{"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 ( - 109 ≤ xi, yi ≤ 109) — the coordinates of the i-th point. It is guaranteed that all points are distinct.", "output_spec": "Print a single number — 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\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\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 \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=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 \n#include \nint midd;\nint mid(int num1,int num2,int num3)\n{\n if(num2>num3&&num2num1)\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\nint swap(int a,int d,int b,int e,int c,int f)\n{\n\tif(a==b)\n\t{\n\t\tif((dd&&fe&&fe))return 3;\n\t\telse return 2;\n\t}\n\tif(a==c)\n\t{\n\t\tif((dd&&ef&&ef)))return 3;\n\t\telse return 2;\n\t}\n\tif(b==c)\n\t{\n\t\tif((ee&&df&&df))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 \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[1]>y[3] && y[2]y[2]) || (y[1]>y[2] && y[3]y[1]) || (y[3]>y[1] && y[2]x[3]) || (x[1]>x[3] && x[2]x[2]) || (x[1]>x[2] && x[3]x[1]) || (x[3]>x[1] && x[2]\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=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\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[9-e-f]&&a[f]>a[9-e-f])||(a[e]\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 \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\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) && vy){\n return x;\n }else{\n return y;\n }\n}\n"}, {"source_code": "#include\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 \n#include \n#include \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\n#include\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 \n\nint min(int a, int b)\n{\n\treturn ab?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 \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 \n#include \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\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 \n#include \n#include \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 \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 \n#include \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 \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\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 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 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 \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\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\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\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\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\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\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 \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 \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 \n#include \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 \n#include \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 \n#include \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 \n#include \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\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\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&&fd&&fe&&f\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\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&&fd&&fe&&f\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 \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[1]>x[3] && x[2]x[2]) || (x[1]>x[2] && x[3]x[1]) || (x[3]>x[1] && x[2]\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[1]>y[3] && y[2]y[2]) || (y[1]>y[2] && y[3]y[1]) || (y[3]>y[1] && y[2]\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\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\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\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\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 && ((x3x2 && x3>x1) ) )\n count=2;\n else if(x2==x3 && ((x1x2 && x1>x3) ))\n count=2;\n else if(x2==x3 && ((x1x2 && x1>x3)))\n count=2;\n else if(y1==y2 && ((y3y2 && y3>y1) ) )\n count=2;\n else if(y2==y3 && ((y1y2 && y1>y3) ))\n count=2;\n else if(y2==y3 && ((y1y2 && y1>y3)))\n count=2;\n else\n count=3;\n\n printf(\"%ld\", count);\n return 0;\n}\n"}, {"source_code": "#include\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 \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 \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 y2 && y1 >y3) || ((y1 y1 && y2 >y3) || ((y2 x2 && x1 >x3) || ((x1 x1 && x2 >x3) || ((x2 x1 && x3 >x2) || ((x3\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\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(xy){\n return x;\n }else{\n return y;\n }\n}\n"}, {"source_code": "#include\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\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\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\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\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(xy){\n return x;\n }else{\n return y;\n }\n}\n"}, {"source_code": "#include\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\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(xy){\n return x;\n }else{\n return y;\n }\n}\n"}, {"source_code": "#include \n#include \n#include \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 \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 \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 \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 \n#include \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 \n#include \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\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\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 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\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 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 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\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 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$$$) — 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\n#include\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\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 \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\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\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 \n#include \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\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 \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 \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 \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 \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\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;imax)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\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 \n#include \n#include \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 \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 \n#include \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 max)\n max = r;\n }\n printf(\"%\"PRIu64\"\\n\", max);\n return 0;\n}\n\n"}, {"source_code": "#include \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\n#include \n#define ll long long\n\nint main()\n{\n\tll a[14],b[14]={0},c[14];\t//b数组用来存储每次模拟的结果,a数组用来模拟. \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是每个洞都要加的个数 \n\t\tm=a[i]%14;\t //m是循环的次数 \n\t\ta[i]=0; //模拟将石头取出 \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\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 \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\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; jk){\n k=r;\n }\n }\n }\n printf(\"%lld\", k);\n}"}, {"source_code": "#include \n#include \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\n#include \n#define ll long long\n\nint main()\n{\n\tll a[14],b[14]={0},c[14];\t//b数组用来存储每次模拟的结果,a数组用来模拟. \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是每个洞都要加的个数 \n\t\tm=a[i]%14;\t //m是循环的次数 \n\t\ta[i]=0; //模拟将石头取出 \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\n#include\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;itemp)?max:temp;\n }\n printf(\"%lld\",max);\n}\n"}, {"source_code": "#include \n#include \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\n#include\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 \n#include\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 \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 \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 \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;k10)\n \t{\n \t\tfor(k2=0;k2score)score=s;\n \t\tfor(k2=0;k2\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 \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\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 \n#include \n#include \n#include \n#include \n#include \n#include \n#include \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\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\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 \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 \n#include \n#include \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 \n#include \n#include \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\n#include\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\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\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\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\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\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\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\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\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=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\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\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 \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 \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 \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 \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 \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 \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 \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;jc2) c2 = c1 ;\n c1 = 0;\n }\n printf(\"\\n%lld\",c2);\n}"}, {"source_code": "#include \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 \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 \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\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;imax)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\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;imax)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\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\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\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\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\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\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 \n#include \n#include \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 \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 \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 \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 \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 \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\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; jk){\n k=r;\n }\n }\n }\n printf(\"%d\", k);\n}"}, {"source_code": "#include\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; jk){\n k=r;\n }\n }\n }\n printf(\"%d\", k);\n}"}, {"source_code": "#include \n#include \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 \n#include \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 \n#include \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 \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 \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 \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 \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\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 \n#include \n#include \n#include \n#include \n#include \n#include \n#include \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 \n#include \n#include \n#include \n#include \n#include \n#include \n#include \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\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=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\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\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\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 \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 \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 \n#include \n#include \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\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 \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\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\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\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\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\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 \n #include \n #include \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 \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\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 \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 \n#include \n#include \n#include \n#include \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\n#include\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&&ab)\n {\n p=a;\n q=p+1;\n printf(\"%d %d\",p,q);\n }\n else if(m>=2&&m<8&&a>b||ab)\n\n printf(\"-1\");\n\n\n }\n\n\n\n\n"}, {"source_code": "#include\n#include\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 \n#include \n\nint main()\n{\n int l,m,i,p;\nscanf(\"%d %d\",&m,&p);\nif(m

\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 \n#include \n#include \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\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 \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 \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 \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\n#define lli long long int\nint main(void)\n{\n\tlli a,b;\n\tscanf(\"%lld %lld\",&a,&b);\n\tif(a\n#include\n#include\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n\n\n if(a=2||a>b){\n printf(\"-1\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \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 \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 \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 \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 \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 \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 \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\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\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(aa)\n printf(\"-1\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include \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\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\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\nint main()\n{\n int num1,num2;\n scanf(\"%d %d\",&num1,&num2);\n if(num1<=9&&num2<=9)\n {\n if(num1\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\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 \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 \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\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\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\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\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\n#include\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&&ab)\n {\n p=a;\n q=p+1;\n printf(\"%d %d\",p,q);\n }\n else if(j>=2&&j<8&&a>b||ab)\n\n printf(\"-1\");\n\n\n }\n"}, {"source_code": "#include \n#include \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 \n#include \n\nint main()\n{\n int l,m,i,p;\nscanf(\"%d %d\",&m,&p);\nif(m

\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\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\n#include\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\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\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\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 \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\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 \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 \n#include \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\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\n#include\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&&ab)\n {\n p=a;\n q=p+1;\n printf(\"%d %d\",p,q);\n }\n else if(j>=2&&j<8&&a>b||ab)\n\n printf(\"-1\");\n\n\n }\n"}, {"source_code": "#include\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 \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\n#include\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&&ab)\n {\n m=a;\n q=m+1;\n printf(\"%d %d\",m,q);\n }\n else if(s>=2 && s<8 && a>b||ab)\n {\n \tprintf(\"-1\");\n\t\t\t}\n\treturn 0;\n}"}, {"source_code": "#include\n#define lli long long int\nint main(void)\n{\n\tlli a,b;\n\tscanf(\"%lld %lld\",&a,&b);\n\tif(a\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 \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\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 \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\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\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 \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\n#include\n#include\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n\n\n if(a=2||a>b){\n printf(\"-1\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include\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\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\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 \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 \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 \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\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\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\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 \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\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\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 \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\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\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\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\n#include\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\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 \n#include \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\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\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 \nint can(int a, int b) {\n if ((a<=b && b\n#include \n#include \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\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 \n#include \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\n#include\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 \n#include\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\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\n#include\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\n#include\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\n#include\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 \n#include \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\n#include\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&&ab)\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\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\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\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\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\n#include\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\n#include\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\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\n#include\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 \n#include \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 \n#include \n#include \n#include \n#include \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 \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 \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 \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 \n#include\n#include\n#include\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\n#include \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\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\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 \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\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 \n#include \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\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\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\n#include\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 \n#include \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 \n#include \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 \n#include \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 \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\n#include\n#include\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\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\n#include\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\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\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\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\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 \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\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 \n#include \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\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\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 \n#include \n\nint main()\n{\n int l,m,i,p;\nscanf(\"%d %d\",&m,&p);\nif(m

\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\n#include\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\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\n#include\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\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 \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\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\n#include\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\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\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\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\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 \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\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 \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 \n#include \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 \n#include \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\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\n#include\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&&ab)\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\n#include\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\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 \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\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 \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 \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 \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\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 \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 \n#include \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\n#include\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\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\n#include\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\n#include\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&&ab)\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 \n#include \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\n#include\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\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\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=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\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 \n#include \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 \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\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\n#include\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\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\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 \n#include \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 \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\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\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(aa)\n printf(\"-1\\n\");\n\n return 0;\n}\n\n"}, {"source_code": "#include\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 — to $$$12$$$.Pay attention to the difference to the traditional roman system — 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$$$) — the number of roman digits to use.", "output_spec": "Output a single integer — 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 — 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 \n#include \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\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ö��y���ó�\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ȡn��\n����1ʽ������5ȡ0~8�μ��ɣ�ʣ�µĴ�1,10,50ȡ\n����2ʽ����5ȡ1�λ�����ʱ������10ȡ0~4�μ��ɣ�ʣ�µĴ�1,50ȡ\n����3ʽ����5ȡ0��ʱ������10ȡ0~48�μ��ɣ�ʣ�µĴ�1,50ȡ\n����4ʽ����5ȡ1��ʱ������1ȡ35�λ�50ȡ8�μ���\n����5ʽ����5ȡ1��ʱ������1ȡ30�λ�50ȡ7�μ���\n...\n����11ʽ����5ȡ1��ʱ������1ȡ0�λ�50ȡ1�μ���\n���ϣ�����5ȡ0�Σ�10ȡ0~48��\n5ȡ1�Σ�10ȡ0~4�Σ�1ȡ0~34�λ�50ȡ0~7��\n5ȡ2�Σ�10ȡ0~4�Σ�1ȡ0~29�λ�50ȡ0~6��\n...\n5ȡ8�Σ�10ȡ0~4�Σ�1ȡ0�λ�50ȡ0~1�ε��������\n1,50ȡn�Σ���n+1�ֽ��\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 \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \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\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 \n#include \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\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ȡn��\n����1ʽ������5ȡ0~8�μ��ɣ�ʣ�µĴ�1,10,50ȡ\n����2ʽ����5ȡ1�λ�1������ʱ������10ȡ0~4�μ��ɣ�ʣ�µĴ�1,50ȡ\n����3ʽ����5ȡ0��ʱ������10ȡ0~48�μ��ɣ�ʣ�µĴ�1,50ȡ\n���ϣ�����5ȡ1~8�Σ�10ȡ0~4�κ�5ȡ0�Σ�10ȡ0~48�ε��������\n1,50ȡn�Σ���n+1��ֵ\n4\t5*8+50*1=10*9\n�ٿ������������\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\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ȡn��\n����1ʽ������5ȡ0~8�μ��ɣ�ʣ�µĴ�1,10,50ȡ\n����2ʽ����5ȡ1�λ�1������ʱ������10ȡ0~4�μ��ɣ�ʣ�µĴ�1,50ȡ\n����3ʽ����5ȡ0��ʱ������10ȡ0~48�μ��ɣ�ʣ�µĴ�1,50ȡ\n����4ʽ����5ȡ8��ʱ������50ȡ0�μ��ɣ�ʣ�µĴ�1,10ȡ\n����5ʽ����5ȡ7��ʱ������1ȡ0~4�λ�50ȡ0~1�μ���\n���ϣ�����5ȡ1~6�Σ�10ȡ0~4�Ρ�5ȡ0�Σ�10ȡ0~48�Ρ�5ȡ8�Σ�10ȡ0~4�Σ�50ȡ0�Ρ�5ȡ7�Σ�10ȡ0~4�Σ�1ȡ0~4�Ρ�5ȡ7�Σ�10ȡ0~4�Σ�50ȡ0~1�ε��������\n1,50ȡn�Σ���n+1��ֵ\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\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ȡn��\n����1ʽ������5ȡ0~8�μ��ɣ�ʣ�µĴ�1,10,50ȡ\n����2ʽ����5ȡ1�λ�1������ʱ������10ȡ0~4�μ��ɣ�ʣ�µĴ�1,50ȡ\n����3ʽ����5ȡ0��ʱ������10ȡ0~49�μ��ɣ�ʣ�µĴ�1,50ȡ\n���ϣ�����5ȡ1~8�Σ�10ȡ0~4�κ�5ȡ0�Σ�10ȡ0~49�ε��������\n1,50ȡn�Σ���n+1��ֵ\n4\t5*8+50*1=10*9\n�ٿ������������\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 \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \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 \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \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 — 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\n#include\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\nint main(){\n char s[105];\n int i,k=0,d=0,len;\n scanf(\"%s\",s);\n for(i=0;i\n#include\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; ima)\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\n#include\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; ima)\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\n#include\n#include\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;ig)\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 \n#include \n#include \n#include \n#include \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 \n#include \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 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\n#include\n#include\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;imax)\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\n#include\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;it) 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 \n#include\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\n#include\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#include \n#include \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\n#include\n#include\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\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=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 \n#include \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\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\n#include\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;imax){\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 \n#include \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;ians){\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\n#include\n#include\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\n#include\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;imax)max=curr-pr;\n\n\tpr=curr;\n\t}\n\tprintf(\"%d\",max);\n}\n"}, {"source_code": "#include\n#include\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\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 \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\n#include\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=1){count--;}\n //printf(\"%d %d\\n\",p++,count);\n if(i==0) {r=count;\n q=r;}\n if(q=1)\n printf(\"%d\\n\",q+1);\n return 0;\n}\n"}, {"source_code": "#include\n#include\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\n#include\nint main()\n{\n\tint i,cnt=1,max=-1;\n\tchar s[102];\n\tgets(s);\n\tfor(i=0;imax) max=cnt;\n\t}\nprintf(\"%d\",max);\n}\n"}, {"source_code": "#include\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;imax)\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\n#include\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\n#include\n#include\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;im)\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\n#include\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 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 \n#include \n#include \n#include \n\n \nint notupper(char *ch) {\n\t\n\t int i=0;\n\twhile(i91) {\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;imax){\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\n#include\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;imax)\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\n#include\nint main()\n{\n\tint i,cnt=1,max=-1;\n\tchar s[102];\n\tgets(s);\n\tfor(i=0;imax) max=cnt;\n\t}\nprintf(\"%d\",max);\n}\n"}, {"source_code": "#include\nint main(){\n char s[105];\n int i,k=0,d=0,len;\n scanf(\"%s\",s);\n for(i=0;i\n#include \n#include \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\n#include\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;ipos){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\n#include\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\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=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 \n#include \n#include \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(ik){\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\n#include\n#include\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 \n#include \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 \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(maxi-p?max:i-p;\n\nprintf(\"%d\\n\",max);\n\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n#include \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(ik){\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\n#include\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;i0)\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\n#include\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\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 \n#include \n\nint main()\n{\n char s[101];\n scanf(\"%s\",s);\n int j,k=1,max=-1;\n for (j=0;j\n#include \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\n#include\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\n#include\nint main()\n{\nchar s[101];\nscanf(\"%s\",s);\nint l=strlen(s);\nint m=1,w=0,i;\nfor(i=0;i=w)\nw=m;\n}\nprintf(\"%d\\n\",w);\nreturn 0;\n}"}, {"source_code": "#include \n#include \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; imax) {\n max = a;\n }\n a = 1;\n } else {\n a++;\n }\n }\n if(max\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\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\n#include\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;imax)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\n#include\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\nint main()\n{\n char s[200];\n int a=-1,count=0,max=0,i;\n scanf(\"%s\",s);\n for(i=0;imax&&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\n#include\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;imax)\n {\n max=p[i];\n }\n }\n }\n printf(\"%d\",max);\n}\n"}, {"source_code": "#include \n#include \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\n#include\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=w)\n\t\t\tw=m;\n\t}\n\tprintf(\"%d\\n\",w);\n\n\treturn 0;\n}"}, {"source_code": "#include//\n#include\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\n#include\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\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\n#include \n#include \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 \n#include \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 \n#include \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\n#include\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=w)\n\t\t\tw=m;\n\t}\n\tprintf(\"%d\\n\",w);\n\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n#include \n#include \n#include \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\n#include\nint main()\n{\n char a[100];\n scanf(\"%s\",a);\n\n int i,count=1,d=0;\n for(i=0;id)\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\n#include\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\n#include \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\n#include\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;ix)\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 \n#include \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\n\nint main()\n{\n int jump=1, ja=1, i, j;\n char s[101];\n scanf(\"%s\", s);\n for(i=0; ija)\n ja=jump;\n }\n else\n jump=1;\n }\n\n printf(\"%d\\n\", ja);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n\tint i,cnt=1,max=-1;\n\tchar s[102];\n\tgets(s);\n\tfor(i=0;imax) max=cnt;\n\t}\nprintf(\"%d\",max);\n}\n"}, {"source_code": "#include\n#include\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; im)\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\n#include\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;ik) 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 \n#include \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 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\n#include\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=max)\n\tmax=a[i];\n\t}\n\tprintf(\"%d\",max);\n\treturn 0;\n\t\n}"}, {"source_code": "#include\n#include\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\n#include\n#include\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;ig)\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\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\n#include\nint max(int a,int b)\n{\n\treturn a>b?a:b;\n}\nint min(int a,int b)\n{\n\treturn a\n#include\n#include\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;im)\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\n#include\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\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\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\n#include\nint main()\n{\n char a[202];\n scanf(\"%s\",a);\n int i,b[202]={0},x=0;\n for(i=0;i=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;i0&&i\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;imax) 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\n#include\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#include\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\n#include\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\n#include\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;is)\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 \n#include \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\n#include\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\n#include\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;imax)\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\n#include\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\n#include\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;i0)\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\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\n#include\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\n#include\n#include\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 \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\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\n#include\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;imax)\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\n#include\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 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\n#include\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=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 \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\n#include\nint main()\n{\n char s[101];\n gets(s);\n int i,count=0,max=0;\n for(i=0;imax) max=count+1;\n count=0;\n }\n }\n printf(\"%d\",max);\n return 0;\n}\n"}, {"source_code": "#include \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\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\n#include\n#include\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 \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 \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\n#include \nint main()\n{\n char a[101];\n gets(a);\n int i,j,count ,max=0,b;\n for(i=0;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\n#include \n#include \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(ik){\n k=h+1;\n\n }\n h=0;\n s=0;\n }\n i=i+1;\n }\n if((c==0)&&(k\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\n#include\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;imax)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\n#include\n#include\n#include \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\n#include\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 \n#include \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; imax) {\n max = a;\n }\n a = 1;\n } else {\n a++;\n }\n }\n if(max\n#include \n#include \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=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 \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\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\n#include \n#include \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;ijump)\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\n#include\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;il)\n l=k;\n }\n }\n printf(\"%d\",l);\n}\n"}, {"source_code": "#include\n#include\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;imaxdif) maxdif=dif;\n }\n firstbound=indexcol[0];\n lastbound=l-indexcol[j-1];\n if(lastbound=lastbound && flag==1) printf(\"%d\", maxdif);\n else if(maxdif\n#include\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\n#include \n#include \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\n#include\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;imax){\n max=i-prev;\n }\n prev=i;\n }}\n \n printf(\"%d\",max);\n}"}, {"source_code": "#include \n#include \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\n#include \n#include \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 \n#include \n#include \n#include \n\n \nint notupper(char *ch) {\n\t\n\t int i=0;\n\twhile(i91) {\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;imax){\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 \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\n#include\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;imax)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\n#include\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 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 \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 \n#include \n#include \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;imax)\n max=i-last;\n last=i;\n }\n }\n printf(\"%d\",max);\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\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\n#include \n#include \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=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\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\n#include\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;imaxdif) maxdif=dif;\n }\n printf(\"%d\", maxdif);\n return 0;\n}\n"}, {"source_code": "#include\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;ijum)\n jum=n;\n}\nprintf(\"%d\\n\",jum);\nreturn 0;\n}\n"}, {"source_code": "#include\n#include\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=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 \n#include \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\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\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\n#include \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;ians){\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\n#include\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=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\n#include\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;imaxJump)\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\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=max) max=z;\n else max=max;\n }\n printf(\"%d\", max);\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \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 \n#include \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 \n#include \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 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\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\n#include \n\nint main()\n{\n char s[101];\n scanf(\"%s\",s);\n int j,k=1,max=-1;\n for (j=0;j\n#include \n#include \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;in)\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\n#include\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;imax)\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 \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 \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\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\n#include\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;imax){\n max=i-prev;\n }\n prev=i;\n }}\n \n printf(\"%d\",max);\n}"}, {"source_code": "#include\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\n#include \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 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 \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 \n#include \n#include \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\n#include\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;imax)\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\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\n#include\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;i0){\n\t\tprintf(\"%d\",count);\n\t}\n\telse{\n\t\tfor(i=0;i\n#include \n#include \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=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 \n#include \n#include \n#include \n\n \nint notupper(char *ch) {\n\t\n\t int i=0;\n\twhile(i91) {\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;imax){\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 \n#include\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 \n#include \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;imax)\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 \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 \n#include \n#include \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\n#include\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;is)\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\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;imax) 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\n#include\n#include\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;ig)\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\n#include\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\n#include \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 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\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 \n#include\n#include\n#include\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 \n#include \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 \n#include \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(is)\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\n#include\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;imax)\n max=k;\n }\n else\n i++;}\n printf(\"%d\",max);\n\n}\n"}, {"source_code": "#include \n#include\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\n#include \n\nint main ()\n{\n char s[100];\n gets(s);\n int i,k=0,c,d=1;\n for(i=0;id) 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\n#include\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; ires){\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\n#include\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;id)\n\t\td=a;\n\t\t}\n\t\t\n\t}\n\tprintf(\"%d\",d);\n\t\n}"}, {"source_code": "#include\n#include\n#include\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;imax)max=dis;\n }\n printf(\"%d\",max);\n}\n"}, {"source_code": "#include\n#include\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;ich[1]) ch[1]=MIN;\n }\n printf(\"%d\\n\",ch[1]);\n return 0;\n\n\n}\n"}, {"source_code": "#include\n#include\n#include\n#include \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\n#include\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;imax)\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\n#include\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;imax)\n {\n max=p[i];\n }\n }\n }\n printf(\"%d\",max);\n}\n"}, {"source_code": "#include\n#include\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 \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\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=max) max=z;\n else max=max;\n }\n printf(\"%d\", max);\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\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 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\n#include\nint main()\n{\n\tchar str[101];\n\tscanf(\"%s\",str);\n\tint i,j;\n\tint max=0;\n\n\tfor(i=0;imax)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\n#include\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\n#include\nint main()\n{\n int i,count=0,r,q,t=0;\n char ch[101];\n gets(ch);\n for(i=0;i=1){count--;}\n if(i==0) {r=count;\n q=r;}\n if(q=1)\n printf(\"%d\\n\",q);\n return 0;\n}\n"}, {"source_code": "#include\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\n#include\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\n#include\n#include\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\n#include\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; k3)\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\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\n#include \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\n#include\n#include\n#include\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\n#include\n#include\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 \n#include\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\n#include\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\n#include\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\n#include \n#include \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\n#include\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; k3)\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\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 \n#include \n#include \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\n#include\n#include\n#include\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\n#include \n#include \n#include \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\n#include\n#include\n#include\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\n#include\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=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;istrlen(c)-1){d[k+3]='\\0';puts(d);}\n else{\n\n d[k+3]='/';o=k+4;\n for(i=s;i\n#include\n#include\n#include\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\n#include \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\n#include\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\n#include\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\n#include \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\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\n#include\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=0;m--)\n {\n if(s[m]=='u' && s[m-1]=='r')\n break;\n }\n for(i=j;i\n#include\n#include\n#include\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\n#include \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\n#include \n#include \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\n#include\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#include \n#include \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 \n#include \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 \n#include \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\n#include\n#include\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\n#include\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;i6*/)){\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;i5*/)){\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;i6)){\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;i5)){\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\n#include \n#include \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\n#include\n#include\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\n#include \n#include \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 \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\n#include\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\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\n#include \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\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\n#include\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\n#include\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\n#include\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\n#include \n#include \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 \n#include \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 \n#include \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\n#include\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#include\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 \n#include \n#include \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\n#include\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#include\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;j6){\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\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 \n#include \n#include \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\n#include\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;i6*/)){\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;i5*/)){\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;i6)){\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;i5)){\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\n#include \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 \n#include \n#include \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\n#include\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\n#include\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#include\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=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;istrlen(c)-1){d[k+3]='\\0';puts(d);}\n else{\n\n d[k+3]='/';o=k+4;\n for(i=s;i\n#include \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 \n#include \n#include \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\n#include\n#include\n#include\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\n#include \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\n#include\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 \n#include \n#include \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\n#include\n#include\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 \n#include \n#include \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\n#include\n#include\n#include\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\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\n#include\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\n#include \n#include \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; in; 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\n#include\n#include\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\n#include\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\n#include\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=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;istrlen(c)-1){d[k+3]='\\0';puts(d);}\n else{\n\n d[k+3]='/';o=k+4;\n for(i=s;i\n#include\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\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 \n#include \n#include \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 \n#include \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 \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 \n#include \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\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\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 \n#include \n#include \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; in; 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\n#include\n#include\n#include\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\n#include \n#include \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 \n#include \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\n#include\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\n#include\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\n#include \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 \n#include \n#include \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 \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\n#include\n#include\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\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 \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 \n#include \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 \n#include \n#include \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 \n#include \n#include \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\n#include \n#include \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\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 \n#include \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\n#include\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\n#include\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\n#include\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 \n#include \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#include \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\n#include \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\n#include\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\n#include\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 \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\n#include\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\n#include \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\n#include\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\n#include\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\n#include\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;i6*/)){\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;i5*/)){\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;i6)){\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;i5)){\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\n#include\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\n#include \n#include \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\n#include\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\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\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#include \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\n#include \n#include \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; in; 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\n#include \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\n#include\n#include\n#include\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)\n#include \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\n#include\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\n#include\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\n#include\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\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 \n#include \n#include \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\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#include\n#include\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\n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \n#define CARACTERES 50\nint posExtension(int indice, char string[CARACTERES]);\n\nint main(){\n /* Declaración 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 \n#include \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\n#include\n#include\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\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 \n#include \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\n#include\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\n#include\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 \n#include \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 \n#include \n#include \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\n#include\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\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 \n#include \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\n#include\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#include \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\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 \n#include \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\n#include\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\n#include \n#include \n#include \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\n#include\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;j6){\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\n#include \n#include \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\n#include\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\n#include \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\n#include\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\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\n#include\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#include \n#include \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\n#include\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\n#include\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=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\n#include\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;i6*/)){\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;i5*/)){\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;i6)){\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;i5)){\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\n#include \n#include \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\n#include\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\n#include\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\n#include\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\n#include\n#include\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\n#include\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\n#include\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\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 \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\n#include\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\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\n#include \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\n#include\n#include\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\n#include \n#include \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\n#include \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\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\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\n#include\n#include\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\n#include\n#include\n#include\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\n#include \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\n#include\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\n#include\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 \n#include \n#include \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 \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 \n#include \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\n#include\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 \n#include \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 \n#include \n#include \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\n#include \n#include \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\n#include\n#include\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\n#include\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\n#include\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 \n#include \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\n#include\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;i6*/)){\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;i5*/)){\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;i6)){\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;i5)){\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\n#include\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\n#include\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\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\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 \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\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=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;jt[j])\n\t\treturn 1;\n\telse if(s[i]0 && a[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;i0 && 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[l])\n\t\tf=1;\n\tif(r0)\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;j0){\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'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 && ind;j++)\n\t\t\tfor(k=0;flag &&kid==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;in;i++){\n\t\tif(p->nei[i]==-1)\n\t\t\tcontinue;\n\t\tfor(j=0;jnei[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;kn;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;in;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;il){\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;ihome=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;jnp;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;idxhome-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;idx2pre[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;idxhome%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;idxnp==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\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\n#include\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 \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\n#include \n#include \n#include \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){\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\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=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\n#include\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=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\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=(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\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=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\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\n#include \n#include \n#include \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<=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\n#include\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\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 \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 \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\n#include\n#include\n#define SORT(a,n) qsort(a,n,sizeof(int),intcmp)\n#define s(n) scanf(\"%d\",&n)\n#define sc(n) scanf(\"%c\",&n)\n#define sl(n) scanf(\"%I64d\",&n)\n#define sf(n) scanf(\"%lf\",&n)\n#define ss(n) scanf(\"%s\",n)\n#define 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\n#include\n#include\n#define SORT(a,n) qsort(a,n,sizeof(int),intcmp)\n#define s(n) scanf(\"%d\",&n)\n#define sc(n) scanf(\"%c\",&n)\n#define sl(n) scanf(\"%I64d\",&n)\n#define sf(n) scanf(\"%lf\",&n)\n#define ss(n) scanf(\"%s\",n)\n#define 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;it[j])\n\t\treturn 1;\n\telse if(s[i]0 && a[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;i0 && 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[l])\n\t\tf=1;\n\tif(r0)\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;j0){\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'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 && ind;j++)\n\t\t\tfor(k=0;flag &&kid==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;in;i++){\n\t\tif(p->nei[i]==-1)\n\t\t\tcontinue;\n\t\tfor(j=0;jnei[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;kn;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;in;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;il){\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;ihome=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;jnp;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;idxhome-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;idx2pre[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;idxhome%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;idxnp==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=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;jt[j])\n\t\treturn 1;\n\telse if(s[i]0 && a[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;i0 && 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[l])\n\t\tf=1;\n\tif(r0)\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;j0){\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'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 && ind;j++)\n\t\t\tfor(k=0;flag &&kid==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;in;i++){\n\t\tif(p->nei[i]==-1)\n\t\t\tcontinue;\n\t\tfor(j=0;jnei[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;kn;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;in;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;il){\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;ihome=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;jnp;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;idxhome-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;idx2pre[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;idxhome%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;idxnp==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=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;jt[j])\n\t\treturn 1;\n\telse if(s[i]0 && a[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;i0 && 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[l])\n\t\tf=1;\n\tif(r0)\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;j0){\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'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 && ind;j++)\n\t\t\tfor(k=0;flag &&kid==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;in;i++){\n\t\tif(p->nei[i]==-1)\n\t\t\tcontinue;\n\t\tfor(j=0;jnei[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;kn;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;in;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;il){\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;ihome=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;jnp;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;idxhome-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;idx2pre[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;idxhome%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;idxnp==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=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;jt[j])\n\t\treturn 1;\n\telse if(s[i]0 && a[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;i0 && 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[l])\n\t\tf=1;\n\tif(r0)\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;j0){\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'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 && ind;j++)\n\t\t\tfor(k=0;flag &&kid==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;in;i++){\n\t\tif(p->nei[i]==-1)\n\t\t\tcontinue;\n\t\tfor(j=0;jnei[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;kn;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;in;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;il){\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;ihome=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;jnp;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;idxhome-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;idx2pre[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;idxhome%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;idxnp==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;i2){\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\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\n#include\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\n#include\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=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\n#include\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 \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\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 \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\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\n#include \n#include \n#include \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){\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\n#include \n#include \n#include \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; iS){\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\n#include \n#include \n#include \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; iS){\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\n#include \n#include \n#include \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){\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\n#include \n#include \n#include \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){\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\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\n#include\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=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\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=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\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=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\n#include \n#include \n#include \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 \n#include \n#include \n#include \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 ≤ n ≤ 15, 1 ≤ l ≤ r ≤ 109, 1 ≤ x ≤ 106) — 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, c2, ..., cn (1 ≤ ci ≤ 106) — 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 — 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\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 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\nvoid print(int *a,int n){\n\tint i;\n\tfor(i=0;i0)\n\t{\n\t\tif((i&1)==1){\n\t\t\tsum+=a[j];\n\t\t\tif(maxa[j])\n\t\t\t\tmin=a[j];\n\t\t}\n\t\ti=(i>>1);\n\t\tj++;\n\t}\n\tif(max-minr)\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\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]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#include\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;countermax)\n\t\t\t\tmax=a[j];\n\t\t\t\tif(a[j]=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\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#include\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;jmax) max=data[j];\n else if(data[j]=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#include \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;i0)\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 \n#include \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<ar[i])\n min=ar[i];\n if(max=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#include \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; imax) max=c[i];\n if (c[i]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\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=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;ia[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#include \n#include \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 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\n#include\n#include\n#include\n#include\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;i0)\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

max)\n\t\t\t\t\tmax=a[k];\n\t\t\t\tif(a[k]=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 \n#include \n#include \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=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=l))\n z++;\n }\n }\n\n printf(\"%d\",z);\n\n\n return 0;\n}\n"}, {"source_code": "#include\n#include \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>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]=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\n#include\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\n#include\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=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;ia[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\n#include\n#define fr(i,n) for(i=0;iarr[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\n#include\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;ia[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 \n#include \n#include \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 \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\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*(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#include \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\n#include\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#include\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=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#include\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;imax)\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 \n#include \n#include \n#include \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 \n#include \n#include \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;j1)\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\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\n#include\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=x && sum>=l && sum<=r){\n ans++;\n }\n }\n printf(\"%lld \", ans);\n\n\n\n return 0;\n}\n"}, {"source_code": "#include\n#define MAXN 20\n#define Max(a,b) a>b?a:b\n#define Min(a,b) a1&&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#include \n#include \n#include \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;imax)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 \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;ic[i]?Max:c[i];\n\t\t\tMin=Min=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#include\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; imax)\n max=arr[j];\n if(arr[j]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\n#include\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;ihigh)\n high=a[j];\n if(a[j]1&&(high-low>=x)&&sum>=l&&sum<=r)\n ans++;\n }\n printf(\"%lld\",ans);\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \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=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;ir)\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\n#include\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;ia[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 \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 \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;ia[k])\n mind=a[k];\n if(maxd=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\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;ia[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; jdata[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 \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;ic[i]?Max:c[i];\n\t\t\tMin=Min=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#include\n#include\n#include\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 ab? 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]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 ib[i])\n minimum = b[i];\n if(maximum 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 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 %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<>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\n#include\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=x && sum>=l && sum<=r){\n ans++;\n }\n }\n printf(\"%I64d \", ans);\n\n\n\n return 0;\n}"}, {"source_code": "#include\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= 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;p0;p--)\n\t\tfor(q=0;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= 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 \n#include \n#include \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< 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\n#define min(a,b) ((a)<(b)?(a):(b))\n#define max(a,b) ((a)>(b)?(a):(b))\n#include\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;ir)\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\n#include \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>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]=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 \n#include \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<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#include\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;ibig)\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 \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;imax)\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#include \n#include \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;igreatest)greatest = a[j];\n\t\t\t\tif(a[j]=l&&sum<=r&&abs(greatest-smallest)>=x)ans++;\n\t}\n\tprintf(\"%I64d\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include \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;imax)\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\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]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\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;kr[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;imax)\n max=k;\n if(k=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 \n#include \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 \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;imax)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\n#include \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>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]=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\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]=x&&d[k]>=l&&d[k]<=r)\n count++;\n }\n\n\n}\nprintf(\"%d\\n\",count);\nreturn 0;\n}\n"}, {"source_code": "#include \n#include \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 \n#include \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\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;imax)\n\t\t\t\t\tmax=input[i];\n\t\t\t\tif(input[i]r)\n\t\t\treturn;\n\t\tif((max-min)\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;ihard[i])\n\t\t\t\t\tmin=hard[i];\n\t\t\t\tif(max=l))\n\t\t\treturn;\n\n\t\tif(max-min\n#include \n#include \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<max)\n \t max=set[j];\n \t if(set[j]=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#include \n#include \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\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=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=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#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; imax)max=b[i];\n if(b[i]=x) && (sum>=l)) {\n //print(b,cm);\n counter++;\n }\n } else {\n for(i=set; i\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=x) && (sum>=l)) {\n //print(b,cm);\n counter++;\n }\n } else {\n for(i=set; i\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; imax)max=b[i];\n if(b[i]=x) && (sum>=l)) {\n //print(b,cm);\n counter++;\n }\n } else {\n for(i=set; i\n#include\n#include\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=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 \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 \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 \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 \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 \n#include \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=2 && sum>=l && sum<=r && high-low>=x)\n res++;\n }\n printf(\"%d\",res);\n return 0;\n}\n"}, {"source_code": "#include \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\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<max)\n\t\t\t\tmax= A[cnt2];\n\t\t\t\tif(A[cnt2]=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 \n#include \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\n#include\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 \n#include \n#include \n#include \n#include \n#include \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\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 \n#include \n#include \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\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]=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\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\n#include\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= 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\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]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#include \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<=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\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*(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#include\n#include\n#include\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 ab? 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]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 ib[i])\n minimum = b[i];\n if(maximum 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 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 %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<>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\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=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\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;ihard[i])\n\t\t\t\t\tmin=hard[i];\n\t\t\t\tif(max=l))\n\t\t\treturn;\n\n\t\tif(max-min\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=x) && (sum>=l)) {\n counter++;\n }\n } else {\n int i;\n for(i=set; i\n#include\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= 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\n#include\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= 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\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 \n#include \n#include \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\n#include \n#include \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\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 \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\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\n//#include\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\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\n#include\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 (vp0)\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 \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\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\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(vd0)\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\n#include\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 \n#include \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) 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 \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 \n#include \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 \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\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\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 \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\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 \n#include \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 \n#include \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 \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 \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 \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 \n#include \n#include \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\n#include\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\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 \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 \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 \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 \n#include \n#include \n#include \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)\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 \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 \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 \n#include \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órym 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\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\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 \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\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\n#include\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=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\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\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\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)\nbreak;\nd+=y*vp;\nk++;\nd+=f*vp;\n}\nprintf(\"%d\",(int)k);\nflag:\nreturn 0;\n}\n\n"}, {"source_code": "#include\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\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 \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 \n#include \n#include \n#include \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 && v_dragon> v_princess)\n printf(\"%i\",cnt);\n else\n printf(\"0\");\n return 0;\n}\n"}, {"source_code": "#include\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 \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\n//#include\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\n//#include\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\n//#include\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\n//#include\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\n//#include\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\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\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\n#include\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\n#include\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 (vp0)\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 \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\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=d1 && d1\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\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=d1 && d1\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 \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 \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 \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 \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 \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 \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\n#include\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\n#include\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 \n#include \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\n#include \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\n#include \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\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\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 \n#include \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 \n#include \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 \n#include \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 \n#include \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 \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 \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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\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 \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 \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 \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 \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 \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 \n#include \n#include \n#include \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)\n#include \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órym 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\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\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\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\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\n#include\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\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\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\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\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)\nbreak;\nd+=y*vp;\nk++;\nd+=f*vp;\n}\nprintf(\"%d\",(int)k);\nreturn 0;\n}\n\n"}, {"source_code": "#include\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=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\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=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\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 \n#include \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\n#include \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=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 \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 \n#include \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\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=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 \n#include \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\n#include \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\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 \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 \n#include \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\n#include\n#include\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\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 \n#include \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=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 \n#include \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\n#include \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=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 \n#include \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\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 \n#include \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=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\n#include\n#include\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\n#include \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\n#include \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\n#include \n#include \n#include \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 printf(\"%i\",cnt);\n return 0;\n}\n"}, {"source_code": "#include\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\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\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 ≤ d, L, v1, v2 ≤ 10 000, d < L) — 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 — 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 - 6. 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\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 \n#include \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 \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 \n#include \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\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\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\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 \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\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\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\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\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\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\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\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\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 \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 \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 \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\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 \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 \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\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 \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 \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\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 \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 \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\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 \n#include \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\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 \n#include \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 \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\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 \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\n#include\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\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 \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 \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\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 \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 \n#include \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 \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\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\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 \n#include \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 \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 \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 \n#include \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 \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 \n#include \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\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 \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 \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\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\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 \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\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\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 \n#include \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\n#include\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 \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 \n#include \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\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 \n#include \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\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\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\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\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 \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\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 \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\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 \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 \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\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\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\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 \n#include \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 \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 \n#include \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 \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 \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\n#include\n#include\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 \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 \n#include \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\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 \n#include \n#include \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)*anst||fabs((v1+v2)*(ans+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 \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 \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 \n\n#include \n#include \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\n#include\n#include\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\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\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 \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 \n#include \n#include \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\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 \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 \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\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\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\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 \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\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 \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\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\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\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 \n#include \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 \n#include \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\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 \n#include \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 \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 \n#include \n#include \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 \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 \n#include \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 \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 \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\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\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\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 \n#include \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\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\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\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 \n#include \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\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\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 \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 \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\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 \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 \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 \n#include \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\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 \n#include \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 \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 \n#include \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\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\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\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 \n#include \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 \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\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 \n#include \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\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 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\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\n#include \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\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\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 \n#include \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 \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 \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 \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 \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 \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 \n#include \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 \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 \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 \n#include \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\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(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\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 \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 \n#include \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 \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 \n#include \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\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 \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 \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 \n#include \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 \n#include \n#include \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\n#include \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 \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 //AA06( 21/ 04/ 20) If u see my code, Have a Good Day! (^_^)\n#include\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 \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\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 \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 \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\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 \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 \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\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 \n#include \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\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 \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\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\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(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 //AA06( 21/ 04/ 20) If u see my code, Have a Good Day! (^_^)\n#include\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\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 \n#include \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\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\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\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 \n#include \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\n#include\n#include\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 \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\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\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 \n#include \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 \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$$$) — 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$$$) — the Petya's array.", "output_spec": "In the first line print integer $$$x$$$ — 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 — 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\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#include \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=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\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=0;b--){\n printf(\"%d \",a[b]);\n }\n return 0;\n\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n#include \n#include \n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a[n];\n int i;\n for(i=0;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\nint main()\n{\n int n,i,j,m=0;\n scanf(\"%d\",&n);\n int a[n+1];\n for(i=0;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\nint main()\n{\n int n,i,j,c=0,a[1001];\n scanf(\"%d\",&n);\n for(i=0; 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\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 \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\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=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\nint main()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n int ara[n];\n \n for(i=0;i\nint main()\n{\n\tint n,a[1000],i,j,count=0;\n\tscanf(\"%d\",&n);\n\tfor(i=0;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\nint main()\n{\n int n,a[55],i,j,cnt,k,b[55];\n scanf(\"%d\",&n);\n for(i=0;i\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\nint main()\n{\n\tint i,c=0,n,x[51],a[1001]={0};scanf(\"%d\",&n);\n\tfor(i=0;i\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=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\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 \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\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=0;i--)\n {\n for(k=0;k\n#include \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#include \n#include \n#include \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\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\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\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\nint main()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n int ara[n];\n \n for(i=0;i\n#include \n#include \n#include \n#include \n#include \n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a[n];\n int i;\n for(i=0;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#include\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=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\nint main()\n{\n int n,x=0,i,j,k;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;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\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\nint main(){\n\tint n,a[50],i,j,r;\n\tscanf(\"%d\",&n);\n\tr=n;\n\tfor(i=0;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\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\nint main()\n{\n int i, j, n, count=0;\n scanf(\"%d\", &n);\n int a[n];\n\n for(i=0;i\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=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\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\nint main()\n{\n int n,i,j,count = 0;\n scanf(\"%d\",&n);\n int ara[n];\n for(i=0;i\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=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\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=0;b--){\n printf(\"%d \",a[b]);\n }\n return 0;\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,i,j,c=0,a[1001];\n scanf(\"%d\",&n);\n for(i=0; 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\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\n\nint main(){\n int n , i , j , x=0 , a[1001];\n scanf(\"%d\",&n);\n for(i=0;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#include\n#include\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=0;i--)\n for(j=i+1;j\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\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=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\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 \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\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=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 \n#include \n#include\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\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=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\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;i0)\n c++;\n }\n printf(\"%d\\n\",c);\n for(p=0;p0)\n printf(\"%d \",a[p]);\n }\n\n return 0;\n\n}\n"}, {"source_code": "#include\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\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=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#include \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\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=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\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=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\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 \n#include \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;i1)\n\t\t{\n\t\t\tb[a[i]]--;\n\t\t\tfor(j=i;j\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\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=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#include \n#include \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\nint main()\n{\n int n,c=0;\n scanf(\"%d\",&n);\n int a[n];\n for(int i=0;i0)\n c++;\n }\n printf(\"%d\\n\",c);\n for(int i=0;i0)\n {\n printf(\"%d \",a[i]);\n }\n }\n}"}, {"source_code": "#include \n\nint main(void) {\nint n;\nscanf(\"%d\",&n);\nint m=0;\nint i,j,ar[n];\nfor(i=0;i0;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#include \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=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\nint main()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n int ara[n];\n \n for(i=0;i\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=0; i--)\n\t\t{ flag=0;\n\t\t\tfor(j=0; j=0; i--)\n printf(\"%d \",b[i]);\n printf(\"\\n\");\n\n\n}\n}"}, {"source_code": "#include \n#include \n\nint main(){\n int t[1001],x[1001],a,i,j;\n scanf(\"%i\",&a);\n for(i=0;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\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#include \n#include \n#include \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\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=0;i--){\n for(j=0;j\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\nint main()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n int ara[n];\n \n for(i=0;i\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\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=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#include \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\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\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#include \n#include \n#include \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\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=0;i--)\n {\n for(k=0;k\nint main()\n{\n int i, j, n, count=0;\n scanf(\"%d\", &n);\n int a[n];\n\n for(i=0;i\nint main()\n{\n int n,x=0,i,j,k;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;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\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=0;i--)\n {\n z=0;\n\n for(j=0;j=0;i--)\n {\n printf(\"%d \",b[i]);\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include\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\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=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\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=0;i--){\n if(b[i]==0){\n printf(\"%d \",a[i]);\n }\n }\n printf(\"\\n\");\n return 0;\n}"}, {"source_code": "#include\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=0;--i)\n printf(\" %d\",a[i]);\n\n return 0;\n}\n"}, {"source_code": "#include\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=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\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\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\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int arr[n];\n for(int i=0; i\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;i0;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\nint main(){\n int n , i , j , x=0 , a[1001];\n scanf(\"%d\",&n);\n for(i=0;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\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#include \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\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\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=0; i--)\n\t{\n\t\tprintf(\"%d \",b[i]);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint i,c=0,n,x[51],a[1001]={0};scanf(\"%d\",&n);\n\tfor(i=0;i\n#include\n\nint main(){\n\tint i,j,n,a[50],temp=0;\n\t\n\tscanf(\"%d\",&n);\n\t\n\tfor(i=0;i0)\n\t\ttemp++;\n\t}\n\tprintf(\"%d\\n\",temp);\n\t\n\tfor(i=0;i0)\n\t\tprintf(\"%d \",a[i]);\n\t}\n}\n\n"}, {"source_code": "#include\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\nint main()\n{\n int i,j,k,l=0,n;\n scanf(\"%d\",&n);\n int arr[20000];\n for(i=0;i=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\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=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\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=0;i--)\n {\n printf(\"%d \",a[i]);\n }\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include \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=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\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#include\n#include\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\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=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#include \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\nint main(){\n\tint n,a[50],i,j;\n\tscanf(\"%d\",&n);\n\tfor(i=0;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\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 \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=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#include \nint main() {\n\t//code\n\tint n;\n\tscanf(\"%d\",&n);\n\tint a[n-1];\n\tfor(int i=0;i0;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#include \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; i1){\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 \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\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#include \n#include \n#include \n#include \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 \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;ktemp2[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\nint main(){\n\tint n,a[50],i,j;\n\tscanf(\"%d\",&n);\n\tfor(i=0;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#include \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=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\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\n \n \nint main(){\n int n;scanf(\"%d\",&n);\n int a[n];for(int i=0;i0;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\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=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 \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=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\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 \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\nint main()\n{\n int n,i,j,k;\n scanf(\"%d\",&n);\n int ara[n];\n for(i=0;i\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#include \n#include \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=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\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\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#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\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\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\nint main()\n{\n\tint n, arr[1000], i, j;\n\t\n\tscanf(\"%d\", &n);\n\t\n\tfor(i=0; i\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\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\n#include\n#include\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=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\nint main()\n{\n\tint i,c=0,n,x[51],a[1001]={0};scanf(\"%d\",&n);\n\tfor(i=0;i\n#include \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\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\nint main()\n{\n int i,j,x;\n scanf(\"%d\",&x);\n int k,ara[x];\n for(k=0; k\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\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=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\nint main(){\n\tint n,a[50],i,j;\n\tscanf(\"%d\",&n);\n\tfor(i=0;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 \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;ktemp2[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\nint main()\n{\n\tint i,c=0,n,x[51],a[1001]={0};scanf(\"%d\",&n);\n\tfor(i=0;i 0) { \n\t\tprintf(\"%d\", x[c]); \n\t\tif(c\nint main()\n{\n int n,i,j,k,p;\n scanf(\"%d\",&n);\n int array[n];\n for(p=0;p\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=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\n#include\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=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\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=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\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 \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=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\nint main(void) {\nint n;\nscanf(\"%d\",&n);\nint m=0;\nint i,j,ar[n];\nfor(i=0;i\n#include \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; i1){\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 \n#include \n#include \n#include \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\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\nint main()\n{\n\tint i,c=0,n,x[51],a[1001]={0};scanf(\"%d\",&n);\n\tfor(i=0;i\nint main()\n{\n\tint n,i,j,c=0,t,a[1001],b[1001]={0};\n\tscanf(\"%d\",&n);\n\tfor(i=0;ia[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\nint main(void) {\nint n;\nscanf(\"%d\",&n);\nint m=0;\nint i,j,ar[n];\nfor(i=0;i\n#include \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=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\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#include \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=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 \n#include \n#include \n#include \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\nint main()\n{\n int i, j, n, a[1000], x, count=1;\n\n scanf(\"%d\", &x);\n for(i=0 ; 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\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\n#include \n\nint main(){\n int t[1001],x[1001],a,i,j=0;\n scanf(\"%i\",&a);\n for(i=0;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\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=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\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=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\n#include\n#include\n#include\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=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\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#include \n#include \n#include \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#include \n#include \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=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\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#include \n#include \n#include \n#include \n#include \n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a[n];\n int i;\n for(i=0;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#include\n#include\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\nint main()\n{\n\tint n, arr[1000], i, j;\n\t\n\tscanf(\"%d\", &n);\n\t\n\tfor(i=0; i\n#include\n#include\n#include\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=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 \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\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=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\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 \nint main()\n{\n int i,n,j,k,f=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;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\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\nint main()\n{\n int i,j,x;\n scanf(\"%d\",&x);\n int k,ara[x];\n for(k=0; k\n#include\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\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 \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\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\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#include \n#include \n#include \n#include \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 \n#include \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\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=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\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=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\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\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\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=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\n#include \n#include\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\nint main()\n{\n int n,i,j,k;\n scanf(\"%d\",&n);\n int ara[n];\n for(i=0;i\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#include \n#include \n#include \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#include \n\nint main(){\n int t[1001],x[1001],a,i,j=0;\n scanf(\"%i\",&a);\n for(i=0;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\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 \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\n#include\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\n#include\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 (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\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\n#include\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\n#include\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\n#include\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) — this string denotes Luba's ticket. The ticket can start with the digit 0.", "output_spec": "Print one number — 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 \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 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 \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\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=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 \n#include \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 \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<\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 \n#include \n#include \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 \n#include \n#include \n#include \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 \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 \n#include \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(num1num2)\n {\n int min=9,j;\n for(i=3;i<6;i++)\n if(a[i]-'0'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(num1b[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 \n#include \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 \n#include \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ğa 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 \n#include \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]2 && Ticket[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 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\n#include\n#include\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=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 \n#include \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 \n#include \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 \n#include \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 \n#include \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]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 \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 \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 \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 \n#include \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 \n#include \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 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]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 \n#include \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 \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 \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 \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\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=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\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=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\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=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\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=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\n#include \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 \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \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(num1num2)\n {\n int min=9,j;\n for(i=3;i<6;i++)\n if(a[i]-'0'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(num1b[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 \n#include \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(num1num2)\n {\n int min=9,j;\n for(i=3;i<6;i++)\n if(a[i]-'0'\n#include \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 \n#include \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 \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]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 \n#include \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]2 && Ticket[i]=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 \n#include \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 \n#include \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 \n#include \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 \n#include \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 \n#include \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 \n#include \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 \n#include \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 \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 \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 \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 \n#include \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 \n#include \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 \n#include \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 \n#include \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 \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 \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 \n#include \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 \n#include \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 \n#include \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 \n#include \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 \n#include \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 \n#include \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 \n#include \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 \n#include \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=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[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 \n#include \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 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\", c1a[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]\n#include \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 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\", c1a[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]\n#include \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 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\", c1a[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]\n#include \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 ≤ r ≤ 9).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 ≤ k ≤ 1000, 1 ≤ r ≤ 9) — 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·117 = 1053 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·15 = 30 burles. It is obvious that he can pay this sum without any change. "}, "positive_code": [{"source_code": "#include\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 \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 \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 \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\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\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\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\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\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\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\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\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\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\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\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\n#include\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\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 \n#include \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\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\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\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 \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 \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\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\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\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 \n#include \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 \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 \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\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\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\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\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\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\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 \n#include \n#include \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\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\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 \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 \n#include \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\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\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\n#include\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 \n#include \n#include \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\n#include\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\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\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 \n#include \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 \n#include \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 \n#include \n#include \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 \n#include \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\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 \n#include\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\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\n#include\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 \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\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\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 \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\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 \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\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 \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 \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 \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 \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 \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\n#include\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\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\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\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 \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\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 \n#include \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 \n#include \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\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 \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\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\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 \n#include\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\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\n#define s(a) long long int a; scanf(\"%lld\",&a);\n#define rep(n) long long int i; for(i=0;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\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 \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 \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 \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\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 \n#include \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\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\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\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\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 \n#include \n#include \n#include \n#include \n#include \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\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 \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\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 \n#include \n#include \n#include \n#include \n#include \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 \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 \n#include \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\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\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\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 \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\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 \n#include \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 \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 \n#include \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\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 \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 \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\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 \n#include \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 \n#include \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\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\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 \n#include \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\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\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\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\nint main()\n{\n int n,i,sum=0,b,x,j;\n scanf(\"%d\",&x);\n for(j=0;j\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\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\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 \n#include \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\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\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\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\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\nint main()\n{\n int n,i,sum=0,b,x,j;\n scanf(\"%d\",&x);\n for(j=0;j\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/*\\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\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\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\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 \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\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\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\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\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\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\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 \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\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 \n//#include \n//#include \n//#include \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\n#include \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\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=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\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\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\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 \n#include \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\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\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\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\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\n#include\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 \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 \n#include \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 \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 \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 \n#include \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\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\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\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\n// #include \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\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 \n#include \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 \n#include \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\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\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 \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\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\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\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\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\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\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\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 \n#include \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 \n#include\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#include \n#include \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\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 \n#include \n\nint main()\n{\n int num,i,even=0,odd=0;\n scanf(\"%d\",&num);\n int a[num];\n for(i=0;iodd)\n {\n printf(\"%d\",even);\n }\n else\n {\n printf(\"%d\",odd);\n }\n return 0;\n}\n"}, {"source_code": "#include\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\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=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 \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\n#include\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\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\n#include\n#include\n#include\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 \n#include \n#include \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 \n// #include \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\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\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\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 \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 \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\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’t want to use too many blocks, but they also want to be unique, so no two students’ 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 ≤ n, m ≤ 1 000 000, n + m > 0) — 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\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\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�ܴ����ߵ� \n m*=3; //B�ܴ����ߵ� \n int i; \n for(i=6;i<=min(n,m);i+=6) \n { \n if(n>m) //�����ʱA��B���߶ȸ� ��ô��B���� \n m+=3; \n else //ͬ�� \n n+=2; \n } \n printf(\"%d\\n\",max(n,m)); \n } \n} \n"}, {"source_code": "#include \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\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;jm)\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 \n\nint n,m;\n\nint check(int a)\n{\n\tif((a/2\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\nint main()\n{\n\tint a,b;\n\tscanf(\"%d %d\",&a,&b);\n\tint k=1,ans=0,m3=0;\n\twhile(m30)\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\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=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(ab)\n return a;\n else\n return b;\n}\n"}, {"source_code": "#include\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=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(ab)\n return a;\n else\n return b;\n}\n"}, {"source_code": "#include\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\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\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(ab)\n\t\treturn a;\n\telse\n\t\treturn b;\n}\n"}, {"source_code": "#include\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 \n#include \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 \n#include \n#include \n#include \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 \n#include \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\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\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 \n#include \n#include \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 \n#include \n#include \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\n#include\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 \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 \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 \n#include \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\n\nint fun(int a,int b)\n{\n if(a\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\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 \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\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 \n\nint n,m;\n\nint check(int a)\n{\n\tif((a/2\nint min(int a,int b)\n{\n\tif(ab)\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\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\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(ab)\n return a;\n else\n return b;\n}\n"}, {"source_code": "#include\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=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(ab)\n return a;\n else\n return b;\n}\n"}, {"source_code": "#include\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\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=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(ab)\n return a;\n else\n return b;\n}\n"}, {"source_code": "#include\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=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(ab)\n return a;\n else\n return b;\n}\n"}, {"source_code": "#include\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(ab)\n return a;\n else\n return b;\n}\n"}, {"source_code": "#include\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\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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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(c2ans2)\n\t\tprintf(\"%lld\\n\", ans2);\n\telse\n\t\tprintf(\"%lld\\n\", ans1);\n\treturn(0);\n}"}, {"source_code": "#include \n#include \n#include \n#include \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(c2ans2)\n\t\tprintf(\"%lld\\n\", ans2);\n\telse\n\t\tprintf(\"%lld\\n\", ans1);\n\treturn(0);\n}"}, {"source_code": "#include \n#include \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\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\nint min(int a,int b)\n{\n\treturn ab?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\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 \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 \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 \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 \n#include \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 \n#include \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 \n#include \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\n\nint fun(int a,int b)\n{\n if(a0||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 \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 \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\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\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 \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 \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 \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\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\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\n#include\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+bb)\n\t\tprintf(\"+\\n\");\n\t\t\telse if(a\n\nint main()\n{\n int x,y,z;\n scanf(\"%d %d %d\",&x,&y,&z);\n if(x>y && y+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\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+zy)\n printf(\"?\");\n else //x+z\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\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\n\nint main()\n{\n int x,y,z;\n scanf(\"%d %d %d\",&x,&y,&z);\n if(x>y && y+zy || y+z>x)\n {\n printf(\"?\");\n }\n else\n printf(\"0\");\n\n return 0;\n}\n"}, {"source_code": "#include \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\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\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 \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\n\nint main()\n{\n int x,y,z;\n scanf(\"%d %d %d\",&x,&y,&z);\n if(x>y && y+zy || y+z>x)\n {\n printf(\"?\");\n }\n else\n printf(\"0\");\n\n return 0;\n}\n"}, {"source_code": "#include\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(ac&&c!=0)\nprintf(\"?\");\nelse\nprintf(\"0\");\n}\nreturn 0;\n}\n"}, {"source_code": "#include\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 \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\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\n#include\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\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){\n if((x+z)\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\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\n#include\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\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(xz){\n printf(\"-\\n\");\n }\n else if(x\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)\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 || yy && x>z && x>(y+z)) printf(\"+\");\nelse if(xz && 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 && xx && z>y) printf(\"?\");\n//else\nelse printf(\"?\");*/\n\n return 0;\n}\n"}, {"source_code": "#include\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\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\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\n#include\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(ab)\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(ac)\n\t\t{\n\t\t\tprintf(\"-\\n\");\n\t\t}\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include\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 \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\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 && sum0))\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\n#include\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(xz || z==0)\n {\n if(x>y)\n {\n printf(\"+\");\n }\n else if(x\n#include\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\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(ac)\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\n#include\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(xy)\n\t\t\tprintf(\"+\");\n\t\telse if(x\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\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\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(xy&&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\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)=0&&z<=100)\n {\n if((y-x)>z)printf(\"-\\n\");\n if((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\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\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(zy-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\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((xz)\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\n#include\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 \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 \n#include \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\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\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(xy&&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\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\n#include\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(ab)\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(ac)\n\t\t{\n\t\t\tprintf(\"-\\n\");\n\t\t}\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include\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(aa+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\nint main()\n{\n int a,b,c;\n scanf(\"%d%d%d\",&a,&b,&c);\n {\n if(a>b&&b+ca&&a+cc)\n printf(\"0\");\n else\n printf(\"?\\n\");\n }\n return 0;\n}\n"}, {"source_code": " #include\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 \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\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 \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 \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\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\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\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 \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\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(zy-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\n#include\n#include \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\n#include\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 \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\n#include\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\n#include\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\n#include\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(xz || z==0)\n {\n if(x>y)\n {\n printf(\"+\");\n }\n else if(x\n\nint main()\n{\n int x,y,z;\n scanf(\"%d %d %d\",&x,&y,&z);\n if(x>y && y+zy || y+z>x)\n {\n printf(\"?\");\n }\n else\n printf(\"0\");\n\n return 0;\n}\n"}, {"source_code": "#include\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 && sum0))\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\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\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(ac)\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\n#include\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(xz || z==0)\n {\n if(x>y)\n {\n printf(\"+\");\n }\n else if(x\n#include\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(xy)\n\t\t\tprintf(\"+\");\n\t\telse if(x\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(xy&&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\n#include\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\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+zy)\n printf(\"?\");\n else //x+z\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+z0 && 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\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\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\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+zx&&x+zy)\n printf(\"+\");\n else if(x\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)\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 || yy && x>z && x>(y+z)) printf(\"+\");\nelse if(xz && 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 && xx && z>y) printf(\"?\");\n//else\nelse printf(\"?\");*/\n\n return 0;\n}\n"}, {"source_code": "#include\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\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(a0)\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\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\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\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\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(xy||y>x){\n if(y+z\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(xy)\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\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 }\n else \n { \n if(a>b)\n {\n printf(\"+\");\n }\n else if(a\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\n#include\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\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\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(a0)\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\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)=0&&z<=100)\n {\n if((y-x)>z)printf(\"-\\n\");\n if((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\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 \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((aa+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\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\n#include\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\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\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\n#include\nint main()\n{\n\tint a,b,c;\n\twhile(scanf(\"%d %d %d\",&a,&b,&c)!=EOF)\n\tif(ac)\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)\n#include\n#include\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\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\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) || (sum0) && ((-z)+sum>0))\n printf(\"+\");\n else if(sum==0 && z==0)\n printf(\"0\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\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\n\nint main()\n{\n int a,b,c,i,j,k;\n\n scanf(\"%d%d%d\",&a,&b,&c);\n\n if(ab)\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 \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\n#include\nint main()\n{\n\tint a,b,c;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tif(a>b&&c+b\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)&&(y>z))\n {\n if((x+z)z))||(x==y)&&(z==0))\n {\n printf(\"0\");\n }\n else\n {\n printf(\"?\");\n }\n}\n"}, {"source_code": "#include\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\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\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)&&(y>z))\n {\n if((x+z)z))\n {\n printf(\"0\");\n }\n else\n {\n printf(\"?\");\n }\n}\n"}, {"source_code": "#include \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\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\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\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\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\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\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(ac)\nprintf(\"?\");\nelse\nprintf(\"0\");\n}\nreturn 0;\n}\n"}, {"source_code": "#include \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(xy){\n y = y+z;\n if(y\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)=0&&z<=100)\n {\n if((y-x)>z)printf(\"-\\n\");\n if((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\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(xz && 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\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\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+yx+z && z+x\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||xy)\n {\n printf(\"+\");\n }\n\n }\n else if(y>x||y==z&&x==z)\n {\n n=x+z;\n if(y==n||yx)\n {\n printf(\"-\");\n }\n }\n\n else\n {\n printf(\"0\");\n }\n return 0;\n }\n\n"}, {"source_code": "#include\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(xy)\n printf(\"+\");\n else if(x\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\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(a0)\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 \n#include \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\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(x0 && y>0){\n printf(\"0\\n\");\n }\n else if(y==0 && x==0){\n printf(\"?\\n\");\n }\n}\n"}, {"source_code": "#include\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\n#include\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\n#include\nint main()\n{\n\tint a,b,c;\n\twhile(scanf(\"%d %d %d\",&a,&b,&c)!=EOF)\n\tif(ab)\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\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\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+cb)\n printf(\"+\");\n else\n printf(\"0\");\n }\n return 0;\n}"}, {"source_code": "#include\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&&xy){\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 \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\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\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\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\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\n//#include\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\n#include\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 \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(ab)\n printf(\"+\\n\");\n\n else if(a\n#include\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(xz || z==0)\n {\n if(x>y)\n {\n printf(\"+\");\n }\n else if(x\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\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\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\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(aa+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\n#include\n#include \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\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\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(xy)\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\nint main()\n{\n int x, y, z;\n scanf(\"%d%d%d\",&x ,&y ,&z);\n if(xy)\n printf(\"+\\n\");\n else if((x+z)x)\n printf(\"-\\n\");\n else if((y+z)\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\n#include\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\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 \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\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\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\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\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\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\n#include\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\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\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\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\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\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 \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 \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\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\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)&&(y>z))\n {\n if((x+z)z))\n {\n printf(\"0\");\n }\n else\n {\n printf(\"?\");\n }\n}\n"}, {"source_code": "#include\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 printf(\"0\");\n}"}, {"source_code": "#include\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\nint main()\n{\n int a,b,c;\n scanf(\"%d%d%d\",&a,&b,&c);\n if(a>b&&b+ca&&a+cc&&b>c)\n printf(\"0\");\n else\n printf(\"?\");\n return 0;\n}\n"}, {"source_code": "#include\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(x0)\n printf(\"?\\n\");\n\n\n return 0;\n}\n"}, {"source_code": "#include\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\n#include\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\n#include\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 \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\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\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-yz){\n printf(\"-\\n\");\n }\n else if(x0 && y>0 && x>z && y>z){\n printf(\"0\\n\");\n }\n\n\n}\n"}, {"source_code": "#include\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\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\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\n#include\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\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\n#include\nint main()\n{\n\tint a,b,c;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tif(a>b&&a>c&&c+bc&&a+cc)\n\tprintf(\"0\\n\");\n\t\telse\n\tprintf(\"?\\n\");\n\t\n\t\n\treturn 0;\n}"}, {"source_code": "#include\n#include\n#include \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\n#include\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\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(xz){\n printf(\"-\\n\");\n }\n else if(x0 && y>0 && x>z && y>z){\n printf(\"0\\n\");\n }\n}\n"}, {"source_code": "#include\n#include\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(zy)\n printf(\"+\");\n else \n printf(\"-\");\n }\n else \n printf(\"0\");\n}"}, {"source_code": "#include\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+cb)\n printf(\"+\");\n else\n printf(\"0\");\n }\n return 0;\n}"}, {"source_code": "#include\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\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\n#include\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(ab)\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)\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\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(xy)\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 — 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 ≤ n, m ≤ 106). Each of the next m lines contains a couple of integers. The i-th line contains integers xi, yi (1 ≤ xi, yi ≤ n) — 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\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#include \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 \n#include \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 — 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 ≤ a, b, c ≤ 106) — the valence numbers of the given atoms.", "output_spec": "If such a molecule can be built, print three space-separated integers — 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 \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(ca+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\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\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\n#include\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\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 \n#include \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\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 \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 \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\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 \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 \n#include \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 \n#include \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\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\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\n#include\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\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\n#include\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]c){\n while(a+b!=c){\n k++;\n a--;\n b--;\n if(a+ba){\n while(c+b!=a){\n k++;\n c--;\n b--;\n if(c+bb){\n while(a+c!=b){\n k++;\n a--;\n c--;\n if(a+c\nint main()\n{\n int a,b,c,i=0,A,B,C;\n scanf(\"%d %d %d\", &a,&b,&c);\n if (ab+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 \n#include \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ções 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 \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 \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\n#include\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]c){\n while(a+b!=c){\n k++;\n a--;\n b--;\n if(a+ba){\n while(c+b!=a){\n k++;\n c--;\n b--;\n if(c+bb){\n while(a+c!=b){\n k++;\n a--;\n c--;\n if(a+c\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(mxj)\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\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 \n#include \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 \n#include \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 \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 \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]\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\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 \n#include \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\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 \n#include \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\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\n#include\n#include\n#include\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 \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\n// #include \n// using namespace std;\n \n#include\n#include\n#include\n#include\n#include\n#include\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\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\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 \n#include \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\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 \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\n#include\n#include\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\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\n#include\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\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\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 \n#include \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\n#include\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 \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\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\n#include\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 \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\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 \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(mxj)\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\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\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\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 \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\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\n// #include \n// using namespace std;\n \n#include\n#include\n#include\n#include\n#include\n#include\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\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 \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(ca+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\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\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]\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\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\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\n// #include \n// using namespace std;\n \n#include\n#include\n#include\n#include\n#include\n#include\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\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\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 \n#include \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 \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 \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\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\n#include\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]c){\n while(a+b!=c){\n k++;\n a--;\n b--;\n if(a+ba){\n while(c+b!=a){\n k++;\n c--;\n b--;\n if(c+bb){\n while(a+c!=b){\n k++;\n a--;\n c--;\n if(a+c\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\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\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 \n#include \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 \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=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\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\n#include\n#include\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 \n#include \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 \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(ca+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\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\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 \n#include \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\n#include\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\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\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\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=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\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\n#include\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\n#include\n#include\n#include\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\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 \n#include \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 \n#include \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\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 \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\n#include\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 \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\n#include\n#include\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\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\n#include\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\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\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\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 \n#include \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 \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 \n#include \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 \n#include \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 \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\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 \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\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\n#include\n#include\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\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\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 \n#include \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\n#include\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 \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\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 \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\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 \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\nint main()\n{\n int a,b,c,A,B,C;\n scanf(\"%d %d %d\", &a,&b,&c);\n if (ab+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 \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 \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 \n#include \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 \n#include \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\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 \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 \n#include \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\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]\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 \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\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\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\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\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 \n#include \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 \n#include \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 \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 \n#include \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 \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=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 (maxa[i])\n min=a[i];\n }\n return min;\n}"}, {"source_code": "#include\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\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\n// #include \n// using namespace std;\n \n#include\n#include\n#include\n#include\n#include\n#include\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\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 \n#include \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 \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\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 \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\n#include\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 \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\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\n#include\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\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\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 \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\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\n#include\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 \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\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 \n#include \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\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\n#include\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]c){\n while(a+b!=c){\n k++;\n a--;\n b--;\n if(a+ba){\n while(c+b!=a){\n k++;\n c--;\n b--;\n if(c+bb){\n while(a+c!=b){\n k++;\n a--;\n c--;\n if(a+c\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 \n#include \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\n#include\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 \n#include \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\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\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 \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\n#include\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 \n#include \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\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 \n#include \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 \n#include \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 \n#include \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 \n#include \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\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 \n#include \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 \n#include \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 \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 \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=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 (maxa[i])\n min=a[i];\n }\n return min;\n}"}, {"source_code": "#include\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 \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 \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 \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]\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)=c&&c>=b){\n\t\tif((b+c)=a&&a>=b){\n\t\tif((b+a)=b&&b>=a){\n\t\tif((b+a)=a&&a>=c){\n\t\tif((c+a)\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\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 \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;xa[i])\n min=a[i];\n }\n return min;\n}"}, {"source_code": "#include\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 (ab+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 — 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\n#include\n#include\n#include\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\n#include\n#include\n#include\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 — 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 \n#include \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 \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$$$) — 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$$$) — 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$$$)  — 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$$$  — 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 \n#include \n#include \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$$$) — 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 ​​of $$$n$$$ for all test cases in the input does not exceed $$$100$$$.", "output_spec": "Print $$$t$$$ integers — 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 \n#include \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\n#include\n#include\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\n#include\n#include\n#include\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\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 \n#include \n#include \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\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;icount)\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 \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 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\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\nvoid read(int *arr, int length) {\n for (int i=0; itemp) 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\n#include \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\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#include \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 \n#include \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\n#include\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\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=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;jch[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\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\nint main()\n{ int t,i;\n scanf(\"%d\",&t);\nfor(i=0;i\nint countf(int a[],int k,int l,int r)\n{\n int b[k];int i, s=0;\n for(i=0;i\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\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=d)\n {\n if(countb ? 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 \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\n#include\n#include\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\n// #include \n// using namespace std;\n \n#include\n#include\n#include\n#include\n#include\n#include\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\n#include \n#include \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\n#include \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\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=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 \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\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\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\nint main(){\n long long z,k;\n scanf(\"%lli\",&z);\n for(k=0;k\n\nint main(){\n int z,k;\n scanf(\"%i\",&z);\n for(k=0;k\n#include \n#define m 1000007\n#define Min(a,b) a\n#include \n#include \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 t)\n ans = t;\n memset(b,0,sizeof(b));\n }\n printf(\"%d\\n\", ans);\n }\n return 0;\n}"}, {"source_code": "#include\n\n#include\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; j0)\n {\n dist++;\n }\n }\n if(dist0)\n {\n dist++;\n }\n }\n if(dist\n#include \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; id\n {\n shows[line[i]]++;\n };\n no=0;\n for(tmp=0; tmp=1 episod fara a atinge i\n {\n if(shows[tmp])\n {\n no++;\n };\n };\n minno=no;\n while(i1\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\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\n#include\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 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\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;in) continue;\n\t\t\tfor(int k = i;k-i0) 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\n\nint main(){\n\n int t,i,j,k,l;\n\n scanf(\"%d\",&t);\n\n for(i=0;i\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=d)\n {\n if(countb ? 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\n// #include \n// using namespace std;\n \n#include\n#include\n#include\n#include\n#include\n#include\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\n// #include \n// using namespace std;\n \n#include\n#include\n#include\n#include\n#include\n#include\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\n#include \n#include \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 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\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\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 \n#include \n#define m 1000007\n#define Min(a,b) a\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\n\nint main(){\n\n long long int t,i,j,k,l;\n\n scanf(\"%I64d\",&t);\n\n for(i=0;i\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\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\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;icount)\n\t\t\t\tmin=count;\n\t\t}\n\n\t\tprintf(\"%lld\\n\",min);\n\n\t\tfor(i=0;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 \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;i0 && 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#include \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 \n#include \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\n#include\n#include\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#include\n#include\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#include \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\n#include\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\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=0;i--)\n printf(\"%d\\n\",arr[i]);\n return 0;\n}"}, {"source_code": "#include\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=0;i--)\n printf(\"%d\\n\",arr[i]);\n return 0;\n}"}, {"source_code": "#include\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=0;i--)\n printf(\"%d\\n\",arr[i]);\n return 0;\n}"}, {"source_code": "#include\nint countf(int a[],int k,int l,int r)\n{\n int b[k];int i, s=0;\n for(i=0;i\n#include \n#include \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\n#include \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\n#include \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=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 \n#include \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\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\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\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\n\nint isInside(int a[],int b,int num){\n int i=0;\n for(i=0;i\n\nint isInside(int *a,int b,int num){\n int i=0;\n for(i=0;i\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\n\nint isInside(int *a,int b,int num){\n int i=0;\n for(i=0;i\n\nint main(){\n int z,k;\n scanf(\"%i\",&z);\n for(k=0;k\n\nint main(){\n int z,k;\n scanf(\"%i\",&z);\n for(k=0;k\n\nint isInside(int *a,int b,int num){\n int i=0;\n for(i=0;i\n\nint main(){\n int z,k;\n scanf(\"%i\",&z);\n for(k=0;k\n#include \n#include \n\nint isInside(int *a,int b,int num){\n int i=0;\n for(i=0;i\n\nint isInside(int *a,int b,int num){\n int i=0;\n for(i=0;i\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\n#include \n#include \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 t)\n ans = t;\n memset(b,0,100);\n }\n printf(\"%d\\n\", ans);\n }\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \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 t)\n ans = t;\n memset(b,0,100);\n }\n printf(\"%d\\n\", ans);\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \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; id\n {\n shows[line[i]]++;\n };\n no=0;\n for(tmp=0; tmp=1 episod fara a atinge i\n {\n if(shows[tmp])\n {\n no++;\n };\n };\n minno=no;\n while(i1\n {\n no++;\n };\n if(shows[line[i-d]]==0)//daca am scazut 1->0\n {\n no--;\n };\n if(no\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\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;in) continue;\n\t\t\tfor(int k = i;k-i0) 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\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=d)\n {\n if(count\n// #include \n// using namespace std;\n \n#include\n#include\n#include\n#include\n#include\n#include\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\n#include \n#include \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\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 \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 \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 \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\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;i0 && 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 \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;i0 && 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\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\n#include\n#include\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#include\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\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\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#include \n#include \n#include \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#include\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 \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\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\n#include\n#include\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 #include \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\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\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#include\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\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\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;icount_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#include \n#include \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\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;icount_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\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 #include \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\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;icount_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#include\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\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\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#include \n#include \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#include \n#include \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\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#include\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\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#include \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#include \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#include \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\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#include\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\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#include \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#include\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\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\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\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\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\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\n#include\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\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#include\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 \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\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#include \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\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;icount_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\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#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\n#include\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\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\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#include\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#include\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\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#include \n#include \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\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#include\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#include \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\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\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#include \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#include \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#include \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\n#include\nint kt(char a[],int k,int n){\n\tint cnt=0,cnt1=0;\n\tfor(int i=k;i\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\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\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\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\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 \n#include\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#include \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\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\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#include \n#include\n#include\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#include\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#include \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#include\n#include\n#include\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\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\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#include\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\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\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#include \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\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#include \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\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\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\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 \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\nint main(){\nint i,j,k,n;\nchar s[101];\nj = k = 0;\nscanf(\"%i\\n%100s\",&n,s);\nfor (i=0;i\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=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#include \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\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\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 #include \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\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#include \n#include\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\n#include \n#include \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\n#include \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#include \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#include \n#include \n#include \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\nint main()\n{\n int n ,i, arr[100],zero=0,one=0;\n scanf(\"%d\",&n);\n for(i=0;i\n#include \n#include \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\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\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\n#include\nint kt(char a[],int k,int n){\n\tint cnt=0,cnt1=0;\n\tfor(int i=k;i\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\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\n#include \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\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\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\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#include \n#include\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\n#include \n#include \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#include \n#include \n#include \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#include \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 \n#include \n#include \n#include \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#include \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\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#include\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 \n#include \n#include \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#include \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#include\n#include\n#include\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#include\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\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\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#include \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\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;i0)\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\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#include\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\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#include \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\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\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 \n#include \n#include\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\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\nint main()\n{\n int n ,i, arr[100],zero=0,one=0;\n scanf(\"%d\",&n);\n for(i=0;i\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#include \n#include \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#include \n#include\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\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\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#include \n#include \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\n#include\n#include\n#include\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\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#include \n#include \n#include \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#include \n#include \n#include \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#include\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#include\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#include \n#include \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#include\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#include\n#include\n#include\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#include \n#include \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\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#include\n#include\n#include\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#include\nint kt(char a[],int k,int n){\n\tint cnt=0,cnt1=0;\n\tfor(int i=k;i\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#include \n#include \n#include \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#include\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#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a[n],p=0;\n for(int i=0;i\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=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#include\n#include\n#include\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 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#include \n#include \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\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\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#include \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\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\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#include \n#include \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#include\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\n#include\nint kt(char a[],int k,int n){\n\tint cnt=0,cnt1=0;\n\tfor(int i=k;i\n#include \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\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#include \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#include \n#include \n#include \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\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\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\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\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; i2 && n%2!=0)\n { \n for(int i=0; i\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\n#include \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\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\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\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\nint main()\n{\n int n ,i, arr[100],zero=0,one=0;\n scanf(\"%d\",&n);\n for(i=0;i\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\n#include\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\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\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\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= 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\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 \n#include \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 \n#include \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 \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\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\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\n#include\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 \n#include \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\n#include\n#include\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 \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 \n#include \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\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\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 \n#include \n#include \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\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\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 \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 \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\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\n#include\n#include\n#include\n#include\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\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 \n#include \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\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 \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\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 \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 \n#include \n#include \n#include \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 \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\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\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 \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 \n#include \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\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\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\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 \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 \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 \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\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\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 \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\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 \n#include \n#include \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\n#include \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 \n#include \n#include \n#include \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\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\n#include\n#include\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 \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 \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 \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\n#include\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 \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 \n#include \n#include \n#include \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\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\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\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\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 \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 \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\n#include\n#include\n#include\n#include\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\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 \n#include \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 \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\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\n#include\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\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\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 \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 \n#include \n#include \n#include \n#include \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\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 \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\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 \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 \n#include \n#include \n#include \n#include \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 \n#include \n#include \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\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 \n#include \n#include \n#include \n#include \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 \n#include \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\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 \n#include \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 \n#include \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 \n#include \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 \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 \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\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\n#include\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\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\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\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 \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\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\n#include \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\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\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 \n#include \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\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 \n#include \n#include \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\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 \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\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 \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\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\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\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\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\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 \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\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\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\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\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\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\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\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 \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 \n#include \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 \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 \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\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\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\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;i0 && 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 \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 \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 \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 \n#include \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\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\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\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 \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\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\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 \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 \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 \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\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 \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\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\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\n#include\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\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\n#include\n#include\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\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\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\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\n#include\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\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\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\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\n#include\n#include\n#include\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\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 \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\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 \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\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 \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 \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\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\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\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 \n#include \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\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 \n#include \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 \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\n#include\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\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\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\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 \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 \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\n#include\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\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\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\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 \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\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\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\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\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\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 \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\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\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\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 \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 \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\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 \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\n#include\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 \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\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 \n#include \n#include \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\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\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\n#include\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\n#include\n#include\n#include\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\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\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 ≤ |s1|, |s2|, |virus| ≤ 100). 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 \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 \n#include \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 \n#include \n#include \n#include \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 \n#include \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]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\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;klist[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;plist[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=1;i--)\n printf(\"%c\",stack[i]);\n return 0;\n //system(\"pause\");\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \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 \n#include \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]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\n#include \n#include \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 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 \n#include \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 \n#include \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 \n#include \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 \n#include \n#include \n#include \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 \n#include \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]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 \n#include \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]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\n#include \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]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\n#include \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 \n#include \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]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\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 \n#include \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;ilist[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;plist[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;plist[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=1;i--)\n\t\tprintf(\"%c\",stack[i]);\n\treturn 0;\n}\n/*\nETFTBRDKOXKCGPVFVCHQXKCIECDK\nEKTFRZNXMGFFXIJXKCATCVTXTDDK\n\nWVBGCSSQHHIFRRWLDDHXBGFUGU\n\n*/\n"}, {"source_code": "#include \n#include \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;ilist[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;plist[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;plist[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=1;i--)\n\t\tprintf(\"%c\",stack[i]);\n\treturn 0;\n}\n/*\nAVBIIQXSAHIFRRJLDDHABFGUGU\nWVBGCSSQHHIFRRWLDDHXBGFUGU\n\n*/\n"}, {"source_code": "#include \n#include \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;ilist[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;plist[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;plist[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=1;i--)\n\t\tprintf(\"%c\",stack[i]);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \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;ilist[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;plist[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;plist[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=1;i--)\n\t\tprintf(\"%c\",stack[i]);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \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;ilist[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;plist[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;plist[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=1;i--)\n\t\tprintf(\"%c\",stack[i]);\n\treturn 0;\n}\n/*\nAVBIIQXSAHIFRRJLDDHABFGUGU\nWVBGCSSQHHIFRRWLDDHXBGFUGU\n\n*/\n"}, {"source_code": "#include \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;klist[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;plist[l1][l2][i]?m:i;\n //for (i=1;i<=l1;i++)\n // for (j=1;j<=l2;j++)\n // for (k=0;k=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)$$$ — 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)$$$ — 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 \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 \n#include \n#include \n//#include \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;i0) {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$$$) — the number of words in the dictionary and the number of letter cells. Each of the next $$$n$$$ lines contains a word — a non-empty string of no more than $$$5$$$ lowercase Latin letters. All words are pairwise distinct. ", "output_spec": "Print a single integer — 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 \n#include \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 ≤ |s| ≤ 50), 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\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\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 \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\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\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#include\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\n#include\n#include\n#include\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='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 \n#include \nint main()\n{\n int i,count=0;\n char s[100005];\n gets(s);\n for(i=0;i\n#include\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\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\n#include\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\n#include\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\n#include\nint main ()\n{\n char str[10000];\n scanf(\"%s\",str);\n int i,count=0;\n for(i=0; i\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\n#include\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='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 \n# include \nchar s[51];\nint arr[126];\nint main(void){\n\tint count=0;\n\tscanf(\"%s\",s);\n\tfor (int i=0;i\n#include\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\n#include\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\n#include \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 \n#include \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 \n#include \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\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#include \nint main()\n{\n int n,i,k=0;\n char s[100];\n gets(s);\n for(i=0;i\n#include \n#include \n#include \n#include \n#include \n#include \nint main()\n{ \nchar a[51]; \n scanf(\"%s\",a);\n int count=0;\n for(int i=0;i\n#include\nmain(){\n int cnt, flip=0, n;\n char str[51];\n gets(str);\n n=strlen(str);\n for(cnt=0;cnt\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\n#include\nint main()\n{\n\tchar s[50],c;\n\tint n=0,i=0;\n\tscanf(\"%s\",s);\n\twhile(i=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\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\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 \n#include \n#include \n#include \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 \n#include \nint main()\n{\n\tchar str[100];\n\tgets(str);\n\tint cnt=0,i,l=strlen(str);\n\tfor(i=0;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\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\n#include\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\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\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 \n#include \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\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\n#include\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=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\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 \n#include \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\nint main()\n{\n char d[1000];\n scanf(\"%s\",d);\n int c=0,i;\n for(i=0;i\n#include \n#include \n#include \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 \n#include \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 \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\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 \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\nint main()\n{\n char s[100];\n int i,j,a;\n a=0;\n scanf(\"%s\",&s);\n for(i=0;i\n#include\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\n#include \nint main()\n{\n char str[55];\n int i,count=0;\n\n scanf(\"%s\",str);\n\n for(i=0; i\n#include\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=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\n#include\nint main()\n{\nint p=0,j,i;\nchar s[51];\ngets(s);\nj=strlen(s);\nfor(i=0;i\n#include\nint main()\n{\nchar str[50];\nint i,j=0,l,s;\ngets(str);\nl=strlen(str);\nfor(i=0;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 \n#include\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\n#include\nint main()\n{\nint p=0,j,i;\nchar s[51];\ngets(s);\nj=strlen(s);\nfor(i=0;i\n#include \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\n#include\n#include\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#include \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 \n#include \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\n#include\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\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\n#include\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\nint main()\n{\n\tchar s[50];\n\tscanf(\"%s\",s);\n\tint i,c=0;\n\tfor(i=0;i\n#include\nint main()\n{\nchar str[50];\nint i,j=0,l,s;\ngets(str);\nl=strlen(str);\nfor(i=0;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\n#include \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\n#include \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\n#include\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\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 \n#include \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='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 \n#include \n#include \n#include \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\n#include\n char ch[55];\nint main()\n{\n gets(ch);\n int i;\n int nb=0;\n for(i=0;i\n#include\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 \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\n#include \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\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;i47&&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 \n#include \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\n#include\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\n#include\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\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 \n#include \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\n#include\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\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\n#include\n#include\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\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\n#include\n\nint main()\n{\n int c=0;\n char a[1001];\n scanf(\"%s\",a);\n \n for(int i=0; i\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#include\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\n#include \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 \n#include\nint main(void) {\nchar str[51];\nint i,cnt,cntL=0;\nscanf(\"%s\",str);\nfor(i=0;i\n#include \n#include \n#include \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\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 \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 \n#include \nint main()\n{\n char str[55];\n int i,count=0;\n\n scanf(\"%s\",str);\n\n for(i=0; i\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 \n#include \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#include \n#include\nint main()\n{ int k=0;\n char a[51];\n scanf(\"%s\",a);\n for(int i=0;i\n#include\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=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\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;i47&&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\n#include\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\n#include\n#include\n#include\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\n#include\nint main()\n{\nchar str[50];\nint i,j=0,l,s;\ngets(str);\nl=strlen(str);\nfor(i=0;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 \n#include \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#include\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#include\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\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\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\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 \n#include \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\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\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\n#include\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=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\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\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#include \n#include \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\n#include\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\n#include\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\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\n#include\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=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\n#include\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#include\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\n#include\n#include\n#include\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\n#include\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\n#include\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=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 \n#include \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#include \n#include \n#include \n#include \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\n#include\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\nint main()\n{\n char s[100];\n int i,j,a;\n a=0;\n scanf(\"%s\",&s);\n for(i=0;i\n#include \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\n#include\n char ch[55];\nint main()\n{\n gets(ch);\n int i;\n int nb=0;\n for(i=0;i\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#include \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\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\n#include\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='1'&&s[i]<='9')\n {\n count=count+1;\n }\n }\n printf(\"%d\",count);\n}\n"}, {"source_code": "#include\n#include\nmain(){\n int cnt, flip=0, n;\n char str[51];\n gets(str);\n n=strlen(str);\n for(cnt=0;cnt\n#include \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#include \n#include \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\n#include\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\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\n#include\nint main(void) {\nchar str[51];\nint i,cnt,cntL=0;\nscanf(\"%s\",str);\nfor(i=0;i\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 \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 \n#include \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\n#include\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#include \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\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\nint main()\n{\nint n=50, count=0,i;\nchar str[n];\nscanf (\"%s\",str);\n for(i=0;i\n#include \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'0' && c[k]<='9'))\n {\n count++;\n }\n }\n printf(\"%d\",count);\n\n}\n"}, {"source_code": "#include \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 \n#include \n#include \n#include \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 \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\n#include\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\n#include \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\n#include\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=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 \n#include \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\n#include \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'0' && c[k]<='9'))\n {\n count++;\n }\n }\n printf(\"%d\",count);\n\n}\n"}, {"source_code": "#include\n#include\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\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\n#include\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\n#include\nmain(){\n int cnt, flip=0, n;\n char str[51];\n gets(str);\n n=strlen(str);\n for(cnt=0;cnt\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 \n#include \n#include \n#include \n#include \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\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\n#include\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\n#include\n#include\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\n#include\n#include\n#include\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\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;i1&&(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\n#include\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 //字母都要看\n counter++;\n }else if(c=='0' || c=='2' || c=='4' || c=='6' || c=='8'){\n if(!see[c-'0'+1]){\n //数字看一遍就行\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\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 © 2019 Mihai Esanu. All rights reserved.\n//\n\n#include \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\n#include\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\nint main()\n{\n char s[100];\n int i,j,a;\n a=0;\n scanf(\"%s\",&s);\n for(i=0;i\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\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\n#include\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\n//#include \n\nint main()\n{\nint n=50,i, count=0;\nscanf (\"%d\",&n);\nchar str[n];\nscanf (\"%s\",str);\nfor (i=0;i\n#include \n#include \n#include \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\n#include\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\n#include\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\n#include \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\n#include\nint main()\n{\nint p=0,j,i;\nchar s[51];\ngets(s);\nj=strlen(s);\nfor(i=0;i\n#include \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\n#include\n#include\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\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\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\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\n#include\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 © 2019 Mihai Esanu. All rights reserved.\n//\n\n#include \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\n#include\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\n#include\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 \n#include \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\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 \n#include \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#include \n#include \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\n#include\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 \n#include \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#include\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\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\n#include\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\n#include\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\n#include\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\ntypedef long long int ll;\nvoid print(int *a,int n)\n{\n int i;\n for(i=0;i0 && 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\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;icount2)?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(count110000000)\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 \n#include \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 \n#include \n#include \n#include \n#include \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\ntypedef long long int ll;\nvoid print(int *a,int n)\n{\n\tint i;\n\tfor(i=0;i0 && 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\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\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;ip)\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;ip)\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\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;ip)\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;ip)\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 \n#include \n#include \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\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 \n#include \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 \n#include \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=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 \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;im+1){printf(\"-1\\n\");return 0;}\n\t\t//printf(\"%lld\\n\",h2 );\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include\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]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]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 \n#include \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\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;icount2)?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\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;icount2)?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\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\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\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;icount2)?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\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\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;icount2)?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\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;icount2)?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\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;icount2)\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\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;icount2)?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\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\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;icount2)?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\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;icount2)?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(count110000000)\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\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\n#include \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 \n#include \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 \n#include \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 \n#include \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 \n#include \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 \n#include \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 \n#include \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 \n#include \n#include \n#include \n#include \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 \n#include \n#include \n#include \n#include \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 \n#include \n#include \n#include \n#include \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\ntypedef long long int ll;\nvoid print(int *a,int n)\n{\n\tint i;\n\tfor(i=0;i=u[st] && v[a2]>=v[st])\n\t{\n\t\t for(i=0;i0 && 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;i0 && 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\ntypedef long long int ll;\nvoid print(int *a,int n)\n{\n\tint i;\n\tfor(i=0;i0 && 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=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=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\ntypedef long long int ll;\nvoid print(int *a,int n)\n{\n\tint i;\n\tfor(i=0;i=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;i0 && 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\ntypedef long long int ll;\nvoid print(int *a,int n)\n{\n\tint i;\n\tfor(i=0;i0 && 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=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=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\ntypedef long long int ll;\nvoid print(int *a,int n)\n{\n\tint i;\n\tfor(i=0;i0 && 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\ntypedef long long int ll;\nvoid print(int *a,int n)\n{\n\tint i;\n\tfor(i=0;i=u[st] && v[a2]>=v[st])\n\t{\n\t\t for(i=0;i0 && 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\ntypedef long long int ll;\nvoid print(int *a,int n)\n{\n\tint i;\n\tfor(i=0;i0 && 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\ntypedef long long int ll;\nvoid print(int *a,int n)\n{\n\tint i;\n\tfor(i=0;i0 && 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=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=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\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 \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 \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 \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 \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 \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 \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\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;ip)\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;ip)\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 \n#include \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 \n#include \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 \n#include \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 \n#include \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 \n#include \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 \n#include \n#include \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\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\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 \n#include \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 \n#include \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;itmp2&&(tmp-tmp2)%cnt2==0)\n {\n printf(\"%d\\n\", tmp);\n break;\n }\n }\n\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \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;itmp2&&(tmp-tmp2)%cnt2==0)\n {\n printf(\"%I64d\\n\", tmp);\n break;\n }\n }\n\n }\n return 0;\n}\n"}, {"source_code": "#include \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\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;im+1)printf(\"-1\\n\");\n\treturn 0;\n}"}, {"source_code": "#include \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 \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 \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++\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;im+1)printf(\"c-1\\n\");\n\treturn 0;\n}"}, {"source_code": "#include \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\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;im+1){printf(\"-1\\n\");return 0;}\n\t\t//printf(\"%lld\\n\",h2 );\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include\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\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&&b2b1&&(b2-b1)%T1==0)printf(\"%d\\n\",b2);\n else printf(\"-1\\n\");\n }\n else if(b2>=s2&&b1b2&&(b1-b2)%T2==0)printf(\"%d\\n\",b1);\n else printf(\"-1\\n\");\n }\n else if(b1\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]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]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\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]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)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\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&&b2b1&&(b2-b1)%T1==0)printf(\"%d\\n\",b2);\n else printf(\"-1\\n\");\n }\n else if(b2>=s2&&b1b2&&(b1-b2)%T2==0)printf(\"%d\\n\",b1);\n else printf(\"-1\\n\");\n }\n else if(b1\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]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)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\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;ip)\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\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;ip)\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;ip)\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\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;ip)\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\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;ip)\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\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\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=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\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;new0)\n temp=j;\n }\n }\n if(flag==1)\n {\n a[0]=1;\n a[len-1]=9;\n for(j=1;j\n#include\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\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\nint main()\n{\n\tint n,c=19,s=19,m=0,i=1;\n\tscanf(\"%d\",&n);\n while(i\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\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=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\n#include\n#include\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 \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\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 \n#include \n#include \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 \n#include \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 \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 \n#include \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\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\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\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 \n#include \n#include \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 \n#include \n#include \n#include \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 \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\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;i10-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 \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(inin) fin=med-1;\n else ini=med;\n }\n printf(\"%d\", perfects[ini]);\nreturn 0;\n}"}, {"source_code": "#include\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\n#include \n#include \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\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\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\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\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\n#include\n\nvoid main(){\nint n,i,z,count=0,sum,k;\nscanf(\"%d\",&n);\ni=z=19;\nwhile(count\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;new0)\n temp=j;\n }\n }\n if(flag==1)\n {\n a[0]=1;\n a[len-1]=9;\n for(j=1;j\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 \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\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=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 \n#include \n#include \n#include \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 \n#include \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 \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 \n#include \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\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 \n#include \n#include \n#include \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 \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\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;new0)\n temp=j;\n }\n }\n if(flag==1)\n {\n a[0]=1;\n a[len-1]=9;\n for(j=1;j\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\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\n#include\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 \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\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 \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\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=1)\n {\n res+=n%10;\n n=n/10;\n }\n return res;\n}"}, {"source_code": "#include \n#include \n#include \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\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=1)\n {\n res+=n%10;\n n=n/10;\n }\n return res;\n}"}, {"source_code": "#include \n#include \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\nint main()\n{\n int n;\n while(~scanf(\"%d\",&n))\n {\n int sum,a,i,t=0;\n for(i=1;t\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\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\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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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\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 \n#include \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\n#include\n#include\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\n#include\n\nvoid main(){\nint n,i,z,count=0,sum,k;\nscanf(\"%d\",&n);\ni=z=19;\nwhile(count\n#include \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 \n#include \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 \n#include \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\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 \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\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\n#include\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\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 \n#include \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 \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\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\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\n#include\n#include\n#include\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 \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;count0)\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\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\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 \n#include \n#include \n#include \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 \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\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\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\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\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 \n#include \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\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 \n#include \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\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\nint main()\n{\n\tint n,c=19,s=19,m=0,i=1;\n\tscanf(\"%d\",&n);\n while(i\nint main()\n{\n long k,i,s,j,p,a[100000];\n\tscanf(\"%ld\",&k);\n\ti=0;j=19;\n\twhile(i0)\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 \n#include \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\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\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\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\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\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 \n#include \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\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\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\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\n#include\n#include\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\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\n#include\n#include\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 \n#include \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 \n#include \n#include \n#include \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\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\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 \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 \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\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\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\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\n#include\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 \n#include \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\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 \n#include \n#include \n#include \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\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 \n#include \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\n#include\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\n#include\n#include\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\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\n#include\n#include\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\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 \n#include \n#include \n\nint main()\n{\n\tint k,i;\n\tscanf(\"%d\",&k);\n\tint s=10;\n\tfor(i=0;i\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\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\n#include\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 \n#include \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\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 \n#include \n#include \n#include \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 \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 \n#include \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 \n#include \n#include \n#include \n#include \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\n#include\n#include\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\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 \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\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 \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\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\n#include\n#include\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\n#include\n\nvoid main(){\nint n,i,z,count=0,sum,k;\nscanf(\"%d\",&n);\ni=z=19;\nwhile(count\nint main()\n{\n int k;\n scanf(\"%d\",&k);\n int n=19;\n int i;\n for (i=1;i\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\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tprintf(\"%d\",(19*n));\n\treturn 0;\n}\n"}, {"source_code": "#include\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\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 \n#include \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\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\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\n#include\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 \n#include \n#include \n#include \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\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 \n#include \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\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\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 \n#include\n#include\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\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\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\n\nint main()\n{\n int a=1,b=9;\n \n printf(\"%d%d\",a,b);\n}"}, {"source_code": "#include \n#include \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\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\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\n#include\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 \n#include \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\n#include\n#include\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\n#include\n#include\n#include\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 \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 \n#include \n#include \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 \n#include \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\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\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 \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;count0)\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 \n#include \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\n#include\n#include\n#include\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\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tn=19<\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 \n#include \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\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#include \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\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 \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\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\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\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\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 \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 \n#include \n#include \n#include \n#include \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\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 \n#include \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\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\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\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\n#include\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 \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\n#include\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\n#include\n#include\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\n#include\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 \n#include \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$$$ — 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$$$ — 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\n#include\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\n#include\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\n#include\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\n#include\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\n#include\n#include\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=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\n#include\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\n#include \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 \n#include\n#include\n#include\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=0){\n printf(\"%c\",a[i]);\n }\n if(j\n#include \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=0;i--) \n\t\tprintf(\"%c\",b[i]);\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\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\n#include\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\n#include\n#include\n#include\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=0){\n printf(\"%c\",a[i]);\n }\n if(j\n#include\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\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\n#include \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 \n#include \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\n#include\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=0;i--) printf(\"%c\",b[i]);\nreturn 0;\n \n}"}, {"source_code": "#include\n#include\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\n#include\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\n#include\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\n#include\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\n#include\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\n#include\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\n#include\n#include\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#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 \n#include \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 \n#include \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=0){\nk--;\ni++;\ns[i]=t[k];\n}\n}\n\nprintf(\"%s\",s);\nreturn 0;\n}\n"}, {"source_code": "#include \n#include \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\n#include\n#include\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\n#include\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\n#include \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\n#include\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\n#include\n#include\n#include\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\n#include\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\n#include\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=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=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\n#include\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= 0; j--) {\n printf(\"%c\", ans[j]);\n }\n return 0;\n}"}, {"source_code": "#include \n#include \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\n#include\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 = 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\n#include\n#include\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\n#include\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 \n#include \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\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\n#include\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=0){\n\tprintf(\"%c\",s[start-i]);}\n\telse\n\t\tbreak;\n}/*\t\nfor(int i=0;i\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\n#include\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=0;i--) printf(\"%c\",b[i]);\nreturn 0;\n \n}"}, {"source_code": "#include \n#include \n#include\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\n#include\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\n#include\n#include\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\n#include\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= 0; j--) {\n printf(\"%c\", ans[j]);\n }\n return 0;\n}"}, {"source_code": "#include\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\n#include\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\n#include\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\n#include\n#include\n#include\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=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\n#include\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\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 \n#include\n#include\n#include\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=0){\n printf(\"%c\",a[i]);\n }\n if(j\n#include\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=0){\n\tprintf(\"%c\",s[start-i]);}\n\telse\n\t\tbreak;\n}/*\t\nfor(int i=0;i\n#include \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=0)\n rs1[i++] = s1[j];\n rs1[i] = '\\0';\n for(i=0; i\n#include \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\n#include\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 \n#include \n#include \n\n\n\nunsigned int a=0;//кол-во cnhjr\nunsigned int b=0;//кол-во столбцов\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\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\n#include\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\n#include\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\n#include\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\n#include\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#include \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\n#include\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\n#include\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\n#include\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=0;i--) printf(\"%c\",b[i]);\nreturn 0;\n \n}"}, {"source_code": "#include\n#include\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= 0; i--)\n\t{\n\t\tprintf(\"%c\", s[i]);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\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;il)\n break;\n }\n str[l]='\\0';\n printf(\"%s\\n\",str);\n return 0;\n}\n"}, {"source_code": "#include\n#include\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\n#include\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\n#include\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#include\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;il)\n break;\n }\n str[l]='\\0';\n printf(\"%s\\n\",str);\n return 0;\n}\n"}, {"source_code": "#include\n#include\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=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\n#include\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\n#include\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\n#include \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=0;i--) \n\t\tprintf(\"%c\",b[i]);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n#include \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\n#include\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\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#include\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\n#include\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=0)\n printf(\"%c\",s[(n-1)/2-i]);\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\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\n#include\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\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#include\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#include\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\n#include \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\n#include\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\n#include\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=0) printf(\"%c\",s[fro--]);\n }\n }*/\n while (fro>=0||rear=0) printf(\"%c\",s[fro--]);\n if (rear\n#include\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\n#include \n#include \n#include \n#include \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\n#include\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\n#include \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\n#include \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 \n#include\n#include\n#include\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=0){\n printf(\"%c\",a[i]);\n }\n if(j\n#include\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\n#include\n#include\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\nint main()\n{\n\tint a[100000],n,i,k,c=0,t;\n\tscanf(\"%d %d\",&n,&k);\n\tfor(i=0;ik)\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\n#include\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\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 \n#include \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\n#include\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\n#include\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\n#include\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 \n#include \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\n#include\n#include\n#include\n#include\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 \n#include \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\n#include\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\n#include \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\n#include\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\n#include\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=0,j\n#include\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\n#include\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\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\n#include\nint main()\n{\nchar a[100],b[100];\nint l;\nscanf(\"%s\", a);\nl=strlen(a);\nfor(int i=0;i\n#include\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\n#include\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\n#include \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\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 \n#include \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=0;i--)\n {\n printf(\"%c\",g[i]);\n }\n printf(\"\\n\");\n }\n}\n"}, {"source_code": "#include\n#include\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\n#include\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\n#include \n#include \n#include \n#include \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 \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\n#include\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\n#include\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 \n#include \n#include \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=0)\n {\n printf(\"%c\",a[k-i]);\n }\n }\n \n}"}, {"source_code": "#include\n#include\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\n#include\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\n#include\n#include\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\n#include\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\n#include\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\n#include \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\n#include\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\n#include\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\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\n#include\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 \n#include \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\n#include\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 \n#include \n#include \n\n\n\nunsigned int a=0;//кол-во cnhjr\nunsigned int b=0;//кол-во столбцов\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\n#include\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#include\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\n#include \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\n#include\n#include\n#include\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=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\n#include\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\n#include\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\n#include\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\n#include\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\n#include\n#include\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#include\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 \n#include\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\n#include \n#include \n#include \n#include \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\n#include\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\n#include \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= 0; i--) printf(\"%c\", ans[i]);\n printf(\"\\n\");\n }\n}"}, {"source_code": "#include\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 \n#include \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\n#include\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\n#include\n#include\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#include\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=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=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 \n#include \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=0;i--)\n {\n printf(\"%c\",g[i]);\n }\n printf(\"\\n\");\n }\n}\n"}, {"source_code": "#include\n#include\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\n#include\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#include \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\n#include\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\n#include\n#include\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#include\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\n#include \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=0;i--)\n {\n printf(\"%c\",g[i]);\n }\n printf(\"\\n\");\n}\n"}, {"source_code": "#include\n#include\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\n#include \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\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 \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\n#include\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=0;i=i-2,j++)\n {\n in[i]=out[j];\n }\n for(i=1;i\n#include\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\n#include\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 \n#include \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\n#include \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= 0; i--) printf(\"%c\", ans[i]);\n printf(\"\\n\");\n }\n}"}, {"source_code": "#include\n#include\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 \n#include \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=0;i--)\n {\n printf(\"%c\",f[i]);\n }\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\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=0,j\n#include\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=0)\n printf(\"%c\",s[(n/2)-1-i]);\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main(){\n char s[101];int flag=0;\n scanf(\"%s\",s);\n int i;\n for(i=0;i\n#include\nint main ()\n{\nchar s[100];\nint l,i=0,n;\nscanf(\"%s\",&s);\nl=strlen(s);\nn=l-1;\nwhile(i\n#include\n#include\n#include\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#include \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 \n#include\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=0)\n {\n\t\twhile(i>=0)\n\t\ts2[t++]=s1[i--];\n\t}\n\tif(j\n#include\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=0;i=i-2,j++)\n {\n in[i]=out[j];\n }\n for(i=1;i\n#include\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= 0; j--) {\n printf(\"%c\", ans[j]);\n }\n return 0;\n}"}, {"source_code": "#include\n#include\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\n#include\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\n#include\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\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 \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 \n#include \n#include \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];//�������ַ����� \n\tchar dest[50];//�������ַ�����\n\tscanf(\"%s\",suorce); \n\tn=strlen(suorce);\n\tif(n%2==0)\n\t{\n\t\tfor(i=0;i\n#include\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#include\n#include\n#include\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\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\n#include\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\n#include\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\n#include\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 \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\n\n int main(){\n int n,k;\n scanf(\"%d%d\",&n,&k);\n int ar[n];\n for(int i=0;i=a?max:a;\n }\n printf(\"%d\\n\",max);\n return 0;\n }\n"}, {"source_code": "#include \n#include\n#include\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;imax) max=abs(e_cpy-s_cpy);\n\t}\n printf(\"%d\", max);\n\n\treturn 0;\n}\n\n"}, {"source_code": "#include \n#include \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\n#include\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=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#include\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\n#include\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;imax)max=abs(a-b);\n }\n printf(\"%d\",max);\n}"}, {"source_code": "#include \n#include \n#include \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;i0;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\n#include\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=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 \n#include \nint main()\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n int arr[n];\n for(int i = 0;i=ans)\n ans=fabs(e-s);\n }\n printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n\tint n,k;\n\tscanf(\"%d %d\",&n,&k);\n\tint a[n];\n\tfor (int i=0;i=0;j-=k)\n\t\tb[j]=0;\n\tfor (int i=0;imax)\n\t\tmax=sum;\n\telse if (sum<0 && (sum*(-1))>max)\n max=sum*(-1);\n for (int i=0;i\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 \n#include \n#include \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\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;iv1)\n v1=v;\n }\n printf(\"%d\",v1);\n}\n"}, {"source_code": "#include\n#include \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 \n#include \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 ; idem[i]?kq:dem[i];\n\t}\n\t\n\tprintf(\"%d\",kq);\n\treturn 0;\n}\n"}, {"source_code": "#include\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#include\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 \n#include \n#include \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\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\n#include\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#include \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\n#include\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\n#include\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 \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 \n#include\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 \n#include \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;imax)\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 \n#include \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 \n#include \n#include \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;item?ans:tem;\n }\n printf(\"%d\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\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]\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\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=0) st-=k;\n st+=k;\n for(int j=st;jmaxdiff)maxdiff=s-ij;\n else if(ij-s>maxdiff)maxdiff=ij-s;\n for(int l=0;l\nint main(){\n\tint k, n;\n\tint type[100];\n\tscanf(\"%d %d\",&n,&k);\n\tfor(int i=0; i\nint main()\n{\n\tint k, n;\n\tint type[100];\n\tscanf(\"%d %d\",&n,&k);\n\tfor(int i=0; i\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\n#include \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=0; j-=k)\n\t\t{\n\t\t\t\ttemp[j]=0;\n\t\t}\n\t\tfor(int j=i; jmax)\n\t\t\tmax=abs(cnt1-cnt2);\n\t}\n\tprintf(\"%d\\n\", max);\n\n\n\n}"}, {"source_code": "#include \n#include \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;i0)x++;\n\t\telse y++;\n\t}\n\ts=0;\n\tfor(i=0;i0)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 \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;imax)\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\n#include\n#include\n#include\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 \n#include \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 \n#include \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//删掉最多的社交,或者删掉最多的测试\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;is){\n if(answer\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;ic2)\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;id)\n\t\td=br[i];\n\t}\n\tprintf(\"%d\\n\",d);\n\treturn 0;\n}"}, {"source_code": "#include\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; imax) max=y[i];\n }\n printf(\"%d\",max);\n}\n\n"}, {"source_code": "#include \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; ics) d[i] = ce-cs;\n else d[i] = cs-ce;\n }\n\n j = d[0];\n for(i=1; i\n#include\n#include\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;imax)\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\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#include \n#include \n#include \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 \nvoid read(int *arr, int length) {\n for (int i=0; i\n#include \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 \n#include\nint main()\n{\n int k,n;\n scanf(\"%d %d\",&n,&k);\n int arr[n];\n for(int i=0;i=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;jmax)\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\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;imax) max=ans[i];\n}\n\nprintf(\"%d\\n\",max);\nreturn 0;\n}"}, {"source_code": "#include\n#include\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\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\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\n#include\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\n#include\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\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;imad)\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\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=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 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\n#include\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;imax)max=diff;\n\t}\n\tprintf(\"%d\",max);\n}"}, {"source_code": "#include\n#include\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 \n#include \n#include \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\n#include\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;imx)\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\n#include\n#include\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=1;i--){\n\t\t\ta[b+i*k-1]=0; \n\t\t}\n\t\tfor(j=0;jtemp)\n\t\t\ttemp=sum[i];\n\t}\n\tprintf(\"%d\",temp);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \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 ; idem[i]?kq:dem[i];\n\t}\n\n\tprintf(\"%d\",kq);\n\treturn 0;\n}"}, {"source_code": "#include\n#include\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;imax)\n max=val;\n }\n printf(\"%d\",max);\n}\n"}, {"source_code": "#include \n#include \n#include \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#include\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\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 \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 \n#include \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\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;in-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;is)\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#include \n#include \n#include \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;imax)\n max=result;\n }\n printf(\"%d\",max);\n\n}\n"}, {"source_code": "#include\n#include\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;imax) max=temp;\n }\n printf(\"%d\",max);\n return 0;\n}"}, {"source_code": "#include \n#include \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\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=0||b+(i*k)=0)\n ar[b-(i*k)]=0;\n if(b+(i*k)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\n#include\n#include\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=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\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)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\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; if)\n {\n f=g;\n }\n }\n printf(\"%d\\n\",f);\n return 0;\n}\n"}, {"source_code": "#include\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\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;i0)\n pcount++;\n }\n ncount=n-pcount;\n for(int i=0;i\n#include\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\n#include\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 \n#include \n#include \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;imax)\n max=abs(e-s);\n }\n printf(\"%d\",max);\n}"}, {"source_code": "#include \n#include \n#include \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;imax)\n max=abs(e-s);\n }\n printf(\"%d\",max);\n}"}, {"source_code": "#include \n#include \nint main()\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n int arr[n];\n for(int i = 0;i=ans)\n ans=fabs(e-s);\n }\n printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "#include\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=0){\n //int num = 0 , int min = 0 ; \nfor(j=0 ; jnum){\n min = num ;\n int index = j ;\n }\n \nfor(i=0 ; i\n#include\n#include\n#include\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\n#include\n#include\n#include\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 \n#include \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\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=s) {\n\n for(i=0;iy[max]-z[max]) max=i;\n }\n\n\n\n\n for(j=max;jy[max]-z[max]) max=i;\n }\n\n\n\n for(j=max;j\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=s) {\n\n for(i=0;iy[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;iy[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\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=s) {\n\n for(i=0;iy[max]) max=i;\n }\n\n\n\n\n for(j=max;jy[max]) max=i;\n }\n\n\n\n for(j=max;j\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=s) y[i]=-1*y[i];\n }\n\n max=0;\n for(i=1; iy[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\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=s)\n {\n\n for(i=0; iy[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\n#include\n#include\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;imax)\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\n#include\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;imx)\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 \n#include \n#include \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#include \n#include \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#include \n#include \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#include\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;imax) max=temp;\n }\n printf(\"%d\",max);\n return 0;\n}"}, {"source_code": "#include\n#include\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;imax) max=temp;\n }\n printf(\"%d\",max);\n return 0;\n}"}, {"source_code": "#include\n#include\n#include\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#include\n#include\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#include\n#include\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\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\n#include\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 ≤ k ≤ n ≤ 1012). 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 \n#include \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\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 \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 \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\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 \n#include \n#include \n#include \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 \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\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\n#include\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\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\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 \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\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\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\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\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\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\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 \n#include \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 \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 \n#include \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\n#include\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 \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\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 \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)\n\t{\tsum=1;\n for (i=1; i\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 \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 \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)\n\t{\tsum=1;\n for (i=1; i\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 \n#include \n#include \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\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\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 \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\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 \nint main()\n{\n long long int n,k,a,b,c=0,tek=0;\n scanf(\"%I64d %I64d\",&n,&k);\n //tek sayı sayısını bulalım\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 \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\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\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 \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\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\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 \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\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\n#include \n#include \n#include \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\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\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\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 \n#include \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 \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 \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\n#include\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 \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)\n\t{\tsum=1;\n for (i=1; i\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\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\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\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\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\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 \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\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\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\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\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 \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)\n\t{\tsum=1;\n for (i=1; i\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 \n#include \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 \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\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\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 \n#include \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\n#include\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(valkey)\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\n#include\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\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\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\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 \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\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\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\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\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 \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\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\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 \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\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\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 \n#include \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 \n#include \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\n#include\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\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 \n#include \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 \n#include\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\n#include\n#include\n#include\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\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\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\n#include\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 \n#include \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\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\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\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\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\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\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 \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\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\n#include\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\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\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 \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\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\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 \n#include \n#include \n#include \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 \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\n# include\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\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 \n#include \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\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\n#include\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\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 \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 \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\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\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\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 \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\n#include\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#include\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\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 \n#include \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 \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\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\n#include\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(kx)\n {\n m=n-x;\n y=2+(m-1)*2;\n }\n printf(\"%lld\",y);\n}\n"}, {"source_code": "#include\n#include\n#include\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\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\nint main()\n{\n int n,k,a,b,c=0,tek=0;\n scanf(\"%d %d\",&n,&k);\n //tek sayı sayısını bulalım\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\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\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\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\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 \n#include \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\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\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\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\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\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\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 \n#include \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\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\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\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 \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\n#include\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 \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\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 \n#include \n#include \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\n#include\n#include\n#include\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\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\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 \nint main()\n{\n long long int n,k;\n scanf(\"%lld%lld\",&n,&k);\n if(kn/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 \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\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 \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\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\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(kn/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\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 \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#include\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\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\n#include\n#include\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 \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\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\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(a/2)){\n for(int i=0;i\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\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 \n#include \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\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\n#include\n#include\n#include\n#include\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 \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\n#include\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\n#include\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\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\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\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 \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\n# include\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\n#include \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 \n#include \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\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\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 \n#include \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\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\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\n#include\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\n#include\n#include\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 \n#include \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 \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 ≤ n ≤ 1018) — 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\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\nint main()\n{\n\tunsigned long long n;\n\tscanf(\"%lld\",&n);\n\tprintf(\"%lld\\n\",n/2520);\n}\n"}, {"source_code": "#include \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\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\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\nint main ()\n{\n long long int n;\n scanf(\"%lld\",&n);\n printf(\"%lld\",n/2520);\n}"}, {"source_code": "#include \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\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\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\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\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\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\nint main(){\nlong long int n;\nscanf(\"%lld\",&n);\nprintf(\"%lld\",n/2520);\nreturn 0;\n}"}, {"source_code": "#include \n#include \n#include \n#include \n#include \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 \nlong long x;\nint main()\n{\n\tscanf(\"%lld\",&x);\n\tprintf(\"%lld\\n\",x/2520);\n\treturn 0;\n}"}, {"source_code": "#include\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\n#include\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 \n#include \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 \nint main()\n{\n long long int n;\n scanf(\"%lld\",&n);\n printf(\"%lld\\n\",n/2520);\n}\n"}, {"source_code": "#include\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\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\nlong long int n;\nint main()\n{\n scanf(\"%lld\",&n);\n printf(\"%lld\",n/2520);\n}\n"}, {"source_code": "#include\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\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\n#include\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\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\nint main(){\n unsigned long long int n;\n scanf(\"%llu\",&n);\n printf(\"%llu\",n/2520);\n}\n"}, {"source_code": "#include\nint main()\n{\nlong long int n;\nscanf(\"%lld\",&n);\nprintf(\"%lld\\n\",n/2520);\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n;\n scanf(\"%lld\",&n);\n printf(\"%lld\",n/2520);\n return 0;\n}"}, {"source_code": "#include\n#include\n#include\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 \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\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\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 \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\nint main()\n{\n long long int n;\n scanf(\"%lld\",&n);\n printf(\"%lld\",n/2520);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tunsigned long long n;\n\tscanf(\"%lld\",&n);\n\tprintf(\"%lld\\n\",n/2520);\n}\n"}, {"source_code": "#include \nlong long x;\nint main()\n{\n\tscanf(\"%lld\",&x);\n\tprintf(\"%lld\\n\",x/2520);\n\treturn 0;\n}"}, {"source_code": "#include\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\nint main()\n{\n unsigned long long int n;\n scanf(\"%I64d\",&n);\n printf(\"%I64d\",n/2520);\n}\n"}, {"source_code": "#include\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\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\nint main()\n{\n\tunsigned long long n;\n\tscanf(\"%lld\",&n);\n\tprintf(\"%lld\\n\",n/2520);\n}\n"}, {"source_code": "#include\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\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 \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\n\nint main()\n{\nlong long int n;\nscanf(\"%lld\",&n);\nprintf(\"%lld\",n/2520);\nreturn 0;\n}\n"}, {"source_code": "#include\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\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\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\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\nint main()\n{\n\t__int64 i;\n\tscanf(\"%I64d\",&i);\n\tprintf(\"%I64d\",i/2520);\n\treturn 0;\n}\n"}, {"source_code": "#include\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\nlong long int n;\nint main()\n{\n scanf(\"%lld\",&n);\n printf(\"%lld\",n/2520);\n}\n"}, {"source_code": "#include\nint main () {\n\tlong long int b;\n\tscanf(\"%lld\",&b);\n\t\tprintf(\"%lld\",b/2520);\n}\n"}, {"source_code": "#include\n#include\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\nint main ()\n{\n\tlong long int n;\n\tscanf(\"%lld\",&n);\n\tprintf(\"%lld\",(n/2520));\n\n}\n"}, {"source_code": "#include \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\n\nint main(){\n long long int n;\n scanf(\"%I64d\",&n);\n printf(\"%I64d\",n/2520);\n}\n"}, {"source_code": "#include\nmain()\n{\nlong long int n, k=0;\nscanf(\"%lld\",&n);\nk=n/2520;\nprintf(\"%lld\",k);\n}\n"}, {"source_code": "#include\nint main () {\n\tlong long int b;\n\tscanf(\"%lld\",&b);\n\t\tprintf(\"%lld\",b/2520);\n}\n"}, {"source_code": "#include \nlong long x;\nint main()\n{\n\tscanf(\"%lld\",&x);\n\tprintf(\"%lld\\n\",x/2520);\n\treturn 0;\n}"}, {"source_code": "#include\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\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\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\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\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\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 \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\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\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\nint main()\n{long long int n;\nscanf(\"%I64d\",&n);\nprintf(\"%I64d\",n/2520);\n}\n"}, {"source_code": "#include\nint main ()\n{\n\tlong long int n;\n\tscanf(\"%lld\",&n);\n\tprintf(\"%lld\\n\",n/2520);\n}\n"}, {"source_code": "#include\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\nint main()\n{\n\tunsigned long long n;\n\tscanf(\"%lld\",&n);\n\tprintf(\"%lld\\n\",n/2520);\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n;\n scanf(\"%lld\",&n);\n printf(\"%lld\",n/2520);\n return 0;\n}"}, {"source_code": "#include\n\nint main(){\n long long int n;\n scanf(\"%I64d\",&n);\n printf(\"%I64d\",n/2520);\n}\n"}, {"source_code": "#include\nint main () {\n\tlong long int b;\n\tscanf(\"%lld\",&b);\n\t\tprintf(\"%lld\",b/2520);\n}\n"}, {"source_code": "#include\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\n#include\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\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 \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 \n#include \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\n#include\nint main(){\nlong long int a,b,c;\nscanf(\"%lld\",&a);\nprintf(\"%lld\",a/2520);\n}"}, {"source_code": "#include\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\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\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\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\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\n#include\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 \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\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\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\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\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\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 \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\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 \nint main (){\n long long int i;\n scanf(\"%lld\",&i);\n printf(\"%lld\",i/2520);\n}"}, {"source_code": "#include\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\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\n#include\nint main(){\nlong long int a,b,c;\nscanf(\"%lld\",&a);\nprintf(\"%d\",a/2520);\n}"}, {"source_code": "#include\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 \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\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\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tprintf(\"%d\",n/2520);\n\treturn 0;\n}\n"}, {"source_code": "#include\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\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\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\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\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 \n#include \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\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\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\nint main () {\n\tint b;\n\tscanf(\"%d\",&b);\n\t\tprintf(\"%d\",b/2520);\n}\n"}, {"source_code": "#include \n#include \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\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\nint main()\n{\n int n,i,j,c=0,f;\n scanf(\"%d\",&n);\n for(i=1;i\n#include \n#include \n#define __STDC_FORMAT_MACROS\n#include \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\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\nint main()\n{\n int a,i,b,cnt=0;\n scanf(\"%d\", &a);\n for(i=1;i\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\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\n#include\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\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\n#include\nmain()\n{\n long long int n,i,count=0;\n scanf(\"%I64d\",&n);\n for(i=0;i\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\nint main()\n{\n int a,i,b,cnt=0;\n scanf(\"%d\", &a);\n for(i=1;i\n#include\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\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\n#include\nint main(){\nlong long int a,b,c;\nscanf(\"%lld\",&a);\nprintf(\"%d\",a/2520);\n}"}, {"source_code": "#include\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\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\n#include\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tint count=0,i=1;\n\tfor(i=2520;i\nmain()\n{\nint n;\nscanf(\"%d\",&n);\nprintf(\"%d\",n/2520);\n}"}, {"source_code": "//1920\n#include\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\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\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\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\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\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\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\nint main()\n{\n int n,ans;\n scanf(\"%d\", &n);\n ans=n/2520;\n printf(\"%d\", ans);\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tprintf(\"%d\",n/2520);\n\treturn 0;\n}\n"}, {"source_code": "#include\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\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\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\n#include\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tint count=0,i=1;\n\tfor(i=2520;i\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 \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\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 \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\nmain()\n{\nint n;\nscanf(\"%d\",&n);\nprintf(\"%d\",n/2520);\n}"}, {"source_code": "#include\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\nint main(){\nint n;\nscanf(\"%lld\",&n);\nprintf(\"%lld\",n/2520);\nreturn 0;\n}\n"}, {"source_code": "#include\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\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 \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\n#include\nint main(){\nlong long int a,b,c;\nscanf(\"%lld\",&a);\nprintf(\"%d\",a/2520);\n}"}, {"source_code": "#include \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\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 \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 \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\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\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\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\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\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\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\n#include\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\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\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\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\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\nint main()\n{\n long long int n,i,j,c=0,f;\n scanf(\"%lld\",&n);\n for(i=1;i\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\nint main()\n{\n int a,i,b,cnt=0;\n scanf(\"%d\", &a);\n for(i=1;i\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\nint main()\n{\n long long int n,i,j,c=0,f;\n scanf(\"%lld\",&n);\n for(i=1;i\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\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\nint main()\n{\n int n,s;\n scanf(\"%d\",&n);\n s=n/2520;\n printf(\"%d\",s);\n}"}, {"source_code": "#include\n#include\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\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\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\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 \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\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 \n#include \n#include \nint main()\n{ unsigned long long n,r;\nint i;\nscanf(\"%lld\",&n);\nprintf(\"1\");\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tprintf(\"%d\",n/2520);\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\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 \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\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\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\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\n#include\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\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\n#include\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\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 — 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 — 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\n#include\n#include\n\nvoid toup(char x[],int n){int i;for(i=0;ia) toup(x,n);\n\n else tolow(x,n);\n\n puts(x);\n}\n\n"}, {"source_code": "#include\n#include\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=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 \n#include \n#include \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='a'&&string[i]<='z') lower++;\n else upper++;\n }\n \n if (upper>lower){\n \n for (int i =0;i\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;ik)?strupr(s) : strlwr(s));\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n char str[100];\n int c=0,c1=0,i;\n scanf(\"%s\",str);\n for(i=0;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\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\n#include\n#include\nint countup(char *str)\n{ int count=0;\n for(int i=0;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 \n#include \n#include \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\n#include\n#include\n\n/*pbkeybord*/\nint main ()\n{\nchar word[100];\nint i;\nint countlower=0,countupper=0;\nscanf(\"%s\",word);\n\nfor(i=0;i=countupper)\n{\n for(i=0;i\n#include\nint main()\n{\n char string[100];\n int ucount=0,lcount=0;\n \n scanf(\"%s\",string);\n for(int i=0;i=65)&&(n<=90))\n ucount++;\n else\n lcount++;\n }\n \n if(ucount>lcount)\n { \n for(int i=0;i=97)&&(l<=122))\n string[i]=string[i]-32;\n }\n }\n else\n {\n for(int i=0;i=65)&&(p<=90))\n string[i]=string[i]+32;\n }\n }\n \n printf(\"%s\",string);\n return 0;\n} "}, {"source_code": "#include\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\n#include\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='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='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='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\n#include\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='A' && s[i]<='Z'){\n upper++;\n }\n else {\n lower++;\n }\n }\n\n if(lower>=upper){\n for(i=0;i='A' && s[i]<='Z'){\n s[i]='a' + (s[i] -'A');\n }\n }\n }\n else{\n for(i=0;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\n#include\n#include\n\nchar toup(char x[],int n)\n{\n int i;\n for(i=0;ia) x[n]=toup(x,n);\n\n else x[n]=tolow(x,n);\n\n puts(x);\n}\n\n"}, {"source_code": "#include\n#include\nint main()\n{\n char string[100];\n int ucount=0,lcount=0;\n \n scanf(\"%s\",string);\n for(int i=0;i=65)&&(n<=90))\n ucount++;\n else\n lcount++;\n }\n \n if(ucount>lcount)\n { \n for(int i=0;i=97)&&(l<=122))\n string[i]=string[i]-32;\n }\n }\n else\n {\n for(int i=0;i=65)&&(p<=90))\n string[i]=string[i]+32;\n }\n }\n \n printf(\"%s\",string);\n return 0;\n} "}, {"source_code": "#include \n#include \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='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='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='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 \n#include \n#include \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 \n#include \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 \n#include \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;ilo) {\n for (i=0;i96) a[i]=a[i]-32;\n }\n }\n else if (up\n#include \n#include \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 \n#include \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\n#include \n#include \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='a'&&string[i]<='z') lower++;\n else upper++;\n }\n \n if (upper>lower){\n \n for (int i =0;i\nint main()\n{\nchar s[100];\nint n,c=0,r=0,j=0;\ngets(s);\nn=strlen(s);\nfor(int i=0;i='a'&&s[i]<='z')\n{\nc++;\n}\nelse\n{\nr++;\n}\n}\nj=(n+1)/2;\nif(c\n#include \n#include \nint main()\n{\nchar a[100];\nint i;\nfloat mid,sum=0;\nscanf(\"%s\",a);\nfor(i=0;i='a'&&a[i]<='z')\n sum++;\n}\nmid=(float)strlen(a)/2;\n if(sum>=mid)\n {\n for(i=0;i='A'&&a[i]<='Z')\n {\n a[i]=a[i]+32;\n }\n }\n\n }\n else\n {\n for(i=0;i='a'&&a[i]<='z')\n {\n a[i]=a[i]-32;\n }\n }\n }\n printf(\"%s\",a);\n}\n"}, {"source_code": "#include \n#include \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= '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\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 \n#include \n#include \nint main(){\n char mot[100];\n scanf(\"%s\",mot);\n int low =0;\n int up =0;\n for (int i=0;i=up){\n for (int i =0;i\n#include\nint main()\n{\nchar s[101];\nscanf(\"%s\",s);\nint len=strlen(s),freq_l=0,freq_u=0;\nfor(int i=0;i=65&&s[i]<=90)\nfreq_u++;\nelse\nfreq_l++;\n}\nif(freq_u>freq_l)\n\t{\n\tfor(int i=0;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=65&&s[i]<=90)\n\ts[i]+=32;\n\t}\n\t}\nprintf(\"%s\",s);\n}"}, {"source_code": "#include\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 \n#include \n#include \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\n#include\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'&& 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' && str[i]<='Z')\n str[i]+=32;\n }\n }\n else if(c2>c1)\n {\n for(int i=0;i='a' && str[i]<='z')\n str[i]-=32;\n }\n }\n else\n {\n for(int i=0;i='A' && str[i]<='Z')\n str[i]+=32;\n }\n }\n printf(\"%s\",str);\n}\n "}, {"source_code": "#include \n#include \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\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;i64&&arr[i]<91)\n arr[i]+=32;\n printf(\"%c\",arr[i]);\n }\n }\n else{\n for(i=0;i96&&arr[i]<123)\n arr[i]-=32;\n printf(\"%c\",arr[i]);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\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\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\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=97&&s[i]<=122)\n j++;\n else\n k++;\n }\n if(j>=k)\n {\n for(i=0;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\n#include\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\n#include\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\n#include\n#include\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=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=65)&&(t<=90))\n {\n t += 32;\n str[i] = t;\n }\n }\n }\n else\n {\n for(i=0;i=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\n#include\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\n#include\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\n#include\n#include\nint main(void)\n{\n char str1[100];\n scanf(\"%s\", str1);\n int cap=0;\n int smol;\n for(int i=0; ismol){\n for(int i=0; i90)\n str1[i] += -32; \n }\n }\n else{\n for(int i=0; i\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=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\n#include\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\n#include\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=97&&s[i]<=122){\n \tc++;\n }\n else if(s[i]>=65&&s[i]<=90){\n \tm++;\n }\n } \nfor(i=0;i=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 \n#include \n#include \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='a' && str[i]<='z')\n ++small;\n else\n ++cap;\n if(cap>small)\n for(int i=0;i\n#include\nint main()\n{\n int i,c=0,c2=0;\n\n char s[100];\n scanf(\"%s\",&s);\n for(i=0; i= 'a' && s[i]<='z'){\n c++;\n }\n else {\n c2++;\n }\n\n }\n if(c2>c){\n for(i=0; i= 'a' && s[i]<='z'){\n s[i]=s[i]-32;\n }\n }\n }\n else{\n for(i=0; 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 \n#include \n#include \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\n#include\n#include\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=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 //C\n#include \nint main()\n{\n int i,un=0,ln=0;\n char s[100];\n gets(s);\n for(i=0;iln)\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 \n#include \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 \n#include\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\n#include\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\n#include\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='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\n#include\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=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=97 && str[i]<=122)\n str[i]=65+str[i]-97;\n }\n }\n else \n {\n for(i=0;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\n#include\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;ip)\n {\n puts(b);\n\n }\n else\n {\n puts(c);\n\n }\n\n return 0;\n }\n\n"}, {"source_code": "#include\n#include\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'Z')\n s[k]=s[k]-32;\n }\n }\n printf(\"%s\\n\",s);\n }\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \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\n#include\n#include\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='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\n#include\n#include\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\n#include\n#include\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=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\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 \n\n#include \n\n#include \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=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\n#include\n#include\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 \n#include \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\n#include\nint main()\n{\n\tchar s[101];\n\tint i,u=0,v=0;\n\tscanf(\"%s\",s);\n\tfor(i=0;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='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='a' && s[i]<='z'){\n\t\ts[i]=(s[i]-'a')+'A';}\n\t}\n\t}\n\tprintf(\"%s\",s);\n}"}, {"source_code": "#include\n#include\nint main()\n{\n char s[1000];\n int i,a=0,b=0;\n gets(s);\n for(i=0;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\n#include\n#include\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=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=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=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\n int main()\n {\n char s[101];\n gets(s);\n int capital=0,small=0,i,ans;\n for(i=0;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\n#include\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='a'&&str[i]<='z'){\n c++;\n }else{\n d++;\n }\n }\n for(int i=0;i=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\n#include \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=b){\n \tfor(i=0;i\n#include \n#include \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\n#include\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;imin){\n for(i=0;i'Z')\n A[i]=A[i]-' ';\n } \n }\n else{\n for(i=0;i\n #include\n int main(){\n \tchar s[101];\n \tint i,c=0;\n \tscanf(\"%s\",s);\n \tfor(i=0;istrlen(s)/2 ? strupr(s):strlwr(s));\n }"}, {"source_code": "#include\n#include\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=n)?tolower(c[i]):toupper(c[i]));\nprintf(\"\\n\");\nreturn 0;}\n"}, {"source_code": "#include\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 \n#include \n#include \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=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\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='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=u)\n {\n if(a[i]>='A'&&a[i]<='Z')\n {\n a[i]=a[i]+32;\n }\n }\n }\n for(i=0;il)\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 \n#include \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 \n#include \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\n#include\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;i64 && 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;i64 && 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;i64 && 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=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 \n#include \n#include \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='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 \n#include \nchar s[105];\nint l,i,b=0,k=0;\nint main(){\n\tscanf(\"%s\",s);\n\tl=strlen(s);\n\tfor(i=0;ik){\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 \n#include \n#include \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\n#include\n#include\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=97 && a[i]<=122)\n {\n scount++;\n \n }\n else\n {\n ccount++;\n \n }\n }\n }\n \n for(i=0;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\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='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='a' && str[i]<='z')\n {\n str[i]=str[i]-32;\n }\n }\n }\n else\n {\n for(i=0;i='A' && str[i]<='Z')\n {\n str[i]=str[i]+32;\n }\n }\n }\n printf(\"%s\",str);\n}\n"}, {"source_code": "#include\n#include\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\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\n#include\n\nint main()\n{\n char s[1000],count=0;\n scanf(\"%s\",s);\n int p=strlen(s);\n for(int i=0;ip/2?strupr(s):strlwr(s));\n return 0;\n}"}, {"source_code": "#include\n#include\n#include\nint main()\n{\n char x[101],a=0,b=0,i;\n\n gets(x);\n\n for(i=0;ia) for(i=0;i\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\n#include\n#include\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;icount2)\n{\n\tfor(i=0;i\n#include \n#include \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\n#include\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\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\n#include\n#include\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\n#include \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 \n#include\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\n#include \n#include\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;im)\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\n#include\nint main(){\n char a[100],b;\n int i,c=0;\n scanf(\"%s\",a);\n for(i=0;i0)printf(\"%s\\n\", strlwr(a));\n else printf(\"%s\\n\", strupr(a));\n return 0;\n}"}, {"source_code": "#include \n#include\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;ilen/2)\n {\n for(int i=0;i=97)\n {\n str[i]=str[i]-32;\n }\n }\n }\n else\n {\n for(int i=0;i\n#include\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\n#include\n#include\n#include\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 \n#include \n#include \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 \n#include \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\n#include\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='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=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\n#include\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 \n#include \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\n#include\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\n#include\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\n#include\n#include\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;i97)\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\n#include\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=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=97&&s[i]<=122)\n s[i]=s[i]-32;\n }\n printf(\"%s\",s);\n }\n else if(c=65&&s[i]<=90)\n s[i]=s[i]+32;\n }\n printf(\"%s\",s);\n }\n else\n {\n for(i=0;i=65&&s[i]<=90)\n s[i]=s[i]-32;\n }\n printf(\"%s\",s);\n }\n return 0;\n}"}, {"source_code": "#include \n#include \n#include\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 ='a')\n l++;\n\n else\n u++;\n }\n if(l>=u){\n for(k = 0; k \n#include \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 \n//#include\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;ilen/2)\n {\n for(int i=0;i=97)\n {\n str[i]=str[i]-32;\n }\n }\n }\n else\n {\n for(int i=0;i\n#include \n#include \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 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\n#include\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'&& 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' && str[i]<='z')\n str[i]+=32;\n }\n }\n else if(c2>c1)\n {\n for(int i=0;i='a' && str[i]<='z')\n str[i]-=32;\n }\n }\n else\n {\n for(int i=0;i='A' && str[i]<='Z')\n str[i]+=32;\n }\n }\n printf(\"%s\",str);\n}\n "}, {"source_code": "#include\n#include\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\n#include\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=lw)\n\tprintf(\"%s\",strupr(a));\n\telse\n\tprintf(\"%s\",strlwr(a));\t\n}"}, {"source_code": "#include \n#include \n#include \n#include \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;inb2)\n\t{ \tfor (i=0;i\n#include\nint main()\n{\n\tchar s[101];\n\tint i,u=0,v=0;\n\tscanf(\"%s\",s);\n\tfor(i=0;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='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='a' && s[i]<='z'){\n\t\ts[i]=(s[i]-'a')+'A';}\n\t}\n\t}\n\tprintf(\"%s\",s);\n}"}, {"source_code": "#include\nint main()\n{\nchar s[100];\nint n,c=0,r=0,j=0;\ngets(s);\nn=strlen(s);\nfor(int i=0;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\n#include\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=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=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=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 \n#include \n\nint main()\n{\n int i,j=0,k=0;\n char str[100];\n gets(str);\n for(i=0; 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\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\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 ;in)\n {\n q=b-n;\n w=q-a+1;\n printf(\"%d\",w);\n }\n return 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n char a[100];int c=0,s=0,d=0;\n gets(a);\n for(int i=0;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= 'a' && a[d] <= 'z')a[d] = a[d] - 32;d++;}printf(\"%s\",a);}\n \n\n return 0;\n}"}, {"source_code": "#include\n#include\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 \n#include \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= '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\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 \n#include \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\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\n#include\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 \n#include \n#include \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;imin)\n {\n for (i=0;i\n#include \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='a')\n {s[k]=toupper(s[k]);}\n k++;}}\n\n printf(\"%s\",s);\n return 0;\n}"}, {"source_code": "#include\n#include\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\n#include\n#include\n#include\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 \n#include \n#include \n#include \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\n#include\n#include\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\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 \n#include \n#include \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; imm)\n printf(\"%s\", minn);\n else\n printf(\"%s\", maiu);\n printf(\"\\n\");\n return 0;\n}"}, {"source_code": "#include\n#include\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=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=97&&s[i]<=122)\n s[i]=s[i]-32;\n }\n }\n else \n {\n for(i=0;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\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\n#include\n#include\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=flagLow)\n {\n for(j=0; j\n#include\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=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=97&&s[i]<=122)\n s[i]=s[i]-32;\n }\n }\n else \n {\n for(i=0;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 \n#include \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='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\n#include\n#include\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='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\n#include\n#include\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;i97)\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 \n#include \n#include \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='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=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\n#include\nmain()\n{ \n int r,i,up,lw;\n\tchar a[101];\n\tgets(a);\n\tr=strlen(a);\n\tfor(i=0;i=lw)\n\tprintf(\"%s\",strupr(a));\n\telse\n\tprintf(\"%s\",strlwr(a));\t\n}"}, {"source_code": "#include\n#include\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\nint main(){\n\tint i,n,c,m;\nscanf(\"%d\",&n);\n char s[101];\n for(i=0;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 \nmain()\n{\n int icount=0;\n char s[101];\n scanf(\"%s\",s);\n for (int i=0;i90)\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 \n#include \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;i96)&&(s1[i]<123))\n\t\tl++;\n\t\telse\n\t\tu1++;\n\t}\n\tif(u1>l)\n\t{\n\tfor(i=0;i96)&&(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;i65)&&(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 \n#include \n#include\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;im)\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\n#include\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;i65&&a[i]<97)\n {\n count++;\n }\n }\n if(count>(l/2))\n {\n for(i=0;i97)\n {\n a[i]=a[i]-32;\n }\n }\n }\n else{\n for(i=0;i\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\n#include\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\n#include\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=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\n#include\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='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=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 \n#include \n#include \n#include \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;inb2)\n\t{ \tfor (i=0;i\n#include\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;i64 && 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;i64 && 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;i64 && 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;i97 && 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 \n#include \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=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;isum/2)\n\t{\n\t\tfor(i=0;i97)\n\t\t\ta[i]=a[i]-32;\n\t\t}\n\t}\n\tfor(i=0;i\n#include\nint main(void)\n{\n char str1[100];\n scanf(\"%s\", str1);\n for(int i=0; i\n#include \n#include \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;ilower){\n \n for (int i =0;i\n#include \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=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;isum/2)\n\t{\n\t\tfor(i=0;i97)\n\t\t\ta[i]=a[i]-32;\n\t\t}\n\t}\n\tfor(i=0;i\n#include\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\n#include \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 \n#include \n#include \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;imin)\n {\n for (i=0;i\n#include\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=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=97 && c[i]<=122)\n {\n c[i]=65+c[i]-97;\n }\n }\n printf(\"%s\", c);\n }\n else if(a=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\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\n#include\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;i64 && 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;i64 && 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;i64 && 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;i97 && 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\n#include\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\n#include\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=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\n#include \n#include\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 =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 l){\n for(k = 0; k \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\n#include\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=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\n#include\nint main()\n{\n char s[1000];\n int i,a=0,b=0;\n gets(s);\n for(i=0;i\n//#include\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;ilen/2)\n {\n for(int i=0;i=97)\n {\n str[i]=str[i]-32;\n }\n }\n }\n else\n {\n for(int i=0;i\n#include \n#include \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; imm)\n printf(\"%s\", minn);\n else\n printf(\"%s\", maiu);\n printf(\"\\n\");\n\n\n return 0;\n}"}, {"source_code": "#include \n#include \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='A' && s[j]<='Z'){ s[j]=tolower(s[j]);}\n j++;}}\n else if (l='a')\n {s[k]=toupper(s[k]);}\n k++;}}\n\n printf(\"%s\",s);\n return 0;\n}\n"}, {"source_code": "#include\n#include\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\n#include\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\n#include\nint main(){\n\n char s[101];\n int i,j,m=0,n=0;\n gets(s);\n for (i=0 ; i'A' && s[i]<'Z' ) m++;\n else n++;\n }\n if (m>n){\n for ( j=0 ; j 'Z' ) s[j] = s[j] - 32;\n }\n printf(s);\n }\n else {\n for ( j=0 ; j\n#include\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='97')\n low++;\n }\n if(low>=(len-low))\n {\n for(i=0;i=97)\n c[i]=c[i]-32;\n printf(\"%c\",c[i]);\n }\n }\n}"}, {"source_code": "#include\n#include\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='a'&&str[i]<='z'){\n c++;\n }else{\n d++;\n }\n }\n for(int i=0;i=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 \n#include \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='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\n#include\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='a'&&str[i]<='z'){\n c++;\n }else{\n d++;\n }\n }\n for(int i=0;i=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\n\nint main()\n{\n char m[101];\n int c=0;\n scanf(\"%s\",m);\n for(int i=0;i='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\n#include\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=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=97 && c[i]<=122)\n {\n c[i]=65+c[i]-97;\n }\n }\n printf(\"%s\", c);\n }\n else if(a=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\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\n#include\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='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='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='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\n#include\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'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 \n#include \n#include \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; imm)\n printf(\"%s\", minn);\n else\n printf(\"%s\", maiu);\n printf(\"\\n\");\n\n\n return 0;\n}"}, {"source_code": "#include\n#include\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=67 && s[i]<=92)\n{\nup++;\n}\nelse\nlow++;\n}\nif(low\n#include\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\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 \n#include \nint main()\n{\n char str[105];\n gets(str);\n int i,count=0,len=strlen(str);\n for(i=0;i\n#include\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\n#include\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\n#include\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\n#include\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\n#include \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\n#include\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\n#include \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 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\n#include\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\n#include\n\nint main()\n{\n int i, j=0, k;\n char a[102];\n scanf(\"%s\", a);\n\n for(i=0; i\n#include\nvoid arr(char pat[],int m,int *lps)\n{\nint len=0;\nlps[0]=0;\nint i=1;\nwhile(i\n#include\n#include\n#include\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\n#include\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\n#include \nint main()\n{\n char str[105];\n gets(str);\n int i,count=0,len=strlen(str);\n for(i=0;i\n#include \nint main()\n{\n char str[105];\n gets(str);\n int i,count=0,len=strlen(str);\n for(i=0;i\n#include\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\n#include \n#include \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\n#include\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\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\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 \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\n#include\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\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\n#include\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\n#include\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\n#include \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\n#include\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\n#include\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\n#include \n\nmain(){\n char A[101];\n int i;\n gets(A);\n int L=strlen(A),Stack=0;\n for(i=0;i1 || Stack==0){\n printf(\"NO\");\n }else printf(\"YES\");\n}\n"}, {"source_code": "#include \n#include \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\n#include\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\n#include \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 \n#include \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\n#include\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=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 \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\n#include\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\n#include\n#include\n#include\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\n#include\n#include\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 \n#include \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\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\n#include \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\n#include\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\n#include\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\n#include\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\n#include \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\n#include\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\n#include\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 \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 \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\n#include\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\n#include\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\n#include\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\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\n#include \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\n#include\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\n#include\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\n#include \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 \n#include \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\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\n#include\n#include\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\n#include\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\n#include \n#include \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\n#include\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\n#include\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\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\n#include\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\n#include\n#include\n#include\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 \n#include \nint main()\n{\n char str[105];\n gets(str);\n int i,count=0,len=strlen(str);\n for(i=0;i\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\n#include\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\n#include \nint main()\n{\n char str[105];\n gets(str);\n int i,count=0,len=strlen(str);\n for(i=0;i\n#include \n\nmain(){\n char A[101];\n int i;\n gets(A);\n int L=strlen(A),Stack=0;\n for(i=0;i1 || Stack==0){\n printf(\"NO\");\n }else printf(\"YES\");\n}\n"}, {"source_code": "#include\n#include\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\n#include\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\n#include\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#include\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\n#include\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\n#include\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\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\n#include\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\n#include\nint main()\n{\n int name=0,i;\n char problem_name[100];\n scanf(\"%s\",problem_name);\n for(i=0;i\n#include\nint main (){\n int i,x,a,b;\n char str[110];\n scanf(\"%s\",&str);\n b=0;\n for(i=0;i\n#include\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\n#include\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\n#include \nint main(){\n\tchar a[100];\n\tscanf(\"%s\",&a);\n\tint f=0;\n\tfor(int i=0;i\n#include \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\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\n#include\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 \n#include \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\n#include \n\nmain(){\n char A[101];\n int i;\n gets(A);\n int L=strlen(A),Stack=0;\n for(i=0;i1 || Stack==0){\n printf(\"NO\");\n }else printf(\"YES\");\n}\n"}, {"source_code": "#include\n#include\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\n#include \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\n#include\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\n#include \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\n#include\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\n#include\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\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\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#include\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\n#include\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\n#include\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\n#include\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\n#include \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\n#include \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\n#include\n#include\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\n#include\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\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 \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 \n#include \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 \n#include \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\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\n#include\n#include\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;j1)\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\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#include\n#include\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;z1)\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\n#include\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\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\n#include\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 \n#include \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 \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\n#include\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\n#include\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#include\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 \n#include \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\n#include\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\n#include \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\n#include\n#include\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\n#include\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\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)\n#include \n#include \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#include\n#include\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 \n#include \n\nmain(){\n char A[101];\n int i;\n gets(A);\n int L=strlen(A),Stack=0;\n for(i=0;i1 || Stack==0){\n printf(\"NO\");\n }else printf(\"YES\");\n}\n"}, {"source_code": "#include\n#include\n#include\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;j1)\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\n#include\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=o)\n\t{\n\t\tfor(i=0;i=p)\n\t{\n\t\tfor(i=0;i=q)\n\t{\n\t\tfor(i=0;i=r)\n\t{\n\t\tfor(i=0;i\n#include\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\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\n#include\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=o)\n\t{\n\t\tfor(i=0;i=p)\n\t{\n\t\tfor(i=0;i=q)\n\t{\n\t\tfor(i=0;i=r)\n\t{\n\t\tfor(i=0;i\n#include \n#include \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 (MemoryStackTopsize) {e=size;}\t\t\tfor (j=1;(s=s;b--)\t\t\t{\t\t\t\tds[e--]=ds[b];\t\t\t}\t\t\tfor (b=1;bsize) {e=size;}\t\t\tfor (j=1;(s=s;b--)\t\t\t{\t\t\t\tds[e--]=ds[b];\t\t\t}\t\t\tfor (b=1;b\n#include\n#include\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\n#include\n#include\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\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\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 \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\n#include\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\n#include \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\n#include\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=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\n#include\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\n#include\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=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\n#include\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\n#include \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\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 \n#include \n#include \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\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 \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 \n#include\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 \n#include \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\n#include\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\n#include \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\n#include\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\n#include\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 \n#include\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 \n#include \n\nmain(){\n char A[101];\n int i;\n gets(A);\n int L=strlen(A),Stack=0;\n for(i=0;i1 || Stack==0){\n printf(\"NO\");\n }else printf(\"YES\");\n}\n"}, {"source_code": "#include\n#include\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\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 \n#include \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 \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 \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 \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 \n#include \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\n#include \n#include \n#include \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\n#include\n#include\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\n#include\nint main ()\n{\n char s [101];\n int i,c=0;\n scanf(\"%s\",s);\n for (i=0;i,i\n#include\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=o)\n\t{\n\t\tfor(i=0;i=p)\n\t{\n\t\tfor(i=0;i=q)\n\t{\n\t\tfor(i=0;i=r)\n\t{\n\t\tfor(i=0;i\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 \n#include \n#include \n#include\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 \n#include \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\n#include \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\n#include\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 \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\n#include\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\n#include\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=o)\n\t{\n\t\tfor(i=0;i=p)\n\t{\n\t\tfor(i=0;i=q)\n\t{\n\t\tfor(i=0;i=r)\n\t{\n\t\tfor(i=0;i\n#include \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\n#include\nint main ()\n{\n\tchar x[105];\n\tint len,i,p=0;\n\tscanf(\"%s\",&x);\n\tfor(i=0;i\n#include\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 \n#include \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\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 \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\n#include\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\n#include\n#include\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;j1)\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 \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\n#include\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#include \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\n#include\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\n#include\n#include\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\n#include \n#include \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, y). 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 = x. 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 ( - 200 ≤ x, y ≤ 200, 1 ≤ d ≤ 200, 1 ≤ n ≤ 20) — 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 ≤ xi, yi ≤ 200) — 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 — to reflect relatively to the line y = x. Dasha will respond to it with the same move and return the dot in position (2;3)."}, "positive_code": [{"source_code": "#include \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 \n\n#define rep(i,n) for(i=0;i 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 \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 ≤ a ≤ n), 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 ≤ m ≤ n ≤ 109) — the range of numbers in the game, and the number selected by Misha respectively.", "output_spec": "Print a single number — 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 / 3. If Andrew chooses a = 3, the probability of winning will be 1 / 3. If a = 1, 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 / 2. For other choices of a the probability of winning is less."}, "positive_code": [{"source_code": "#include\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\n#include\n#include\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 \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\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 \n#include \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 \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 \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\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\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\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\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\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\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\n#include\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(mx)\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(mx)\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 \n#include \n#include \n#include \n#include \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\nint main()\n{\n int n,m;\n scanf(\"%d%d\",&n,&m);\n if(n%2==0)\n {\n if(mn/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\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\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\n#include\n#include\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\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\n#include\n#include\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 \nmain() {\n\tint n,m,a;\n\tscanf(\"%d %d\",&n,&m);\n\tif (m-1n) a=m;\n\tprintf(\"%d\",a);\n}\n"}, {"source_code": "#include \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\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\n#include\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 \n#include \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\n#include\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\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\n#include\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 \n#include \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\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\n#include\n#include\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 \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\nint main()\n{\n int n,m;\n scanf(\"%d%d\",&n,&m);\n if(n%2==0)\n {\n if(mn/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\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\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 \n#include \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 \n#include \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\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 \n#include \n#define max(a,b) a\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 \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\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 \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\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\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 \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 \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\n#include\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 \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\nint main()\n{\n int n,m;\n scanf(\"%d%d\",&n,&m);\n if(n%2==0)\n {\n if(mn/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\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\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 \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\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 \n#include \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 \n#include \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 \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\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\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 \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 \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(amid) printf(\"%d\\n\", a-1);\n else printf(\"%d\\n\",a+1);\n }\n\n return 0;\n\n}\n"}, {"source_code": "#include\n#include\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 \n#include \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 \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\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\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\n#include\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 \n#include \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\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 \n#include \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\n#include\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 \n//#include \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 \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\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\nint main()\n{\n int n,m;\n scanf(\"%d%d\",&n,&m);\n if(n%2==0)\n {\n if(mn/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\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\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 \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\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\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\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\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\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\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 \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\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\n#include\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\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 \n#include \n#include \n#include \n#include \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\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+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\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 \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\n#include\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 \n#include\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\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 \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 \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\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 \n#include\n#include\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 \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 \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\n#include\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 \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 \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\n#include\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\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 \n#include\n#include\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 \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\n#include\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 \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\n int main ()\n{\n int n=3,m=1;\n 1<=mm-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\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\n#include\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\n#include\n#include\n#include\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\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\n int main ()\n{\n int n,m;\n 1<=mm-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 \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\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\n#include\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 \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\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 \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 \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 \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\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 \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\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 \n#include \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\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\n#include\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\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)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\n#include\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\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\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\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\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 \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\n#include\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\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 \n#include\n#include\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\nint main()\n{\n int n,m;\n scanf(\"%d%d\",&n,&m);\n if(n%2==0)\n {\n if(mn/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 \n#include \n#define max(a,b) a\n#include\n#include\n#include\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 \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\n#include\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\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 \n# include \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 \n#include \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\n#include\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))\n#include\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 \n#include \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\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 \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\n#include\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 \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\n#include\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))\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 \n#include \n#include \n#include \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 \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 \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 \n#include \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 \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 \n#include \n#include \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\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 \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\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 \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\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 \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 \n#include \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的初始数字是m\n//andrew的初始数字是a\n//在1到n之间选择!\n//c是一个随机数\n//看谁的数接近c,距离相同misha赢!\n//距离不同谁近,谁赢!\n//n是可以选择的数字范围!\n//这是一个概率问题!\n//每一个都计算一遍时间肯定超时\n//因为题目设置为10^9级别的问题!\n//只能先实现一个看有没有超时!\n//我的想法是a必须选择中间位置,才能获取最大概率!\n/*interface*/\n/*interface implementation*/\n/*client*/\n#include\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 \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 \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 \n#include \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\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 \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)\n#include \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 \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\n int main ()\n{\n int n,m;\n 1<=mm-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 \n#include \n#define max(a,b) a\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\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\n#include\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\n#include\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\n#include\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 \n#include\n#include\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\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 \n#include\n#include\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\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\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 \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(amid) printf(\"%d\\n\", mid);\n else if(a\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(amid) printf(\"%d\\n\", mid);\n else if(a\n#include \n#include \n#include \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\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\n int main ()\n{\n int n,m;\n 1<=mm-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\n#include\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 \n#include \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\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\n#include\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 \n#include\n#include\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\n#include\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\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\n#include\nint main(){long long int t,i,j,n,c;\n scanf(\"%lld\",&t);\n for(i=0;i\n#include \n#include \n#include \n#include \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≡a*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\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\n#include\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\n#include\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\n#include\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\n#include\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\n#include\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\n#include\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\n#include\n#include\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=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 \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\n#include\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 \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\n#include\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\n#include\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\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\n#include\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 \n#include \n#include \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 \n# include \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\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 \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 \n#include \n#include \n#include \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\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\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 \n#include \n#include \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\n#include\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 \n#include \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\n#include\n#include\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#include\n#include\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\n#include\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\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\nint main()\n{ \n long long int t,n,i,j,factor;\n scanf(\"%lld\",&t);\n for(i=0;i\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\n#include\n#include\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\n#include\n#include\n#include\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\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\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 \n#include \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\n#include\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 \n#include \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\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 \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 \n#include\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\n#include\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\n#include\n#include\n#include\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 \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 \n#include \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 \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 \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 \n#include \n#include \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\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 \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\n#include\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\n#include\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n int i;\n for(i=0;i\n#include\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 \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 \n#include \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\n#include \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\n#include\n#include\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\n#include\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\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 \n#include \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\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\n#include\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\n #include\n #include\n #include\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\n#include\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\n#include\n#include\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n for(int q=0;q\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\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\n#include\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 \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 \n#include \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 \n#include \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 \n#include \n#include \n#include \n#include \n#include \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):(aa ){\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\n#include\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\n#include\n#include\n#include\n//int a[123];\nint main()\n{\n int i,j,m,n,t;\n scanf(\"%d\", &t);\n for(i=0;i=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\n#include\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\n#include\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n int i;\n for(i=0;i0;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 \n#include \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\n#include\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\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\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\nint main()\n{ \n long long int t,n,i,j,factor;\n scanf(\"%lld\",&t);\n for(i=0;i\n#include\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n int i;\n for(i=0;i\n#include\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\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\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\n#include\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 \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\n#include\nint main()\n{\n int i,t,j,n,k;\n scanf(\"%d\", &t);\n for(i=0; isqrt(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\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\nint main()\n{ \n long long int t,n,i,j,factor;\n scanf(\"%lld\",&t);\n for(i=0;i\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 \n#include \n#include \n#include \n#include \n#include \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):(aa ){\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\n#include\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 \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\n#include\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\n#include\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 \n#include \n#include \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\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\n#include \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\n#include\nint main()\n{\n int i,t,j,n,k;\n scanf(\"%d\", &t);\n for(i=0; isqrt(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\n#include\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 \n#include \n#include \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\n#include\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\n#include\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]\n#include\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\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 \n#include \n#include \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 \n#include \n#include \n#include \n#include \n#include \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):(aa ){\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\n#include\nint main()\n{\n int i,t,j,n,k;\n scanf(\"%d\", &t);\n for(i=0; isqrt(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\n#include\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\n#include\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\n#include\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\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\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\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\n#include\n#include\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\n#include\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 \n#include \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\n#include\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\n#include\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\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\n#include\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\n#include\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]\n#include\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 \n#include \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 \n#include \n#include \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\n#include\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n int i;\n for(i=0;i0;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\n#include\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\nint main()\n{ \n long long int t,n,i,j,factor;\n scanf(\"%lld\",&t);\n for(i=0;i\n#include\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\n#include\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n int i;\n for(i=0;i0;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\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 \n#include \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\n#include\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 \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\n#include\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 \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\n#include\n#include\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\n#include\nint main()\n{\n int i,t,j,n,k;\n scanf(\"%d\", &t);\n for(i=0; isqrt(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 \n#include\n#include\n#include\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\n#include\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\n#include\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\n#include\n#include\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\nint main()\n{ \n long long int t,n,i,j,factor;\n scanf(\"%lld\",&t);\n for(i=0;i\n#include\nint main()\n{\n int i,t,j,n,k;\n scanf(\"%d\", &t);\n for(i=0; isqrt(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\n#include\nint main()\n{\n int i,t,j,n,k;\n scanf(\"%d\", &t);\n for(i=0; isqrt(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 \n#include\n#include\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 \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\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 \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 \n#include \n#include \n#include \n#include \n#include \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):(aa ){\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\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n int i;\n int n;\n int min;\n for(i=0; i\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 \n#include \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 \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 \n#include\n#include\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\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\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\n#include\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\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\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\n#include\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 \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\n#include\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n int i;\n for(i=0;i\n#include \n#include \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\n#include\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\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\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n int i;\n int n;\n int min;\n for(i=0; i\n#include\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\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\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#include\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\n#include\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\n#include\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 \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 — 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 — 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, 0), (n, 0), (0, n) and (n, n).", "input_spec": "The single line contains 5 space-separated integers: n, x1, y1, x2, y2 (1 ≤ n ≤ 1000, 0 ≤ x1, y1, x2, y2 ≤ n) 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\n#include\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\n#include \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\n#include\n#include\n#include\n#include\n#include\n#include\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\n#include\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\n#include\n#include\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\n#include\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\n#include\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\n#include\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\n\n#include\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\n#include \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 \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 \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 \n#include \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\nint min(int a, int b)\n{\n \treturn a0?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 \n#include \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\n#include\n#include\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\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#include \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 \n#include \n#include \n#include \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*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\n#include\n#include\n#define REP(i,a,b) for(i=a;i 4*n-res) res = 4*n-res;\n printf(\"%d\\n\",res);\n break;\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\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 \n#include \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 \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 \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\n#include\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(((x1y2))||((x2y1))){\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 \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 \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\n#include\n#include\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\n#include \n#include \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 \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\n#include\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\n#include\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\n#include \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\n#include \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\n#include\n#include\n#include\n#include\n#include\n#include\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\n#include\n#include\n#include\n#include\n#include\n#include\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\n#include\n#include\n#include\n#include\n#include\n#include\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\n#include\n#include\n#include\n#include\n#include\n#include\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\n#include\n#include\n#include\n#include\n#include\n#include\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\n#include\n#include\n#include\n#include\n#include\n#include\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\n#include\n#include\n#include\n#include\n#include\n#include\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\n#include\n#include\n#include\n#include\n#include\n#include\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\n#include\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\n#include\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\n#include\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 \n#include \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 \n#include \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 \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 \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 \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \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 \n#include \n#include \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\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 \n#include \n#include \n#include \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\n#include\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\n#include\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 \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 \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 \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 \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 \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 \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 \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 \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 \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 \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 \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 \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 \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\n#include\n#include\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\n#include\n#include\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\n#include \n#include \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 \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 \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 = 1 and b = 3 then at first the calculator will print 2 segments, then — 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, b (1 ≤ a ≤ b ≤ 106) — the first and the last number typed by Max.", "output_spec": "Print the only integer a — the total number of printed segments.", "sample_inputs": ["1 3", "10 15"], "sample_outputs": ["12", "39"], "notes": null}, "positive_code": [{"source_code": "#include\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\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 \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 \n#include \n#include \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\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\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\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\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\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년 KJBS2. All rights reserved.\n//\n\n#include \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\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\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년 KJBS2. All rights reserved.\n//\n\n#include \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 \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\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 \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\n#include\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\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\n#include\t\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 \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 \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\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\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\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\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\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\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\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 \n#include \n#include\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 \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 \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\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\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 \n#include \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 \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\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 \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\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\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\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\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 \n#include \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 \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 \n#include \n#include \n#include \n#include \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 \n#include \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 \n#include \n#include \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\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\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 \n#include \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 \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\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\n#include\n#include\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\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 \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\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\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\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\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\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 \n#include \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 \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\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 \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 \n#include \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\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\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 \n#include \n\n//1〜nに含まれるcountの個数を求める\nunsigned long long solve(unsigned long long n,int count,int base){\n\tunsigned long long r=0; //結果\n\tunsigned long long lower=0; //処理している桁より下の桁の合計\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\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 \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 \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\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\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\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\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 \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\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 \n#include \n#include \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\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\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 \n#include \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\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 \n#include \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 \n#include \n#include \n#include \n#include \n#include \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\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 \n#include \n#include \n#include \n#include \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\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 \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 \n#include \n#include \n#include \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\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\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 \n#include \n#include \n#include \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 \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\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 \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 \n#include \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\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\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\n#include\n#include\n#include\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 \n#include \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 \n#include \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 \n#include \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 \n#include \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 \n#include \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 \n#include \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 \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 \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 \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\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\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\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\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\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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \n#include \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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\n#include\n#include\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\n#include\t\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\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 \n#include \n#include \n#include \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\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\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 \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 \n#include \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\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\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 \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\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\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 \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\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 \n#include \n#include \n#include \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\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\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\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\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 \n#include \n\n//1〜nに含まれるcountの個数を求める\nunsigned long long solve(unsigned long long n,int count,int base){\n\tunsigned long long r=0; //結果\n\tunsigned long long lower=0; //処理している桁より下の桁の合計\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 \n#include \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\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 \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\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 \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 \n#include \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\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\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\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\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 234 567 game-coins each), cars (for 123 456 game-coins each) and computers (for 1 234 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 × 1 234 567 + b × 123 456 + c × 1 234 = n?Please help Kolya answer this question.", "input_spec": "The first line of the input contains a single integer n (1 ≤ n ≤ 109) — 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 234 567 + 123 456 + 1234 = 1 359 257 game-coins in total."}, "positive_code": [{"source_code": "#include\n#include\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\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\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\n#include\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\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 \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\n#include\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\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 \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 \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\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 \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\n#include\n#include\n#include\n#include\n#include\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 \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\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\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\n#include\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 \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 \n#include \n#include \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\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\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 \n#include \n#include \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\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 \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 \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 \n#include \n#include \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 \n#include \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\n#include\n#include\n#include\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\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\n#include\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\n#include\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\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\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 \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\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 \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\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\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 \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\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 \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 \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\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\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 \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\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 \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\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 \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\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 \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 \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\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\n#include\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\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\n#include\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 \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 \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 \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 \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\n#include\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 \n#include \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 \n#include \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 \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 \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\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 \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 \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 \n#include \n#include \n#include\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 \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 \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 \n#include \n#include \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\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 \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 \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\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 \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 \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 \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\n#include\n#include\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\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\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\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 \n#include \n#include \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\n#include\n#include\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 \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 \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\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 \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\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\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 \n#include \n#include \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\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 \n#include \n#include \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\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 \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 \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 \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 \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 \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\n#include\n#include\n#include\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(xval)\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*xval;\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;ib)\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\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 \n#include \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= 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\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 \n#include \n#include \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\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\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\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\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\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\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 \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\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 \n#include \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\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\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 \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\n#include\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\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 \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 \n#include \n#include \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 \n#include \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= 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\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 \n#include\n#include\n#include\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=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 \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; jn) 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\n\nint main(){\n\n int n,cost,j,k,i;\n scanf(\"%d\",&n);\n\n for(i=0;i\n#include \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= 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\n#include\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\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\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 \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 \n#include \n#include \n#include\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 \n#include \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\n#include\n#include\n#include\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(xval)\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*xval;\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;ib)\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 \n#include \n#include \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 \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\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\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\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\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\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\n#include\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 \n#include \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= 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\n#include\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 \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\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 \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 \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\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\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\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 \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\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=(b+c))\n {\n n=n-(b+c);\n if(n<(b+c)&&n>=c)\n {\n n=n-c;\n if(n\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 \n#include \n#include \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\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\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\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\n#include\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\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\n#include\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\n#include\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\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 \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 \n#include \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\n#include\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\n#include\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\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 \n#include \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= 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\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 \n#include \n#include \n#include\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\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\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\n#include\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 \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\nint main()\n{\nint i,co=0,n,j;\nscanf(\"%d\",&n);\nfor(i=0;i\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\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\nint main()\n{\nint i,co=0,n,j;\nscanf(\"%d\",&n);\nfor(i=0;i\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\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=(b+c))\n {\n n=n-(b+c);\n if(n<(b+c)&&n>=c)\n {\n n=n-c;\n if(n\n#include\n#include\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 \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\n#include\n#include\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\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 \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 \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\n#include\n#include\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\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#include \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= 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\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 \n#include \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 \n#include \n#include \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\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\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\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\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 \n#include \n#include \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\n\nint main(){\n\n int n,cost,j,k,i;\n scanf(\"%d\",&n);\n\n for(i=0;i\n#include \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 × 4 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 × 2 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 × 2 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 × 2 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\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\n#include\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\n#include\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 \n#include \n#include \n#include \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\n#include\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 \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\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 \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 \n#include \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\n#include\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\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 \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\n#include\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\n#include\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/* رَّبِّ زِدْنِى عِلْمًا */\n\n\n\n#include \n#include \n#include \n#include \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\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\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\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 \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\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\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 \n#include \n//#include \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\n#include\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\n#include\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\n#include\n#include\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 \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 \n#include \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\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 \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 \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\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\n#include\n#include\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\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 \n#include \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\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 \n#include \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\n#include\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\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 \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\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\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 \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\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 \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\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\n#include\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\n#include\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\n#include\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 \n#include \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\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\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\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 \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 \n#include \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\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 \n#include \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\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\n//#include\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\n#include\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 \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\n#include\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\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 \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\n#include\n#include\n#define SORT(a,n) qsort(a,n,sizeof(int),intcmp)\n#define s(n) scanf(\"%d\",&n)\n#define sc(n) scanf(\"%c\",&n)\n#define sl(n) scanf(\"%I64d\",&n)\n#define sf(n) scanf(\"%lf\",&n)\n#define ss(n) scanf(\"%s\",n)\n#define 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\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": "/* بِسْمِ اللهِ الرَّحْمٰنِ الرَّحِيْمِ */\n/* رَّبِّ زِدْنِى عِلْمًا */\n\n\n\n#include \n#include \n#include \n#include \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\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\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\n#include\n#include\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\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\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\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\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 \n#include\n#include\n#include\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\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 \n#include \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 \n#include \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 \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 \n#include \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 \n#include \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\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\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\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\n#include\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 \n#include \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\n#include\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 \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 \n# include \n# include \n# include \n# include \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 \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 \nint a[4][4];\nint n = 4, m, i, j;\nchar s[4];\n\nint main()\n{\n for (i= 0; i\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 \n#include \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 \n#include \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 \n#include \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 \n#include \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 \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 \n#include \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\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 \n#include \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 \n#include \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\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\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 \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\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\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\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 \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\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 \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 \n#include \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\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 \n#include \n#include \n#include \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 \n#include \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\n#include\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\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\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 \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\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 \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 \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\n#include\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\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\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\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 \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\n#include\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\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\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 \n#include \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\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\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\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\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 \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 \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 \n#include \n#include \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\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 \n#include \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 \n#include \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 \n#include \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\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\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\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 \n#include \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\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 \n#include \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\n#include\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 \n#include \n#include \n#include \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\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\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 \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\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\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 \n#include \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 \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\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\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\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 \n#include \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\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\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\n#include\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 \n#include \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 \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\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 \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\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\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\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\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 \n#include \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 \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 \n#include \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 \n#include \n#include \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 \n#include \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\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 \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\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\n#include\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 \n#include \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 \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\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\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 \n#include \n#include \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 \n#include \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 \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\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 \n#include \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 \n#include \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 \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 \n#include \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\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 \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\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 \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\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 \n#include \n#include \n#include \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 \n#include \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 \n#include \n#include \n#include \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 — D, Clubs — C, Spades — S, or Hearts — 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\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 \n#include \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\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\n#include\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\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\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\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\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 \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\n#include\n#include\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 \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 \n#include \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) { // 對手的牌\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\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\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\n#include\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\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\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\n#include\n#include\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;iname);\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\n#include \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\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\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\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\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\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\n#include\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\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\n#include\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\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 \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\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\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 \n#include \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\n#include\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 \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\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\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\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 \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 \n#include \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\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\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\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\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\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 \n#include \n#include \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 \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 \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\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\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 \n#include \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\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 \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\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\n#include\n#include\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 \n#include \n#include \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 \n#include \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\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\n#include\n#include\n#include\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\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\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\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\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 \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\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\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 \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\n#include\n#include\n#include\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\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\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 \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 \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\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 \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\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 \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 \n#include \n\nvoid fchaine(char *string)\n{\n int i,n;\n char L;\n\n n = strlen(string);\n\n for(i=0;i0)\n printf (\"YES\");\n\n}\n"}, {"source_code": "#include \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\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 \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\n#include\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 \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 \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\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 \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\n#include\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 \n#include \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\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\n#include\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\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\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 \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\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\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\n#include\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\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\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\n#include\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;i0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n\n}\n"}, {"source_code": "#include\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\n#include\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=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 \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\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 \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\n#include\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 \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\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 \n#include \n#include \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\n#include\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 \n#include \n#include \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\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 \n#include \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\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\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\n#include\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 \n#include\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\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\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 \n#include \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\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\n#include\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\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 \n#include \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\n#include\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 \n#include \n#include \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\n#include\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\n#include\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\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\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\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\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\n#include\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\n#include\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 \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\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 \n#include\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\n#include\n#include\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\n#include\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\n#include\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 \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\n#include\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 \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\n#include\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\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\n#include\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 \n#include \n#include \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\n#include\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 \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 \n#include \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\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 \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\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\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\n#include\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 \n#include\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\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 \n#include\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\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\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\n#include\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\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\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\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\n#include\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 \n#include \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 \n#include \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\n#include\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 \n#include \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\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\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\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 \n#include \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\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\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\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\n#include\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 \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 \n#include \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\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\n#include\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;iname);\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 \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\n#include\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\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 \n#include\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 \n#include \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 \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 \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 \n#include \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\n#include\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\n#include\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\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\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\n#include\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\n#include\n#include\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;iname);\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 \n#include\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 \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\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": "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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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 = s1s2... s|s|.A substring of s is a non-empty string x = s[a... b] = sasa + 1... sb (1 ≤ a ≤ b ≤ |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 ≠ c or b ≠ d. 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 = s[p1p2... p|y|] = sp1sp2... sp|y| (1 ≤ p1 < p2 < ... < p|y| ≤ |s|). For example, \"coders\" is a subsequence of \"codeforces\". Two subsequences u = s[p1p2... p|u|] and v = s[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 ≤ |s| ≤ 5000), and the second one contains t (1 ≤ |t| ≤ 5000). Both strings consist of lowercase Latin letters.", "output_spec": "Print a single number — 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 + 7).", "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 2]\"."}, "positive_code": [{"source_code": "#include \n#include \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 \n#include \n#include \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 \n#include \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 \n#include \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 \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\n#include \n#include \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 \n#include \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 \n#include \n#include \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 — 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 — print «YES», if he can, and «NO», 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 ≤ n, k ≤ 100) — the number of baloons and friends. Next line contains string s — colors of baloons.", "output_spec": "Answer to the task — «YES» or «NO» 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 «NO»."}, "positive_code": [{"source_code": "#include \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#include\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=k) {printf(\"NO\");break;}\n if(i==(n-1)){printf(\"YES\");break;}\n }\nreturn 0;\n}"}, {"source_code": "#include\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 \n#include \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\n#include\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;ik)\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\n#include\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\n#include\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;ik)\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 \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\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\n#include\n#include\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;ik)\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 \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 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\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\n#include\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 ; i0)\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\n#include\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(nk)\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\n#include\n#include\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 }\n printf(\"YES\");\n\n}"}, {"source_code": "#include\n#include\n#include\n#include\n#include\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 \n#include \n#include \n#include \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\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 \n#include \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\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\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 \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;ik){\n printf(\"NO\\n\");\n return 0;}\n printf(\"YES\\n\");\n \n return 0;\n}\n"}, {"source_code": "#include\n#include\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;ik)\n {\n printf(\"NO\\n\");\n flag=1;\n break;\n }\n }\n if(flag==0)\n printf(\"YES\\n\");\n}"}, {"source_code": "#include \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; ik){\n printf(\"NO\\n\");\n return 0;\n }\n }\n\n printf(\"YES\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \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\n#include\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 \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\n#include\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;ik)\n {\n printf(\"NO\");\n return 0;\n }\n }\n printf(\"YES\");\n}\n"}, {"source_code": "#include \n#include \n#include\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; ik){\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\n#include\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;ik)\n {\n printf(\"NO\");\n return 0;\n }\n }\n printf(\"YES\");\n}\n"}, {"source_code": "#include \n#include \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 \n#include \n#include \n#include \n#include \n#include \n#include \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 \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;jm){\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\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\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; imx)\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\n#include\n#include\n#include\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;imax)\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 \n#include \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 \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\n#include\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\n#include\n#include\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\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;ik)\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 \n#include \n#include \n#include \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 \n#include \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;jk)\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\n#include\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;ilcon||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 \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\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;ifriends){\n printf(\"NO\");\n return 0;\n }\n }\n\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\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;ik)\n f++;\n }\n\n\n if(f>0)\n printf(\"NO\");\n else printf(\"YES\");\n\n}\n"}, {"source_code": "#include \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&&ik) x=0;\n }\n printf(\"%s\\n\",x?\"YES\":\"NO\");\n return 0;\n}"}, {"source_code": "#include \n#include \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 \n#include \n#include \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\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;imax)\n max=freq[j];\n }\n if(max>k)\n printf(\"NO\");\n else\n printf(\"YES\");\n return 0;\n}"}, {"source_code": "#include \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\n#include\n#include\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;is[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\n#include\n#include\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;ik){\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 \n#include \n#include \n#include \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 \n#include \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 k){\n printf(\"NO\");\n return 0;\n }\n }\n printf(\"YES\");\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\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;jfre[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 \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\n#include\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(nk)\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\n#include\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; ik)\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 \n#include \n#include \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 \n#include \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\n#include\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;ik)\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\n#include\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;ia[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\n#include\n#include\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\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 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\n#include\n#include\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='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\n#include\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=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 \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;i1)\n {\n count++;\n }\n }\n }\n k=0;\n\n for(i=0;i\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=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 \n#include \n#include \n#include \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\n#include\n#include\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='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\n#include\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;ia[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\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;ik)\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\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;imax)\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 \n#include \n#include \n#include \n#include \n#include \n#include \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 \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\n#include\n#include\n#include\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; ik)\n { printf(\"NO\");\n return 0;}\n }\n\n printf(\"YES\");\n\n\n}"}, {"source_code": "#include \n#include \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\n#include\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;ik)\n {\n printf(\"NO\");\n return 0;\n }\n }\n printf(\"YES\");\n}\n"}, {"source_code": "#include\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;ik)\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \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;ik){\n printf(\"NO\\n\");\n return 0;\n }\n }\n\n printf(\"YES\\n\");\n}\n"}, {"source_code": "#include\n#include\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;imax)\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 — 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 — print «YES», if he can, and «NO», 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 ≤ n, k ≤ 100) — the number of baloons and friends.\n *\n * Next line contains string s — colors of baloons.\n * Output\n *\n * Answer to the task — «YES» or «NO» 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 «NO».\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 \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\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;ik)\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 \n#include \n#include \n#include \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\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;ik){\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 \n#include \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 \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 \n#include \n#include \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\n#include \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 \n#include \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;ik)\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\n#include\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;ik)\n return puts(\"NO\");\n }\n puts(\"YES\");\n return 0;\n}"}, {"source_code": "#include\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\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;icount1)\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\n#include\n#include\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 }\n printf(\"YES\");\n\n}"}, {"source_code": "#include \n#include \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;ik){\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 \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 \n#include \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\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\n#include\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;imax){\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 \n#include \n#include\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\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 \n#include \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 \n#include \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;jk)\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\n#include\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;ic)\n {\n printf(\"NO\");\n return 0;\n }\n }\n }\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\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;is[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\n#include \n#include \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=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\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;icount1)\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\n#include\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;ik){\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\n#include\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=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 \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 //3번\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= 'a') {\n ++str[p - 'a'];\n }\n else break;\n }\n for (i = 0; ik) {\n printf(\"NO\\n\");\n \n return 0;\n }\n }\n \n printf(\"YES\\n\");\n \n return 0;\n}"}, {"source_code": "#include\n#include\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\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\n#include\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#include \n#include \n#include \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\n#include\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=k)\n {\n printf(\"YES\");\n }\n else {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\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\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;ik)\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \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=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 \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 \n#include \n#include \n#include \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 \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 \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;i1)\n {\n count++;\n }\n }\n }\n k=0;\n\n for(i=0;i\n#include \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\nint n, k, i;\nchar a[100];//������ɫ\nint b[26];//��26��������ɫ ������26�������г�ʼ��Ϊ0\nint main()\n{\n\t//int n, k, i;\n\t//char a[100];//������ɫ\n\t//int b[26];//��26��������ɫ ������26�������г�ʼ��Ϊ0\n\tscanf(\"%d%d\", &n, &k); //n��ʾ�������� k��ʾ��������\n\tscanf(\"%s\", a + 1);\n\tfor (i = 1; i <= n; i++) //ѭ��n�� ���ж��ٸ�������ɫ\n\t{\n\t\tb[a[i] - 'a']++; //�����ݴ�����b[26]�� ������ĸa��z��ÿ����ĸ�������ֱ��Ƕ���\n\t}\n\tfor (i = 0; i < 26; i++)//���������ĸ�У��ٴ�a - z�������һ��������ɫ���������������� ֱ��no\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\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 \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#include\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 \n#include \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\n#include\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;imax){\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\n#include\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;ik)\n return puts(\"NO\"),0;puts(\"YES\");\n }\n return 0;\n}"}, {"source_code": "#include\n#include\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;imax){\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 \n#include \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;jk)\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\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\n#include\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\n#include\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\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 \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\n#include\n#include\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;is[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;icount)\n {\n min=count;\n\n }\n count=1;\n }\n \n }\n // printf(\"%d\\n\",min);\n if(min\n#include \n#include\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\n#include \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\n#include\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=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\n#include\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= 2*k)\n\t{\n\t\tfor(i=0;i 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\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;ifriends){\n printf(\"NO\");\n return 0;\n }\n }\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\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;imax){\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\nint main()\n{\n int n,i,j,temp;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i\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\n#include\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)0)\n {\n check[j]=count;\n j++;\n }\n }\n j--;\n while(j>=0)\n {\n if(check[j]\n#include\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;imax){\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\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\n#include\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\n#include\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;ic)\n {\n printf(\"NO\");\n return 0;\n }\n }\n }\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include \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\n#include\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;ik){\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\n#include\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 }\n printf(\"YES\");\n\n}"}, {"source_code": "#include\n#include\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; ik) {\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\n#include\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; ik) {\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 \n#include \n#include \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=k)\n printf(\"YES\\n\");\n else\n {\n if(2*t==n||(2*t\n#include\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= 2*k)\n\t{\n\t\tfor(i=0;i 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\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\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 \n#include \n#include\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\n\nint N,K;\nchar baloon[110];\nint chart[30];\n\nint sol(){\n\tint i,j,num=2;\n\tfor(i=0;i\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) //풍선이 너무 많음\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. 입력 받기/\n2. 입력 받은 풍선을 array에 넣기/\n3. 변수 cnt와 tmp 만들기 /\n4. tmp로 색을 비교하면서 해당 색과 같은 색이 몇개 있는지 cnt로 저장\n5. ( 풍선수 > 학생수*2 ) -> No/\n6. cnt와 학생 수를 비교, ( cnt > 학생수 ) -> No/\n\n\n*/"}, {"source_code": "#include\n#include\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=k)\n\t{ z++;\n\t\tprintf(\"NO\");\n\t\tbreak;\n\t}\n}if(z==0)\nprintf(\"YES\");\n}"}, {"source_code": "#include \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\n#include\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;ik)\n return puts(\"NO\"),0;\n puts(\"YES\");\n }\n return 0;\n}"}, {"source_code": "#include \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;ik)\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 \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 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\n#include\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\n#include\n#include\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\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\n#include\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;ic)\n {\n printf(\"NO\");\n return 0;\n }\n }\n }\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\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;ic)\n {\n printf(\"NO\");\n return 0;\n }\n }\n }\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\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;ic)\n {\n printf(\"NO\");\n return 0;\n }\n }\n }\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\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;is[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=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\n#include\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\n#include\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=k)printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include\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;ik)\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\n#include\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\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#include\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\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\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\n#include\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#include\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=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\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;icount1)\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 \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\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 \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\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\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\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;icount1)\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 \n#include \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;jk)\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 \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\n#include\n#include\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;is[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;icount)\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\n#include\n#include\n#include\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;imax)\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\n#include\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=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$$$ — 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 \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\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\n#include\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 \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\n#include\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 \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\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\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\n#include\nint main()\n{\n int a,n,i,k;\n scanf(\"%d%d\",&n,&k);\n\n if(n0;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\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\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\n#include\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 \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;ix)mn=x;\n }\n printf(\"%d\\n\",mn);\n}\n"}, {"source_code": "#include\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\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\n#include \n#include \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\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\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 aofd[i] && aofd[i]) ans = aofd[i];\n }\n\n printf(\"%i\", ans);\n return;\n}"}, {"source_code": "#include \n#include \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\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 \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\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\n#include\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 \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\n#include\n#include\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\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\n#include\n#include\n#include\n#define MIN(a,b) ab?a:b\n#define rep(i,a,b) for(i=a;ib;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 \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\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 \n#include \n#include \n#include \n#include \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\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\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 \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 \n\nint main(void) {\n int n,k,q,r;\n scanf(\"%d%d\",&n,&k);\n for(int i=1;i\n#include\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\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 \n#include\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\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\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 \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하는 수보다 크면 더 할수가 없다\n\t\t\tbreak;\n\t\tif (i == 1)\t\t\t\t\t\t\t\t\t// 처음 x 값 정하기\n\t\t\tx = k * (n / i) + i;\n\t\tif (n%i == 0 && i < k) {\t\t\t\t\t// 나누어 떨어질 때\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 \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// 나누어 떨어질 때\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\nint main()\n{\n\tint n,k,a,x,i;\n\tscanf(\"%d %d\",&n,&k);\n\tfor(i=1;i\nint n,i,x,k;\nint main()\n{\n scanf(\"%d%d\",&n,&k);\n for(i=1;i\n#include\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 \n#include\n#include\n#include\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 \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\n#include\nint main(){\nint x,n,k,i;\nscanf (\"%d %d\",&n,&k);\n//for(){\n//}\nfor(i=0;;i++){\n \nfor(x=0;x\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\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 \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\n#include\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\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\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 \n#include \n\nint main()\n{\n int n,k,i,j,x;\n scanf(\"%d\",&n);scanf(\"%d\",&k);\n\n for(i=0;i\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\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 \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 \n#include \n#include \n\n\n\nunsigned long int a=0;//кол-во cnhjr\nunsigned long int b=0;//кол-во столбцов\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\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\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\n#include\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\n#include\n#include\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;k1) {\n if(j>l) j=l;\n }\n }\n }\n }\n printf(\"%lld\",j);\n return 0;\n}"}, {"source_code": "#include \n#include \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\ntypedef long long ll;\nll minn(ll a,ll b)\n{\nreturn (a\n#include \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\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 \n#include \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 \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\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\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\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 \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 \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\nint main(){\n int n,k,term,min=1000000;\n scanf(\"%d%d\",&n,&k);\n for(int i=1;i\nint main(){\n int n,k,term,min=1000000;\n scanf(\"%d%d\",&n,&k);\n for(int i=1;i<=n && i\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\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\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\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\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\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\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\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\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\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\n#include\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\n\nint main(){\n\tint n,k,a;\n\tscanf(\"%d %d\",&n,&k);\n\tif(k-1\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 aofd[i] && aofd[i]) ans = aofd[i];\n }\n\n printf(\"%i\", ans);\n}"}, {"source_code": "#include \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\n#include\n#include\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\n#include\n#include\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\n#include\n#include\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\n#include\n#include\n#include\n#define MIN(a,b) ab?a:b\n#define rep(i,a,b) for(i=a;ib;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\n#include\n#include\n#include\n#define MIN(a,b) ab?a:b\n#define rep(i,a,b) for(i=a;ib;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 \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\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\n#include\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\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\n#include\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\n#include\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\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\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\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 \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 \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\n#include\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\n#include\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\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\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 \n#include\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\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\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 \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// 나누어 떨어질 때\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\nint main()\n{\n\tint n,k,a,x,i;\n\tscanf(\"%d %d\",&n,&k);\n\tfor(i=1;i\n#include\n#include\n#include\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 \n#include\n#include\n#include\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 \n#include\n#include\n#include\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\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\n#include\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 \n#include \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 \n#include \n\nint main()\n{\n int n,k,i;\n scanf(\"%d\",&n);scanf(\"%d\",&k);\n for(i=n+k;i\n#include \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 \n#include \n\nint main()\n{\n int n,k,i,j,x;\n scanf(\"%d\",&n);scanf(\"%d\",&k);\n\n for(i=0;i\n#include \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 \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 \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\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\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\n\nint main(){\n int n,k,x,first,temp,i;\n scanf(\"%d %d\",&n,&k);\n for(i=1;i\n#include\n#include\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\n#include\n#include\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;k1) {\n if(j>l) j=l;\n }\n }\n }\n printf(\"%lld\",j);\n return 0;\n}"}, {"source_code": "#include\n#include\n#include\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 \n#include \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\n#include \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\n#include \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#include \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 \n#include \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 \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 - 1.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 ≤ A ≤ 1000).", "output_spec": "Output should contain required average value in format «X/Y», 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\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;i0){\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\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\nmain()\n{\n int n,i,j,N,s=0;\n scanf(\"%d\",&n);\n for(i=2;in)\n break;\n }\n printf(\"%d/%d\",s,n);\n}\n"}, {"source_code": "#include\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 \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\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\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\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;q0)\n { a=b%i;\n b=b/i;\n p[q]+=a;}\n b=r;}\nfor(q=1;q1;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 \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 \n#include \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\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 \n#include \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(i0)\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\nint main()\n{\n int n,i,num=0,temp,x,den,j;\n scanf(\"%d\",&n);\n for(i=2;i0)\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\nint main()\n{\n\tint n,temp,i,sum=0,x=0,y=0;\n\tscanf(\"%d\",&n);\n\tfor (i=2;i\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 \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\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\nint main()\n{\n int n,i,num=0,temp,x,den,j;\n scanf(\"%d\",&n);\n for(i=2;i0)\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\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\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=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\nint main()\n{\n \n int i,a,s=0,num,j,x;\n scanf(\"%d\",&a);\n for(i=2;i0)\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 \n#include \n#include \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;i0){\n printf(\"P\");\n a[i]--;\n }\n if(a[i]==0){\n a[i]=-1;\n c++;\n }\n\n if(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\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=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\nint main()\n{\n\tint n,temp,i,sum=0,x=0,y=0;\n\tscanf(\"%d\",&n);\n\tfor (i=2;i\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=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\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;i0)\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 \n#include \n\nint main()\n{\n int A, X = 0;\n scanf(\"%i\", &A);\n int N = A;\n for(int i=2;i\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;q0)\n { a=b%i;\n b=b/i;\n p[q]+=a;}\n b=r;}\nfor(q=1;q1;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 © 2020 Petrucio. All rights reserved.\n//\n\n\n#include \nint main(){\n long int n,i,l,j,k,s=0;\n scanf(\"%ld\",&n);\n for(i=2;i\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\nmain()\n{\n int n,sum=0,i;\n scanf(\"%d\",&n);\n if(n>2)\n {\n for(i=2;ib-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 \n#include \n#include \n#include \n#include \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\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 \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 \n#include \n\nint main()\n{\n int A, X = 0;\n scanf(\"%i\", &A);\n int N = A;\n for(int i=2;i\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 \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 \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\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;i0)\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 \nint main(){\n long int n,i,l,j,k,s=0;\n scanf(\"%ld\",&n);\n for(i=2;i \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;j0)\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\n#include\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;ic?sum:c;\n y=sum\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;q0)\n { a=b%i;\n b=b/i;\n p[q]+=a;}\n b=r;}\nfor(q=1;q1;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\n#include\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;i0)\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\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\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=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 \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\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\n#include\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\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; i0)\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 \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 \n#include \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 \n#include \n\nint main()\n{\n int A, X = 0;\n scanf(\"%i\", &A);\n int N = A;\n for(int i=2;i\nint main()\n{\n int n,i,num=0,temp,x,den,j;\n scanf(\"%d\",&n);\n for(i=2;i0)\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\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;q0)\n { a=b%i;\n b=b/i;\n p[q]+=a;}\n b=r;}\nfor(q=1;q1;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\n#include\n#include\nlong long resultaCb(long long n,long long m)\n{\n if(nm;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\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\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=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 \nint main()\n{\n int a,s=0,i,j,z;\n scanf(\"%d\",&a);\n for(i=2;i\n\nint main()\n{\n int pp,qq,t,i,j,k,count=0;\n scanf(\"%d\", &t);\n for(i=2;i\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;i0)\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 \n#include\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 \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 \nint main(){\n long int n,i,l,j,k,s=0;\n scanf(\"%ld\",&n);\n for(i=2;i\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\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\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 © 2020 Petrucio. All rights reserved.\n//\n\n\n#include \nint main(){\n long int n,i,l,j,k,s=0;\n scanf(\"%ld\",&n);\n for(i=2;i\nint main()\n{\n\tint n,i,x;\n\tscanf(\"%d\",&n);\n\tint S[n-2];\n\tfor(i=0;i0;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\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\n#include\n#include\n#include\n#include\n#include\n#include\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 \n#include \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\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;q0)\n { a=b%i;\n b=b/i;\n p[q]+=a;}\n b=r;}\nfor(q=1;q1;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\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 \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; b0)\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\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 \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\nint main()\n{\n\tint i , j , k , m , n , t , p;\n\tscanf(\"%d\",&n);\n\tt = 0;\n\tfor(i = 2 ; i=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\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=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 \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\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;i0){\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 \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 \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\n#include\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\n#include\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;ic?sum:c;\n y=sum\n#include \n#include \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 \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; b0)\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\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;i0 ){ 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\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\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\n#include\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\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\n\nint main()\n{\n int a,b;\n scanf(\"%d\",&a);\n int i,sum=0;\n for(i=2;i0;)\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\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\nint main()\n{\n\tint n,i,rem,count=0,j,b;\n\tscanf(\"%d\",&n);\n\tb=n;\n\tfor (i=2;i1;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\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\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;q0)\n { a=b%i;\n b=b/i;\n p[q]+=a;}\n b=r;}\nfor(q=1;q1;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\nint main()\n{\n\tint k,n=0,i,r,sum=0,t;\n\tscanf(\"%d\",&n);\n\tt=n;\n\tfor(i=2;i1;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\nint main()\n{\n int n, i, x, y, sum=0, s, d;\n scanf(\"%d\",&n);\n for(i=2;i0;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\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\nint main()\n{\n\tint n=0,i,r,sum=0,t;\n\tscanf(\"%d\",&n);\n\tt=n;\n\tfor(i=2;i1;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\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\n#include\n#include\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\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\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\nint main()\n{\n int A,i,c=0,d,r;\n scanf(\"%d\",&A);\n\n for(i=2;i\n#include \n//int ne[101];\nint main()\n{\n int a,i,x,s=0;\n scanf(\"%d\",&a);\n for(i=2;i0)\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\n#include\n#include\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\n#include \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\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\n#include\n#include\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\n#include\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 \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\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\nint main()\n{\n int n,i,num=0,temp,x;\n scanf(\"%d\",&n);\n for(i=2;i0)\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 \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\nint main()\n{\n int n,i,m,s=0,d;\n scanf(\"%d\",&n);\n for(i=2;i0)\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 \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\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 \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\nmain()\n{\n long int a,i,l,sum=0;\n scanf(\"%ld\",&a);\n for(i=2;i\n#include \n//int ne[101];\nint main()\n{\n int a,i,x,s=0;\n scanf(\"%d\",&a);\n for(i=2;i0)\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 © 2020 Petrucio. All rights reserved.\n//\n\n#include \n\nint main() {\n int n,i,l,j,s=0;\n scanf(\"%d\",&n);\n for(i=2;i\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\n#include\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\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#include\n#include\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\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#include \n//int ne[101];\nint main()\n{\n int a,i,x,s=0;\n scanf(\"%d\",&a);\n for(i=2;i0)\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\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;i0){\n if(n>=j&&n\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\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;i0){\n if(n>=j&&n\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\nint main()\n{\n int n,i,num=0,temp,x;\n scanf(\"%d\",&n);\n for(i=2;i0)\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 \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 \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\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\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\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\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;i0){\n if(n>=j&&n\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\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 \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 \n#include \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\n\nint main()\n{\n int pp,qq,t,i,j,k,count=0;\n scanf(\"%d\", &t);\n for(i=2;i\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\nint main()\n{\n int n,i,sum=0;\n scanf(\"%d\",&n);\n int x=n;\n for(i=2;i=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\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\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 \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 \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 \n# include \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\nint main()\n{\n int n,i,m,s=0,d;\n scanf(\"%d\",&n);\n for(i=2;i0)\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\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\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\nint main()\n{\n int p=0,i,t,n;\n scanf(\"%d\",&n);\n for(i=2;i\n#include\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\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;q0)\n { a=b%i;\n b=b/i;\n p[q]+=a;}\n b=r;}\nfor(q=1;qy)\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\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=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\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 \n#include \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 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\n\nint main()\n{\nint A,i,b,c;\nscanf(\"%d\",&A);\nint num,sum=0;\nfor(i=2;i\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\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\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;q0)\n { a=b%i;\n b=b/i;\n p[q]+=a;}\n b=r;}\nfor(q=1;qy)\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 \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 \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\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;c0;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 \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\nint main()\n{\n\tint a,sum=0,n;\n\tscanf(\"%d\",&n);\n\tint i;\n\tfor(i=2;i0)\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\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\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\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\n#include\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\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\n#include \n#include \n#include \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\n\nint main()\n{\n\tint n,i,j,sum=0;\n\tscanf(\"%d\",&n);\n\tint a[1001];\n\tfor(i=2;ii)\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\nint main()\n{\n int i,n,a,sum=0;\n while(scanf(\"%d\",&a)==1)\n {\n for(i=2;i\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\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# include \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\n#include\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 \n#include \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 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\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\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 \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 int main()\n {\n int n,i,x;\n scanf(\"%d\",&n);\n int S[n-2];\n for(i=0;i\n#include \n#include \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;i0){\n printf(\"P\");\n a[i]--;\n }\n if(a[i]==0){\n a[i]=-1;\n c++;\n }\n\n if(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 \n#include \n\nint main(){\n int A,i,s=0,c=0,t;\n scanf(\"%d\",&A);\n for(i=2;i\n#include \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\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\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 \n#include \n\nint main()\n{\n int A, X = 0;\n scanf(\"%i\", &A);\n int N = A;\n for(int i=2;i\n int main()\n {\n int n,i,x;\n scanf(\"%d\",&n);\n int S[n-2];\n for(i=0;i\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 \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 \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#include \n \nint main() {\n\tint a,i,sum=0;\n\tscanf(\"%d\",&a);\n\tfor(i=2;i\nint main()\n{\n int i,n,a,sum=0;\n while(scanf(\"%d\",&a)==1)\n {\n for(i=2;i\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 — 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, 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.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 ≤ k ≤ n ≤ 1018).", "output_spec": "Output one number — 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 \n#include \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]>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 \n#include \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\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 \n#include \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\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 \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<>1;\n\t}\n\tprintf(\"%lld\\n\",x);\n\treturn 0;\n}"}, {"source_code": "#include\n#include\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\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 \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\n#include\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\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\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\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\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\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\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\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=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\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 \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 \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\n#include\n#include\n#include\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/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/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*(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\n#include\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\n#include\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 \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 \n#include \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 \n#include \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\n#include\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\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 \n#include \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\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 \n#include \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\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 \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\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 \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\n#include\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 \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\n#include\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(nn)\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 �� 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?��?k?��?n?��?1018).\n\nOutput\nOutput one number �� 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 \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 \n#include \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 \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<\n#include\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\n#include \n#include \n#include \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\n#include \n#include \n#include \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\n#include\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\n#include\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 \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<\n#include\n#include\n#include\n#include\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\n#include\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\n#include\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\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\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 \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\n#include\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 \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\n#include\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 \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 \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 \n#include \n#include \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 \n#include \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 \n#include \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\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\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 \n#include \n#include \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 \n#include \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 \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 \n#include \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 \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 \n#include \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 \n#include \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]>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 \n#include \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]>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 \n#include \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\n#include \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 \n#include \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\n# include\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\n#include\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 \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 \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\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\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=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\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=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\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;jn||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;ix)\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\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=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\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\n#include\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\n#include\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\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 \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\n#include\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\n#include\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\n#include\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\n#include \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 \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\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\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\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\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\n#include\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 \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\n#include\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\n#include\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\n#include\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\n#include\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\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 \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 \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 \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 �� 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?��?k?��?n?��?1018).\n\nOutput\nOutput one number �� 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 \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 �� 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?��?k?��?n?��?1018).\n\nOutput\nOutput one number �� 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 \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 \n#include \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\n#include\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\n#include\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\n#include \n#include \n#include \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\n#include\n#include\n#include\n#include\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\n#include\n#include\n#include\n#include\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\n#include\n#include\n#include\n#include\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\n#include\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\n#include\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=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\nlong long int power(int n)\n{\n\tint m;\n\tlong long int sum1=1;\n\tfor(m=0;m0;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\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 \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\n#include\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 \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 \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 \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 \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 \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 \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 \n#include \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 \n#include \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 \n#include \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 \n#include \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 \n#include \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 \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 \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 \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 \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 \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 \n#include \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 \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\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 — 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)$$$ — the number of ties. The second line contains one integer $$$b$$$ $$$(1 \\le b \\le 100\\,000)$$$ — the number of scarves. The third line contains one integer $$$c$$$ $$$(1 \\le c \\le 100\\,000)$$$ — the number of vests. The fourth line contains one integer $$$d$$$ $$$(1 \\le d \\le 100\\,000)$$$ — the number of jackets. The fifth line contains one integer $$$e$$$ $$$(1 \\le e \\le 1\\,000)$$$ — the cost of one suit of the first type. The sixth line contains one integer $$$f$$$ $$$(1 \\le f \\le 1\\,000)$$$ — the cost of one suit of the second type.", "output_spec": "Print one integer — 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\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[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 \n#include \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 \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)a)\n cost=b*f+a*e;\n else if(c<=b && (d-c)\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(emin)\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\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 \n#include \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\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\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\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\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 \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\n#include \n#include \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\n#include\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(cf){\n int min=1000000; \n if(a\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(e0)\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 \n#include \n#include \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 \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)a)\n cost=b*f+a*e;\n else if(c<=b && (d-c)\nint min(int a,int b){if(af){\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 \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[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] 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 \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 \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\nint min(int a,int b){\n if(acost1){\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\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 \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\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 \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\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]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 \n#include \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(mino){\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\n#include\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(cf){\n int min=1000000; \n if(a\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[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] 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\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\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\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\n#include \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 \n#include \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(mino){\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 \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 \n#include \n#include \nlong long int min(long long int a,long long int b)\n{\n if (ae)\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\n#include \n#include \n#include \n#include \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\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 \n#include \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 \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 \n#include \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\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\n#include\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 \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\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 \n#include \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\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)cost2)\n printf(\"%lld\\n\",cost1);\n else\n printf(\"%lld\\n\",cost2);\n return 0;\n}\n"}, {"source_code": "#include\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(bf)\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=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\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\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=(bf)\n\t{\n\t\tk=(a\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\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 \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\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\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[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] 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 \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\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\", 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\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 \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\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\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\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)cost2)\n printf(\"%lld\\n\",cost1);\n else\n printf(\"%lld\\n\",cost2);\n return 0;\n}\n"}, {"source_code": "#include \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 \n#include \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\nunsigned int min(unsigned int a,unsigned int b) {\n if(ae ) {\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\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)cost2)\n printf(\"%lld\\n\",cost1);\n else\n printf(\"%lld\\n\",cost2);\n return 0;\n}\n"}, {"source_code": "#include \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[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] 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\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 \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\n#include \n#include \nlong long int min(long long int a,long long int b)\n{\n if (ae)\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\nlong long min(long long a,long long b,long long c)\n{\nif(af)\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\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=(bf)\n\t{\n\t\tk=(a\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\n#include \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\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\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\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 \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 \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\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 \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[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] 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 \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\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 \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\n#include\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=bmin)\n p=a*e+min*f;\n else\n p=a*e+d*f;\n }\n\n }\n else\n {min=bd)\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\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 \n#include \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(mino){\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\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=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 \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 \n#include \n#include \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 \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\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\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[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 \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\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 \n#include \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 \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\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(emin)\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\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\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 \n#include \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 \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 \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\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 \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 \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\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] 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\nunsigned int min(unsigned int a,unsigned int b) {\n if(ae ) {\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\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\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\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\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(bmin)\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\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 \n#include \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 \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 \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; i0 && input[2]>0 && input[3>0]){\n if(input[1]>input[2]){\n max_type2 = input[2];\n }\n else if(input[1] 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\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(bmin)\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\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] 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 \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 \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 cost2)\n printf(\"%d\",cost1);\n else\n printf(\"%d\",cost2);\n return 0;\n\n\n\n\n}\n"}, {"source_code": "#include \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 \n#include \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\nlong int min3(long int a,long int b,long int c)\n{\n return (a\n#include \n#include \n#include \n#include \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 \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\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(ad)\n price+=d*e;\n else\n price+=a*e;\n }\n printf(\"%d\\n\",price);\n}\n"}, {"source_code": "#include\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\nint min1(long int x,long int y)\n{\n if(x=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\n#include\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=e){\n if(x>d)\n printf(\"%d\\n\",d*f);\n else if(xd)\n printf(\"%d\\n\",d*e);\nelse if (a\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\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(ad){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\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(ad)\n x=d;\n\n x=x*f;\n\n}\n\nprintf(\"%d\\n\",s+x);\n\nreturn 0;\n}"}, {"source_code": "#include \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 \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\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\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(ad)\n x=d;\n\n x=x*f;\n\n}\n\nprintf(\"%d\\n\",s+x);\n\nreturn 0;\n}"}, {"source_code": "#include\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\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\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(b0){\n count+=g*e;\n }\n\n printf(\"%d\\n\", count);\n return 0;\n}\n"}, {"source_code": "#include\n#include\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=bmin)\n p=a*e+min*f;\n else\n p=a*e+d*f;\n }\n\n }\n else\n {min=bd)\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 \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\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 \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 \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 \n#include \n#include \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 \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 cost2)\n printf(\"%d\",cost1);\n else\n printf(\"%d\",cost2);\n return 0;\n\n\n\n\n}\n"}, {"source_code": "#include \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\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(ef)\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 \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 \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\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\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\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 \n#include \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 \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\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\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\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(scarvesjackets)\n {\n cost2=jackets*Type1Cost;\n MaxCost=cost2;\n }\n else if(tiesvests &&(jackets-ties)>vests)\n {\n MaxCost=cost2+(vests*Type2Cost);\n\n }\n else if(scarves\nint min(int a,int b,int c)\n{\nif(af)\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 \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\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 \n#include \n#include \n#include \n#include \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\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\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 \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 \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 \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\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 \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 \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\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\n#include\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 \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\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\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=(bf)\n\t{\n\t\tk=(a\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(scarvesRemain)\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(tiesvests &&RemainJacket>vests)\n {\n MaxCost=cost2+(vests*Type2Cost);\n\n }\n else if(scarvesscarves)\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 \n#include \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\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 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 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 \n#include \n#include \n#include \n#include \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\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 \n#include \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 \n#include \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\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 \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\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\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 \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 cost2)\n printf(\"%d\",cost1);\n else\n printf(\"%d\",cost2);\n return 0;\n\n\n\n\n}\n"}, {"source_code": "#include\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\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 \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\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\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(ad)\n x=d;\n\n x=x*f;\n\n}\n\nprintf(\"%d\\n\",s+x);\n\nreturn 0;\n}"}, {"source_code": "#include\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\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 \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 \n#include \n#include \n#include \n#include \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 \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\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\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 \n#include \n#include \n#include \n#include \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, Hr, Hb, Wr, Wb (1 ≤ C, Hr, Hb, Wr, Wb ≤ 109).", "output_spec": "Print a single integer — 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 \n#include \n#include \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\n#include\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(remmax)max=f;\n if(rem%c==0)break;\n if(rem\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 \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 \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 \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 \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 \n#include \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 \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&&w2ans2)\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 \n#include \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\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\n#include \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(wrans)\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 \n#include \n#include \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\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;ians){\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\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\n#include\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\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 \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 \n#include \n#include \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 \n#include \n#include \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 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 \n#include \n#include \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 ans) ans=tmp;\n}\n\nconst unsigned long long z2= C/Wb;\n\nfor ( unsigned long long n1=0; (n1 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 \n#include \n#include \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 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\n#include\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(ck){\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(remmax)max=f;\n if(rem%c==0)break;\n if(rem\n#include\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(ck){\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\n#include\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(remmax)max=f;\n if(rem%c==0)break;\n if(rem\n#include\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(ck){\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 \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 \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 \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 \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 \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 \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 \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 \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 (gg2ans)\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 \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&&w2ans2)\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 \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&&w20)\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 (gg2ans)\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 \n#include \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\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\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\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\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 \n#include \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 \n#include \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(wrans)\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 \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\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\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;ians){\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\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;ians){\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\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\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\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\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\n#include\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(maxenjoysqrt(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\n#include\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;now2maxenjoy)\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\n#include\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\n#include\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(maxenjoysqrt(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\n#include\n#include\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=m)\n\t{\n\t\tfor(i = 0;ixb)\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\n#include\n#include\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){\n printf(\"%d\\n\",c/wr*hr);\n return 0;\n }\n if(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\n#include\n#include\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=wr){\n ans+=(l/wr)*hr;\n l-=l/wr*wr;\n }\n if(hr=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 \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*wbn*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\n#include\n#include\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=m)\n\t{\n\t\tfor(i = 0;ixb)\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 777 777 777 floors, numbered from  - 8 888 888 888 to 8 888 888 888. In particular, there is floor 0 between floor  - 1 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 888 888 888 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,  - 180, 808 are all lucky while 42,  - 10 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 ( - 109 ≤ a ≤ 109).", "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\n#include\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\n#include\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 \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 \n#include \n#include \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 \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\n#include\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\n#include\n#include\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\n#include\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\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 \n#include \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 \n#include \n#include \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\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 \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 \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 \n#include \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 \n#include \n#include \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 \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\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 \n#include \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 \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\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 \n#include \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 \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\n#include\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 \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 \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\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 \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 \n#include \n#include \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\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 \n#include \n\nint encontrar(long int a, int *ptrban);\n\nint main(){ //este algor�tmo 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�gito 8, se tendra buena suerte. El problema consiste en saber cuantos pisos encima\n //se encuentra el siguiente piso con d�gito 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�n encontrar devuelva 0 sigue el ciclo while\n b++; //mientras la funci�n 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� en 1 y no se increment� b\n}\nint encontrar(long int a, int *ptrban){ //la funci�n encontrar recibe el piso actual y la bandera por referencia(puntero a ban)\n //la funci�n 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�gito de \"a\"\n if(c==8 || a==8){ //si \"c\" o \"a\" == 8 retorna 1 que significa que encontr� 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�n 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� el d�gito \"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 \n#include \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\n#include\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 \n#include \n//#include \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\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 \n#include \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 \n#include \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 \n#include \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\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\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 \n#include \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\n#include\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 \n#include \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\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 \n#include \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 \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\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 \n#include \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 \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\n#include \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\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 \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 \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\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 \n#include \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ígito 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 \n#include \n#include \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\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\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 \n#include \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 \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 \n#include \n\n#define loop(i,x,y) for(i=x;i\n#include \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 \n#include \n#include \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 \n#include \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\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 \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\n#include\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\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 \n#include \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\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 \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\n#include\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 \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\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\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�s alto y m�s 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�as, miles de turistas vienen a este lugar para disfrutar de la maravillosa\nvista.\n\nEn Cyberland, se cree que el n�mero \"8\" es un n�mero 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�n decimal contiene al menos uno d�gito \"8\". Por ejemplo, 8, - 180, 808 son afortunados, mientras que 42, - 10\nno. En la Torre Giga, si escribes c�digo en un piso con el n�mero del piso de la suerte, la buena suerte siempre estar� contigo (Bueno, esta ronda\nes # 278, tambi�n afortunada, �eh?).\n\nEl turista Henry va a la torre a buscar buena suerte. Ahora �l est� en el piso numerado a . Quiere encontrar el m�nimo positivo n�mero entero b , de\ntal manera que, si camina b pisos superiores, que llegar�n a un piso con una suerte de n�mero.\n\nEntrada\nLa �nica l�nea de entrada contiene un n�mero entero a ( - 10 9 <= a <= 10 9 ).\n\nSalida\nImprima el m�nimo b en una l�nea.*/\n#include\n#include \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 \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 \n#include \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 \n#include\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\n#include\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\n#include \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#include \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\n#include \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\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\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\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\n#include\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 \n#include \n#include \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 \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\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\n#include\n#include\n#include\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\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\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\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 \n#include \n#include \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\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\n#include\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 \n#include \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\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\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 \n#include \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 \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 \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\n#include\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 \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\n#include\n#include\n#include\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\n#include\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 \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\n#include\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\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 \n#include \n#include \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\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\n#include\n#include\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-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\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\n#include\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 \n#include \n#include \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 \n#include \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\n#include\n#include\n#include\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\n#include\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 \n#include \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 \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\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 \n#include \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 \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\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\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\n#include \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\n//#include\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\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 \n#include \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\n#include\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\n#include\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\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 \n#include \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 \n#include \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\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\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 \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 \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\n#include \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#include\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\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 \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 \n#include \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\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 \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\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 \n#include \n//#include \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 \n#include \n#include \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\n//#include\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\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\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 \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\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\n#include\n#include\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;i0)\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\n#include\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\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\n#include\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\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 \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\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 \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\n#include\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\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 \n#include \n#include \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\n#include \n#include \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\n#include \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\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 \n#include \n#include \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\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 \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\n#include\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 \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 \n#include \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 \n#include \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\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 \n#include \n#include \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\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 \n#include \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 \n#include \n\n#define loop(i,x,y) for(i=x;i\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\n#include\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 \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 \n#include \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 \n#include \n//#include \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\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 \n#include \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\n#include\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\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 \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\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\n#include\n#include\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 \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 \n#include \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\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 \n#include\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\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\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\n#include\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 - m temperatures), so that the minimum temperature was min and the maximum one was max.", "input_spec": "The first line contains four integers n, m, min, max (1 ≤ m < n ≤ 100; 1 ≤ min < max ≤ 100). The second line contains m space-separated integers ti (1 ≤ ti ≤ 100) — 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 \n#include \n#include \n#include \n#include \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\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;imax1)\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\n#include\n#include\n#include\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=2)\n {\n a[i++]=mn;\n a[i++]=mx;\n for(j=0;j\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\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;iq)\n q=a;\n }\n if(min>p || max=0)\n printf(\"Correct\");\n else\n printf(\"Incorrect\");\n return 0;\n\n}\n"}, {"source_code": "#include\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(maxk)min=k;\n\t}\n\tif(minMA)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�׽����� n ������ ��ģ��.\n�� ���ܿ��� ���μ����� �Ϻ� ��ɵ��� ��´�.\n�׸��?�� �µ��� �����ȴ�.\n���� �����Ͼ ���μ����� �Ͽ����� �������� ������ �ִ�. �״� ���� ���� �µ����� ū �µ����� �᳻������.\n���� ������ ��� �µ��� �᳻�������ߴ�. �׷��� �״� ���� m�� ����ߴ�.\n\n������ ������ ��� m �µ����� ���?�� �����. ������ ���������Ͼ ������ ��Ȯ�ϰ� ����� �ǽ��Ѵ�. \n�׷��� �״� ��ſ��� �׸� ���ʹ޶�� ��û�Ѵ�. �־��� n,m,min,max �׸��� m ���� �µ� ����Ʈ����\n����� m �µ� ��Ʈ���� n �µ� ��Ʈ�� ���׷��̵� �Ҽ� ������ �����Ѵ�.\n�׷��� ���� ���� �µ��� min ������ max �̴�.\n\n\n\n*/\n\n#include \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\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||tempn||key)\n printf(\"Incorrect\");\n else printf(\"Correct\");\n return 0;\n}\n"}, {"source_code": "#include\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=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\nint n,m,a,b,x=2,i,z;\nmain(){\nscanf(\"%d%d%d%d\",&n,&m,&a,&b);\nfor(i=0;ib){puts(\"Incorrect\");return 0;}}\nif(n-m\nint n,m,a,b,x=2,i,z;\nmain(){\nscanf(\"%d%d%d%d\",&n,&m,&a,&b);\nfor(i=0;ib){puts(\"Incorrect\");return 0;}}\nif(n-m\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;imax)\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 \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 \n#include \n#include \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;imax)\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\nint partition(int number[],int i,int j)\n{\n int key;\n key=number[i];\n while(ikey) j--;\n if(it[0]||max\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 \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\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;imax)\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 \n#include \n#include \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 \n#include \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 \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\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;imax)\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 \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 \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;imini && arr[i]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\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]Max||a[i]\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;imax)\n {\n count=1;\n break;\n }\n}\nif(count==0)\n{ \nfor(i=0;i=2)\n printf(\"Correct\");\n else\n printf(\"Incorrect\");\n}\n}\nelse\n{\n printf(\"Incorrect\");\n}\nreturn 0;\n}"}, {"source_code": "#include \n#include \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=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\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||maxmin)\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]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\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= 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\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;ib)\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 \n#include \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]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 \n#include \n#include \n#include\n#include\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;imax)\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\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;imax)\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;imax)\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 \n#include \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 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 max)\n\t\t\tcorrect = 0;\n\t\n\tfprintf(stdout, correct ? \"Correct\" : \"Incorrect\");\n\t\n\treturn 0;\n}"}, {"source_code": "#include \n#include \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=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\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;imax)||(a[i]=(2-c))\n printf(\"Correct\\n\");\n else\n printf(\"Incorrect\\n\");\n }\n }\n return 0;\n }\n"}, {"source_code": "#include\n#include\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;imax) 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 \n#include \n#include \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 \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=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(bmax)\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\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;imax || k\n#include \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;imax){\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 \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 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\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;imax)\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\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;itemp[i])\n\t\t\tmin_temp=temp[i];\n\t\tif(max_temp1)\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 \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;ib){\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 \n#include \n#include \n#include \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\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;imax)\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\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;imax&&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�u 2014\n * Author: KT\n */\n\n#include \n#include\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=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\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;imax||t[i]=2-count)\n printf(\"Correct\");\nelse\n printf(\"Incorrect\");\n}\nreturn 0;\n}\n"}, {"source_code": "#include\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 \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 \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 \n#include \n#include \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 \n#include \n#include \n#include \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;imax1)\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=2)\n\t printf(\"Correct\\n\");\n\t \n\t else if(x==0)\n\t {\n\t \tfor(i=0;i=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\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;i1)\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\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;imax1)\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 \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\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(maxk)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�׽����� n ������ ��ģ��.\n�� ���ܿ��� ���μ����� �Ϻ� ��ɵ��� ��´�.\n�׸��?�� �µ��� �����ȴ�.\n���� �����Ͼ ���μ����� �Ͽ����� �������� ������ �ִ�. �״� ���� ���� �µ����� ū �µ����� �᳻������.\n���� ������ ��� �µ��� �᳻�������ߴ�. �׷��� �״� ���� m�� ����ߴ�.\n\n������ ������ ��� m �µ����� ���?�� �����. ������ ���������Ͼ ������ ��Ȯ�ϰ� ����� �ǽ��Ѵ�. \n�׷��� �״� ��ſ��� �׸� ���ʹ޶�� ��û�Ѵ�. �־��� n,m,min,max �׸��� m ���� �µ� ����Ʈ����\n����� m �µ� ��Ʈ���� n �µ� ��Ʈ�� ���׷��̵� �Ҽ� ������ �����Ѵ�.\n�׷��� ���� ���� �µ��� min ������ max �̴�.\n\n\n\n*/\n\n#include \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 \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;imax)\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 \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;im)\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 \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;imax)\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 \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;i0)\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 \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\nint partition(int number[],int i,int j)\n{\n int key;\n key=number[i];\n while(ikey) j--;\n if(it[0]||max\nint partition(int number[],int i,int j)\n{\n int key;\n key=number[i];\n while(ikey) j--;\n if(it[0]||max\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 \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\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;imax)\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 \n#include \n#include \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 \n#include \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 \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 \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 \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 \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 \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\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=(a1+a2))\n printf(\"Correct\\n\");\n else\n printf(\"Incorrect\\n\");\n return 0;\n}\n"}, {"source_code": "#include \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=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\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;imax)\n {\n count=1;\n break;\n }\n}\nif(count==0)\n{ \nfor(i=0;i=2)\n printf(\"Correct\");\n else\n printf(\"Incorrect\");\n}\n}\nelse\n{\n printf(\"Incorrect\");\n}\nreturn 0;\n}"}, {"source_code": "#include\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=2)\n printf(\"CORRECT\");\n else\n printf(\"INCORRECT\");\n}\nreturn 0;\n}\n"}, {"source_code": "#include\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=2)\n printf(\"Correct\");\n else\n printf(\"Incorrect\");\n}\nreturn 0;\n}"}, {"source_code": "#include\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=2)\n printf(\"Correct\");\n else\n printf(\"Incorrect\");\n}\nreturn 0;\n}"}, {"source_code": "#include \n#include \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=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\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||maxmin)\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\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= 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\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= 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\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= 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\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;ib)\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\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=2)\n printf(\"Correct\\n\");\n else\n printf(\"Incorrect\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include\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=2)\n printf(\"Correct\\n\");\n else\n printf(\"Incorrect\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include \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]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 \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]max) flag=0;\n }\n if (flag==1) printf(\"Correct\"); else printf(\"Incorrect\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \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 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 \n#include \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 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 \n#include \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 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\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=2)\n printf(\"Correct\\n\");\n else\n printf(\"Incorrect\\n\");\n }\n }\n return 0;\n }\n"}, {"source_code": "#include\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;imax)||(a[i]=(2-c))\n printf(\"Correct\\n\");\n else\n printf(\"Incorrect\\n\");\n }\n return 0;\n }\n"}, {"source_code": "#include\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=(2-c))\n printf(\"Correct\\n\");\n else\n printf(\"Incorrect\\n\");\n }\n return 0;\n }\n"}, {"source_code": "#include\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=2)\n printf(\"Correct\\n\");\n else\n printf(\"Incorrect\\n\");\n }\n }\n return 0;\n }\n"}, {"source_code": "#include\n#include\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;imax) 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\n#include\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\n#include\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;imax) max=a[i];\n }\n if(min==c||max==b) printf(\"Correct\");\n else\n printf(\"Incorrect\");\n \nreturn 0;\n}"}, {"source_code": "#include\n#include\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#include\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;imax); 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\n#include\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;i0) 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\n#include\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;i0) 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\n#include\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;i0&&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\n#include\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;i0) 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 \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=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(bmax)\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\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\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= 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 \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\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=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\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=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\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=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\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;itemp[i])\n\t\t\tmin_temp=temp[i];\n\t\tif(max_temp1)\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\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;itemp[i])\n\t\t\tmin_temp=temp[i];\n\t\tif(max_temp1)\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\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\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\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 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\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;imax)\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\n#include\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 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\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 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\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 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\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 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\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 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\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;imax&&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\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;iflag)\n printf(\"Correct\");\n else\n printf(\"Incorrect\");\n return 0;\n}"}, {"source_code": "#include\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\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=flag)\n printf(\"Correct\");\n else\n printf(\"Incorrect\");\n return 0;\n}"}, {"source_code": "#include\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;imax&&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\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\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;imax||t[i]2-count)\n printf(\"Correct\");\nelse\n printf(\"Incorrect\");\n}\nreturn 0;\n}\n"}, {"source_code": "#include\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;imax||t[i]2-count)\n printf(\"Correct\");\nelse\n printf(\"Incorrect\");\n}\nreturn 0;\n}\n"}, {"source_code": "#include\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=2-count)\n printf(\"Correct\");\nelse\n printf(\"Incorrect\");\nreturn 0;\n}\n"}, {"source_code": "#include\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\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;imax||t[i]=2-count)\n printf(\"Correct\");\nelse\n printf(\"Incorrect\");\n}\nreturn 0;\n}\n"}, {"source_code": "#include\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 \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 \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \n#include \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;imax1)\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=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 \n#include \n#include \n#include \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;imax1)\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=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 \n#include \n#include \n#include \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=2)\n\t printf(\"Correct\\n\");\n\t else if(x==0)\n\t {\n\t \tfor(i=0;i-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 \n#include \n#include \n#include \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;imax1)\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=2)\n\t printf(\"Correct\\n\");\n\t \n\t else if(x==0)\n\t {\n\t \tfor(i=0;i=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 \n#include \n#include \n#include \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;imax1)\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=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 — 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 ≤ n ≤ 50) — the number of balls Limak has. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 1000) 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\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;ib[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;i0&&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 \n#include \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ón insertar */\n"}, {"source_code": "#include \n#include \n#include \n#include \n#include \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\nvoid swap (int *v, int i, int j);\nvoid quick (int *v, int ini, int fin);\n\nint main (){\n\t//TAMAÑO 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 \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 \n#include \n#include \n#include \n#include \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#include \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 \n#include \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\n#define T 1001\nint main() {\n\t//因为ti的值最大是1000,所以我选择用exist方法\n\tint n;\n\tscanf(\"%d\",&n);\n\tchar exist[T];\n\tint i;\n\tfor(i=0;i=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 \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�os 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�os de las n pelotas\n for(i=0; i\nint main(){\nint n,i,j,k,m=0;\nscanf(\"%d\",&n);\nint a[n];\nfor(i=0;ia[j]){int t=a[i];\n a[i]=a[j];\n a[j]=t; }\n}}\nfor(i=0;i0){printf(\"YES\");}\nelse{printf(\"NO\");}\n\nreturn 0;\n}\n"}, {"source_code": "#include \n#include \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#include\nmain()\n{\n int n,t,i,c,j,a[55];\n scanf(\"%d\",&n);\n for(i=0;i\n#include //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 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\n#include\n#include\n#include\n#include\n#include\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\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 \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\n#include\n#include\n#include\n#include\n#include\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\n#include \n#include \n#include \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 (iflag) && (i=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 \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\n#include\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\nint main() {\n int n;\nscanf(\"%d\",&n);\n\n int a[n];\n int i;\n for(i=0; i 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 int main()\n {\n int n,i,a[55],j,s,check=0,k; //s=sort\n scanf(\"%d\",&n);\n for(i=0;ia[j]){\n s=a[i];\n a[i]=a[j];\n a[j]=s;\n }\n }\n }\n for(i=0;i\n#include \n#include \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\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 \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) 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\n#include \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ón insertar */\n"}, {"source_code": "#include\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;ia[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\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\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\n#include\n#include\n#include\n#include\n\n#define SORT while(t--){for(i=0;iarr[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\n#include\nint main()\n{\n int n,c[100],i,j,t,b[100] ;\n scanf(\"%d\",&n);\n for(j=0; jc[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#include \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\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;ipivote) 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(inii){\n quicksort(A,i,fin);\n }\n}"}, {"source_code": "#include\n#include\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;IV[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; I2)\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 \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#include \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 y)\n return 1;\n\n return 0;\n}\n"}, {"source_code": "#include\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;iar[j])\n {\n temp=ar[i];\n ar[i]=ar[j];\n ar[j]=temp;\n }\n }\n }\n for(i=0;i\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;It[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=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 \n#include \n#include \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 \nmain()\n{\n int n,i,x=0,j,k;\n scanf (\"%d\",&n);\n int A[n];\n for (i=0; i=1)\n printf(\"YES\");\n else printf(\"NO\");\n\n}\n"}, {"source_code": "#include \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�os 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�os de las n pelotas\n for(i=0; i\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;iarr[j])\n {\n temp=arr[i];\n arr[i]=arr[j];\n arr[j]=temp;\n }\n }\n }\n for(i=0;i\n#include \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\n#include \n#include \n\n\t// solución 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\n\nint a[1000],b[1005];\nint main()\n{\n int n,i;\n scanf(\"%d\",&n); //4\n for(i=0;i\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; ia[pivot])\n j--;\n \n if(i\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;i0 && 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 \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#include\n#include\n#include\n#include\n\n#define SORT while(t--){for(i=0;iarr[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\n\n\nint main(){\n\tint arr[10005],x,i,t,o,h[10005]={0};\n\tscanf(\"%d\",&x);\n\tfor(i=0;i\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;ia[j]){\n s=a[i];\n a[i]=a[j];\n a[j]=s;\n }\n }\n }\n for(i=0;i\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 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 \n#include \n#include \n#include \n#include \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\nvoid swap (int *v, int i, int j);\nvoid quick (int *v, int ini, int fin);\n\nint main (){\n\t//TAMAÑO 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 \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; ipivote)\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 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\nint main()\n{\n int n,a[50],b,c[1001]= {0},i,j,k=0;\n scanf(\"%d\",&n);\n for(i=0; ia[j+1])\n n=a[j],a[j]=a[j+1],a[j+1]=n;\n for(i=1; i\n#include \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\n\n\nint main(){\n\tint arr[10005],x,i,t,o,h[10005]={0};\n\tscanf(\"%d\",&x);\n\tfor(i=0;i\nvoid swap (int *v, int i, int j);\nvoid quick (int *v, int ini, int fin);\n\nint main (){\n\t//TAMAÑO 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\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[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\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;iar[j])\n {\n temp=ar[i];\n ar[i]=ar[j];\n ar[j]=temp;\n }\n }\n }\n for(i=0;i\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\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; iv[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=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 \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\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\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 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_izqizq){qs(lista,izq,limite_der);}\n}\n\n\n"}, {"source_code": "#include \n#include \n#include \n#include \n#include \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\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\nint main()\n{\n int j,n,i,d,cnt=0,a[100],b[100],t;\n scanf(\"%d\",&n);\n for(i=0; ia[j])\n {\n d=a[j];\n a[j]=a[i];\n a[i]=d;\n }\n for(i=0; i\n#include \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\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 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_izqizq){qs(lista,izq,limite_der);}\n}\n\n\n"}, {"source_code": "#include\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;ia[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#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 \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\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\n#include\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\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;i0){\n for(j=0;j0) printf(\"YES\");\n else{\n printf(\"NO\");\n \n }\n }\n}"}, {"source_code": "#include \n#include \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\nint main(){\n int n,i,k,j,b=0;\n scanf(\"%d\",&n);\n int v[n];\n for (i=0; i\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]\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 \n#include \n#include \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\nint main() {\n int n;\nscanf(\"%d\",&n);\n\n int a[n];\n int i;\n for(i=0; i 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#include \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 \n#include \n#include \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#include \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\n#include\nmain()\n{\n int n,t,i,c,j,a[55];\n scanf(\"%d\",&n);\n for(i=0;i\n#include\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;IV[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; I2)\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 \n#include \n#include \n#include \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 (iflag) && (i=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 \n\nint main()\n{\n int p;\n scanf(\"%d\", &p);\n int a[100], i,temp,flag=0,j;\n for(i=0; ia[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 \n#include \n#include \n#include \n#include \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\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\n\nint a[1000],b[1005];\nint main()\n{\n int n,i;\n scanf(\"%d\",&n); //4\n for(i=0;i\nint main()\n{\n int n,flag=0;\n scanf(\"%d\",&n);\n int a[n],i,tmp,j;\n for (i=0;ia[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\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]\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#include\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(jnext && 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 \n#include \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\n#include\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#include\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=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#define T 1001\nint main() {\n\t//因为ti的值最大是1000,所以我选择用exist方法\n\tint n;\n\tscanf(\"%d\",&n);\n\tchar exist[T];\n\tint i;\n\tfor(i=0;i\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; ipiv) 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\n\nint main(){\n int n,i,j,x=1;\n int a[50];\n scanf(\"%d\",&n);\n for(i=0;i0) || ((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\nint main()\n{\n int n,i,j,swap,s=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;ia[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;ia[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#include \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;ipivote) 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(inii){\n quicksort(A,i,fin);\n }\n}\n"}, {"source_code": "#include\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;ib[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;i0&&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\n#define T 1001\nint main() {\n\t//因为ti的值最大是1000,所以我选择用count方法\n\tint n;\n\tscanf(\"%d\",&n);\n\tint count[T];\n\tint i;\n\tfor(i=0;i0 && 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\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=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 && ipivote){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\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\nmain()\n{\n int n,a[100],i,j,temp,c=0;\n scanf(\"%d\",&n);\n for(i=0;ia[j])\n {\n temp=a[i];\n a[i]=a[j];\n a[j]=temp;\n }\n }\n }\n for(i=0;i=1) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n\n\nreturn 0;\n}\n"}, {"source_code": "#include \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; ip2)\n {\n menor=p2;\n mayor=p1;\n }\n for(k=i+1; k\n\nint main()\n{\n int balls,i,j,temp,size[1000];\n scanf(\"%d\",&balls);\n for(i=0; isize[j+1])\n {\n size[j]^=size[j+1]^=size[j]^=size[j+1];\n }\n }\n }\n for (j= 0; j\n#include\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;IV[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; I2)\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\nint main() {\n int n;\n scanf(\"%d\",&n);\n int a[n];\n int i;\n for(i=0; i 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#include \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\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\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;i0 && 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\n#include\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#include \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\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 <= n && 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; ib[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\nint main()\n{\n int j,n,i,d,cnt=0,a[100],b[100],t;\n scanf(\"%d\",&n);\n for(i=0;ia[j])\n{ d=a[j];\n a[j]=a[i];\n a[i]=d;\n}\n\n\n for(i=0;i\n#include \n#include \n#include \n#include \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\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\n#include \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\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; ip2)\n {\n menor=p2;\n mayor=p1;\n }\n for(k=i+1; k\n#include\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#include \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; ibolas[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\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\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=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#include \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\n#include \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;ipivote) 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(inii){\n quicksort(A,i,fin);\n }\n}\n"}, {"source_code": "#include\nint main()\n{\n int j,n,i,d,cnt=0,a[100],b[100],t;\n scanf(\"%d\",&n);\n for(i=0;ia[j])\n{ d=a[j];\n a[j]=a[i];\n a[i]=d;\n}\n\n\n for(i=0;i\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; ipivot && 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(limizqizq){\n\t\tqs(lista,izq,limder);\n\t}\n\t\n}\n"}, {"source_code": "#include \n#include \n#include \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#include\n#include\n#include\n#include\n\n#define SORT while(t--){for(i=0;iarr[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\nint main()\n{\n int n,i,j,swap,s=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;ia[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;ia[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#include \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\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\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;ia[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 \n#include \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\n#include \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; ilista[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\n#include\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 \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=0;i--){\n\t\tfor (j=0;jara[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\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;ia[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 \n#include \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\nint main(){\n\n int x,i,j,t,n,a[55];\n\n scanf(\"%d\",&x);\n\n for(i=0;i=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\n#include \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; ibolas[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�\";\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 \n#include \n#include \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\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;ia[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\n#include\nint main()\n{\n int n,c[100],i,j,t,b[100] ;\n scanf(\"%d\",&n);\n for(j=0; jc[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\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;ia[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#include\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=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;iy[k]){\n tmp=y[i];\n y[i]=y[k];\n y[k]=tmp;\n }\n }\n }\n for(j=0;j\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; iv[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=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\n#include\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 \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; ipiv) 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\n#include //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 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 \n#include \n#include \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#include \n#include \n#include \n#include \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\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\n#include \n#include \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= 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 índice 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 \n#include \n#include \n#include \n#include \n#include \n#include \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#include \n#include \n#include \n#include \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\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\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 <= n && 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; ib[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\n#include \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\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;ib[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;i2)\n\t\t{\n\t\t\ttemp=i;\n\t\t\tbreak;\n\t\t}\n\t}\n\tfor (i=1;i2)\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=3||g>=3)\n\t\t\tprintf(\"YES\\n\");\n\t\telse printf(\"NO\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\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;ia[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\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; ip2)\n {\n menor=p2;\n mayor=p1;\n }\n for(k=i+1; k\nint main()\n{\n int n,i,j,swap,s=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;ia[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\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;c2||(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;c0&&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\nint main()\n{\n int n,i,j,swap,s=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;ia[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;ia[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#include \n#include \n#define min(a,b) (a=0;i--)\nlong long\tint i,n,t,arr[1003],a[1040];\nint main() {\n\tscanf(\"%lld\",&n);\n\tfor(i=0;i\nvoid swap (int *v, int i, int j);\nvoid quick (int *v, int ini, int fin);\n\nint main (){\n\t//TAMAÑO 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 \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; ipiv) 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\n#define T 1001\nint main() {\n\t//因为ti的值最大是1000,所以我选择用exist方法\n\tint n;\n\tscanf(\"%d\",&n);\n\tchar exist[T];\n\tint i;\n\tfor(i=0;i=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 \n#include \n#include \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\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 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\n#define T 1001\nint main() {\n\t//因为ti的值最大是1000,所以我选择用exist方法\n\tint n;\n\tscanf(\"%d\",&n);\n\tchar exist[T];\n\tint i;\n\tfor(i=0;i\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\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;c2||(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;c0&&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\ntypedef unsigned u;\nu D[1111];\nint main()\n{\n\tu n,i=-1,j;\n\tfor(scanf(\"%u\",&n);++i\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\nint main()\n{\n int j,n,i,d,cnt=0,a[100],b[100],t;\n scanf(\"%d\",&n);\n for(i=0;ia[j])\n{ d=a[j];\n a[j]=a[i];\n a[i]=d;\n}\n\n\n for(i=0;i\nint main()\n{\n int n,flag=0;\n scanf(\"%d\",&n);\n int a[n],i,tmp,j;\n for (i=0;ia[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#include\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\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) 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\n#include \n#include \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\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;ia[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\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=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#include \n#include \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#include \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\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; isize[j+1])\n {\n size[j]^=size[j+1]^=size[j]^=size[j+1];\n }\n }\n }\n for(i=0; i\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#include \n#include \n#include \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 (iflag) && (i\n#include \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 \n#include \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\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#include \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\n\n\nint main(){\n\tint arr[10005],n,t[1001]={0},i;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i\n#include\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\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 \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 \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\nint main()\n{\n int n;\n while(~scanf(\"%d\",&n))\n {\n int i,j,sum=0,c;\n for(i=1;i=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 \nint main() {\n int n ,i ,j ,k, c;\n while( scanf(\"%d\",&n)!=EOF ){\n c = 0;k=n;\n for( i=1 ; ik)c++;\n printf(\"%d\\n\", c);\n } \n}"}, {"source_code": "#include \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 \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\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\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 \n\nint main()\n{\nint n,count=0;\nscanf(\"%d\",&n);\nint a[n][n],b[n];\nfor(int i=0;i=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 \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 \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 \n#include \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\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 \n#define _MEASURE_ 0\n\n#if _MEASURE_\n#include \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\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= 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\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 \n#include \n#include \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\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 \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\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\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\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(tempn)\n\t\t\t\tcontinue;\n\t\t\tc++;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",c);\n}"}, {"source_code": "#include \n#include \n#include \n#include \n#include \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\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\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\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))\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\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 \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 \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\n#include\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 \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\n#include\n#include\n#include\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/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/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*(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\n#include\n#include\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 \n#include \n#include \n#include \n#include \n#include \n#include \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 \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\n#include\n\nvoid main(){\nlong long n,i,j,count=0,k;\nscanf(\"%lld\",&n);\n\nfor(i=1;i=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\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\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\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\nint main (){\n int n,a,b,c,all=0;\n scanf(\"%d\",&n);\n for(a=1;ac&&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\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;kn)\n break;\n {if(!(i^j^k))\n a++;}\n }\n }\n }\n printf(\"%d\",a);\n return 0;\n}\n"}, {"source_code": "#include \n#include \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 \n#include \n#include \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\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 \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 ; in)\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\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\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\n#include \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\n#include\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\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 \n#include \n#include \n#include \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;jj && 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\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 \n#include \n#include \nint tricheck(int a,int b,int c){\n if((abs(a-b)= 1 ;x--){\n for(y = x ; y > x/2 ; y--){\n if((x^y)\n#include \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\n#include\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<\n#include \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 \n//#include \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\nint n;\nint main()\n{\n\tint ans=0;\n\tscanf(\"%d\",&n);\n\tfor(int i=1;i=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\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 \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\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 \n#include \n#include \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 \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\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 \n#include \n#include \n#include \n#include \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 \n#include \n#include \n#include \n#include \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 \n#include \n#include \n#include \n#include \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\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\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\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\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\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 \n#include \n#include \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 \n#include \n#include \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\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\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 \n#include \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\n#include \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\n#include\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\n#include\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\n#include\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\n#include\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\n#include \n#include \n#include \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 \n#include \n#include \n#include \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\n#include\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<\n#include\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\n#include\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 \n#include \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 \n#include \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\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)\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 ≤ n ≤ 10) 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 ≤ i ≤ n, 0 ≤ bi, ci, bi + ci ≤ 4). 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 \n#include \n#include \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\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 \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#include \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 \n#include \n#include \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\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": "n hobbits are planning to spend the night at Frodo's house. Frodo has n beds standing in a row and m pillows (n ≤ m). 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 ≤ n ≤ m ≤ 109, 1 ≤ k ≤ n) — the number of hobbits, the number of pillows and the number of Frodo's bed.", "output_spec": "Print single integer — 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\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\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 \n#include \n#include \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\n#include\n#include\n#include \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 \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 \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\n\nint mini(int a, int b)\n{\n if(a0)\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\n\nint mini(int a, int b)\n{\n if(a0)\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\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 \n#include \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 \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\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\n#include\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 \n#include \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(r0)\n \tans+=(m/n);\n printf(\"%d\\n\",ans);\n\treturn 0;\n}"}, {"source_code": "#include \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\n#include\nlong long m,n,k;\nint judge(long long x)\n{\n long long ans;\n long long l,r;\n if (kbot)\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 \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\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\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 \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 (sumans-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 \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||bm)\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张床 n个人 自然金字塔形最优\n#include\n#include\nlong long n, m, k; //不开long long见祖宗\n\nint check( long long mid )\n{\n\tlong long l, r, cnt=0; //该方案需要的枕头数\n\tif( k-mid+1 >= 1 ) l = k-mid+1; //金字塔左边底的位置\n\telse l = 1; //如果到了左边界还没到底 左边界取1\n\tif( k+mid-1 <= n ) r = k+mid-1; //金字塔右边底的位置\n\telse r = n; //如果到了右边界还没到底 右边界取n\n\tcnt += ( k-l+1 ) * ( mid-k+l+mid ) / 2 + ( l-1 ); //左半部分等差求和加上平地部分\n\tcnt += ( r-k+1 ) * ( mid-r+k+mid ) / 2 + ( n-r ); //右半部分等差求和加上平地部分\n\tcnt -= mid; //上式加了两次mid 要减掉一次\n\tif( cnt<=m ) return 1;\n\telse return 0;\n}\n\nint main()\n{\n\tlong long left, right, mid; //二分法\n\tscanf(\"%lld %lld %lld\", &n, &m, &k);\n\tleft = 1; right = m-n+1; //初始范围\n\twhile( left <= right ){\n\t\tmid = (left + right) / 2;\n\t\tif( check( mid ) ) left = mid+1; //还能得寸进尺\n\t\telse right = mid-1; //人家生气了\n\t}\n\tprintf(\"%lld\\n\", right);\n\t//system(\"pause\");\n\treturn 0;\n}"}, {"source_code": "#include\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 \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\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 \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 \n\ninline int min(int a,int b)\n {\n \treturn ab?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\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\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\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\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\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\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的左右几个数 \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\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\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\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=2)\n\t {\n\t \tm=m-p-2;\n\t }\n\t 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 \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 \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 \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 \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 \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 \n#include \n#include \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\n\nlong long scount(long long x,long long y)\n{\n long long i,sum=0;\n for(i=0;idesno)\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\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 \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 \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 \n#include \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(r0)\n \tans+=(m/n);\n printf(\"%d\\n\",ans);\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n#include \n#include \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\n#include\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 (ansbot)\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\n#include\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 (ansbot)\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\n#include\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 (ansbot)\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\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 \n#include \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]\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 \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 \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\nint n,m,k;\nint f(int a)\n{\n int s=-a;\n if(a=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\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\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\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\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\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 \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||bm)\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 \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 \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 \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 \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 \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\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#include \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 \n#include \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 \n#include \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\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\n#include\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\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\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\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 \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\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\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\n#include\n#include\n#include\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/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/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*(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 \n#include \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\n#include \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\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\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\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\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 \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\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\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\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\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 \n#include \n#include \n#include \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\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 \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\n#include \n#include \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 \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 \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 \n#include \n#include\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\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 \n#include \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\n#include\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\n#include\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\n#include\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\n#include\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\n#include\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\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\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\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 \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\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\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\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\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\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 \n#include \n#include\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\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 \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 \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 \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 \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\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&&disti)\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 \n#include \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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;ij+2?1:0)])%1000000007;\n\t\t}else{\n\t\t\tfor(j=1;j\n#include \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 \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 \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 \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 \n#include \n#include \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 \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 \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 \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 \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 \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\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&&disti)\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\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&&disti)\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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \n#include \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\n#include \n#include \n#include \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\n#include \n#include \n#include \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\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 \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 ≤ n ≤ 100, 1 ≤ k ≤ 10000). The second line contains n integers a1, a2, a3, ..., an (1 ≤ ai ≤ 100).", "output_spec": "If it is impossible for Arya to give Bran k candies within n days, print -1. Otherwise print a single integer — 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 \n\nint main() {\n int n,x[100],k;\n scanf(\"%d %d\",&n,&k);\n int i;\n for(i=0;i=k) {\n printf(\"%d\",count);\n return 0;\n }\n count++;\n }\n printf(\"-1\");\n\treturn 0;\n}"}, {"source_code": "#include \n#include \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\n#include\nint main()\n{\n int n,k,i,s=0;\n scanf(\"%d%d\",&n,&k);\n int x[n];\n for(i=0;i8)\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 \n#include \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 \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\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=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 \n#include \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=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\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=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\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;i8){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\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= 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\n#include\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 \n#include \n#include \n#include \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=8) g+=8, s-=8;\n\t\t\telse g+=s, s=0;\n\t\t}\n\t\tif (g\n\nint main()\n{\n\tint n,k,s,g=0,t=0;\n\tscanf(\"%d %d\",&n,&k);\n\tfor(int i=0;i0) 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\n#include\n#include\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=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;iptr[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;iptr[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 \n#include \n#include \n#include \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=8) g+=8, s-=8;\n\t\t\telse g+=s, s=0;\n\t\t}\n\t\tif (g\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\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\n#include\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;i0)&&(i\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 \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\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;i8){\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 \n#include \n#include \n#include \n#include \n#include \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;in*8){\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\tint count=0;\n\tfor(int i=0;i0){\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 \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=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 \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;i8)\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\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=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\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=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\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;Count8)\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 \nint main()\n{\n\tint n,k,i,a[1000];\n\tscanf(\"%d%d\",&n,&k);\n\tfor(i=0;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 \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\n#include\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=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 \nint main(){\n int n,k,i,s=0,ans=-1;\n scanf(\"%i%i\",&n,&k);\n for(i=0;i=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 \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 \n#include \nint main(){\n\tint n,k,num=0,t,tmp=0,f=0;\n\tscanf(\"%d%d\",&n,&k);\n\tfor(int i=0;i8){\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\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=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\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=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\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=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 \n\nint main() {\n int n,x[100],k;\n scanf(\"%d %d\",&n,&k);\n int i;\n for(i=0;i=k) {\n printf(\"%d\",count);\n return 0;\n }\n count++;\n }\n printf(\"-1\");\n\treturn 0;\n}"}, {"source_code": "#include \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 \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;i8)\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\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 \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\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;Count8)\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\n#include\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=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\n#include \n#include \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=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\n#include\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;i8)\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\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 ;imul)\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 \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 \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;i8)\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\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;i8)\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\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=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\n#include \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 \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;i8)\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\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\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 \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 \n#include \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=k){\n sum=0; int sum2=0,flag=0;\n for(i=0;i=8){\n p[i+1]+=p[i]-8;\n p[i]=8;\n }\n }\n for(i=0;i=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 \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=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 \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\n#include\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;i8)\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 \n#include \n#include \n#include \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=8) g+=8, s-=8;\n\t\t\telse g+=s, s=0;\n\t\t}\n\t\tif (g\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; i8){\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\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= 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\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;itotal)\n printf(\"-1\");\n else if(k>(n*8))\n printf(\"-1\\n\");\n else\n {\n for(i=0;i=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\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=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\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 \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\n#include\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\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= 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\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=8){\n sum=sum+8;\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 && 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\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\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;i8){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\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;i8){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\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=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 \n#include \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=k){\n sum=0; int sum2=0,flag=0;\n for(i=0;i=8){\n p[i+1]+=p[i]-8;\n p[i]=8;\n }\n }\n for(i=0;i=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\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\n#include\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=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\n#include \n#include \n#include \n#include \n#include \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;i0){\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\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\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#include\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;i8)\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 \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\n#include\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 \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;i8){\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 \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 \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\n#include\n#include\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=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 \n#include \nint main(){\n\tint n,k,num=0,t,tmp=0,f=0;\n\tscanf(\"%d%d\",&n,&k);\n\tfor(int i=0;i8){\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\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\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= 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 \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\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 \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;i8)\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\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\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;i8)\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\n#include\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= 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\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=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\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= 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\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; i8){\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\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=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\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\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;is)\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 \n#include \n#include \n#include \n#include \n#include \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;i0){\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 \n#include \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;i8)\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\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;i8){\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 \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\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; i8 )\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 \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;i8)\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\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\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; is)\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\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 \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 \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\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\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;i0 && (j8){\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\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;ir)\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\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=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\n#include\n#include\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 \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 \n#include \n#include \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\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;i8) 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\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;ir)\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\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\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;Count8)\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\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 (i8? (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\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*88)\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\n#include\n#include\nint main()\n{\n\tint n,k,t;\n\tscanf(\"%d %d\",&n,&k);\n\tint a[n];\n\tfor(int i=0;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\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=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\n\nint main()\n{\n int n,k,a[107],i,sum=0;\n scanf(\"%d %d\",&n,&k);\n for(i=0;i8)\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\n#include \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=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 \n#include \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 \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\n#include\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; i8)\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 \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 \n#include \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; i8) {\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\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=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 \n#include \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 \n#include \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=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 \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 \n#include \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;i8) 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 \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;i8)\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\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=k)\n printf(\"%d\\n\",count);\n else\n printf(\"-1\");\n\n return 0;\n}\n"}, {"source_code": "#include\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 \n#include \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=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 \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;i8)\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\nint main()\n{\nint n,k,r=0;\nscanf(\"%d %d\",&n,&k);\nint a[n];\nfor(int i=0;i=k)\n{\nint rem=r-k;\nif(rem!=0)\n{\nfor(int j=0;j\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;ir)\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\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 (i8? (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\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;i8){\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\nint main()\n{\n int n,k,i,j,m,ar[10000];\n scanf(\"%d %d\",&n,&k);\n for(i=0;i\n#include \n\nint main()\n{\n int n,k,a[100],i;\n scanf(\"%d %d\",&n,&k);\n for (i=0;i8)\n {\n printf(\"-1\");\n exit(0);\n }\n for(i=0;i8)\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 \n#include \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=k){\n int l=0,c=0;\n while(c=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\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 ;i8 && 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\nint main(n,k)\n{scanf(\"%d%d\",&n,&k);\nint i,a,t=0,c=0;\nfor(i=0;i8)\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=k && i==n)\nprintf(\"%d\",i);\nelse \nprintf(\"-1\");\n}"}, {"source_code": "#include \n#include \n#include \n#include \n#include \n#include \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;i8){\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;i0){\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\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=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 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 && k0)\n {\n printf(\"-1\");\n }\n return 0;\n}"}, {"source_code": "#include \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=k){\n day=i+1;\n sum=-100000000;\n }\n }\n if(day==0&&k<8&&k\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\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\n#include\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;i0)&&(i\n#include \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=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\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=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\nmain()\n{\n int n,k,a[10000],i,j,sum=0,flag=0;\n scanf(\"%d%d\",&n,&k);\n for(i=0;i8)a[i]=8;\n }\n for(i=0;i=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 \n#include \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=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\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; i8 )\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 \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 \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=k)\n printf(\"%d\\n\",count);\n else\n printf(\"-1\");\n\n return 0;\n}\n"}, {"source_code": "#include\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; is)\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\nint main()\n{\nint n,k,a[100],i=0,sum=0;\nscanf(\"%d %d\",&n,&k);\nfor(i=0;i=k)\n {\n printf(\"%d\",i);\n break;\n }n--;\n}\nif(sum\n#include\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=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\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=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 \n#include \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;i8)\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\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\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]=k)\n break;\n\n}\nif(i<=n)\nprintf(\"%d\",i);\nelse\n printf(\"-1\");\nreturn 0;\n}\n"}, {"source_code": "#include \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\nint main()\n{\n int n,k,a[100],s=0,i;\n scanf(\"%d%d\",&n,&k);\n for(i=0; i=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 \n#include \n#include \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=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 \n#include \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; i8) {\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 \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\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\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;is)\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 \n#include \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 \n#include \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=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\n#include\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 \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 \n#include \n\nint main()\n{\n int n,k,a[100],i;\n scanf(\"%d %d\",&n,&k);\n for (i=0;i8)\n {\n printf(\"-1\");\n exit(0);\n }\n for(i=0;i8)\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 \nint main()\n{\n int i, j, n, k;\n scanf(\"%d %d\", &n, &k);\n int a[n];\n for(i=0; i= 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\n#include \n#include \n#include \n#include \n#define forn(i,n) for (i = 0; i 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 \n#include \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=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 \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;i8)\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\nint min(int a,int b){return (a0) printf(\"-1\\n\");\n else printf(\"%d\\n\",i+1);\n return 0;\n}"}, {"source_code": "#include \nint main()\n{\n\tint n,k,i,a[1000];\n\tscanf(\"%d%d\",&n,&k);\n\tfor(i=0;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 \n\nint main()\n{\n\tint n,k,s,g=0,t=0;\n\tscanf(\"%d %d\",&n,&k);\n\tfor(int i=0;i0) printf(\"%d\\n\", -1);\n\telse printf(\"%d\\n\", g);\n\treturn 0;\n}"}, {"source_code": "#include\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\n#include\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;i8)\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 \n#include \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=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\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=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\n#include\n#include\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=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\n#include\n#include\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 + m 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 — to minimize the number of the opponent's points.", "input_spec": "The only line contains two space-separated integers n and m (1 ≤ n, m ≤ 105) — the number of red and blue cubes, correspondingly.", "output_spec": "On a single line print two space-separated integers — 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 \n#include \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;ix1)\n printf(\"%d %d\",x,y);\n else\n printf(\"%d %d\",x1,y1);\n return 0;\n}\n"}, {"source_code": "#include \n#include \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 \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 \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\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\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 \n#include \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 \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]\n#include\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;icount2)\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 \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\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;i0){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\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 \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\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 \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 \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 \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\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\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\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 \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\n#include\nint main()\n{\n\tint n,m;\n\tscanf(\"%d%d\",&n,&m);\n\tint out,diff;\n\tif(m\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\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\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\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(n0&&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\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\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\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 \n#include \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\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\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\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\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\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\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\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\n#define min(a,b) ((a\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\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(n0&&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\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\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\nint main()\n{\n int m,n,t;\n scanf(\"%d %d\",&m,&n);\n if(m\n#include \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 \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\n#include\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;icount2)\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 \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\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;i0)\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\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;i0)\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\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;i0)\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\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;i0)\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\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\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\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(n0&&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\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 \n#include \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 \n#include \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\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\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\n#include\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 \n#include \n#include \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\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\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\n#include\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\n#include \n#include \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\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\n#include\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\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\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 \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\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)\n#include\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\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\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 \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\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 \n#include \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\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 \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\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\n#include\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\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\n#include\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\n#include\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 \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\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\n#include\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\n#include\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 \n#include \n#include\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\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\n#include\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\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\n#include\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 \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 if (c==sum)\n {\n printf(\"Yes\");\n return 0;\n }\n if (sum\n#include \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 \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\n#include\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\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\n#include\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\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\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 \n#include \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 \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\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 \n#include \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 \n#include \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\n#include\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\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\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 \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\n#include\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\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\n#include\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\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\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\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\n#include\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\n#include\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\n#include\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\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 \n#include \n#include \n#include \n#include \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\n#include\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 \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\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 \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 \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\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 \n#include \n#include \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\n#include\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 \n#include \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\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\n#include\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\n#include\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\n#include\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\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\n#include\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#include\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\n#include\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\n#include\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\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\n#include\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#include\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\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\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\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\n#include\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 \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 \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\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\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\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 \n#include \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 \n#include \n#include\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\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\n#include\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 \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\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 \n#include \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\n#include\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 \n#include \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\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\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\n#include\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\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 \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 \n#include \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\n#include \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 \n#include \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 \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\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\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\n#include\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\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\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\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\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\n#include\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\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\n#include\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\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\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 \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 \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\n#include\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 \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\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 \n#include \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\n#include\n\tint main (){\n\t\tlong long x ,a , b , s;\n\t\tscanf(\"%lld%lld%lld\", &a , &b , &s);\n\t\tif( s\n#include \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\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\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\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\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\n#include\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 \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\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\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 \n#include \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\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\n\nint main()\n{\n int a,b,s,x,y,z;\n\n scanf(\"%d %d %d\",&a,&b,&s);\n if(s\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 \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\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\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\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\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(sa+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\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\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\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\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\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\n#include\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\n#include\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\n#include\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\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 \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 \n#include \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\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 \n#include \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\n#include\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\n#include\n#include\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 \n#include \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 \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\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\n#include\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\n#include\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 \n#include \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 \n#include \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 \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 \n#include \n#include \n#include \n#include \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\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 \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 \n#include \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\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\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

\n#include\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 \n#include \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\n#include\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\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\n#include\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\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\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\n#include\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\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\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\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\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\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

\n#include \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\n#include\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 \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 \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 \n#include \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\n#include\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\n#include\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 \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 = 01123 tor 12123 = 10213 = 3410.Petya wrote numbers a and c on a piece of paper. Help him find such number b, that a tor b = c. If there are several such numbers, print the smallest one.", "input_spec": "The first line contains two integers a and c (0 ≤ a, c ≤ 109). Both numbers are written in decimal notation.", "output_spec": "Print the single integer b, such that a tor b = c. 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 \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\n#include\n#include\n#include\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\n#include\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 \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 \n#include \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 \n#include \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 \n#include \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\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\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 \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 \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 \n#include \n#include \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\n#include\n#include\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\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\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 \n#include \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\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\n#include\n#include\n#include\n#include\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\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 \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 \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\n#include\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\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\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;ie)\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;i0)\n{\nn[x++]=m%3;\nm=(m-(m%3))/3;\n}\nreturn(x);\n}\n\n"}, {"source_code": "#include \n#include \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=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\n#include\n#include\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]\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 \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 \n#include \n#include \n#define MAX_LEN 30\nvoid encode(int* cs3,unsigned int a){\n int n=0;\n int i;\n for(i=0;i0){\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;ib||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\n#include \n#include \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 \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\n#include \n#include \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\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;ki)\n {\n for(k=i;k0)\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 \n#include \n#include \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\n#include\n#include\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=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\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 \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\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;xj)\n j=add(e,j,i);\n else if(j>i)\n i=add(d,i,j);\n for(x=0;x\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\n#include\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\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\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 \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\n#include\n#include\n#include\n#define REP(i,a,b) for(i=a;i\n#include \n#include \n#include \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\n#include\n#include\n#include\n\n#define fp(i,a,b,c) for(i=a;ib;i-=c)\n#define fs(i,a) for(i=0;il2)\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\n#include\n#include\n#include\n\n#define fp(i,a,b,c) for(i=a;ib;i-=c)\n#define fs(i,a) for(i=0;il2)\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\n#include\n#include\n#include\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\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=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 \n#include \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 \n#include \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\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 \n#include \n#include\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]=0;x--)\n {\n z=z*3+b[x];\n }\n printf(\"%ld\",z);\n return 0;\n}\n"}, {"source_code": "#include \n#include \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 \n#include \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\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 \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\n#include \n#include \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 \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\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\n#include \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=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\n#include\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\n#include\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\n#include \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\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 \n#include \n#include \n#include \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;iy[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 \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\n#include \n#include \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\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;ie)\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;i0)\n{\nn[x++]=m%3;\nm=(m-(m%3))/3;\n}\nreturn(x);\n}"}, {"source_code": "#include\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;ie)\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;i0)\n{\nn[x++]=m%3;\nm=(m-(m%3))/3;\n}\nreturn(x);\n}"}, {"source_code": "#include \n#include \n#include \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 \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 \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 \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 \n#include \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\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\n#include\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\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 \n#include \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 \n#include \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\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=0){\n as=as*3+ans[i--];\n }\n printf(\"%lld\",as);\n return 0;\n}\n"}, {"source_code": "#include \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 \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \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 \n#include \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 \n#include \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\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\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;ie)\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;i0)\n{\nn[x++]=m%3;\nm=(m-(m%3))/30;\n}\nreturn(x);\n}"}, {"source_code": "#include\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\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 + k 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 ≤ n, a, b, c ≤ 109).", "output_spec": "Print the minimum amount of rubles she should pay to buy such number of copybooks k that n + k 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 = 3 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 = 1 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\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 \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 \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\n#include\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 \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 \n#include \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\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\n#include\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*aa+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\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]\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\n#include\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\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\n#define min(a,b) a\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\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\nlong long min(long long a,long long b,long long c)\n{\n return ((a\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\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\nlong long int min(long long int a, long long int b){\n\treturn a\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 \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\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 \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\n#include\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\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\n#define MIN(a,b) a\n#include\n\n#define MIN(a,b) (a=0 && t1)\n\t\t{\n\t\t\tif(ans[i-2]+a[1]2)\n\t\t{\n\t\t\tif(ans[i-3]+a[2]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 \n#include \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 \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 \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\n#include\nlong long min(long long a,long long b,long long c)\n{\nif(a3*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\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]\nlong long MIN(long long a,long long b){return a\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 \n#include \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=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\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\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\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\n#include\n#include\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\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//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(jka[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\n#define min(a,b) a\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\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\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 \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\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 \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\ntypedef unsigned int ui;\nui min3(ui a, ui b, ui c)\n{\n return a>b?(b\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\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\n#define min(a,b) a\nlong long MIN(long long a,long long b){return a\n#include \n#include \n#include \n#include \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\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\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\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 \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\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\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//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(jka[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\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\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\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 \n\nlong long int min ( long long int a, long long int b)\n{\n\treturn (a\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\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\n#include \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=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\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 \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\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\nlong long MIN(long long a,long long b){return a\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\n#include\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\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]\nlong long int min(long long int a, long long int b){\n\treturn a\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 \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\nlong long int min(long long int a,long long int b)\n{\n\tlong long int mini;\n\tif(a\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 \n#include \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\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\nlong long int min(long long int a, long long int b){\n\treturn a\n#include\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\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\ntypedef unsigned int ui;\nui min3(ui a, ui b, ui c)\n{\n return a>b?(b\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\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//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(jka[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\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//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(jka[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\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\nlong long int min(long long int a,long long int b)\n{\n if(a\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\n#include\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\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]\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 \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\n#include\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 \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\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\n#include\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\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\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 \n#include \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\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\n#include\n#include\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\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\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)\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 \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 \n#include \n#include \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\n#include\n#include\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\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\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\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\n#include\n#include\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 \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 \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\n#define min(a,b) a\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 \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\nint min(int a,int b,int c)\n{\n return ((a\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)\n#include \n#include \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\nlong long int min(long long int a,long long int b)\n{\n\tif(a\n#include \n#include \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\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\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\n#include\n#include\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 \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\n#include\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\nint n, a, b, c;\nlong long aa, bb, cc;\nint min(long long a, long long b)\n{\n if(a\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*3b+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*2c*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\nint min(int a,int b)\n{\n if(a\n#include \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(s1s1 && s2\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\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 \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\n#define MIN(a,b) a\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\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\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 \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\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)\n#include \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\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)\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 \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\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\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\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(a3*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\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\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.这个程序做到的事情\n * ruble是俄国的货币\n * 四门课\n * 2.这个程序遇到的困难\n * 3.接下来要做的事情\n */\n#include\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){\n printf(\"不够\\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 \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\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\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\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)\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\n\nlong long int min(long long int a,long long int b)\n{\n\tlong long int y=((a\n#include \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(s1s2 && s2\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 \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\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\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(a3*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\n#include\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 \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\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\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 \n\nlong long int min(long long int x, long long int y, long long int z)\n{\n\tif(x\n\nint main() {\nint n,a[5]={0};\nscanf(\"%d %d %d\",&n,&a[1],&a[2],&a[3]);\nif (a[1]+a[1]\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\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 \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 \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\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\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 \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*3b+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\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\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\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\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\n#include\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 \nlong long int min(long long int x,long long int y, long long int z)\n{\n if(x\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\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\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\n\nlong long int min(long long int a,long long int b)\n{\n\tlong long int y=((a\n#include \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 \n#include \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\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)\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 \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\nlong long int min(long long int a,long long int b)\n{\n\tif(a\n#include \n#include \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\nint min(int a,int b)\n{\n if(a\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 \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\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=b )\n min=(b*k)/2;\n else if((c*3)%k==0 && (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 — $$$(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 — $$$(x_4, y_4)$$$. Coordinates of the bottom left corner of the second black sheet are $$$(x_5, y_5)$$$, and the top right — $$$(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})$$$ — 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})$$$ — 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})$$$ — 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\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&&x5=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=y2&&y3<=y1)flag=1;\n\t\t}\n\t\telse if(x6>=i&&x5=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\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 \n#include \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\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(y20) printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\treturn 0;\n}"}, {"source_code": "#include \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 \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 && y3y1) y1=y4;\n }\n if (x5<=x1 && x6>=x2)\n {\n if(y6>=y2 && y5y1) y1=y6;\n }\n if (y3<=y1 && y4>=y2)\n {\n if(x4>=x2 && x3x1) x1=x4;\n }\n if (y5<=y1 && y6>=y2)\n {\n if(x6>=x2 && x5x1) x1=x6;\n }\n if (x1>=x2 || y1>=y2) printf(\"NO\");\n else printf(\"YES\");\n \n}\n"}, {"source_code": "#include\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全覆盖a \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全覆盖a \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左右覆盖 \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左右覆盖 \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上下覆盖 \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上下覆盖 \n\telse printf(\"YES\"); //还有白色部分露出 \n\treturn 0;\n}\n\n\n"}, {"source_code": "#include\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 \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全覆盖a\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全覆盖a\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左右覆盖\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左右覆盖\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\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\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\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 \n#include \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=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 \n#include \n#include \n#include \n#include \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\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(x2x5)\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(x2x7&&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(x8x11&&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\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&&x5=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=y2&&y3<=y1)flag=1;\n\t\t}\n\t\telse if(x6>=i&&x5=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 \n#include \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 \n#include \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 \n#include \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\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(y20) printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\treturn 0;\n}"}, {"source_code": "#include \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 \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 \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 \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=x2)\n {\n if(y6>=y2 && y5=y2)\n {\n if(x4>=x2 && x3=y2)\n {\n if(x6>=x2 && x5=x2 && y1>=y2) printf(\"NO\");\n else printf(\"YES\");\n \n}\n"}, {"source_code": "#include \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 \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=x2)\n {\n if(y6>=y2 && y5=y2)\n {\n if(x4>=x2 && x3=y2)\n {\n if(x6>=x2 && x5=x2 || y1>=y2) printf(\"NO\");\n else printf(\"YES\");\n \n}\n"}, {"source_code": "#include\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全覆盖a \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全覆盖a \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左右覆盖 \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左右覆盖 \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上下覆盖 \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上下覆盖 \n\telse printf(\"YES\"); //还有白色部分露出 \n\treturn 0;\n}\n\n\n"}, {"source_code": "#include \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全覆盖a\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全覆盖a\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左右覆盖\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左右覆盖\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 \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全覆盖a\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全覆盖a\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左右覆盖\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左右覆盖\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\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\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\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 \n#include \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=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 \n#include \n#include \n#include \n#include \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 \n#include \n#include \n#include \n#include \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 \n#include \n#include \n#include \n#include \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 — n, a, b, c (1 ≤ n ≤ 10000, 0 ≤ a, b, c ≤ 5000).", "output_spec": "Print the unique number — 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 \n#include \n#include \n#include \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 \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 \n#include \n#include \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 \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 \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 \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 \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 \n#include \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 \n#include \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 \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 \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 \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\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\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 \n#include \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 \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\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 \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\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\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\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\n#include \n#include \n#include \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\n#include\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(nq){\n printf(\"%I64d\",q);\n }\n else\n printf(\"%I64d\",p);\n }\n \n}\n"}, {"source_code": "#include\nlong long int min (long long int a, long long int b)\n{\n if(a\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\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\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\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\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=n*b){\n r=n*b;\n printf(\"%lld\",r);\n }\n else if((m-n)*a\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\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\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\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\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\n#define ll long long\n#include\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(c1n)\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\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=cost2?cost2:cost1) ;\n\treturn 0 ;\n}"}, {"source_code": "#include \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\n#include \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 \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\n#include\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\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\n#include\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\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 \nlong long min(long long a,long long b) {return (a\n#include \n#include \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\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=n*b){\n r=n*b;\n printf(\"%lld\",r);\n }\n else if((m-n)*a\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(nm)\n {\n i=(n%m)*b;\n j=(m-(n%m))*a;\n if(i\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\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 \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\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;//拆除\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//md)\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\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\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\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\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 cost10)&&(m>n))\n {\n cost1=n*b;\n cost2=(m-n)*a;\n cost1\n#include \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 \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\n#include\n#include\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\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 \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\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 \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\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\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 \n#include \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\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\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\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\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\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\n#include\n#define min(x,y) xm)\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\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\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\n#include\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(nq){\n printf(\"%I64d\",q);\n }\n else\n printf(\"%I64d\",p);\n }\n \n}\n"}, {"source_code": "#include\n#define ll long long\n#include\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(c1n)\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\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\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\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\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=cost2?cost2:cost1) ;\n\treturn 0 ;\n}"}, {"source_code": "#include\n#include\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(nq){\n printf(\"%I64d\",q);\n }\n else\n printf(\"%I64d\",p);\n }\n \n}\n"}, {"source_code": "#include\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 \n#include \n#include \n#include \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\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(nm)\n {\n i=(n%m)*b;\n j=(m-(n%m))*a;\n if(i\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\n#include\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\n#include\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�ltiplo m�s 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�ltiplos 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\n#include\n#include\n#include\n#include\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\n#include\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�ltiplo m�s 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�ltiplos 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\n#include\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\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\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\n#define min(x,y) x\nlong long int min (long long int a, long long int b)\n{\n if(a\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\n#include\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 \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\n#define min(a,b) a\n#include \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 \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\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\n#include\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\n#include\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\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\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\n#include\n#define Min(a,b) a\n#define min(x,y) x\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\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\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\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 \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\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 \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\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\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\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\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\n#include\n#define Min(a,b) a\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\n#include\n#define min(x,y) xm)\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\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\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\n#include\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\n#include\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�ltiplo m�s 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�ltiplos 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\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\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(nm)\n {\n i=(n%m)*b;\n j=(m-(n%m))*a;\n if(i\n#include\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\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\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\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\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\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(nm){\n c=(m*2)-n;\n printf(\"%d\\n\",c*a);\n }\n }\n \n}"}, {"source_code": "#include\n#include\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�ltiplo m�s 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�ltiplos 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\n#include\n#include\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\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\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\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\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(ny)\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\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 \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\n#include\n#include\n#include\n#include\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\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\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(ny)\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\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\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\n#include\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\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\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(sum1sum2)\n\t\t\t{\n\t\t\t\tprintf(\"%d\\n\",sum2);\n\t\t\t}\n\t\t}\n\t\tif(nsum2)\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 \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\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\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(nm){\n c=(m*2)-n;\n printf(\"%d\\n\",c*a);\n }\n }\n \n}"}, {"source_code": "#include\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(nq){\n printf(\"%I64d\",q);\n }\n else\n printf(\"%I64d\",p);\n }\n\n}"}, {"source_code": "#include \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\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 \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 \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 \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 \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\n#include\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(nq){\n printf(\"%I64d\",q);\n }\n else\n printf(\"%I64d\",p);\n }\n\n}\n"}, {"source_code": "#include\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\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\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\n#include\n#define min(x,y) xm)\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\n#include\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(nq){\n printf(\"%I64d\",q);\n }\n else\n printf(\"%I64d\",p);\n }\n\n}\n"}, {"source_code": "#include \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 \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\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\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\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\n#include\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(nq){\n printf(\"%I64d\",q);\n }\n else\n printf(\"%I64d\",p);\n }\n\n}\n"}, {"source_code": "#include \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\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\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\n#include\n#include\n#include\n#include\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\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\n#include\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\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(nm)\n {\n i=(n%m)*b;\n j=(m-(n%m))*a;\n if(i\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\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\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\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(ny)\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\n#define min(x,y) x\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(nd)\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\n#include\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\n#include\n#define min(x,y) xm)\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\n#include\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\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\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\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(ny)\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\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\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\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(nm){\n c=(m*2)-n;\n printf(\"%lld\\n\",c*a);\n }\n }\n \n}"}, {"source_code": "#include\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\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\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\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\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\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(ny)\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\n#include\n#include\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 \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\n#include\n#include\n\nint min(int a, int b){\n return a\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=n*b){\n r=n*b;\n printf(\"%d\",r);\n }\n else if((m-n)*a\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\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(ny)\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\n#define min(x,y) x\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\n#include\n#include\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\n#include\n#define Min(a,b) a\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\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\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(nd)\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\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\n#include\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\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\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 ≤ n, k ≤ 109) — 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 ≤ i ≤ n). Permutation a is lexicographically smaller that permutation b if there is such a i (1 ≤ i ≤ n), that ai < bi, and for any j (1 ≤ j < i) aj = bj. 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 \n#include \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 \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 \n#include \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 \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 \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 \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 \n#include \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 — 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$$$ — 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$$$ — 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$$$) — 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$$$) — 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\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\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; iElo)\n {\n printf(\"%d\\n\",l);\n break;\n }\n l++;\n }\n return 0;\n}\n"}, {"source_code": "#include\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#include \n#include \n\nint main(){\n int n,mx=0,i,tmp,sum=0,k;\n scanf(\"%d\",&n);\n for(i=0;imx)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\n#include \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 \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\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(maxsum)\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\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; isum)\n {\n printf(\"%d\",k+j);\n break;\n }\n }\n\n return 0;\n\n}\n"}, {"source_code": "#include\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(maxsum)\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\n#include\nint main()\n{\n int i, n, k=0, score=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;ik)\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\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;imax)\n {\n max=a[i];\n }\n }\n for(i=0;isum)\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 \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 \n#include \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\nint n,a,k=0,s=0,max=0;\nint main()\n{\n\tscanf(\"%d\",&n);\nfor (int i=0;i\n#include\nint main()\n{\n int n,s,max;\n scanf(\"%d\",&n);\n int array[n];\n for(int i=0;i\n\nint main()\n{\n int n,i,a[100],sum=0,t,max=0;\n \n scanf(\"%d\",&n);\n for(i=0;imax?a[i]:max;\n }\n \n while(1)\n {\n t=max*n;\n if(sum\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; isum)\n {\n printf(\"%d\",k+j);\n break;\n }\n }\n\n return 0;\n\n}\n"}, {"source_code": "#include\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\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\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;ik)\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;jsum)\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;imax)\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;ivote_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 \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\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\nint main()\n{\n int n,i, t, k, c, b;\n scanf(\"%d \", &n);\n int a[n];\n for(i=0;i1)\n {\n for(i=1;it)\n {\n k=i;\n break;\n }\n }\n printf(\"%d \", k);\n return 0;\n \n \n \n}"}, {"source_code": "#include\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;ik) printf(\"%lu\",max);\n else printf(\"%lu\",k);\n return 0;\n}"}, {"source_code": "#include \n\nint main() {\n\tint n;\n\tscanf(\" %d\", &n);\n\tint arr[n], sum=0, max=0;\n\tfor (int i=0;imax) max=arr[i];\n\t}\n\tint sumb=0;\n\tfor (max;sumbsum) break;\n\t}\n\tprintf(\"%d\\n\", max);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,sum=0,sum2=0,temp,i;\n\tscanf(\"%d\",&n);\n\tint a[n];\n\tfor(i=0;imax)\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;isum)\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 \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\n#include\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\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;imax)\n {\n max=a[i];\n }\n }\n for(i=0;isum)\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\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;isum1)break;\n else max++;\n }\n printf(\"%d\\n\",max);\n}\n"}, {"source_code": "#include\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\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 \nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint a[n],i,max,k,sum=0;\n\tfor(i=0;imax)\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\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;imax)\n {\n max=a[i];\n }\n }\n\n for(i=0;itotal)\n {\n printf(\"%d\\n\",j);\n break;\n }\n j++;\n }\n return 0;\n}\n"}, {"source_code": "#include\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#include \n\nint main()\n{\n int n,i,k,s=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;ik)\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\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;imax)\n {\n max=a[i];\n }\n }\n for(i=0;isum)\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\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\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;ik) printf(\"%lu\",max);\n else printf(\"%lu\",k);\n return 0;\n}"}, {"source_code": "#include\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;im)\n {\n m=a[i];\n }\n }\n for(i=m;;i++)\n {\n p=0;\n for(j=0;js)\n {\n printf(\"%d\\n\",i);\n break;\n }\n }\n}\n"}, {"source_code": "#include \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;isumele){\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 \n#include \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; iz)\n printf(\"%d\", y);\n else\n {\n y = y+1;\n goto h;\n }\n}"}, {"source_code": "#include \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\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\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\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\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=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; ks)\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\nint main(){\n\tint n,i,a,max=0,sum=0;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i\n#include \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; iz)\n printf(\"%d\", y);\n else\n {\n y = y+1;\n goto h;\n }\n}"}, {"source_code": "#include \nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a[100];\n int i;\n for(i=0;isum)\n {\n printf(\"%d\",k);\n break;\n }\n else\n k++;\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \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 //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\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\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;imax)\n {\n max=a[i];\n }\n }\n\n for(i=0;itotal)\n {\n printf(\"%d\\n\",j);\n break;\n }\n j++;\n }\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n\tint n, s=0;\n\tscanf(\"%d\",&n);\n\tint a[n];\n\tfor(int i=0;imax) max=a[i];\n\t}\n//\tprintf(\"%d %d\",s,max);\n\tint s1=0,b=max;\n\tfor(int i=0;i5)b=b+1;\n\tprintf(\"%d\",b);\n\treturn 0;\n}"}, {"source_code": "#include\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\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;ik) printf(\"%lu\",max);\n else printf(\"%lu\",k);\n return 0;\n}"}, {"source_code": "#include \n#include \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\n#include\n#include\n#include\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;imax)\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\nint main()\n{\n int a,b[101],d=0,i,f=0,j;\n scanf(\"%d\",&a);\n for(i=0;if)\n f=b[i];\n }\n for(i=f;;i++)\n {\n int cnt = 0;\n for(j=0;jd){\n printf(\"%d\\n\", i);\n return 0;\n }\n }\n}\n"}, {"source_code": "#include\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\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=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;jsum)\n {\n printf(\"%d\",i);\n break;\n }\n else\n {\n continue;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int i, n, k=0, score=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;ik)\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\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=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;jsum)\n {\n printf(\"%d\",i);\n break;\n }\n else\n {\n continue;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\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\nint main()\n{\n int a,b[101],d=0,i,f=0,j;\n scanf(\"%d\",&a);\n for(i=0;if)\n f=b[i];\n }\n for(i=f;;i++)\n {\n int cnt = 0;\n for(j=0;jd){\n printf(\"%d\\n\", i);\n return 0;\n }\n }\n}\n"}, {"source_code": "#include //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 \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;imax)\n {\n max=a[i];\n }\n }\n for(i=0;isum)\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 \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;isumele){\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 \n#include \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#include \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#include\n#include\n#include\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=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 \n#include \n#include \n\nint main(){\n int n,mx=0,i,tmp,sum=0,k;\n scanf(\"%d\",&n);\n for(i=0;imx)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 //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\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(maxsum)\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\nint main()\n{\nint i,j,s=0,s1=0,n,max;\nscanf(\"%d\",&n);\nint ara[n];\nfor(i=0;is)\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 \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;isum)\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\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\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; itemp){\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\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\n#include\nint main()\n{\n int n,s,max;\n scanf(\"%d\",&n);\n int array[n];\n for(int i=0;i\n#include\nint main()\n{\n int n,a[100],sum=0,i,grt=0,sum1;\n scanf(\"%d\",&n);\n\n for(i=0;i\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;ik) printf(\"%lu\",max);\n else printf(\"%lu\",k);\n return 0;\n}"}, {"source_code": "#include\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\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\nint main()\n{\n int n,i;\n scanf(\"%d\",&n);\n int a[n],h=0,s=0;\n for(i=0;i //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 \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\nint main()\n{\n int a,b[101],d=0,i,f=0,j;\n scanf(\"%d\",&a);\n for(i=0;if)\n f=b[i];\n }\n for(i=f;;i++)\n {\n int cnt = 0;\n for(j=0;jd){\n printf(\"%d\\n\", i);\n return 0;\n }\n }\n}\n"}, {"source_code": "#include\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;ibase?max:base;\n while(need<=sum)\n {\n max1+=j;\n for(i=0,need=0;i1)\n max1-=1;\n printf(\"%d\\n\",max1);\n return 0;\n}\n"}, {"source_code": "#include\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;ibiggest_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;iElodreip)break;\n Awruk=0,Elodreip=0;\n }\n printf(\"%d\\n\",k);\n //\n}\n"}, {"source_code": "#include\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;imax)\n {\n max=a[i];\n }\n }\n for(i=0;isum)\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 \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\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;isum1)break;\n else max++;\n }\n printf(\"%d\\n\",max);\n}\n"}, {"source_code": "#include\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\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;ip[i+1]?p[i]:p[i+1];\n p[i+1]=temp;\n}\nfor(i=0;;i++)\n{\n for(j=0;jt)\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\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#include\nint main() {\n int n,i;\n scanf(\"%d\",&n);\n float a[100],sum=0,max=0,val,temp;\n for(i=0;imax) 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\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\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;ik) printf(\"%lu\",max);\n else printf(\"%lu\",k);\n return 0;\n}"}, {"source_code": "#include\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;iflag)\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\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;imax)\n {\n max=a[i];\n }\n }\n printf(\"%d\\n\",max);\n for(i=0;itotal)\n {\n printf(\"%d\\n\",j);\n break;\n }\n j++;\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \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 \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 \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;isumele){\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\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;ia[i+1]?a[i]:a[i+1];\n a[i+1]=temp;\n}\nfor(i=0;;i++)\n{\n for(j=0;jt)\n {\n printf(\"%lld\",temp);\n break;\n }\n else\n {temp++;\n k=0;\n }\n}\nreturn 0;\n}\n"}, {"source_code": "#include\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;i1){\n\n\n\n\n\n max=a[0];\n for(int i=0;isum){\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\n#include\nint main()\n{\n int n,k=0,score=0;\n scanf(\"%d\",&n);\n int a[n];\n for(int i=0;ik)\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\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;isum1&&c==0)\n printf(\"%d\\n\",b);\n else\n printf(\"%d\\n\",b+1);\n}\n"}, {"source_code": "#include \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; ia[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=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\n#include\nint main()\n{\n int i, n, k=0, score=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;ik)\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\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=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=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 \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; ia[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=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 \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-nel)\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 \nint main()\n{\n\tint n, s=0;\n\tscanf(\"%d\",&n);\n\tint a[n];\n\tfor(int i=0;imax) max=a[i];\n\t}\n//\tprintf(\"%d %d\",s,max);\n\tint s1=0,b=max;\n\tfor(int i=0;i5)b=b+1;\n\tprintf(\"%d\",b);\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n int i, n, k=0, score=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;ik)\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\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;ibase?max:base;\n while(need<=sum)\n {\n max1+=j;\n for(i=0,need=0;i1)\n max1-=1;\n printf(\"%d\\n\",max1);\n return 0;\n}\n"}, {"source_code": "#include \n#include \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;jtotal)\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 ˜”*°•.˜”*°• God •°*”˜.•°*”˜\n\n/* \n\n JadedBeast ~~Morocco~~\n \n*/\n#include \n\nint main(void){\n int n,sum=0,a,k=1;\n scanf(\"%d\",&n);\n for(int i=0;i\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#include \n#include \nint main(){\n\n}\n"}, {"source_code": "#include \nint main()\n{\n\tint n, s=0;\n\tscanf(\"%d\",&n);\n\tint a[n];\n\tfor(int i=0;imax) max=a[i];\n\t}\n//\tprintf(\"%d %d\",s,max);\n\tint s1=0,b=max;\n\tfor(int i=0;i5)b=b+1;\n\tprintf(\"%d\",b);\n\treturn 0;\n}"}, {"source_code": "#include\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;im)\n {\n m=a[i];\n }\n }\n for(i=0;;i++)\n {\n for(j=0;js)\n {\n d=i;\n break;\n }\n }\n printf(\"%d\\n\",d);\n\n}\n"}, {"source_code": "#include\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;it)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\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;isum1&&c==0)\n printf(\"%d\\n\",b);\n else\n printf(\"%d\\n\",b+1);\n}\n"}, {"source_code": "#include\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 \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\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;imax)\n {\n max=a[i];\n }\n }\n for(i=0;isum)\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\n#include\nint main()\n{\n int i, n, k=0, score=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;ik)\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 \n#include \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; icount)\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\nint main()\n{\n int i,n,a[100],s1=0,j,s=0,k,max;\n scanf(\"%d\",&n);\n for(i=0;is)\n {\n printf(\"%d\\n\",k);\n break;\n }\n else\n {\n k++;\n }\n }\n}\n"}, {"source_code": "#include\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;i1){\n\n\n\n\n\n max=a[0];\n for(int i=0;isum){\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 \n#include \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\n#include\nint main()\n{\n int i, n, k=0, score=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;ik)\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\n#include\nint main()\n{\n int i, n, k=0, score=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;ik)\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\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\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\n#include\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\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-nel)\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\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;isum1&&c==0)\n printf(\"%d\\n\",b);\n\n\n else\n printf(\"%d\\n\",b+1);\n\n}\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int n,k=0,score=0;\n scanf(\"%d\",&n);\n int a[n];\n for(int i=0;ik)\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 \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=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\n#include\nint main() {\n int n,i;\n scanf(\"%d\",&n);\n float a[100],sum=0,max=0,val;\n for(i=0;imax) 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\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;iflag)\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\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#include\n#include\n#include\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;imax){\n max=i;\n }\n}\nprintf(\"%lld\",((max*2))+1);\nreturn 0;\n}\n"}, {"source_code": "#include\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 \n#include \n#include \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\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\n#include\nint main()\n{\n int i, n, k=0, score=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;ik)\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\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;ia[i+1]?a[i]:a[i+1];\n a[i+1]=temp;\n}\nfor(i;;i++)\n{\n for(j=0;jt)\n {\n printf(\"%d\",temp);\n break;\n }\n else\n {temp++;\n k=0;\n }\n}\nreturn 0;\n}\n"}, {"source_code": "#include \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=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\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;imax)\n max=a[i];\n }\n for(i=max;;i++)\n {\n for(j=0;jsum1)\n {\n printf(\"%d\\n\",i);break;\n }\n }\n\n}\n"}, {"source_code": "#include\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=count1)\n {\n break;\n }\n }\n printf(\"%d\",i);\n}\n"}, {"source_code": "#include\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;ik) printf(\"%lu\",max);\n else printf(\"%lu\",k);\n return 0;\n}"}, {"source_code": "#include\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;isum1&&c==0)\n printf(\"%d\\n\",b);\n\n\n else\n printf(\"%d\\n\",b+1);\n\n}\n}\n"}, {"source_code": "#include\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\n#include\nint main()\n{\n int i, n, k=0, score=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;ik)\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 \n#include \n#include \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\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(maxsum)\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\n#include\nint main() {\n int n,i;\n scanf(\"%d\",&n);\n float a[100],sum=0,max=0,val;\n for(i=0;imax) 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 \nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a[100];\n int i;\n for(i=0;isum)\n {\n printf(\"%d\",k);\n break;\n }\n else\n k++;\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int i,n,a[100],s1=0,j,s=0,k,max;\n scanf(\"%d\",&n);\n for(i=0;is)\n {\n printf(\"%d\\n\",k);\n break;\n }\n else\n {\n k++;\n }\n }\n}\n"}, {"source_code": "#include\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\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;ia[i+1]?a[i]:a[i+1];\n a[i+1]=temp;\n}\nfor(i=0;;i++)\n{\n for(j=0;jt)\n {\n printf(\"%lld\",temp);\n break;\n }\n else\n {temp++;\n k=0;\n }\n}\nreturn 0;\n}\n"}, {"source_code": "#include \n#include \n#include \nint main(){\n\n}\n"}, {"source_code": "#include \nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a[100];\n int i;\n for(i=0;isum)\n {\n printf(\"%d\",k);\n break;\n }\n else\n k++;\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main() {\n int n,i;\n scanf(\"%d\",&n);\n float a[100],sum=0,max=0,val;\n for(i=0;imax) 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\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;imax)\n max=a[i];\n }\n for(i=max;;i++)\n {\n for(j=0;jsum1)\n {\n printf(\"%d\\n\",i);break;\n }\n }\n\n}\n"}, {"source_code": "#include\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;ia[i+1]?a[i]:a[i+1];\n a[i+1]=temp;\n}\nfor(i=0;;i++)\n{\n for(j=0;jt)\n {\n printf(\"%lld\",temp);\n break;\n }\n else\n {temp++;\n k=0;\n }\n}\nreturn 0;\n}\n"}, {"source_code": "#include\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;im)\n {\n m=a[i];\n }\n }\n for(i=m;;i++)\n {\n for(j=0;js)\n {\n printf(\"%d\\n\",i);\n break;\n }\n }\n}\n"}, {"source_code": "#include \n#include \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;jtotal)\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\nint main()\n{\n int i,n,a[100],s1=0,j,s=0,k,max;\n scanf(\"%d\",&n);\n for(i=0;is)\n {\n printf(\"%d\\n\",k);\n break;\n }\n else\n {\n k++;\n }\n }\n}\n"}, {"source_code": "// In the name of ˜”*°•.˜”*°• God •°*”˜.•°*”˜\n\n/* \n\n JadedBeast ~~Morocco~~\n \n*/\n#include \n\nint main(void){\n int n,sum=0,a,k=1;\n scanf(\"%d\",&n);\n for(int i=0;i\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\n#include\nint main()\n{\n int i, n, k=0, score=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;ik)\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\n\nint main()\n{\n int n, i, j, c=0;\n\n scanf(\"%d\", &n);\n int a;\n\n for(i=0 ; ic) break;\n }\n printf(\"%d\", i);\n\n return 0;\n}\n"}, {"source_code": "#include\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\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\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; isum)\n {\n printf(\"%d\",k+j);\n break;\n }\n }\n\n return 0;\n\n}\n"}, {"source_code": "#include\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;imax)\n max=a[i];\n if(a[i]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\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#include\nint main()\n{\n int i, n, k=0, score=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;ik)\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\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 \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\nint main()\n{\n int t,i,b,n[100],sum1=0,sum=0;\n scanf(\"%d\",&t);\n for(i=0;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;isum1)\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 \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\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;im)\n {\n m=a[i];\n }\n }\n for(i=0;;i++)\n {\n for(j=0;js)\n {\n d=i;\n break;\n }\n }\n printf(\"%d\\n\",d);\n\n}\n"}, {"source_code": "#include\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;isum1&&c==0)\n printf(\"%d\\n\",b);\n\n else\n printf(\"%d\\n\",b+1);\n}\n}\n"}, {"source_code": "#include\nint main()\n{\n int i,n,a[100],s1=0,j,s=0,k,max;\n scanf(\"%d\",&n);\n for(i=0;is)\n {\n printf(\"%d\\n\",k);\n break;\n }\n else\n {\n k++;\n }\n }\n}\n"}, {"source_code": "#include\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;imax)\n {\n max=a[i];\n }\n }\n for(i=0;isum)\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\nint main()\n{\n int t,i,b,n[100],sum1=0,sum=0;\n scanf(\"%d\",&t);\n for(i=0;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;isum1)\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 \nint main()\n{\n\tint n, s=0;\n\tscanf(\"%d\",&n);\n\tint a[n];\n\tfor(int i=0;imax) max=a[i];\n\t}\n//\tprintf(\"%d %d\",s,max);\n\tint s1=0,b=max;\n\tfor(int i=0;i\n#include\nint main()\n{\n int i, n, k=0, score=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;ik)\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\n#include\nint main()\n{\n int i, n, k=0, score=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;ik)\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\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; isum)\n {\n printf(\"%d\",k+j);\n break;\n }\n }\n\n return 0;\n\n}\n"}, {"source_code": "#include \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; ia[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\n#include\nint main()\n{\n int i, n, k=0, score=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;ik)\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 \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; ia[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 ≥ 2), 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 - 1. You have a choice of making cuts at n + 1 places, i.e., Before b0, between b0 and b1, between b1 and b2, ..., between bn - 2 and bn - 1, and after bn - 1.The n + 1 choices of making cuts are as follows (where a | denotes a possible cut):| b0 | b1 | b2 | ... | bn - 2 | bn - 1 |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 - 1 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 = 3, 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 + 7.", "input_spec": "The input consists of two lines. The first line consists an integer n (1 ≤ n ≤ 75) — 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 + 7.", "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) = 4, f(3) = 4 and f(4) = 2. So, the value of s = 10.In the second sample, the set of valid cuts is:Size 2: |1|0.Hence, f(2) = 1 and f(3) = 0. So, the value of s = 1."}, "positive_code": [{"source_code": "/* practice with Dukkha */\n#include \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\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;++i20)break;\n\t\t\tb=1u<<(V[i][j]-1);\n\t\t\tfor(k=-1;++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=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 \n#include \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 \n#include \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 \n#include \n#include \nint main()\n{\n char mail[101], save[101];\n int ok=1;\n scanf(\"%s\",&mail);\n for(int i=0; i\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\n#include\n#include\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\n#include \n#include \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\n#include\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\n#include\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\n#include\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\n#include \n#include \n#include \n#include \n#include \n#include \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\n#include\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\n#include \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 \n#include \n#include \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\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\n#include\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='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\n#include\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#include \n#include \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 \n#include \n#include \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\n#include\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\n#include\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\n#include \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\n#include\n\nint main()\n{char add[101];\nint l,i,c=0;\nscanf(\"%s\",add);\nl=strlen(add);\nfor(i=0;i0 && i0 && i\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 \n#include \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\n#include \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\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\n#include \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 \n#include \n#include \nint main()\n{\n char mail[101], save[101];\n scanf(\"%s\",&mail);\n for(int i=0; i\n#include\n#include\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\n#include\n#include\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\n#include\n#include\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\n#include \n#include \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\n#include \n#include \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\n#include \n#include \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\n#include\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\n#include\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\n#include\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\n#include\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\n#include\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\n#include \n#include \n#include \n#include \n#include \n#include \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 \n#include \n#include \n#include \n#include \n#include \n#include \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 \n#include \n#include \n#include \n#include \n#include \n#include \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 \n#include \n#include \n#include \n#include \n#include \n#include \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\n#include\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\n#include\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\n#include\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\n#include\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\n#include\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\n#include\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\n#include\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\n#include \n#include \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\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\n#include\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='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\n#include\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#include\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#include\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#include \n#include \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 \n#include \n#include \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 \n#include \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\n#include\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=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\n#include\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\n#include \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\n#include\n\nint main()\n{char add[101];\nint l,i;\nscanf(\"%s\",add);\nl=strlen(add);\nfor(i=0;i0 && i0 && i\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\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\n#include\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\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#include \n#include \n#include \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=2;i--)\n {\n count = 0;\n for(j=0;j\n#include\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;ip[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\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#include\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;ix[i]?max:x[i];\n min = min\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\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\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\nint main()\n{\n int n,i,j,sum=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;ia[j]){\n a[i]=a[i]-a[j];\n i=-1;\n break;\n }\n }\n }\n for(i=0;i\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 \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\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=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#include\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\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#include\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; iarr[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 \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#include\n#include\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#include\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;ia)\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 \n#include \n#include \n#include \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=2;i--)\n {\n count = 0;\n for(j=0;j\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\nint main()\n{\n int n,x[105];\n scanf(\"%d\",&n);\n int i;\n for(i=0;i\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=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 \n#include \n#include \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\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#include \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;imaxm)\n\t\t\t\tmaxm=arr[i];\n\t\t}\n\tfor(k=0;karr[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#include \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\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\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=0;i--){\n\t\tfor (j=0;jara[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#include \n#include \n#include \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\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=0;i--){\n\t\tfor (j=0;jara[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\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=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\nint main()\n{\n int n,i,j,sum,p,a[200],k;\n scanf(\"%d\",&n);\n for(i=0;ia[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\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\n#include\nvoid sort(int *arr,int k)\n{\n int i,j,temp;\n for(i=0;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\nint main()\n{\n int n,i,j,k,sum=0,ind;\n scanf(\"%d\", &n);\n int li[n];\n for (i=0; ili[j]) li[i] = li[i] - li[j];\n }\n }\n ind = 1;\n for (j=1; j\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=0;i--){\n\t\tfor (j=0;jara[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\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 \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\nint min (int ar[],int n)\n{\n int i,p=19000;\n for (i=0;i\n#include \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\n#include\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\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\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\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\n#include\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;iq)\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\n#include\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;ix[i]?max:x[i];\n\t\tmin = min\n#include\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;ia[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\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;jy){\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\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\n#include\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;ix[i]?max:x[i];\n\t\tmin = min\n#include\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;ip[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\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#include \nint main()\n{\n int n,min;\n scanf(\"%d\",&n);\n int a[n];\n for(int i=0; i0)\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\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\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\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\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 \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 \n#include \n#include \nint main(){\nint n;\nscanf(\"%d\",&n);\nint a[n],i,j;\nfor(i=0;ia[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#include\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#include\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=0)\n {\n if(arr[x]\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\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;imax){\n max=x[i];\n max1=i;\n }\n }\n maxi=max;\n max=0;\n for(i=0;imax&&x[i]\nint main(){\n int n,m,a[100],i,tr=1,min;\nscanf(\"%d\",&n);\nfor(i=0;ia[i])min=a[i];\nfor(i=0;imin){\ntr=1;\na[i]-=min;\n}\n}\nm=0;\n\nfor(i=0;i\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\n#include\nmain()\n{\n int n,i,r,min;\n scanf(\"%d\",&n);\n int arr[n];\n\n for(i=0; iarr[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\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;jy){\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\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\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\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 \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 \n#include \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\nint main()\n{\n int n,min=100,i,j,A[100],temp;\n scanf(\"%d\",&n);\n for(i=0;i0;i--)\n {\n for(j=0;j\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\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\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#include \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=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\n#include\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\nint main()\n{\n int n,i,j,sum,p,a[200],k;\n scanf(\"%d\",&n);\n for(i=0;ia[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\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 \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\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\n#include\n#include\n#include\n#include\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;ia[i])min=a[i];\n }\n save=min;\n while(flag){\n flag=0;\n for(i=0;i\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 \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\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;imax)\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\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\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;i0;k--)\n {\n for(i=0;i\nint main()\n{\n int n,min=100,i,j,A[100],temp;\n scanf(\"%d\",&n);\n for(i=0;i0;i--)\n {\n for(j=0;j\n#include\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;ia)\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\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\n\n\nint main(){\n\tint a[101];\n\tint n,i,j,sum=0;\n\tscanf(\"%d\",&n);\n\tfor(i=0;ia[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]\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\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\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#include\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;ia)\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\n\nunsigned gcd(unsigned x, unsigned y){\n unsigned wk;\n if(x\nint min (int ar[],int n)\n{\n int i,p=19000;\n for (i=0;i\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 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\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\n#include\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\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#include\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#include\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\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;imax)\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 \n#include \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;iarr[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\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(iarray[i]){\n\t\t\tmin=array[i];\n\t\t}\n\t\ti++;\n\t}\n\treturn min;\n}\n\n "}, {"source_code": "#include\n#include\nmain()\n{\n int n,i,r;\n scanf(\"%d\",&n);\n int arr[n];\n\n for(i=0; i\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 #include\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#include \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\n#include\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;i0)\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 \n\nint main()\n{\n int n,i,j,sum,p,a[200];\n scanf(\"%d\",&n);\n for(i=0;ia[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 #include\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\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]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\n#include\n#include\nint main()\n{int a,b[101],c,d,e,f,n,w,g,j,i;\nscanf(\"%d\",&n);\nfor(i=0;ib)\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 \n#include\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#include \n#include \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\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#include\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;ix[i]?max:x[i];\n\t\tmin = min\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\n#include \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\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=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\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\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=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\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=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\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\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;ia[i])\nmin=a[i];}\nl=min;t=min;\nfor(i=0;it)\nl=t;}\nprintf(\"%d\",n*l);\nreturn 0;\n}"}, {"source_code": "#include\n\nunsigned gcd(unsigned x, unsigned y){\n unsigned wk;\n if(x\n#include\n#include\nint main()\n{int a,b[101],c,d,e,f,n,w,g,j,i;\nscanf(\"%d\",&n);\nfor(i=0;ib)\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 \nint q,w=1,A[100],i,g,r,x,top;\nint main()\n{\n\tscanf(\"%d\",&q);\n\tfor (i = 0; i =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\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#include \n#include \n\n\nint main(){\n\n int n,i,j=0;\n scanf(\"%d\",&n);\n int a[100];\n for(i=0; ia[i-1]){\n a[i]-=a[i-1];\n }\n }\n for(j=0; ja[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#include \n\nint main()\n{\n int n,i,sum=0;\n scanf(\"%d\",&n);\n int arr[n];\n for(i=0;iarr[i+1])\n {\n arr[i]=arr[i]-arr[i+1];\n }\n else if(arr[i]\n#include\n#include\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=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=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\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\nint q,w=1,A[100],i,g,r,x,top;\nint main()\n{\n\tscanf(\"%d\",&q);\n\tfor (i = 0; i =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\n#include\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\nint q,w=1,A[100],i,g,r,x,top;\nint main()\n{\n\tscanf(\"%d\",&q);\n\tfor (i = 0; i =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 \n#include \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#include\n#include\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=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=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\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\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;imax)\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 \n#include \n#include \n\n\nint main(){\n\n int n,i,j=0;\n scanf(\"%d\",&n);\n int a[100];\n for(i=0; ia[i-1]){\n a[i]-=a[i-1];\n }\n }\n for(j=0; ja[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\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\n#include\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 \n#include \nint main()\n{\n\tint n,f,mini,i,s,j,r;\n\tscanf(\"%d\",&n);\n\tint ara[100000];\n\tfor (i=0;i0){\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\n#include\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#include \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 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\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=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\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\n#include\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;lk)\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\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;i0){\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\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#include\n#include\nint main()\n{int a,b[101],c,d,e,f,n,w,g,j,i;\nscanf(\"%d\",&n);\nfor(i=0;ib)\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 \n#include \n#include \n\n\nint main(){\n\n int n,i,j=0;\n scanf(\"%d\",&n);\n int a[100];\n for(i=0; ia[i-1]){\n a[i]-=a[i-1];\n }\n }\n for(i=0; ia[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\nint main()\n{\n int n, a[101], i, min, flag;\n scanf(\"%d\", &n);\n for(i=0; ia[i])\n {\n min=a[i];\n }\n }\n \n for(i=0; i0)\n a[i]-=min;\n }\n \n for(i=1; i\n#include\n#include\nint main(void) {\nint n,freq,i,j,temp,d;\nscanf(\"%d\",&n);\nint a[n];\nfor(i=0;ia[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\n\nint main(){\n\tint a[101];\n\tint n,i,j,sum=0;\n\tscanf(\"%d\",&n);\n\tfor(i=0;ia[j]) {\n\t\t\t\t\ta[i]=a[i]-a[j];\n\t\t\t\t}\n\t\t\t\tif (a[i]\n #include\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\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 \n#include \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 \n#include \n#include \n#include \n#include \n\nint main()\n{\n int n , A[200]={0}, Result=0,i,j,temp;\n scanf(\"%d\",&n);\nfor(i=0;iA[1])\n {\n if(A[0]==A[n-1])\n {\n break;}\n for(i=0;iA[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\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;imax)\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\n#include\nmain()\n{\n int n,i,r;\n scanf(\"%d\",&n);\n int arr[n];\n\n for(i=0; i\n#include \n#include \n\n\nint main(){\n\n int n,i,j=0;\n scanf(\"%d\",&n);\n int a[100];\n for(i=0; ia[i-1]){\n a[i]-=a[i-1];\n }\n }\n for(i=0; ia[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\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\n#include\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\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=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\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;i0){\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 \n#include \n#include \n#include \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#include \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\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\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=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 \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 \n#include \n\nint main()\n{\n int n,i,sum=0;\n scanf(\"%d\",&n);\n int arr[n];\n for(i=0;iarr[i+1])\n {\n arr[i]=arr[i]-arr[i+1];\n }\n else if(arr[i]\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\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;ia[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;ia[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\nint q,w=1,A[100],i,g,r,x,top;\nint main()\n{\n\tscanf(\"%d\",&q);\n\tfor (i = 0; i =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 \nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tint a[n];\n\tfor(int i=0;ia[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#include\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;ix[i]?max:x[i];\n\t\tmin = min\n#include\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\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 \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 \n#include\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\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;ia[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\n\nunsigned gcd(unsigned x, unsigned y){\n unsigned wk;\n if(x\n#include\nmain()\n{\n int n,i,r;\n scanf(\"%d\",&n);\n int arr[n];\n\n for(i=0; i\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;i0){\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\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\n#include\nint main()\n{\nint n,sum=0,i,j;\nscanf(\"%d\",&n);\nint a[n];\nfor(i=0;ia[i+1])\n{\nwhile(a[i]-a[i+1]>0)\na[i]=a[i]-a[i+1];\n}\n}\nfor(i=0;ia[i])\n{\nwhile(a[i+1]-a[i]>0)\na[i+1]=a[i+1]-a[i];\n}\n}\nfor(i=0;ia[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\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 \n#include \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;iarr[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\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#include \n\nint main()\n{\n int n,i,sum=0;\n scanf(\"%d\",&n);\n int arr[n];\n for(i=0;iarr[i+1])\n {\n arr[i]=arr[i]-arr[i+1];\n }\n else if(arr[i]\n#include \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 \nint main()\n{\n int n, a[101], i, min, flag;\n scanf(\"%d\", &n);\n for(i=0; ia[i])\n {\n min=a[i];\n }\n }\n \n for(i=0; i0)\n a[i]-=min;\n }\n \n for(i=1; i\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=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\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 \n#include \nint factor(int a,int b)\n{\n while(a != b)\n {\n if(a>b)\n a-=b;\n else if(a\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\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\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\n#include\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 \n#include \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\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 \n#include \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 \n#include \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 \n#include \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\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\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 \n#include \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 \n#include \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;j0;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 \n#include \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 \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 \n#include \n#include \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\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 \n#include \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 \n#include \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 \n#include \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 \n#include \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 \n#include \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 \n#include \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 \n#include \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\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\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\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\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\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\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\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\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 \n#include \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;j0;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 \n#include \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 \n#include \n#include \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 ≤ n ≤ 100) and k (1 ≤ k ≤ n) — the lengths of sequence a and b respectively. The second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 200) — Hitagi's broken sequence with exactly k zero elements. The third line contains k space-separated integers b1, b2, ..., bk (1 ≤ bi ≤ 200) — 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, 0, 0, 14. Two of the elements are lost, and the candidates in b are 5 and 4. There are two possible resulting sequences: 11, 5, 4, 14 and 11, 4, 5, 14, both of which fulfill the requirements. Thus the answer is \"Yes\". In the second sample, the only possible resulting sequence is 2, 3, 5, 8, 9, 10, which is an increasing sequence and therefore invalid."}, "positive_code": [{"source_code": "#include\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\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#include \nint check_inc(int a[],int size)\n{\n int i;\n for(i=0;ia[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\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;i0 && count1==0 && k==1) printf(\"NO\");\n else printf(\"YES\");\n\n }\n\n\n\n"}, {"source_code": "#include\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;i1){\n printf(\"Yes\\n\");\n return 0;\n }\n int c=0;\n for(i=0;i=0;i--){\n if(ara1[i]\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]\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;i1) printf(\"Yes\\n\");\n\telse{\n\t\tfor(i=0;ia[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 \n#include\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=2)\nprintf(\"Yes\\n\");\nelse\n{\n for(i=0;ia[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\n#include\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 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\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;cnt0 && khobza[d-1]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\n#include\nint judge(int a[],int b[],int n,int m)\n{\n\tint i;\n\tint t=0,x=0;\n\tfor(i=0;ia[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#include \nint check_inc(int a[],int size)\n{\n int i;\n for(i=0;ia[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\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;ia[i+1]){\n count++;\n }\n }\n\n if(a[i]==0){\n for(j=0;ja[i+1]){\n count++;}\n\n }\n else if(i==t1-1){\n if(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 \n#include\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=2)\nprintf(\"Yes\\n\");\nelse\n{\n for(i=0;ia[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 \n#include \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;ia[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\n#include\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;ia[i+1])\n{printf(\"Yes\\n\");return 0;}\nprintf(\"No\\n\");\nreturn 0;\n}\n"}, {"source_code": "#include \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]\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\nint main()\n{\n int n,k;\n scanf(\"%d%d\",&n,&k);\n int a[n],i;\n for(i=0;i0)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n else\n printf(\"YES\");\n \n return 0;\n}"}, {"source_code": "#include \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;ia[i+1])\n {\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\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;ia[i+1])\n{printf(\"Yes\\n\");return 0;}\nprintf(\"No\\n\");\nreturn 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n#include \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\n#include\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;i1)\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+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\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#include \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=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\n#include\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;i1)\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+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\n\nint main()\n{\n int n,k;\n scanf(\"%d%d\",&n,&k);\n int a[n],i;\n for(i=0;i0)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n else\n printf(\"YES\");\n \n return 0;\n}"}, {"source_code": "#include\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; ia[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 \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 \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=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;ia[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\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=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\n\nint main()\n{\n int n,k;\n scanf(\"%d%d\",&n,&k);\n int a[n],i;\n for(i=0;i0)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n else\n printf(\"YES\");\n \n return 0;\n}"}, {"source_code": "#include\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#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 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\n#include\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;i0? printf(\"Yes\"):printf(\"No\");\n }\n else puts(\"Yes\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \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 \n#include \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\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\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;i1)\n printf(\"Yes\\n\");\n\n else if(c==1){\n for(i=0;ia[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 \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;i1)\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#include\n#include\n#include\n#include\n#include\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;i1)\n {\n printf(\"Yes\\n\");\n return 0;\n }\n else{\n for(i=0;ia[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 \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;i0;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\nint *sort(int ara[],int n)\n{\n int i,j,temp;\n for(i=0;iara[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 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 \n#include \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= 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\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;imax)\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(maxmax && num1[i-1]\n#include\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;i0? printf(\"Yes\"):printf(\"No\");\n }\n else puts(\"Yes\");\n return 0;\n}\n"}, {"source_code": "#include \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\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; i1)\n {\n printf(\"YES\");\n return 0;\n }\n for(i=0; ib[i+1])\n {\n printf(\"YES\");\n return 0;\n }\n }\n\n for(i=0; it)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n\n}\n"}, {"source_code": "#include \n#include \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;ia[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\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\nint main(){\n int a[101],b[101],A,B;\n scanf(\"%d%d\",&A,&B);\n for(int i=0;i1) printf(\"Yes\");\n else printf(\"No\");\n return 0;\n}\n"}, {"source_code": "#include \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;i0;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#include\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=2)\nprintf(\"Yes\\n\");\nelse\n{\n for(i=0;ia[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 \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\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#include\nint check(int [],int );\nint fun(int [],int ,int [],int );\nint check(int a[],int n)\n{\n int i;\n for(i=1;ia[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#include\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\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 \n#include \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;ib[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;ia[i])&&(i+1==n-1))\n printf(\"No\");\n else if(a[i+1]\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=(k-1)) break;\n }}\n\n for(i=0;ia[i+1])\n {\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n return 0;\n}"}, {"source_code": "#include\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;i1)\n printf(\"Yes\");\n \n else\n {\n for(int i=0;i\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 \n#include \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\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;i1)\n printf(\"Yes\");\n \n else\n {\n for(int i=0;i\nmain()\n{\nint A[100000],B[100000],a,b,i,min,max,j,c=0;\nscanf(\"%d%d\",&a,&b);\nfor(i=0;imax)\n max=B[i];\n }\n for(i=0;i=0;j--)\n if(A[j]==0)\n break;\n A[j]=min;\n\n }\n for(i=0;i\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\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;is[i])\n less2=s[i];\n if(max2=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\n#include\n#include\n#include\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;ib[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\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=(k-1)) break;\n }}\n\n for(i=0;ia[i+1])\n {\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n return 0;\n}"}, {"source_code": "#include \n#include \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 \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\n#include\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(temp1)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\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;cnt0 && khobza[d-1]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\n#include\nint judge(int a[],int b[],int n,int m)\n{\n\tint i;\n\tint t=0,x=0;\n\tfor(i=0;ia[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#include\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;ia[i+1])\n\t\treturn 1; \n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \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\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;i1)\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 \n#include \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=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\nmain()\n{\nint A[100000],B[100000],a,b,i,min,max,j,c=0;\nscanf(\"%d%d\",&a,&b);\nfor(i=0;imax)\n max=B[i];\n }\n for(i=0;i=0;j--)\n if(A[j]==0)\n break;\n A[j]=min;\n\n }\n for(i=0;i\n#include \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;ia[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 \n#include \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\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(ka[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 \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 \n#include \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= 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 \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\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=n[i-1] && n[i]<=n[i+1]);\n flag++;\n }\n }\n\n if(flag==b)\n {\n for(i=0,j=0; in[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\nint main()\n{\n int n,k,i,b[202],a[203],flag,j;\n scanf(\"%d %d\",&n,&k);\n for(i=0;ia[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\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;i1) printf(\"Yes\\n\");\n\telse{\n\t\tfor(i=0;ia[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\n\nint main()\n{\n int n,k;\n scanf(\"%d%d\",&n,&k);\n int a[n],i;\n for(i=0;i0)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n else\n printf(\"YES\");\n \n return 0;\n}"}, {"source_code": "#include\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;is[i])\n less2=s[i];\n if(max2=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 \n#include \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;i1)\n printf(\"Yes\");\n else\n {\n if (k==1)\n for (i=0;ia[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\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;ib[i])min=b[i];\n }\n if(k!=1){\n if(max!=min){\n increase=0;\n }else{\n for(i=0;ia[i]){\n increase=0;\n }\n }\n }\n }else{\n for(i=0;ia[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 \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]\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=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]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 \n }\n // printf(\"%d\\n\",i);\n }\n if (flag==0)\n printf(\"No \\n\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \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\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;ia[n];);puts(k-1|n?\"Yes\":\"No\");}"}, {"source_code": "# include \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;i0 &&(a[i]1){\n //printf(\"pop\");\n for(i=0;i\n#include \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;ib[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\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\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;i1)\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\n\nint main()\n{\n int n,k;\n scanf(\"%d%d\",&n,&k);\n int a[n],i;\n for(i=0;i0)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n else\n printf(\"YES\");\n \n return 0;\n}"}, {"source_code": "#include\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;ia)\n{\nprintf(\"Yes\");return 0;\n}\n}\nfor(i=0;iy[0])\n {\n printf(\"Yes\");return 0;\n }\n }\n\nprintf(\"No\");return 0;\n}\nfor(i=0;i\n#include\n#include\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; ic && 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 \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;i1)\n\t\tans=1;\n\tif(m\n#include \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\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;i1){\n printf(\"Yes\\n\");\n return 0;\n }\n int c=0;\n for(i=0;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\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\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#include \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 \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;i1)\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\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\nmain()\n{\n int n,k,a[100],b[100],i,t,j;\n scanf(\"%d%d\",&n,&k);\n for(i=0;ia[i+1])\n {\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include\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\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;i1){\n printf(\"Yes\\n\");\n return 0;\n }\n int c=0;\n for(i=0;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\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=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]b[0] || a[i+1]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\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\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\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;i1){\n printf(\"Yes\\n\");\n return 0;\n }\n int c=0;\n for(i=0;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\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;iara1[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 \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\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;i1){\n printf(\"Yes\\n\");\n return 0;\n }\n int c=0;\n for(i=0;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\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;i1)\n // {\n // printf(\"YES\");\n // break;\n\n // }\nif(n!=1)\n\nprintf(\"YES\");\n\nif(n==1)\n {\n for(i=0;i\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; ia[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; ia[i+1])\n printf(\"Yes\");\n else\n printf(\"No\");\n }\n\n\n else\n {\n for(i = 0; 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\n#include \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 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\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\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 \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;i0;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\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;i1) printf(\"Yes\");\n else\n\n {\n for(i=0;i\n#include\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;iara1[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 \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;i1)\n\t\tans=1;\n\tif(m\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;ib[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\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=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=x[j]&&y[0]<=x[j+1+m])\n printf(\"No\");\n\n else printf(\"Yes\");\n }\n }\n}\n"}, {"source_code": "#include\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;ib[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\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;i0;i--){\n for(j=0;jy)\n printf(\"No\\n\");\n else{\n j=0;\n for(i=0;ia[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 \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#include \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=0; j--)\n {\n if(big[j]!=0)\n {\n if(big[i] 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\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; ia[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; ia[i+1])\n printf(\"Yes\");\n else\n printf(\"No\");\n }\n\n\n else\n {\n for(i = 0; 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\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;i1) printf(\"Yes\");\n else\n\n {\n for(i=0;i\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;i1)\n\t\tans=1;\n\tif(m\n#include \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 \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\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;ia[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\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;ib[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\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;iara1[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 \n#include \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 \n#include \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=0;j--)\n {\n if(big[j]!=0)\n {\n if(big[i] 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\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\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;ia[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 \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#include \n#include\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 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 a[i+1])\n {\n printf(\"Yes\");\n return 0;\n }\n }\n printf(\"No\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \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 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\nmain()\n{\n int n,k,a[100],b[100],i,t,j;\n scanf(\"%d%d\",&n,&k);\n for(i=0;ia[i+1])\n {\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include\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;i1) printf(\"Yes\");\n else\n\n {\n for(i=0;i\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;i0){\n if(a[i]==0){\n for(j=0;ja[i+1]){\n count++;}\n }\n }\n }\n else if(a[i+1]0){printf(\"Yes\");}\n else{printf(\"No\");}\n\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\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=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\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;ia)\n{\nprintf(\"Yes\");return 0;\n}\n}\nfor(i=0;iy[0])\n {\n printf(\"Yes\");return 0;\n }\n }\n\nprintf(\"No\");return 0;\n}\nfor(i=0;i\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;ia[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\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;i1) printf(\"Yes\\n\");\n\telse{\n\t\tfor(i=0;ia[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\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;i0 && (a[i]0 && 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\n#include\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\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 1)\n\t{\n\t\tprintf (\"Yes\\n\");\n\t}\n\n\telse if (sum ==1)\n\t{\n\t\tfor (x=0 ; 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\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=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 \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\n#include \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 \n#include \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=0; j--)\n {\n if(big[j]!=0)\n {\n if(big[i] 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\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;isb[1]) { printf(\"yes\"); return 0;}\n printf(\"no\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \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\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;i1){\n printf(\"Yes\\n\");\n return 0;\n }\n int c=0;\n for(i=0;iara1[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\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;i0 && (a[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] || ma[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\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;i0;i--){\n for(j=0;jy)\n printf(\"No\\n\");\n else{\n for(i=0;ia[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 \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;ia[i+1])\n {\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \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 \n#include \n#include \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 \n#include \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 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#include \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=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\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=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=x[j]&&y[0]<=x[j+1+m])\n printf(\"No\");\n\n else printf(\"Yes\");\n }\n }\n}\n"}, {"source_code": "#include\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;i1)\n printf(\"Yes\");\n if(a[0]==0)\n a[0]=b[0];\n else\n {\n for(int i=0;i\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;i1)\n // {\n // printf(\"YES\");\n // break;\n\n // }\nif(n!=1)\n\nprintf(\"YES\");\n\nif(n==1)\n {\n for(i=0;i\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;i1)\n // {\n // printf(\"YES\");\n // break;\n\n // }\nif(n!=1)\n\nprintf(\"YES\");\n\nif(n==1)\n {\n for(i=0;i\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;i1)\n printf(\"Yes\");\n else\n {\n for(int i=0;i\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;is[i])\n less2=s[i];\n if(max2=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\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;i1)\n // {\n // printf(\"YES\");\n // break;\n\n // }\nif(n!=1)\n\nprintf(\"YES\");\n\nif(n==1)\n {\n for(i=0;i\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;isb[1]) { printf(\"yes\"); return 0;}\n printf(\"no\");\n return 0;\n}\n"}, {"source_code": "#include \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\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\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;ia[i+1])\n {\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include\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;i1){\n printf(\"Yes\\n\");\n return 0;\n }\n int c=0;\n for(i=0;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\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;is[i])\n less2=s[i];\n if(max2=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\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;i0;i--){\n for(j=0;jb[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;ia[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\n#include\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\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=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 \n#include \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\n#include\n#include\n#include\n#include \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\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;i0){\n if(a[i]==0){\n for(j=0;ja[i+1]){\n count++;}\n }\n }\n }\n else if(a[i+1]0){printf(\"Yes\");}\n else{printf(\"No\");}\n\n\n return 0;\n}\n"}, {"source_code": "#include\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\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;isb[1]) { printf(\"yes\"); return 0;}\n printf(\"no\");\n return 0;\n}\n"}, {"source_code": "#include \nmain()\n{\n int n,k,a[100],b[100],i,t,j;\n scanf(\"%d%d\",&n,&k);\n for(i=0;ia[i+1])\n {\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include\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;i1){\n printf(\"Yes\\n\");\n }\n int c=0;\n for(i=0;iara1[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 ≤ n ≤ 100) — 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 \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#include\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\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 \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#include\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#include\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\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\nint main(){\n\tint leng,count=0,i=0;\n\tscanf(\"%d\",&leng);\n\tchar s[leng];\n\tscanf(\"%s\",s);\n\twhile(i\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\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\n#include\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\n#include\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\n#include\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#include\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\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\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#include\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\n#include\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\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\n#include\n#include\n#include\n#include\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\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\nint main()\n{\n int n, i, ans=0;\n char s[101];\n scanf(\"%d %s\", &n, s);\n for(i=0; i\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\n#include\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#include\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\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\nint main()\n{\n\n int n,i,b=0;\n scanf(\"%d\",&n);\n char a[n];\n for (i=0;i\nint main()\n{\nint n,i,c=0;\nchar s[100];\nscanf(\"%d\",&n);\nscanf(\"%s\",s);\nfor(i=1;i\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#include\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\n#include\nint main()\n{\nint n,i=0,mov=0;\nscanf(\"%d\",&n);\nchar str[n];\nscanf(\"%s\",str);\n\twhile(i\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 \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 \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\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#include \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#include \n#include \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#include\n#include\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\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 * \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 \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#include\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\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\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\nchar a[101];\nint s=0,i=0,n;\nint main()\n{\nscanf(\"%d\",&n);\nscanf(\"%s\",a);\nwhile (i\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\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#include\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\nint main(){\n\tint leng,count=0,i=0;\n\tscanf(\"%d\",&leng);\n\tchar s[leng];\n\tscanf(\"%s\",s);\n\twhile(i\n#include \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\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#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\nint main()\n{\nint n,i,c=0;\nchar s[100];\nscanf(\"%d\",&n);\nscanf(\"%s\",s);\nfor(i=1;i\n#include\nint fun(char *,int );\nint fun(char *s,int n)\n{\n int i=0,cnt=n;\n while(i\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\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#include \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\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\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\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\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\nint main()\n{\nint n,i,c=0;\nchar s[100];\nscanf(\"%d\",&n);\nscanf(\"%s\",s);\nfor(i=1;i\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\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\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#include\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\n\n#include \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 \n#include \n\nint main()\n{\n int i,n,ans=0;\n char letters[100000];\n scanf(\"%d\",&n);\n for(i=0;i\n#include\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\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\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 \ntypedef float fl;\ntypedef char ch;\ntypedef long long ll;\n#define rep(i,a,n) for(i=a;i=a;i--)\n#define repr(i,a,b) for(i=a;i\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\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#include\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\n#include\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#include \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\n#include \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\n#include\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 \n#include \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;i1)){\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\n#include\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#include\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\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#include \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\n#include\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\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\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\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\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 \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#include\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\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#include\n#include\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;iptr[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;iptr[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\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\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 \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 \n#include \n#include \n#include \n#include \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#include\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\n#include\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\n #include\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\nint main()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n char ch[n];\n for (i=0;i\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\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 \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\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#include\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\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\nint main()\n{\n int i,n,sum=0;\n char a[110];\n scanf(\"%d\",&n);\n for(i=0;i\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\nint main()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n char ch[n];\n for (i=0;i\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\n#include\nint main()\n{\n char a[100];\n int i,l,p=0;\n\n gets(a);\n\n for(i=0;i\n#include\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\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#include \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\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#include\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 \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\nint main() {\n int a;\n scanf(\"%d\",&a);\n int x=a%2;\n printf(\"%d\", x); \n}"}, {"source_code": "#include\n#include\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\n#include\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 \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#include\nint main()\n{\n char a[100];\n int i,l,p=0;\n\n gets(a);\n\n for(i=0;i\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 #include\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#include \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;i1)){\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 \n\nint main() {\n int a,x;\n scanf(\"%d\",&a);\n x=a%2;\n printf(\"%d\", x); \n}"}, {"source_code": "#include\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\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\n#include\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\n#include\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\nint main()\n{\n\n int n,i,b=0;\n scanf(\"%d\",&n);\n char a[n];\n for (i=0;i\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\nint main()\n{\n int i,n,sum=0;\n char a[110];\n scanf(\"%d\",&n);\n for(i=0;i\n#include \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\n\nint main() {\n int a;\n scanf(\"%d\",&a);\n int x=a%2;\n printf(\"%d\", x); \n}"}, {"source_code": "#include\n\nint main()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n char ch[n];\n for (i=0;i\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\n#include\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\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#include\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\nint main()\n{\n\n int n,i,b=0;\n scanf(\"%d\",&n);\n char a[n];\n for (i=0;i\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\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 \n#include \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\nint main()\n{\n\n int n,i,b=0;\n scanf(\"%d\",&n);\n char a[n];\n for (i=0;i\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 \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 \n#include \n#include \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\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 \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 \n#include \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\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#include\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 \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 \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\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\n#include\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\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\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\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#include\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#include\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\n#include\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 \n#include \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#include \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\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\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\n#include\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 \n\nint main(){\n int i,n,ctn;\n scanf(\"%d\",&n);\n char c[n];\n for(i=0;i\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#include \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#include\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#include \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#include \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#include \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 \n#include \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\nint main()\n{\n int i,n,count=0;\n char a[1000];\n scanf(\"%d\",&n);\n for(i=0;i\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\n#include \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\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\n#include\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\n#include\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#include\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\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#include\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\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\n#include \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\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\n#include\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\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\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#include\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 \n#include \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 \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#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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) + next(l + 1) + ... + next(r - 1) + next(r). Help him solve this problem.", "input_spec": "The single line contains two integers l and r (1 ≤ l ≤ r ≤ 109) — the left and right interval limits.", "output_spec": "In the single line print the only number — the sum next(l) + next(l + 1) + ... + next(r - 1) + next(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) + next(3) + next(4) + next(5) + next(6) + next(7) = 4 + 4 + 4 + 7 + 7 + 7 = 33In the second sample: next(7) = 7"}, "positive_code": [{"source_code": "#include \n#include \n#include \n#include \n#include \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;jc[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 \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 \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 \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 \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\n#include\ndouble mu10(int t){\n\tint i;double kq=1;\n\tfor(i=0;i\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\n#include\n#include\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]=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]\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 \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 \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 \n#include \n#include \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=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 \n#include \n#include \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\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\n#include\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 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\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 \n#include \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 \n#include \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(位數),digitarr(luckynum陣列),digittest(using to find digit),digitnum(num的第i位數字)*/\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;ipow(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=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) /*無法進位*/\n { \n digit++;\n /*printf(\"%d\\n\",digit);*/\n i=0;/*從第一位開始全為4*/\n } \n for(j=i;j\n#include \n#include \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= 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\n#include\n#include\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]=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]\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 \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=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\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(startno[start])\n start++;\nlong long prev_no=l;\nwhile(startno[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\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;ilucky[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\n#include \n#include \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]=x&&arr[mid-1]x)\n h=mid-1;\n else\n l=mid+1;\n }\n if(arr[l]>=x&&arr[l-1]\n#include\n#include\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 \n#include \n#include \n#include \n#include \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;jc[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 \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 \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 \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\n#include\ndouble mu10(int t){\n\tint i;double kq=1;\n\tfor(i=0;i\n#include\ndouble mu10(int t){\n\tint i;double kq=1;\n\tfor(i=0;i\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\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\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\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\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 \n#include \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=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 \n#include \n#include \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=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 \n#include \n#include \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=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 \n#include \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=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 \n#include \n#include \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=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 \n#include \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=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 \n#include \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=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 \n#include \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=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 \n#include \n#include \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=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 \n#include \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=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 \n#include \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=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 \n#include \n#include \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\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 \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 \n#include \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\n#include\n#include\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]=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]\n#include\n#include\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]=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 \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=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 \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=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 \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=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 \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=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\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;ilucky[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\n#include\n#include\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\n#include\n#include\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 \n#include \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 \n#include \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 \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\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\n#include\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 \n#include \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\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 \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\n#include\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\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 \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\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 \n#include \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\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\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\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\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\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 \n#include \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\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 \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\n#include\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\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\n#include\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 \n#include \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 \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\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 \n#include \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 \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 \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\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 \n#include \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 \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 \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\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\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 \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\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 \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 \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\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\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\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 \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\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\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 \n#include \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 \n#include \n#include \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\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 \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\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 \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\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\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 \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\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\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 \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\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\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\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 \n#include\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 \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\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 \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 \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 \n#include \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 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\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\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\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\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 \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\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\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\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 \n#include \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\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\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 \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 \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\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 \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\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\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\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\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\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\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\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 \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\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 \n#include \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 \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\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\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\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\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 \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\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 \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\n#include\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 \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 \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\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\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+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 \n#include \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\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 \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 \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 \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 \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\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+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\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\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 \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\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 \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\n#include\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\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\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 \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\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\n#include\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 \n#include \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\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 \n#include \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\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\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\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\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\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 \n#include \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\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\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\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 \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\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\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\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\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\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 \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\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\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\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\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 \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\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\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\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\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 \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\n#include\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\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 \n#include \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 \n#include\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\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\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\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\n#include\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\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\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\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\nint main()\n{\n int n,i,j=0,k=0;\n scanf(\"%d\",&n);\n for(i=0;i\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\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\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\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\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 \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\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(\"������� ����� \");\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\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\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\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\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\nint main()\n{\n int n,i,j=0,k=0;\n scanf(\"%d\",&n);\n for(i=0;i100)\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 \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\nint main()\n{\n int n,i,j=0,k=0;\n scanf(\"%d\",&n);\n for(i=0;i\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 \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\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\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\n#include\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\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\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\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\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\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 \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\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 \n#include \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\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 \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\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\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\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!\" — he kept on repeating in his mind. — \"Let's take, say, Max, Ilya, Vova — here, they all know each other! And now let's add Dima and Oleg to Vova — 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 ≤ m ≤ 10), 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 ≤ ai, bi ≤ 5;ai ≠ bi), where (ai, bi) 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 \nint main()\n{\n int n, i, a[6]={0}, x, y;\n scanf(\"%d\", &n);\n for(i=0; i\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\n#include \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 \n#include \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 \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 \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\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 \n#include \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\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 \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 \n#include \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\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\n#include \n#include \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 \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 \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\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\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#include\nint main()\n{\n\tint m,i,a,b,x[10]={0};\n\tscanf(\"%d\",&m);\n \n\t\tfor(i=0;i5)\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\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 \n#include \nint r[5][5],i,j,k,n,p,q,z;\nmain()\n{\n scanf(\"%d\",&n);\n for(i=0;i\n#include \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\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\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\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 \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ón 3\n B - Friends\n A01208964 - Doménica Rentería\n*/\n\n#include \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úmero, si sale, se le suma al arreglo en su posición\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 \n#include \n#include \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 \n#include \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 \n#include \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= 3 || n2 >= 3 || n3 >= 3 || n4 >= 3 || n5 >= 3 ){\n printf(\"WIN\");\n }\n else printf(\"FAIL\");\n }\n\n}\n"}, {"source_code": "#include \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\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 \nint main()\n{\n int n, i, a[6]={0}, x, y;\n scanf(\"%d\", &n);\n for(i=0; i\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\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\n#include \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 \n#include \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 \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 \n#include \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\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 \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 \n#include \n#include \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 \n#include \n#include \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 \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ón 3\n B - Friends\n A01208964 - Doménica Rentería\n*/\n\n#include \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úmero, si sale, se le suma al arreglo en su posición\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ón 3\n B - Friends\n A01208964 - Doménica Rentería\n*/\n\n#include \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úmero, si sale, se le suma al arreglo en su posición\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ón 3\n B - Friends\n A01208964 - Doménica Rentería\n*/\n\n#include \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úmero, si sale, se le suma al arreglo en su posición\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 \n#include \n#include \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 \n#include \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 \n#include \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 \n#include \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 \n#include \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 \n#include \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 \n#include \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 \n#include \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 \n#include \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 \n#include \n#include \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 \n#include \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 \n#include \n#include \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 \n#include \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 \n#include \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= 3 || n2 >= 3 || n3 >= 3 || n4 >= 3 || n5 >= 3){\n printf(\"WIN\");\n }\n else printf(\"FAIL\");\n }\n\n}\n"}, {"source_code": "#include \n#include \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\n#include \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= 3 || n2 >= 3 || n3 >= 3 || n4 >= 3 || n5 >= 3){\n printf(\"WIN\");\n }\n else printf(\"FAIL\");\n }\n\n}\n"}, {"source_code": "#include \n#include \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\n#include \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\n#include \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 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 \n#include \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= 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 \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$$$) — 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 \n#include \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": "«One dragon. Two dragon. Three dragon», — 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, l, m, n and d, each number in a separate line (1 ≤ k, l, m, n ≤ 10, 1 ≤ d ≤ 105).", "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 \n#include \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\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\n#include\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 \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\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 \n#include \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 \n#include \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 \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\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\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\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\n#include\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 \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 =l)\n\t{\t\n\t\tfor (int i = 0; i =m)\t\n\t{\t\n\t\tfor (int i = 0; i =n)\n\t{\t\n\t\tfor (int i = 0; i \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\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\n#include\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\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 \n#include \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\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 \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\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 \n#include \n#include \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 \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 \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 \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\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\n#include\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\n#include \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\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\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\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\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\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 \nvoid sort(int *a,int n)\n{\tint i,j,t;\n\tfor(i=0;ia[j])\t\t\t//a[i]a[j]升序;\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]\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\n#include\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\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\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\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 \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\n#include\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 \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 \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\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 \n#include \n#include \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\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=0;i--){\n ar[i][1]=0;\n for(int j=0;j=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 \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\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\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 \n#include \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\n#include\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\n#include\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\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\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 \n#include \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\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\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\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\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\n#include\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 \n#include \n#include \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\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\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\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\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\n#include \n#include\n#include\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\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\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 \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\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 \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 \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 \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\n#include \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\n#include \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\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\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\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\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 \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\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 \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 \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\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\n#include\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\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\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\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\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 \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\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\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\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\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\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 \n#include \n#include \n#include \n#include \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\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\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\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\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\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 \n#include \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\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 \n#include \n#include \n#include \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\n#include\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\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\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\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 \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 \n#include \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\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\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\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\n#include \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 \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 \n#include \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\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\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\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\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\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 \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\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 \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\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;id && 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 \n#include \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 \n#include \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 \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 \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\n#include \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\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\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 l)\n\t{\t\n\t\tfor (int i = 0; i m)\t\n\t{\t\n\t\tfor (int i = 0; i n)\n\t{\t\n\t\tfor (int i = 0; i \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\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 \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\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 \n#include \n#include \n#include \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\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\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\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\n#include\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\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\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\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\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\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\n#include\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\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\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 && b=m && n\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\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\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\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\n#include \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#include \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\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 \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\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 \n#include \n#include \n#include \n#include \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 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 \n#include \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\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\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\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 \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\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;ii;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\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 \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\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\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 \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 (k1)\n cnt++;\n else if(gcd(l,k)==1&&l1)\n cnt++;\n else if(gcd(l,m)==1&&m1)\n cnt++;\n else if(gcd(m,k)==1&&n1)\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\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 \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\nint main()\n{\n\tint n,i,a[10005],len,max=0,cur;\n\tscanf(\"%d\",&n);\n\tfor (i=0;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 \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 \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\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\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 \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\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\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 \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\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;i0)\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\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\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 l)\n\t{\t\n\t\tfor (int i = 0; i m)\t\n\t{\t\n\t\tfor (int i = 0; i n)\n\t{\t\n\t\tfor (int i = 0; i \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 \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\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\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\n#include\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\nint main()\n{\n\tint n,i,a[10005],len,max=0,cur;\n\tscanf(\"%d\",&n);\n\tfor (i=0;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\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\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\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\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\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 \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 \n#include \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\n#include\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]\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 \n#include \n#include \n#include \n#include \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 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 × m chessboard, a very tasty candy and two numbers a and b.Dima put the chessboard in front of Inna and placed the candy in position (i, j) on the board. The boy said he would give the candy if it reaches one of the corner cells of the board. He's got one more condition. There can only be actions of the following types: move the candy from position (x, y) on the board to position (x - a, y - b); move the candy from position (x, y) on the board to position (x + a, y - b); move the candy from position (x, y) on the board to position (x - a, y + b); move the candy from position (x, y) on the board to position (x + a, y + b). Naturally, Dima doesn't allow to move the candy beyond the chessboard borders.Inna and the pony started shifting the candy around the board. They wonder what is the minimum number of allowed actions that they need to perform to move the candy from the initial position (i, j) to one of the chessboard corners. Help them cope with the task! ", "input_spec": "The first line of the input contains six integers n, m, i, j, a, b (1 ≤ n, m ≤ 106; 1 ≤ i ≤ n; 1 ≤ j ≤ m; 1 ≤ a, b ≤ 106). 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, j) in the statement is a chessboard cell on the intersection of the i-th row and the j-th column. You can consider that the corners are: (1, m), (n, 1), (n, m), (1, 1).", "output_spec": "In a single line print a single integer — 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 + 2, 3 + 2) = (3, 5), from there they can move it to positions (3 - 2, 5 + 2) = (1, 7) and (3 + 2, 5 + 2) = (5, 7). These positions correspond to the corner squares of the chess board. Thus, the answer to the test sample equals two."}, "positive_code": [{"source_code": "#include\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\n#include \n#include \n#include \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\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 \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(xx) 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\n#include \n#include \n\nint min(int x1,int x2){if(x1x2)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\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(no1no2)\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 \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 (ab) 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 \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\n#include\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 \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 \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 \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\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;ians[i])\n min=ans[i];\n \n printf(\"%ld\",min);\n return 0;\n}\n"}, {"source_code": "#include \n#include \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 \n#include \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\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(ab)\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\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(cnt1cnt4 && flg4==1){\n printf(\"Poor Inna and pony!\\n\");\n return 0;\n }\n if(cnt1cnt3 && flg3==1){\n printf(\"Poor Inna and pony!\\n\");\n return 0;\n }\n if(cnt2cnt4 && flg4==1){\n printf(\"Poor Inna and pony!\\n\");\n return 0;\n }\n if(cnt2\n#include\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\n#include\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 \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?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]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 \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\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=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 \n#include \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\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=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/ap)\n q=p;\n }\n if(k%a==0&&l%b==0&&k/a%2==l/b%2)\n {\n if(k/ap)\n q=p;\n }\n if(k1%a==0&&k2%b==0&&k1/a%2==k2/b%2)\n {\n if(k1/ap)\n q=p;\n }\n if(k3%a==0&&k4%b==0&&k3/a%2==k4/b%2)\n {\n if(k3/ap)\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 \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(xx) 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\n#include\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\n#include \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 \n#include \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 \n#include \nint mn(int a,int b){\n\tif(a==-1)return b;\n\tif(b==-1)return a;\n\treturn ab?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 \n#include \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\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 \n#include \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 \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 \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 (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\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 \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\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 \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 (ab) 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\n#include\n#include\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\n#include \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 \n#include \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 \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 \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 \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?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]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\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;ians[i])\n min=ans[i];\n \n printf(\"%ld\",min);\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\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\n#include \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 \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\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/ap)\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/ap)\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/ap)\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/ap)\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\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\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 \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 (ab) 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\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\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/ap)\n q=p;\n }\n if(k%a==0&&l%b==0&&k/a%2==l/b%2)\n {\n if(k/ap)\n q=p;\n }\n if(k1%a==0&&k2%b==0&&k1/a%2==k2/b%2)\n {\n if(k1/ap)\n q=p;\n }\n if(k3%a==0&&k4%b==0&&k3/a%2==k4/b%2)\n {\n if(k3/ap)\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\n#include\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\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 \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 \n#include \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 \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 (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 \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\n#include\n#include\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\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\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\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/ap)\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/ap)\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/ap)\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/ap)\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\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(ab)\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 \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 \n#include \n#include \n#include \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\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 \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 (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 \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\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\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\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\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/ap)\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/ap)\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/ap)\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/ap)\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\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/ap)\n q=p;\n }\n if(k%a==0&&l%b==0&&k/a%2==l/b%2)\n {\n if(k/ap)\n q=p;\n }\n if(k1%a==0&&k2%b==0&&k1/a%2==k2/b%2)\n {\n if(k1/ap)\n q=p;\n }\n if(k3%a==0&&k4%b==0&&k3/a%2==k4/b%2)\n {\n if(k3/ap)\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\n#include\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]\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/ap)\n q=p;\n }\n if(k%a==0&&l%b==0&&k/a%2==l/b%2)\n {\n if(k/ap)\n q=p;\n }\n if(k1%a==0&&k2%b==0&&k1/a%2==k2/b%2)\n {\n if(k1/ap)\n q=p;\n }\n if(k3%a==0&&k4%b==0&&k3/a%2==k4/b%2)\n {\n if(k3/ap)\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\n#include\n#include\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\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\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/ap)\n q=p;\n }\n if(k%a==0&&l%b==0&&k/a%2==l/b%2)\n {\n if(k/ap)\n q=p;\n }\n if(k1%a==0&&k2%b==0&&k1/a%2==k2/b%2)\n {\n if(k1/ap)\n q=p;\n }\n if(k3%a==0&&k4%b==0&&k3/a%2==k4/b%2)\n {\n if(k3/ap)\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 \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 (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\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 \n#include \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 \n#include \nint mn(int a,int b){\n\tif(a==-1)return b;\n\tif(b==-1)return a;\n\treturn ab?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\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/ap)\n q=p;\n }\n if(k%a==0&&l%b==0&&k/a%2==l/b%2)\n {\n if(k/ap)\n q=p;\n }\n if(k1%a==0&&k2%b==0&&k1/a%2==k2/b%2)\n {\n if(k1/ap)\n q=p;\n }\n if(k3%a==0&&k4%b==0&&k3/a%2==k4/b%2)\n {\n if(k3/ap)\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 \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 \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 \n#include \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 \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?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]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 \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\n#include\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 \n#include \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\n#include\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\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 \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 \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\n#include\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\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;ians[i])\n min=ans[i];\n \n printf(\"%ld\",min);\n return 0;\n}\n"}, {"source_code": "#include\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(ab)\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 \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 \n#include \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\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\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\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\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\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(mintopminright)\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(minbottomminright)\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(mintopminleft)\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(minbottomminleft)\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\n#include \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\n\nint max(int a,int b)\n{\n return a>b?a:b;\n}\nint min(int a,int b)\n{\n return aa || (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\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(x1)\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=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(x0)\n mini=brr[i];\n p=0;\n }\n if(brr[i]\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?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]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\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/ap)\n q=p;\n }\n if(k%a==0&&l%b==0&&k/a%2==l/b%2)\n {\n if(k/ap)\n q=p;\n }\n if(k1%a==0&&k2%b==0&&k1/a%2==k2/b%2)\n {\n if(k1/ap)\n q=p;\n }\n if(k3%a==0&&k4%b==0&&k3/a%2==k4/b%2)\n {\n if(k3/ap)\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 \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\n#include\n#include\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\n#include\n#include\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\n#include \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 \n#include \nint mn(int a,int b){\n\tif(a==-1)return b;\n\tif(b==-1)return a;\n\treturn ab?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 \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\n#include\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\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/ap)\n q=p;\n }\n if(k%a==0&&l%b==0&&k/a%2==l/b%2)\n {\n if(k/ap)\n q=p;\n }\n if(k1%a==0&&k2%b==0&&k1/a%2==k2/b%2)\n {\n if(k1/ap)\n q=p;\n }\n if(k3%a==0&&k4%b==0&&k3/a%2==k4/b%2)\n {\n if(k3/ap)\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 \n#include \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 \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\n#include\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\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\n#include\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]\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 \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 (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 \n#include \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\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\n#include \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\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 \n#include \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 — 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$$$) — 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\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=1 || n==1)\n printf(\"YES\");\n\n else\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include\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#include\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 j[s]){ p = j[s]; s[j] = *(s + i); *(s + i) = p;}\n }\n }\n printf(\"No\");\n}"}, {"source_code": "#include\n#include\n#include\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=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\n#include\n#include\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; ia[j]){\n temp=a[j];\n a[j]=a[i];\n a[i]=temp;\n }\n }\n }\n for(i=1; i1)\n break;}\n else m=1;\n }\n if(m==1) printf(\"No\");\n else printf(\"Yes\");\n }\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int i;\n scanf(\"%d\",&i); /**ȡ����i*/\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; x1) {flag=1; break;}\n }\n if(flag) printf(\"Yes\");\n else printf(\"No\");\n }\n return 0;\n\n\n}\n"}, {"source_code": "#include\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=max1||strlen(string)==1)\n printf(\"%s\\n\",\"Yes\");\n else\n printf(\"%s\\n\",\"No\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \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 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 \n#include \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= 2)num++;\n }\n if(num != 0)\n puts(\"Yes\");\n else\n puts(\"No\");\n return 0;\n}\n"}, {"source_code": "#include \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\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\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\n#include\n\nint x=0;\nint slot(char a[],int size){\n int temp;\n for(int i=0;ia[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 \nconst int M = 100001;\nconst int A = 26;\nint main(){\n int n,i,a[A],c=0; for(i=0;i1) 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\n#include\n\nint x=0;\nint slot(char a[],int size){\n int temp;\n for(int i=0;ia[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\n#include\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\n#include\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#include \n#include \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;jk && 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 \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;i1){\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 \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\n#include\n\nint x=0;\nint slot(char a[],int size){\n int temp;\n for(int i=0;ia[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\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#include\n#include\n#include\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 \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\n#include \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= 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\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\n#include\n\nint x=0;\nint slot(char a[],int size){\n int temp;\n for(int i=0;ia[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\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\n#include\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\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\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\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=2){\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "\n#include\n#include\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\n#include\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\n#include\n#include\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=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\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\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;i1){\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\n#include\nint possible(char *str,int n)\n{\n int i,j;\n for(i=0;i\n#include \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#include\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\n#include\n#include\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=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\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#include\n#include\n#include\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=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\n#include\n#include\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=2){evens++;}\n}\nif(evens>0 || l==1){\nprintf(\"YES\");\n}else{printf(\"NO\");}\nreturn 0;\n}\n"}, {"source_code": "#include\n#include\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;i27){\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\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\n#include \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\n#include\n#include\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; ia[j]){\n temp=a[j];\n a[j]=a[i];\n a[i]=temp;\n }\n }\n }\n for(i=1; i1)\n break;}\n else m=1;\n }\n if(m==1) printf(\"No\");\n else printf(\"Yes\");\n }\n}\n"}, {"source_code": "#include\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=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\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=max1||strlen(string)==1)\n printf(\"%s\\n\",\"Yes\");\n else\n printf(\"%s\\n\",\"No\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\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\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=2){\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include\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\n#include \n#include \n#include \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=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\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=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\n#include\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;i1){\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\n#include\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#include \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\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#include\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 0 || n==1)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include \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\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=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 \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= 2){\n flag= 1;\n }\n }\n\n if(flag)\n printf(\"YES\");\n else\n printf(\"NO\");\n}"}, {"source_code": "#include \n#include \n#include \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\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\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=2){\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\nint x=0;\nint slot(char a[],int size){\n int temp;\n for(int i=0;ia[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\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#include\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;i1){\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 \n#include\n#include\n#include\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=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\n#include\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\n#include\n#include\n#include\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(ab)\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;i1)\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 \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\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=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 \n#include \n#include \n#include \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 \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 1)\n {\n printf(\"Yes\\n\");\n return 0;\n }\n printf(\"No\\n\");\n return 0;\n\n}\n"}, {"source_code": "#include\n#include\n#include\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=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\n#include\n#include\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 \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\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#include\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 \n#include\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\n#include\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\n#include\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 \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\n#include\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\n#include\n#include\n#include\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(ab)\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;i1)\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\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#include \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 \n#include \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#include\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#include\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;i27){\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 \n#include \n#include \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;jk && 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\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=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\n#include\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\n#include\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;i1)\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 \nconst int M = 100001;\nconst int A = 26;\nint main(){\n int n,i,a[A],c=0; for(i=0;i1) 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\n#include\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#include\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\n#include \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= 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\n#include\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\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;i1){\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\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=1)\n printf(\"YES\");\n\n else\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \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 \n#include \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=1)\n goto h;\n }\n h:\n if(i==(n-1))\n printf(\"No\");\n else\n printf(\"Yes\");\n}"}, {"source_code": "#include \n#include \n#include \n#include \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\n#include\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\n#include\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;i1)\n {\n printf(\"No\\n\");\n }\n else\n {\n printf(\"Yes\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include \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\n\nint main()\n{\n int i;\n scanf(\"%d\",&i); /**ȡ����i*/\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; x1) {flag=1; break;}\n }\n if(flag) printf(\"Yes\");\n else printf(\"No\");\n }\n return 0;\n\n\n}\n"}, {"source_code": "#include \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= 2){\n flag= 1;\n }\n }\n if(flag)\n printf(\"YES\");\n else\n printf(\"NO\");\n}"}, {"source_code": "#include\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]1)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include \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#include\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#include\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\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= 2){\n flag= 1;\n }\n }\n if(flag)\n printf(\"YES\");\n else\n printf(\"NO\");\n}"}, {"source_code": "#include\n#include\nint possible(char *str,int n)\n{\n int i,j;\n for(i=0;i\n#include\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=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\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 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 \n#include \n#include \n#include \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\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#include\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\n#include\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=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\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=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\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\n\nint main()\n{\n int i;\n scanf(\"%d\",&i); /**ȡ����i*/\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; x1) {flag=1; break;}\n }\n if(flag) printf(\"Yes\");\n else printf(\"No\");\n return 0;\n\n\n}\n"}, {"source_code": "#include\n#include\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;i27){\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\n#include\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;i1)\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\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 \n#include \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\n#include\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;i1)\n { f=1;\n break;}\n }\n if(f==1)\n printf(\"yes\");\n else\n printf(\"no\");\n}\n"}, {"source_code": "#include\n#include\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\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\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\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=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\n\nint main()\n{\n int i;\n scanf(\"%d\",&i); /**ȡ����i*/\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; x1) {flag=1; break;}\n }\n if(flag) printf(\"Yes\");\n else printf(\"No\");\n\n return 0;\n\n\n}\n"}, {"source_code": "#include\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\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\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]=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\n#include\n#include\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\n#include \n#include \n#include \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\n#include\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;i27){\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\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;i1){\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\n#include\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 \n#include \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=1)\n goto h;\n }\n h:\n if(i==(n-1))\n printf(\"No\");\n else\n printf(\"Yes\");\n}"}, {"source_code": "#include\n#include\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\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]1)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include \n#include\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=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\n#include\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;i0)\n\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\nreturn 0;}\n"}, {"source_code": "#include\n#include \n#include \n#include \n#include \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#include\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\n#include\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 \n#include \n#include \n#include \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 \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 \n#include\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=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\n#include\n#include\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=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\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\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\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\nint main()\n{\n int i;\n scanf(\"%d\",&i); /**ȡ����i*/\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; x1) {flag=1; break;}\n }\n if(flag) printf(\"Yes\");\n else printf(\"No\");\n return 0;\n\n\n}\n"}, {"source_code": "#include\n#include\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;i1)\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 \n#include\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=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 \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 1)\n {\n printf(\"Yes\\n\");\n return 0;\n }\n printf(\"No\\n\");\n return 0;\n\n}\n"}, {"source_code": "#include \n#include\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=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\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#include\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\n#include\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\n#include\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\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]=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 \n#include\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=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 \n#include \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\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;i1)\n\t {\n\t printf(\"Yes\");\n\t return 0;\n\t }\n\t}\n\tprintf(\"No\");\n\treturn 0;\n}"}, {"source_code": "#include \n#include\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=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\n#include\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=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 \n#include\n#include\n#include\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\n#include\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\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 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\n#include\n#include\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=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 \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 1)\n {\n printf(\"Yes\\n\");\n return 0;\n }\n printf(\"No\\n\");\n return 0;\n\n}\n"}, {"source_code": "#include\n#include\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\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 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\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\nint main()\n{\n int i;\n scanf(\"%d\",&i); /**ȡ����i*/\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; x1) {flag=1; break;}\n }\n if(flag) printf(\"Yes\");\n else printf(\"No\");\n\n return 0;\n\n\n}\n"}, {"source_code": "#include\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#include \n#include \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;jk)\n {\n printf(\"YES\");\n }\n if(n==k)\n {\n printf(\"NO\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n#include \n#include \n#include \n#include \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#include\n#include\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=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\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=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 \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 \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\n\nint main()\n{\n int i;\n scanf(\"%d\",&i); /**ȡ����i*/\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; x1) {flag=1; break;}\n }\n if(flag) printf(\"Yes\");\n else printf(\"No\");\n return 0;\n\n\n}\n"}, {"source_code": "#include\n#include\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#include\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#include \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 \n#include \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 \n#include \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\n\nint main()\n{\n int i;\n scanf(\"%d\",&i); /**ȡ����i*/\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; x1) {flag=1; break;}\n }\n if(flag) printf(\"Yes\");\n else printf(\"No\");\n\n return 0;\n\n\n}\n"}, {"source_code": "#include\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#include\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;i0)\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\n#include\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 \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 \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 \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 \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\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 \n#include \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 \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 \n#include \n#include \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]\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 \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=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=5)\n {\n printf(\"%d0:0%d\",a+1,a+1);\n }\n if(a==2 && b<3)\n {\n if(c=3)\n {\n if(c\n#include \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\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 \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\n#include\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 \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 \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 \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[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\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\n#include\n#include\n#include\n#include\n#include\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;ii5 and x<10){\n printf(\"10:01\");\n return 0;\n}\nif(s=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 \n#include \n#include \n#include \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\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\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 \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\n#include\n#include\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 \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 \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\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 \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\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 \n#include \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 \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\n#include\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\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 \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\n#include\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\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\n#include\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 \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 \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 \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 \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\n#include\n#include\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 \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=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\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\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\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 \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\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\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 \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[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 \n#include \n#include \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(sumamsumam)\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\n#include\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\n#include\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 \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\n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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(sumamsumam)\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 \n#include \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\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&&n210)\n printf(\"%d:%d\\n\",p,n1);\n else if(n2\n#include \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=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\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\n#include\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 \n#include \n#include \n#include \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 \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 \n#include \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 \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\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\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 \n#include \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=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\n#include\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\n#include\n#include\n#include\n#include\n#include\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;ii5 and x<10){\n printf(\"10:01\");\n return 0;\n}\nif(s=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 \n#include \n#include \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 \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 \n#include \n#include \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 \n#include \n#include \n#include \n#include \n#define si(n) scanf(\"%d\",&n)\n#define rep(i,n) for(i=0;i %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 \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\n#include\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\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 \n#include \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\n#include\n#include\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 \n#include \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 \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 \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 \n#include \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\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 \n#include \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\n#include\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=5)\n\t{\n\t\tif(y==5&&p\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\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\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 \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\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 \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 \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\n#include\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\n#include\n#include\n#include\n#include\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 \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\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\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\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\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 \n#include \n#include \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 \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\n#include\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=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 \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 \n#include \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\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 \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 \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 \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\n#include \n#include \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\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\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\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\n#include\n#include\n#include\n#include\n#include\n//#include\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 \n#include \n#include \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(sumahauxpalin)\n {\n sig=1;\n palin=0;\n }\n else if(sumam==auxpalin)\n {\n sig=1;\n palin=0;\n }\n else if(sumamsumam)\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 \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\n#include\n#include\n#include\n#include\n#include\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=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 \n#include \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 \n#include \n#include \n#include \n#include \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=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\n#include\n#include\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 \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[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\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\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\n#include \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\n#include \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\n#include\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 \n#include \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 \n#include \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=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\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]=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\n#include\n#include\n#include\n#include\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\n#include\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\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\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 \n#include \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 \n#include \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\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\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 \n#include \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 \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 \n#include \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\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 \n#include \n#include \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 \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\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 \n#include\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 \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[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 \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=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 \n#include \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\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]=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\n#include\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\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\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\n#include \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\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]\n#include \n#include \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\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 \n#include \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\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 \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 \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 \n#include \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\n#include\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\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\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 \n#include \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\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 \n#include \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\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 \n#include \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=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 \n#include \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\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 \n#include\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 \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 \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\n#include \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\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\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\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\n#include\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\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\n#include\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\n#include\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 \n#include \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\n#include\n#include\n#include\n#include\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\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]=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 \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=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=5)\n {\n printf(\"%d0:0%d\",a+1,a+1);\n }\n if(a==2 && b<3)\n {\n if(c=3)\n {\n if(c<=b && d\n#include\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\n#include\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 \n#include \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=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\n#include\n#include\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 \n#include \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\n#include\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:%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\n#include\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 \n#include \n#include \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 \n#include \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 \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\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 \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 — 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’ 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 \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 \n#include \nint max(int a,int b){\n\treturn a>b?a:b;\n}\nint min(int a,int b){\n\treturn ad))k=1;\n\t\n\tprintf(k?\"YES\":\"NO\");\n}\n"}, {"source_code": "#include \n#include \n#include \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\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\n#include\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 \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 \n#include \n#include \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 \n#include \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 \n#include \nint max(int a,int b){\n\treturn a>b?a:b;\n}\nint min(int a,int b){\n\treturn ad))k=1;\n\t\n\tprintf(k?\"YES\":\"NO\");\n}"}, {"source_code": "#include \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\n#include \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 \n#include \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(cb){\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 \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \n#include \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 \n#include \n#include \n#include \n#include \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 \n#include \n#include \n#include \n#include \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-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 \n#include \n#include \n#include \n#include \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 \n#include \n#include \n#include \n#include \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\n#include\n#include\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)\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\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 \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\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 \n#include \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\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 \n#include \n#include \n#include \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\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 \n#include \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 \n#include \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\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\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(bc){\n printf(\"YES\\n\");\n return 0;\n }\n if(ac&&b>d){\n printf(\"NO\\n\");\n return 0;\n }\n if(a>c&&bc){\n printf(\"YES\\n\");\n return 0;\n }\n if(ad){\n printf(\"YES\\n\");\n return 0;\n }\n if(b\n#include \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\n#include\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 \n#include \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\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\n#include\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\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 \n#include \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\n#include\n#include\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)\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\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 \n#include \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 \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 \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 \n#include \n#include \n#include \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\n#include\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 \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\n#include\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 \n#include \n#include \n#include \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\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 \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\n#include\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\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 \n#include \n#include \n#include \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 \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\n#include\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\n#include\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 \n#include \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 \n#include \nint max(int a,int b){\n\treturn a>b?a:b;\n}\nint min(int a,int b){\n\treturn ad))k=1;\n\t\n\tprintf(k?\"YES\":\"NO\");\n}"}, {"source_code": "#include\n#include\n#include\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\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 \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 \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 \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; icheck2)\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\n#include\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 \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\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'\n#include\n#include\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)\n#include\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 \n#include \n#include \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\n#include \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\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(bc){\n printf(\"YES\\n\");\n return 0;\n }\n if(ac&&b>d){\n printf(\"NO\\n\");\n return 0;\n }\n if(a>c&&bc){\n printf(\"YES\\n\");\n return 0;\n }\n if(ad){\n printf(\"YES\\n\");\n return 0;\n }\n if(b\n#include\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\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\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\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 \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 \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 \n#include \n#include \n#include \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 \n#include \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 \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 \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\n#include \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(cb){\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 \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \n#include \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 \n#include \n#include \n#include \n#include \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 \n#include \n#include \n#include \n#include \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-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 \n#include \n#include \n#include \n#include \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 \n#include \n#include \n#include \n#include \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 \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 \n#include \n#include \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 \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 \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\n#include\n#include\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 \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\n#include\n#include\n#include\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 \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\n#include\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 \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 \n#include \n#include \n#include \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 \n#include \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 \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\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\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\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\n#include\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\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 \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\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 \n#include \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\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\n#include\n#include\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\n#include\n#include\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 \n#include \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 \n#include \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 \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\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(ad){\n printf(\"YES\\n\");\n return 0;\n }\n if(b\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\n#include\n#include\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 \n#include \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 \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 \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 \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\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 \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 \n#include \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 \n#include \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\n#include\n#include\n#include\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\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 \n#include \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 \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 \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 \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 \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\n#include\n#include\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\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 \n#include \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 \n#include \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\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 \n#include \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 \n#include \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 \n#include \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 \n#include \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 \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 \n#include \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 \n#include \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\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 \n#include \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\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 \n#include \n#include \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 \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 \n#include \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 \n#include \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 \n#include \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 \n#include \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\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\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 \n#include \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 \n#include \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 \n#include \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 \n#include \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\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\n#include\n#include\n#include\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\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\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 \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\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 \n#include \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 \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\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\n#include\n#include\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 \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\n#include\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 \n#include \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 \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\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\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 \n#include \n#include \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 \n#include \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\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 \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\n#include\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\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]\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(bc){\n printf(\"YES\\n\");\n return 0;\n }\n if(ac){\n printf(\"YES\\n\");\n return 0;\n }\n if(ad){\n printf(\"YES\\n\");\n return 0;\n }\n if(b\n#include \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 \n#include \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 \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 \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 \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\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\n#include\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\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\n#include\n#include\n#include\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 \n#include \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\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\n#include\n#include\n#include\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\n#include\n#include\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\n#include\n#include\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\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 \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 \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 \n#include \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\n#include\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 \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 \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\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'\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(bc){\n printf(\"YES\\n\");\n return 0;\n }\n if(ac&&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(ad){\n printf(\"YES\\n\");\n return 0;\n }\n if(b\n#include \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 \n#include \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 \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 - 1 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 - 1, 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 – 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 – 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 ≤ N ≤ 109).", "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\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 \n#include \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\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\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\n#include\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\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\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\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 \n#include \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\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\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"%d\",(n+1)/2);\n return 0;\n}"}, {"source_code": "#include\n#include\n#include\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\n#include\n#include\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\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 \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\n#include\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 \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 \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\nint main()\n{\n\tint t;\n\tscanf(\"%d\",&t);\n\tprintf(\"%d\",(t+1)/2);\n\treturn 0;\n}"}, {"source_code": "#include\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\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 \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 \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\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 \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\n#include\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\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\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\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\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 \n#include \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\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 \nint main(void) {\n\tint n;\n\tscanf(\"%d\", &n);\n\tprintf(\"%d\", (n + 1) / 2);\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n#include \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 \n#include \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\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\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\n#include\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\n\n\nint main(){\n\tint x;\n\tscanf(\"%d\",&x);\n\tprintf(\"%d\",(x+1)/2);\n}"}, {"source_code": "#include \n#include \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 \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\n#include\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\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\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 \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 \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\n#include\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 \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 \n#include \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 \n#include \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\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\n#include\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 \n#include \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\n#include\n#include\n#include\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\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\n#include\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\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 \n \n int main() {\n int num ;\n scanf(\"%d\", &num) ;\n printf(\"%d\", (num+1) >> 1) ;\n return 0;\n }"}, {"source_code": "#include \n \nint main() {\n int num ;\n scanf(\"%d\", &num) ;\n printf(\"%d\", (num+1)/2) ;\n return 0;\n}"}, {"source_code": "#include\n#include\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 \n#include \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\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\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 \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\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\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\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\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\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\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 \n#include \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\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\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\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\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\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 \n#include \n#include \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 \n#include \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 \n#include \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\n#include\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\nint main()\n{\n long int n;\n scanf(\"%ld\",&n);\n printf(\"%ld\\n\",n/2);\n return 0;\n}"}, {"source_code": "#include\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\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\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\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 \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 \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 \n#include \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\n#include\n#include\n#include\n#include\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 \n\nint main() {\n int num ;\n scanf(\"%d\", &num) ;\n printf(\"%d\", (num+1)%2) ;\n return 0;\n}"}, {"source_code": "#include \n#include \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$$$) — 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 — 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 \n#include \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 ≤ n ≤ 109).", "output_spec": "Output the only number — 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\n#define N 20\nint main()\n{\n long int n;\n int num[20],i,j,k = 0,count1; /*k用来记录输入整数的位数*/\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表示位数,这样做的目的是将输入整数的各位数储存在一维数组中*/\n if(num[k - 1] > 1) /*最高位大于1的情况*/\n {\n count1 = Index(k) - 1;\n }\n else\n {\n count1 = Index(k - 1) - 1; /*低一位及以下之和*/\n for(j = k - 2;j > 0;j--) /*k-1表示的是最高位*/\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) /*上述循环非正常退出*/\n {\n printf(\"%d\\n\",count1);\n k = 0; /*最后k要置0*/\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; /*最后k要置0*/\n }\n\n return 0;\n}\nint Index(int n) /*用于求2^n的函数*/\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 \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\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 \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\n#include\n#include\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 \n#include \n#include \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'1'){\n\t\t\tfor(j = i+1; j0 && n[i] == '1'){\n\t\t\tn[i]='0';\n\t\t\tfor(j = i+1; j'1'){\n\t\t\tn[i] = '1';\n\t\t\tfor(j = i+1; j\n#include \n#include \nint po(int a,int b){\n\tint q,w;\n\tw=a;\n\tfor (q=1;q=10;i= (int)i/10,j++);\n\t//for(i=j;)\n\tfor(i=0;i0)\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 \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<\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\n#include\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\n#include\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=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 \n#include \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\n#include\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 \n#include \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'1')\n {\n for(j=i; j=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 \n#include \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 \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 \n#include\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 \n#include\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 \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 \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\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 \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 \n #include \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=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 \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=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 \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<\n#include\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\n#include\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\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 \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 \n#include \n#include \n#include \n#include \n\n/*───▄▀▀▀▄▄▄▄▄▄▄▀▀▀▄───\n ───█▒▒░░░░░░░░░▒▒█───\n ────█░░█░░░░░█░░█────\n ─▄▄──█░░░▀█▀░░░█──▄▄─\n █░░█─▀▄░░░░░░░▄▀─█░░█*/\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 \n#include \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\n#include\n#include\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\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\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 \n#include \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'1')\n {\n for(j=i; j=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\n#include\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; i1)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t}\n\tfor(j=i; j=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\n#include\n#include\n#include\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=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\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 \n#include \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\nint x,cont; // couldnt type count for some reason\nint waw(int n){\n if(x\n//#include\n#include\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 \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\n#include\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;i1&&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 \n#include \n#include \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 \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 \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 \n#include \n#include \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\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 \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 \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\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 \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<\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 \n#include \n#include \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'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 \n#include \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\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=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\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=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 \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 \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\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 //想法一,直接判断\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 //这样做可以减少很多工作量\n //还可以进一步减少工作量就是只差找到11111\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 \n#include \n#include \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égzõdik */\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 \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 \n#include \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 \n#include \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 \n#include \n#include \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 \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\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 \n#include \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\n#include\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 \n#include \n#include \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;i0){\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\n#include\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\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<\n#include\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\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\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 \n#include \n#include \n#include \n#include \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\n#include\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 \n#include \n#include \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'1')\n\t\t\tfor(j = i+1; j\n#include \n#include \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\n#include \n#include \nint po(int a,int b){\n\tint q,w;\n\tw=a;\n\tfor (q=1;q=10;i= (int)i/10,j++);\n\t//for(i=j;)\n\tfor(i=0;i0)\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 \n#include \n#include \nint po(int a,int b){\n\tint q,w;\n\tw=a;\n\tfor (q=1;q=10;i= (int)i/10,j++);\n\t//for(i=j;)\n\tfor(i=0;i0)\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 \n#include \n#include \nint po(int a,int b){\n\tlong long q,w;\n\tw=a;\n\tfor (q=1;q=10;i= (int)i/10,j++);\n\t//for(i=j;)\n\tfor(i=0;i0)\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 \n#include \n#include \nint po(int a,int b){\n\tint q,w;\n\tw=a;\n\tfor (q=1;q=10;i= (int)i/10,j++);\n\t//for(i=j;)\n\tfor(i=0;i0)\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 \n#include \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 \n#include \n#include \nint po(int a,int b){\n\tint q,w;\n\tw=a;\n\tfor (q=1;q=10;i= (int)i/10,j++);\n\t//for(i=j;)\n\tfor(i=0;i0)\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 \n#include \n#include \nint po(int a,int b){\n\tint q,w;\n\tw=a;\n\tfor (q=1;q=10;i= (int)i/10,j++);\n\t//for(i=j;)\n\tfor(i=0;i0)\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 \n#include \n#include \nint po(int a,int b){\n\tlong long q,w;\n\tw=a;\n\tfor (q=1;q=10;i= (int)i/10,j++);\n\t//for(i=j;)\n\tfor(i=0;i0)\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\n#include\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 \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 \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 \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 \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 \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 \n#include \n#include \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\n#include\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 \n#include \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\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 \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=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 \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=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\n#include\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\n#include\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 \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\n#include\n#include\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\n#include\n#include\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\n#include\n#include\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\n#include\n#include\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\n#include\n#include\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 \n#include \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'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\n#include\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; i1)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t}\n\tfor(j=i; j\n#include\n#include\n#include\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\n#include\n#include\n#include\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\n#include \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 \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\n#include\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 \n#include \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 \n#include \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 \n#include \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 \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \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 (tx[best]) besttime=t,best=i;\n\t}\n\tprintf(\"%i\\n\",best);\n\treturn 0;\n}\n"}, {"source_code": "#include\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\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 \n#include \n#include \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\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=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 \n#include \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 \n#include \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\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\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 \n#include \n#include \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;i0){\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\n#include \n#include \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;i0){\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\n#include \n#include \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;i0){\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\n#include \n#include \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;i0){\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\n#include \n#include \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 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\n#include \n#include \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;i0){\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\n#include \n#include \n#include \n#include \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 — 201510 = 111110111112. 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 ≤ a ≤ b ≤ 1018) — the first year and the last year in Limak's interval respectively.", "output_spec": "Print one integer – 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 = 1012, 610 = 1102, 710 = 1112, 810 = 10002, 910 = 10012 and 1010 = 10102. Two of them (1012 and 1102) have the described property."}, "positive_code": [{"source_code": "#include\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<\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": "/* بِسْمِ اللهِ الرَّحْمٰنِ الرَّحِيْمِ */\n/* رَّبِّ زِدْنِى عِلْمًا */\n\n\n\n#include \n#include \n#include \n#include \n#include \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=num)\n return i;\n }\n\n}\n"}, {"source_code": "#include \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\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=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\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\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 \n#include \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 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 \n#include \n#include \n#include \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 \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\n#include\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 \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\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;i0)\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\n#include\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=c)&&(a[i]<=b))\n ret++;\n }\n if(c<=1){\n ret--;\n }\n printf(\"%d\\n\",ret);\n}"}, {"source_code": "#include\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=a&&arr[i]<=b)\n num++;\n }\n printf(\"%I64d\\n\",num);\n return 0;\n}\n"}, {"source_code": "#include \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\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;i0)&&(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 \n#include \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\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\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=1;a--){\nx=powx(2,a)-1;\ninc=1;\nfor(b=1;b=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\n#include\n#include\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=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\n#include\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 \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 \n#include \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]pow(10,18))\n // printf(\"1\");\n}\n"}, {"source_code": "#include \n#include \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; p0; 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= 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 \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 \n#include \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 \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 \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 \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 \n#include \n#include \n#include \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\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=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\n#include\n#include\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=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\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=0;j--)a[j]=1;\n for(j=i+1;j \n#include \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 \n#include\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=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\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\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 \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=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=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": "//我服了这个问题了,我需要做得很精细!\n#include\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//读入起始年份和结束年份\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//获得起始年份和结束年份的二进制位数\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//计算分两种情况\n\t//情况一first year 与 last year 的二进制位数相同!\n\t//情况二first year 与 last year 的二进制位数不相同!\n\t//变量不初始化,问题比较严重!\n\tunsigned long long possible;//没有初始化这个变量为什么会出现不同编译器的不同解答?\n\tunsigned long long base;\n\tunsigned long long one=1;//我所有的二进制操作都必须在64位上进行!\n\t//而且我所有的比较都必须是64位unsigned long long数据之间的比较\n\t//如果是long long之间的比较可能会出问题\n\t//就是我产生的可能是signed long long下的负数,负数之间比较就无法得到我想要的结果!\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 && 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//分三个部分计算\n\t\t//第一部分与first year二进制位数相同的有多少个!\n\t\t//第二部分与last year二进制位数相同的有多少个!\n\t\t//第三部分在first year与last year之间的二进制位数有多少个!\n\t\tunsigned long long part1=0;\n\t\tbase=0;//我忽略了这个条件!\n\t\tfor(i=0;i=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\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//读入起始年份和结束年份\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//获得起始年份和结束年份的二进制位数\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//计算分两种情况\n\t//情况一first year 与 last year 的二进制位数相同!\n\t//情况二first year 与 last year 的二进制位数不相同!\n\t//变量不初始化,问题比较严重!\n\tunsigned long long possible=0;\n\tunsigned long long base=0;\n\tunsigned long long one=1;//我所有的二进制操作都必须在64位上进行!\n\t//而且我所有的比较都必须是64位unsigned long long数据之间的比较\n\t//如果是long long之间的比较可能会出问题\n\t//就是我产生的可能是signed long long下的负数,负数之间比较就无法得到我想要的结果!\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 && 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//分三个部分计算\n\t\t//第一部分与first year二进制位数相同的有多少个!\n\t\t//第二部分与last year二进制位数相同的有多少个!\n\t\t//第三部分在first year与last year之间的二进制位数有多少个!\n\t\tunsigned long long part1=0;\n\t\tfor(i=0;i=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\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\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 \n#include \n#include \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=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 \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\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 \n#include \n#include \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= 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\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]\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]\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 \n#include \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<=a)&&(x<=b))\n\t\t\tcount++;\n\t\t}\n\t}\n\tprintf(\"%d \\n\",count);\n\treturn 0;\n}"}, {"source_code": "#include\n#include\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=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 \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 \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 \n#include \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=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 \n#include \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 \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 \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\n#include \n#include \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\n\nint max(int a , int b){return a>b?a:b;}\nint min(int a , int b){return a=0;j--){\n\t\t\tar[len++]=x^((long long)1<>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 \n#include \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 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\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\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<=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 \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\n#include\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=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\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\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 \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 \n#include \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\n#include\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&&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 \n#include \n#include \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 \n#include \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 \n#include \n#include \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=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 \n#include \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\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<=a && num<=b)count++;\n }\n\n }\n printf(\"%d\",count);\n return 0;\n\n}\n"}, {"source_code": "#include \n#include \n#include \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\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=a && xn<=b)res++;\n n<<=1;\n }\n if(num2>num1)\n {\n n=1;\n for(i=num1;i=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\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=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\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&&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\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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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\n#include\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\n#include\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\n#include\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\n#include\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 \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 \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\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;i0;i--){\n if (num2[i]==1) n2++;\n else break;\n }\n i=len2-1;\n for(i=0;i \n#include \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\n#include\n#include\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\n#include\n#include\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\n#include\n#include\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\n#include\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 \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 \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 \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\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=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\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=0;j--)a[j]=1;\n for(j=i+1;j \n#include \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 \n#include \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\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\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": "//我服了这个问题了,我需要做得很精细!\n#include\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//读入起始年份和结束年份\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//获得起始年份和结束年份的二进制位数\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//计算分两种情况\n\t//情况一first year 与 last year 的二进制位数相同!\n\t//情况二first year 与 last year 的二进制位数不相同!\n\t//变量不初始化,问题比较严重!\n\tunsigned long long possible;//没有初始化这个变量为什么会出现不同编译器的不同解答?\n\tunsigned long long base;\n\tunsigned long long one=1;//我所有的二进制操作都必须在64位上进行!\n\t//而且我所有的比较都必须是64位unsigned long long数据之间的比较\n\t//如果是long long之间的比较可能会出问题\n\t//就是我产生的可能是signed long long下的负数,负数之间比较就无法得到我想要的结果!\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 && 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//分三个部分计算\n\t\t//第一部分与first year二进制位数相同的有多少个!\n\t\t//第二部分与last year二进制位数相同的有多少个!\n\t\t//第三部分在first year与last year之间的二进制位数有多少个!\n\t\tunsigned long long part1=0;\n\t\t//base=0;//我忽略了这个条件!\n\t\tfor(i=0;i=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\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//读入起始年份和结束年份\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//获得起始年份和结束年份的二进制位数\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//计算分两种情况\n\t//情况一first year 与 last year 的二进制位数相同!\n\t//情况二first year 与 last year 的二进制位数不相同!\n\tunsigned long long possible;\n\tunsigned long long base;\n\tunsigned long long one=1;//我所有的二进制操作都必须在64位上进行!\n\t//而且我所有的比较都必须是64位unsigned long long数据之间的比较\n\t//如果是long long之间的比较可能会出问题\n\t//就是我产生的可能是signed long long下的负数,负数之间比较就无法得到我想要的结果!\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 && 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//分三个部分计算\n\t\t//第一部分与first year二进制位数相同的有多少个!\n\t\t//第二部分与last year二进制位数相同的有多少个!\n\t\t//第三部分在first year与last year之间的二进制位数有多少个!\n\t\tunsigned long long part1=0;\n\t\tfor(i=0;i=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\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//读入起始年份和结束年份\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//获得起始年份和结束年份的二进制位数\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//计算分两种情况\n\t//情况一first year 与 last year 的二进制位数相同!\n\t//情况二first year 与 last year 的二进制位数不相同!\n\tunsigned long long possible;\n\tunsigned long long need;\n\tunsigned long long one=1;//我所有的二进制操作都必须在64位上进行!\n\t//而且我所有的比较都必须是64位unsigned long long数据之间的比较\n\t//如果是long long之间的比较可能会出问题\n\t//就是我产生的可能是signed long long下的负数,负数之间比较就无法得到我想要的结果!\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 && 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//分三个部分计算\n\t\t//第一部分与first year二进制位数相同的有多少个!\n\t\t//第二部分与last year二进制位数相同的有多少个!\n\t\t//第三部分在first year与last year之间的二进制位数有多少个!\n\t\tunsigned long long part1=0;\n\t\tint i;\n\t\tfor(i=0;i=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\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//读入起始年份和结束年份\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//获得起始年份和结束年份的二进制位数\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//计算分两种情况\n\t//情况一first year 与 last year 的二进制位数相同!\n\t//情况二first year 与 last year 的二进制位数不相同!\n\tunsigned long long possible;\n\tunsigned long long need;\n\tunsigned long long one=1;//我所有的二进制操作都必须在64位上进行!\n\t//而且我所有的比较都必须是64位unsigned long long数据之间的比较\n\t//如果是long long之间的比较可能会出问题\n\t//就是我产生的可能是signed long long下的负数,负数之间比较就无法得到我想要的结果!\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 && 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//分三个部分计算\n\t\t//第一部分与first year二进制位数相同的有多少个!\n\t\t//第二部分与last year二进制位数相同的有多少个!\n\t\t//第三部分在first year与last year之间的二进制位数有多少个!\n\t\tunsigned long long part1=0;\n\t\tint i;\n\t\tfor(i=0;i=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\n#include \n#include \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=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 \n#include \n#include \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= 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\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]\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\n#include \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 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\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<=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\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<=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 \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 \n#include \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 \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 \n#include \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 \n#include \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 \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 \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 \n#include \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 \n#include \n#include \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=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,  aj) value among all 1 ≤ i < j ≤ n. For n ≤ 1 weirdness is equal to 0, gcd(x,  y) 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,  j) is weirdness of the new array a obtained by removing all elements between i and j inclusive, so new array is [a1... ai - 1, aj + 1... 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 ≤ n ≤ 200 000) — the number of elements in a. The next line contains n integers ai (1 ≤ ai ≤ 200 000), 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,  1) is equal to 3. f(2,  2) is equal to 1. f(3,  3) is equal to 2. f(1,  2), f(1,  3) and f(2,  3) are equal to 0. Thus the answer is 3 + 0 + 0 + 1 + 0 + 2 = 6."}, "positive_code": [{"source_code": "#include\n#include\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(hiki||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=loki?x->ki:lo;\n\t\trr=hi>x->ka?x->ka:hi;\n\t\tif(rrval;\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(hiki||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(h1;--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\n#include\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(hiki||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=loki?x->ki:lo;\n\t\trr=hi>x->ka?x->ka:hi;\n\t\tif(rrval=%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(hiki||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(h1;--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\n#include\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(hiki||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=loki?x->ki:lo;\n\t\trr=hi>x->ka?x->ka:hi;\n\t\tif(rrval=%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(hiki||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]\n#include\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(hiki||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=loki?x->ki:lo;\n\t\trr=hi>x->ka?x->ka:hi;\n\t\tif(rrval=%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(hiki||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]\n#include\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(hiki||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=loki?x->ki:lo;\n\t\trr=hi>x->ka?x->ka:hi;\n\t\tif(rrval=%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(hiki||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(h1;--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\n#include\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(hiki||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=loki?x->ki:lo;\n\t\trr=hi>x->ka?x->ka:hi;\n\t\tif(rrval=%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(hiki||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]\n#include\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(hiki||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=loki?x->ki:lo;\n\t\trr=hi>x->ka?x->ka:hi;\n\t\tif(rrval=%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(hiki||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(h1;--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\n#include\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(hiki||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=loki?x->ki:lo;\n\t\trr=hi>x->ka?x->ka:hi;\n\t\tif(rrval=%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(hiki||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(h1;--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\n#include\n#include\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\n#include\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\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\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\nint main()\n{\n int n,m,i,x=2;\n scanf(\"%d%d\",&n,&m);\n char ch;\n for(i=0;i\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#include\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\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\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//打倒毒瘤数据!"}, {"source_code": "#include \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\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 \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\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 0) printf(\"#Color\");\n\telse printf(\"#Black&White\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \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\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 0) printf(\"#Color\");\n\telse printf(\"#Black&White\");\n\n\treturn 0;\n}\n"}, {"source_code": "# include\n# include\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\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; i0){\n printf(\"#Color\\n\");\n return 0;\n }\n\n printf(\"#Black&White\\n\");\n\n}\n"}, {"source_code": "#include \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(i0){\n printf(\"#Black&White\");\n }\n else if(a>0){\n printf(\"#Color\");\n }\n\treturn 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n\tint m,n,i,j;\n\tscanf(\"%d%d\",&m,&n);\n\tchar pic;\n\tfor(i=0;i\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\n#include \n#include \n#include \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 \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\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\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 \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#include\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#include\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\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\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\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\n#include\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\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\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 \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\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\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\n#include\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#include \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#include\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\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#include\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\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\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\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 \n#include \n#include \n\nint main(){\n int m,n;\n scanf(\"%d %d\\n\", &m, &n);\n char c;\n for(int j=0 ; j\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\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\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\n#include \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\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\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; i0)\n printf(\"#Color\\n\");\n if(c==0)\n printf(\"#Black&White\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\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\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\nint main()\n{\n\tint m,n,i,j;\n\tscanf(\"%d%d\",&m,&n);\n\tchar pic;\n\tfor(i=0;i\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\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\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\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\nint main(){\n int n,x,i,c=0;\n char ara;\n scanf(\"%d %d\",&n,&x);\n for(i=0;i0){\n printf(\"#Color\\n\");\n }\n else{\n printf(\"#Black&White\\n\");\n }\nreturn 0;\n}\n"}, {"source_code": "#include\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\nint main() {\n int n,m,i,j;\n scanf(\"%d%d\",&n,&m);\n char s[n][m];\n for(i=0;i\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\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\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 \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 \n#include \n#include \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\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\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\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\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\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\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\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\n#include\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\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\n#include\n#include \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\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 \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\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\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\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#include \n#include \n#include \n#include \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#include\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# include\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\n#include\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\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=1)\n\t\tprintf(\"#Color\");\n\telse\n\t\tprintf(\"#Black&White\");\n}\n"}, {"source_code": "#include\n#include\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\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\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\n#include \n#include \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\n#include\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\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\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\n#include\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;i0)\n printf(\"#Color\\n\");\n else\n printf(\"#Black&White\\n\");\n}\n"}, {"source_code": "#include \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#include \n#include \n#include \n#include \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\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\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\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\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\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\n#include\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\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\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 \n#include \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\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\n# include\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\nint main()\n{\n int n,m,i,x;\n scanf(\"%d%d\",&n,&m);\n char ch;\n for(i=0;i\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\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\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\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#include\n#include\n#include\n#include\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\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\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\n#include\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\n#include\n#include\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\nint main()\n{\n int n,m,i,x;\n scanf(\"%d%d\",&n,&m);\n char ch;\n for(i=0;i\n#include \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#include\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\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\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\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\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\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;i0)\n {\n \tprintf(\"#Color\\n\");\n }\n else if(count==0)\n {\n \tprintf(\"#Black&White\\n\");\n }\n}\n\n"}, {"source_code": "#include\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\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;l0){\n printf(\"#Black&White\");\n}\n\nelse{\n printf(\"#Color\");\n}\n\n\nreturn 0;\n}\n"}, {"source_code": "#include\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\nint main()\n{\nint n,m,i,j,x=0;\nscanf(\"%d%d\",&n,&m);\nchar s[n][m];\nfor(i=0;i\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\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;i1)\n printf(\"#Color\\n\");\n else\n printf(\"#Black&White\\n\");\n return 0;\n}"}, {"source_code": "#include \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(i0){\n printf(\"#Black&White\");\n }\n else if(a>0){\n printf(\"#Color\");\n }\n\treturn 0;\n}\n\n"}, {"source_code": "#include \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\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\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\n#include\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\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\nint main()\n{\n int p,q,count=0;\n scanf(\"%d %d\",&p,&q);\n char t;\n for(int i=0;i\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#include\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\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\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\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\nint main()\n{\n int a,s;\n long long int count=0;\n char p;\n for(int i=0;i\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;i0)\n printf(\"#Color\");\n else\n printf(\"#Black&White\");\n}\n\n"}, {"source_code": "#include\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\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\n#include\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\n#include\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\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\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;i0)\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\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\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=1)\n {\n printf(\"#Color\");\n }\n else{\n printf(\"#Black&White\");\n }\n return 0;\n\n}\n"}, {"source_code": "#include\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\n#include\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//#include\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\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\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\nint main() {\n int n,m,i,j;\n scanf(\"%d%d\",&n,&m);\n char s[n][m];\n for(i=0;i\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\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\n//#include\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\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;i0)\n \t break; \n \t}\n \tif(b==0)\n \tprintf(\"#Black&White\");\n \treturn 0;\n }"}, {"source_code": "#include\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\n#include\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#include\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\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\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\n#include \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\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\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\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\n#include\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\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\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 \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\n#include\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\nint main()\n{\nint i,j,n,m,s;\nscanf(\"%d%d\",&n,&m);\nchar str[n][m][1];\nfor(i=0;i0) printf(\"#Black&White\\n\");\nelse printf(\"#Color\\n\");\nreturn 0;\n}\n"}, {"source_code": "#include\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\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\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#include \n#include \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\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=1) printf(\"#Blacl&White\");\n else printf(\"#color\");\n return 0;\n\n}\n"}, {"source_code": "#include\n#include\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\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\nint main(){\n int n,m,i,j;\n char s;\n scanf(\"%d %d\",&n,&m);\n for(i=0;i\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\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 \n#include \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\n//#include\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\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\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\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=1)\n {\n printf(\"#Black&White\");\n }\n else{\n printf(\"#Color\");\n }\n return 0;\n\n}\n"}, {"source_code": "#include \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\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#include \n#include \n#include \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 \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\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# include\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 - 1) 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, 2, 1] after the first step, the sequence [1, 2, 1, 3, 1, 2, 1] 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. e. after (n - 1) steps.Please help Chloe to solve the problem!", "input_spec": "The only line contains two integers n and k (1 ≤ n ≤ 50, 1 ≤ k ≤ 2n - 1).", "output_spec": "Print single integer — 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, 2, 1, 3, 1, 2, 1]. The number on the second position is 2.In the second sample the obtained sequence is [1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1]. The number on the eighth position is 4."}, "positive_code": [{"source_code": "#include \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 \n#include \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\n#include\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(km)\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#include \n#include \n#include \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\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 \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#include\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\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\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\n//#include\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\n//#include\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\n#include\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 \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\n#include\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 \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 \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\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>1;\n if(kmid)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\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 \n#include \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 \n#include \n#include \n#include \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(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\n#include\n#include\n#include\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 \n#include \n#include \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\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 \n#include \n#include \n#include \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\nint main(){\n long long int n,k,m=1,i;\n scanf(\"%llu %llu\",&n,&k);\n for(i=0;i\n#include\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\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#include \n#include \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 \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\n#include\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 \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\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 \n#include \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 \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\n#include\n#include\n#include\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\n#include\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 \n#include \n#include \n#include \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\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 \n#include \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\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 \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\n#include\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\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 \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\n#include\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\n#include\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\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\n#include\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\n#include \n#include \n#include \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(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 \n#include \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\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 \n#include \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\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 \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\n#include\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\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 \n#include \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 \n#include \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\nint main()\n{\n\tlong long int n,k,multiple=1,i;\n\tscanf(\"%lld %lld\",&n,&k);\n\tfor(i=0;i\n#include\n#include\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;i0)\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 \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\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\n#include\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 \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\n#include\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\n#include\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 \n#include \n#include \n#include \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(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 \n#include \n#include \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\n#include\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\n#include\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\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\n#include\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\n#include\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\n#include\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\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\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\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 \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 \n#include \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 \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \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\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 \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\n#include\n#include\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\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 \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\n#include\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(kt/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 \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<\n#include \n#include \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#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 \n#include \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\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\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 \n#include \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\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\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\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\n#include\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 \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 \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\n#define ll long long\n//#include\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 \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 \n#include \n#include \n#include \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=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 \n#include \n#include \n#include \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=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\nint main()\n{\n\tint n,k,i;\n\tscanf(\"%d %d\",&n,&k);\n\tint len=1;\n\tfor(i=0;i\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\n#include\n#include\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\n#include\n#include\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#include\n#include\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\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 \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 \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 \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 \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 \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<\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<\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 \n#include \n#include \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#include\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 \n#include \n#include \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]\n#include\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\n#include \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=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\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\n#include\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 \n#include \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 \n#include \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 \n#include \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 \n#include \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 \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 \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 \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\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\n#include\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\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\n#include\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\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 \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 \n#include \n#include \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\n#include\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 \n#include \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\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 \n#include \n#include \n#include \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(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 \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\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\n#include\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(kt/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\n#include\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(kn/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\n#include \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\n#include \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\n#include \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\n#include\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\n#include\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\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\n#include\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\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\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\n#include\n#include\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\n#include\n#include\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\n#include\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\n#include\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\n#include\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\n#include\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\n#include\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\n#include\n#include\n#include\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\n#include\n#include\n#include\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\n#include\n#include\n#include\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 \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\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\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 – 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 ≤ i ≤ n) 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 – 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, a2, ..., an. 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 ≤ n, k ≤ 80). The second line will contain n integers a1, a2, ..., an (1 ≤ ai ≤ n) – 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\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\n#include\n#include\n#include\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;i1&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#include \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\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\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 \n#include \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#include \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#include \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#include \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#include\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;i0)\n {\n x=i%10;\n i=i/10;\n for(j=0;j\n#include\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; j0)\n {\n printf(\"-1\\n\");\n }\n\n return 0;\n\n\n}\n"}, {"source_code": "#include\n#include\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\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 \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 \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 \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\n#include\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\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\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\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 \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\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 \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\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;y0)\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\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\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\n#include\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;js[k])\n {\n t=s[j];\n s[j]=s[k];\n s[k]=t;\n }\n }\n }\n for(j=0;j\n#include\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=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 \n#include \n#include \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\n#include\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=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 \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 \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\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 \n#include \n#include \n#include \n#include \n#include \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):(aa ){\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=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\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 \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=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 \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\n#include\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 \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\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\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\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\n#include\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=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\n#include\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 \n#include \n#include \n#include \n#include \n#include \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):(aa ){\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=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\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\n#include\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=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\n#include\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)); //数组全部清零\n num1=10000;CS=5;\n for(i=0;5>i;i++) //判断位数\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++) //判断有无重复\n {\n if(((n/num1)%10)==a[i])\n ch[i]++;\n }\n num1/=10;\n }\n for(i=0;i<10;i++) //读取ch中有多少相同的数\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\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\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\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=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 \n#include \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 \n#include \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\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=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\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\n#include\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; j0)\n {\n printf(\"-1\\n\");\n }\n\n return 0;\n\n\n}\n"}, {"source_code": "#include\n\n\n#include\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\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\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;ja[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;j0)\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\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;j1)\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\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\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 \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\n#include\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=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\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=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 \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\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 \n#include \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 \n#include \n#include \n#include \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 \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\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\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\n#include\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 \n#include \n#include \n#include \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\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\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;jr)printf(\"-1\");\n}"}, {"source_code": "#include\n#include\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;i0)\n {\n x=i%10;\n i=i/10;\n for(j=0;j\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\n#include\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;i0)\n {\n x=i%10;\n i=i/10;\n for(j=0;j\n#include\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=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 \n\nint digit(int n, int ord) {\n for(int i=0;i\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 \n#include \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 \n#include \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\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 \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 \n#include \n#include \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\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;sa[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\n#include \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\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 \n#include \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\n#include \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 \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\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 \n#include \n#include \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\n#include\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 \n#include \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\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\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\n#include\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\n#include \n#include \n#include \n#include \n#include \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):(aa ){\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=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\n#include\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; j0)\n {\n printf(\"-1\\n\");\n }\n\n return 0;\n\n\n}\n"}, {"source_code": "#include \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=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 \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\n#include\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\n#include\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\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\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\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\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 \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 \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 \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\n\n\n#include\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\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 \n#include \n#include \n#include \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\n#include\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)); //数组全部清零\n num1=10000;CS=5;\n for(i=0;5>i;i++) //判断位数\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++) //判断有无重复\n {\n if(((n/num1)%10)==a[i])\n ch[i]++;\n }\n num1/=10;\n }\n for(i=0;i<10;i++) //读取ch中有多少相同的数\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\n#include\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(ni;i++) //判断位数\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++) //判断有无重复\n {\n if(((n/num1)%10)==a[i])\n ch[i]++;\n }\n num1/=10;\n }\n for(i=0;i<10;i++) //读取ch中有多少相同的数\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\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\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\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\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\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 \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\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=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\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=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\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;ir)\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 \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 \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 \n#include \n#include\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\n#include \n#include \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\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 \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 \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\n#include\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\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\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 \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\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\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\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;i0)\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\n#include \n#include \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\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\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 \n#include \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 \n#include \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\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 \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\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 \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 \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\n#include\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;n0)\n {\n x=i%10;\n i=i/10;\n for(j=0;j\n#include\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;i0)\n {\n x=i%10;\n i=i/10;\n for(j=0;j\n#include\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;n0)\n {\n x=i%10;\n i=i/10;\n for(j=0;j\n#include\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\n#include\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\n#include\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\n#include\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\nint main()\n{\n int l,r,ans,a[6];\n scanf(\"%d %d\",&l,&r);\n int i;\n for( i=l;i\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\nint main()\n{\n int l,r,ans,a[6];\n scanf(\"%d %d\",&l,&r);\n int i;\n for( i=l;i\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\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;ja[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;j0)\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 \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\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\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\n#include\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\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\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\n#include\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\n#include\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\n#include \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\n#include\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\n#include\n#include\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=0;i++,j--)\n {\n for(k=0,temp=1;k0)\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=0;i++,j--)\n {\n for(k=0,temp=1;k0)\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 ≤ k, l ≤ 231 - 1).", "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 — the importance of number l.", "sample_inputs": ["5\n25", "3\n8"], "sample_outputs": ["YES\n1", "NO"], "notes": null}, "positive_code": [{"source_code": "#include \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\n#include \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(kl)\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\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\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\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\n#include\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 \nint main(){\n __int64 n,k,le,i;\n n=1;\n scanf(\"%I64d%I64d\",&k,&le);\n for(i=1;n\n#include \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(kl)\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\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\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\n#include\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\n#include\n#include\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\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\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\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\n#include\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 \n#include \n#include \n#include \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(tl)\n printf(\"NO\");\n else\n {\n printf(\"YES\\n\");\n printf(\"%d\",counter);\n }\n return 0;\n}"}, {"source_code": "#include\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 \n#include \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\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\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 \n#include \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 \n#include \n#include \n#include \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\n#include\n#include\n#include\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(ca)\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\n#include\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\n#include\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\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\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 \n#include \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\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 \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 \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\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\n#include\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\n#include\n#include\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\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\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 \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\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\n#include\n#include\n#include\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\n#include\n#include\n#include\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\n#include\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 \n#include \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(kl)\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\n#include\n#include\n#include\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(ca)\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 \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\n#include\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\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 \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\n#include \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 \n#include \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 \n#include \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\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 \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 \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\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\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 \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\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\n#include\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\n#include\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\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\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 \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\n#include \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\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\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\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 \n#include\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\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\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\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\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\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\n#include \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\n#include \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)||(lk)&&(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\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\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\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 \n#include\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\n#include\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\n#include\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 \n#include \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\n//#include\n#include\n#include\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\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 \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 \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 \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\nint main()\n{\n long long int k,l,c=0;\n scanf(\"%lld%lld\",&k,&l);\n int p=k;\n while(k\n#include\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\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\n#include\n#include\n#include\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\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\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 \n#include \n#include \n#include \n#include \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 \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 \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\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\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 \n#include \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\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 \n#include \n#include \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 \n#include \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\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\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\n#include\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 \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\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\n#include\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\n#include\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\n#include\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\n#include\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 \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 \n#include \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\nint main()\n{\nint c,f=0,t=0;\nlong long l,k;\nscanf(\"%I64d\",&k);\nscanf(\"%I64d\",&l);\nc=k;\nwhile(c\n#include\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\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\n#include\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 \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\n#include\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 \n#include\n#include\n#include\nint main() {\nlong int k,l,n=1,q=1;\nscanf(\"%ld%ld\",&k,&l);\nif(l\n#include\n\nint main(){\n int k,l,n=0,z=1,flag=0;\nscanf(\"%d%d\",&k,&l);\nif(l\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 \n#include \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\n#include\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 \n#include \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\n#include\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 \n#include \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\n#include\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\n#include\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\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\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\n#include\n#include\n#include\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\n#include \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\n#include\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\n#include\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 \n#include \n#include \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 \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\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 \n#include \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\n#include\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\n#include\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 \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 \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 \n#include \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 \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\n#include\n#include\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\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\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\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#include\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 \n#include \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 \n#include \n#include \n\n\nint main()\n{\n long long k,l;\n scanf(\"%I64d %I64d\",&k,&l);\n int i=0;\n if(lk)\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 \n#include \n#include \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#include \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 \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 (kl)\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 \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\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 \n#include \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\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 \n#include \n#include \n#include \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\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\n#include\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\n//#include\n#include\n#include\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\n#include\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\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 \n#include \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\n#include\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\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 \n#include \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)||(lk)&&(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\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 \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\n#include\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\n#include\n#include\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\n#include\n#include\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\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\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\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(k0)\n printf(\"YES\\n%I64d\\n\",i);\n else\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\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 \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\n#include \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 \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\n#include \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\n#include\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 \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 \n#include \n#include \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 \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 \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 (kl)\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\n#include\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 \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\n#include\n#include\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\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\n#include\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 \n#include \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\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\n#include\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 \n#include \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\n#include\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 × m. Let's denote the coordinate system on the grid. So, each point on the grid will have coordinates — a pair of integers (x, y) (0 ≤ x ≤ n, 0 ≤ y ≤ m).Your task is to find a maximum sub-rectangle on the grid (x1, y1, x2, y2) so that it contains the given point (x, y), and its length-width ratio is exactly (a, b). In other words the following conditions must hold: 0 ≤ x1 ≤ x ≤ x2 ≤ n, 0 ≤ y1 ≤ y ≤ y2 ≤ m, .The sides of this sub-rectangle should be parallel to the axes. And values x1, y1, x2, y2 should be integers. If there are multiple solutions, find the rectangle which is closest to (x, y). Here \"closest\" means the Euclid distance between (x, y) 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, y1, x2, y2), so we can choose the lexicographically minimum one.", "input_spec": "The first line contains six integers n, m, x, y, a, b (1 ≤ n, m ≤ 109, 0 ≤ x ≤ n, 0 ≤ y ≤ m, 1 ≤ a ≤ n, 1 ≤ b ≤ m).", "output_spec": "Print four integers x1, y1, x2, y2, which represent the founded sub-rectangle whose left-bottom point is (x1, y1) and right-up point is (x2, y2).", "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 \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 \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\n#define min(a,b) a=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\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 \n# include \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 \n#include \n#include \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 \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 \n# include \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 \n# include \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)\n# include \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 \n#include \n#include \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": "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 — 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 \n#include \n#include \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\nint a[5];\nint u[4];\nint f[5] = {0}, falg=0;\nvoid dfs(int dep)\n{\n\tif (dep == 4)//因为dep是在为下一轮做准备,所以dep=3(准备选第3个数)时才选了2个数,所以要dep=4时来判断\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\");//满足普通三角形,直接输出\n\t\t\texit(0);//意为\"正常退出程序\",相当于主函数里面的retrun 0,在DFS里面用可以节省搜到答案后回朔的时间\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这里不能直接输出\n\t\t因为弱化三角形的优先级小于普通三角形,\n\t\t所以当木棍同时满足弱化三角形和普通三角形的条件时应该输出最优解普通三角形\n\t\t但因为用的是DFS,枚举数的顺序只和数据的顺序有关,于是满足弱化三角形时就直接输了,要到确认没有普通三角形时才能输\n\t\t(第一次竟然在在这里跪了QAQ)\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];//把当前枚举到的组合临时存储下来\n\t\t\tdep++;//为下轮做准备\n\t\t\tdfs(dep);//刚学DFS时教练说内循环要写成镜像来回溯,于是我沿用到现在\n\t\t\tdep--;//撤销所有操作\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);//把数组当指针用,小绿书介绍过,也可以写scanf(\"%d%d%d%d\",&a[1],&a[2],&a[3],&a[4])\n\tdfs(1);\n\tif (falg)printf(\"SEGMENT\");//然而第2次又跪在打少了一个等号上(我太蒻了)\n\telse printf(\"IMPOSSIBLE\");\n\treturn 0;\n}"}, {"source_code": "#include \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\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 \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\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\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\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[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\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]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\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\n#include\n\nint book[ 4 ], ns[ 4 ]; // 标记是否使用以及存储原四个数据\nint ans[ 3 ]; // 判断此时的三个数能否组成三角形\nint flag; // 标记是否是弱化三角形\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 \n#include \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 \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 \n#include \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 \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)//若第i个数未被选择\n {\n f[i]=1;//表示第i个数已选择\n b[x]=a[i];\n dfs(x+1);\n b[x]=0;\n f[i]=0;\n }\n }\n}\n"}, {"source_code": "#include\n//#include\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; ia[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 \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\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 \n#include \n#include \n#include \n\n#define REP(i,a,b) for(i=a;i 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\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[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 \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\n#include\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\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 \n#include \n#include \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]= 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[step-1] ) //保证取值单调递增,满足组合有顺序\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\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\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]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\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 \n#include \n#include \n#include \n\n#define REP(i,a,b) for(i=a;i 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 \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\n#include\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 \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 \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\n#include\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\n#include\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 //冒泡算法\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 \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\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\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\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[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\nint main()\n{\n int a,b,c,d;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n\n if(((a\nint triangle(int a,int b,int c){\n if((a\n#include \n#include \n\nint main()\n{\n int x, y, z, c;\n scanf(\"%i %i %i %i\", &x, &y, &z, &c);\n if(((x\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 \n#include\n\nvoid ins(int a[], int n)\n{\n int i, j, k;\n for (i=1; i=0 && a[j]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 \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 (a3a3) 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\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 \n#include \n#include \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 \n#include \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 \n#include\n\nvoid ins(int a[], int n)\n{\n int i, j, k;\n for (i=1; i=0 && a[j]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 \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\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 \n#include \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]\n#include \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 \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\n#include\n#include\n#include\n#include\n#include\n#include\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\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]\n#include \n#include \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\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\n#include\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]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\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[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 \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\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 \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 \n#include \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\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\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 \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]=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\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]\n#include \n#include \n\nint main()\n\n{\n\nint x, y, z, c;\n\nscanf(\"%i %i %i %i\", &x, &y, &z, &c);\n\nif(((x\n#include \n#include \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\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 \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]\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\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\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\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[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\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[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 \n#include \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; jc[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]\n#include\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]\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; ja[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 \n#include \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; ja[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]\n#include \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 //\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 \n#include \n#include \n#include \n#include \n#include \n#include \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\n#include\n#include\n#include\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[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\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]\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\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 \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\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]\n#include \n#include \n#include \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\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\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[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 #include \nint main()\n{\n int a,b,c,d;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n if (((a\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 \n#include \n#include \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\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\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 \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\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\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\n#include\n#include\n#include\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[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 \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]\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; ja[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 \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\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 \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(sumlen[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\n#include\n#include\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]\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\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\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[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\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\nint main()\n{\n int a,b,c,d;\n scanf(\"%d%d%d%d\",&a,&b,&c,&d);\n if(a+b\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]=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 \n#include \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; ja[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]\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[1]+a[2]+a[3]) printf(\"IMPOSSIBLE\\n\");\n\t \n}\nreturn 0;\n}"}, {"source_code": "#include\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\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]\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\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[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\n#include\n#include\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\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\n#include \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\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 \n#include \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 \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\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\n#include\n#include\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\n#include\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\n#include\n#include\n#include\n#include\n#include\n#include\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\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 \n#include \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]\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]0) puts(\"TRIANGLE\");\n else puts(\"SEGMENT\");\n }\n return 0;\n}\n\n \n \n \n"}, {"source_code": "#include \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(sumlen[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\n#include\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\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//输入 \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\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 && ab && a>d && ad && a>c && aa && b>c && ba && b>d && bd && b>c && ba && c>b && ca && c>d && cd && c>b && ca && d>b && da && d>c && dc && d>b && d\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(dif1a[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\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\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\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\n#include\nint main()\n{\n int i,j,temp;\n char s[101];\n gets(s);\n for(i=0;is[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\n#include \n#include\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//äëÿ b,c,d\n\t\t//äëÿ c,d,a\n\t\t//äëÿ d,a,b\n\tif (((a\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\n#include\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\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 \n#include \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\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\n#include\n#include\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]\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 \n#include \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 \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 \n#include \n#include \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]\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\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[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\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 \n#include \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 \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]=3){\n printf(\"TRIANGLE\\n\");\n }\n else if(C[0]\n#include\n#include\n#include\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[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 \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\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]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\n#include\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\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\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\n#include\nint main()\n{\n int i,j,temp;\n char s[101];\n gets(s);\n for(i=0;is[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\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\n#include\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\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\n#include \n#include\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//äëÿ b,c,d\n\t\t//äëÿ c,d,a\n\t\t//äëÿ d,a,b\n\tif (((a\n#include \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 \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\n#include\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]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\n#include\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\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\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\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\n#include\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]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 \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\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\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 \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]0) printf(\"TRIANGLE\");\n else printf(\"IMPOSSIBLE\");\n\n return 0;\n}"}, {"source_code": "#include\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\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\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\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[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 \n#include \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 \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 \n#include \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\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 \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]=3){\n printf(\"TRIANGLE\\n\");\n }\n else if(C[0]\n#include\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]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 \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 © 2016 Anton Titkov. All rights reserved.\n//\n\n#include \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; kvalue3) {\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\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//输入 \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\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]\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\n#include\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]\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\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\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 ≤ a ≤ 1018; 0 ≤ k ≤ 100).", "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 \n#include \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 \n#include \n#include \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;i0;i++)\n {\n c=a[i];\n t=-1;\n for(j=i+1;jc)\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": "/* بِسْمِ اللهِ الرَّحْمٰنِ الرَّحِيْمِ */\n/* رَّبِّ زِدْنِى عِلْمًا */\n\n\n\n#include \n#include \n#include \n#include \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)\n break;\n\n if(maxfixed;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\n#include\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;i0;j--)\n if(arr[j-1]0 && jj)\n {\n for(l=0;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;iindex[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#include\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\n#include \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 \n#include \n#include \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-1;i--){\n for(j=0;j0;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\n#include\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;i0)\n {\n j=i+1;\n temp=i;\n k=m;\n max=ar[i];\nwhile(k>0 &&j<=l-1)\n{\n if(maxi;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 \n#include \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\n#include\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 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\n#include\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\n#include\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;ii+k)\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(maxi;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\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;i0;i++)\n\t{max=arr[i];maxi=i;\n\t\tfor(j=i+1;j<=i+k && jmax)\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#include \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\n#include\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\n#include\n#include\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\n#include\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;jmax)\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 \n#include\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;ia[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 \n#include \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\n#include\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;ilen)\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;imax)\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\n#include \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 \n#include \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(maxi;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 \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 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\n#include\nint main() {\n char a[20];\n int k;\n scanf(\"%s%d\",a,&k);\n //就一个原则,把最大的放在最前面\n //把k步内最大的换到最前面\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;ia[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\n#include\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;imx)\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\n#include\nint main(){\n\nchar a[20],c;\nint i,j,k,mx,l,pos;\nscanf(\"%s\",a);\nscanf(\"%d\",&k);\nfor(i=0;i0){\n mx=a[i]-48;\n pos=i;\n for(j=i+1;j<=i+k&&jmx){\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 \n#include \n#include \n#include\n#include\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;i0;i++){\n temp=i;\n flag=0;\n for(j=i;j<=i+k && j0;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 \n#include \n#include \n#include \n#include \n#include \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 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\n#include\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 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\n#include\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;ia[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 \n#include \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;i0 && p>0)\n {\n max=0;\n for(i=x;i<=x+k && imax)\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#include\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=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\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;jmx){\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 \n#include \n\nint a[30];\n\nint MIN(int x, int y){\n\tif (x= 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 \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\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)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 \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]1; i--) printf(\"%d\",a[i]);\n\tprintf(\"%d\\n\",a[1]);\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\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;jmax)\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\n#include\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;imax)\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\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 \n#include \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 \n#include \n#include \n#include \n#include \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 \n#include \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 \n#include \n#include \n#include \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; i0; 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 \n#include \n#define min2(x,y) (x\n#include\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\n#include\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(stm)\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\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\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 \n#include \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;is[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 \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;imax)\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\n#include\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 \n#include \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 \n#include \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 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 \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\n#include \n#include \n#include \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;imax){\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\n#include \n#include \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;i0;i++)\n {\n for(j=i+1;ja[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": "/* بِسْمِ اللهِ الرَّحْمٰنِ الرَّحِيْمِ */\n/* رَّبِّ زِدْنِى عِلْمًا */\n\n\n\n#include \n#include \n#include \n#include \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)\n break;\n\n if(maxj;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": "/* بِسْمِ اللهِ الرَّحْمٰنِ الرَّحِيْمِ */\n/* رَّبِّ زِدْنِى عِلْمًا */\n\n\n\n#include \n#include \n#include \n#include \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)\n break;\n\n if(maxj;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 \n#include \n#include \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-1;i--){\n\t\tfor(j=0;j0;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 \n#include \n#include \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;i0 && i>-1;i--){\nfor(j=0;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 \n#include \n#include \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;i0 && i>-1;i--){\nfor(j=0;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\n#include\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;i0)\n {\n j=i+1;\n temp=i;\n k=m;\n max=ar[i];\nwhile(k>0 &&ji;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\n#include\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;i0)\n {\n j=i+1;\n temp=i;\n k=m;\n max=ar[i];\nwhile(k>0)\n{\n if(maxi;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\n#include\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;i0)\n {\n j=i+1;\n temp=i;\n k=m;\n max=ar[i];\nwhile(k>0)\n{\n if(maxi;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 \n#include \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\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\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;i0;i++)\n\t{max=arr[i];maxi=i;\n\t\tfor(j=i+1;j<=i+k && jmax)\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#include\n#include\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 \n#include\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;i0)\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 \n#include\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\n#include \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 \n#include \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 \n#include \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 \n#include \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 \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 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 \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 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\n#include\nint main(){\n\nchar a[20],c;\nint i,j,k,mx,l,pos;\nscanf(\"%s\",a);\nscanf(\"%d\",&k);\nfor(i=0;i0){\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 \n#include \n#include \n#include\n#include\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;iarr[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 \n#include \n#include \n#include\n#include\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;jarr[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 \n#include \n#include \n#include\n#include\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;iarr[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 \n#include \n#include \n#include\n#include\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;iarr[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\n#include\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\n#include\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=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\n#include\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=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\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\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]1; i--) printf(\"%d\",a[i]);\n\tprintf(\"%d\\n\",a[1]);\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\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;jmax)\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\n#include\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;imax)\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\n#include\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\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]\n#include \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 \n#include \n#define min2(x,y) (x\n#include\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(stm)\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\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]\n#include \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;is[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 \n#include \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;is[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 \n#include \nmain()\n{\nchar s[20];\nlong long int i,j,k,m,temp=-1,ind;\nscanf(\"%s %d\",s,&k);\nfor(i=0;ii;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 \n#include \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;ii && ms[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 \n#include \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;is[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 \n#include \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;ii && ms[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 \n#include \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;is[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 \n#include \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;ii && ms[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 \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;imax)\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\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;imax)\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\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;imax)\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\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;imax)\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\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;imax)\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\n#include \n#include \n#include \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;imax){\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\n#include \n#include \n#include \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;imax&&count\n#include \nusing namespace std;*/\n\n#include\n#include\n#include\n#include\n#include\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>=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\n#include \nusing namespace std;*/\n\n#include\n#include\n#include\n#include\n#include\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\n#include \nusing namespace std;*/\n\n#include\n#include\n#include\n#include\n#include\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\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#include\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\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\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\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 ; i0)\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 \n#include \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\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\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 \n#include \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 \n#include \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 \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\ntypedef long long ll;\nchar S[200010];\nll min(ll a,ll b){\n return a\n#include \n#include \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\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#include \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#include \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 \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\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;inm && n2>nm)\n {ans=nm;\n break;}\n else if(n2\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;inm && 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 \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\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 \n#include \n#define min(a,b) a\n#include \n#define min(a,b) a= 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 \n#include \n#define min(a,b) a= 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 \n#include \n#define min(a,b) a= 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 \n#include \n#define min(a,b) a= 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 \n#include \n#define min(a,b) a= 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 \n#include \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 \n#include \n#define min(a,b) a= 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 \n#include \n#define min(a,b) a= 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 \n#include \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 \n#include \n#define min(a,b) a= 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 \n#include \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 \n#include \n#include \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 ≤ l, r, a ≤ 100) — 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 — 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 \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\n#include\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=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=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 \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\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\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\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\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\n//#include\n//#include\n//#include\n//#include\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\n#include\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\n#include\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\n#include\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 && rl)\n\t{\n\t\twhile(a>0 && l\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\n#include\nint main(l,r,a)\n{scanf(\"%d%d%d\",&l,&r,&a);\nint t,s;\nif(l\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(leftright){\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\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\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=a) t=a*2;\n else t=((a+r)/2)*2;\n s=s+t;\n }\n else if(r=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\nint main()\n{\n int x,y,z,a,b,c;\n scanf(\"%d%d%d\",&x,&y,&z);\n if(xy)\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 \n#include \n#include \n#include \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\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 \n#include \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\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 \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 \n\nint min(int a, int b){ \tif (ab) 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\n#include\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 \n\nint main()\n{\n int l,r,a,s;\n scanf(\"%d%d%d\",&l,&r,&a);\n if(l\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 \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 \n#include \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 \n#include\n#include\n#include\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(lb){\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\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\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\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\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\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\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 \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//lr){\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\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 \nint main(){int l,r,a;scanf(\"%d%d%d\",&l,&r,&a);while(l0){a--;l++;}else{r--;}}while(r0){a--;r++;}else{l--;}}while(a>1){r++;l++;a-=2;}printf(\"%d\",r+l);return 0;}"}, {"source_code": "#include\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 \n#include \n#include \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\n\nint main()\n{\n int l,r,b;\n scanf(\"%d%d%d\",&l,&r,&b);\n if(l\nint getResult(int l,int r,int a){\n\tint max,min;\n\tmax=l>r?l:r;\n\tmin=la)\n\t\treturn (min+a)*2;\n\tif(max-min\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\nint main()\n{\n int L,R,A,C,i,j;\n\n scanf(\"%d%d%d\",&L,&R,&A);\n\n if(L0);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(LR)\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\n\nint main()\n{\n int l,r,a,s;\n scanf(\"%d%d%d\",&l,&r,&a);\n if(l\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\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\n#include \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\n#include\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\n#include\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\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 \n#include \n#include \n#include \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 if((a+l)\n#include \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\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=a) t=a*2;\n else t=((a+r)/2)*2;\n s=s+t;\n }\n else if(r=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\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\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 ambidexter-=difference;\n ambidexter=ambidexter/2;\n max_team=right+right+(ambidexter*2);\n printf(\"%d\\n\",max_team);\n }\n else if (ambidexter\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\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\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(ab)\n\t\t{\n\t\t\tif((b+c)\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 \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\n#include\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\n#include\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=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=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\n#include\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 \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 \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(r0)\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 \nint min(int a,int b)\n{\n if(ab) 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 \n#include \n\nint main(){\n int l,r,a,t=0;\n scanf(\"%d %d %d\",&l,&r,&a);\n if(l\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 \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\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 \n\nint main()\n{\n int l,r,a,s;\n scanf(\"%d%d%d\",&l,&r,&a);\n if(l\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 \n#include \n\nint main()\n{\n int l,r,a,count;\n scanf(\"%d%d%d\",&l,&r,&a);\n count=0;\n while(count(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\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(r0)\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\nint main(){\nint n,m,a,c,min,max,k;\nscanf(\"%d %d %d\",&n,&m,&a);\nif(n!=m){\nif(n\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=a) t=a*2;\n else t=((a+r)/2)*2;\n s=s+t;\n }\n else if(r=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 \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\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\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(ab && a-b>c)\n {\n b=b+c;\n i=a-b;\n a=a-i;\n x=a+b;\n }\n else if(ac)\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\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\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=(lr)?l:r;\n x=max-min;\n if(x>=a)\n ans=2*(min+a);\n if(x\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(ab && a-b>c)\n {\n b=b+c;\n i=a-b;\n a=a-i;\n x=a+b;\n }\n else if(ac)\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 \n#include \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(l0&&l1)\n {\n r++;\n l++;\n a-=2;\n }\n else if(r==l&&a==1)\n break;\n }\n if(l0&&r1)\n {\n r++;\n l++;\n a-=2;\n }\n else if(r==l&&a==1)\n break;\n }\n if(r\n#include \n\nint main()\n{\n int l,r,a,count;\n scanf(\"%d%d%d\",&l,&r,&a);\n count=0;\n while(count(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\n#include\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\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\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\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 \n#include \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\n#include\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\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(lx)\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(ax)\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\n#include\nmain()\n{\nint l,r,a,temp,ans;\nscanf(\"%d %d %d\",&l,&r,&a);\nif(l0)\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\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 ambidexter-=difference;\n ambidexter=ambidexter/2;\n max_team=right+right+(ambidexter*2);\n printf(\"%d\\n\",max_team);\n }\n else if (ambidexter\n\nint min(int a, int b){ \tif (ab) 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\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 ambidexter-=difference;\n ambidexter=ambidexter/2;\n max_team=right+right+(ambidexter*2);\n printf(\"%d\\n\",max_team);\n }\n else if (ambidexter\n#include\nmain()\n{\nint l,r,a,temp,ans;\nscanf(\"%d %d %d\",&l,&r,&a);\nif(l0)\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\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\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\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 \n#include \n\nint main()\n{\n int l,r,a,c;\n scanf(\"%d %d %d\",&l,&r,&a);\n if(l=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=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\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\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)\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 \n#include \n#include \n#include \n\nint main() {\n int l,u,a;\n scanf(\"%d %d %d\",&l,&u,&a);\n int min,max;\n if(lmax)\n printf(\"%d\",2*max+(a-max)/2);\n\n \n\n }\n "}, {"source_code": "#include\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)\n#include\nint main()\n{\n int a,b,c,s;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(a\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\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 \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=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 \n#include \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\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(lr){\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 \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\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\n#include \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\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\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\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\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(l0)\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\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\n#include\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\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 \n#include \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 (l0)\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 && l0)\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\n#include\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(rr)\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 \n#include \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\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\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\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(lr){\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\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(ab)\n\t\t{\n\t\t\tif((b+c)\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(ab)\n\t\t{\n\t\t\tif((b+c)\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\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\n#include\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\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\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 (maxmax && ((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\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(ll){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 \n#include\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\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\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-rl)\n {\n if(r-l>=a)\n {\n sum=2*(l+a);\n }\n else if(r-l\n#include \n#include \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\n#include\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-rl)\n {\n if(r-l>=a)\n {\n printf(\"%d\",s-(r-l)+a);\n }\n else if(r-l\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\n#define min(a,b) a\n#include\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\n#include\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\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(lb){h=2*b;}\n printf(\"%d\",h);\n}\n"}, {"source_code": "#include \n#include \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\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(lx)\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(ax)\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\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\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\n#include\n#include\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\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\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\nint main()\n{\n int L,R,A,C,i,j;\n\n scanf(\"%d%d%d\",&L,&R,&A);\n\n if(L0);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(LR)\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\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\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\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(lr)\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\n#include\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 \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//lr){\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\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\n#include\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 \n#include \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\n#include\n#include\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\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\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\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 = lr ? l:r;\n d = max - min;\n min1 = d\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 \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\n#include\n#include\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 \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 \n#include \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\n#include\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 \n#include \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 \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-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-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\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\n#include\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 && rl)\n\t{\n\t\twhile(a>0 && l\n#include\n#include\n#include\n#include\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 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\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(ba)\n {\n while(b!=a)\n {\n b=b-1;\n }\n }\n else if(b\n#include \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\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\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 \n#include \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 (l0)\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 && l0)\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\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{\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{\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\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 && rr && 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 \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 \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\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(lr){\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\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(ll){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 \n#include \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\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\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(l0)\n\tl=l+m;\n\ta=a-m;\n\tgoto start;\t\t\n\t}\n\t\n\t\n}"}, {"source_code": "#include\n#include\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 && rl)\n\t{\n\t\twhile(a>0 && l\n#include\n#include\n#include\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\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\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\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\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\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\nint main()\n{\n int l,r,a,n;\n scanf(\"%d%d%d\",&l,&r,&a);\n\n while(l0 )\n {\n a--;\n l++;\n if(l==r)\n {\n break;\n }\n }\n while(r0)\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\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\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\n#include \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 × m 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 × n 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 + 7).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 ≤ n ≤ 100; n ≤ m ≤ 1018; 0 ≤ k ≤ n2) — 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 С++. It is preferred to use the cin, cout streams or the %I64d specifier. ", "output_spec": "In a single line print a single integer — the remainder from dividing the described number of ways by 1000000007 (109 + 7).", "sample_inputs": ["5 6 1"], "sample_outputs": ["45"], "notes": "NoteLet's consider the first test case: The gray area belongs to both 5 × 5 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 \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 \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 \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\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 \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\n#include\n#include\n#include\n#include\n#include\n#include\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\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 \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 \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, y (1 ≤ x, y ≤ 1018, xy > 1) — 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\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 \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\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 \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 \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 \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 \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, v2, ..., vx, where for any 1 ≤ i < x exists a transition from vi to vi + 1.Vasya's value in state v is interesting to the world, if exists path p1, p2, ..., pk such, that pi = v for some i (1 ≤ i ≤ k), 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 ≤ n, m ≤ 105) — the numbers of states and transitions, correspondingly. The second line contains space-separated n integers f1, f2, ..., fn (0 ≤ fi ≤ 2), fi described actions performed upon Vasya in state i: 0 represents ignoring, 1 — assigning a value, 2 — using. Next m lines contain space-separated pairs of integers ai, bi (1 ≤ ai, bi ≤ n, ai ≠ bi), 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, r2, ..., rn, 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 , — 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\n#include\n#include\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 \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\n#include\n#include\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\n#include\n#include\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\n#include\n#include\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 \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 \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 × N 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 ≤ N ≤ 10) – 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 \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#include \n#include \nchar a[20][11],b[20][11];\nint n;\nint check()\n{\n int k=0;\n for (int i=0; i\n#include \n#include \n#include \n#include \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\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\n#include \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\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#include\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=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\n#include\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= 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 \n#include \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\n#include\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\n#include \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 \n#include \n#include \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;i0 && (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#include#include\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;iabs(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#include\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=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=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=0)\n {\n printf(\"Yes\");\n return 0;\n }\n }\n printf(\"No\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\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;imo(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\n#include\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=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 \n#include \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 \n#include \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\\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\n#include\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= 0 && wa[j][0] / wx == k)\n {\n ans++;\n }\n }\n }\n if(wx == 0 && wy != 0)\n {\n for(j=0;j 0)\n {\n ans++;\n }\n }\n }\n if(wx != 0 && wy == 0)\n {\n for(j=0;j 0)\n {\n ans++;\n }\n }\n }\n if(wx == 0 && wy == 0)\n {\n for(j=0;j0) printf(\"Yes\\n\");\n else printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\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\n#include\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\n#include \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 \n#include \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 \n#include \n#include \n#include \n#define For(i,n) for(i=0;iy?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\n#include\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\n#include\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=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\n#include\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=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\n#include\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\n#include\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\n#include\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\n#include\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(ilen)\n printf(\"No\\n\");\nreturn 0;\n} "}, {"source_code": "#include \n#include \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 \n#include \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 \n#include \n#include \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\n#include \n#include \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\n#include \n#include \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;i0 && (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\n#include\n#include\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;iabs(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#include\n#include\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;iabs(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#include\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#include\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;imo(m2))\n\t\tm = m1;\n\telse\n\t\tm = m2;\n\tfor(i=m-100;i\n#include\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;imo(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\n#include\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=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\n#include\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\n#include\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\n#include\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=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 \n#include \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 \n#include \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 \n#include \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 \n#include \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 \n#include \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\\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 \n#include \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\\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 \n#include \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\\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\n#include\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= 0 && wa[j][0] / wx == k)\n {\n ans++;\n }\n }\n }\n if(wx == 0 && wy != 0)\n {\n for(j=0;j 0)\n {\n ans++;\n }\n }\n }\n if(wx != 0 && wy == 0)\n {\n for(j=0;j 0)\n {\n ans++;\n }\n }\n }\n if(wx == 0 && wy == 0)\n {\n for(j=0;j0) printf(\"Yes\\n\");\n else printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\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;i0) printf(\"Yes\\n\");\n else printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\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= 0)\n {\n ans++;\n }\n }\n }\n if(wx == 0 && wy != 0)\n {\n for(j=0;j0) printf(\"Yes\\n\");\n else printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\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\n#include\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\n#include\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\n#include \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 \n#include \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 \n#include \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 \n#include \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 \n#include \n#include \n#include \n#define For(i,n) for(i=0;iy?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 \n#include \n#include \n#include \n#define For(i,n) for(i=0;iy?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 \n#include \n#include \n#include \n#define For(i,n) for(i=0;iy?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 ψ(n) which is obtained from n by replacing every digit a in the decimal notation of n with the digit (9  -  a). We say that ψ(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·89 = 890.Your task is to find the maximum weight of the numbers in the given range [l, r] (boundaries are included).", "input_spec": "Input contains two space-separated integers l and r (1 ≤ l ≤ r ≤ 109) — bounds of the range.", "output_spec": "Output should contain single integer number: maximum value of the product n·ψ(n), where l ≤ n ≤ r. 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·1 = 8, weight of 9 equals 9·0 = 0, weight of 10 equals 890.Thus, maximum value of the product is equal to 890."}, "positive_code": [{"source_code": "#include\n#include\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(rx/2)\n printf(\"%I64d\",l*(x-l));\n\n return 0;\n }\n\n\n"}, {"source_code": "#include\nchar s1[30],s2[30];\nlong long change(char *s)\n{\n\tlong long sum=0,i;\n\tfor(i=0;i=x1) printf(\"%I64d\\n\",x3*(f(10,len)-1-x3));\n\telse if(x3\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\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_digitmax)\n max=current_max;\n printf(\"%I64d\",max);\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#define REP(i,a,b) for(i=a;i 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 \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\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 \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\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)=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\n#include\n#include\n#define REP(i,a,b) for(i=a;i 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\n#include\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\n#include\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\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\n#include\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(lx/2)\n printf(\"%I64d \",(x+1)/2*((x+1)/2-1));\n\n if(rx/2)\n printf(\"%I64d\",l*(x-l));\n\n return 0;\n }\n\n\n"}, {"source_code": "#include\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(lx/2&&r\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\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 \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 \n#include \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\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\n#include\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: mm. 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: mm 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: 07 and 17: 27 are lucky, while 00: 48 and 21: 34 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: mm.Formally, find the smallest possible non-negative integer y such that the time representation of the time x·y minutes before hh: mm contains the digit '7'.Jamie uses 24-hours clock, so after 23: 59 comes 00: 00.", "input_spec": "The first line contains a single integer x (1 ≤ x ≤ 60). The second line contains two two-digit integers, hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59).", "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\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 \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 \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\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 \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 \n#include \n#include \n#include \n#include \n#include \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 \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 \n#include \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\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\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\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\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\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 \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\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\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\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\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\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 \n#include \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 \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\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\n#include\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\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\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\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\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\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 \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 \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 \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 \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 \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 \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\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 \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\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\n#include\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\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 \n#include \n#include \n#include \n#include \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\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 \n#include \n#include \n#include \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 \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 \n#include \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\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\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\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 \n#include \n#include \n#include \n#include \n#include \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\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\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\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 \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 \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 \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 \n#include \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\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\n#include\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 \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\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\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 \n#include\n#include\n#include\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\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 \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 \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 \n#include \n#include \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\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 \n#include \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\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 \n#include \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\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 \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\n#include\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=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 \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\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 \n#include \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\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\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\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\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 \n#include \n#include \n#include \n#include \n#include \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\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\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 \n#include \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 \n#include \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\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 \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\n#include\n#include\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\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\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 \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\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\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 \n#include \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 \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 \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 \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 \n#include \n#include \n#include \n#include \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 \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\n#include\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 \n#include \n#include \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 \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\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\n#include\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\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\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\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\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\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\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]\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\n#include\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\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 \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\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\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(mmx)\n{mm=mm-x;}\n}\n}\n"}, {"source_code": "#include\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\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\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 \n# include \n# include \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\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\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\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\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 \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\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 \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\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\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\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\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 \n#include \n#include \n#include \n#include \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\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\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\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]\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(mmx)\n{mm=mm-x;}\n}\n}\n"}, {"source_code": "#include\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\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 \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 \n#include \n#include \n#include \n#include \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 \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) //分钟数小于7\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\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\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 \n#include \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\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\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 \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 \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 \n#include \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\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 \n#include \n#include \n#include \n#include \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 \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 \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\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 \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\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 \n#include\n#include\n#include\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\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\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\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\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\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 \n#include \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\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 \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\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\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\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\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\n#include\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 \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) //分钟数小于7\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 \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\n#include \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 \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\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 \n#include \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\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\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\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 \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 \n#include \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 \n#include \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\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 \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 \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\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\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\n#include\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 \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\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(mmx)\n{mm=mm-x;}\n}\n}\n"}, {"source_code": "#include \n#include \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 \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\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\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\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\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 \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 \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\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 \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\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\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\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\n#include\n#include\n#include\n#include\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 \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\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\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 \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 \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\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\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\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 \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 \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\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\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 \n#include \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 \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\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\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\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\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\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\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 \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\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\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\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\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\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\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\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\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 \n#include \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\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 \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 \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 \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\n//#include\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\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\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\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 \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 \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 \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\n#include\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 \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\n#include\n#include \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\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 \n#include \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\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 \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\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\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 \n#include \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\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\n#include\n#include\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 \n#include \n#include \n#include \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\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 \n#include \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 \n#include \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 \n#include \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 \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 \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\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\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\n#include\n#include\n#include\n#include\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\n#include\n#include\n#include\n#include\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\n#include\n#include\n#include\n#include\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\n#include\n#include\n#include\n#include\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 \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\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 \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\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\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\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\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\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 \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 \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 \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 \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 \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 \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 \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\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\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\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 \n#include \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\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\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\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\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 \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\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\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\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\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\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\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 \n#include \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 \n#include \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 \n#include \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\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\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 \n#include \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\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 \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 \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 \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 \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 \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 \n#include \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 \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 \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 \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\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 \n#include \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 \n#include \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\n#include\n#include\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 \n#include \n#include \n#include \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\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 \n#include \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 \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 × 8 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 — 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\n#include\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\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\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\n#include\n#include\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\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\n#include\n#include\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\n//#include\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\n#include\n#include\n#include\n\nint main()\n{\n\tint n=8,f=0;\n char a[n][n];\n for(int i=0;i\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\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\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 \n#include \n#include \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 \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 \n#include \n//#include \n//#include \n//#include \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\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\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\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\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 \n#include \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\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\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 \n#include \n#include \n#include \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\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 \n#include \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\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\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\n#include\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 \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 \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\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();//去掉每一行的换行符号!\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\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();//去掉每一行的换行符号!\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\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 \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\n#include\n#include\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 \n#include \n#include \n#include \n#include \n#include \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 \n#include \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 \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\n#include\n#include \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\n#include\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 \n#include \n#include \n#include \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\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 \n#include \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\n#include\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\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\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\n#include\n#include\n#include\n\nint main()\n{\n\tint n=8,f=0;\n char a[n][n];\n for(int i=0;i\n#include\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 \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\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\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\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();//去掉每一行的换行符号!\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\n#include\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 \n#include \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\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\n#include\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\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\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\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();//去掉每一行的换行符号!\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\n#include\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\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\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 \n#include \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 \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\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 \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\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 \n#include \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 \n#include \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 \n#include \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\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 \n#include \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\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\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\n#include\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 \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\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 \n#include \n#include \n#include \n#include \n#include \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\n#include\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\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();//去掉每一行的换行符号!\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\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();//去掉每一行的换行符号!\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\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 \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\n#include\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 \n#include \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\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 \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 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 \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=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 \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\n#include\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\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 \n#include \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 \n#include \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 \n#include \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\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 \n#include \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\n#include\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 \n#include \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\n#include\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 \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 \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#include\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\n#include\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\n#include\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\n#include\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\n#include\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\n#include\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\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 \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 \n#include \n#include \n#include \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\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 \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\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 \n#include \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\n#include\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 \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 \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\n//#include\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\n#include\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\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\n//#include\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\n#include\n#include\n#include\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 \n#include \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 \n#include \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\n#include\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\n#include\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\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\n#include\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\n#include\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\n#include\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 \n#include \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 \n#include \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 \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 \n#include \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\n#include\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\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\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\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\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\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 \n#include \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\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\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\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\n#include\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 \n#include \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\n#include\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\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\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\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\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\n#include\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\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\n#include\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 \n#include \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\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 \n#include \n#include \n#include \n#include \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\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\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\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\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\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\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\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\n#include\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\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\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\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\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\n#define N 8\n\nint main ()\n{ int c=1,i,j,a[10][10]; \n\tfor(i=0;i0)\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\n#define N 8\n\nint c=1,i,j,a[10][10];\nint main ()\n{ \n\tfor(i=0;i0)\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\n#define N 8\n\nint main ()\n{ int c=1,i,j,a[10][10]={0}; \n\tfor(i=0;i0)\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 \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 \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\n#include\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\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 \n#include \n#include \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 \n#include \n#include \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\n#include\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\n#include\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\n#include\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\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\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 \n#include \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\n#include\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\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\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\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 \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\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 \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\n#include\n#include\n#include\n#include\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\n#include\n#include\n#include\n#include\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\n#include\n#include\n#include\n#include\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 — 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}$$$) — 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 — 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\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;j0;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=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 \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \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\n#include \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 \n#include \n#include \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\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;j0;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;i0){\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\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;j0;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=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 \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \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\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \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\n#include \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 \n#include \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 × a. He wants to put some of them on a rectangular wall with size h × w. 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 ≤ a, h, w ≤ 109) — the size of photos and the height and the width of the wall.", "output_spec": "Print one non-negative real number — 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 - 6. 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 \n#include \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) %.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}$$$) — the length of the side of the chess field. The second line contains two integers $$$x$$$ and $$$y$$$ ($$$1 \\le x,y \\le n$$$) — 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\n#include\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\n#include\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\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 \n#include \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 \n#include \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\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\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\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\n#include\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\n#include\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\n#include\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\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\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 \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 \n#include \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\n#include\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\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\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\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 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 \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 \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 \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 \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\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\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 \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 \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\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\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 \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\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 \n#include \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\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\n#include\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\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\n#include\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\n#include\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\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\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\n#include\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 \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\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 \n#include \nlong long int max(long long int a, long long int b)\n{\n if(a\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 \n#include \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\n#include\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 \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\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\n#include\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\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\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 \n#include \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\n#include\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\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 \n#include \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\n#include\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\n#include\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\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 \n#include\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\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\n#include\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 \n#include \n#include \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 \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 \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\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\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\n#include\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\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\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\n#include\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\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\n#include\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 \n#include \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 \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\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\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 \n#include\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\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 \n#include \n#include \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 \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\n#include \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\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\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\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\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\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\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 \n#include\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\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 \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 \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\n#include\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\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\n#include\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=xy?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 \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\n#include\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\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 \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 \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 \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 \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\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\n#include\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 \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 \n#include \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\n#include\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 \n#include \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 \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\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\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\n#include\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\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 \n#include \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\n#include\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\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\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\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 \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\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\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\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 \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\n#include\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\n#include\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\n#include\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\n#include \n#include \n#include \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 \n#include \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 \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 \n#include\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\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\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\n#include\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 \n#include \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\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 \n#include \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 \n#include \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\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 \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\n#include\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\n#include\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 \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 \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 \n#include\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\n#include\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\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\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\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 \n#include \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\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 \n#include \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\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\n#include\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 \n#include \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\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 \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 \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\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\nint maxium(int x,int y)\n{\tif(x>y)\n\treturn x;\n}\nint mini(int x,int y)\n{ if(x\n#include\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 \n#include \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\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 \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\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 \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\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 \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 \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 \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\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 \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\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\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\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\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 \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\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 \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\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\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\n#include \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\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\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 \n#include \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 \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\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\n#include\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 \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 \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 \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\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 \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\n#include\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\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 \n#include \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\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 \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\n#include\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\n#include\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\n#include\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\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 \n#include \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(r3r4){\n\tprintf(\"Black\");\n\t}\n\treturn 0;\n}\n "}, {"source_code": "#include\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\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\n#include\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\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 \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 \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 \n#include \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 \n#include \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": "Три брата договорились о встрече. Пронумеруем братьев следующим образом: пусть старший брат имеет номер 1, средний брат имеет номер 2, а младший брат — номер 3. Когда пришло время встречи, один из братьев опоздал. По заданным номерам двух братьев, которые пришли вовремя, вам предстоит определить номер опоздавшего брата.", "input_spec": "В первой строке входных данных следуют два различных целых числа a и b (1 ≤ a, b ≤ 3, a ≠ b) — номера братьев, которые пришли на встречу вовремя. Номера даны в произвольном порядке.", "output_spec": "Выведите единственное целое число — номер брата, который опоздал на встречу.", "sample_inputs": ["3 1"], "sample_outputs": ["2"], "notes": null}, "positive_code": [{"source_code": "#include \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 \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\nint main()\n{\n int a,b;\n scanf(\"%i%i\",&a,&b);\n printf(\"%i\",6-a-b);\n}\n"}, {"source_code": "#include \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\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 \r\n#include \r\n#include \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\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*i100000){\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\r\n#include\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((pi)\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\r\n\r\n#include \r\n#include \r\n\r\n#define loop(i, a, b) for(ll i=a; i\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 \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 \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 \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 \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\r\n#include \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 \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] <\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] <\n#include \n#include \n#include \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 \r\n#include \r\n#include \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=0;k--)s1=(s1+a[k])%(998244353);\r\n float m=sqrt(j+1);\r\n int k;\r\n for(k=1;k\r\n#include \r\n#include \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=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 \r\n#include \r\n#include \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=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\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*i100000){\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\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*i100000){\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\r\n#include\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\r\n\r\n#include \r\n#include \r\n\r\n#define loop(i, a, b) for(ll i=a; i\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; i15)\n printf(\"15\\n\");\n else\n {\n for(i=0; iara[i+1] && s<90)\n ara[i]=ara[i+1];\n else 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\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\nint main() {\n\tint n;\n\tscanf(\"%d\",&n);\n\tint i;\n\tint now=0;\n\tfor(i=0;i\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\nint main(void)\n{\n int i,a,x=0,time=15,n;\n scanf(\"%d\",&n);\n for(i=0;i90)\n time=90;\n printf(\"%d\\n\",time);\n return 0;\n}\n"}, {"source_code": "#include\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\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\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 \n\nint main()\n{\n\tint n,s,fst=0,i,cnt=0;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i15) 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\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;j15){\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\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\nint main() {\n\tint n;\n\tscanf(\"%d\",&n);\n\tint i;\n\tint now=0;\n\tfor(i=0;i\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\nint main(void)\n{\n int i,a,x=0,time=15,n;\n scanf(\"%d\",&n);\n for(i=0;i90)\n time=90;\n printf(\"%d\\n\",time);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n,a[100],i,c=0;\n scanf(\"%d\",&n);\n \n for(i=0;i15)\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=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\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\nint main()\n{\n int a[100],n,i;\n scanf(\"%d\",&n);\n for(i=0; i15)\n {\n printf(\"15\");\n }\n\n else\n {\n for(i=0; i=90)\n {\n printf(\"90\");\n break;\n }\n }\n\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n,a[100],i,c=0;\n scanf(\"%d\",&n);\n for(i=0;i15)\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=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\n#include \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;i15){\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\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 \nint main()\n{\n\t\tint min;\n\t\tscanf(\"%d\",&min);\n\t\tint a[min+1],i;\n\t\tfor(i=0;i15)\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\nint main()\n{\n int n,k;\n scanf(\"%d\",&n);\n int i,a[10000];\n for(i=0;i15)\n printf(\"15\");\n else\n {\n for(i=0;i15)\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 \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\nint main()\n{\n int ara[91];\n int i,T,c=1;\n scanf(\"%d\",&T);\n for(i=0;i15)\n {\n printf(\"15\\n\");\n c=0;\n }\n else if(ara[0]<16)\n {\n for(i=0;i15)\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\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;i15)\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\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 \n#include \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;i15)\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 \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\nint main()\n{\n int n,f=0;\n scanf(\"%d\",&n);\n int a[n];\n for(int i=0;i=15)\n {\n f=1;\n printf(\"15\");\n }else\n {t=a[0];\n for(int i=1;i15)\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\n#include\nint main()\n{\n int a,l,i,q;\n scanf(\"%d\",&a);\n int s[a];\n for(i=0;i=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\nint main(){\n\tint n,a[100],time;\n\tscanf(\"%d\",&n);\n\tfor(int i=0; i=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; i15){\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\nint main()\n{int tmin,i,j,arr[90],plus,count=0;\n scanf(\"%d\",&tmin);\n\n for (i=0;i15)\n plus=0;\n else {\n for (j=0;j=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\nint main()\n{\n int array[10000],i,n,time,t;\n scanf(\"%d\",&n);\n for(i=0; i15)\n printf(\"15\");\n\n else\n {\n for(i=0; i15)\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\nint main()\n{\n int i,n,a=0;\n scanf(\"%d\",&n);\n int t[n];\n for(i=0;i\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 \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 \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\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n\n int array[n];\n int i;\n for(i=0; i15)\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\nint main(){\n int n,i,c=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i90)printf(\"90\");\n else printf(\"%d\",c+15);\n return 0 ;\n}\n"}, {"source_code": "#include \n#include \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 \n#include \n#include \n#include \n#include \n#include \nint main ()\n{int n,i,sum=0,j,ok=0;\nscanf (\"%d\",&n);\nint t [100];\nfor (i=0;i 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\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 \n#include \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; i15){\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\nint main()\n{\tint time=90;\n\tint N;\n\tscanf(\"%d\",&N);\n\tint A[N];\n\tint i;\n\tfor(i=0;i15)\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 \n#include \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; i15){\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\n#define Max 100\nint main()\n{\n\tint n,a[Max],s=0,i;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i90)\n\t\tprintf(\"%d\\n\",90);\n\telse\n\t\tprintf(\"%d\\n\",s+15);\n\treturn 0;\n}"}, {"source_code": "#include\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; ib)\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\nint main()\n{\n int i,n,a=0;\n scanf(\"%d\",&n);\n int t[n];\n for(i=0;i\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 \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 \n#include \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\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\n#include\n#include\n#include\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; i15)\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 \n#include \n#include \n#include \n#include \n#include \nint main ()\n{int n,i,sum=0,j,ok=0;\nscanf (\"%d\",&n);\nint t [100];\nfor (i=0;i 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#include\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 \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(i15)\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\n#include\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\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\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\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;i15)\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\n\nint main()\n{\n int i,j,k=0,n;\n scanf(\"%d\",&n);\n int ar[n];\n for(i=0;i15) k=15;\n else\n {\n for(i=0;i15)\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\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\nint main()\n{\n int n,i;\n scanf(\"%d\",&n);\n int a[n];\n\n for(i=0;i15)\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;i15)\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\nint main()\n{int tmin,i,j,arr[90],plus,count=0;\n scanf(\"%d\",&tmin);\n\n for (i=0;i15)\n plus=0;\n else {\n for (j=0;j=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 \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 \n#include \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;i15)\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\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int i,A[n];\n int countn=1;\n for(i=0;i15)\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\nint main()\n{\n int n,a[100],i,c=0;\n scanf(\"%d\",&n);\n for(i=0;i15)\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=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\nint main()\n{\n int n,i;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i15){\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;i15){\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;i15){\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 \nint main()\n{\n int i,k[99],n;\n scanf(\"%d\", &n);\n for (i=0; i15)\n {\n printf(\"%d\\n\", 15);\n return 0;\n }\n else {\n for (i=1; i15)\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\nint main()\n{\n int n,s=0,i,k;\n scanf(\"%d\",&n);\n int A[n];\n for(i=0;i90)\n {\n s=75;\n }\n printf(\"%d\\n\",s+15);\n return 0;\n}\n"}, {"source_code": "#include\n#include\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\n#include\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint mins[n];\n\tfor(int o=0;o15)\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;p15)\n\t\t\n\tprintf(\"%d\",count+15);\t\n\t } \n\t\n\t\n}"}, {"source_code": "#include\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\t\n\tint time[n],i;\n\tfor (i=0; i\n\nint main()\n{\n int n,cnt=0,f=0;\n scanf(\"%d\",&n);\n int ar[n];\n for(int i=0;i15)\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;i15)\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 \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\nint main()\n{\n int n,i;\n scanf(\"%d\",&n);\n int a[n];\n\n for(i=0;i15)\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;i15)\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\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\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 \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\nint main()\n{\n\tint n,a[100],c,i,flag=0,b[100];\n\tscanf(\"%d\",&n);\n\tfor(i=0;i15)\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 \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 \n#include \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\n\nint main()\n{\n int n,i,s;\n i=0;\n scanf(\"%d\",&n);\n int a[90]={};\n while(i=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 \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\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 \nint main()\n{\nint n,i,s,test=0;\nscanf(\"%d\",&n);\nint ar[n];\nfor(i=0;i\n#include \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\n\nint main()\n{\n\tint n,i,s=15;\n\tscanf(\"%d\",&n);\n\tint a[n];\n\t\n\tfor(i=0;i90)\n\tprintf(\"90\");\n\telse\n\tprintf(\"%d\",s);\t\t\n}\n\n\n"}, {"source_code": "#include \n\nint main(void) {\n\tint min,i,j;\n\tscanf(\"%d\",&min);\n\tint a[min+1];\n\tfor(j=0;j15)\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\nint main()\n{\nint c=0,i,j,n;\nscanf(\"%d\",&n);\nint t[n];\nfor(i=0;i=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;i15)\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\n\nint main(){\n\n int i,n,ans=0;\n\n scanf(\"%d\",&n);\n int a[91];\n\n for(i=0;i15){\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\n\nint main()\n{\n int n, a[90], i, p;\n \n scanf(\"%d\", &n);\n for(i=0;i15)\n p=0;\n else\n {\n p=a[0];\n for(i=1;i=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\n#define Max 100\nint main()\n{\n\tint n,a[Max],s=0,i;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i90)\n\t\tprintf(\"%d\\n\",90);\n\telse\n\t\tprintf(\"%d\\n\",s+15);\n\treturn 0;\n}"}, {"source_code": "#include \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(i15)\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 \n#include \n#include\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;i15)\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\nint main()\n{\nint n,a[90];\nscanf(\"%d\",&n);\nint i;\nfor(i=0;i\nint main()\n{\n int n,s=0,i,k;\n scanf(\"%d\",&n);\n int A[n];\n for(i=0;i90)\n {\n s=75;\n }\n printf(\"%d\\n\",s+15);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i15){\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\n#include\n\nmain(){\n\tint n,i,a[90];\n\t\n\tscanf(\"%d\",&n);\n\tfor(i=0;i15) printf(\"%d\",15);\n\telse{\n\tif (n==1) printf(\"%d\",a[0]+15);\n\telse\n\tfor(i=0;i\n#include \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\n\nint main(){\n\n int n,i,arr[100];\n\n scanf(\"%d\",&n);\n\n for(i=0;i15)\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\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;Loop15)\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\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\t\n\tint time[n],i;\n\tfor (i=0; i\nint main()\n{\n int n,i,j,c=0;\n\n scanf(\"%d\",&n);\n int t[n];\n\n for(i=0;i15)\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;i15)\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\nint main()\n{\n int n,i,x,j,a[100];\n scanf(\"%d\",&n);\n\n for(i=0;i15)\n printf(\"15\\n\");\n else\n {\n x=a[0];\n for(i=1;i=75)\n printf(\"90\\n\");\n else\n printf(\"%d\\n\",x);\n }\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n,a[100],i,c=0;\n scanf(\"%d\",&n);\n for(i=0;i15)\n {\n printf(\"%d\\n\",15);}\n else\n {\n for(i=1;i15)\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\n\nint main()\n{\n int i,j,k,n;\n scanf(\"%d\",&n);\n int ar[n];\n for(i=0;i15) k=15;\n else \n {\n k=ar[0]+15;\n for(i=1;i15)\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 \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; i15)\n {\n printf(\"15\");\n }\n else\n printf(\"%d\", arr[0]+15);\n }\n else{\n int count=0;\n for(i=0; i15)\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\n\nint main()\n{\n int n,a[100],i,c=0;\n scanf(\"%d\",&n);\n for(i=0;i15)\n {\n printf(\"%d\\n\",15);}\n else\n {\n for(i=1;i15)\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\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\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int i,A[n];\n int countn=1;\n for(i=0;i15)\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#include\nint main()\n{\n int n,i,m,sum=0;\n scanf(\"%d\",&n);\n int arr[n+1];\n for(i=0 ; i15)\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\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=15)\n c=i-1;\n }\n printf(\"%d\\n\",a[c]+15);\n}\n"}, {"source_code": "#include\n#include\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;i15)\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\nint main(){\n int n,i,c=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i15){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\nint main()\n{\n int n,i,j,c=0;\n\n scanf(\"%d\",&n);\n int t[n];\n\n for(i=0;i15)\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;i15)\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\nint main()\n{\n int n,i,s=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i90)\n s=75;\n printf(\"%d\",s+15);\n return 0;\n\n}\n"}, {"source_code": "#include\nmain()\n{\n int n,i;\n scanf(\"%d\",&n);\n int ara[n];\n\n for(i=0;i15) {\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\nint main()\n{\n int n,a[1000],i,sum;\n while(scanf(\"%d\",&n)==1)\n {\n for(i=0; i \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\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\nint main()\n{\n\tint n,t[91],i,ans,tmp;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i\n#include\nint main()\n{\n int n,i,m,sum=0;\n scanf(\"%d\",&n);\n int arr[n+1];\n for(i=0 ; i15)\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\nint main()\n{\n int n,i,ans=0,s;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i=15) ans=15;\n else ans=a[0]+15;\n }\n else\n {\n for(i=0;i15)\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\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;i15)\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 \n#include \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 \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 \n#include\n#include\n#include\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;i15){\n printf(\"%lld\",b+15);\n return 0;\n }\n b=a;\n}\nprintf(\"90\");\nreturn 0;\n}\n"}, {"source_code": "#include\n#include\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;i15)\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 \n#include \n#include \n#include \n\nint n, s, result, time;\n//int i, j;\n//char str[100];\n//int *a; // указатель на массив\n\nint main()\n{\n scanf(\"%d\", &n);\n\n // Выделение памяти\n /*a = (int*) malloc(n*sizeof(int));\n // Ввод элементов массива\n for(i=0; i 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\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\n#include\nint main()\n{\n int n, m, aux=0,i,j=0;\n scanf(\"%i\", &n);\n for(i=0;i15)&&(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\n#include\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;i15)\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\n#include\nint main()\n{\n int n, m, aux=0,i,j=0;\n scanf(\"%i\", &n);\n for(i=0;i15)&&(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 \n#include \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 \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(i15)\n {printf(\"%d\",j+15); return 0;}\n j=a[i];\n }\n printf(\"90\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\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 \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\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;i15)\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\nint main()\n{\n int n,a[91],i,flag=1,ans=0;\n scanf(\"%d\",&n);\n for(i=0;i15)\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\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= 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\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;i15)\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\nint main(){\n int n,i,c=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i15){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 \n#include \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\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;i15)\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\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; iinput2[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\n#include\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\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=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;i15)\n t=15;\n for(int i=1;i15)\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\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= 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\nint main(void)\n{\n int a,ara[1000],b=0,i,j,k;\n scanf(\"%d\",&a);\n for(i=0;i15){\n printf(\"%d\",ara[j]+15);\n\n break;\n }\n\n }\n\n}\n"}, {"source_code": "#include\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;j1) {\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\nint main()\n{\n int n,i,ans=0,s;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i15)\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\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; iinput2[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 \nint main()\n{\n int i,k[99],n;\n scanf(\"%d\", &n);\n for (i=0; i15)\n {\n printf(\"%d\\n\", 15);\n return 0;\n }\n else {\n for (i=1; i=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\nint main()\n{\n int ara[91];\n int i,T,c=1;\n scanf(\"%d\",&T);\n for(i=0;i15)\n {\n printf(\"15\\n\");\n c=0;\n }\n else if(ara[0]<16)\n {\n for(i=0;i15)\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\nint main()\n{\n int a[100],n,i,j,c,s;\n scanf(\"%d\",&n);\n for (i=0; i=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\nint main()\n{\n int n,i,s=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i90)\n s=75;\n printf(\"%d\",s+15);\n return 0;\n\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n#include\n#define prime 1000000007 \nint main()\n{\n\tint temp,num,i,arr[90];\n\tscanf(\"%d\",&num);\n\tfor(i=0;i15)\n\t{\n\t\tprintf(\"15\\n\");\n\t}\n\telse\n\t{\n\t\ttemp=arr[0];\n\t\tfor(i=1;i=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\n#include\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\nint main()\n{\n int n,f=0;\n scanf(\"%d\",&n);\n int a[n];\n for(int i=0;i=15)\n {\n f=1;\n printf(\"15\");\n }else\n {t=a[0];\n for(int i=1;i=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\n#include\nint main()\n{\n int size, aux=0, i=0, j=0;\n scanf(\"%i\", &size);\n int a[size];\n for(i;i15)\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\n#include\n#include\n#include\n#include\n#define prime 1000000007 \nint main()\n{\n\tint temp,num,i,arr[90];\n\tscanf(\"%d\",&num);\n\tfor(i=0;i15)\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=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 \n#include \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\nint main(){\n int n,a[10000],i,x,bore=0;\n scanf(\"%d\",&n);\n for(i=0;i15) {\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\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\n#include\n#include\n#include\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; i15)\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 \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 \nmain()\n{\n\tint i,j,x,temp=0;\n\tscanf(\"%d\",&x);\n\tint a[x];\n\tfor (i=0;i15)\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;i15)\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 \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 \n\nint main(void) {\n\tint n,i,a[100],d,s=0,p=0;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i\nint main()\n{\n int n,i,s=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i90)\n s=75;\n printf(\"%d\",s+15);\n return 0;\n\n}\n"}, {"source_code": "#include \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\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=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\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\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; iinput2[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 \n#include \n#include \n#include \n#include \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 \n\nint main()\n{\n int a[90], i, check, n, flag=-100;\n scanf(\"%d\", &n);\n for(i=0; i15)\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\nint main(){\n int n,i,c=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i15){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\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\nint main()\n{\n int n,i;\n scanf(\"%d\",&n);\n int a[n];\n\n for(i=0;i15)\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;i15)\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\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;i15){\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\nint main()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n int t[n];\n for(i=0;i=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 \n#include \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 \n#include \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;i15)\nprintf(\"%d\",15);\nelse\n{sum=a[0];\nif(n==1)\nsum=sum+15;\nfor(i=0;i15)\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\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\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 \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\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\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\t\n\tint time[n],i;\n\tfor (i=0; i\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;i15)\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\n\nint main()\n{\n int n, a[90], i, p, q;\n \n scanf(\"%d\", &n);\n for(i=0;i15)\n q=15;\n else if(n==1)\n q=q+15;\n else\n {\n for(i=1;ia[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\n#include\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\n#include\nint main()\n{\n int size, aux=0, i=0, j=0;\n scanf(\"%i\", &size);\n int a[size];\n for(i;i=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\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\nint main()\n{\n\tint n,a[100],c,i,flag=0,b[100];\n\tscanf(\"%d\",&n);\n\tfor(i=0;i15)\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\nint main()\n{\n int ara[91];\n int i,T,c=1;\n scanf(\"%d\",&T);\n for(i=0;i15)\n {\n printf(\"15\\n\");\n c=0;\n }\n else if(ara[0]<16)\n {\n for(i=0;i15)\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 \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 \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;i15)\n {\n printf(\"15\");\n }\n else if(a[0]<15) {\n for(i=0;i=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 \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) = Ax + B. Let's define g(0)(x) = x and g(n)(x) = f(g(n - 1)(x)) for n > 0. For the given integer values A, B, n and x find the value of g(n)(x) modulo 109 + 7.", "input_spec": "The only line contains four integers A, B, n and x (1 ≤ A, B, x ≤ 109, 1 ≤ n ≤ 1018) — 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 — the value g(n)(x) modulo 109 + 7.", "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 \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 \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 \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\n#include\n#include\n#include\n#include\n#include\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\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\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\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 \n#include \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\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 \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 \n#include \n#include \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\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 \n#include \n#ifndef _TJYTLXWXHYZQFW_COMMON_H\n#define _TJYTLXWXHYZQFW_COMMON_H\n#include \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 \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/* 大数除小数, 小数除余数 */\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 \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;i0)\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\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\n#include\n#include\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\n#include\n#include\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 \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 \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\n#include\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\n#include\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 \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 \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 \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 \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 \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 \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 \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\n#include\n#include\n#include\n#include\n#include\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\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\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\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 \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# 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;i0)\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 \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;i0)\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\n#include\n#include\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\n#include\n#include\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\n#include\n#include\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\n#include\n#include\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 \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 \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 \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 \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 \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 \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 — 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 \n#include \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\n#include\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\n#include\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#include\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\n#include\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 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#include\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;is[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\n#include\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;i1)\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\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]\n#include \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\n#include\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#include\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;i0)\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\n #include\n #include\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;i0)\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 \n#include \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\n#include\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\n#include \n#include \n#include\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\n#include \n#include \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\n#include\n#include\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\n#include \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\n#include\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;i96)\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\n#include\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#include\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 \n#include \n#include \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\n#include\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\n#include\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;iarr[i])\n {\n temp=arr[j];\n arr[j]=arr[i];\n arr[i]=temp;\n }\n }\n }\n for(i=0;i\n#include\n#include\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\n #include\n #include\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;i0)\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\n#include\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\n#include\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;istr[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\n#include \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\n#include\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;iarr[i])\n {\n temp=arr[j];\n arr[j]=arr[i];\n arr[i]=temp;\n }\n }\n }\n for(i=0;i\n#include \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\n#include\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\n#include\n#include\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=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 \n#include \n#include \n#include \n#include \n#include \n#include \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;is[j])\n {\n temp=s[i];\n s[i]=s[j];\n s[j]=temp;\n }\n }\n }\n \n for(i=0;i\n#include\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\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 \n#include \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\n#include\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;ich[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\n#include\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\n#include \n#include \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\n#include \nmain()\n{\n char s[102];\n gets(s);\n int c,k,i;\n c=1;\n for(i=1;i\n #include\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='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 \n#include \n#include \n#include \n#include \n#include \n#include \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;is[j])\n {\n temp=s[i];\n s[i]=s[j];\n s[j]=temp;\n }\n }\n }\n \n for(i=0;i\n#include\nint main(){\nchar str[200];\nscanf(\"%s\",str);\nint count[30]={0},data=0;\nint len=strlen(str),i;\nfor(i=0;i\n#include\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\n#include\n#include\n#include\n#include\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\n#include \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\n#include\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\n#include\nint main()\n{\n char a[100];\n scanf(\"%s\",a);\n int m=strlen(a);\n for(int i=0;i\n#include \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\n#include \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\n#include \n#include \n#include \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\n#include \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\n#include\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\n#include\n#include\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\n#include\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\n#include\n#include\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\n#include\nint main()\n{\n int i,j,k=0;\n char str[102];\n char temp;\n gets(str);\n\n for( i =0; istr[i])\n {\n temp = str[j];\n str[j] = str[i];\n str[i] = temp;\n }\n }\n }\n for( i =0; i\n#include\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 \n#include \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\n#include\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\n#include\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 \n#include \n#include \n#include \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\n#include\nint main(){\nchar str[200];\nscanf(\"%s\",str);\nint count[30]={0},data=0;\nint len=strlen(str),i;\nfor(i=0;i\n#include\n#include\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\n#include\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;i96)\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\n#include\nint main()\n{\n char s[100];\n int freq[27]={0},i,count=0;\n scanf(\"%s\",s);\n for(i=0;i\n#include \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\n#include\nint main(){\n char s[100];\n scanf(\"%s\",s);\n int d=0,l=strlen(s);\n for(int i=0;i\n#include\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;ich[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\n#include\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 \n#include \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#include\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\n#include\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\n#include\n#include\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=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\n#include\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\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\n#include\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\n#include\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#include\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#include\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\n#include\n#include\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='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 \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\n#include\nint main(){\n char s[100];\n scanf(\"%s\",s);\n int d=0,l=strlen(s);\n for(int i=0;i\n#include \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#include\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\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\n#include\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\n#include\nint main()\n{\n char a[102];\n int i,j,cnt=0;\n gets(a);\n for (i=0;i\n#include \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=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\n#include\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\n#include \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\n#include\n#include\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\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\n#include\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\nint main()\n{\n int score=0,sum=0;\nchar name[101];\nchar aux='a';\nscanf(\"%s\",name);\nfor (int i=0;iname[j]){\n aux=name[i];\n name[i]=name[j];\n name[j]=aux;\n }\n }\n\n }\n for (int i=0;i\n#include\nint main()\n{\n char s[100];\n int freq[26],i,count=0;\n gets(s);\n for(i=0;i\n#include\nint main()\n{\n char c[100],s=0;\n gets(c);\n int l=strlen(c);\n for(int i=0;i\n#include \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\n#include\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\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\n#include\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;ii;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\n#include\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;ii;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 \n#include \n#include \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\n#include \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\n#include\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\n#include\n#include\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\n#include\n#include\nint main(){\n char ch[200];\n scanf(\"%s\",&ch);\n int j,i;\n int nb=0;\n for(i=0;i\n#include\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 \n#include \n#include \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\n\nint main() {\n\nint i,x,len,count=0,y;\nchar a[100];\ngets(a);\nlen=strlen(a);\n\nfor(i=0;i\n#include \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\n#include \n#include \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\n#include\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 \n#include \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 \n#include \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 \n#include \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 \n#include \n#include \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\n#include \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\n#include\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\n#include\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\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\n#include\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\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\n#include\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 \n#include \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 \n#include \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\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#include\n\nint main()\n{\n char s[100],p[100];\n int n,i,j;\n gets(s);\n for(int k=0;k\n#include\nint main()\n{\nint p=0,d=0;\nchar s[100];\nd=strlen(s);\nfor(int i=0;i\n#include\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\n#include \n#include \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\n#include\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\n#include\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\n#include \n#include \n#include \n#include \n#include \n#include \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\n#include\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;istr[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\n#include \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\n#include \n#include\n\nint main()\n{\nchar ch[100];\nint i,n,s=0,j;\nscanf(\"%s\",ch);\nn=strlen(ch);\nfor (i=0;i\n#include\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 \n#include \n#include \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\n#include\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;i96)\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\n#include\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\n#include\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 \n#include \nint main()\n{\n char ch[50],sh[50];\n scanf(\"%s\",&ch);\n int s,i,j=0;\n for(i=0;i\n#include\nint main()\n{\n\tchar string[100],string2[100],temp;\n\tgets(string);\n\tint i,j,k=0;\n\tfor(i=0;istring[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\n#include\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\n#include\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\n#include \n#include \n#include \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\n#include \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\n#include\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 \n#include \nint main()\n{\n int i, j, len;\n char s[105];\n gets(s);\n len=strlen(s);\n for(i=0;i\n#include\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 \n#include \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\n#include\nint main()\n{\n int i,j,k=0;\n char str[102];\n char temp;\n gets(str);\n\n for( i =0; istr[i])\n {\n temp = str[j];\n str[j] = str[i];\n str[i] = temp;\n }\n }\n }\n for( i =0; i\n#include\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\n#include\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;kstr[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\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\n#include\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\n#include \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]\n#include\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\n#include\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\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 \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 \n#include \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\n#include\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\n#include\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#include\nint main(){\n char str[100];\n int i,c=0,j;\n gets(str);\n for(i=0;i\n#include\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\n#include\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 \n#include\nint main()\n{\n char s[100];\n int freq[26],i,count=0;\n gets(s);\n for(i=0;i\n#include\n#include\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\n#include\n#include\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\n#include\nint main(){\n char str[100];\n int i,c=0,j;\n gets(str);\n for(i=0;i\n#include\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\n#include \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\n#include\n\nint main()\n{\n char s[100];\n int n;\n gets(s);\n n=strlen(s);\n for(int i=0;i\n#include \nmain ()\n{\nchar x[101],l,s=0,i,j;\nscanf (\"%s\",x);\nl=strlen (x);\nfor (i=0;i \n#include \n#include \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\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\n#include\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 \n#include\n\nint main() {\n\nchar a[100];\nint len,i,x,y,count=0;\n\ngets(a);\nlen=strlen(a);\nfor(i=0;i\n#include\nint main()\n{\n char a[20];\n int i,k,j,len;\n scanf(\"%s\",a);\n for(i=0;i\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\n#include \n#include \n#include\n\n/*\n * \n */\nint main()\n{ char c[100];\nint i,j,l ;\nscanf(\"%s\",&c);\nl=strlen(c);\nfor (i=0; i\n#include\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\n#include \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 \n#include \n#include \n#include\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\n#include\n#include\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\n#include \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\n#include\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\n#include\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\n#include \n#include \n#include \n#include \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\n#include\n#include\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\n#include\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\n#include\n#include\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\n#include\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\n#include\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 \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 \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 \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 \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/22 ) 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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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\n#include\n#include\n#include\n#include\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\n#include\n#include\n#include\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の配列数,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//月\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(min0){\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(min0){\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(min0){\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(min0){\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(min0){\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\n#include \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(max0 && 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\n#include\n#include\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/3r/2&&r/2\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 \n\nint min(int a, int b)\n{\n if (a=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 \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\n#define MIN(a,b) (ab)?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 \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\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 = ay?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 \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\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(c1c3)\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 \n#include \n#include \n#include \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 \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 \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\n#include\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\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\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\n\nint min(int a, int b, int c)\n{\n\tint\tmin = a;\n\tif(bmax)\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 \n#include \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\n#include\nlong int min_v(long int a,long int b)\n{\n\tif(a=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 \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\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 && ee && e==f && f1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e==f && ee && g==e && g1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && ee && e==f && f1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && ee && g==e && g1==0)\n printf(\"%d\",(e*7)+4);\n else if(e1==2 && ee && e==f && f1==0)\n printf(\"%d\",(e*7)+3);\n else if(e1==2 && e==f && ef && 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 && ff && 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){\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 && gg && 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 && gg && 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\n#include\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=camax){\n max=count;\n }\n }\n printf(\"%lld\\n\",totald+max);\n return 0;\n}\n"}, {"source_code": "#include\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 \n#include \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(a1c1)\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\n#include\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\n#include\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\ntypedef long long ll;\nint nnn(int a,int b,int c)\n{\nif(ab)?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\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\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\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;ir/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\n#include \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 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\n#include\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\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=((fmax) max=res[i];\n\t}\n\n\tprintf(\"%d\",ans+max);\n\n\treturn 0;\n}"}, {"source_code": "#include \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=((fmax) max=res[i];\n\t}\n\t\n\tprintf(\"%d\",ans+max);\n\n\treturn 0;\n}"}, {"source_code": "#include \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/22 ) 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 \n#include \n#include \n#include \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\n#include\n#include\n#include\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の配列数,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//月\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(min0){\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(min0){\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(min0){\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(min0){\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\n#include\n#include\n#include\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の配列数,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//月\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(min0){\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(min0){\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(min0){\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(min0){\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(min0){\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\n#include\n#include\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/3r/2&&r/2\n#include\n#include\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/3r/2&&r/2\n#include\n#include\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/3r/2&&r/2\n#include\n#include\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/3r/2&&r/2\n\nint min(int a, int b)\n{\n if (a3)\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 \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\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(c1c3)\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 \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(c1c3)\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\n\nint min(int a, int b, int c)\n{\n\tint\tmin = a;\n\tif(bmax)\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\n\nint min(int a, int b, int c)\n{\n\tint\tmin = a;\n\tif(bmax)\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\n\nint min(int a, int b, int c)\n{\n\tint\tmin = a;\n\tif(bmax)\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\n#include\nlong int min_v(long int a,long int b)\n{\n\tif(a=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\n#include\nlong int min_v(long int a,long int b)\n{\n\tif(a=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\n#include\nlong int min_v(long int a,long int b)\n{\n\tif(a=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\n#include\nmain()\n{\n\tint n,b,a,i,ac;\n\tscanf(\"%d %d %d\",&n,&b,&a);\n\tint ar[200002];\nfor(i=0;i0)\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 \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\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 && ee && e==f && f1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e==f && ee && g==e && g1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && ee && e==f && f1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && ee && g==e && g1==0)\n printf(\"%d\",(e*7)+3);\n else if(e1==2 && ee && e==f && f1==0)\n printf(\"%d\",(e*7)+3);\n else if(e1==2 && e==f && ef && 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 && ff && 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){\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 && gg && 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 && gg && 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\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 && ee && e==f && f1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e==f && ee && g==e && g1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && ee && e==f && f1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && ef && 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 && ff && 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){\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 && gg && 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 && gg && 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\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 && ee && e==f && f1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e==f && ee && g==e && g1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && ee && e==f && f1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && ee && g==e && g1==0)\n printf(\"%d\",(e*7)+3);\n else if(e1==2 && ee && e==f && f1==0)\n printf(\"%d\",(e*7)+3);\n else if(e1==2 && e==f && ef && 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 && ff && 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){\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 && gg && 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 && gg && 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\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(e2g2){\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\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 && ee && e==f && f1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e==f && ee && g==e && g1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && ee && e==f && f1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && ef && 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 && ff && 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){\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 && gg && 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 && gg && 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\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 && ee && e==f && f1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e==f && ee && g==e && g1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && ee && e==f && f1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && ee && g==e && g1==0)\n printf(\"%d\",(e*7)+3);\n else if(e1==2 && ee && e==f && f1==0)\n printf(\"%d\",(e*7)+3);\n else if(e1==2 && e==f && ef && 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 && ff && 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){\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 && gg && 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 && gg && 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\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 && ee && e==f && f1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e==f && ee && g==e && g1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && ee && e==f && f1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && ef && 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 && ff && 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){\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 && gg && 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 && gg && 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\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 && ee && e==f && f1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e==f && ee && g==e && g1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && ee && e==f && f1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && ee && g==e && g1==0)\n printf(\"%d\",(e*7)+3);\n else if(e1==2 && ee && e==f && f1==0)\n printf(\"%d\",(e*7)+3);\n else if(e1==2 && e==f && ef && 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 && ff && 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){\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 && gg && 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 && gg && 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\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 && ee && e==f && f1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e==f && ee && g==e && g1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && ee && e==f && f1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && ee && g==e && g1==0)\n printf(\"%d\",(e*7)+3);\n else if(e1==2 && ee && e==f && f1==0)\n printf(\"%d\",(e*7)+3);\n else if(e1==2 && e==f && ef && 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 && ff && 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){\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 && gg && 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 && gg && 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\n#include\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=camax){\n max=count;\n }\n }\n printf(\"%lld\\n\",totald+max);\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\n\nint main(){\n\n long long totald,min,a,b,c,ca,cb,cc;\n scanf(\"%lld%lld%lld\",&b,&a,&c);\n ca=a/3;a=a%3;\n cb=b/2;b=b%2;\n cc=c/2;c=c%2;\n min=camax){\n max=count;\n }\n }\n printf(\"%lld\\n\",totald+max);\n return 0;\n}\n"}, {"source_code": "#include\n#include\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=camax){\n max=count;\n }\n }\n printf(\"%lld\\n\",totald+max);\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\n\nint main(){\n\n long long totald,min,a,b,c,ca,cb,cc;\n scanf(\"%lld%lld%lld\",&b,&a,&c);\n ca=a/3;a=a%3;\n cb=b/2;b=b%2;\n cc=c/2;c=c%2;\n min=camax){\n max=count;\n }\n }\n printf(\"%lld\\n\",totald+max);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,c,i=0;\n scanf(\"%d %d %d\",&a,&b,&c);\n while(b>=2 && a>=3 && c>=2)\n {\n a=a-3;\n b=b-2;c=c-2;\n i=i+7;\n }\n if(a>=2 && b>=2 && c==0)\n {\n i=i+4;\n printf(\"%d\",i);\n return 0;\n\n }\n else if(a>=1 && b==1 && c==0)\n {\n i=i+4;\n printf(\"%d\",i);\n return 0;\n\n }\n if(a>=1 && b==0 && c>=2)\n {\n i=i+3;\n printf(\"%d\",i);\n return 0;\n\n }\n else if(a>=2 && c==1 && b==0)\n {\n i=i+2;\n printf(\"%d\",i);\n return 0;\n\n }\n if(b>=1 && c>=1 && a==0)\n {\n i=i+2;\n printf(\"%d\",i);\n return 0;\n\n }\n else if((b>=1 && a==0)||(c>=1 && a==0))\n {\n i++;\n printf(\"%d\",i);\n return 0;\n }\n if(a>=2 && b==0 && c==0)\n {\n i=i+2;\n printf(\"%d\",i);\n return 0;\n\n }\n else if(a>=1 && b==0 && c==0)\n {\n i++;\n printf(\"%d\",i);\n return 0;\n\n }\n if (a==0 && b==0 && c>=1)\n {\n i++;\n printf(\"%d\",i);\n return 0;\n\n }\n if (a==0 && c==0 && b>=1)\n {\n i++;\n printf(\"%d\",i);\n return 0;\n\n }\n if(a==2 && b>=2 && c>=2)\n {\n i=i+6;\n printf(\"%d\",i);\n return 0;\n\n }\n else if(a==2 && b>=1 && c>=1)\n {\n i=i+4;\n printf(\"%d\",i);\n return 0;\n\n }\n else if(a==1 && b>=2 && c>=2)\n {\n i=i+5;\n printf(\"%d\",i);\n return 0;\n\n }\n else if(a==1 && b>=1 && c>=1)\n {\n i=i+3;\n }\n if(b==1 && a>=3 && c>=2)\n {\n i=i+6;\n printf(\"%d\",i);\n return 0;\n\n }\n else if(b==1 && a>=2 && c>=1)\n {\n i=i+4;\n printf(\"%d\",i);\n return 0;\n\n }\n if(a>=3 && b>=2 && c==1)\n {\n i=i+6;\n printf(\"%d\",i);\n return 0;\n\n }\n else if(a>=2 && b>=1 && c==1)\n {\n i=i+4;\n printf(\"%d\",i);\n return 0;\n\n }\n else if(a>=2 && b>=2 && c==1)\n {\n i=i+5;\n printf(\"%d\",i);\n return 0;\n\n }\n printf(\"%d\",i);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,c,i=0;\n scanf(\"%d %d %d\",&a,&b,&c);\n while(b>=2 && a>=3 && c>=2)\n {\n a=a-3;\n b=b-2;c=c-2;\n i=i+7;\n }\n if(a>=2 && b>=2 && c==0)\n {\n i=i+4;\n\n }\n else if(a>=1 && c==0)\n {\n i=i+4;\n\n }\n if(a>=1 && b==0 && c>=2)\n {\n i=i+3;\n\n }\n else if(a>=2 && b==0)\n {\n i=i+2;\n\n }\n if(b>=1 && c>=1 && a==0)\n {\n i=i+2;\n\n }\n else if((b>=1 && a==0)||(c>=1 && a==0))\n {\n i++;\n\n }\n if(a>=2 && b==0 && c==0)\n {\n i=i+2;\n\n }\n else if(a>=1 && b==0 && c==0)\n {\n i++;\n\n }\n if (a==0 && b==0)\n {\n i++;\n\n }\n if (a==0 && c==0)\n {\n i++;\n\n }\n if(a>=2 && b>=1 && c>=1)\n {\n i=i+4;\n\n }\n else if(a>=1 && b>=2 && c>=2)\n {\n i=i+5;\n\n }\n else if(a>=1 && b>=1 && c>=1)\n {\n i=i+3;\n }\n printf(\"%d\",i);\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,c,i=0;\n scanf(\"%d %d %d\",&a,&b,&c);\n while(b>=2 && a>=3 && c>=2)\n {\n a=a-3;\n b=b-2;c=c-2;\n i=i+7;\n }\n if(a>=2 && b>=2 && c==0)\n {\n i=i+4;\n printf(\"%d\",i);\n return 0;\n\n }\n else if(a>=1 && b==1 && c==0)\n {\n i=i+4;\n printf(\"%d\",i);\n return 0;\n\n }\n if(a>=1 && b==0 && c>=2)\n {\n i=i+3;\n printf(\"%d\",i);\n return 0;\n\n }\n else if(a>=2 && c==1 && b==0)\n {\n i=i+2;\n printf(\"%d\",i);\n return 0;\n\n }\n if(b>=1 && c>=1 && a==0)\n {\n i=i+2;\n printf(\"%d\",i);\n return 0;\n\n }\n else if((b>=1 && a==0)||(c>=1 && a==0))\n {\n i++;\n printf(\"%d\",i);\n return 0;\n\n }\n if(a>=2 && b==0 && c==0)\n {\n i=i+2;\n printf(\"%d\",i);\n return 0;\n\n }\n else if(a>=1 && b==0 && c==0)\n {\n i++;\n printf(\"%d\",i);\n return 0;\n\n }\n if (a==0 && b==0 && c>=1)\n {\n i++;\n printf(\"%d\",i);\n return 0;\n\n }\n if (a==0 && c==0 && b>=1)\n {\n i++;\n printf(\"%d\",i);\n return 0;\n\n }\n if(a==2 && b>=2 && c>=2)\n {\n i=i+6;\n printf(\"%d\",i);\n return 0;\n\n }\n else if(a==2 && b>=1 && c>=1)\n {\n i=i+4;\n printf(\"%d\",i);\n return 0;\n\n }\n else if(a==1 && b>=2 && c>=2)\n {\n i=i+5;\n printf(\"%d\",i);\n return 0;\n\n }\n else if(a==1 && b>=1 && c>=1)\n {\n i=i+3;\n }\n if(b==1 && a>=3 && c>=3)\n {\n i=i+6;\n printf(\"%d\",i);\n return 0;\n\n }\n if(a>=3 && b>=2 && c==1)\n {\n i=i+6;\n printf(\"%d\",i);\n return 0;\n\n }\n printf(\"%d\",i);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,c,i=0;\n scanf(\"%d %d %d\",&a,&b,&c);\n while(b>=2 && a>=3 && c>=2)\n {\n a=a-3;\n b=b-2;c=c-2;\n i=i+7;\n }\n if(a>=2 && b>=2 && c==0)\n {\n i=i+4;\n\n }\n else if(a>=1 && c==0)\n {\n i=i+4;\n\n }\n if(a>=1 && b==0 && c>=2)\n {\n i=i+3;\n\n }\n else if(a>=2 && b==0)\n {\n i=i+2;\n\n }\n if(b>=1 && c>=1 && a==0)\n {\n i=i+2;\n\n }\n else if((b>=1 && a==0)||(c>=1 && a==0))\n {\n i++;\n\n }\n if(a>=2 && b==0 && c==0)\n {\n i=i+2;\n\n }\n else if(a>=1 && b==0 && c==0)\n {\n i++;\n\n }\n if (a==0 && b==0 && c>=1)\n {\n i++;\n\n }\n if (a==0 && c==0 && b>=1)\n {\n i++;\n\n }\n if(a>=2 && b>=1 && c>=1)\n {\n i=i+4;\n\n }\n else if(a>=1 && b>=2 && c>=2)\n {\n i=i+5;\n\n }\n else if(a>=1 && b>=1 && c>=1)\n {\n i=i+3;\n }\n printf(\"%d\",i);\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,c,i=0;\n scanf(\"%d %d %d\",&a,&b,&c);\n while(b>=2 && a>=3 && c>=2)\n {\n a=a-3;\n b=b-2;c=c-2;\n i=i+7;\n }\n if(a>=2 && b>=2 && c==0)\n {\n i=i+4;\n printf(\"%d\",i);\n return 0;\n\n }\n else if(a>=1 && b==1 && c==0)\n {\n i=i+4;\n printf(\"%d\",i);\n return 0;\n\n }\n if(a>=1 && b==0 && c>=2)\n {\n i=i+3;\n printf(\"%d\",i);\n return 0;\n\n }\n else if(a>=2 && c==1 && b==0)\n {\n i=i+2;\n printf(\"%d\",i);\n return 0;\n\n }\n if(b>=1 && c>=1 && a==0)\n {\n i=i+2;\n printf(\"%d\",i);\n return 0;\n\n }\n else if((b>=1 && a==0)||(c>=1 && a==0))\n {\n i++;\n printf(\"%d\",i);\n return 0;\n\n }\n if(a>=2 && b==0 && c==0)\n {\n i=i+2;\n printf(\"%d\",i);\n return 0;\n\n }\n else if(a>=1 && b==0 && c==0)\n {\n i++;\n printf(\"%d\",i);\n return 0;\n\n }\n if (a==0 && b==0 && c>=1)\n {\n i++;\n printf(\"%d\",i);\n return 0;\n\n }\n if (a==0 && c==0 && b>=1)\n {\n i++;\n printf(\"%d\",i);\n return 0;\n\n }\n if(a>=2 && b>=1 && c>=1)\n {\n i=i+4;\n printf(\"%d\",i);\n return 0;\n\n }\n else if(a>=1 && b>=2 && c>=2)\n {\n i=i+5;printf(\"%d\",i);\n return 0;\n\n }\n else if(a>=1 && b>=1 && c>=1)\n {\n i=i+3;\n }\n printf(\"%d\",i);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,c,i=0;\n scanf(\"%d %d %d\",&a,&b,&c);\n while(b>=2 && a>=3 && c>=2)\n {\n a=a-3;\n b=b-2;c=c-2;\n i=i+7;\n }\n if(a>=2 && b>=2 && c==0)\n {\n i=i+4;\n\n }\n else if(a>=1 && b==1 && c==0)\n {\n i=i+4;\n\n }\n if(a>=1 && b==0 && c>=2)\n {\n i=i+3;\n\n }\n else if(a>=2 && c==1 && b==0)\n {\n i=i+2;\n\n }\n if(b>=1 && c>=1 && a==0)\n {\n i=i+2;\n\n }\n else if((b>=1 && a==0)||(c>=1 && a==0))\n {\n i++;\n\n }\n if(a>=2 && b==0 && c==0)\n {\n i=i+2;\n\n }\n else if(a>=1 && b==0 && c==0)\n {\n i++;\n\n }\n if (a==0 && b==0 && c>=1)\n {\n i++;\n\n }\n if (a==0 && c==0 && b>=1)\n {\n i++;\n\n }\n if(a>=2 && b>=1 && c>=1)\n {\n i=i+4;\n\n }\n else if(a>=1 && b>=2 && c>=2)\n {\n i=i+5;\n\n }\n else if(a>=1 && b>=1 && c>=1)\n {\n i=i+3;\n }\n printf(\"%d\",i);\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,c,i=0;\n scanf(\"%d %d %d\",&a,&b,&c);\n while(b>=2 && a>=3 && c>=2)\n {\n a=a-3;\n b=b-2;c=c-2;\n i=i+7;\n }\n if(a>=2 && b>=2 && c==0)\n {\n i=i+4;\n }\n else if(a>=1 && c==0)\n {\n i=i+4;\n }\n if(a>=1 && b==0 && c>=2)\n {\n i=i+3;\n }\n else if(a>=2 && b==0)\n {\n i=i+2;\n }\n if(b>=1 && c>=1 && a==0)\n {\n i=i+2;\n }\n else if((b>=1 && a==0)||(c>=1 && a==0))\n {\n i++;\n }\n if(a>1 && b==0 && c==0)\n {\n i++;\n }\n if(a>=2 && b>=1 && c>=1)\n {\n i=i+4;\n }\n else if(a>=1 && b>=1 && c>=1)\n {\n i=i+3;\n }\n printf(\"%d\",i);\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,c,i=0;\n scanf(\"%d %d %d\",&a,&b,&c);\n while(b>=2 && a>=3 && c>=2)\n {\n a=a-3;\n b=b-2;c=c-2;\n i=i+7;\n }\n if(a>=3 && b>=2 && c==1)\n {\n i=i+6;\n printf(\"%d\",i);\n return 0;\n\n }\n if(a==2 && b>=2 && c>=2)\n {\n i=i+6;\n printf(\"%d\",i);\n return 0;\n\n }\n if(b==1 && a>=3 && c>=2)\n {\n i=i+6;\n printf(\"%d\",i);\n return 0;\n\n }\n if(a>=2 && b>=2 && c==1)\n {\n i=i+5;\n printf(\"%d\",i);\n return 0;\n\n }\n if(a==1 && b>=2 && c>=2)\n {\n i=i+5;\n printf(\"%d\",i);\n return 0;\n\n }\n if(a>=2 && b>=2 && c==0)\n {\n i=i+4;\n printf(\"%d\",i);\n return 0;\n\n }\n if(a>=1 && b>=1 && c==0)\n {\n i=i+4;\n printf(\"%d\",i);\n return 0;\n\n }\n if(b==1 && a>=2 && c>=1)\n {\n i=i+4;\n printf(\"%d\",i);\n return 0;\n\n }\n\n if(a>=2 && b>=1 && c==1)\n {\n i=i+4;\n printf(\"%d\",i);\n return 0;\n\n }\n if(a==2 && b>=1 && c>=1)\n {\n i=i+4;\n printf(\"%d\",i);\n return 0;\n\n }\n if(a==1 && b>=1 && c>=1)\n {\n i=i+3;\n printf(\"%d\",i);\n return 0;\n }\n if(a>=1 && b==0 && c>=2)\n {\n i=i+3;\n printf(\"%d\",i);\n return 0;\n\n }\n if(a>=2 && c>=1 && b==0)\n {\n i=i+2;\n printf(\"%d\",i);\n return 0;\n\n }\n if(b>=1 && c>=1 && a==0)\n {\n i=i+2;\n printf(\"%d\",i);\n return 0;\n\n }\n if(a>=2 && b==0 && c==0)\n {\n i=i+2;\n printf(\"%d\",i);\n return 0;\n\n }\n if((b>=1 && a==0)||(c>=1 && a==0))\n {\n i++;\n printf(\"%d\",i);\n return 0;\n }\n if(a>=1 && b==0 && c==0)\n {\n i++;\n printf(\"%d\",i);\n return 0;\n\n }\n if (a==0 && b==0 && c>=1)\n {\n i++;\n printf(\"%d\",i);\n return 0;\n\n }\n if (a==0 && c==0 && b>=1)\n {\n i++;\n printf(\"%d\",i);\n return 0;\n\n }\n printf(\"%d\",i);\n return 0;\n}\n"}, {"source_code": "#include \n#include \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(a1c1)\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\n {\n if(c>1)ans+=a+!(!b)+!(!c)+(b>1)+(c>1);\n else ans+=a+2;\n }\n }else\n {\n if(b==0)\n c=0;\n ans+=!(!a)+!(!b)+!(!c)+(a>1)+(b>1);\n \n }\n printf(\"%lld\",ans);\n return 0;\n}"}, {"source_code": "#include \n#include \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(a1c1)\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\n {\n if(c>1)ans+=a+!(!b)+!(!c)+(b>1)+(c>1);\n else ans+=a+2;\n }\n }else\n {\n if(b==0&&c<2)\n c=0;\n ans+=!(!a)+!(!b)+!(!c)+(a>1)+(b>1);\n if(a==0&&b!=0&&c!=0)\n ans--;\n }\n printf(\"%lld\",ans);\n return 0;\n}"}, {"source_code": "#include \n#include \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(a1c1)\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(b==0&&c<2)\n c=0;\n ans+=!(!a)+!(!b)+!(!c)+(a>1)+(b>1);\n if(a==0&&b!=0&&c!=0)\n ans--;\n }\n printf(\"%lld\",ans);\n return 0;\n}"}, {"source_code": "#include \n#include \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(a1c1)\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+=!(!a)+!(!b);\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}\n"}, {"source_code": "#include \n#include \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(a1c1)\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\n {\n if(c>1||b>1)ans+=a+!(!b)+!(!c)+(b>1)+(c>1);\n else ans+=a+2;\n }\n }else\n {\n if(b==0&&c<2)\n c=0;\n ans+=!(!a)+!(!b)+!(!c)+(a>1)+(b>1);\n if(a==0&&b!=0&&c!=0)\n ans--;\n }\n printf(\"%lld\",ans);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n long int a,b,c,a1,b1,c1,z,ans=0;\n scanf(\"%ld %ld %ld\",&a,&b,&c);\n a1=a/3;\n b1=b/2;\n c1=c/2;\n\n if(a1c1)\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\n {\n if(c>1)ans+=a+!(!b)+!(!c)+(b>1)+(c>1);\n else ans+=a+2;\n }\n }else\n {\n if(b==0)\n c=0;\n ans+=!(!a)+!(!b)+!(!c)+(a>1)+(b>1);\n }\n printf(\"%ld\",ans);\n return 0;\n}"}, {"source_code": "#include \n#include \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(a1c1)\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+=(a>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 \n#include \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(a1c1)\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\n {\n if(c>1)ans+=a+!(!b)+!(!c)+(b>1)+(c>1);\n else ans+=a+2;\n }\n }else\n {\n if(b==0&&c<2)\n c=0;\n ans+=!(!a)+!(!b)+!(!c)+(a>1)+(b>1);\n\n }\n printf(\"%lld\",ans);\n return 0;\n}\n"}, {"source_code": "#include\n#include\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==0&&c>=2)\n\t\t{\n\t\t\tans=ans+3;\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\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}\n\t\t}\n\t\t\n\t\tprintf(\"%d\\n\",ans);\n\t}\n\treturn 0;\n } "}, {"source_code": "#include\n#include\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==0&&c>=2)\n\t\t{\n\t\t\tans=ans+3;\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}\n\t\t}\n\t\t\n\t\tprintf(\"%d\\n\",ans);\n\t}\n\treturn 0;\n } "}, {"source_code": "#include\n#include\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==0&&c>=2)\n\t\t{\n\t\t\tans=ans+3;\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}\n\t\t}\n\t\t\n\t\tprintf(\"%d\\n\",ans);\n\t}\n\treturn 0;\n } "}, {"source_code": "#include\n#include\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==0&&c>=2)\n\t\t{\n\t\t\tans=ans+3;\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 \n#include \n\nlong long a ,b,c,mini,nr;\n\nint main()\n{\nscanf(\"%I64d %I64d %I64d\",&a,&b,&c);\nmini=a/3;\nif(b/2 1)\n{\n\n\na=a-3*mini;\nb=b-2*mini;\nc=c-2*mini;\nnr=mini*7;\n\n}\nif(a>3)\n a=3;\nif(b>2)\n b=2;\nif(c>2)\n c=2;\nprintf(\"%I64d %I64d %I64d \",a,b,c);\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\n if(b!=0 && c!=0 && a>0)\n {\n\n if(c==2)\n nr=nr+a+b+c;\n else\n nr=nr+3;\n\n }\n else\n if(a==0 && c>0 && c>0)\n nr=nr+2;\n else\n\n nr++;\n\n}\nelse\n\n if(a==b || a==c )\n if(b!=c)\n if(b==0 )\n nr=nr+3;\n else\n nr=nr+a+b+c;\n\n\n\n\nprintf(\"%I64d\",nr);\n\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \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 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+3;\n else\n nr=nr+a+b+c;\n\nprintf(\"%I64d\",nr);\n\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nlong long a ,b,c,mini,nr;\n\nint main()\n{\nscanf(\"%I64d %I64d %I64d\",&a,&b,&c);\nmini=a/3;\nif(b/2 3)\n a=3;\nif(b>2)\n b=2;\nif(c>2)\n c=2;\nnr=mini*7;\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\n{if(b>a || c>a)\n if(b!=0 && c!=0 && a>0)\n {\n\n if(c==2)\n nr=nr+a+b+c;\n else\n nr=nr+3;\n\n }\n else\n if(a==0 && c>0 && c>0)\n nr=nr+2;\n else\n\n nr++;\n\n}\n\nprintf(\"%I64d\",nr);\n\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nlong long a ,b,c,mini,nr;\n\nint main()\n{\nscanf(\"%I64d %I64d %I64d\",&a,&b,&c);\nmini=a/3;\nif(b/2 3)\n a=3;\nif(b>2)\n b=2;\nif(c>2)\n c=2;\nnr=mini*7;\nif(a==b && b==c)\n nr=nr+a+b+c;\nif(a>b && a>c)\n{\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\n{if(b>a || c>a)\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 else\n\n nr++;\n\n}\n\nprintf(\"%I64d\",nr);\n\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \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 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 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 else\n if(b!=0 && c!=0 && a>0)\n {\n\n if(c==2)\n nr=nr+a+b+c;\n else\n nr=nr+3;\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+3;\n else\n nr=nr+a+b+c;\n\n\n\n\nprintf(\"%I64d\",nr);\n\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nlong long a ,b,c,mini,nr;\n\nint main()\n{\nscanf(\"%I64d %I64d %I64d\",&a,&b,&c);\nmini=a/3;\nif(b/2 3)\n a=3;\nif(b>2)\n b=2;\nif(c>2)\n c=2;\nnr=mini*7;\nif(a==b && b==c)\n nr=nr+a+b+c;\nif(a>b && a>c)\n{\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\n{if(b>a || c>a)\n if(b!=0 && c!=0 )\n nr=nr+a+2;\n else\n\n nr++;\n\n}\n\nprintf(\"%I64d\",nr);\n\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \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 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 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 else\n if(b!=0 && c!=0 && a>0)\n {\n\n if(c==2)\n nr=nr+a+b+c;\n else\n nr=nr+3;\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+3;\n else\n nr=nr+a+b+c;\n\nprintf(\"%I64d\",nr);\n\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \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 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 if(a>0)\n {\n\n\n if(b==0)\n nr=nr+3;\n if(c==0)\n nr=nr+2;\n\n }\n\n else\n if(b!=0 && c!=0 && a>0)\n {\n\n if(c==2)\n nr=nr+a+b+c;\n else\n nr=nr+3;\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+3;\n else\n nr=nr+a+b+c;\n\n\n\n\nprintf(\"%I64d\",nr);\n\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nlong long a ,b,c,mini,nr;\n\nint main()\n{\nscanf(\"%I64d %I64d %I64d\",&a,&b,&c);\nmini=a/3;\nif(b/2 1)\n{\n\n\na=a-3*mini;\nb=b-2*mini;\nc=c-2*mini;\nnr=mini*7;\n\n}\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\n if(b!=0 && c!=0 && a>0)\n {\n\n if(c==2)\n nr=nr+a+b+c;\n else\n nr=nr+3;\n\n }\n else\n if(a==0 && c>0 && c>0)\n nr=nr+2;\n else\n\n nr++;\n\n}\nelse\n\n if(a==b || a==c )\n if(b!=c)\n if(b==0 )\n nr=nr+3;\n else\n nr=nr+a+b+c;\n\n\n\n\nprintf(\"%I64d\",nr);\n\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \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 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\n if(b!=0 && c!=0 && a>0)\n {\n\n if(c==2)\n nr=nr+a+b+c;\n else\n nr=nr+3;\n\n }\n else\n if(a==0 && c>0 && c>0)\n nr=nr+2;\n else\n\n nr++;\n\n}\nelse\n\n if(a==b || a==c )\n if(b!=c)\n if(b==0 )\n nr=nr+3;\n else\n nr=nr+a+b+c;\n\n\n\n\nprintf(\"%I64d\",nr);\n\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nlong long a ,b,c,mini,nr;\n\nint main()\n{\nscanf(\"%I64d %I64d %I64d\",&a,&b,&c);\nmini=a/3;\nif(b/2 1)\n{\n\n\na=a-3*mini;\nb=b-2*mini;\nc=c-2*mini;\nnr=mini*7;\n}\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\n if(b!=0 && c!=0 && a>0)\n {\n\n if(c==2)\n nr=nr+a+b+c;\n else\n nr=nr+3;\n\n }\n else\n if(a==0 && c>0 && c>0)\n nr=nr+2;\n else\n\n nr++;\n\n}\nelse\n\n if(a==b || a==c)\n if(b==0 )\n nr=nr+3;\n else\n nr=nr+a+b+c;\n\n\n\n\nprintf(\"%I64d\",nr);\n\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nlong long a ,b,c,mini,nr;\n\nint main()\n{\nscanf(\"%I64d %I64d %I64d\",&a,&b,&c);\nmini=a/3;\nif(b/2 3)\n a=3;\nif(b>2)\n b=2;\nif(c>2)\n c=2;\nnr=mini*7;\nif(a==b && b==c)\n nr=nr+a+b+c;\nif(a>b && a>c)\n{\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\n{if(b>a || c>a)\n if(b!=0 && c!=0 && a>0)\n {\n\n if(c==2)\n nr=nr+a+b+c;\n else\n nr=nr+3;\n\n }\n else\n if(a==0 && c>0 && c>0)\n nr=nr+2;\n else\n\n nr++;\n\n}\n\nprintf(\"%I64d\",nr);\n\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nlong long a ,b,c,mini,nr;\n\nint main()\n{\nscanf(\"%I64d %I64d %I64d\",&a,&b,&c);\nmini=a/3;\nif(b/2 3)\n a=3;\nif(b>2)\n b=2;\nif(c>2)\n c=2;\nnr=mini*7;\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\n if(b!=0 && c!=0 && a>0)\n {\n\n if(c==2)\n nr=nr+a+b+c;\n else\n nr=nr+3;\n\n }\n else\n if(a==0 && c>0 && c>0)\n nr=nr+2;\n else\n\n nr++;\n}\nelse\n if(a==b || a==c)\n if(b==0 )\n nr=nr+3;\n else\n nr=nr+a+b+c;\n\n\n\nprintf(\"%I64d\",nr);\n\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \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 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 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 else\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 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+3;\n else\n nr=nr+a+b+c;\n\n\n\n\nprintf(\"%I64d\",nr);\n\n\n return 0;\n}\n"}], "src_uid": "e17df52cc0615585e4f8f2d31d2daafb"} {"nl": {"description": "Little girl Tanya is learning how to decrease a number by one, but she does it wrong with a number consisting of two or more digits. Tanya subtracts one from a number by the following algorithm: if the last digit of the number is non-zero, she decreases the number by one; if the last digit of the number is zero, she divides the number by 10 (i.e. removes the last digit). You are given an integer number $$$n$$$. Tanya will subtract one from it $$$k$$$ times. Your task is to print the result after all $$$k$$$ subtractions.It is guaranteed that the result will be positive integer number.", "input_spec": "The first line of the input contains two integer numbers $$$n$$$ and $$$k$$$ ($$$2 \\le n \\le 10^9$$$, $$$1 \\le k \\le 50$$$) — the number from which Tanya will subtract and the number of subtractions correspondingly.", "output_spec": "Print one integer number — the result of the decreasing $$$n$$$ by one $$$k$$$ times. It is guaranteed that the result will be positive integer number. ", "sample_inputs": ["512 4", "1000000000 9"], "sample_outputs": ["50", "1"], "notes": "NoteThe first example corresponds to the following sequence: $$$512 \\rightarrow 511 \\rightarrow 510 \\rightarrow 51 \\rightarrow 50$$$."}, "positive_code": [{"source_code": "#include\n#include\n#include\n#include\nint main()\n{int a,b;\nscanf(\"%d%d\",&a,&b);\nwhile(b--)\n{\n if(a%10!=0)\n a=a-1;\n else\n a=a/10;\n}\nprintf(\"%d\\n\",a);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main(){\n long n;\n int k;\n \n scanf(\"%ld%d\", &n, &k);\n \n for(int i = 0; i < k; i++){\n if(n % 10 == 0)\n n /= 10;\n else\n n--;\n }\n printf(\"%ld\", n);\n}"}, {"source_code": "#include \n\nint main(){\n int n,k;\n scanf(\"%d %d\",&n,&k);\n for(int i = 0;i < k;i++){\n if(n == 0){\n break;\n }\n if(n%10 == 0){\n n = n/10;\n }\n else{\n n--;\n }\n }\n printf(\"%d\",n);\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int number,loop,k;\n scanf(\"%d %d\",&number,&loop);\n for(k=1;k<=loop;k++)\n {\n if(number%10==0)\n {\n number=number/10;\n }\n else\n {\n number=number-1;\n }\n }\n printf(\"%d\",number);\n return 0;\n}\n"}, {"source_code": "main()\n{\n long long n,k,i;\n scanf(\"%lld %lld\",&n,&k);\n for(i=1;i<=k;i++)\n {\n if(n%10==0)\n {\n n=n/10;\n }\n else\n {\n n--;\n }\n\n }\n printf(\"%lld\",n);\n}\n"}, {"source_code": "#include \n\nint main(int argc, char const *argv[])\n{\n /* code */\n long int n, k;\n scanf(\"%ld %ld\", &n, &k);\n\n for(int i = 0; i < k; i++){\n if(n % 10 == 0)\n n = n / 10;\n else\n n--;\n }\n printf(\"%ld\\n\", n);\n return 0;\n}"}, {"source_code": "#include\nint main(){\n int n,k,j ;\n scanf(\"%d %d\",&n,&k);\n \n for(;k>0;){\n j=n%10;\n if(k>j){\n n/=10;\n k-=j;\n k-=1; }\n else{n-=k;\n k=0;}\n }\n printf(\"%d\",n);\n return 0;\n \n}"}, {"source_code": "#include\nint main()\n{\n int a,b,n,i;\n scanf(\"%d %d\",&a,&b);\n for(i=1;i<=b;i++)\n {\n if(a%10==0)\n {\n a=a/10;\n }\n else {a=a-1;}\n }\n printf(\"%d\",a);\n return 0;\n}\n"}, {"source_code": "#include\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\n}"}, {"source_code": "#include\nint main()\n{\n int n,k,l;\n scanf(\"%d%d\",&n,&k);\n while(k!=0)\n {\n l=n%10;\n if(l!=0)\n {\n if(l<=k)\n {\n n=n-l;\n k=k-l;\n }\n else\n {\n n=n-k;\n k=k-k;\n }\n }\n l=n%10;\n if(l==0&&k!=0)\n {\n \n n=n/10;\n k=k-1;\n }\n \n }\n printf(\"%d\\n\",n);\n \n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,k;\n\tscanf(\"%d %d\",&n,&k);\n\tint i;\n\tfor(i=0;i\nint main()\n{\n int n,k,i,a;\n scanf(\"%d%d\",&n,&k);\n for(i=0;i\n\nint main()\n{\n int n, k, temp;\n scanf(\"%d %d\", &n, &k);\n \n while(k > 0) {\n \tif(n % 10 == 0) {\n \t\tn /= 10;\n \t\tk--;\n\t\t} else if(n % 10 >= k) {\n\t\t\ttemp = k;\n\t\t\tk -= n % 10;\n \t\tn -= temp;\n\t\t} else {\n\t\t\tk -= (n % 10 + 1);\n\t\t\tn /= 10;\n\t\t}\n\t}\n\n\tprintf(\"%d\", n);\n\t\n return 0;\n}\n"}, {"source_code": "#include\nint main(){long long n,k;\nscanf(\"%I64d%I64d\",&n,&k);\nfor(int i=0;i\n\nint main(){\n int n,k;\n scanf(\"%d %d\",&n,&k);\n for(int i = 0;i < k;i++){\n if(n == 0){\n break;\n }\n if(n%10 == 0){\n n = n/10;\n }\n else{\n n--;\n }\n }\n printf(\"%d\",n);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\nlong int n,k,i;\nscanf(\"%ld%ld\",&n,&k);\n\nfor(i=0;i\nint main()\n{\n\tint n,k;\n\tscanf(\"%d %d\",&n,&k);\n\tint i;\n\tfor(i=0;i\nint main()\n{\n long long int i,a,k;\n scanf(\"%lld%lld\",&a,&k);\n for(i=0;i\nint main()\n{\n long int n;\n int k;\n scanf(\"%ld %d\",&n,&k);\n for(int i=1;i<=k;i++)\n {\n\tif(n%10==0)\n\t n=n/10;\n \telse\n\t n=n-1;\n }\n printf(\"%ld \\n\",n);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n long int x;\n\n int y, i;\n\n scanf(\"%ld\", &x);\n\n scanf(\"%d\", &y);\n\n for(i=0; i\nint main()\n{\n long long int n,k,i,j,a,b;\n scanf(\"%lld %lld\",&n,&k);\n for(i=1;i<=k;i++)\n {\n a=n%10;\n if(a==0)\n {\n b=n/10;\n n=b;\n }\n else if(a>0)\n {\n b=n-1;\n n=b;\n }\n }\n printf(\"%lld\",n);\n}\n"}, {"source_code": "#include \nint main()\n{\n int n = 0, k = 0, i;\n \n scanf(\"%d %d\", &n, &k);\n \n for(int i = 0; i < k; i++){\n if(n % 10 == 0){\n n = n/10;\n }\n else{\n n = n - 1;\n }\n }\n \n printf(\"%d\", n);\n}"}, {"source_code": "\n\n#include\nint main()\n{\n int n,i,k;\n scanf(\"%d %d\",&n,&k);\n for(i=1; i<=k; i++)\n {\n if(n%10==0)\n {\n n=n/10;\n }\n\n else\n {\n n=n-1;\n }\n\n\n }\n\n\n printf(\"%d\\n\",n);\n\n return 0;\n\n\n\n\n\n\n\n\n\n\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n for(int i=1; i<=k; i++)\n {\n if(n%10==0)\n n=n/10;\n else if(n%10!=0)\n n=n-1;\n if(i==k)\n \tprintf(\"%d\",n);\n }\n \n}"}, {"source_code": "#include\nint main()\n{\n int n,k,i,last;\n scanf(\"%d %d\",&n,&k);\n for(i=1;i<=k;i++)\n {\n last=n%10;\n\n if(last!=0)\n {\n n=n-1;\n }\n else\n {\n n=n/10;\n }\n }\n printf(\"%d\\n\",n);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,k,count=0;\n scanf(\"%d%d\",&n,&k);\n\n while(k--)\n {\n if(n%10!=0)\n {\n n--;\n }\n else\n {\n n/=10;\n }\n\n\n\n}\n printf(\"%d\",n);\n}\n"}, {"source_code": "#include\nint main(){\n int n,num;\n scanf(\"%d %d\",&num,&n);\n for(int i=0;i\nvoid main()\n{\n int a;\n int b;\n scanf(\"%d %d\", &a,&b);\n for(int i=0; i\nint main()\n{\n int n,i,last;\n long int k;\n scanf(\"%ld\",&k);\n scanf(\"%d\",&n);\n for(i=0;i\nint main(){\n int n,k,i=0;\n scanf(\"%d %d\",&n,&k);\n while(i\nint main()\n{\nint n,k;\nscanf(\"%d%d\",&n,&k);\nwhile(k)\n{\nif(n%10!=0)\nn=n-1;\nelse\nn=n/10;\nk--;\n\n}\nprintf(\"%d\",n);\nreturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n long long int n;\n int k,i;\n scanf(\"%lld %d\",&n, &k);\n for(i=1;i<=k;i++)\n {\n if(n%10!=0)\n n=n-1;\n else if(n%10==0)\n n=n/10;\n }\n printf(\"%lld\",n);\n return 0;\n \n}"}, {"source_code": "#include\n\nint main()\n{\n long long int a,k,n;\n scanf(\"%I64d %I64d\",&a,&k);\n while(k--)\n {\n if(a%10==0)\n {\n n=a/10;\n a=n;\n }\n else if(a%10!=0)\n {\n n=a-1;\n a=n;\n }\n }\n printf(\"%I64d\",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 \n\nint\nmain ()\n{\n int n;\n int k;\n scanf(\"%d\", &n);\n scanf(\"%d\", &k);\n\n for (int i = 0; i < k; i++)\n {\n if (n % 10 == 0)\n\t{\n\t n = n / 10;\n\t}\n else\n\t{\n\t n = n - 1;\n\t}\n }\n printf(\"%d\", n);\n return 0;\n}\n"}, {"source_code": "#include\nint main(){long long n,k;\nscanf(\"%I64d%I64d\",&n,&k);\nfor(int i=0;i\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nint n,m;\n\nint main()\n{\n\tscanf(\"%d %d\",&n,&m);\n\twhile (m--)\n\t{\n\t\tif (n%10) n--;\n\t\telse n/=10;\n\t}\n\tprintf(\"%d\\n\",n);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int i,a,b,c=0;\n scanf(\"%d %d\",&a,&b);\n if(a%10==0)\n while(1)\n {\n a=a/10;\n if(a%10!=0)\n break;\n }\n for(i=1;i<=b;i++)\n {\n a=a-1;\n if(a==0)\n {\n printf(\"%d\",a+1);\n break;\n }\n if(i==b)\n {\n c++;\n break;\n }\n if(a%10==0)\n while(i\nint main()\n{\n long int n;\n int k;\n scanf(\"%ld %d\",&n,&k);\n for(int i=1;i<=k;i++)\n {\n\tif(n%10==0)\n\t n=n/10;\n \telse\n\t n=n-1;\n }\n printf(\"%ld \\n\",n);\n return 0;\n}\n"}, {"source_code": "#include\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 }\n printf(\"%d\",n);\n}\n"}, {"source_code": "\n#include\n\nint main()\n{\n long int a ,b ;\n scanf(\"%ld %ld\",&a,&b);\n\n int last_digit =0;\n while(b != 0)\n {\n\n last_digit = a % 10;\n if(last_digit!=0)\n {\n\n a = a-1;\n }\n else\n {\n a = a/10;\n }\n\n b--;\n\n }\n\nprintf(\"%ld\\n\",a);\n\nreturn 0;\n\n\n}\n\n"}, {"source_code": "#include \n\nint main()\n{\n int i, n, k;\n\n scanf(\"%d%d\", &n, &k);\n\n for(i = 1; i <= k; i++)\n {\n if(n%10 == 0)\n n = n / 10;\n else\n n = n - 1;\n }\n\n printf(\"%d\\n\", n);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tlong long i,j,k,l,n,m;\n\tscanf(\"%lld%lld\",&n,&k);\n\tfor(i=1;i<=k;i++)\n\t{\n\t\tif(n%10!=0)\n\t\t{\n\t\t\tn=n-1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tn=n/10;\n\t\t}\n\t}\n\tprintf(\"%lld\",n);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,k,i;\n scanf(\"%d\",&n);\n scanf(\"%d\",&k);\n for(i=1;i<=k;i++)\n {\n if(n%10!=0) n--;\n else n=n/10;\n }\n printf(\"%d\",n);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int a,k,num,c;\n scanf(\"%I64d %I64d\",&a,&k);\n while(k--){\n if(a%10==0){\n num=a/10;\n a=num;\n }\n else if(a%10!=0)\n {\n num=a-1;\n a=num;\n }\n }\n printf(\"%I64d\",num);\n return 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n long long int i,a,k;\n scanf(\"%lld%lld\",&a,&k);\n for(i=0;i\nint main()\n{\n long long int a,k,num,c;\n scanf(\"%I64d %I64d\",&a,&k);\n while(k--){\n if(a%10==0){\n num=a/10;\n a=num;\n }\n else if(a%10!=0)\n {\n num=a-1;\n a=num;\n }\n }\n printf(\"%I64d\",num);\n return 0;\n}\n\n"}, {"source_code": "#include \n \nint main()\n{\n long n;\n int k;\n \n scanf(\"%d%d\", &n, &k);\n \n for(int i = 0; i < k; i++)\n {\n if(n%10 == 0)\n {\n n /= 10;\n }\n else\n {\n n -= 1;\n }\n }\n \n printf(\"%d\", n);\n return 0;\n}"}, {"source_code": "#include\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 }\n printf(\"%d\\n\",n);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,n,i;\n scanf(\"%d %d\",&a,&b);\n for(i=1;i<=b;i++)\n {\n if(a%10==0)\n {\n a=a/10;\n }\n else {a=a-1;}\n }\n printf(\"%d\",a);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int i,n,p;\n scanf(\"%d %d\",&n,&p);\n for(i=0;i\n\nint main()\n{\n int n,k;\n scanf(\"%d%d\",&n,&k);\n while(k--)\n {\n int rem=n%10;\n if(rem==0)\n n/=10;\n else\n n-=1;\n }\n printf(\"%d\",n);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(int argc, char const *argv[])\n{\n /* code */\n long int n, k;\n scanf(\"%ld %ld\", &n, &k);\n\n for(int i = 0; i < k; i++){\n if(n % 10 == 0)\n n = n / 10;\n else\n n--;\n }\n printf(\"%ld\\n\", n);\n return 0;\n}"}, {"source_code": "#include \nint main()\n{\n\tint k,x,y,i;\n\tscanf(\"%d %d\", &x,&k);\n\tfor(i=0;i\n \nint main()\n{\n int n,k;\n scanf(\"%d%d\",&n,&k);\n \n while(k!=0)\n {\n if(n%10!=0)\n n=n-1;\n \n else if(n%10==0)\n n=n/10;\n \n k--;\n } \n printf(\"%d\",n); \n}\n"}, {"source_code": "#include\nint main()\n{\n int num,k,i,count=0;\n scanf(\"%d%d\",&num,&k);\n for(i=1;i<=k;i++)\n {\n if((num%10)==0)\n {\n num/=10;\n\n }\n else\n {\n num--;\n\n }\n }\n printf(\"%d\\n\",num);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,k,i;\n scanf(\"%d%d\",&n,&k);\n for (i=1;i<=k;i++){\n if (n%10!=0){\n n--;\n\n }\n else n=n/10;\n }\n printf(\"%d\",n);\n return 0;\n}\n"}, {"source_code": "#include\nmain(void)\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n while(k--)\n {\n if(n%10==0)\n n/=10;\n else\n n-=1;\n }\n printf(\"%d\",n);\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,k,i;\n scanf(\"%d %d\", &n, &k);\n for (i=0;i\n\nint main()\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n\n int count=0;\n int temp=n;\n while(1) {\n if(temp%10==0) {\n temp=temp/10;\n }\n else {\n temp=temp-1;\n }\n count++;\n if(count==k) {\n break;\n }\n }\n printf(\"%d\\n\",temp);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,n,i;\n scanf(\"%d %d\",&a,&b);\n for(i=1;i<=b;i++)\n {\n if(a%10==0)\n {\n a=a/10;\n }\n else {a=a-1;}\n }\n printf(\"%d\",a);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int number,i,n,z;\n scanf(\"%lld%lld\",&number,&n);\n for(i=0;i\nint main(){\n int i,m,a;\n scanf(\"%d %d\",&m,&a);\n for(i=0;i \n#include \n\nint main() {\n\n\tint n, k, t;\n\n\tscanf(\"%d %d\", &n, &k);\n\n\tfor (int i = 0; i < k; i++) {\n\t\tt = n % 10;\n\n\t\tif (t != 0) {\n\t\t\tn = n - 1;\n\t\t}\n\t\telse {\n\t\t\tn = n / 10;\n\t\t}\n\t}\n\t\n\tprintf(\"%d\", n);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main(){\n int n,k,i=0;\n scanf(\"%d %d\",&n,&k);\n while(i\n//#include\nint main(){\nint n,rem,k;//,c=0;\nscanf(\"%d %d\",&n,&k);\nwhile(k--){\n\trem=n%10;\n\tif(rem==0){\n\t\tn=n/10;\n\t\t}\n\telse{\n\t\tn=n-1;\n\t}\n//k--;\n\t//c++;\n\t//if(c==k){\n\t//\tbreak;\n//}\n}\nprintf(\"%d\",n);\nreturn 0;\n}\n"}, {"source_code": "#include \nint main()\n{\nint n , k ;\nscanf(\"%d %d\", &n ,&k);\n\nfor(int i=0 ; i\nint main()\n{\n int n,k,i;\n scanf(\"%d %d\", &n, &k);\n for (i=0;i\n#include\nint main()\n{\n\tint number,times;\n\tscanf(\"%d\",&number);\n\tscanf(\"%d\",×);\n\tint k;\n\tint temp;\n\tint temp2;\n\tfor(k=0;k=0)\n\t\t{\n\t\t\tif(number%10==0)\n\t\t\t{\n\t\t\t\tnumber=number/10;\n\t\t\t}\n\t\t\telse \n\t\t\t{\n\t\t\t\tnumber=number-1;\n\t\t\t}\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%d\",number);\n} "}, {"source_code": "#include\nint main()\n{\n int n,i,k;\n scanf(\"%d%d\",&n,&k);\n for(i=0;i\n#include\n\nint main(){\n\tint n,k;\n\tscanf(\"%d%d\",&n,&k);\n\n\twhile (k != 0){\n\t\tif (n % 10 == 0)\n\t\t\tn = n/10;\n\t\telse\n\t\t\tn=n-1;\n\t\tk-=1;\n\t}\n\tprintf(\"%d\",n);\n\t\n}\n\n\n"}, {"source_code": "#include\n\nint main()\n{\n int i,n,p;\n scanf(\"%d %d\",&n,&p);\n for(i=0;i\nint main(void)\n{\n int n;\n int k;\n scanf(\"%d\\t\",&n);\n scanf(\"%d\\n\",&k);\n while((n>0)&&(k>=1))\n {\n if(n%10==0){n=n/10;}\n else{n=n-1;}\n k--;\n }\n printf(\"%d\",n);\n\n\n\n\n}"}, {"source_code": "#include \n#include \n#include \n#include \nint main()\n{\n\tlong long int n,k,mod,j=0,i;\n\tscanf(\"%lld%lld\",&n,&k);\n\tfor(i=1;i<=k;i++){\n\t\tmod=n%10;\n\t\tif(mod==0){\n\t\t\tn/=10;\n\t\t}\n\t\telse{\n\t\t\tn--;\n\t\t}\n\t}\n\tprintf(\"%lld\",n);\n return 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n long int x;\n\n int y, i;\n\n scanf(\"%ld\", &x);\n\n scanf(\"%d\", &y);\n\n for(i=0; i\n#include \n\nint main()\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n while(k>0)\n {\n if(n%10>0)\n {\n n=n-1;\n k--;\n continue;\n }\n else\n {\n n=n/10;\n k--;\n continue;\n }\n }\n printf(\"%d\",n);\n return 0;\n}\n"}, {"source_code": "#include \nint main ()\n{\n long long int i,a,b;\n scanf(\"%lld %lld\",&a,&b);\n for(i =0; i\n\nint main(){\n int n,k;\n scanf(\"%d %d\",&n,&k);\n for(int i = 0;i < k;i++){\n if(n == 0){\n break;\n }\n if(n%10 == 0){\n n = n/10;\n }\n else{\n n--;\n }\n }\n printf(\"%d\",n);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tlong long int n,k,i;\n\tscanf(\"%I64d%I64d\",&n,&k);\n\tfor(i=1;i<=k;i++){\n\t\tif(n%10==0) n=n/10;\n\t\telse n=n-1;\n\t}\n\tprintf(\"%I64d\\n\",n);\n\t\n\treturn 0;\n}"}, {"source_code": "\n\n #include\nint main()\n{\n int n;\n int k,i;\n scanf(\"%d%d\",&n,&k);\n for(i=0;i\nint main()\n{\nint n,k;\nscanf(\"%d%d\",&n,&k);\nwhile(k)\n{\nif(n%10!=0)\nn=n-1;\nelse\nn=n/10;\nk--;\n\n}\nprintf(\"%d\",n);\nreturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int n,c,i;\n scanf(\"%d %d\", &n, &c);\n for (i=1; i<=c; i++)\n {\n if((n%10)!=0)\n {\n n--;\n\n }\n else\n {\n n/=10;\n\n }\n }\n\n printf(\"%d\\n\",n);\n\n return 0;\n}\n"}, {"source_code": "#include\nint main(void)\n{\n long long unsigned int n;\n int k;\n scanf(\"%I64d\\t\",&n);\n scanf(\"%d\\n\",&k);\n while((n>0)&&(k>=1))\n {\n if(n%10==0){n=n/10;}\n else{n=n-1;}\n k--;\n }\n printf(\"%I64d\",n);\n\n\n\n\n}"}, {"source_code": "#include\nint main()\n{\n int a,b,n,i;\n scanf(\"%d %d\",&a,&b);\n for(i=1;i<=b;i++)\n {\n if(a%10==0)\n {\n a=a/10;\n }\n else {a=a-1;}\n }\n printf(\"%d\",a);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,k,i=0,p;\n scanf(\"%d %d\",&n,&k);\n for(i=0;i\n\nint main() {\n int n,k,i;\n scanf(\"%d %d\",&n,&k);\n i=k;\n while(i>0) {\n if (n%10 == 0) {\n n = n/10;\n i--;\n }\n else {\n int t = n%10;\n if (t<=i) {\n n = n - t;\n i = i-t;\n }\n else {\n n = n-i;\n i = 0; \n }\n }\n }\n printf(\"%d\",n);\n return 0; \n}"}, {"source_code": "#include\n\nint main()\n{\n long long int k,i,n,r;\n scanf(\"%lld %lld\",&n,&k);\n for(i=1;i<=k;i++)\n {\n r=n%10;\n if(r==0)\n {\n n/=10;\n }\n else\n n--;\n }\n printf(\"%lld\\n\",n);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int i=0,n,k;\n scanf(\"%d\",&n);\n scanf(\"%d\",&k);\n while(k>0)\n {\n if(n%10 == 0)\n {\n n= n/10;\n }\n else\n {\n n=n-1;\n }\n k--;\n }\n printf(\"%d\",n);\n\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{ int n,k,x=0;\n scanf(\"%d %d\",&n,&k);\n while(n>0&&x\n\nint main(void) {\n int k,n;\n scanf(\"%d\",&n);\n scanf(\"%d\",&k);\n\n while(k--){\n if(n%10 == 0){\n n= n / 10;\n }\n else{\n n = n - 1;\n }\n }\n printf(\"%d\",n);\n \n\t// your code goes here\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n long long int n;\n int k,i;\n scanf(\"%I64d%d\",&n,&k);\n for(i=1;i<=k;i++)\n {\n if(n%10==0) n=n/10;\n else n=n-1;\n\n }\n printf(\"%I64d\\n\",n);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tlong long i,j,k,l,n,m;\n\tscanf(\"%lld%lld\",&n,&k);\n\tfor(i=1;i<=k;i++)\n\t{\n\t\tif(n%10!=0)\n\t\t{\n\t\t\tn=n-1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tn=n/10;\n\t\t}\n\t}\n\tprintf(\"%lld\",n);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main(){\n int n,k;\n scanf(\"%d %d\",&n,&k);\n while(k--){\n if(n %10 == 0)\n n/=10;\n else\n n--;\n }\n printf(\"%d\",n);\n return 0;\n\n}"}, {"source_code": "#include\nint main()\n{\n int n,k,i=0,p;\n scanf(\"%d %d\",&n,&k);\n for(i=0;i\n\nint main()\n{\n int n, k;\n scanf(\"%d %d\", &n, &k);\n while(k--) {\n if(n % 10 == 0) {\n n /= 10;\n } else {\n --n;\n }\n }\n printf(\"%d\\n\", n);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,k,count=0;\n scanf(\"%d%d\",&n,&k);\n\n while(k--)\n {\n if(n%10!=0)\n {\n n--;\n }\n else\n {\n n/=10;\n }\n\n\n\n}\n printf(\"%d\",n);\n}\n"}, {"source_code": "#include \n\nint subtraction(int n, int k){\n\twhile(k){\n\t\tif (n % 10 != 0)\n\t\t\tn--;\n\t\telse\n\t\t\tn /= 10;\n k--;\n\t}\n\treturn n;\n}\n\nint main() {\n\n\tint n, k;\n\tscanf(\"%d %d\", &n, &k);\n\tprintf(\"%d\", subtraction(n,k));\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n long int n;\n int k;\n scanf(\"%li\",&n);\n scanf(\"%d\",&k);\n while((k>0)&&(n>=0))\n {\n if(n%10==0)\n {\n n=n/10;\n k--;\n }\n else\n {\n n--;\n k--;\n }\n }\n printf(\"%li\",n);\n return 0;\n}"}, {"source_code": "#include \n\nint main() {\n int n,k,i;\n scanf(\"%d %d\",&n,&k);\n i=k;\n while(i>0) {\n if (n%10 == 0) {\n n = n/10;\n i--;\n }\n else {\n int t = n%10;\n if (t<=i) {\n n = n - t;\n i = i-t;\n }\n else {\n n = n-i;\n i = 0; \n }\n }\n }\n printf(\"%d\",n);\n return 0; \n}"}, {"source_code": "#include\nint main()\n{\n int s,i,n;\n scanf(\"%d %d\",&s,&n);\n for(i=0;i\nint main(){\n int n,k;\n scanf(\"%d %d\",&n,&k);\n int i;\n for(i=1;i<=k;i++){\n if(n%10!=0){\n n=n-1;\n }\n if(n%10==0){\n n=n/10;\n }\n }\n printf(\"%d\",n);\n return 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n,k,i;\n printf(\"enter the number you want to be subtracted\");\n scanf(\"%d\",&n);\n printf(\"how many times do you want to be subtracted tanya \");\n scanf(\"%d\",&k);\n for(k;k!=0;k--)\n {\n if (n%10==0)\n {\n n=n/10;\n }\n else\n {\n n--;\n }\n\n printf(\"%d \\n\",n);\n }\n return 0;\n}\n"}, {"source_code": "\nint main()\n{\n long n;\n int k;\n \n scanf(\"%l%d\", n, k);\n \n for(int i = 0; i < k; i++)\n {\n if(n%10 == 0)\n {\n n /= 10;\n }\n else\n {\n n -= 1;\n }\n }\n return n;\n}"}, {"source_code": "#include \nint main(void)\n{\n int n,k,i;\n printf(\"imput n k:\");\n scanf(\"%d %d\",&n,&k);\n for (size_t i= 1; i < k+1; i++)\n {\n if ((n%10==0))\n {\n n=n/10;\n }\n else\n {\n n=n-1;\n }\n \n }\n printf(\"%d\",n);\n getchar();\n getchar(); \n return 0;\n}"}, {"source_code": "#include \nint main()\n{\n int n = 0, k = 0, i;\n \n for(int i = 0; i < k; i++){\n if(n % 10 == 0){\n n = n/10;\n }\n else{\n n = n - 1;\n }\n }\n \n printf(\"%d\", n);\n}"}, {"source_code": "#include\n \n \nint main()\n{\n \n int n,k,i;\n \n scanf(\"%d %d\",&n,&k);\n \n for(i=0;i\n \n \nint main()\n{\n \n int n,k,i;\n \n scanf(\"%d %d\",&n,&k);\n \n for(i=0;i\nint main(void)\n{\n\tlong long int N;\n\tint k;\n\tscanf(\"%d %d\",&N,&k);\n\twhile(k--)\n\t{\n\t\tif(N%10==0)\n\t\tN/=10;\n\t\telse\n\t\tN--;\n\t}\n\tprintf(\"%d\",N);\n}"}, {"source_code": "/*Little girl Tanya is learning how to decrease a number by one, but she does it wrong with a number consisting of two or more digits. Tanya subtracts one from a number by the following algorithm:\n\nif the last digit of the number is non-zero, she decreases the number by one;\nif the last digit of the number is zero, she divides the number by 10 (i.e. removes the last digit).\nYou are given an integer number n. Tanya will subtract one from it k times. Your task is to print the result after all k subtractions.\n\nIt is guaranteed that the result will be positive integer number.\n\nInput\nThe first line of the input contains two integer numbers n and k (2≤n≤10E9, 1≤k≤50) — the number from which Tanya will subtract and the number of subtractions correspondingly.\n\nOutput\nPrint one integer number — the result of the decreasing n by one k times.\n\nIt is guaranteed that the result will be positive integer number.\n*/\n\n#include \n#include \n\nint main()\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n\n while (k!=0)\n {\n if ( n%10 != 0)\n {\n n=n-1;\n }\n else\n {\n n=n/10;\n }\n k--;\n\n }\n printf(\"Result = %d\",n);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main ()\n{\n int x;\n\t\tint count=0;\n\t\tprintf(\"Please Enter Number\");\n\t\tscanf(\"%d\",&x);\n\t\twhile\t(x>1)\n\t\t{\t\tif\t(x%10==0)\n\t\t\t\t\t{\tx=x/10;;\n\t\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\t{x--;\n\t\t\t\t\t}\n\t\t\t\t\tcount++;\n\t\t}\n\t\tprintf(\"Count=%d\",count);\n return 0;\n}\n\n\n\n\n\n"}, {"source_code": "#include \n\nint main(int argc, char const *argv[])\n{\n /* code */\n long long n, k;\n scanf(\"%ld %ld\", &n, &k);\n\n for(int i = 0; i < k; i++){\n if(!n % 10)\n n = n / 10;\n else\n n--;\n }\n printf(\"%d\\n\", n);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,i,last;\n long int k;\n scanf(\"%ld d\",&k,&n);\n printf(\"%d\",n);\n for(i=0;i\n#include \n\nint main()\n{ int x;\n int count =0;\n x=512;\n\n while (x>0)\n {\n if (x%10 == 0)\n {\n x=x/10;\n }\n else\n {\n x--;\n count++;\n }\n }\n\n printf(\"The counter = %d\",count);\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,k;\n scanf(\"%d%d\",&n,&k);\n for(k=0;k\nint main()\n{\n int n,k,i;\n for(i=0;i\n\nint main()\n{\n int n,k,i;\nscanf(\"%d %d\",&n,&k);\n for(i=1;i<=k;i++)\n {\n if(n%10==0)\n n=n/10;\n else if(n%10!=0)\n n--;\n }\n printf(\"the last value is %d\",n);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,k,r,i;\n for(i=0;i<=k;i++)\n {\n r=n%10;\n if(r==0)\n n=n/10;\n else\n n=n-1;\n }\n printf(\"%d\",n);\n return 0;\n}"}, {"source_code": "#include\nint main(){\n int n,k;\n scanf(\"%d %d\",&n,&k);\n int i;\n for(i=1;i<=k;i++){\n if(n%10!=0){\n n=n-1;\n break;\n }\n if(n%10==0){\n n=n/10;\n }\n }\n printf(\"%d\",n);\n return 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n long long int n;\n int k,i;\n scanf(\"%lld %d\",&n, &k);\n for(i=1;i\nint main()\n{\n int n = 0, k = 0, i;\n \n for(i = 0; i\nint main () {\n int num,k,m;\n scanf(\"%d %d\",&num,&k);\n m=num % 10;\n while (k--) {\n if (m == 0 ) {\n num=num / 10;\n }\n else{\n num--;\n }\n }\n printf(\"%d\\n\",num);\n}"}, {"source_code": "#include \nint main()\n{\n int n = 0, k = 0, i;\n \n for(i = 0; i\nint main()\n{\n int n,k,i=0;\n printf(\"n&f\");\n scanf(\"%d%d\",&n,&k);\n while(i\n#include\nint main(){\nint n,rem,k;//,c=0;\nscanf(\"%d\",&n,&k);\nwhile(n && k--){\n\trem=n%10;\n\tif(rem==0){\n\t\tn=n/10;\n\t\t}\n\telse{\n\t\tn=n-1;\n\t}\n//k--;\n\t//c++;\n\t//if(c==k){\n\t//\tbreak;\n//}\n}\nprintf(\"%d\",n);\nreturn 0;\n}\n"}, {"source_code": "#include\nint main(){\n int n,k,j ;\n scanf(\"%d %d\",&n,&k);\n \n if(k>0){\n j=n%10;\n if(k>j){\n n/=10;\n k-=j;\n k-=1;\n }\n else{n-=k;\n k=0;}\n }\n printf(\"%d\",n);\n return 0;\n \n}"}, {"source_code": "#include\n\nint wrongSubstraction ( int x, int z );\n\nint main() {\n // wrongSubstraction(512, 4);\n // wrongSubstraction(1000000000, 9);\n}\n\nint wrongSubstraction(int n, int k) {\n \n while(k>0) {\n if(n%10!=0)\n n-=1;\n else\n n/=10;\n k--;\n }\n \n return n;\n}"}, {"source_code": "#include\nint main()\n{\n int a,k;\n int temp;\n scanf(\"%d %d\",&a,&k);\n while(k!=0)\n {\n temp=a%10;\n if(temp>=1)\n {\n temp-=1;\n a=a/10+temp;\n }\n else\n {\n a=a/10;\n }\n k--;\n }\n return 0;\n}"}, {"source_code": "#include \n\nint main(void) {\n int k,n;\n scanf(\"%d\",&k);\n scanf(\"%d\",&n);\n\n while(k--){\n if(n%10 == 0){\n n= n / 10;\n }\n else{\n n = n - 1;\n }\n\n }\n printf(\"%d\",n);\n \n\t// your code goes here\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,temp,x,i,X,rem,count=0,p;\n scanf(\"%d %d\",&x,&n);\n temp=x;\n for(i=1;i<=n;i++)\n {\n if(temp%10==0)\n break;\n if(temp%10!=0)\n {\n temp--;\n count++;\n }\n }\n printf(\"%d\\n%d\\n\",temp,count);\n for(i=1;i<=n-count;i++)\n {\n if(temp%10!=0)\n {\n temp--;\n }\n if(i==n-count)\n break;\n if(temp%10==0)\n {\n rem=temp/10;\n temp=rem;\n }\n }\n printf(\"%d\",temp);\n\n\n return 0;\n}\n"}, {"source_code": "#include\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--;\n }\n printf(\"%d\\n\", n);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int i,x,n,last;\n scanf(\"%d%d\",&n,&x);\n for(i=1;i<=x;i++)\n {\n last=n%10;\n if(last!=10)\n {\n n=n-1;\n }\n else\n {\n n=n/10;\n }\n }\n printf(\"%d\\n\",n);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(){\n long n,k;\n scanf(\"%l %l\",&n,&k);\n while(k--){\n if(n%10==0)\n n = (n/10)-1;\n else\n n = n-1;\n }\n printf(\"%l\",n);\n return 0;\n}"}, {"source_code": "#include \n\nint main (void){\n int k, n;\n\n scanf (\"%d %d\", &n , &k);\n\n while ( (n/10) != 0)\n if (n % 10 == 0) {\n n /= 10;\n }\n else if( n % 10 != 0)\n {\n n--;\n }\n\n printf(\"%d\", n);\n return 0;\n}"}, {"source_code": "#include\nint main(){\n \n int n,k;\n int i;\n printf(\"input the positive integer number:\");\n scanf(\"%d\",&n);\n \n printf(\"input the number of substractions:\");\n scanf(\"%d\",&k);\n \n for(i=1;i<=k;i++){\n if(n>9) {\n if(n%10==0)\n n=n/10;\n else\n n=n-1;\n }}\n printf(\"%d\",n);\n}"}, {"source_code": "#include\n \n \nint main()\n{\n \n int n,k,i;\n \n scanf(\"%d %d\",&n,&k);\n \n for(i=0;i\nint main()\n{\n int n = 0, k = 0, i;\n \n for(int i = 0; i < k; i++){\n if(n % 10 == 0){\n n = n/10;\n }\n else{\n n = n - 1;\n }\n }\n \n printf(\"%d\", n);\n}"}, {"source_code": "#include \nint main(){\n int n, k, i;\n \n printf(\"enter n and k : \");\n scanf(\"%d %d\", &n);\n \n for(i = 0; i < k; i++){\n if(n % 10 == 0){\n n = n/10;\n }\n else{\n n = n - 1;\n }\n }\n printf(\"%d\", n);\n \n}\n"}, {"source_code": "#include \n \nint main()\n{\n long n;\n int k;\n \n scanf(\"%l%d\", &n, &k);\n \n for(int i = 0; i < k; i++)\n {\n if(n%10 == 0)\n {\n n /= 10;\n }\n else\n {\n n -= 1;\n }\n }\n \n printf(\"%d\", n);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint b;\n\tint i;\n\tlong long int a;\n\tscanf (\"%l64d %d\", &a, &b);\n\tfor (i=0; i=10; i++)\n\t{\n\t\tif (a%10==0)\n\t\t{\n\t\t\ta=a/10;\n\t\t}\n\t\telse if(a%10!=0)\n\t\t{\n\t\t\ta=a-1;\n\t\t}\n\t}\n\tprintf (\"%l64d\", a);\n\treturn 0;\n}"}, {"source_code": "#include\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--;\n }\n printf(\"%d\\n\", n);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,k;\n scanf(\"%d %d\",&a,&k);\n while(k!=0)\n {\n if(a%10==0)\n {\n a/=10;\n }\n else\n {\n a--;\n }\n k--;\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,temp,x,i,X,rem,count=0,a,count1=0;\n scanf(\"%d %d\",&x,&n);\n temp=x;\n for(i=1;i<=n;i++)\n {\n if(temp%10==0)\n break;\n if(temp%10!=0)\n {\n temp--;\n count++;\n }\n }\n a=n-count;\n // printf(\"%d\\n\",a);\n for(i=1;i<=a-1;i++)\n {\n if(temp%10!=0)\n {\n temp--;\n continue;\n }\n if(temp%10==0)\n {\n rem=temp/10;\n temp=rem;\n }\n }\n //printf(\"%d\\n%d\\n\",temp,count);\n for(i=a;i<=a;i++)\n {\n if(temp%10!=0)\n {\n temp--;\n count1++;\n }\n if(count1==1)\n break;\n if(temp%10==0)\n {\n rem=temp/10;\n temp=rem;\n }\n }\n printf(\"%d\",temp);\n\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n for(int i=1; i\nint main(){\n int n,k;\n scanf(\"%d%d\",&n,&k);\n int rem;\n for(int i=1;i<=k;i++){\n rem=n/10;\n if(rem!=0){\n n=n-1;\n }\n else if(rem==0){\n n=n/10;\n }\n printf(\"%d\",n);\n }\n}"}, {"source_code": "#include \n#include \n\nint main() {\n\n\tint n, k, t;\n\n\tprintf(\"n k = \");\n\tscanf(\"%d %d\", &n, &k);\n\n\tfor (int i = 0; i < k; i++) {\n\t\tt = n % 10;\n\n\t\tif (t != 0) {\n\t\t\tn = n - 1;\n\t\t}\n\t\telse {\n\t\t\tn = n / 10;\n\t\t}\n\t}\n\t\n\tprintf(\"%d\", n);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main (void){\n int k, n;\n\n scanf (\"%d %d\", &n , &k);\n\n while ( (n/10) != 0)\n if (n % 10 == 0) {\n n /= 10;\n }\n else if( n % 10 != 0)\n {\n n--;\n }\n\n printf(\"%d\", n);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int i,x,n,last;\n scanf(\"%d%d\",&n,&x);\n for(i=1;i<=x;i++)\n {\n last=n%10;\n if(last!=10)\n {\n n=n-1;\n }\n else\n {\n n=n/10;\n }\n }\n printf(\"%d\\n\",n);\n return 0;\n}\n"}, {"source_code": "\n#include \n\nint main (void){\n int k, n;\n\n scanf (\"%d %d\", &n , &k);\n\n if (n % 10 != 0) {\n n /= 10;\n }\n else \n {\n n--;\n }\n\n printf(\"%d\", n);\n return 0;\n}"}, {"source_code": "#include\n#include\nint main(){\n int n,k,i;\n printf(\"n=\");\n scanf(\"%d\",&n);\n printf(\"k=\");\n scanf(\"%d\",&k);\n while(k!=0){\n if(n%10!=0)\n n=n-1;\n else\n n=n/10;\n --k;\n }\n printf(\"%d\",n);\n\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n for(int i=1; i\nint main()\n{\n int a,b,i,x;\n scanf(\"%d %d\",&a,&b);\n for(i=0;i\nint main()\n{int n,k,i;\ni=0; \nscanf(\"%d%d\",&n,&k);\nwhile(i<=k)\n{\n\n\nif(n%10==0)\n\n n=n/10,i++;\n \n\nelse\n\n n=n-1,i++;\n\n}\nprintf(\"%d\",&n);\n}\n"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include \n#include \n\nint main()\n{\n\tint n, k;\n\tprintf(\"The number from which Tanya will substract is:\");\n\tscanf(\"%d\", &n);\n\tprintf(\"The number of substractions is:\");\n\tscanf(\"%d\", &k);\n\twhile (k != 0)\n\t{\n\t\tif (n % 10 != 0)\n\t\t{\n\t\t\tn -= 1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tn /= 10;\n\t\t}\n\t\tk--;\n\t}\n\tprintf(\"%d\", n);\n\treturn 0;\n}"}, {"source_code": "#include\nint main(){\n int n,k;\n scanf(\"%lldd %lld\",&n,&k);\n while(k--){\n if(n %10 == 0)\n n/=10;\n else\n n--;\n }\n printf(\"%lld\",n);\n return 0;\n\n}"}, {"source_code": "#include \n\nint main(void) {\n\t// your code goes here\n\n\n int n,k;\n n<=(10^9)&&n>=2;\n k<=50&&k>=1;\n printf(\"Enter 2 numbers\");\n scanf(\"%d%d\",&n,&k);\n \n for(int i=0; i\nint main(void)\n{\n int n,k,i;\n n=512;\n k=4;\n for (size_t i= 1; i < k+1; )\n {\n if ((n%10==9))\n {\n i=i-1;\n n=n/10;\n n=n+2;\n }\n else\n {\n i=i+1;\n n=n-1;\n }\n \n }\n printf(\"your finnal number n=%d\",n);\n getchar();\n getchar(); \n return 0;\n}"}, {"source_code": "#include\n\nint wrongSubstraction ( int x, int z );\n\nint main() {\n wrongSubstraction(512, 4);\n wrongSubstraction(1000000000, 9);\n return 0;\n}\n\nint wrongSubstraction(int n, int k) {\n \n while(k>0) {\n if(n%10!=0)\n n-=1;\n else\n n/=10;\n k--;\n }\n \n return n;\n}"}, {"source_code": "#include\nint main()\n{\n int n,k;\n scanf(\"%d\",&n);\n if(n>600)\n {\n\n for(k=0;k<9;k++)\n {\n if(n%10!=0)\n {\n n--;\n }\n else\n {\n n=n/10;\n }\n }\n printf(\"%d\",n);\n\n }\n else\n {\n for(k=0;k<4;k++)\n {\n if(n%10!=0)\n {\n n--;\n }\n else\n {\n n=n/10;\n }\n }\n printf(\"%d\",n);\n }\n return 0;\n}\n\n"}, {"source_code": "#include \nint main()\n{\n int n = 0, k = 0, i;\n \n for(i = 0; i\nint main()\n{\n int a,b,n,i;\n scanf(\"%d %d\",&a,&b);\n for(i=1;i<=b;i++)\n {\n if(a%10==0)\n {\n a=a/10;\n }\n //else {a=a-1;}\n }\n printf(\"%d\",a);\n return 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n long long int x,p,q;\n scanf(\"%lld %lld\",&x,&p);\n while(p>0){\n {\n if(x%10==0)\n q=x/10;\n else\n q=x-1;\n }\n printf(\"%lld\\n\",q);\n p--;\n }\n return 0;\n }"}, {"source_code": "#include \n\nint main(int argc, char const *argv[])\n{\n /* code */\n long long n, k;\n scanf(\"%ld %ld\", &n, &k);\n\n for(int i = 0; i < k; i++){\n if(!(n % 10))\n n /= 10;\n else\n n--;\n }\n printf(\"%d\\n\", n);\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n int n,k;\n scanf(\"%d %d\",&n,&k);\n while(k--){\n if (n%10==0)\n {n=n/10;}\n else(n-=1);\n printf( \"%d \",n);\n }\n}"}, {"source_code": "#include\n\nint main()\n{\n long long n;\n int k;\n scanf(\"%ll\",&n);\n scanf(\"%d\",&k);\n while((k>0)&&(n>=0))\n {\n if(n%10==0)\n {\n n=n/10;\n k--;\n }\n else\n {\n n--;\n k--;\n }\n }\n printf(\"%ll\",n);\n return 0;\n}"}, {"source_code": "#include\nint main(void)\n{\n\tlong long int N;\n\tint k;\n\tscanf(\"%d %d\",&N,&k);\n\twhile(k--)\n\t{\n\t\tif(N%10==0)\n\t\tN/=10;\n\t\telse\n\t\tN--;\n\t}\n\tprintf(\"%d\",N);\n}"}, {"source_code": "#include\nint main()\n{\n int n,temp,x,i,X,rem,count=0,p;\n scanf(\"%d %d\",&x,&n);\n temp=x;\n for(i=1;i<=n;i++)\n {\n if(temp%10==0)\n break;\n if(temp%10!=0)\n {\n temp--;\n count++;\n }\n }\n printf(\"%d\\n%d\\n\",temp,count);\n for(i=1;i<=n-count;i++)\n {\n if(temp%10!=0)\n {\n temp--;\n }\n if(i==n-count)\n break;\n if(temp%10==0)\n {\n rem=temp/10;\n temp=rem;\n }\n }\n printf(\"%d\",temp);\n\n\n return 0;\n}\n"}, {"source_code": "\n#include \n\nint main (void){\n int k, n;\n\n scanf (\"%d %d\", &n , &k);\n\n if (n % 10 != 0) {\n n /= 10;\n }\n else \n {\n n--;\n }\n\n printf(\"%d\", n);\n return 0;\n}"}, {"source_code": "#include \n\nint main(){\n long n;int k;\n scanf(\"%l %d\",&n,&k);\n while(k--){\n if(n%10==0)\n n = (n/10)-1;\n else\n n = n-1;\n }\n printf(\"%l\",n);\n return 0;\n}"}, {"source_code": "#include\n#include\n#include\n#include\nint main()\n{int a,b;\nscanf(\"%d%d\",&a,&b);\nwhile(b--)\n{\n if(a%10==0)\n a=a-1;\n else\n a=(a/10)*10;\n}\nprintf(\"%d\\n\",a);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,temp,x,i,X,rem,count=0,p;\n scanf(\"%d %d\",&x,&n);\n temp=x;\n for(i=1;i<=n;i++)\n {\n if(temp%10==0)\n break;\n if(temp%10!=0)\n {\n temp--;\n count++;\n }\n }\n printf(\"%d\\n%d\\n\",temp,count);\n for(i=1;i<=n-count;i++)\n {\n if(temp%10!=0)\n {\n temp--;\n }\n if(i==n-count)\n break;\n if(temp%10==0)\n {\n rem=temp/10;\n temp=rem;\n }\n }\n printf(\"%d\",temp);\n\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,i,k;\n scanf(\"%d%d\",&n,&k);\n for(i=0;i\nint main(){\n int n,k;\n scanf(\"%lldd %lld\",&n,&k);\n while(k--){\n if(n %10 == 0)\n n/=10;\n else\n n--;\n }\n printf(\"%lld\",n);\n return 0;\n\n}"}, {"source_code": "#include\nint main(){\n\t\n\tint n, k;\n\t\n\tscanf(\"%d %d\",&n,&k);\n\t\n\twhile(k){\n\t\t\n\t\tif((n%10) != 0)\n\t\tn = n - 1;\n\t\t\n\t\telse if((n%10) == 0)\n\t\tn = n % 10;\n\t\t\n\t\tk--;\n\t}\n}\n"}, {"source_code": "#include\nint main(void)\n{\n long long unsigned int n;\n int k;\n scanf(\"%I64d\\t\",&n);\n scanf(\"%d\\n\",&k);\n while((n>0)&&(k>=1))\n {\n if(n%10==0){n=n/10;}\n else{n=n-1;}\n }\n printf(\"%I64d\",n);\n\n\n\n\n}"}, {"source_code": "#include\nint main()\n{\n int i,a,b,c=0;\n scanf(\"%d %d\",&a,&b);\n if(a%10==0)\n while(1)\n {\n a=a/10;\n if(a%10!=0)\n break;\n }\n for(i=1;i<=b;i++)\n {\n a=a-1;\n if(a==0)\n {\n printf(\"%d\",a+1);\n break;\n }\n if(i==b)\n {\n c++;\n break;\n }\n if(a%10==0)\n while(1)\n {\n a=a/10;\n i++;\n c++;\n if(a%10!=0)\n break;\n }\n if(a==0)\n {\n printf(\"%d\",a+1);\n break;\n }\n c++;\n }\n if(c==b)\n printf(\"%d\",a);\n return 0;\n}"}, {"source_code": "#include\nint main(){\n int n,k;\n scanf(\"%d %d\",&n,&k);\n int i=n;\n while(k--){\n if(n%10!=0){\n n=n-1;\n }\n if(n%10==0){\n n=n/10;\n }\n }\n printf(\"%d\",n);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,k;\n printf(\"n&f\");\n scanf(\"%d%d\",&n,&k);\n while(k--)\n { if (n%10!=0){n=n-1;}\n else if (n%10==0){n=n/10;}\n printf(\"the no is %d \",n);}\n}"}, {"source_code": "#include\nint main()\n{\n long long int x,p;\n scanf(\"%lld %lld\",&x,&p);\n while(p!=0){\n {\n if(x%10==0)\n x=x/10;\n else\n x=x-1;\n }\n printf(\"%lld\\n\",x);\n p--;\n }\n return 0;\n }"}, {"source_code": "#include\n\nint wrongSubstraction ( int x, int z );\n\nint main() {\n int a, b;\n scanf(\"%d, %d\", &a, &b);\n printf(\"%d\", wrongSubstraction(a, b));\n return 0;\n}\n\nint wrongSubstraction(int n, int k) {\n \n while(k>0) {\n if(n%10!=0)\n n-=1;\n else\n n/=10;\n k--;\n }\n \n return n;\n}"}, {"source_code": "#include\n\n\nint main()\n{\n \n int n,k,i;\n \n scanf(\"%d %d\",&n,&k);\n \n for(i=0;i\nint main(){long long n,k;\nscanf(\"%I64d%I64d\",&n,&k);\nfor(int i=0;i\nint main()\n{\n int n,i,last;\n long int k;\n scanf(\"%ld d\",&k,&n);\n for(i=0;i\nint main () {\n int num,k,m;\n scanf(\"%d %d\",&num,&k);\n m=(num % 10);\n while (k--) {\n if (m == 0 ) {\n num=num / 10;\n }\n else{\n num--;\n }\n }\n printf(\"%d\",num);\n}"}, {"source_code": "#include \n\nint main() {\n\t// your code goes here\n\n\n int n,k,t;\n n<=(10^9)&&n>=2;\n k<=50&&k>=1;\n printf(\"Enter 2 numbers\");\n scanf(\"%d%d\",&n,&k);\n \n \n for(int i=0; i\n#include \n\nint main()\n{\n int n,k,r;\n scanf(\"%d %d\",&n,&k);\n\n r=re(n,k);\n printf(\"%d\",r);\n\n}\nint re(int n,int k)\n{\n\n while(k>0&&n>1)\n {\n if((n%10)==0)\n return(re(n/10,k-1));\n else\n return(re(n-1,k-1));\n }\n}\n"}, {"source_code": "int main()\n{\nint n,k,i;\nwhile(n>k)\n{\n for(i=1;i<=k;i++)\n {\n if(n%10>0)\n n--;\n else\n n=n/10;\n }\n printf(\"%d\",n);\n n=0;\n}\n}"}, {"source_code": "#include\nint main(){\n\t\n\tint n, k;\n\t\n\tscanf(\"%d %d\",&n,&k);\n\n\t\n\twhile(k){\n\t\t\n\t\tif((n%10) != 0){\n\t\t\n\t\tn--;\n\t\tk--;\n\t\t\n\t\tprintf(\"%d \",n);\n\t}\n\t\t\n\t\telse if((n%10) == 0){\n\t\t\n\t\tn = n / 10;\n\t\tk--;\n\t\n\t\t//printf(\"%d \",n);\n\t}\n\t\t\n\t\n\t\t\n\t\n\t}\n\t\n//\tprintf(\"\\n%d\",n);\n}\n"}, {"source_code": "#include\nint main()\n{\n\tlong long n;\n\tint k,i;\n\tscanf(\"%d%d\",&n,&k);\n\tfor(i=1;i<=k;i++)\n\t{\n\t\tif(n%10==0)\n\t\t{\n\t\t\tn=n/10;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tn=n-1;\n\t\t}\n\t}\n\tprintf(\"\\n\");\n\tprintf(\"%lld\",n);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main(){\n int n,k,count=0;\n scanf(\"%d%d\",&n,&k);\n while(k--){\n if(n%10==0)\n printf(\"%d\",n/10);\n else\n n--;\n }\n printf(\"%d\",n);\n}"}, {"source_code": "#include\nint main()\n{\nlong int n,k,i;\nscanf(\"%lli%lli\",&n,&k);\n\nfor(i=0;i\nint main()\n{\n int n,k,i=0;\n scanf(\"%d%d\",&n,&k);\n while(i\n\nint main(){\n int n,k;\n scanf(\"%d %d\",&n,&k);\n while(k--){\n if(n%10==0)\n n = (n/10)-1;\n else\n n = n-1;\n }\n printf(\"%d\\n\",n);\n return 0;\n}"}, {"source_code": "#include \n\nint main (void){\n int k, n;\n\n scanf (\"%d %d\", &n , &k);\n\n if (n % 10 != 0) {\n n /= 10;\n }\n else if( n % 10 == 0)\n {\n n--;\n }\n\n printf(\"%d\", n);\n return 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n,k,i;\n printf(\"enter the number you want to be subtracted\");\n scanf(\"%d\",&n);\n printf(\"how many times do you want to be subtracted tanya \");\n scanf(\"%d\",&k);\n for(k;k!=0;k--)\n {\n if (n%10==0)\n {\n n=n/10;\n }\n else\n {\n n--;\n }\n\n printf(\"%d \\n\",n);\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main(){\n int n,k,i;\n printf(\"n=\");\n scanf(\"%d\",&n);\n printf(\"k=\");\n scanf(\"%d\",&k);\n while(k>=n){\n scanf(\"%d\",&k);\n }\n while(k!=0){\n if(n%10!=0)\n n=n-1;\n else\n n=n/10;\n --k;\n }\n printf(\"%d\",n);\n\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\nchar X[1000001];\nint Y,L,G;\nscanf(\"%s %d\",X,&Y);\nL=strlen(X);\nwhile(Y!=0)\n{\nif(X[L-1]=='0')\n{\nX[L-1]='\\0';\nL--;\nY--;\nprintf(\"%s %d\\n\",X,Y);\n}\nelse if(X[L-1]<(Y+48))\n{\nY=Y-(X[L-1]-48)-1;\nX[L-1]='\\0';\nL--;\nprintf(\"%s %d\\n\",X,Y);\n}\nelse if(X[L-1]==(Y+48))\n{\nY=0;\nX[L-1]='0';\n}\nelse\n{\nG=(X[L-1]-48)-Y;\nX[L-1]=G+48;\nY=0;\n}\n}\nprintf(\"%s\\n\",X);\nreturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,i,last;\n long int k;\n scanf(\"%ld d\",&k,&n);\n for(i=0;i\n\nint main() {\n int n,k,i;\n scanf(\"%d %d\",&n,&k);\n i=k;\n while(i>0) {\n if (n%10 == 0) {\n n = n/10;\n }\n else {\n int t = n%10;\n if (t<=i) {\n n = n - t;\n i = i-t;\n }\n else {\n n = n-i;\n i = 0; \n }\n }\n } \n}"}, {"source_code": "#include\nint main()\n{\n int n,k;\n scanf(\"%d%d\",&n,&k);\n for(k=0;k\n\nint main(void) {\n int k,n;\n scanf(\"%d\",&k);\n scanf(\"%d\",&n);\n\n while(k--){\n if(n%10 == 0){\n n= n / 10;\n }\n else{\n n = n - 1;\n }\n\n }\n printf(\"%d\",n);\n \n\t// your code goes here\n\treturn 0;\n}\n"}], "src_uid": "064162604284ce252b88050b4174ba55"} {"nl": {"description": "Bob is about to take a hot bath. There are two taps to fill the bath: a hot water tap and a cold water tap. The cold water's temperature is t1, and the hot water's temperature is t2. The cold water tap can transmit any integer number of water units per second from 0 to x1, inclusive. Similarly, the hot water tap can transmit from 0 to x2 water units per second.If y1 water units per second flow through the first tap and y2 water units per second flow through the second tap, then the resulting bath water temperature will be:Bob wants to open both taps so that the bath water temperature was not less than t0. However, the temperature should be as close as possible to this value. If there are several optimal variants, Bob chooses the one that lets fill the bath in the quickest way possible.Determine how much each tap should be opened so that Bob was pleased with the result in the end.", "input_spec": "You are given five integers t1, t2, x1, x2 and t0 (1 ≤ t1 ≤ t0 ≤ t2 ≤ 106, 1 ≤ x1, x2 ≤ 106).", "output_spec": "Print two space-separated integers y1 and y2 (0 ≤ y1 ≤ x1, 0 ≤ y2 ≤ x2).", "sample_inputs": ["10 70 100 100 25", "300 500 1000 1000 300", "143 456 110 117 273"], "sample_outputs": ["99 33", "1000 0", "76 54"], "notes": "NoteIn the second sample the hot water tap shouldn't be opened, but the cold water tap should be opened at full capacity in order to fill the bath in the quickest way possible."}, "positive_code": [{"source_code": "#include \nint main()\n{\n long long t1,t2,x1,x2,t0,x,y;\n double t,tt=0x3f3f3f3f;\n scanf(\"%lld %lld %lld %lld %lld\",&t1,&t2,&x1,&x2,&t0);\n while(x1>=0&&x2>=0)\n {\n t=(t1*x1+t2*x2)*1.0/(x1+x2);\n if(t\n\nint r() { int x; scanf(\"%d\",&x); return x; }\n\nint main()\n{\n int y,z; long long u=r(),v=r(),w=r(),x=r(),t=r(),a=t-u,b=v-t,p=1,q=0,g=w+x,f=u*w+v*x-t*g;\n \n for(;w>=0;--w,--g,f+=a)\n for (;x>=0&&f>=0;--x,--g,f-=b)\n if (q*f\n\nint main()\n{\n int t1, t2, x1, x2, t0, x, y, i;\n double m;\n\n scanf(\"%d %d %d %d %d\", &t1, &t2, &x1, &x2, &t0);\n\n if (t2 == t0) {\n\tif (t1 == t2) {\n\t printf(\"%d %d\\n\", x1, x2);\n\t} else {\n\t printf(\"%d %d\\n\", 0, x2);\n\t}\n\n\treturn 0;\n }\n\n if (t1 == t0) {\n\tprintf(\"%d %d\\n\", x1, 0);\n\n\treturn 0;\n }\n\n for (i = x1; i > 0; i--) {\n\tlong long p = (long long)(t0 - t1) * i;\n\n\tif (p % (t2 - t0) == 0 && p / (t2 - t0) <= x2) {\n\t printf(\"%d %d\\n\", i, (int)(p / (t2 - t0)));\n\n\t return 0;\n\t}\n }\n\n x = 0;\n y = x2;\n m = t2;\n\n for (i = x1; i >= 0; i--) {\n\tlong long p = (long long)(t0 - t1) * i / (t2 - t0) + 1;\n\n\tif (p <= x2) {\n\t double q = ((double)t1 * i + (double)t2 * p) / (i + p);\n\n\t if ((p * x != (long long)i * y) && q < m || (q == m && x + y < i + p)) {\n\t\tx = i;\n\t\ty = p;\n\t\tm = q;\n\t }\n\t}\n }\n\n printf(\"%d %d\\n\", x, y);\n\n return 0;\n}\n"}, {"source_code": "#include \n\n#include \n#include \nint main(){\n __int64 t1,t2,x1,x2,t,i;\n __int64 m1,m2;\n __int64 my1,my2;\n __int64 d1,d2,tmp1;\n __int64 y1,y2;\n scanf(\"%I64d %I64d %I64d %I64d %I64d\",&t1,&t2,&x1,&x2,&t);\n\n m1=t2;m2=1;//m1/m2 and d1/d2\n \n \n my1=0;my2=x2;\n if(t1==t2){\n printf(\"%I64d %I64d\\n\",x1,x2);\n return 0;\n }else\n if(t==t2){\n printf(\"0 %I64d\\n\",x2);\n return 0;\n }else if(t==t1){\n printf(\"%I64d 0\\n\",x1);\n return 0;\n }\n for(i=x1;i>=0;i--){\n \n y1=i;\n tmp1=y1*(t-t1);\n if(tmp1%(t2-t)) y2=(tmp1)/(t2-t)+1;\n else y2=tmp1/(t2-t);\n \n //for(y2=x2;y2>=0;y2--){\n \n if(y2>x2) y2=x2;\n \n d1=t1*y1+t2*y2;\n d2=y1+y2;\n \n \n if(d1>=t*d2)if(d1*m2\n\nint t0,t1,t2;\ndouble comp(int y1,int y2)\n{\n double left = t0;\n double right = (double)((double)t1*y1+(double)t2*y2)/(double)(y1+y2);\n return left-right;\n}\n\nint main(void)\n{\n int x1,x2;\n double temp;\n scanf(\"%d%d%d%d%d\",&t1,&t2,&x1,&x2,&t0);\n int i,j;\n double state;\n temp = 9999999.0000;\n int cold,hot;\n for(i=x1,j=x2; i>=0,j>=0;)\n {\n state = comp(i,j);\n if(state < 0.0000001 && state > -0.0000001)\n {\n cold = i;\n hot = j;\n break;\n }\n else if(state > 0.0000001)\n {\n i--;\n }\n else\n {\n\n if(-state\n\nint main()\n{\n int t1, t2, x1, x2, t0, x, y, i;\n double m;\n\n scanf(\"%d %d %d %d %d\", &t1, &t2, &x1, &x2, &t0);\n\n if (t2 == t0) {\n\tif (t1 == t2) {\n\t printf(\"%d %d\\n\", x1, x2);\n\t} else {\n\t printf(\"%d %d\\n\", 0, x2);\n\t}\n\n\treturn 0;\n }\n\n if (t1 == t0) {\n\tprintf(\"%d %d\\n\", x1, 0);\n\n\treturn 0;\n }\n\n for (i = x1; i > 0; i--) {\n\tlong long p = (long long)(t0 - t1) * i;\n\n\tif (p % (t2 - t0) == 0 && p / (t2 - t0) <= x2) {\n\t printf(\"%d %d\\n\", i, (int)(p / (t2 - t0)));\n\n\t return 0;\n\t}\n }\n\n x = 0;\n y = x2;\n m = t2;\n\n for (i = x1; i >= 0; i--) {\n\tlong long p = (long long)(t0 - t1) * i / (t2 - t0) + 1;\n\n\tif (p <= x2) {\n\t double q = ((double)t1 * i + (double)t2 * p) / (i + p);\n\n\t if ((p * x != (long long)i * y) && q < m || (q == m && x + y < i + p)) {\n\t\tx = i;\n\t\ty = p;\n\t\tm = q;\n\t }\n\t}\n }\n\n printf(\"%d %d\\n\", x, y);\n\n return 0;\n}\n"}, {"source_code": "#include \n\ntypedef long long ll;\n\nvoid solve(ll t1, ll t2, ll x1, ll x2, double t0)\n{\n ll i, l, r, m, ans, y1, y2;\n double t, temp;\n if (t1 == t2)\n {\n printf(\"%I64d %I64d\\n\", x1, x2);\n return;\n }\n ans = x2;\n y1 = 0;\n y2 = x2;\n temp = t2;\n if (t1 == t0 && (t1 < temp || x1 > ans))\n {\n ans = x1;\n y1 = x1;\n y2 = 0;\n temp = t1;\n }\n for (i = 1; i <= x1; i ++)\n {\n l = 1;\n r = x2;\n while (l <= r)\n {\n m = (l + r) >> 1;\n t = (double)(t1 * i + t2 * m) / (i + m);\n if (t == t0)\n {\n if (t < temp || i + m > ans)\n {\n temp = t;\n y1 = i;\n y2 = m;\n ans = i + m;\n }\n break;\n }\n else if (t > t0)\n {\n if (t < temp || (t == temp && i + m > ans))\n {\n temp = t;\n y1 = i;\n y2 = m;\n ans = i + m;\n }\n r = m - 1;\n }\n else\n {\n l = m + 1;\n }\n }\n }\n printf(\"%I64d %I64d\\n\", y1, y2);\n}\n\nint main()\n{\n int t1, t2, x1, x2, t0;\n while (scanf(\"%d%d%d%d%d\", &t1, &t2, &x1, &x2, &t0) == 5)\n {\n solve(t1, t2, x1, x2, t0);\n }\n return 0;\n}"}, {"source_code": "#include\n#include\n#include\n#include\n#define REP(i,a,b) for(i=a;i x2) break;\n }\n if(y2 > x2) break;\n\n k = GCD(y1, y2);\n if(k>1) continue;\n\n tmp = (t1*y1+t2*y2) / (double)(y1+y2);\n if(opt > tmp){\n opt = tmp;\n\n k = 1000000000;\n if(y1 && k > x1 / y1) k = x1 / y1;\n if(y2 && k > x2 / y2) k = x2 / y2;\n\n r1 = y1 * k;\n r2 = y2 * k;\n }\n }\n\n printf(\"%d %d\\n\",r1,r2);\n }\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#define min(a, b) (((a) < (b)) ? (a) : (b))\n#define abs(a) ((a < 0) ? (-a) : (a))\n#define double long double\n\nlong long t1, t2, t0, x1, x2, y1, y2, y1_ans, y2_ans;\ndouble ans = 100000000000000.0;\ndouble eps = 0.000000000000001;\n\nint\neq(double a, double b)\n{\n return (abs(a - b) < eps);\n}\n\nint\nmain(void)\n{\n scanf(\"%I64d%I64d%I64d%I64d%I64d\", &t1, &t2, &x1, &x2, &t0);\n if(t2 == t0){\n y2_ans = y2 = x2;\n for(y1 = 0; y1 <= x1; ++y1){\n double tmp = (double)(t1 * y1 + t2 * y2) / (double)(y1 + y2);\n if(tmp < t0) continue;\n if(tmp - (double)t0 < ans || (eq(tmp - (double)t0, ans) && y1 + y2 > y1_ans + y2_ans)){\n ans = tmp - (double)t0;\n y1_ans = y1;\n }\n }\n printf(\"%I64d %I64d\", y1_ans, y2_ans);\n return 0;\n }\n for(y1 = 0; y1 <= x1; ++y1){\n y2 = ((y1 * (t0 - t1)) % (t2 - t0)) ? (y1 * (t0 - t1)) / (t2 - t0) + 1 : (y1 * (t0 - t1)) / (t2 - t0);\n if(y2 > x2) continue;\n if(y1 == 0 && y2 == 0) continue;\n double tmp = (double)(t1 * y1 + t2 * y2) / (double)(y1 + y2);\n if(tmp - (double)t0 < ans || (eq(tmp - (double)t0, ans) && y1 + y2 > y1_ans + y2_ans)){\n ans = tmp - (double)t0;\n y1_ans = y1;\n y2_ans = y2;\n }\n }\n\n if(t1 == t0){\n y1_ans = y1 = x1;\n for(y2 = 0; y2 <= x2; ++y2){\n double tmp = (double)(t1 * y1 + t2 * y2) / (double)(y1 + y2);\n if(tmp < t0) continue;\n if(tmp - (double)t0 < ans || (eq(tmp - (double)t0, ans) && y1 + y2 > y1_ans + y2_ans)){\n ans = tmp - (double)t0;\n y2_ans = y2;\n }\n }\n printf(\"%I64d %I64d\", y1_ans, y2_ans);\n return 0;\n }\n\n for(y2 = 0; y2 <= x2; ++y2){\n y1 = (y2 * (t2 - t0)) / (t0 - t1);\n if(y1 > x1) continue;\n if(y1 == 0 && y2 == 0) continue;\n double tmp = (double)(t1 * y1 + t2 * y2) / (double)(y1 + y2);\n if(tmp - (double)t0 < ans || (eq(tmp - (double)t0, ans) && y1 + y2 > y1_ans + y2_ans)){\n ans = tmp - (double)t0;\n y1_ans = y1;\n y2_ans = y2;\n }\n }\n printf(\"%I64d %I64d\", y1_ans, y2_ans);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n\n#define MAX 100010\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nlong long int t1, t2, x1, x2, t0, r1, r2;\n\ndouble F(long long int y1, long long int y2){\n long long int x = (t1 * y1) + (t2 * y2);\n long long int y = (y1 + y2);\n double res = ((1.0 * x) / (1.0 * y));\n return res;\n}\n\nbool Check(long long int y1, long long int y2){\n return ((y1 + y2) >= (r1 + r2));\n}\n\nint main(){\n int i, j, k;\n long long int y1, y2;\n\n while (scanf(\"%I64d %I64d %I64d %I64d %I64d\", &t1, &t2, &x1, &x2, &t0) != EOF){\n r1 = -1, r2 = -1;\n double dif = 1e18;\n\n for (y1 = 0; y1 <= x1; y1++){\n long long int low = 0, high = x2;\n if (y1 == 0) low++;\n\n while ((low + 1) < high){\n long long int mid = (low + high) >> 1LL;\n if (F(y1, mid) <= t0) low = mid;\n else high = mid;\n }\n\n low -= 10, high += 10;\n for (; ;low++){\n if (low > x2) break;\n double r = F(y1, low);\n if ((r >= t0) || (fabs(r - t0) <= 1e-8)){\n double tmp = r - t0;\n if ((tmp < dif) && (fabs(tmp - dif) > 1e-8)) dif = tmp, r1 = y1, r2 = low;\n else if ((fabs(tmp - dif) <= 1e-8) && Check(y1, low)) dif = tmp, r1 = y1, r2 = low;\n }\n if (low == high) break;\n }\n }\n\n printf(\"%I64d %I64d\\n\", r1, r2);\n }\n return 0;\n}"}, {"source_code": "#include\n#include\n\n#define eps 1e-12\n\nint main() {\n\tint t1,t2,t0,x1,x2,i,a1,a2;\n\tlong long j,t,ans;\n\n\tscanf(\"%d %d %d %d %d\",&t1,&t2,&x1,&x2,&t0);\n\tif (t0==t2) {\n\t\tif (t0==t1) printf(\"%d %d\\n\",x1,x2);\n\t\telse printf(\"0 %d\\n\",x2);\n\t\treturn 0;\n\t}\n\tans=(long long)x2*t2,a1=0,a2=x2;\n\tfor(i=1;i<=x1;i++) {\n\t\tj=((long long)(t0-t1)*i+(t2-t0-1))/(t2-t0);\n\t\tif (j>x2) continue;\n\t\tt=(long long)i*t1+j*t2;\n\t\tif (t*(a1+a2)a1+a2)\n\t\t\tans=t,a1=i,a2=j;\n\t}\n\tprintf(\"%d %d\\n\",a1,a2);\n\treturn 0;\n}"}], "negative_code": [{"source_code": "#include \nint main()\n{\n int t1,t2,x1,x2,t0,k1,k2,i,l,r,mid,t,max=0,x,y;\n double dis=0x3f3f3f3f;\n scanf(\"%d %d %d %d %d\",&t1,&t2,&x1,&x2,&t0);\n k1=t1-t0;\n k2=t2-t0;\n for(i=0;x1>=i;i++)\n {\n l=0;\n r=x2;\n while(l<=r)\n {\n mid=(l+r)/2;\n if(k1*i+k2*mid>=0)\n {\n if(i+mid!=0&&(dis>(t1*i+t2*mid)*1.0/(i+mid)-t0||(dis==(t1*i+t2*mid)*1.0/(i+mid)-t0&&max\n\n//#include \n#include \n#include \nint main(){\n int t1,t2,x1,x2,t,i;\n int m1,m2;\n int my1,my2;\n int d1,d2,tmp1;\n int y1,y2;\n scanf(\"%d %d %d %d %d\",&t1,&t2,&x1,&x2,&t);\n\n m1=t2;m2=1;//m1/m2 and d1/d2\n \n \n my1=0;my2=x2;\n if(t1==t2){\n printf(\"%d %d\\n\",x1,x2);\n return 0;\n }else\n if(t==t2){\n printf(\"0 %d\\n\",x2);\n return 0;\n }\n for(i=x1;i>=0;i--){\n \n y1=i;\n tmp1=y1*(t-t1);\n if(tmp1%(t2-t)) y2=(tmp1)/(t2-t)+1;\n else y2=tmp1/(t2-t);\n \n //for(y2=x2;y2>=0;y2--){\n \n if(y2>x2) y2=x2;\n \n d1=t1*y1+t2*y2;\n d2=y1+y2;\n \n \n if(d1>=t*d2)if(d1*m2\n\n#include \n#include \n#include \nint main(){\n __int64 t1,t2,x1,x2,t,i;\n __int64 m1,m2;\n __int64 my1,my2;\n __int64 d1,d2,tmp1;\n __int64 y1,y2;\n scanf(\"%I64d %I64d %I64d %I64d %I64d\",&t1,&t2,&x1,&x2,&t);\n\n m1=t2;m2=1;//m1/m2 and d1/d2\n \n \n my1=0;my2=x2;\n \n for(i=x1;i>=0;i--){\n y1=i;\n tmp1=y1*(t-t1);\n if(tmp1%(t2-t)) y2=(tmp1)/(t2-t)+1;\n else y2=tmp1/(t2-t);\n \n d1=t1*y1+t2*y2;\n d2=y1+y2;\n \n \n if(d1*m2\n\n//#include \n#include \n#include \nint main(){\n int t1,t2,x1,x2,t,i;\n int m1,m2;\n int my1,my2;\n int d1,d2,tmp1;\n int y1,y2;\n scanf(\"%d %d %d %d %d\",&t1,&t2,&x1,&x2,&t);\n\n m1=t2;m2=1;//m1/m2 and d1/d2\n \n \n my1=0;my2=x2;\n if(t1==t2){\n printf(\"%d %d\\n\",x1,x2);\n return 0;\n }else\n if(t==t2){\n printf(\"0 %d\\n\",x2);\n return 0;\n }\n for(i=x1;i>=0;i--){\n y1=i;\n tmp1=y1*(t-t1);\n if(tmp1%(t2-t)) y2=(tmp1)/(t2-t)+1;\n else y2=tmp1/(t2-t);\n \n if(y2>x2) y2=x2;\n \n d1=t1*y1+t2*y2;\n d2=y1+y2;\n \n \n if(d1*m2\n\n#include \n#include \n#include \nint main(){\n __int64 t1,t2,x1,x2,t,i;\n __int64 m1,m2;\n __int64 my1,my2;\n __int64 d1,d2,tmp1;\n __int64 y1,y2;\n scanf(\"%I64d %I64d %I64d %I64d %I64d\",&t1,&t2,&x1,&x2,&t);\n\n m1=t2;m2=1;//m1/m2 and d1/d2\n \n \n my1=0;my2=x2;\n \n for(i=x1;i>=0;i--){\n y1=i;\n tmp1=y1*(t-t1);\n if(tmp1%(t2-t)) y2=(tmp1)/(t2-t)+1;\n else y2=tmp1/(t2-t);\n \n d1=t1*y1+t2*y2;\n d2=y1+y2;\n \n \n if(d1*m2y1+y2)){\n m1=d1;\n m2=d2;\n \n my1=y1;\n my2=y2;\n }\n //printf(\"%d %d:%d/%d now min:%d %d:%d/%d\\n\",y1,y2,d1,d2,my1,my2,m1,m2);\n }\n printf(\"%I64d %I64d\\n\",my1,my2);\n return 0;\n}"}, {"source_code": "#include \n\n//#include \n#include \n#include \nint main(){\n int t1,t2,x1,x2,t,i;\n int m1,m2;\n int my1,my2;\n int d1,d2,tmp1;\n int y1,y2;\n scanf(\"%d %d %d %d %d\",&t1,&t2,&x1,&x2,&t);\n\n m1=t2;m2=1;//m1/m2 and d1/d2\n \n \n my1=0;my2=x2;\n if(t==t2){\n printf(\"0 %d\\n\",x2);\n return 0;\n }\n for(i=x1;i>=0;i--){\n y1=i;\n tmp1=y1*(t-t1);\n if(tmp1%(t2-t)) y2=(tmp1)/(t2-t)+1;\n else y2=tmp1/(t2-t);\n \n d1=t1*y1+t2*y2;\n d2=y1+y2;\n \n \n if(d1*m2\n\n//#include \n#include \n#include \nint main(){\n int t1,t2,x1,x2,t,i;\n int m1,m2;\n int my1,my2;\n int d1,d2,tmp1;\n int y1,y2;\n scanf(\"%d %d %d %d %d\",&t1,&t2,&x1,&x2,&t);\n\n m1=t2;m2=1;//m1/m2 and d1/d2\n \n \n my1=0;my2=x2;\n if(t1==t2){\n printf(\"%d %d\\n\",x1,x2);\n return 0;\n }else\n if(t==t2){\n printf(\"0 %d\\n\",x2);\n return 0;\n }\n for(i=x1;i>=0;i--){\n y1=i;\n tmp1=y1*(t-t1);\n if(tmp1%(t2-t)) y2=(tmp1)/(t2-t)+1;\n else y2=tmp1/(t2-t);\n \n d1=t1*y1+t2*y2;\n d2=y1+y2;\n \n \n if(d1*m2\n\n//#include \n#include \n#include \nint main(){\n int t1,t2,x1,x2,t,i;\n int m1,m2;\n int my1,my2;\n int d1,d2,tmp1;\n int y1,y2;\n scanf(\"%d %d %d %d %d\",&t1,&t2,&x1,&x2,&t);\n\n m1=t2;m2=1;//m1/m2 and d1/d2\n \n \n my1=0;my2=x2;\n if(t==t2){\n printf(\"0 %d\\n\",x2);\n return 0;\n }\n for(i=x1;i>=0;i--){\n y1=i;\n tmp1=y1*(t-t1);\n if(tmp1%(t2-t)) y2=(tmp1)/(t2-t)+1;\n else y2=tmp1/(t2-t);\n \n d1=t1*y1+t2*y2;\n d2=y1+y2;\n \n \n if(d1*m2\n#include \nint main(){\n int t1,t2,x1,x2,t,i;\n int64_t m1,m2;\n int my1,my2;\n int64_t d1,d2,tmp1;\n int y1,y2;\n scanf(\"%d %d %d %d %d\",&t1,&t2,&x1,&x2,&t);\n\n m1=t2;m2=1;//m1/m2 and d1/d2\n \n \n my1=0;my2=x2;\n \n for(i=x1;i>=0;i--){\n y1=i;\n tmp1=y1*(t-t1);\n if(tmp1%(t2-t)) y2=(tmp1)/(t2-t)+1;\n else y2=tmp1/(t2-t);\n \n d1=t1*y1+t2*y2;\n d2=y1+y2;\n \n \n if(d1*m2\n#include \nint main(){\n int64_t t1,t2,x1,x2,t,i;\n int64_t m1,m2;\n int64_t my1,my2;\n int64_t d1,d2,tmp1;\n int64_t y1,y2;\n int t11,t21,x11,x21,t111;\n\n scanf(\"%d %d %d %d %d\",&t11,&t21,&x11,&x21,&t111);\n t1=t11;t2=t21;t=t111;x1=x11;x2=x21;\n m1=t2;m2=1;//m1/m2 and d1/d2\n \n \n my1=0;my2=x2;\n \n for(i=x1;i>=0;i--){\n y1=i;\n tmp1=y1*(t-t1);\n if(tmp1%(t2-t)) y2=(tmp1)/(t2-t)+1;\n else y2=tmp1/(t2-t);\n \n d1=t1*y1+t2*y2;\n d2=y1+y2;\n \n \n if(d1*m2\n\nint t0,t1,t2;\ndouble comp(int y1,int y2)\n{\n double left = t0;\n double right = (double)((double)t1*y1+(double)t2*y2)/(double)(y1+y2);\n return left-right;\n}\n\nint main(void)\n{\n int x1,x2;\n double temp;\n scanf(\"%d%d%d%d%d\",&t1,&t2,&x1,&x2,&t0);\n int i,j;\n double state;\n temp = 9999999.0000;\n int cold,hot;\n for(i=x1,j=x2; i>=0,j>=0;)\n {\n state = comp(i,j);\n if(state < 0.000001 && state > -0.000001)\n {\n cold = i;\n hot = j;\n break;\n }\n else if(state > 0.000001)\n {\n i--;\n }\n else\n {\n if(-state\n\nint t0,t1,t2;\nfloat comp(int y1,int y2)\n{\n float left = t0;\n float right = (float)(t1*y1+t2*y2)/(float)(y1+y2);\n printf(\"%f\\n\",left-right);\n return left-right;\n}\n\nint main(void)\n{\n int x1,x2;\n float temp;\n scanf(\"%d%d%d%d%d\",&t1,&t2,&x1,&x2,&t0);\n int i,j;\n float state;\n temp = 99999.0000;\n int cold,hot;\n for(i=x1,j=x2; i>=0,j>=0;)\n {\n state = comp(i,j);\n if(state < 0.000001 && state > -0.000001)\n {\n cold = i;\n hot = j;\n break;\n }\n else if(i+j==1)\n break;\n else if(state > 0.000001)\n {\n i--;\n }\n else\n {\n if(-state\n\nint t0,t1,t2;\nfloat comp(int y1,int y2)\n{\n float left = t0;\n float right = (float)(t1*y1+t2*y2)/(float)(y1+y2);\n return left-right;\n}\n\nint main(void)\n{\n int x1,x2;\n float temp;\n scanf(\"%d%d%d%d%d\",&t1,&t2,&x1,&x2,&t0);\n int i,j;\n float state;\n temp = 99999.0000;\n int cold,hot;\n for(i=x1,j=x2; i>=0,j>=0;)\n {\n state = comp(i,j);\n if(state < 0.000001 && state > -0.000001)\n {\n cold = i;\n hot = j;\n break;\n }\n else if(i+j==1)\n break;\n else if(state > 0.000001)\n {\n i--;\n }\n else\n {\n if(-state\n#define abs(a) (a)>0?(a):(-a)\nint t0,t1,t2;\nint comp(int y1,int y2)\n{\n long long left = (y1+y2)*t0;\n long long right = t1*y1+t2*y2;\n return left-right;\n}\n\nint main(void)\n{\n int x1,x2;\n int temp;\n scanf(\"%d%d%d%d%d\",&t1,&t2,&x1,&x2,&t0);\n int i,j;\n int state;\n temp = x1;\n int cold,hot;\n for(i=x1,j=x2; i>=0,j>=0;)\n {\n state = comp(i,j);\n if(state == 0)\n {\n cold = i;\n hot = j;\n break;\n }\n else if(state > 0)\n {\n i--;\n if(abs(state)\n\nint t0,t1,t2;\ndouble comp(int y1,int y2)\n{\n double left = t0;\n double right = (double)((double)t1*y1+(double)t2*y2)/(double)(y1+y2);\n return left-right;\n}\n\nint main(void)\n{\n int x1,x2;\n double temp;\n scanf(\"%d%d%d%d%d\",&t1,&t2,&x1,&x2,&t0);\n int i,j;\n double state;\n temp = 999999.0000;\n int cold,hot;\n for(i=x1,j=x2; i>=0,j>=0;)\n {\n state = comp(i,j);\n if(state < 0.000001 && state > -0.000001)\n {\n cold = i;\n hot = j;\n break;\n }\n else if(i+j==1)\n break;\n else if(state > 0.000001)\n {\n i--;\n }\n else\n {\n if(-state\n\nint t0,t1,t2;\nfloat comp(int y1,int y2)\n{\n float left = t0;\n float right = (float)(t1*y1+t2*y2)/(float)(y1+y2);\n printf(\"%f\\n\",left-right);\n return left-right;\n}\n\nint main(void)\n{\n int x1,x2;\n float temp;\n scanf(\"%d%d%d%d%d\",&t1,&t2,&x1,&x2,&t0);\n int i,j;\n float state;\n temp = 99999.0000;\n int cold,hot;\n for(i=x1,j=x2; i>=0,j>=0;)\n {\n state = comp(i,j);\n printf(\"state %f temp %f cold %d hot%d\\n\",state,temp,cold,hot);\n if(state < 0.000001 && state > -0.000001)\n {\n cold = i;\n hot = j;\n break;\n }\n else if(i+j==1)\n break;\n else if(state > 0.000001)\n {\n i--;\n }\n else\n {\n if(-state\n\nint t0,t1,t2;\ndouble comp(int y1,int y2)\n{\n double left = t0;\n double right = (double)((double)t1*y1+(double)t2*y2)/(double)(y1+y2);\n return left-right;\n}\n\nint main(void)\n{\n int x1,x2;\n double temp;\n scanf(\"%d%d%d%d%d\",&t1,&t2,&x1,&x2,&t0);\n int i,j;\n double state;\n temp = 999999.0000;\n int cold,hot;\n for(i=x1,j=x2; i>=0,j>=0;)\n {\n state = comp(i,j);\n if(state < 0.000001 && state > -0.000001)\n {\n cold = i;\n hot = j;\n break;\n }\n else if(state > 0.000001)\n {\n i--;\n }\n else\n {\n if(-state\n\nint t0,t1,t2;\nint comp(int y1,int y2)\n{\n long long left = (y1+y2)*t0;\n long long right = t1*y1+t2*y2;\n return left>right?1:(left==right?0:-1);\n}\n\nint main(void)\n{\n int x1,x2;\n scanf(\"%d%d%d%d%d\",&t1,&t2,&x1,&x2,&t0);\n int i,j;\n int state;\n for(i=x1,j=x2; i>=0,j>=0;)\n {\n state = comp(i,j);\n if(state == 0)\n break;\n else if(state == 1)\n i--;\n else\n j--;\n }\n printf(\"%d %d\\n\",i,j);\n return 0;\n}\n"}, {"source_code": "#include \n\nint t0,t1,t2;\nint comp(int y1,int y2)\n{\n long long left = t0;\n long long right = (t1*y1+t2*y2)/(y1+y2);\n return left>right?1:(left==right?0:-1);\n}\n\nint main(void)\n{\n int x1,x2;\n scanf(\"%d%d%d%d%d\",&t1,&t2,&x1,&x2,&t0);\n int i,j;\n int state;\n for(i=x1,j=x2; i>=0,j>=0;)\n {\n state = comp(i,j);\n if(state == 0)\n break;\n else if(state == 1)\n i--;\n else\n j--;\n }\n printf(\"%d %d\\n\",i,j);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int t1, t2, x1, x2, t0, x, y, i;\n long long j;\n double m = -1;\n\n scanf(\"%d %d %d %d %d\", &t1, &t2, &x1, &x2, &t0);\n\n if (t2 == t0) {\n\tif (t1 == t2) {\n\t printf(\"%d %d\\n\", x1, x2);\n\t} else {\n\t printf(\"%d %d\\n\", 0, x2);\n\t}\n\n\treturn 0;\n }\n\n for (i = x1; i >= 0; i--) {\n\tlong long p = (long long)(t0 - t1) * i / (t2 - t0);\n\n\tfor (j = p + 10; j >= p - 10 && i + j > 0; j--) {\n\t if (j <= x2 && ((long long)t1 * i + (long long)t2 * j) / (i + j) == t0) {\n\t\tdouble q = ((double)t1 * i + (double)t2 * j) / (i + j);\n\n\t\tif (m == -1 || q < m || (q == m && (x + y < i + j))) {\n\t\t x = i;\n\t\t y = j;\n\t\t m = q;\n\t\t}\n\t }\n\t}\n }\n\n if (m == -1 || t2 < m || (t2 == m && x + y < x2)) {\n\tx = 0;\n\ty = x2;\n }\n\n printf(\"%d %d\\n\", x, y);\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int t1, t2, x1, x2, t0, x, y, i;\n double m;\n\n scanf(\"%d %d %d %d %d\", &t1, &t2, &x1, &x2, &t0);\n\n if (t2 == t0) {\n\tif (t1 == t2) {\n\t printf(\"%d %d\\n\", x1, x2);\n\t} else {\n\t printf(\"%d %d\\n\", 0, x2);\n\t}\n\n\treturn 0;\n }\n\n if (t1 == t0) {\n\tprintf(\"%d %d\\n\", x1, 0);\n\n\treturn 0;\n }\n\n for (i = x1; i > 0; i--) {\n\tlong long p = (t0 - t1) * i;\n\n\tif (p % (t2 - t0) == 0 && p / (t2 - t0) <= x2) {\n\t printf(\"%d %d\\n\", i, (int)(p / (t2 - t0)));\n\n\t return 0;\n\t}\n }\n\n x = 0;\n y = x2;\n m = t2;\n\n for (i = x1; i >= 0; i--) {\n\tlong long p = (long long)(t0 - t1) * i / (t2 - t0) + 1;\n\n\tif (p <= x2) {\n\t double q = ((double)t1 * i + (double)t2 * p) / (i + p);\n\n\t if (q < m || (q == m && x + y < i + p)) {\n\t\tx = i;\n\t\ty = p;\n\t\tm = q;\n\t }\n\t}\n }\n\n printf(\"%d %d\\n\", x, y);\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int t1, t2, x1, x2, t0, x, y, i;\n double m;\n\n scanf(\"%d %d %d %d %d\", &t1, &t2, &x1, &x2, &t0);\n\n if (t2 == t0) {\n\tif (t1 == t2) {\n\t printf(\"%d %d\\n\", x1, x2);\n\t} else {\n\t printf(\"%d %d\\n\", 0, x2);\n\t}\n\n\treturn 0;\n }\n\n if (t1 == t0) {\n\tprintf(\"%d %d\\n\", x1, 0);\n\n\treturn 0;\n }\n\n for (i = x1; i > 0; i--) {\n\tlong long p = (t0 - t1) * i;\n\n\tif (p % (t2 - t0) == 0 && p / (t2 - t0) <= x2) {\n\t printf(\"%d %d\\n\", i, (int)(p / (t2 - t0)));\n\n\t return 0;\n\t}\n }\n\n x = 0;\n y = x2;\n m = t2;\n\n for (i = x1; i >= 0; i--) {\n\tlong long p = (long long)(t0 - t1) * i / (t2 - t0) + 1;\n\n\tif (p <= x2) {\n\t double q = ((double)t1 * i + (double)t2 * p) / (i + p);\n\n\t if (q < m) {\n\t\tx = i;\n\t\ty = p;\n\t\tm = q;\n\t }\n\t}\n }\n\n printf(\"%d %d\\n\", x, y);\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int t1, t2, x1, x2, t0, x, y, i;\n double m;\n\n scanf(\"%d %d %d %d %d\", &t1, &t2, &x1, &x2, &t0);\n\n if (t2 == t0) {\n\tif (t1 == t2) {\n\t printf(\"%d %d\\n\", x1, x2);\n\t} else {\n\t printf(\"%d %d\\n\", 0, x2);\n\t}\n\n\treturn 0;\n }\n\n if (t1 == t0) {\n\tprintf(\"%d %d\\n\", x1, 0);\n\n\treturn 0;\n }\n\n for (i = x1; i > 0; i--) {\n\tlong long p = (t0 - t1) * i;\n\n\tif (p % (t2 - t0) == 0 && p / (t2 - t0) <= x2) {\n\t printf(\"%d %d\\n\", i, (int)(p / (t2 - t0)));\n\n\t return 0;\n\t}\n }\n\n x = 0;\n y = x2;\n m = t2;\n\n for (i = x1; i >= 0; i--) {\n\tlong long p = (long long)(t0 - t1) * i / (t2 - t0) + 1;\n\n\tif (p <= x2) {\n\t double q = ((double)t1 * i + (double)t2 * p) / (i + p);\n\n\t if ((p * x != (long long)i * y) && q < m || (q == m && x + y < i + p)) {\n\t\tx = i;\n\t\ty = p;\n\t\tm = q;\n\t }\n\t}\n }\n\n printf(\"%d %d\\n\", x, y);\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int t1, t2, x1, x2, t0, x, y, i;\n double m;\n\n scanf(\"%d %d %d %d %d\", &t1, &t2, &x1, &x2, &t0);\n\n if (t2 == t0) {\n\tif (t1 == t2) {\n\t printf(\"%d %d\\n\", x1, x2);\n\t} else {\n\t printf(\"%d %d\\n\", 0, x2);\n\t}\n\n\treturn 0;\n }\n\n for (i = x1; i > 0; i--) {\n\tlong long p = (t0 - t1) * i;\n\n\tif (p % (t2 - t0) == 0 && p / (t2 - t0) <= x2) {\n\t printf(\"%d %d\\n\", i, (int)(p / (t2 - t0)));\n\n\t return 0;\n\t}\n }\n\n x = 0;\n y = x2;\n m = t2;\n\n for (i = x1; i >= 0; i--) {\n\tlong long p = (long long)(t0 - t1) * i / (t2 - t0) + 1;\n\n\tif (p <= x2) {\n\t double q = ((double)t1 * i + (double)t2 * p) / (i + p);\n\n\t if (q < m) {\n\t\tx = i;\n\t\ty = p;\n\t\tm = q;\n\t }\n\t}\n }\n\n printf(\"%d %d\\n\", x, y);\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int t1, t2, x1, x2, t0, x, y, i, j;\n double m = -1;\n\n scanf(\"%d %d %d %d %d\", &t1, &t2, &x1, &x2, &t0);\n\n if (t2 == t0) {\n\tif (t1 == t2) {\n\t printf(\"%d %d\\n\", x1, x2);\n\t} else {\n\t printf(\"%d %d\\n\", 0, x2);\n\t}\n\n\treturn 0;\n }\n\n for (i = x1; i >= 0; i--) {\n\tint p = (long long)(t0 - t1) * i / (t2 - t0);\n\n\tfor (j = p + 10; j >= p - 10 && i + j > 0; j--) {\n\t if (j <= x2 && ((long long)t1 * i + (long long)t2 * j) / (i + j) == t0) {\n\t\tif (m == -1) {\n\t\t x = i;\n\t\t y = j;\n\t\t m = ((double)t1 * i + (double)t2 * j) / (i + j);\n\t\t} else {\n\t\t double q = ((double)t1 * i + (double)t2 * j) / (i + j);\n\n\t\t if (q < m) {\n\t\t\tx = i;\n\t\t\ty = j;\n\t\t\tm = q;\n\t\t }\n\t\t}\n\t }\n\t}\n }\n\n printf(\"%d %d\\n\", x, y);\n\n return 0;\n}\n"}, {"source_code": "#include \n\n#define INF (1LL << 50)\n\ntypedef long long ll;\n\nvoid solve(ll t1, ll t2, ll x1, ll x2, double t0)\n{\n ll i, l, r, m, ans, y1, y2;\n double t, temp;\n if (t1 == t2)\n {\n printf(\"%I64d %I64d\\n\", x1, x2);\n return;\n }\n temp = INF;\n y1 = y2 = ans = -1;\n for (i = 0; i <= x1; i ++)\n {\n l = 0;\n r = x2;\n while (l <= r)\n {\n m = (l + r) >> 1;\n if (i == 0 && m == 0)\n {\n l = m + 1;\n continue;\n }\n t = (double)(t1 * i + t2 * m) / (i + m);\n if (t == t0)\n {\n if (t < temp || i + m > ans)\n {\n temp = t;\n y1 = i;\n y2 = m;\n ans = i + m;\n }\n break;\n }\n else if (t > t0)\n {\n if (t < temp || (t == temp && i + m > ans))\n {\n temp = t;\n y1 = i;\n y2 = m;\n ans = i + m;\n }\n r = m - 1;\n }\n else\n {\n l = m + 1;\n }\n }\n }\n printf(\"%I64d %I64d\\n\", y1, y2);\n}\n\nint main()\n{\n int t1, t2, x1, x2, t0;\n while (scanf(\"%d%d%d%d%d\", &t1, &t2, &x1, &x2, &t0) == 5)\n {\n solve(t1, t2, x1, x2, t0);\n }\n return 0;\n}"}, {"source_code": "#include \n\n#define INF (1LL << 60)\n\ntypedef long long ll;\n\nvoid solve(ll t1, ll t2, ll x1, ll x2, double t0)\n{\n ll i, l, r, m, ans, y1, y2;\n double t, temp;\n if (t1 == t2)\n {\n printf(\"%I64d %I64d\\n\", x1, x2);\n return;\n }\n temp = INF;\n y1 = y2 = ans = -1;\n for (i = 0; i <= x1; i ++)\n {\n l = 0;\n r = x2;\n while (l <= r)\n {\n m = (l + r) >> 1;\n t = (double)(t1 * i + t2 * m) / (i + m);\n if (t == t0)\n {\n if (t0 < temp || i + m > ans)\n {\n temp = t0;\n y1 = i;\n y2 = m;\n ans = i + m;\n }\n break;\n }\n else if (t > t0)\n {\n if (t < temp || (t == temp && i + m > ans))\n {\n temp = t;\n y1 = i;\n y2 = m;\n ans = i + m;\n }\n r = m - 1;\n }\n else\n {\n l = m + 1;\n }\n }\n }\n printf(\"%I64d %I64d\\n\", y1, y2);\n}\n\nint main()\n{\n int t1, t2, x1, x2, t0;\n while (scanf(\"%d%d%d%d%d\", &t1, &t2, &x1, &x2, &t0) == 5)\n {\n solve(t1, t2, x1, x2, t0);\n }\n return 0;\n}"}, {"source_code": "#include \n#include \n#define min(a, b) (((a) < (b)) ? (a) : (b))\n#define abs(a) ((a < 0) ? (-a) : (a))\n#define double long double\n\nlong long t1, t2, t0, x1, x2, y1, y2, y1_ans, y2_ans;\ndouble ans = 100000000000000.0;\ndouble eps = 0.000000000000001;\n\nint\neq(double a, double b)\n{\n return (abs(a - b) < eps);\n}\n\nint\nmain(void)\n{\n scanf(\"%I64d%I64d%I64d%I64d%I64d\", &t1, &t2, &x1, &x2, &t0);\n if(t2 == t0){\n if(t1 == t0){\n printf(\"%I64d %I64d\", x1, x2);\n } else {\n printf(\"0 %I64d\", x2);\n }\n return 0;\n }\n for(y1 = 0; y1 <= x1; ++y1){\n y2 = ((y1 * (t0 - t1)) % (t2 - t0)) ? (y1 * (t0 - t1)) / (t2 - t0) + 1 : (y1 * (t0 - t1)) / (t2 - t0);\n if(y2 > x2) continue;\n double tmp = (double)(t1 * y1 + t2 * y2) / (double)(y1 + y2);\n if(tmp - (double)t0 < ans || (eq(tmp - (double)t0, ans) && y1 + y2 > y1_ans + y2_ans)){\n ans = tmp - (double)t0;\n y1_ans = y1;\n y2_ans = y2;\n }\n }\n printf(\"%I64d %I64d\", y1_ans, y2_ans);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#define min(a, b) (((a) < (b)) ? (a) : (b))\n#define abs(a) ((a < 0) ? (-a) : (a))\n#define double long double\n\nlong long t1, t2, t0, x1, x2, y1, y2, y1_ans, y2_ans;\ndouble ans = 100000000000000.0;\ndouble eps = 0.000000000000001;\n\nint\neq(double a, double b)\n{\n return (abs(a - b) < eps);\n}\n\nint\nmain(void)\n{\n scanf(\"%I64d%I64d%I64d%I64d%I64d\", &t1, &t2, &x1, &x2, &t0);\n if(t2 == t0){\n y2_ans = x2;\n y2 = x2;\n for(y1 = 0; y1 <= x1; ++y1){\n double tmp = (double)(t1 * y1 + t2 * y2) / (double)(y1 + y2);\n if(tmp < t0) continue;\n if(tmp - (double)t0 < ans || (eq(tmp - (double)t0, ans) && y1 + y2 > y1_ans + y2_ans)){\n ans = tmp - (double)t0;\n y1_ans = y1;\n }\n }\n printf(\"%I64d %I64d\", y1_ans, y2_ans);\n return 0;\n }\n for(y1 = 0; y1 <= x1; ++y1){\n y2 = ((y1 * (t0 - t1)) % (t2 - t0)) ? (y1 * (t0 - t1)) / (t2 - t0) + 1 : (y1 * (t0 - t1)) / (t2 - t0);\n if(y2 > x2) continue;\n if(y1 == 0 && y2 == 0) continue;\n double tmp = (double)(t1 * y1 + t2 * y2) / (double)(y1 + y2);\n if(tmp - (double)t0 < ans || (eq(tmp - (double)t0, ans) && y1 + y2 > y1_ans + y2_ans)){\n ans = tmp - (double)t0;\n y1_ans = y1;\n y2_ans = y2;\n }\n }\n printf(\"%I64d %I64d\", y1_ans, y2_ans);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#define min(a, b) (((a) < (b)) ? (a) : (b))\n#define abs(a) ((a < 0) ? (-a) : (a))\n\nlong long t1, t2, t0, x1, x2, y1, y2, y1_ans, y2_ans;\ndouble ans = 100000000000000.0;\ndouble eps = 0.000000000001;\n\nint\neq(double a, double b)\n{\n return (abs(a - b) < eps);\n}\n\nint\nmain(void)\n{\n scanf(\"%I64d%I64d%I64d%I64d%I64d\", &t1, &t2, &x1, &x2, &t0);\n if(t2 == t0){\n if(t1 == t0){\n printf(\"%I64d %I64d\", x1, x2);\n } else {\n printf(\"0 %I64d\", x2);\n }\n return 0;\n }\n long long i;\n for(i = 0; i <= x1; ++i){\n y1 = i;\n y2 = ((y1 * (t0 - t1)) % (t2 - t0)) ? (y1 * (t0 - t1)) / (t2 - t0) + 1 : (y1 * (t0 - t1)) / (t2 - t0);\n if(y2 > x2) continue;\n if(y1 == 0 && y2 == 0) continue;\n double tmp = (double)(t1 * y1 + t2 * y2) / (double)(y1 + y2);\n if(tmp - (double)t0 < ans || (eq(tmp - (double)t0, ans) && y1 + y2 > y1_ans + y2_ans)){\n ans = tmp - (double)t0;\n y1_ans = i;\n y2_ans = y2;\n }\n }\n printf(\"%I64d %I64d\", y1_ans, y2_ans);\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\n#define eps 1e-12\n\nint main() {\n\tint t1,t2,t0,x1,x2,i,a1,a2;\n\tlong long j,t,ans;\n\n\tscanf(\"%d %d %d %d %d\",&t1,&t2,&x1,&x2,&t0);\n\tif (t0==t2) {\n\t\tif (t0==t1) printf(\"%d %d\\n\",x1,x2);\n\t\telse printf(\"0 %d\\n\",x2);\n\t\treturn 0;\n\t}\n\tans=5000000000000000000LL,a1=0,a2=1;\n\tfor(i=0;i<=x1;i++) {\n\t\tj=((long long)(t0-t1)*i+(t2-t0-1))/(t2-t0);\n\t\tif (j>x2) continue;\n\t\tt=(long long)i*t1+j*t2;\n\t\tif (t*(a1+a2)a1+a2)\n\t\t\tans=t,a1=i,a2=j;\n\t}\n\tprintf(\"%d %d\\n\",a1,a2);\n\treturn 0;\n}"}, {"source_code": "#include\n#include\n\n#define eps 1e-12\n\nint main() {\n\tint t1,t2,t0,x1,x2,i,a1,a2;\n\tlong long j,t,ans;\n\n\tscanf(\"%d %d %d %d %d\",&t1,&t2,&x1,&x2,&t0);\n\tif (t0==t2) {\n\t\tif (t0==t1) printf(\"%d %d\\n\",x1,x2);\n\t\telse printf(\"0 %d\\n\",x2);\n\t\treturn 0;\n\t}\n\tans=3000000000000LL,a1=0,a2=1;\n\tfor(i=0;i<=x1;i++) {\n\t\tj=((long long)(t0-t1)*i+(t2-t0-1))/(t2-t0);\n\t\tif (j>x2) continue;\n\t\tt=(long long)i*t1+j*t2;\n\t\tif (t*(a1+a2)a1+a2)\n\t\t\tans=t,a1=i,a2=j;\n\t}\n\tprintf(\"%d %d\\n\",a1,a2);\n\treturn 0;\n}"}, {"source_code": "#include\n#include\n\n#define eps 1e-12\n\nint main() {\n\tint t1,t2,t0,x1,x2,i,j,a1,a2,tt;\n\tdouble t,tx,ans,dt,y;\n\n\tscanf(\"%d %d %d %d %d\",&t1,&t2,&x1,&x2,&t0);\n\tif (t0==t2) {\n\t\tif (t0==t1) printf(\"%d %d\\n\",x1,x2);\n\t\telse printf(\"0 %d\\n\",x2);\n\t\treturn 0;\n\t}\n\tans=1e20;\n\tfor(i=0;i<=x1;i++) {\n\t\ty=(t1-t0)/(double)(t0-t2)*i;\n\t\tif (y>x2+1.1) continue;\n\t\ttt=(int)floor(y+eps);\n\t\tj=tt;\n\t\tt=((double)i*t1+(double)j*t2)/(i+j);\n\t\tif (i+j>0 && t+eps>t0 && j<=x2) {\n\t\t\tdt=t-t0;\n\t\t\tif (dt+eps0 && t+eps>t0 && j<=x2) {\n\t\t\tdt=t-t0;\n\t\t\tif (dt+eps\n#include\n\n#define eps 1e-12\n\nint main() {\n\tint t1,t2,t0,x1,x2,i,j,a1,a2,tt;\n\tdouble t,tx,ans,dt,y;\n\n\tscanf(\"%d %d %d %d %d\",&t1,&t2,&x1,&x2,&t0);\n\tif (t0==t2) {\n\t\tif (t0==t1) printf(\"%d %d\\n\",x1,x2);\n\t\telse printf(\"0 %d\\n\",x2);\n\t\treturn 0;\n\t}\n\tans=1e20;\n\tfor(i=0;i<=x1;i++) {\n\t\ty=(t1-t0)/(double)(t0-t2)*i;\n\t\tif (y>x2+1.0) continue;\n\t\ttt=(int)floor(y+eps);\n\t\tj=tt;\n\t\tt=((double)i*t1+(double)j*t2)/(i+j);\n\t\tif (t+eps>t0 && j<=x2) {\n\t\t\tdt=t-t0;\n\t\t\tif (dt+epst0 && j<=x2) {\n\t\t\tdt=t-t0;\n\t\t\tif (dt+eps\nint main()\n{\n int sum=0,n,a[10000],b=0,i,c=0,flag,d=0;\n scanf(\"%d\",&n);\n for(i=0; ;i++){\n if(i<7){\n scanf(\"%d\",&a[i]);\n }\n sum=sum+a[c];\n b++;\n c++;\n if(sum>=n){\n b=b-d;\n break;\n }\n if(b>7){\n b=1;\n c=0;\n d=1;\n }\n }\nprintf(\"%d\",b);\n\nreturn 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int n, day[10], i;\n scanf(\" %d\", &n);\n for(i = 1; i <= 7; i++) \n {\n scanf(\" %d\", &day[i]);\n }\n while(1)\n {\n for(i = 1; i <= 7; i++) \n {\n n -= day[i];\n if(n <= 0) goto ans;\n }\n }\n ans:\n printf(\"%d\", i);\n return 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n\tint n, a[7], i, j, s=0, x;\n\tscanf(\"%d\", &n);\n\tfor(i=0; i<7; i++)\n\t{\n\t\tscanf(\"%d\", &a[i]);\n\t\ts = s + a[i];\n\t}\n\tj = n%s;\n\tif(j==0)\n\t{\n\t\tj=s ;\n\t\tfor(i=0; i<7; i++)\n\t\t{\n\t\t\tif(j<=a[i])\n\t\t\t{\n\t\t\t\tprintf(\"%d\", i+1);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse\n\t\t\tj = j - a[i];\n\t\t}\n\t}\n\telse\n\t{\n\t\tfor(i=0; i<7; i++)\n\t\t{\n\t\t\tif(j<=a[i])\n\t\t\t{\n\t\t\t\tprintf(\"%d\", i+1);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse\n\t\t\tj = j-a[i];\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint pages[7];\n\tfor (int i=0;i<7;i++)\n\t\tscanf(\"%d\",&pages[i]);\n\tint temp=n, ans=0, flag=0;\n\tfor (int i=0;i\n#include \n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a[7];\n int i;\n for (i=0;i<7;i++){\n scanf(\"%d\",&a[i]);\n }\n i=0;\n while (n>0){\n n=n-a[i];\n i++;\n if (i>6){\n i=0;\n }\n }\n if (i==0){\n printf(\"%d\",7);\n }else\n printf(\"%d\",i);\n return 0;\n}\n"}, {"source_code": "#include\nint s(int x[], int y);\nint sum=0;\nint main()\n{\nint n, i, day[1000], z;\nscanf(\"%d\", &n);\nfor(i=1; i<=7;i++)\n scanf(\"%d\", &day[i]);\nz= s(day, n); \nprintf(\"%d\\n\", z);\n\nreturn 0;\n}\n\nint s(int x[], int y)\n{\nint i, n=y;\nfor(i=1; i<=7;i++)\n{\n sum+= x[i]; \n if(sum>=n)\n return(i);\n}\nif(i==8)\n s(x, n); \n}"}, {"source_code": "#include\nint main()\n{\n int n,g,i,j=0,k=0,e,sum=0,l=0,x,y,z,a=0;\n int p[8];\n scanf(\"%d\",&n);\n for(i=1;i<=7;i++)\n {\n scanf(\"%d\",&p[i]);\n sum=p[i]+sum;\n if(sum==n)\n {\n j++;\n printf(\"%d\\n\",i);\n break;\n }\n }\n x=n/sum;\n e=n%sum;\n if(sum==1)\n {\n for(i=1;i<=7;i++)\n {\n if((p[i]>0)&&(j==0))\n {\n k++;\n printf(\"%d\\n\",i);\n break;\n }\n }\n }\n\n\n if((j==0)&&(k==0))\n {\n y=x*sum;\n z=n-y;\n if(z!=0)\n {\n for(i=1;i<=7;i++)\n {\n l=p[i]+l;\n if(l>=z)\n {\n break;\n }\n }\n printf(\"%d\\n\",i);\n }\n else\n {\n g=(x-1)*sum;\n for(i=1;i<=7;i++)\n {\n g=p[i]+g;\n if(g==n)\n {\n printf(\"%d\\n\",i);\n break;\n } \n }\n }\n }\n return 0;\n}"}, {"source_code": "#include \n\nint main () {\n\t\n\tint p=0, i=0;\n\tint d[7];\n\n\tscanf(\"%d\", &p);\n\n\tfor (i=0; i<7; i++)\n\t\tscanf(\"%d\", &d[i]);\n\n\ti=0;\n\twhile (p > 0) {\n\t\tp -= d[i];\n\t\ti++;\n\t\tif (i>=7)\n\t\t\ti=0;\n\t}\n\n\tif (i==0)\n\t\tprintf(\"7\\n\");\n\telse\n\t\tprintf(\"%d\\n\", i);\n\t\n\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main(int argc, char const *argv[]){\n\t\n\tint n, j = 0;\n\n\tint leer[7];\n\n\tscanf(\"%d\", &n);\n\tscanf(\"%d %d %d %d %d %d %d\",&leer[0],&leer[1],&leer[2],&leer[3],&leer[4],&leer[5],&leer[6]);\n\n\twhile(n > 0){\n\t\tn = n - leer[j];\n\t\tj++;\n\t\tj = j % 7;\n\t}\n\tif ( j == 0){\n\t\tj = 7;\n\t}\n\tprintf(\"%d\",j );\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main(){\n\tint n,i;\n\tint a[8];\n\tint count=0;\n\tint day;\n\tscanf(\"%d\",&n);\n\tfor(i=1;i<=7;i++){\n\t\tscanf(\"%d\",a+i);\n\t\t//count+=a[i];\n\t}\n\twhile(n>0){\n\t\tfor(i=1;i<=7;i++){\n\t\t\tn-=a[i];\n\t\t\tif(n<=0)break;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",i);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int i,n,arr[10],flag=0,day;\n scanf(\"%d\",&n);\n for(i=1;i<=7;i++)\n {\n scanf(\"%d\",&arr[i]);\n }\n while(1)\n {\n for(i=1;i<=7;i++)\n {\n n=n-arr[i];\n if(n<=0)\n {\n day=i;\n flag=1;\n break;\n }\n }\n if(flag==1)\n {\n break;\n }\n }\n printf(\"%d\\n\",day);\n return 0;\n}\n"}, {"source_code": "#include \n#include\n#include\nlong long int max(long long int a,long long int b){\n if(a>b){\n return a;\n }\n return b;\n}\nlong long int cmp(const void *a,const void *b){\n return *(long long int *)b-*(long long int*)a;\n}\nint main()\n{\n long long int i,j,test,k,m,l,r,flag=0,max=0,n,m1,m2,x,sum=0,ans=0,count, a[10000]={0},b[1000]={0};\nscanf(\"%lld\",&n);\nsum=0;\nfor(i=0;i<8;i++){\n scanf(\"%lld\",&a[i]);\n sum+=a[i];\n}\n//printf(\"%lld\\n\",sum);\ncount=1;\ni=0;\n while(n-a[i]>0 && i<7){\n count++;\n // printf(\"%lld %lld\\n\",a[i],sum);\n n=n-a[i];\n i++;\n if(count==8){\n count=1;\n }\n if(i==7){\n i=0;\n }\n }\n \n printf(\"%lld\",count);\n\n\n return 0;\n}"}, {"source_code": "#include \n#include \n#include\n// skdjfklsdjfkldsklj\nint sum[8];\nint main()\n{\n\tint n, w;\n\tscanf(\"%d\", &n);\n\tfor (int i = 1; i < 8; i++)\n\t{\n\t\tscanf(\"%d\", &w);\n\t\tsum[i] = sum[i - 1] + w;\n\t}\n\tn %= sum[7];\n\tif (n == 0) n = sum[7];\n\tfor (int i = 1; i < 8; i++)\n\t{\n\t\tif (sum[i] >= n)\n\t\t{\n\t\t\tprintf(\"%d\\n\", i);\n\t\t\treturn 0;\n\t\t}\n\t}\n}"}, {"source_code": "#include\nint main ()\n{\n\tint arr[1010], i, n, page;\n\tscanf(\"%d\",&n);\n\tfor (i = 1; i<=7; i++)\n\t{\n\t\tscanf(\"%d\", &arr[i]);\n\t}\n\twhile(1)\n {\n for(i = 1; i<=7; i++)\n {\n n = n - arr[i];\n if(n<=0)\n {\n printf(\"%d\\n\",i);\n break;\n }\n if(i==7)\n {\n i=0;\n continue;\n }\n else continue;\n }\n if(n<=0)break;\n }\n\treturn 0;\n\n}\n"}, {"source_code": "#include\n#include\n#include\nint main()\n{\n int n,a[7],i,ans;\n scanf(\"%d\",&n);\n for(i=0;i<7;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n while(n>0)\n {\n for(i=0;i<7;i++)\n {\n if(n>a[i])\n n=n-a[i];\n else\n {\n ans=i+1;\n n=0;\n break;\n }\n }\n }\n printf(\"%d\",ans);\n printf(\"\\n\");\n return 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int t[100];\n int n,i,somme;\n somme=0;\n\n scanf(\"%d\",&n);\n for (i=1;i<=7;i++)\n {\n scanf(\"%d\",&t[i]);\n }\n\n do\n {\n for (i=1;i<=7;i++)\n {\n somme=somme+t[i];\n\n if (somme>=n)\n {\n printf(\"%d\",i);\n exit(0);\n }\n\n }\n\n }while(somme\nint main()\n{\n int n,w[1000],i=0,j=0,s=0,l=0;\n scanf(\"%d\",&n);\n for(j=1;j<=7;j++) scanf(\"%d\",&w[j]);\n while(s=n) j=i;\n if(i==7) i=0;\n } printf(\"%d\",j);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,i,s=0;\n\tint a[7];\n\tscanf(\"%d\",&n);\n\tfor (i=0;i<7;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tfor (i=0;i<100000;i++)\n\t{\n\t\ts=s+a[i%7];\n\t\tif (s>=n) \n\t\t{\n\t\t\tprintf(\"%d\",((i%7)+1));\n\t\t\treturn 0;\n\t\t}\n\t}\n\t\n}"}, {"source_code": "#include\"stdio.h\"\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int num[7]; // 0 is monday, 6 is sunday\n int i;\n for(i=0;i<7;i++)\n scanf(\"%d\",&num[i]);\n int sum=n,flag=0,j;\n while(flag==0)\n {\n for(j=0;j<7;j++)\n {\n sum-=num[j];\n if(sum<=0) { flag=j+1; break;}\n }\n\n }\n printf(\"%d\",flag);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,i;\n\t\n\tscanf(\"%d\",&n);\n\tint z=n;\n\tint a[8];\n\tfor(i=0;i<7;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tfor(i=0;i<7;i++)\n\t{\n\t\tz=z-a[i];\n\t\tif(z<=0)\n\t\t{\n\t\t\tprintf(\"%d\",i+1);\n\t\t\tbreak;\n\t\t}\n\t\tif(i==6)\n\t\t{\n\t\t\tif(z>0)\n\t\t\t{\n\t\t\t\ti=-1;\n\t\t\t}\n\t\t}\t\t\n\t\t\t\n\t}\n\t\n}\t\t\n\t\t\n\t\t\n"}, {"source_code": "#include\nint main() {\n int n;\n scanf(\"%d\",&n);\n int read[7];\n int i;\n for(i=0;i<7;i++) {\n scanf(\"%d\",&read[i]);\n }\n int sum=0;\n i=0;\n int res=0;\n while(1) {\n \n if(sum>=n) {\n res=i;\n break;\n } \n if(i==7) i=0;\n sum+=read[i];\n \n i++;\n }\n printf(\"%d\\n\",res);\n return 0;\n}"}, {"source_code": "#include \n\nint main(void){\n int pages, sum=0;\n int pagesbyday[7] = {0};\n scanf(\"%d\", &pages);\n for(int i=0; i<7; ++i){\n scanf(\"%d\", &pagesbyday[i]);\n }\n int i;\n for(i=0; sum\nint main()\n{\n int n, i, a[8], c = 0, sum = 0;\n\n scanf(\"%d\", &n);\n for(i=1; i<=7; i++)\n scanf(\"%d\", &a[i]);\n\n while(1)\n {\n for(i=1 ;i<=7; i++)\n {\n sum = sum + a[i];\n if(sum >= n)\n {\n printf(\"%d\\n\", i);\n c = 1;\n break;\n }\n }\n if(c) break;\n }\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,i,s=0\n ;\n int a[1005];\n scanf(\"%d\",&n);\n for(i=1;i<=7;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n i=0;\n while(1)\n {\n s=s+a[i];\n if(s>=n)\n break;\n i=i%7;\n i++;\n }\n printf(\"%d\",i);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int i,j=0,n,s=0,k;\n int arr[7];\n scanf(\"%d\",&n);\n for(i=0;i<7;i++)\n {\n scanf(\"%d\",&arr[i]);\n }\n i=0;\n while(1)\n {\n s=s+arr[i%7];\n j++;\n if(s>=n)\n {\n break;\n }\n i++;\n }\n if(j%7!=0)\n printf(\"%d\",j%7);\n else\n printf(\"%d\",7);\n}"}, {"source_code": "#include \n#include \n#include \n#include \n#include \n\n#define lli long long int\n#define MAX INT_MAX\n#define PI acos(-1)\n#define FOR(ii,aa,bb) for(ii=aa;ii<=bb;ii++)\n#define ROF(ii,aa,bb) for(ii=aa;ii>bb;ii--)\n#define buyuk(a,b) (a=x){\n\t\tprintf(\"%d\",i+1);\n\treturn 0;\n\t}\n\t\t}\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int n,i=0;\n scanf(\"%d\",&n);\n int a[7],s=0;\n for(int i=0;i<7;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n while(i>=0)\n {\n if(i<7)\n {\n s+=a[i];\n if(s>=n)\n {\n printf(\"%d\",i+1);\n break;\n }\n }\n else if(i>=7)\n {\n int p=(i%7);\n s+=a[p];\n if(s>=n)\n {\n printf(\"%d\",p+1);\n break;\n }\n }\n i++;\n }\n return 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int pages,i;\n scanf(\"%d\",&pages);\n int day[10];\n for(i=1;i<=7;i++){\n scanf(\"%d\",&day[i]);\n }\n int read=0;\n int save;\n int flag=0;\n int j;\n while(read=pages && flag==0){\n save=j;\n flag=1;\n break;\n }\n }\n }\n\n printf(\"%d\",save);\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(void)\n{\n unsigned short page;\n scanf(\"%hu\", &page);\n\n const unsigned short DAYS = 7;\n unsigned short pages[DAYS];\n for (unsigned short i = 0; i < DAYS; ++i)\n scanf(\"%hu\", &pages[i]);\n\n unsigned short day = 1;\n unsigned short i = 0;\n while (page - pages[i] > 0)\n {\n page -= pages[i++];\n if (day++ == DAYS)\n {\n day = 1;\n i = 0;\n }\n }\n\n printf(\"%hu\", day);\n\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int sum=n;\n int i;\n\n int a[7];\n\n for(i=0;i<7;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n i=0;\n while(1)\n {\n sum=sum-a[i];\n if(sum<=0)\n {\n printf(\"%d\",i+1);\n return 0;\n }\n if(i==6) i=-1;\n i++;\n\n\n\n }\n}\n"}, {"source_code": "//In the name of God\n\n#include \n\nint main()\n{\n\tint b;\n\tscanf(\"%d\",&b);\n\tint a[10],i,n=7;\n\tfor(i=1;i<=n;i++)\n\t\tscanf(\"%d\",&a[i]);\n\tint c=b,cn=0;\n\tfor(i=1;c>0;i++)\n\t{\n\t\tif(i==8)\n\t\t\ti=1;\n\t\tc=c-a[i];\n\t\tcn++;\n\t}\n\t//printf(\"%d\\n\",cn);\n\tif(cn%7==0)\n\t\tprintf(\"7\\n\");\n\telse\n\t\tprintf(\"%d\\n\",(cn%7));\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n\tint i, n;\n\tstatic int a[7];\n\n\tscanf(\"%d\", &n);\n\tfor (i = 0; i < 7; i++)\n\t\tscanf(\"%d\", &a[i]);\n\tfor (i = 0; ; i = (i + 1) % 7) {\n\t\tn -= a[i % 7];\n\t\tif (n <= 0) {\n\t\t\tprintf(\"%d\\n\", i + 1);\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\t\tint p,w1,w2,w3,w4,w5,w6,w7;\n\t\tscanf(\"%d\",&p);\n\t\tscanf(\"%d %d %d %d %d %d %d\",&w1,&w2,&w3,&w4,&w5,&w6,&w7);\n\t\twhile(p>0)\n\t\t{\n\t\t\tif(p-w1<=0)\n\t\t\t{printf(\"1\\n\");}\n\t\t\telse if(p-w1-w2<=0)\n\t\t\t{printf(\"2\\n\");}\n\t\t\telse if(p-w1-w2-w3<=0)\n\t\t {printf(\"3\\n\");}\n\t\t\telse if(p-w1-w2-w3-w4<=0)\n\t\t\t{printf(\"4\\n\");}\n\t\t\telse if(p-w1-w2-w3-w4-w5<=0)\n\t\t {printf(\"5\\n\");}\n\t\t\telse if(p-w1-w2-w3-w4-w5-w6<=0)\n\t\t\t{printf(\"6\\n\");}\n\t\t\telse if(p-w1-w2-w3-w4-w5-w6-w7<=0)\n\t {printf(\"7\\n\");}\n\t p=p-w1-w2-w3-w4-w5-w6-w7;\n\t \n\t }\n\treturn 0;\n\t\t\t\n}"}, {"source_code": "#include \n\nint main()\n{\n\tint n,i,s,g,r,t,y,e;\n\tscanf(\"%d\",&n);\n\tint ara[1000000];\n\tfor (i=0;i<7;i++){\n\t\tscanf(\"%d\",&ara[i]);\n\t}\n\ts=0;\n\tfor (i=0;i<7;i++){\n\t\ts=s+ara[i];\n\t}\n\tif (s>=n){\n\t\t\n\t\t\ty=0;\n\t\t\tfor (i=0;i<7;i++){\n\t\t\t\ty=y+ara[i];\n\t\t\t\tif (y>=n){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\tprintf(\"%d\",i+1);\n\t}\n\telse{\n\t\tif (n%s!=0){\n\t\tt=n/s;\n\t\te=n-(s*t);\n\t\ty=0;\n\t\tfor (i=0;i<7;i++){\n\t\t\ty=y+ara[i];\n\t\t\tif(y>=e && y!=0){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tprintf(\"%d\",i+1);\n\t}\n\telse{\n\t\tif(s!=1){\n\t\tr=n/s;\n\t\ty=0;\n\t\tfor (i=0;i<7;i++){\n\t\t\ty=y+ara[i];\n\t\t\tif(y>=r ){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tprintf(\"%d\",i+1);\n\t}\n\t\n\telse{\n\t\tfor(i=0;i<7;i++){\n\t\t\tif(ara[i]==1){\n\t\t\t\tprintf(\"%d\",i+1);\n\t\t\t}\n\t\t}\n\t}\n\t}\n\t}\n\treturn 0;\n\t\n}\n"}, {"source_code": "#include \nint main()\n{\n int n, ara[7], i;\n scanf(\"%d\", &n);\n for(i = 0; i <7; i++){\n scanf(\"%d\", &ara[i]);\n }\n i = 0;\n while(n>0){\n n = n -ara[i];\n i = i + 1;\n if(i==7){\n i = 0;\n }\n }\n if(i == 0){\n printf(\"7\");\n return 0;\n }\n printf(\"%d\", i);\n return 0;\n}\n"}, {"source_code": "// C program for insertion sort\n#include \n#include \n#include\n#include\nint maxi(int n,int m)\n{\n return n>m?n:m;\n}\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 /* create temp arrays */\n int L[n1], R[n2];\n\n /* Copy data to temp arrays L[] and R[] */\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 /* Merge the temp arrays back into arr[l..r]*/\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\n /* Copy the remaining elements of L[], if there are any */\n while (i < n1)\n {\n arr[k] = L[i];\n i++;\n k++;\n }\n\n /* Copy the remaining elements of R[], if there are any */\n while (j < n2)\n {\n arr[k] = R[j];\n j++;\n k++;\n }\n}\n\n/* l is for left index and r is right index of the sub-array\n of arr to be sorted */\nvoid mergeSort(int arr[], int l, int r)\n{\n if (l < r)\n {\n int m = l+(r-l)/2; //Same as (l+r)/2, but avoids overflow for large l and h\n mergeSort(arr, l, m);\n mergeSort(arr, m+1, r);\n merge(arr, l, m, r);\n }\n}\n\nint main()\n {\n int i=0,j=0,n,m,x,y,z,r,flag=0,sum=0,arr[8],x1,x2,y1,y2;\n scanf(\"%d\",&n);\n for(i=0;i<7;i++)\n {\n scanf(\"%d\",&arr[i]);\n }\n while(sumn)\n {\n flag=1;\n break;\n }\n if(sum==n)\n {\n flag=2;\n break;\n }\n if(flag>=1)\n break;\n }\n\n }\n if(flag>=1)\n printf(\"%d\",i+1);\n return 0;\n }\n"}, {"source_code": "#include\nint main()\n{\n int n,i;\n scanf(\"%d\",&n);\n int a[7];\n for(i=0;i<7;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n int sum=0,s,p=0;\n while(1)\n {\n for(i=0;i<7;i++)\n {\n sum=sum+a[i];\n if(sum>=n)\n {\n s=i+1;\n p=1;\n break;\n }\n }\n if(p==1)\n {\n break;\n }\n }\n if(s<=7)\n {\n printf(\"%d\\n\",s);\n }\n else\n {\n printf(\"%d\\n\",s%7);\n }\n return 0;\n}\n"}, {"source_code": "#include \n\n\nint m(n,i);\nint n,i;\nint a[7];\n\nint main()\n{\n scanf(\"%d\",&n);\n for (i=0 ; i<7 ; i++)\n {\n scanf(\"%d\",&a[i]);\n }\n i=0;\n m(n,i);\n}\n\nint m(n,i)\n{\n n=n-a[i];\n if (n<=0){\n printf(\"%d\",i+1);\n return 0;\n }\n if (i==6)\n i=-1;\n i++;\n m(n,i);\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int n,p=0,i;\n int a[7];\n scanf(\"%d\",&n);\n for(i=0;i<7;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n while(n>0)\n {\n n=n-a[p];\n if(n<=0)\n break;\n else\n {\n p++;\n p=p%7;\n }\n }\n printf(\"%d\",p+1);\n return 0;\n}\n\n"}, {"source_code": "#include\n#include\nint main()\n{ int n,i,d=0,s=0;\n scanf(\"%d\",&n);\n int a[7];\n for(i=0;i<7;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<7;i++)\n {\n s=s+a[i];\n if(s>=n)\n {\n printf(\"%d\",i+1);\n return 0;\n }\n }\n\n if(s=n)\n {\n printf(\"%d\",(i%7)+1);\n return 0;\n }\n }\n }\nreturn 0;\n }\n"}, {"source_code": "#include\nint main()\n{\n int n,a[7],i,d=-1;\n scanf(\"%d\",&n);\n for(i=0;i<7;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n while(n!=0)\n {\n d++;\n if(n>=a[d%7])\n {\n n-=a[d%7];\n }\n else\n {\n break;\n }\n }\n printf(\"%d\",(d%7)+1);\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,week[7],i,j=0;\n scanf(\"%d\",&n);\n for(i=0;i<7;i++)\n scanf(\"%d\",&week[i]);\n while(n>0)\n {\n n=n-week[j];\n j++;\n if(j==7 && n<=0) break;\n if(j>6) j=0;\n }\n printf(\"%d\",j);\n return 0;\n}\n"}, {"source_code": "#include \n\nint arr[7];\n\nint main()\n{\n int n, i, sum = 0, count = 0;\n scanf(\"%d\", &n);\n\n for(i=0; i<7; i++){\n scanf(\"%d\", &arr[i]);\n sum = sum + arr[i];\n }\n\n while(1){\n for(i=0; i<7; i++){\n count = count + arr[i];\n if(count >= n){\n printf(\"%d\", i + 1);\n return 0;\n }\n }\n }\n}\n"}, {"source_code": "#include\n\nint main(void)\n{\n\tint n,a[10],i,s=0,dif;\n\tscanf(\"%d\",&n);\n\tfor(i=1;i<8;i++) {\n\t\tscanf(\"%d\",&a[i]);\n\t\ts+=a[i];\n\t}\n\tif(n>s) {\n\t\tdif=n%s;\n\t\tif(dif==0) {\n\t\t\tfor(i=7;i>0;i--) {\n\t\t\t\tif(a[i]!=0) {\n\t\t\t\t\tprintf(\"%d\",i);\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\tif(dif<=a[1])\n\t\t\t\tprintf(\"1\");\n\t\t\telse if(dif<=a[1]+a[2])\n\t\t\t\tprintf(\"2\");\n\t\t\telse if(dif<=a[1]+a[2]+a[3])\n\t\t\t\tprintf(\"3\");\n\t\t\telse if(dif<=a[1]+a[2]+a[3]+a[4])\n\t\t\t\tprintf(\"4\");\n\t\t\telse if(dif<=a[1]+a[2]+a[3]+a[4]+a[5])\n\t\t\t\tprintf(\"5\");\n\t\t\telse\n\t\t\t\tprintf(\"6\");\n\t\t}\n\t}\n\telse {\n\t\tdif=n;\n\t\tif(dif<=a[1])\n\t\t\tprintf(\"1\");\n\t\telse if(dif<=a[1]+a[2])\n\t\t\tprintf(\"2\");\n\t\telse if(dif<=a[1]+a[2]+a[3])\n\t\t\tprintf(\"3\");\n\t\telse if(dif<=a[1]+a[2]+a[3]+a[4])\n\t\t\tprintf(\"4\");\n\t\telse if(dif<=a[1]+a[2]+a[3]+a[4]+a[5])\n\t\t\tprintf(\"5\");\n\t\telse if(dif<=a[1]+a[2]+a[3]+a[4]+a[5]+a[6])\n\t\t\tprintf(\"6\");\n\t\telse\n\t\t\tprintf(\"7\");\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n, i, a[8], c = 0, sum = 0;\n\n scanf(\"%d\", &n);\n for(i=1; i<=7; i++)\n scanf(\"%d\", &a[i]);\n\n while(1)\n {\n for(i=1 ;i<=7; i++)\n {\n sum = sum + a[i];\n if(sum >= n)\n {\n printf(\"%d\\n\", i);\n c = 1;\n break;\n }\n }\n if(c) break;\n }\n return 0;\n}"}, {"source_code": "#include\n#include\n\nint main(){\n int tab[8];\n int i,j,n;\n scanf(\"%d\",&n);\n for(i=1;i<=7;i++)\n scanf(\"%d\",&tab[i]);\n while(n>=0){\n for(i=1;i<=7;i++){\n n-=tab[i];\n if(n<=0){\n printf(\"%d\",i);\n return 0;\n }\n }\n }\n\n}"}, {"source_code": "#include \nint main()\n{\n int n,i,sum=0,j=1;\n scanf(\"%d\",&n);\n int a[8];\n for(i=1;i<8;i++)\n scanf(\"%d\",&a[i]);\n while(1)\n {\n \n sum=sum+a[j];\n if(sum>=n)\n {\n printf(\"%d\",j);\n break;\n }\n j++;\n if(j>7)\n j=1;\n }\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int total, day;\n scanf(\"%d\",&total);\n int a[8], i, read = 0;\n\n for(i = 1; i < 8; i++){\n scanf(\"%d\",&a[i]);\n }\n\n for(i = 1; i < 8; i++){\n read += a[i];\n //printf(\"read: %d\\n\",read);\n if(read >= total){\n day = i;\n break;\n }\n if(i == 7){\n i = 0;\n }\n }\n\n printf(\"%d\\n\",day);\n\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n int n,pages[7],read=0,day=0;\n scanf(\"%d\",&n);\n for(int i=0;i<7;i++){\n scanf(\"%d\",&pages[i]);\n }\n while(1){\n for(int i=0;i<7;i++){\n read+=pages[i];\n if(read>=n){ day=i+1;break;}\n \n }\n if(day!=0) break; \n }\n printf(\"%d\",day);\n}"}, {"source_code": "#include\nint main(){\n int n,p[7],i,t;\n scanf(\"%d\",&n);\n for(i=1;i<7;i++)\n scanf(\"%d\",&p[i]);\n scanf(\"%d\",&p[0]);\n for(t=1;;t++){\n n-=p[(t%7)];\n if(n<=0){\n if(t%7==0)\n printf(\"7\");\n else\n printf(\"%d\",t%7);\n return 0;\n }\n }\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,i,s=0\n ;\n int a[1005];\n scanf(\"%d\",&n);\n for(i=1;i<=7;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n i=0;\n while(1)\n {\n s=s+a[i];\n if(s>=n)\n break;\n i=i%7;\n i++;\n }\n printf(\"%d\",i);\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n int totpag=0,lu=0,ma=0,mi=0,ju=0,vi=0,sa=0,dom=0,dia=0,x=0;\n scanf(\"%d\",&totpag); \n scanf(\"%d%d%d%d%d%d%d\",&lu,&ma,&mi,&ju,&vi,&sa,&dom);\n do{\n dia++;\n if((dia%7)==0) totpag=totpag-dom;\n else if((dia%7)==1) totpag=totpag-lu;\n else if((dia%7)==2) totpag=totpag-ma;\n else if((dia%7)==3) totpag=totpag-mi;\n else if((dia%7)==4) totpag=totpag-ju;\n else if((dia%7)==5) totpag=totpag-vi;\n else if((dia%7)==6) totpag=totpag-sa;\n }while(totpag>0);\n if (dia%7==0){dia=7;}\n else dia=dia%7;\n printf(\"%d\",dia);\n}"}, {"source_code": "#include\nint main()\n{\n int n,i;\n scanf(\"%d\",&n);\n int a[7],total=0;\n for(i=0;i<7;i++)\n {\n scanf(\"%d\",&a[i]);\n total+=a[i];\n }\n int x;\n x=n/total;\n x=x*total;\n if(x=n) break;\n }\n printf(\"%d\",i+1);\n }\n else if(x==n)\n {\n x=n/total;\n x=(x-1)*total;\n for(i=0;i<7;i++)\n {\n x+=a[i];\n if(x>=n) break;\n }\n printf(\"%d\",i+1);\n }\n\n return 0;\n}\n"}, {"source_code": "#include\nint main ()\n{\n\tint arr[1010], i, n, page;\n\tscanf(\"%d\",&n);\n\tfor (i = 1; i<=7; i++)\n\t{\n\t\tscanf(\"%d\", &arr[i]);\n\t}\n\twhile(1)\n {\n for(i = 1; i<=7; i++)\n {\n n = n - arr[i];\n if(n<=0)\n {\n printf(\"%d\\n\",i);\n break;\n }\n if(i==7)\n {\n i=0;\n continue;\n }\n else continue;\n }\n if(n<=0)break;\n }\n\treturn 0;\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int n, arr[7], i;\n scanf(\"%d\", &n);\n for(i=0; i<7; i++)\n {\n scanf(\"%d\", &arr[i]);\n }\n while(n>0)\n {\n for(i=0; i<7; i++)\n {\n n-=arr[i];\n if(n<=0)\n {\n printf(\"%d\", i+1);\n return 0;\n }\n \n }\n }\n return 0;\n}"}, {"source_code": "#include \n\nint main(void){\n int pages, sum=0;\n int pagesbyday[7] = {0};\n scanf(\"%d\", &pages);\n for(int i=0; i<7; ++i){\n scanf(\"%d\", &pagesbyday[i]);\n }\n int i;\n for(i=0; sum\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tint days[7], j, sum = 0;\n\tfor (j = 0; j < 7; j++)\n\t\tscanf(\"%d\", &days[j]);\n\twhile (1)\n\t{\n\t\tfor (j = 0; j < 7; j++)\n\t\t{\n\t\t\tif (n > 0)\n\t\t\t\tn -= days[j];\n\t\t\tif (n <= 0)\n\t\t\t{\n\t\t\t\tprintf(\"%d\\n\", j + 1);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "#include\nint main()\n{\nint n,i=0,a[7],sum=0;\nscanf(\"%d\",&n);\nfor(i=0;i<7;i++)\nscanf(\"%d\",&a[i]);\ni=0;\nwhile(sum=7)\ni=i-7;\n}\nif(i==0)\nprintf(\"7\");\nelse\nprintf(\"%d\",i);\nreturn 0;\n}"}, {"source_code": "#include \nint main()\n{\n int n, ara[7], i;\n scanf(\"%d\", &n);\n for(i = 0; i <7; i++){\n scanf(\"%d\", &ara[i]);\n }\n i = 0;\n while(n>0){\n n = n -ara[i];\n i = i + 1;\n if(i==7){\n i = 0;\n }\n }\n if(i == 0){\n printf(\"7\");\n return 0;\n }\n printf(\"%d\", i);\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int sum,i,d[7];\n scanf(\"%d\", &sum);\n for(i=1;i<=7;i++)\n {\n scanf(\"%d\", &d[i]);\n }\n for(i=1;i<=7;i++)\n {\n if(sum<=d[i])\n {\n printf(\"%d\", i);\n break;\n }\n sum=sum-d[i];\n if(i==7)\n {\n i=0;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n, pages[7];\n scanf(\"%d\", &n);\n for(int i=0; i<7; i++){\n scanf(\"%d\", &pages[i]);\n }\n int i=0, total=0, cnt = 1;\n while(i<7){\n total += pages[i];\n //cnt++;\n //i++;\n if(total >= n){\n break;\n }\n\n else if(i==6 && total\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a[7],i,sum=0,left=0;\n for(i=0;i<7;i++)\n {\n scanf(\"%d\",&a[i]);\n sum+=a[i];\n }\n i=0;\n while(1)\n {\n if(a[i]>=n)\n {\n printf(\"%d\",i+1);\n return 0;\n }\n else\n n-=a[i];\n if(i==6)\n i=0;\n else i++;\n }\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,i,s=0\n ;\n int a[1005];\n scanf(\"%d\",&n);\n for(i=1;i<=7;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n\n\n for(i=1;i<=7;i++)\n {\n s=s+a[i];\n if(s>=n)\n {\n printf(\"%d\",i);\n break;\n }\n else if(i==7 && s\nint main()\n{\n int i, x, a[7], y = 0, count = 0;\n scanf(\"%d\", &x);\n for(i = 0; i<7; i++) {\n scanf(\"%d\", &a[i]);\n }\n while(y < x) {\n y = y + a[count];\n count++;\n if(count>6)\n count = 0;\n }\n if(count%7 == 0) {\n y = 7;\n }\n else {\n y = count%7;\n }\n printf(\"%d\", y);\n}\n"}, {"source_code": "#include\nint main()\n{\n int n, i, a[8], c = 0, sum = 0;\n\n scanf(\"%d\", &n);\n for(i=1; i<=7; i++)\n scanf(\"%d\", &a[i]);\n\n while(1)\n {\n for(i=1 ;i<=7; i++)\n {\n sum = sum + a[i];\n if(sum >= n)\n {\n printf(\"%d\\n\", i);\n c = 1;\n break;\n }\n }\n if(c) break;\n }\n return 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n int n,i,j,remainder,sum=0,loop,page[105];\n\n scanf(\"%d\",&n);\n\n for(i=1;i<=7;i++)\n {\n scanf(\"%d\",&page[i]);\n }\n\n loop:for(i=1;i<=7;i++)\n {\n\n sum=sum+page[i];\n if(sum>=n)\n {\n break;\n }\n }\n if(sum\n#include\n#include\n#include\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,d,x,m,l,max,sum2,min,f,c,r,o,sum1,sum=0,y,a[10000]={0},b;\n\nscanf(\"%lld\",&n);\n sum=0;\nfor(i=0;i<=6;i++){\n \n scanf(\"%lld\",&a[i]);\n sum+=a[i];\n}\nn=n%sum;\nif(n==0){\n n=sum;\n}\n\n\ni=0;\nwhile(n>0){\n n-=a[i];\n i++;\n \n}\n\nprintf(\"%lld\",i);\n \n\n\nreturn 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n\nint main(){\n\tint pages;\n\tint mo,tu,we,th,fr,sa,su;\n\tscanf(\"%d\",&pages);\n\tint day[8];\n\tfor(int i=0;i<7;i++){\n\t\tscanf(\"%d\",&day[i]);\n\t}\n\t\n\tint temp=1;\n\n\t\n\twhile(pages > 0){\n\t\tif(temp==8) temp=1;\n\t\t\n\t\tpages-=day[temp-1];\n\t\t\n\t\ttemp++;\t\n\t}\n\tprintf(\"%d\",temp-1);\n\t\n\treturn 0;\n}"}, {"source_code": "#include \nint main()\n{\n int n, day[8], i;\n scanf(\" %d\", &n);\n for(i = 1; i <= 7; i++) scanf(\" %d\", &day[i]);\n while(1) {\n for(i = 1; i <= 7; i++) {\n n -= day[i];\n if(n <= 0) goto ans;\n }\n }\n ans:\n printf(\"%d\", i);\n return 0;\n}"}, {"source_code": "#include \n\nint main() {\n \n int pages, i;\n scanf(\"%d\", &pages);\n\n int dayValues[7];\n for (i = 0; i <= 6; i++) {\n scanf(\"%d\", &dayValues[i]);\n }\n\n int currentPages = 0, currentDay = 0;\n\n while (1) {\n \n currentPages += dayValues[currentDay];\n\n if (currentPages >= pages) {\n printf(\"%d\", currentDay + 1);\n break;\n } else {\n currentDay++;\n }\n\n if (currentDay == 7) {\n currentDay = 0;\n }\n }\n}"}, {"source_code": "#include \nmain()\n{\nint n;\nscanf(\"%d\",&n);\nint a[8];\nint i,j=1,k;\nfor(i=1;i<8;i++)\nscanf(\"%d\",&a[i]);\nwhile(n>0)\n{\n\tif(j%7!=0)\nn=n-a[j%7];\nelse\n\tn=n-a[7];\nj++;\n\n\n}\nj--;\nif(j==0)\n\tprintf(\"1\");\nelse if (j%7==0)\n\tprintf(\"7\");\nelse \nprintf(\"%d\",j%7);\n\n\n\n}"}, {"source_code": "#include\n#include\n\nint main(){\n int tab[8];\n int i,j,n;\n scanf(\"%d\",&n);\n for(i=1;i<=7;i++)\n scanf(\"%d\",&tab[i]);\n while(n>=0){\n for(i=1;i<=7;i++){\n n-=tab[i];\n if(n<=0){\n printf(\"%d\",i);\n return 0;\n }\n }\n }\n\n}"}, {"source_code": "#include\nint main()\n{\n int n,i;\n scanf(\"%d\",&n);\n int a[7],total=0;\n for(i=0;i<7;i++)\n {\n scanf(\"%d\",&a[i]);\n total+=a[i];\n }\n int x;\n x=n/total;\n x=x*total;\n if(x=n) break;\n }\n printf(\"%d\",i+1);\n }\n else if(x==n)\n {\n x=n/total;\n x=(x-1)*total;\n for(i=0;i<7;i++)\n {\n x+=a[i];\n if(x>=n) break;\n }\n printf(\"%d\",i+1);\n }\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n,i,a[1001];\n scanf(\"%d\", &n);\n for(i=0;i<7;i++){\n scanf(\"%d\", &a[i]);\n }\n i=0;\n while(n>0){\n n=n-a[i];\n i++;\n if(i==7&& n>0){\n i=0;\n }\n }\n printf(\"%d\\n\",i);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,m,a,b,c,d;\n scanf(\"%d\",&n);\n int week[7]={0};\n for(a=0;a<7;a++)\n {\n scanf(\"%d\",&week[a]);\n }\n for(c=0;0\nint main()\n{\n\tint n,s[7],i;\n\tscanf(\"%d \\n\",&n);\n\tfor(i=0;i<7;i++)\n\t{\n\t\tscanf(\"%d \",&s[i]);\n\t}\n\tfor(i=0;i<7;i++)\n\t{\n\t\tn=n-s[i];\n\t\tif(n<0 || n==0)\n\t\t{\n\t\t\tprintf(\"%d \",i+1);\n\t\t\tbreak;\n\t\t}\n\t\tif(i==6 && n>0)\n\t\t{\n\t\t\ti=-1;\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\nint main() {\n\n\tint i,a[10000],su=0,n;\n\tscanf(\"%d\",&n);\n\tfor(i=0; i<7; i++)\n\t\t\tscanf(\"%d\",&a[i]);\n\tfor(i=0; i<7; i++)\n\t{\n\t\tsu+=a[i];\n\t\tif(su>=n)\n\t\t{\n\t\t\tprintf(\"%d\",i+1); return 0;\n\t\t}\n\t\tif(i==6)\n\t\t\ti=-1;\n\t}\n\n\t\n\n\n\n\n\n\nreturn 0;\n}\n"}, {"source_code": "#include \n\nint main(void)\n{\n int n, arr[7], i;\n\n scanf(\"%d\", &n);\n\n for (i = 0; i < 7; i++) {\n scanf(\"%d\", &arr[i]);\n }\n\n i = 0;\n while (n > 0) {\n n -= arr[i];\n i = (i + 1) % 7;\n }\n\n if (i == 0)\n printf(\"7\\n\");\n else\n printf(\"%d\\n\", i);\n\n return 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n int i,n,a[10],count=0,ans;\n scanf(\"%d\",&n);\n for(i=1;i<=7;i++)\n scanf(\"%d\",&a[i]);\n for(i=1;i<=7;i++)\n {\n n=n-a[i];\n if(n<=0) break;\n if(i==7)\n i=0;\n }\n printf(\"%d\",i);\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n\tint n,d;\n\tint a[7];\n\td=-1;\n\tscanf(\"%d\",&n);\n\tfor (int i = 0; i < 7; ++i)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\twhile(n>0)\n\t{\n\t\td=(d+1)%7;\n\t\tn=n-a[d];\n\t}\n\tprintf(\"%d\",d+1);\n}"}, {"source_code": "#include \n \nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint s[7];\n\tfor(int i=0; i<7; i++){\n\t\tscanf(\"%d\",&s[i]);\n\t}\n\t\n\tint sum=s[0],i=1;\n\twhile(sum\n#include\n#include\n\nint main(){\n\tint pages;\n\tint mo,tu,we,th,fr,sa,su;\n\tscanf(\"%d\",&pages);\n\tint day[8];\n\tfor(int i=0;i<7;i++){\n\t\tscanf(\"%d\",&day[i]);\n\t}\n\t\n\tint temp=1;\n\n\t\n\twhile(pages > 0){\n\t\tif(temp==8) temp=1;\n\t\t\n\t\tpages-=day[temp-1];\n\t\t\n\t\ttemp++;\t\n\t}\n\tprintf(\"%d\",temp-1);\n\t\n\treturn 0;\n}"}, {"source_code": "//SORU xx\n//PROGRAM C\n#include\n#include\n#include\n#include\n#include\n#include\n//#include\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 N,gun[10];\nvoid oku(){\n\tscn(N);\n\tint i;\n\tfor(i=1; i<=7; i++)\n\t\tscn(gun[i]);\n}\nvoid coz(){\n\tint yer=1,top=0;\n\twhile(1){\n\t\tif(N<=0) break;\n\t\ttop++;\n\t\tN-=gun[yer++];\n\t\tif(yer==8) yer=1;\n\t}\n\tif(top%7==0) fprintf(out,\"7\");\n\telse prn(top%7);\n}\nint main(){\n\tdosya();\n\toku();\n\tcoz();\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n { int n,sum=0;\n \n scanf(\"%d\",&n);\n int a[7];\n for(int i=0;i<7;i++)\n { scanf(\"%d\",&a[i]);\n sum+=a[i];\n // printf(\"%d \",sum);\n }\n sum=n%sum;\n if(sum)\n for(int i=0;i<7;i++)\n { sum-=a[i];\n // printf(\"hi %d %d \",a[i],sum);\n if(sum<=0)\n {printf(\"%d\\n\",i+1);\n break;}}\n else\n { for(int i=6;i>-1;i--)\n if(a[i])\n { printf(\"%d\",i+1); \n break;}}\n return 0;\n}/*\nint s=0,l=0,x; char a[10];\n for(int i=0;scanf(\"%c\",&a[i])!=EOF&&i<100;x++,i++)\n { printf(\"%c\",a[i]);\n if(a[i]<97&&a[i]>64)\n l++;\n else\n s++;}\n if(s\n\nint main(){\n\tint n,i;\n\tint a[8];\n\tint count=0;\n\tint day;\n\tscanf(\"%d\",&n);\n\tfor(i=1;i<=7;i++){\n\t\tscanf(\"%d\",a+i);\n\t\t//count+=a[i];\n\t}\n\twhile(n>0){\n\t\tfor(i=1;i<=7;i++){\n\t\t\tn-=a[i];\n\t\t\tif(n<=0)break;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",i);\n\treturn 0;\n}\n"}, {"source_code": "/*One Sunday Petr went to a bookshop and bought a new book on sports programming. The book had exactly n pages.\n\nPetr decided to start reading it starting from the next day, that is, from Monday. Petr's got a very tight schedule and for each day of the week he knows how many pages he will be able to read on that day. Some days are so busy that Petr will have no time to read whatsoever. However, we know that he will be able to read at least one page a week.\n\nAssuming that Petr will not skip days and will read as much as he can every day, determine on which day of the week he will read the last page of the book.\n\nInput\nThe first input line contains the single integer n (1<=n<=1000) the number of pages in the book.\n\nThe second line contains seven non-negative space-separated integers that do not exceed 1000 �� those integers represent how many pages Petr can read on Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday correspondingly. It is guaranteed that at least one of those numbers is larger than zero.\n\nOutput\nPrint a single number �� the number of the day of the week, when Petr will finish reading the book. The days of the week are numbered starting with one in the natural order: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday.\n\nExamples\ninput\n100\n15 20 20 15 10 30 45\noutput\n6\ninput\n2\n1 0 0 0 0 0 0\noutput\n1*/\n#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int pagenum[7];\n for(int i=0;i<7;i++)\n scanf(\"%d\",&pagenum[i]);\n int sum = 0,i;\n for(i=0;sum\nint main()\n{\n int n,i,ara[7];\n scanf(\"%d\", &n);\n\n for(i=0;i<7;i++)\n {\n scanf(\"%d\", &ara[i]);\n }\n int s =0;\n for(i=0;s\n#include\nint main ()\n{\n int n,i,a[8];\n scanf(\"%d\",&n);\n for(i=0;i<7;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n int s=0,t=0;\n while(s=n && a[i]!=0)\n {\n printf(\"%d\",i+1);\n break;\n }\n }\n }\n return 0;\n\n}"}, {"source_code": "#include\nint main()\n{\n\tint n,arr[7],cnt=0,book_pg=0,i=0;\n\tscanf(\"%d\",&n);\n\tfor(i=1;i<=7;i++)\n\t\tscanf(\"%d\",&arr[i]);\n\tfor(i=1;i<8;i++)\n\t{\n\t\tbook_pg=book_pg+arr[i];\n\t//\tprintf(\"%d\",book_pg);\n\t\tcnt++;\n\t\tif(book_pg>=n)\n\t\tbreak;\n\t\t\n\t\t\n\t\tif(i==7)\n\t\t{\n\t\t\n\t\ti=0;\n\t\tcontinue;\n\t\t}\n\t\t\n\t//\tprintf(\"%d\\n\",i);\n\t}\n\tprintf(\"\\n%d\",i);\n\treturn 0;\t\t\n\t\n\t\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n,i;\n scanf(\"%d\", &n);\n int a[n];\n for(i=1;i<=7;i++){\n scanf(\" %d\",&a[i]);\n }\n\n\n while(n>0){\n if(n<=a[1]){\n printf(\"1\");\n break;\n }else{\n n-=a[1];\n }\n if(n<=a[2]){\n printf(\"2\");\n break;\n }else{\n n-=a[2];\n }\n if(n<=a[3]){\n printf(\"3\");\n break;\n }else{\n n-=a[3];\n }\n if(n<=a[4]){\n printf(\"4\");\n break;\n }else{\n n-=a[4];\n }\n if(n<=a[5]){\n printf(\"5\");\n break;\n }else{\n n-=a[5];\n }\n if(n<=a[6]){\n printf(\"6\");\n break;\n }else{\n n-=a[6];\n }\n if(n<=a[7]){\n printf(\"7\");\n break;\n }else{\n n-=a[7];\n }\n\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n\n#define REP(i, a, b) for((i) = (a) ; i < (b) ; i++)\n\nint n, arr[15];\n\n\nint main() {\n//\tfreopen(\"input.in\", \"r\", stdin);\n\tint n, i;\n\tscanf(\"%d\", &n);\n\tREP(i, 0, 7) scanf(\"%d\", &arr[i]);\n\tint sum = 0;\n\ti = 0;\n\twhile(1) {\n\t\tsum += arr[i];\n\t\tif(sum >= n) break;\n\t\ti++;\n\t\ti%=7;\n\t}\n\tprintf(\"%d\", i+1);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n\tint i, n;\n\tstatic int a[7];\n\n\tscanf(\"%d\", &n);\n\tfor (i = 0; i < 7; i++)\n\t\tscanf(\"%d\", &a[i]);\n\tfor (i = 0; ; i = (i + 1) % 7) {\n\t\tn -= a[i % 7];\n\t\tif (n <= 0) {\n\t\t\tprintf(\"%d\\n\", i + 1);\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tint pages, i;\n\tint A[10];\n\tscanf(\"%d\", &pages);\n\n\tfor (i = 1; i <= 7; i++)\n\t\tscanf(\"%d\", &A[i]);\n\tA[0] = A[7];\n\tfor (i = 1;; i++)\n\t{\n\t\tpages -= A[i % 7];\n\t\tif (pages <= 0)\n\t\t\tbreak;\n\t}\n\n\ti %= 7;\n\tif (!i)\n\t\ti = 7;\n\tprintf(\"%d\", i);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint number,i,j=0,array[7],sum=0,count=0;\n\tscanf(\"%d\",&number);\n\tfor(i=0;i<7;i++)\n\t{\n\t\tscanf(\"%d\",&array[i]);\n\t\tsum=sum+array[i];\n\t}\n\t\n\nif (number%sum==0)\n{\n\t\n\twhile(number)\n\t{\n\t\tfor (i = 0; i < 7; i++)\n\t\t{\n\t\t\tif(number>0)\n\t\t\t{\n\t\t\t\tnumber=number-array[i];\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tj++;\n\t}\n}\nelse\n{\tnumber=number%sum;\n\tj=1;\n\tfor (i = 0; i < 7; i++)\n\t{\n\t\tif(number>0)\n\t\t{\n\t\t\tnumber=number-array[i];\n\t\t\tcount++;\n\t\t}\n\t}\n}\n\tprintf(\"%d\",count-((j-1)*7));\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n long long int n,a[8],i,s=0,q,k,d=0;\n scanf(\"%lld\",&n);\n for(i=1;i<=7;i++)\n {scanf(\"%lld\",&a[i]);\n s=s+a[i];\n }\n k=s;\n if(s>n)\n {s=0;\n i=0;\n while(s\nint main()\n{\n int n, ara[7], i;\n scanf(\"%d\", &n);\n for(i = 0; i <7; i++){\n scanf(\"%d\", &ara[i]);\n }\n i = 0;\n while(n>0){\n n = n -ara[i];\n i = i + 1;\n if(i==7){\n i = 0;\n }\n }\n if(i == 0){\n printf(\"7\");\n return 0;\n }\n printf(\"%d\", i);\n return 0;\n}\n"}, {"source_code": "#include\nmain()\n{\n int n;\n scanf(\"%d\",&n);\n int a[7],i,j;\n for(i=0;i<7;i++)\n scanf(\"%d\",&a[i]);\n for(j=0;j<7;j++)\n {\n n-=a[j];\n if(n==0||n<0)\n {\n printf(\"%d\",j+1);\n break;\n }\n if(j==6&&n>0)\n j=-1;\n }\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int n,i,j,remainder,sum=0,loop,page[105];\n\n scanf(\"%d\",&n);\n\n for(i=1;i<=7;i++)\n {\n scanf(\"%d\",&page[i]);\n }\n\n loop:for(i=1;i<=7;i++)\n {\n\n sum=sum+page[i];\n if(sum>=n)\n {\n break;\n }\n }\n if(sum\n#include\n#include\n#include\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,d,x,m,l,max,sum2,min,f,c,r,o,sum1,sum=0,y,a[10000]={0},b;\n\nscanf(\"%lld\",&n);\n sum=0;\nfor(i=0;i<=6;i++){\n \n scanf(\"%lld\",&a[i]);\n sum+=a[i];\n}\nn=n%sum;\nif(n==0){\n n=sum;\n}\n\n\ni=0;\nwhile(n>0){\n n-=a[i];\n i++;\n \n}\n\nprintf(\"%lld\",i);\n \n\n\nreturn 0;\n}\n"}, {"source_code": "#include\nint get_lcm(int x,int y);\nint main(){\nint n,i,sum;\nsum=0;\nint day_pages[7];\nscanf(\"%d\",&n);\nfor(i=0;i<7;i++){\n scanf(\"%d\",&day_pages[i]);\n}\nbegin:\nfor(i=0;i<7;i++){\n sum+= day_pages[i];\n if (!(sum\nint main ()\n{\n int n,i,j,count=0;\n scanf(\"%d\",&n);\n int array[7];\n for(i=0;i<7;i++)\n\n {\n scanf(\"%d\",&array[i]);\n }\n for(i=0;;i++){\n\n\n count=count+array[i];\n\n\n if(count>=n)\n {\n i++;\n\n break;\n }\n\n\n\n }\n\n if(i<7)\n printf(\"%d\",i);\n else\n printf(\"%d\",(i%7));\n\n\n}\n"}, {"source_code": "#include \nint main()\n{\n\tint n, i;\n\tint days[7];\n\tscanf(\"%d\", &n);\n\tfor(i=0; i<7; i++)\n\t{\n\t\tscanf(\"%d\", &days[i]);\n\t\tn-=days[i];\n\t\tif(n<=0)\n\t\t\tbreak;\n\t}\n\twhile(n>0)\n\t{\n\t\tif(i<7)\n i++;\n else\n i = 0;\n\t\tn-=days[i];\n\t}\n\t//printf(\"%d\\n\", (n==0) ? i : i+1);\n\tprintf(\"%d\\n\", i+1);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int i, p, k, arr[7], brr[7];\n scanf(\"%d\", &p);\n for(i=0; i<7; i++)\n {\n scanf(\"%d\", &arr[i]);\n }\n brr[0]=arr[0];\n for(i=1; i<7; i++)\n {\n brr[i]=brr[i-1]+arr[i];\n }\n /*for(i=0; i<7; i++)\n {\n printf(\"%d \", brr[i]);\n }*/\n //k=p-brr[6];\n int flag;\n if(p>brr[6])\n {\n //printf(\"aaaaaa\\n\");\n p=p%brr[6];\n if(brr[0]>=p)\n {\n printf(\"1\");\n return 0;\n }\n \n for(i=0; i<7; i++)\n {\n if(brr[i]

p)\n {\n flag=0;\n break;\n }\n else if(brr[i]==p)\n {\n flag=1;\n break;\n }\n }\n }\n else\n {\n // printf(\"bbbbb\\n\");\n if(brr[0]>=p)\n {\n printf(\"1\");\n return 0;\n }\n for(i=0; i<7; i++)\n {\n if(brr[i]

p)\n {\n flag=0;\n //printf(\"%d \", i);\n break;\n }\n else if(brr[i]==p)\n {\n flag=1;\n break;\n }\n }\n }\n \n if(flag==0)\n printf(\"%d\", (i+2));\n else \n printf(\"%d\", i+1);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main(void)\n{\n\tint n,a[10],i,s=0,dif;\n\tscanf(\"%d\",&n);\n\tfor(i=1;i<8;i++) {\n\t\tscanf(\"%d\",&a[i]);\n\t\ts+=a[i];\n\t}\n\tdif=n%s;\n\tif(dif==0) {\n\t\tfor(i=7;i>0;i--) {\n\t\t\tif(a[i]!=0)\n\t\t\t\tprintf(\"%d\",i);\n\t\t}\n\t}\n\telse {\n\t\tif(dif\nint main()\n{\n int n,w[100],i,sum=0,j=0;\n scanf(\"%d\",&n);\n for(i=1;i<=7;i++) scanf(\"%d\",&w[i]);\n while(sum7) j=0;\n j++;\n sum=sum+w[j];\n printf(\"%d\\n\",sum);\n }\n printf(\"%d\",j);\n return 0;\n}\n\n"}, {"source_code": "#include\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int sum=n;\n int i;\n\n int a[7];\n\n for(i=0;i<7;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n i=0;\n while(1)\n {\n sum=sum-a[i];\n if(sum<=0)\n {\n printf(\"%d\",i+1);\n return 0;\n }\n i++;\n if(i==6) i=0;\n\n\n }\n}\n"}, {"source_code": "#include\nint s(int x[], int y);\nint sum=0;\nint main()\n{\nint n, i, day[1000], z;\nscanf(\"%d\", &n);\nfor(i=1; i<=n;i++)\n scanf(\"%d\", &day[i]);\nz= s(day, n); \nprintf(\"%d\\n\", z);\n\nreturn 0;\n}\n\nint s(int x[], int y)\n{\nint i, n=y;\nfor(i=1; i<=n;i++)\n{\n sum+= x[i]; \n if(sum>=n)\n return(i);\n}\nif(i=(n+1) && sum< n)\n s(x, n); \n}"}, {"source_code": "#include\nint main()\n{\nint n,i=0,a[7],sum=0;\nscanf(\"%d\",&n);\nfor(i=0;i<7;i++)\nscanf(\"%d\",&a[i]);\ni=0;\nwhile(sum=7)\ni=i-7;\n}\nprintf(\"%d\",i);\nreturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n long a[7],m,sum=0,count=0,i;\n scanf(\"%ld\",&m);\n for(i=0;i<7;i++)\n scanf(\"%ld\",&a[i]);\n for(;;){\n for(i=0;i<7;i++)\n {\n sum+=a[i];\n if(sum<=m)\n count++;\n else\n break;\n\n }if(sum>m)\n {printf(\"%ld\",count+1);\n break;}\n else\n {m=m-sum;\n sum=0;\n count=0;}\n\n }\n}"}, {"source_code": "#include \nint main()\n{\nint n,a[7],b=0;\nscanf(\"%d\",&n);\nfor(int i=0;i<7;++i) \n{\nscanf(\"%d\",&a[i]);\nb+=a[i];\n}\nn%=b;\nif(n==0)\n{\nprintf(\"7\");\nreturn 0;\n}\nfor(int i=0;i<7;++i)\n{\nn-=a[i];\nif(n<=0)\n{\nprintf(\"%d\",i+1);\nreturn 0;\n}\n}\n}"}, {"source_code": "#include\nint main()\n{\n\tint t;\n\tscanf(\"%d\",&t);\n\twhile(t--)\n\t{\n\t\tint p,w1,w2,w3,w4,w5,w6,w7;\n\t\tscanf(\"%d\",&p);\n\t\tscanf(\"\\n%d %d %d %d %d %d %d\",&w1,&w2,&w3,&w4,&w5,&w6,&w7);\n\t\twhile(p>0)\n\t\t{\n\t\t\tif(p-w1<=0)\n\t\t\t{printf(\"1\");}\n\t\t\telse if(p-w1-w2<=0)\n\t\t\t{printf(\"2\");}\n\t\t\telse if(p-w1-w2-w3<=0)\n\t\t {printf(\"3\");}\n\t\t\telse if(p-w1-w2-w3-w4<=0)\n\t\t\t{printf(\"4\");}\n\t\t\telse if(p-w1-w2-w3-w4-w5<=0)\n\t\t {printf(\"5\");}\n\t\t\telse if(p-w1-w2-w3-w4-w5-w6<=0)\n\t\t\t{printf(\"6\");}\n\t\t\telse if(p-w1-w2-w3-w4-w5-w6-w7<=0)\n\t {printf(\"7\");}\n\t p=p-w1-w2-w3-w4-w5-w6-w7;\n\t \n\t }\n\t}\n\treturn 0;\n\t\t\t\n}"}, {"source_code": "#include \nint main()\n{\n int i, x, a[7], y = 0, count = 0;\n scanf(\"%d\", &x);\n for(i = 0; i<7; i++) {\n scanf(\"%d\", &a[i]);\n }\n while(y < x) {\n y = y + a[count];\n count++;\n }\n if(count%7 == 0) {\n y = 7;\n }\n else {\n y = count%7;\n }\n printf(\"%d\", y);\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,s[7],i;\n\tscanf(\"%d \\n\",&n);\n\tfor(i=0;i<7;i++)\n\t{\n\t\tscanf(\"%d \",&s[i]);\n\t}\n\tfor(i=0;i\n#include\nint main()\n{\n int n,i=0;\n scanf(\"%d\",&n);\n int a[7],s=0;\n for(int i=0;i<7;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n while(i>=0)\n {\n s+=a[i];\n if(s>=n && i<7)\n {\n printf(\"%d\",i+1);\n break;\n }\n else if(s>=n && i>=7)\n {\n printf(\"%d\",((i%7)+1));\n break;\n }\n i++;\n }\n return 0;\n}"}, {"source_code": "#include\nint main ()\n{\n int n,i,j,count=0;\n scanf(\"%d\",&n);\n int array[7];\n for(i=0;i<7;i++)\n\n {\n scanf(\"%d\",&array[i]);\n }\n for(i=0;;i++){\n\n\n count=count+array[i];\n\n\n if(count>=n)\n {\n i++;\n\n break;\n }\n\n\n\n }\n\n if(i<7)\n printf(\"%d\",i);\n else\n printf(\"%d\",(i%7));\n\n\n}\n"}, {"source_code": "//In the name of God\n\n#include \n\nint main()\n{\n\tint b;\n\tscanf(\"%d\",&b);\n\tint a[10],i,n=7;\n\tfor(i=1;i<=n;i++)\n\t\tscanf(\"%d\",&a[i]);\n\tint c=b,cn=0;\n\tfor(i=1;c>0;i++)\n\t{\n\t\tif(i==8)\n\t\t\ti=1;\n\t\tc=c-a[i];\n\t\tcn++;\n\t}\n\tif(cn%8==7)\n\t\tprintf(\"7\\n\");\n\telse\n\t\tprintf(\"%d\\n\",(cn%7));\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tint days[7], j, sum = 0;\n\tfor (j = 0; j < 7; j++)\n\t{\n\t\tscanf(\"%d\", &days[j]);\n\t\tsum += days[j];\n\t}\n\tn %= sum;\n\tif (!n)\n\t{\n\t\tprintf(\"7\");\n\t\treturn 0;\n\t}\n\tfor (j = 0; j < 7; j++)\n\t{\n\t\tif (!days[j])\n\t\t\tcontinue;\n\t\tif (n > 0)\n\t\t\tn -= days[j];\n\t\tif (n <= 0)\n\t\t\tbreak;\n\t}\n\tprintf(\"%d\\n\", j + 1);\n}\n"}, {"source_code": "#include\n#include\nint main()\n{ int n,i,s=0;\n scanf(\"%d\",&n);\n int a[7];\n for(i=0;i<7;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<7;i++)\n {\n s=s+a[i];\n if(s>n)\n {\n printf(\"%d\",i+1);\n return 0;\n }\n }\n\n if(s=0;i--)\n {\n if(a[i]==0)\n {\n continue;\n }\n else\n {\n printf(\"%d\",i+1);\n return 0;\n }\n }\n }\nreturn 0;\n }\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int i, page, day=0, count=0;\n int arr[7];\n scanf(\"%d\", &page);\n for(i=0; i<7; i++)scanf(\"%d\", &arr[i]);\n i=0;\n while(count7){\n if(day/8 == 7) day--;\n day%=8;\n day++;\n }\n printf(\"%d\\n\", day);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tint days[7], j, sum = 0;\n\tfor (j = 0; j < 7; j++)\n\t{\n\t\tscanf(\"%d\", &days[j]);\n\t\tsum += days[j];\n\t}\n\tn %= sum;\n\tfor (j = 0; j < 7; j++)\n\t{\n\t\tif (!days[j])\n\t\t\tcontinue;\n\t\tif (n > 0)\n\t\t\tn -= days[j];\n\t\tif(n <= 0)\n\t\t\tbreak;\n\t}\n\tprintf(\"%d\\n\", j + 1);\n}\n"}, {"source_code": "#include \n#include\n#include\n#include\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,d,x,m,l,max,sum2,min,f,c,r,o,sum1,sum=0,y,a[10000]={0},b;\n\nscanf(\"%lld\",&n);\n sum=0;\nfor(i=0;i<=6;i++){\n \n scanf(\"%lld\",&a[i]);\n sum+=a[i];\n}\nif(sum>1){\nn=n%sum;\n}\ni=0;\nwhile(n>0){\n n-=a[i];\n i++;\n // printf(\"%lld \",n);\n if(i==7){\n i=0;\n }\n}\nprintf(\"%lld\",i);\n \n\n\nreturn 0;\n}\n"}, {"source_code": "#include \n#include \n//#include \nint main()\n{\n int n,s=0,i,f=0,ans=0;\n int a[8];\n scanf(\"%d\",&n);\n for(i=0;i<7;i++)\n {\n scanf(\"%d\",&a[i]);\n s=s+a[i];\n // printf(\"s=%d\\n\",s);\n if(s>=n && f==0)\n {\n f=1;\n ans=i;\n }\n }\n i=ans;\n if(ans==0)\n {\n\n\n n=n%s;\n s=0;\n for(i=0;i<7;i++)\n {\n s=s+a[i];\n if(s>=n)\n break;\n }\n }\n printf(\"%d\",i+1);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n\tint n, a[7], i, j, s=0;\n\tscanf(\"%d\", &n);\n\tfor(i=0; i<7; i++)\n\t{\n\t\tscanf(\"%d\", &a[i]);\n\t\ts = s + a[i];\n\t}\n\tj = n%s;\n\tfor(i=0; i<7; i++)\n\t{\t\n\t\tif(j==0)\n\t\t{\n\t\t\tj=n;\n\t\t\tif(j<=a[i])\n\t\t { printf(\"%d\", i+1);\n\t\t\t break;\n\t\t }\n\t\t else\n\t\t j = j - a[i];\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(j<=a[i])\n\t\t{\n\t\t\tprintf(\"%d\", i+1);\n\t\t\tbreak;\n\t\t}\n\t\telse\n\t\tj = j - a[i];\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \nint main()\n{\n int n, i;\n scanf(\"%d\", &n);\n int arr[7];\n for(i=0; i<7 ; i++)\n {\n scanf(\"%d\", &arr[i]);\n }\n int total = 0;\n i=0;\n while(total < n)\n {\n total += arr[i];\n if(i==6) i=0;\n else ++i;\n }\n\n printf(\"%d\\n\", i);\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,i,a[7],c1=-1;\n scanf(\"%d\",&n);\n for(i=0;i<7;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n while(n!=0)\n {\n for(i=0;i<7;i++)\n {\n n=n-a[i];\n if(n<=0)\n {\n c1=i;\n break;\n }\n }\n if(c1>0)\n break;\n }\n printf(\"%d\\n\",c1+1);\n}"}, {"source_code": "#include\nint main()\n{\n int n,i;\n scanf(\"%d\",&n);\n int myarray[7];\n int total=0,flag=0;\n for(i=0; i<7; i++)\n {\n scanf(\"%d\",&myarray[i]);\n }\n for(i=0; i<7; i++)\n {\n total+=myarray[i];\n flag++;\n if(flag==7)\n {\n flag=0;\n }\n if(total>=n) break;\n\n\n }\n printf(\"%d\",flag);\n return 0;\n\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,s[7],i;\n\tscanf(\"%d \\n\",&n);\n\tfor(i=0;i<7;i++)\n\t{\n\t\tscanf(\"%d \",&s[i]);\n\t}\n\tfor(i=0;i\nint main()\n{\n int n, i;\n scanf(\"%d\", &n);\n int a[7];\n for(i=0; i<7; i++)\n {\n scanf(\"%d\", &a[i]);\n }\n for(i=0; 1 ;i++)\n {\n if(i==7)\n i=0;\n if(n<=0)\n {\n if(i==0)\n printf(\"1\");\n else\n printf(\"%d\", i);\n break;\n }\n n=n-a[i];\n }\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int i,x,n,a[1001];\n scanf(\"%d\",&n);\n for(i=0;i<7;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(;x>=0;)\n {\n for(i=0;i<7;i++)\n {\n x=n-a[i];\n n=x;\n if(x<=0)\n break;\n\n\n }\n }\n\n printf(\"%d\",i+1);\n}\n"}, {"source_code": "#include\nint main()\n{\n int a[7],n,i=-1;\n scanf(\"%d\",&n);\n for(i=0;i<7;i++)\n scanf(\"%d\",&a[i]);\n i=-1;\n while(n>=0)\n {\n i++;\n if(i==7)\n i=0;\n if(a[i]==0)\n {\n continue;\n }\n n=n-a[i];\n }\n printf(\"%d\",i);\n return 0;\n \n \n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int arr[7];\n int i;\n for(i=0;i<7;i++){\n scanf(\"%d\",&arr[i]);\n }\n i=0;\n while (n>0){\n n-=arr[i];\n i++;\n if(i==7)\n i=0;\n }\n printf(\"%d\",i);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a[7];\n int i;\n for (i=0;i<7;i++){\n scanf(\"%d\",&a[i]);\n }\n i=0;\n while (n>0){\n n=n-a[i%7];\n i++;\n }\n printf(\"%d\",i%7);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,s[7],i;\n\tscanf(\"%d \\n\",&n);\n\tfor(i=0;i<7;i++)\n\t{\n\t\tscanf(\"%d \",&s[i]);\n\t}\n\tfor(i=0;i\nint main(){\n int totpag=0,lu=0,ma=0,mi=0,ju=0,vi=0,sa=0,dom=0,dia=1;\n scanf(\"%d\",&totpag); \n scanf(\"%d%d%d%d%d%d%d\",&lu,&ma,&mi,&ju,&vi,&sa,&dom);\n do{\n if((dia%7)+1==1) totpag=totpag-lu;\n else if((dia%7)+1==2) totpag=totpag-ma;\n else if((dia%7)+1==3) totpag=totpag-mi;\n else if((dia%7)+1==4) totpag=totpag-ju;\n else if((dia%7)+1==5) totpag=totpag-vi;\n else if((dia%7)+1==6) totpag=totpag-sa;\n else if((dia%7)+1==7) totpag=totpag-dom;\n dia++; \n if (dia==8){ dia=1;}\n }while(totpag>1);\n if(totpag<=0){\n dia--;}\n printf(\"%d\",dia);\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int day[7];\n int i;\n int sum=0;\n int flag=0;\n int c=0;\n int sve;\n for(i=0;i<7;i++){\n scanf(\"%d\",&day[i]);\n sum=sum+day[i];\n if(flag==0 && sum>=n){\n flag=1;\n sve=i;\n }\n if(day[i]==0){\n c=c+1;\n }\n }\n if(flag==1){\n printf(\"%d\",sve+1);\n }\n if(flag==0){\n printf(\"%d\",7-c);\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int i, p, k, arr[7], brr[7];\n scanf(\"%d\", &p);\n for(i=0; i<7; i++)\n {\n scanf(\"%d\", &arr[i]);\n }\n brr[0]=arr[0];\n for(i=1; i<7; i++)\n {\n brr[i]=brr[i-1]+arr[i];\n }\n /*for(i=0; i<7; i++)\n {\n printf(\"%d \", brr[i]);\n }*/\n //k=p-brr[6];\n int flag;\n if(p>brr[6])\n {\n //printf(\"aaaaaa\\n\");\n while(p>brr[6])\n {\n p-=brr[6];\n }\n if(brr[0]>=p)\n {\n printf(\"1\");\n return 0;\n }\n \n for(i=0; i<7; i++)\n {\n if(brr[i]

p)\n flag=0;\n else if(brr[i]==p)\n {\n flag=1;\n break;\n }\n }\n }\n else\n {\n // printf(\"bbbbb\\n\");\n if(brr[0]>=p)\n {\n printf(\"1\");\n return 0;\n }\n for(i=0; i<7; i++)\n {\n if(brr[i]

p)\n {\n flag=0;\n //printf(\"%d \", i);\n break;\n }\n else if(brr[i]==p)\n {\n flag=1;\n break;\n }\n }\n }\n \n if(flag==0)\n printf(\"%d\", (i+2));\n else \n printf(\"%d\", i+1);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int i, p, k, arr[7], brr, sum=0, f=0;\n scanf(\"%d\", &p);\n for(i=0; i<7; i++)\n {\n scanf(\"%d\", &arr[i]);\n sum+=arr[i];\n }\n \n if(p<=sum)\n {\n for(i=0; i<7; i++)\n {\n f+=arr[i];\n if(f>=p)\n break;\n }\n }\n else\n {\n k=p%sum;\n for(i=0; i<7; i++)\n {\n f+=arr[i];\n if(f>=k)\n break;\n }\n }\n printf(\"%d\", i+1);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int i,k,a[8],sum=0,c=0;\n scanf(\"%d\",&k);\n for(i=0;i<7;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<1000;i++)\n {\n if(c==0){i=0;}\n sum=sum+a[i];\n c++;\n if(c==7)\n {\n c=0;\n }\n if(sum>=k)\n {\n printf(\"%d\",c);\n break;\n }\n }\n}\n"}, {"source_code": "#include\nint main(){\n\tint n;\n\tint a[8];\n\tscanf(\"%d\",&n);\n\tint i,sum=0,ans=0;\n\tfor(i=0;i<7;i++){\n\t\tscanf(\"%d\",&a[i+1]);\n\t\tsum=sum+a[i+1];\n\t}\n//\tprintf(\"sum=%d\\n\",sum);\n\twhile(1){\n\t\tif(n>sum)\n\t\t\tn=n-sum;\n\t\telse if(n==sum){\n\t\t\tans=1;\n\t\t\tbreak;\n\t\t}\n\t\telse {\n\t\t\tfor(i=1;i<=7;i++){\n\t\t\t\tn=n-a[i];\n//\t\t\t\tprintf(\"n=%d\\n\",n);\n\t\t\t\tif(n<=0){\n\t\t\t\t\tans=i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(ans!=0)\n\t\t\tbreak;\n\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,s[7],i;\n\tscanf(\"%d \\n\",&n);\n\tfor(i=0;i<7;i++)\n\t{\n\t\tscanf(\"%d \",&s[i]);\n\t}\n\tfor(i=0;i\nint main()\n{\n\tint n,s[7],i;\n\tscanf(\"%d \\n\",&n);\n\tfor(i=0;i<7;i++)\n\t{\n\t\tscanf(\"%d \",&s[i]);\n\t}\n\tfor(i=0;i= remain) {\n day = i + 1;\n break;\n }\n }\n\n printf(\"%d\\n\", day);\n return 0;\n}\n\n/*\n\n50\n1 2 3 4 3 2 3 = 18\n50/18 = 2\n50-18(50/18)\n\n*/\n"}, {"source_code": "#include\nint main()\n{\n int week,cnt;\n int i,n;\n int a[8];\n scanf(\"%d\",&n);\n week=0;\n for(cnt=1;cnt<=7;cnt++)\n scanf(\"%d\",&a[cnt]);\n\n i=1;\n while(n>=0){\n if(i==8) i=1;\n n-=a[i];\n i++;\n }\n printf(\"%d\\n\",i-1);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n, mon, tue, wed, thur, fri, sat, sun, sum=0, count=0, i;\n scanf(\"%d %d %d %d %d %d %d %d\", &n, &mon, &tue, &wed, &thur, &fri, &sat, &sun);\n\n for(i=0; 1; i++)\n {\n sum = sum+mon;\n count++;\n if(sum>=n && i==0)\n {\n printf(\"1\");\n break;\n }\n else if(sum>=n)break;\n else\n {\n sum = sum+tue;\n count++;\n if(sum>=n && i==0)\n {\n printf(\"2\");\n break;\n }\n else if(sum>=n)break;\n else\n {\n sum = sum+wed;\n count++;\n if(sum>=n && i==0)\n {\n printf(\"3\");\n break;\n }\n\n else if(sum>=n)break;\n else\n {\n sum = sum+thur;\n count++;\n if(sum>=n && i==0)\n {\n printf(\"4\");\n break;\n }\n else if(sum>=n)break;\n else\n {\n sum = sum+fri;\n count++;\n if(sum>=n && i==0)\n {\n printf(\"5\");\n break;\n }\n else if(sum>=n)break;\n else\n {\n sum = sum+sat;\n count++;\n if(sum>=n && i==0)\n {\n printf(\"6\");\n break;\n }\n else if(sum>=n)break;\n else\n {\n sum = sum+sun;\n count++;\n if(sum>=n && i==0)\n {\n printf(\"7\");\n break;\n }\n else if(sum>=n)break;\n }\n }\n }\n }\n }\n }\n }\n if(i!=0 && count%7 !=0)printf(\"%d\", count%7);\n else printf(\"7\");\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tint days[7], j, sum = 0;\n\tfor (j = 0; j < 7; j++)\n\t{\n\t\tscanf(\"%d\", &days[j]);\n\t\tsum += days[j];\n\t}\n\tn %= sum;\n\tif (!n)\n\t{\n\t\tprintf(\"7\");\n\t\treturn 0;\n\t}\n\tfor (j = 0; j < 7; j++)\n\t{\n\t\tif (!days[j])\n\t\t\tcontinue;\n\t\tif (n > 0)\n\t\t\tn -= days[j];\n\t\tif (n <= 0)\n\t\t\tbreak;\n\t}\n\tprintf(\"%d\\n\", j + 1);\n}\n"}, {"source_code": "#include \nint main()\n{\n\tint n,i,sum=0,j=1;\n\tscanf(\"%d\",&n);\n\tint a[n+1];\n\tfor(i=1;i=n)\n\t\t\t{\n\t\t\t\tprintf(\"%d\",j);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tj++;\n\t\t\tif(j>n)\n\t\t\t\tj=1;\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n int n,sum=0,p=0;\n scanf(\"%d\",&n);\n int ar[7];\n for(int i=0;i<7;i++)\n {\n scanf(\"%d\",&ar[i]);\n sum+=ar[i];\n }\n if(n>sum)\n {\n n-=(n/sum)*sum;\n for(int i=0;i<7;i++)\n {\n if(ar[i]>=n&&ar[i]!=0)\n {\n p=i;\n break;\n }\n else\n n-=ar[i];\n }\n printf(\"%d\",p+1);\n }\n else\n {\n for(int i=0;i<7;i++)\n {\n if(ar[i]>=n)\n {\n p=i;\n break;\n }\n else\n n-=ar[i];\n }\n printf(\"%d\",p+1);\n \n }\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,i,sum=0,l=0,x,y,z;\n int p[8];\n scanf(\"%d\",&n);\n for(i=1;i<=7;i++)\n {\n scanf(\"%d\",&p[i]);\n sum=p[i]+sum;\n \n }\n x=n/sum;\n y=x*sum;\n z=n-y;\n for(i=1;i<=7;i++)\n {\n l=p[i]+l;\n if(l>=z)\n {\n break;\n }\n }\n printf(\"%d\\n\",i);\n return 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n,i;\n scanf(\"%d\", &n);\n int a[n];\n for(i=1;i<=7;i++){\n scanf(\" %d\",&a[i]);\n }\n for(i=1;i<=7;i++){\n printf(\"%d \", a[i]);\n }\n printf(\"\\n\");\n while(n>0){\n if(n<=a[1]){\n printf(\"1\");\n break;\n }else{\n n-=a[1];\n }\n if(n<=a[2]){\n printf(\"2\");\n break;\n }else{\n n-=a[2];\n }\n if(n<=a[3]){\n printf(\"3\");\n break;\n }else{\n n-=a[3];\n }\n if(n<=a[4]){\n printf(\"4\");\n break;\n }else{\n n-=a[4];\n }\n if(n<=a[5]){\n printf(\"5\");\n break;\n }else{\n n-=a[5];\n }\n if(n<=a[6]){\n printf(\"6\");\n break;\n }else{\n n-=a[6];\n }\n if(n<=a[7]){\n printf(\"7\");\n break;\n }else{\n n-=a[7];\n }\n\n }\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n, mon, tue, wed, thur, fri, sat, sun, sum=0, count=0, i;\n scanf(\"%d %d %d %d %d %d %d %d\", &n, &mon, &tue, &wed, &thur, &fri, &sat, &sun);\n\n if(mon==0)mon = 1;\n if(tue==0)tue = 1;\n if(wed==0)wed = 1;\n if(thur==0)thur = 1;\n if(fri==0)fri = 1;\n if(sat==0)sat = 1;\n if(sun==0)sun = 1;\n\n for(i=0; 1; i++)\n {\n sum = sum + mon;\n if(sum>=n)break;\n count++;\n }\n printf(\"%d\", count);\n\n}\n"}, {"source_code": "#include\nint s(int x[], int y);\nint sum=0;\nint main()\n{\nint n, i, day[1000], z;\nscanf(\"%d\", &n);\nfor(i=1; i<=n;i++)\n scanf(\"%d\", &day[i]);\nz= s(day, n); \nprintf(\"%d\\n\", z);\n\nreturn 0;\n}\n\nint s(int x[], int y)\n{\nint i, n=y;\nfor(i=1; i<=n;i++)\n{\n sum+= x[i]; \n if(sum>=n)\n return(i);\n}\nif(i=(n+1) && sum< n)\n s(x, n); \n}"}, {"source_code": "// C program for insertion sort\n#include \n#include \n#include\n#include\nint maxi(int n,int m)\n{\n return n>m?n:m;\n}\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 /* create temp arrays */\n int L[n1], R[n2];\n\n /* Copy data to temp arrays L[] and R[] */\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 /* Merge the temp arrays back into arr[l..r]*/\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\n /* Copy the remaining elements of L[], if there are any */\n while (i < n1)\n {\n arr[k] = L[i];\n i++;\n k++;\n }\n\n /* Copy the remaining elements of R[], if there are any */\n while (j < n2)\n {\n arr[k] = R[j];\n j++;\n k++;\n }\n}\n\n/* l is for left index and r is right index of the sub-array\n of arr to be sorted */\nvoid mergeSort(int arr[], int l, int r)\n{\n if (l < r)\n {\n int m = l+(r-l)/2; //Same as (l+r)/2, but avoids overflow for large l and h\n mergeSort(arr, l, m);\n mergeSort(arr, m+1, r);\n merge(arr, l, m, r);\n }\n}\n\nint main()\n {\n int i=0,j=0,n,m,x,y,z,r,sum=0,arr[8],x1,x2,y1,y2;\n scanf(\"%d\",&n);\n for(i=0;i<7;i++)\n {\n scanf(\"%d\",&arr[i]);\n sum+=arr[i];\n }\n n=n%sum;\n if(n==0)\n printf(\"%d\",i);\n else\n {i=0;\n for(i=0;i<7;i++)\n {\n n=n-arr[i];\n if(n<=0)\n break;\n }\n\n printf(\"%d\",i+1);\n } return 0;\n }\n"}, {"source_code": "#include \n\nint arr[7];\n\nint main()\n{\n int n, i, sum = 0, count = 0;\n scanf(\"%d\", &n);\n\n for(i=0; i<7; i++){\n scanf(\"%d\", &arr[i]);\n sum = sum + arr[i];\n }\n\n n = n % sum;\n for(i=0; i<7; i++){\n count = count + arr[i];\n if(count >= n){\n printf(\"%d\", i + 1);\n return 0;\n }\n }\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int i, page, day=0, count=0;\n int arr[7];\n scanf(\"%d\", &page);\n for(i=0; i<7; i++)scanf(\"%d\", &arr[i]);\n i=0;\n while(count7){\n if(day/8 == 7) day--;\n day%=8;\n day++;\n }\n printf(\"%d\\n\", day);\n return 0;\n}\n"}, {"source_code": "#include\nint main ()\n{\n\tint arr[1010], i, n, page;\n\tscanf(\"%d\",&n);\n\tfor (i = 1; i<=7; i++)\n\t{\n\t\tscanf(\"%d\", &arr[i]);\n\t}\n\tfor (i = 1; ; i++)\n\t{\n\t n = n - arr[i];\n\t\tif (n<=0)\n\t\t{\n\t\t\tprintf(\"%d\\n\", i);\n\t\t\tbreak;\n\t\t}\n\t\telse continue; \n\t}\n\treturn 0;\n\t\n}"}, {"source_code": "#include \n#include \n \nint main() {\n \n int n, a[10], sum, left;\n int i, j;\n \n scanf(\"%d\", &n);\n \n for (i = 0; i < 7; i++)\n {\n \tscanf(\"%d\", &a[i]);\n \tsum += a[i];\n\t}\n\t\n\tif (sum > n)\n\t{\n\t\tleft = n % sum;\n\t}\n\telse\n\t{\n\t\tleft = n;\n\t}\n\t\n\ti = 0;\n\tj = 0;\n\twhile (j < left)\n\t{\n\t\tif (i == 8)\n\t\t{\n\t\t\ti = 0;\n\t\t}\n\t\t\n\t\tj += a[i];\n\t\ti += 1;\n\t}\n \n printf(\"%d\\n\", i);\n \n return 0;\n \n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int i, page, day=0, count=0;\n int arr[7];\n scanf(\"%d\", &page);\n for(i=0; i<7; i++)scanf(\"%d\", &arr[i]);\n i=0;\n while(count7){\n if(day/8 == 7) day--;\n day%=8;\n day++;\n }\n printf(\"%d\\n\", day);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int week,cnt;\n int i,n;\n int a[8];\n scanf(\"%d\",&n);\n week=0;\n for(cnt=1;cnt<=7;cnt++){\n scanf(\"%d\",&a[cnt]);\n week+=a[cnt];\n }\n if(n>week)\n n=n%week;\n\n for(i=1;i<=7;i++){\n n-=a[i];\n if(n<=0){\n printf(\"%d\\n\",i);\n break;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,i,j=0,e,sum=0,l=0,x,y,z,a=0;\n int p[8];\n scanf(\"%d\",&n);\n for(i=1;i<=7;i++)\n {\n scanf(\"%d\",&p[i]);\n sum=p[i]+sum;\n if(sum==n)\n {\n j++;\n printf(\"%d\\n\",i);\n break;\n }\n }\n x=n/sum;\n e=n%sum;\n if(sum==1)\n {\n for(i=1;i<=7;i++)\n {\n if((p[i]>0)&&(j==0))\n {\n \n printf(\"%d\\n\",i);\n break;\n }\n }\n }\n\n if((e==0)&&(j==0))\n {\n printf(\"7\\n\");\n }\n if((e!=0)&&(j==0))\n {\n y=x*sum;\n z=n-y;\n for(i=1;i<=7;i++)\n {\n l=p[i]+l;\n if(l>=z)\n {\n break;\n }\n }\n printf(\"%d\\n\",i);\n }\n return 0;\n}"}, {"source_code": "#include\nint main ()\n{\n int n,i,count=0,flag=0;\n scanf(\"%d\",&n);\n int array[7];\n for(i=0;i<7;i++)\n {\n scanf(\"%d\",&array[i]);\n }\n for(i=0;i<7;i++)\n {\n count+=array[i];\n flag++;\n if(count>=n)\n break;\n if(flag==7)\n {\n flag=0;\n i--;\n }\n }\n printf(\"%d\",flag);\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n, mon, tue, wed, thur, fri, sat, sun, sum=0, count=0, i;\n scanf(\"%d %d %d %d %d %d %d %d\", &n, &mon, &tue, &wed, &thur, &fri, &sat, &sun);\n\n for(i=0; 1; i++)\n {\n sum = sum+mon;\n count++;\n if(sum>=n && i==0)\n {\n printf(\"1\");\n break;\n }\n else if(sum>=n)break;\n else\n {\n sum = sum+tue;\n count++;\n if(sum>=n && i==0)\n {\n printf(\"2\");\n break;\n }\n else if(sum>=n)break;\n else\n {\n sum = sum+wed;\n count++;\n if(sum>=n && i==0)\n {\n printf(\"3\");\n break;\n }\n\n else if(sum>=n)break;\n else\n {\n sum = sum+thur;\n count++;\n if(sum>=n && i==0)\n {\n printf(\"4\");\n break;\n }\n else if(sum>=n)break;\n else\n {\n sum = sum+fri;\n count++;\n if(sum>=n && i==0)\n {\n printf(\"5\");\n break;\n }\n else if(sum>=n)break;\n else\n {\n sum = sum+sat;\n count++;\n if(sum>=n && i==0)\n {\n printf(\"6\");\n break;\n }\n else if(sum>=n)break;\n else\n {\n sum = sum+sun;\n count++;\n if(sum>=n && i==0)\n {\n printf(\"7\");\n break;\n }\n else if(sum>=n)break;\n }\n }\n }\n }\n }\n }\n }\n if(i!=0 && count%7 !=0)printf(\"%d\", count%7);\n else if(count%7 == 0) printf(\"7\");\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,week[7],i,j=0;\n scanf(\"%d\",&n);\n for(i=0;i<7;i++)\n scanf(\"%d\",&week[i]);\n while(n>0)\n {\n n=n-week[j];\n j++;\n if(j>6) j=0;\n }\n printf(\"%d\",j);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a[8];\n int i,count,n,b;\n while(scanf(\"%d\",&n)==1)\n {\n b=0;\n for(i=0;i<7;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n i=0;\n while(b\nint main()\n{\n\tint n,i,sum=0,j=1;\n\tscanf(\"%d\",&n);\n\tint a[n+1];\n\tfor(i=1;i=n)\n\t\t\t{\n\t\t\t\tprintf(\"%d\",j);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tj++;\n\t\t\tif(j>n)\n\t\t\t\tj=1;\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int a[7],n,i;\n scanf(\"%d\",&n);\n for(i=0;i<7;i++)\n scanf(\"%d\",&a[i]);\n while(n>=0)\n {\n for(i=0;i=0)\n n=n-a[i];\n else\n break;\n }\n }\n printf(\"%d\",i+1);\n return 0;\n \n \n}"}, {"source_code": "#include \nint main()\n{\nint n,a[7],b=0;\nscanf(\"%d\",&n);\nfor(int i=0;i<7;++i) \n{\nscanf(\"%d\",&a[i]);\nb+=a[i];\n}\nn%=b;\nfor(int i=0;i<7;++i)\n{\nn-=a[i];\nif(n<=0)\n{\nprintf(\"%d\",i+1);\nreturn 0;\n}\n}\n}"}, {"source_code": "#include \n\nint main(void) {\n int n,a[7],i,s;\n scanf(\"%d\",&n);\n for(i=0;i<7;i++)\n scanf(\"%d\",&a[i]);\n s=0;i=0;\n while(s\n\nint main(){\n int n=0,dni[7],i;\n scanf(\"%d\",&n);\n for(i=0;i<7;i++)\n scanf(\"%d\",&dni[i]);\n i=0;\n while(n>0){\n if(i==6) i=0;\n if(dni[i]!=0)\n n-=dni[i];\n i++;\n }\n printf(\"\\n%d\",i);\nreturn 0;\n}\n"}, {"source_code": "#include\"stdio.h\"\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int num[7]; // 0 is monday, 6 is sunday\n int i,s=0;\n for(i=0;i<7;i++){\n scanf(\"%d\",&num[i]);\n s+=num[i];\n }\n int sum=n%s;\n int flag=0,j;\n\n for(j=0;j<7;j++)\n {\n sum-=num[j];\n if(sum<=0) { flag=j+1; break;}\n }\n\n\n printf(\"%d\",flag);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n, i;\n scanf(\"%d\", &n);\n int a[7];\n for(i=0; i<7; i++)\n {\n scanf(\"%d\", &a[i]);\n }\n for(i=0; 1 ;i++)\n {\n if(i==7)\n i=0;\n if(n<=0)\n {\n if(i==0)\n printf(\"%d\", i+1);\n else\n printf(\"%d\", i);\n break;\n }\n n=n-a[i];\n }\n return 0;\n}"}, {"source_code": "#include\nint main(){\n int n,i,days,arr[7];\n scanf(\"%d\",&n);\n for(i=0;i<7;i++){\n scanf(\"%d\",&arr[i]);\n \n }\n i=-1;\n while(n>0){\n i++;\n n-=arr[i];\n \n if(n<=0){\n break;\n }\n \n }\n days=i%7;\n printf(\"%d\",days+1);\n return 0;\n}"}, {"source_code": "#include\"stdio.h\"\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int num[7]; // 0 is monday, 6 is sunday\n int i;\n for(i=0;i<7;i++)\n scanf(\"%d\",&num[i]);\n int sum=n,flag=0,j;\n while(flag==0)\n {\n for(j=0;j<7;j++)\n {\n sum-=num[j];\n if(sum<0) { flag=j+1; break;}\n }\n\n }\n printf(\"%d\",flag);\n return 0;\n}\n"}, {"source_code": "#include \n \nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint s[8],x;\n\ts[0]=0;\n\tfor(int i=1; i<8; i++){\n\t\tscanf(\"%d\",&x);\n\t\ts[i]=s[i-1]+x;\n\t}\n\t\n\tint mod=n%s[7],i=0;\n\t\n\tif(mod==0 && s[7] != 1) {\n\t\tprintf(\"7\");\n\t}\n\telse{\n\t while(mod>=s[i]){\n\t\t i++;\n\t }\n\t printf(\"%d\",i);\n }\n\t \n\treturn 0;\n}\n \n"}, {"source_code": "#include\nint main(){\n int n,i,days,arr[7];\n scanf(\"%d\",&n);\n for(i=0;i<7;i++){\n scanf(\"%d\",&arr[i]);\n \n }\n i=-1;\n while(n>0){\n i++;\n n-=arr[i];\n \n if(n<=0){\n break;\n }\n \n }\n days=i%7;\n printf(\"%d\",days+1);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint n,i,k=0;\n\t scanf(\"%d\",&n);\n\t int a[7];\n\t for(i=0;i<7;i++)\n\t scanf(\"%d\",&a[i]);\n\t while(n>0)\n\t {\n\t \tn=n-a[k%7];\n\t \tk++;\n\t }\n\t printf(\"%d\",k%7);\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,s[7],i;\n\tscanf(\"%d \\n\",&n);\n\tfor(i=0;i<7;i++)\n\t{\n\t\tscanf(\"%d \",&s[i]);\n\t}\n\tfor(i=0;i\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a[7];\n for (int i=0;i<7;i++)\n scanf(\"%d\",&a[i]);\n int k=0;int i=0;\n while (k\n\nint main()\n{\n int n, mon, tue, wed, thur, fri, sat, sun, sum=0, count=0, i;\n scanf(\"%d %d %d %d %d %d %d %d\", &n, &mon, &tue, &wed, &thur, &fri, &sat, &sun);\n\n for(i=0; 1; i++)\n {\n sum = sum+mon;\n count++;\n if(sum>=n && i==0)\n {\n printf(\"1\");\n break;\n }\n else if(sum>=n)break;\n else\n {\n sum = sum+tue;\n count++;\n if(sum>=n && i==0)\n {\n printf(\"2\");\n break;\n }\n else if(sum>=n)break;\n else\n {\n sum = sum+wed;\n count++;\n if(sum>=n && i==0)\n {\n printf(\"3\");\n break;\n }\n\n else if(sum>=n)break;\n else\n {\n sum = sum+thur;\n count++;\n if(sum>=n && i==0)\n {\n printf(\"4\");\n break;\n }\n else if(sum>=n)break;\n else\n {\n sum = sum+fri;\n count++;\n if(sum>=n && i==0)\n {\n printf(\"5\");\n break;\n }\n else if(sum>=n)break;\n else\n {\n sum = sum+sat;\n count++;\n if(sum>=n && i==0)\n {\n printf(\"6\");\n break;\n }\n else if(sum>=n)break;\n else\n {\n sum = sum+sun;\n count++;\n if(sum>=n && i==0)\n {\n printf(\"7\");\n break;\n }\n else if(sum>=n)break;\n }\n }\n }\n }\n }\n }\n }\n if(i!=0)printf(\"%d\", count%7);\n}\n"}, {"source_code": "#include\n\nint main(void)\n{\n\tint n,a[10],i,s=0,dif;\n\tscanf(\"%d\",&n);\n\tfor(i=1;i<8;i++) {\n\t\tscanf(\"%d\",&a[i]);\n\t\ts+=a[i];\n\t}\n\tdif=n%s;\n\tif(dif==0) {\n\t\tfor(i=7;i>0;i--) {\n\t\t\tif(a[i]!=0)\n\t\t\t\tprintf(\"%d\",i);\n\t\t}\n\t}\n\telse {\n\t\tif(dif\nint main()\n{\n int i, x, a[7], y = 0, count = 0;\n scanf(\"%d\", &x);\n for(i = 0; i<7; i++) {\n scanf(\"%d\", &a[i]);\n }\n while(y < x) {\n y = y + a[count];\n count++;\n if(count>7)\n count = 1;\n }\n if(count%7 == 0) {\n y = 7;\n }\n else {\n y = count%7;\n }\n printf(\"%d\", y);\n}\n"}, {"source_code": "#include\nint main(){\n int n,p[7],i,t;\n scanf(\"%d\",&n);\n for(i=1;i<7;i++)\n scanf(\"%d\",&p[i]);\n scanf(\"%d\",&p[0]);\n for(t=1;;t++){\n n-=p[(t%7)];\n if(n<0){\n if(t%7==0)\n printf(\"7\");\n else\n printf(\"%d\",t%7);\n return 0;\n }\n }\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,i,t=0,d=0;\n scanf(\"%d\",&n);\n int a[7];\n for(i=0;i<7;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n\n for(i=0;i<7;i++)\n {\n d=d+a[i];\n if(d>=n)\n {\n t=i+1;\n printf(\"%d \\n\",d);\n break;\n }\n }\n printf(\"%d\",t);\n}\n"}, {"source_code": "#include\nint main(){\nint n,x[7],i,sum;\nscanf(\"%d\",&n);\nfor(i=0;i<7;i++)scanf(\"%d\",&x[i]);\nsum=n;\ni=-1;\nwhile(sum>=0){\n ++i;\n sum=sum-x[i];\n if(i==7)i=-1;\n}\nprintf(\"%d\",++i);\n \n return 0;}\n"}, {"source_code": "#include \n\nint arr[7];\n\nint main()\n{\n int n, i, sum = 0, count = 0;\n scanf(\"%d\", &n);\n\n for(i=0; i<7; i++){\n scanf(\"%d\", &arr[i]);\n sum = sum + arr[i];\n }\n\n n = n % sum;\n for(i=0; i<7; i++){\n count = count + arr[i];\n if(count >= n){\n printf(\"%d\", i + 1);\n return 0;\n }\n }\n}\n"}, {"source_code": "#include\nint main()\n{\n int i, p, k, arr[7], brr[7];\n scanf(\"%d\", &p);\n for(i=0; i<7; i++)\n {\n scanf(\"%d\", &arr[i]);\n }\n brr[0]=arr[0];\n for(i=1; i<7; i++)\n {\n brr[i]=brr[i-1]+arr[i];\n }\n /*for(i=0; i<7; i++)\n {\n printf(\"%d \", brr[i]);\n }*/\n //k=p-brr[6];\n int flag;\n if(p>brr[6])\n {\n //printf(\"aaaaaa\\n\");\n p=p%brr[6];\n if(p==0)\n {\n printf(\"7\");\n return 0;\n }\n else if(brr[0]>=p)\n {\n printf(\"1\");\n return 0;\n }\n \n for(i=0; i<7; i++)\n {\n if(brr[i]

p)\n {\n flag=0;\n break;\n }\n else if(brr[i]==p)\n {\n flag=1;\n break;\n }\n }\n }\n else\n {\n // printf(\"bbbbb\\n\");\n if(brr[0]>=p)\n {\n printf(\"1\");\n return 0;\n }\n for(i=0; i<7; i++)\n {\n if(brr[i]

p)\n {\n flag=0;\n //printf(\"%d \", i);\n break;\n }\n else if(brr[i]==p)\n {\n flag=1;\n break;\n }\n }\n }\n \n if(flag==0)\n printf(\"%d\", (i+2));\n else \n printf(\"%d\", i+1);\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n int n,i,days,arr[7];\n scanf(\"%d\",&n);\n for(i=0;i<7;i++){\n scanf(\"%d\",&arr[i]);\n \n }\n i=-1;\n while(n>0){\n i++;\n n-=arr[i];\n \n if(n<=0){\n break;\n }\n \n }\n days=i%7;\n printf(\"%d\",days+1);\n return 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int sum=n;\n int i;\n\n int a[7];\n\n for(i=0;i<7;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n i=0;\n while(1)\n {\n sum=sum-a[i];\n if(sum<=0)\n {\n printf(\"%d\",i+1);\n return 0;\n }\n i++;\n if(i==6) i=0;\n\n\n }\n}\n"}, {"source_code": "#include \nint main()\n{\n\tint n,i,sum=0,j=1;\n\tscanf(\"%d\",&n);\n\tint a[n+1];\n\tfor(i=1;i=n)\n\t\t\t{\n\t\t\t\tprintf(\"%d\",j);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tj++;\n\t\t\tif(j>7)\n\t\t\t\tj=1;\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\n#include\n#include\n#define MAX\nint main()\n{\n int week,cnt;\n int i,n;\n int a[8];\n scanf(\"%d\",&n);\n week=0;\n// printf(\"\\n%d\\n\",n);\n for(cnt=1;cnt<=7;cnt++){\n scanf(\"%d\",&a[cnt]);\n week+=a[cnt];\n }\n // printf(\"\\n%d\\n\",n);\n n=n%week;\n // printf(\"%d\\n\",n);\n for(i=1;i<=7;i++){\n n-=a[i];\n if(n<=0){\n printf(\"%d\\n\",i);\n break;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a[7],n,i=-1;\n scanf(\"%d\",&n);\n for(i=0;i<7;i++)\n scanf(\"%d\",&a[i]);\n i=-1;\n while(n>=0)\n {\n i++;\n if(i==7)\n i=0;\n if(a[i]==0)\n {\n continue;\n }\n n=n-a[i];\n }\n printf(\"%d\",i);\n return 0;\n \n \n}"}, {"source_code": "#include\nint main()\n{\n\tint n,s[7],i;\n\tscanf(\"%d \\n\",&n);\n\tfor(i=0;i<7;i++)\n\t{\n\t\tscanf(\"%d \",&s[i]);\n\t}\n\tfor(i=0;i\nint main()\n{\n\tint n,s[7],i;\n\tscanf(\"%d \\n\",&n);\n\tfor(i=0;i<7;i++)\n\t{\n\t\tscanf(\"%d \",&s[i]);\n\t}\n\tfor(i=0;i0)\n\t\t{\n\t\t\ti=-1;\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a[7],i,sum=0,left=0;\n for(i=0;i<7;i++)\n {\n scanf(\"%d\",&a[i]);\n sum+=a[i];\n }\n if(n>=sum)\n {\n left=n-(n/sum)*sum;\n }\n else left=n;\n i=0;\n while(1)\n {\n if(a[i]>=left)\n {\n printf(\"%d\",i+1);\n return 0;\n }\n else\n {\n left=left-a[i++];\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n\n int n, i, rem, x;\n\n int a[7];\n int cum[7]={0};\n scanf(\"%d\", &n);\n\n for(i=0;i<7;i++)\n {\n scanf(\"%d\", &a[i]);\n }\n\n cum[0]=a[0];\n for(i=1;i<7;i++)\n {\n cum[i]=cum[i-1] + a[i];\n\n if(n <=cum[i])\n {\n printf(\"%d\\n\", i+1);\n exit(0);\n\n }\n\n }\n\n\n while(n>cum[6])\n {\n n=n-cum[6];\n }\n for(i=0;i<7;i++)\n {\n\n if(n <=cum[i])\n {\n printf(\"%d\\n\", i+1);\n exit(0);\n\n }\n\n }\n\n\n\n\n\n\n\n\n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,i,count=1,a,k;\n scanf(\"%d\",&n);\n int arr[7];\n for(i=1;i<=7;i++)\n {\n scanf(\"%d\",&arr[i]);\n }\n for(i=1;i<=7;i++)\n {\n n=n-a;\n if(n>0)\n {\n count++;\n if(arr[i]==0)\n {\n break;\n }\n }\n }\n printf(\"%d\",count);\n\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n\tint n;\n\tint a[8];\n\tscanf(\"%d\",&n);\n\tint i,sum=0,ans=0;\n\tfor(i=0;i<7;i++){\n\t\tscanf(\"%d\",&a[i+1]);\n\t\tsum=sum+a[i+1];\n\t}\n//\tprintf(\"sum=%d\\n\",sum);\n\twhile(1){\n\t\tif(n>sum)\n\t\t\tn=n-sum;\n\t\telse if(n==sum){\n\t\t\tans=1;\n\t\t\tbreak;\n\t\t}\n\t\telse {\n\t\t\tfor(i=1;i<=7;i++){\n\t\t\t\tn=n-a[i];\n//\t\t\t\tprintf(\"n=%d\\n\",n);\n\t\t\t\tif(n<=0){\n\t\t\t\t\tans=i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(ans!=0)\n\t\t\tbreak;\n\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int i, p, k, arr[7], brr[7];\n scanf(\"%d\", &p);\n for(i=0; i<7; i++)\n {\n scanf(\"%d\", &arr[i]);\n }\n brr[0]=arr[0];\n for(i=1; i<7; i++)\n {\n brr[i]=brr[i-1]+arr[i];\n }\n /*for(i=0; i<7; i++)\n {\n printf(\"%d \", brr[i]);\n }*/\n //k=p-brr[6];\n int flag;\n if(p>brr[6])\n {\n //printf(\"aaaaaa\\n\");\n while(p>brr[6])\n {\n p-=brr[6];\n }\n for(i=0; i<7; i++)\n {\n if(brr[i]

p)\n flag=0;\n else if(brr[i]==p)\n {\n flag=1;\n break;\n }\n }\n }\n else\n {\n // printf(\"bbbbb\\n\");\n for(i=0; i<7; i++)\n {\n if(brr[i]

p)\n {\n flag=0;\n //printf(\"%d \", i);\n break;\n }\n else if(brr[i]==p)\n {\n flag=1;\n break;\n }\n }\n }\n \n if(flag==0)\n printf(\"%d\", (i+2));\n else \n printf(\"%d\", i+1);\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\nint n,x[7],i,sum;\nscanf(\"%d\",&n);\nfor(i=0;i<7;i++)scanf(\"%d\",&x[i]);\nsum=n;\ni=-1;\nwhile(sum>0){\n ++i;\n sum=sum-x[i];\n}\nprintf(\"%d\",++i);\n\n return 0;}"}, {"source_code": "#include\n#include\n\nint main(){\n int tab[7];\n int i,j,n,page;\n scanf(\"%d\",&n);\n for(i=1;i<=7;i++)\n scanf(\"%d\",&tab[i]);\n while(n>=0){\n for(i=1;i<=7;i++){\n n-=tab[i];\n if(n<=0){\n printf(\"%d\",i);\n return 0;\n }\n }\n }\n\n}"}, {"source_code": "#include\n#include\nint main( )\n{\n\tint n,i,j,k,a[1001],c=0,flag=0;\n\tscanf(\"%d\",&n);\n\tfor(i=1;i<=7;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tfor(j=0;;j++)\n\t{\n\t\tfor(i=1;i<=7;i++)\n\t\t{\n\t\t\tk+=a[i];\n\t\t\tc+=1;\n\t\t\tif(k>=n)\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\tbreak;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",i);\n\treturn 0;\n}\n"}], "src_uid": "007a779d966e2e9219789d6d9da7002c"} {"nl": {"description": "You are given two integer numbers, $$$n$$$ and $$$x$$$. You may perform several operations with the integer $$$x$$$.Each operation you perform is the following one: choose any digit $$$y$$$ that occurs in the decimal representation of $$$x$$$ at least once, and replace $$$x$$$ by $$$x \\cdot y$$$.You want to make the length of decimal representation of $$$x$$$ (without leading zeroes) equal to $$$n$$$. What is the minimum number of operations required to do that?", "input_spec": "The only line of the input contains two integers $$$n$$$ and $$$x$$$ ($$$2 \\le n \\le 19$$$; $$$1 \\le x < 10^{n-1}$$$).", "output_spec": "Print one integer — the minimum number of operations required to make the length of decimal representation of $$$x$$$ (without leading zeroes) equal to $$$n$$$, or $$$-1$$$ if it is impossible.", "sample_inputs": ["2 1", "3 2", "13 42"], "sample_outputs": ["-1", "4", "12"], "notes": "NoteIn the second example, the following sequence of operations achieves the goal: multiply $$$x$$$ by $$$2$$$, so $$$x = 2 \\cdot 2 = 4$$$; multiply $$$x$$$ by $$$4$$$, so $$$x = 4 \\cdot 4 = 16$$$; multiply $$$x$$$ by $$$6$$$, so $$$x = 16 \\cdot 6 = 96$$$; multiply $$$x$$$ by $$$9$$$, so $$$x = 96 \\cdot 9 = 864$$$. "}, "positive_code": [{"source_code": "#include \n\nint func (long long x, int n, int ans, int num, long long *pow10, long long *pow9) {\n int cnt = 0;\n int digit[10] = {};\n \n long long tmp = x;\n \n if (num >= ans) {\n return ans;\n }\n \n while (tmp > 0LL) {\n digit[(int)(tmp%10LL)] = 1;\n tmp /= 10LL;\n cnt++;\n }\n \n if (cnt > n) {\n return 100;\n }\n \n if (cnt == n) {\n return num;\n }\n \n for (int i = 9; i > 1; i--) {\n if (digit[i] > 0 && num <= ans-2) {\n long long nx = x*((long long)i);\n if (ans-num-2 >= n || (pow10[n-1]-1LL)/pow9[ans-num-2] < nx) {\n int tmp = func(nx, n, ans, num+1, pow10, pow9);\n if (tmp < ans) {\n ans = tmp;\n }\n }\n }\n }\n \n return ans;\n}\n\nint main () {\n int n = 0;\n long long x = 0LL;\n \n int res = 0;\n \n long long pow10[19] = {};\n long long pow9[19] = {}; \n \n int ans = 0;\n \n res = scanf(\"%d\", &n);\n res = scanf(\"%lld\", &x);\n \n pow10[0] = 1LL;\n for (int i = 1; i < n; i++) {\n pow10[i] = 10LL*pow10[i-1];\n }\n \n pow9[0] = 1LL;\n for (int i = 1; i < n; i++) {\n pow9[i] = 9LL*pow9[i-1];\n }\n \n ans = func(x, n, 100, 0, pow10, pow9);\n if (ans >= 100) {\n ans = -1;\n }\n \n printf(\"%d\\n\", ans);\n \n return 0;\n}\n"}, {"source_code": "#include \r\n\r\ntypedef long long ll;\r\n#define rll register ll\r\n#define rint register int\r\n#define rep(i,a,b) for(rint i=(a);i<(b);i++)\r\n#define repe(i,a,b) for(rint i=(a);i<=(b);i++)\r\n#define repr(i,a,b) for(rint i=(a)-1;(b)<=i;i--)\r\n\r\nint writeBuffer[20];\r\nvoid write(ll num) { if (num == 0) putchar('0'); else { rint size = 0; rll current; if (0 < num) current = num; else current = -num, putchar('-'); while (0 < current) writeBuffer[size++] = current%10+'0', current /= 10; while (0 < size) putchar(writeBuffer[--size]); } }\r\nll read() { rint sign = 1; rll num = 0; while (1) { rint ch = getchar(); if (ch == '-') { sign = -sign; continue; } if (ch <= 32) break; num = num*10+(ch-'0'); } return sign*num; }\r\n\r\nll target;\r\nint ans;\r\nvoid dfs(ll num, int depth) {\r\n if (target <= num) ans = depth;\r\n else {\r\n rint best = depth;\r\n for (rll temp=num;temphead[i] = 0;\r\n temp->cnt = 0, temp->ed = '0';\r\n return temp;\r\n}\r\nn * fnd (n * tr, ll v) {\r\n while (v) {\r\n if (!tr->head[v%10]) tr->head[v%10] = mk();\r\n tr = tr->head[v%10];\r\n v/=10;\r\n }\r\n if (tr->ed == '0') tr->ed = '1', tr->cnt = 100;\r\n return tr;\r\n}\r\nvoid del (n * tr) {\r\n for (int i = 0; i < 10; i++)\r\n if (tr->head[i]) {\r\n del (tr->head[i]);\r\n free(tr->head[i]);\r\n }\r\n}\r\nn tr;\r\nint dfs (ll v, int s) {\r\n ll k = v; int len = 0;\r\n while (k) len++, k/=10;\r\n if (len == s) return 0;\r\n else if (len > s) return 100;\r\n n * chk = fnd( &tr, v ); k = v;\r\n if (chk->cnt != 100) return chk->cnt;\r\n while (k) {\r\n if (k%10 > 1) chk->cnt = min(chk->cnt, 1 + dfs(v * (k%10), s));\r\n k/=10;\r\n } return chk->cnt;\r\n}\r\nint main () {\r\n for (int i = 0; i < 10; i++) tr.head[i] = 0;\r\n int m; ll f;\r\n scanf(\"%d%lld\",&m,&f);\r\n int ans = dfs(f,m);\r\n printf(\"%d\\n\",(ans == 100) ? -1 : ans);\r\n}"}, {"source_code": "#define ll long long\r\n#define min(a,b) (a < b ? a : b)\r\ntypedef struct node {\r\n struct node * head[10];\r\n short cnt; char ed;\r\n} n;\r\nn * mk() {\r\n n * temp = malloc(sizeof(n));\r\n for (int i = 0; i < 10; i++)\r\n temp->head[i] = 0;\r\n temp->cnt = 0, temp->ed = '0';\r\n return temp;\r\n}\r\nn * fnd (n * tr, ll v) {\r\n while (v) {\r\n if (!tr->head[v%10]) tr->head[v%10] = mk();\r\n tr = tr->head[v%10];\r\n v/=10;\r\n }\r\n if (tr->ed == '0') tr->ed = '1', tr->cnt = 100;\r\n return tr;\r\n}\r\nvoid del (n * tr) {\r\n for (int i = 0; i < 10; i++)\r\n if (tr->head[i]) {\r\n del (tr->head[i]);\r\n free(tr->head[i]);\r\n }\r\n}\r\nn tr;\r\nint dfs (ll v, int s) {\r\n ll k = v; int len = 0;\r\n while (k) len++, k/=10;\r\n if (len == s) return 0;\r\n else if (len > s) return 100;\r\n n * chk = fnd( &tr, v ); k = v;\r\n if (chk->cnt != 100) return chk->cnt;\r\n while (k) {\r\n if (k%10 > 1) chk->cnt = min(chk->cnt, 1 + dfs(v * (k%10), s));\r\n k/=10;\r\n } return chk->cnt;\r\n}\r\nint main () {\r\n for (int i = 0; i < 10; i++) tr.head[i] = 0;\r\n int m; ll f;\r\n scanf(\"%d%lld\",&m,&f);\r\n int ans = dfs(f,m);\r\n printf(\"%d\\n\",(ans == 100) ? -1 : ans);\r\n del(&tr);\r\n}"}], "negative_code": [{"source_code": "#include \n\nint func (long long x, int n, int num, long long *pow10, int *lim) {\n int cnt = 0;\n int digit[10] = {};\n \n long long tmp = x;\n \n int ans = -1;\n \n while (tmp > 0LL) {\n digit[(int)(tmp%10LL)] = 1;\n tmp /= 10LL;\n cnt++;\n }\n \n if (cnt > n) {\n return -1;\n }\n \n if (cnt == n) {\n return num;\n }\n \n for (int i = 9; i > 1; i--) {\n if (digit[i] > 0) {\n long long nx = x*((long long)i);\n if (nx >= pow10[cnt] && lim[cnt] > num) {\n int tmp = 0;\n lim[cnt] = num+1;\n tmp = func(nx, n, num+1, pow10, lim);\n if (ans < 0 || (tmp >= 0 && tmp < ans)) {\n ans = tmp;\n }\n } else if (lim[cnt] > num+1) {\n int tmp = 0;\n tmp = func(nx, n, num+1, pow10, lim);\n if (ans < 0 || (tmp >= 0 && tmp < ans)) {\n ans = tmp;\n }\n }\n }\n }\n \n return ans;\n}\n\nint main () {\n int n = 0;\n long long x = 0LL;\n \n int res = 0;\n \n long long pow10[19] = {};\n int ans[20] = {}; \n \n res = scanf(\"%d\", &n);\n res = scanf(\"%lld\", &x);\n \n pow10[0] = 1LL;\n for (int i = 1; i <= n; i++) {\n pow10[i] = 10LL*pow10[i-1];\n }\n \n for (int i = 0; i < n; i++) {\n ans[i] = 100;\n }\n \n printf(\"%d\\n\", func(x, n, 0, pow10, ans));\n \n return 0;\n}\n"}, {"source_code": "#include \r\n\r\ntypedef unsigned long long ll;\r\n#define rll register ll\r\n#define rint register int\r\n#define rep(i,a,b) for(rint i=(a);i<(b);i++)\r\n#define repe(i,a,b) for(rint i=(a);i<=(b);i++)\r\n#define repr(i,a,b) for(rint i=(a)-1;(b)<=i;i--)\r\n\r\nint writeBuffer[20];\r\nvoid write(ll num) { if (num == 0) putchar('0'); else { rint size = 0; rll current; if (0 < num) current = num; else current = -num, putchar('-'); while (0 < current) writeBuffer[size++] = current%10+'0', current /= 10; while (0 < size) putchar(writeBuffer[--size]); } }\r\nll read() { rint sign = 1; rll num = 0; while (1) { rint ch = getchar(); if (ch == '-') { sign = -sign; continue; } if (ch <= 32) break; num = num*10+(ch-'0'); } return sign*num; }\r\n\r\nll dp[100][1<<10];\r\n\r\nint main() {\r\n rint n = read();\r\n rll target = 1;\r\n rep(i,0,n) target *= 10;\r\n\r\n rll x = read();\r\n\r\n {\r\n rint mask = 0;\r\n for (rll temp=x;temp;temp/=10) mask |= 1<<(temp%10);\r\n dp[0][mask] = x;\r\n }\r\n\r\n rint depth = 0;\r\n while (1) {\r\n rint found = 0;\r\n rep(j,0,1024) {\r\n rll num = dp[depth][j];\r\n if (num) {\r\n rep(k,2,10) if (j&(1<\n#include \n#include \n#include\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tif(n==2)\n\tprintf(\"6\");\n\telse if(n==3)\n\tprintf(\"8\");\n\telse if(sqrt(n)-(int)sqrt(n)==0)\n\tprintf(\"%d\",(int)sqrt(n)*4);\n\telse\n\t{\n\t\tint s=sqrt(n);\n\t\tint res=4*s;\n\t\tint y=n-s*s;\n\t\tif(y<=s)\n\t\tprintf(\"%d\",res+2);\n\t\telse\n\t\tprintf(\"%d\",res+4);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\n#include\n\n\n\nint main(){\nint n;\nscanf(\"%d\",&n);\nint sq=n;\nwhile(sqrt(sq)!=(int)sqrt(sq)){\nsq++;\n}\n\nint peri=4*sqrt(sq);\nint d=sq-n;\nint val=0;\nint a=sqrt(sq);\nif(d>=a){\nval=val+2;\nd=d-a;\na--;}\nint cnt=0;\n\nwhile(d!=0){\ncnt++;\nif(d>=a){\nval=val+2;\nd=d-a;\n}\nif(d\n#include\n\nint main()\n{\n int n,sr;\n scanf(\"%d\",&n);\n sr=(int) sqrt(n);\n if((sr*sr)==n)\n printf(\"%d\",sr*4);\n else if((sr*sr+sr)>=n)\n printf(\"%d\",sr*4+2);\n\n else\n printf(\"%d\",(sr+1)*4);\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tdouble a=sqrt(n);\n\tint b=ceil(a);\n\tint count=0;\n\twhile(n>0)\n\t{\n\t\tn-=b;\n\t\tcount++;\n\t}\n\tprintf(\"%d\\n\",2*b+2*count);\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint main(){\n\n int m;\n scanf(\"%d\",&m);\n for(int i=0;i<1200;i++){\n if(i*i >= m){\n printf(\"%d\\n\",4*i);\n break;\n }\n else if(i*i + i >= m){\n printf(\"%d\\n\",4*i + 2);\n break;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main(){\n int N, i, per, r, dis, div1, div, div2;\n scanf(\"%d\",&N);\n r=sqrt(N);\n per=r*4;\n dis=N-(r*r);\n if(dis){\n if(dis<=r){\n per=per+2;\n }\n if(dis>r){\n div=dis/r;\n div1=dis%r;\n if(div1){\n div++;\n }\n per=per+div*2;\n }\n }\n printf(\"%d\",per);\n}"}, {"source_code": "#include \n\nint main()\n{\n int n,weight,height,p,minP;\n scanf(\"%d\",&n);\n weight = 1;\n while(weight <= n)\n {\n if(n % weight ==0)\n height = n/weight;\n else\n height = n/weight + 1;\n p = 2*(height+weight);\n if(weight == 1)\n minP = p;\n else\n if(p < minP)\n minP = p;\n weight++;\n }\n printf(\"%d\",minP);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int a,n;\n scanf(\"%d\",&n);\n a = 2*ceil(2*sqrt(n));\n printf(\"%d\",a);\n return 0;\n}\n"}, {"source_code": "#include\nint mini(int a, int b)\n{\nif(a<=b)return a;\nreturn b;\n}\nint dp[2000005];\nint main()\n{\nint n;\nscanf(\"%d\",&n);\nint i;\nfor(i=1;i<=2*n+1;i++)\ndp[i] = 2*i + 2;\nint j;\nfor(i=1;i<=2*n;i++)\nfor(j=i;j<=2*n;j+=i)\ndp[j] = mini(dp[j],2*(i+j/i));\nfor(i=2*n;i>=1;i--)\ndp[i] = mini(dp[i],dp[i+1]);\nprintf(\"%d\\n\",dp[n]);\nreturn 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n long long N;\n long long squares[1005];\n long long maxsquare;\n long long maxlines;\n long long remainder;\n long long squareside;\n long long perimeter;\n int i;\n for(i=0;i<=1000;i++) squares[i]=i*i;\n \n scanf(\"%lld\",&N);\n for(i=1;i<=1000;i++)\n {\n maxsquare=squares[i];\n squareside=i;\n if(squares[i+1]>N) break;\n }\n\n remainder=N-maxsquare;\n maxlines=remainder/squareside;\n remainder=remainder-maxlines*squareside;\n\n perimeter=4*squareside;\n if(maxlines>0) perimeter+= 2*maxlines;\n if(remainder>0) perimeter+=2;\n printf(\"%lld\\n\",perimeter);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,i,x,y,z,p;\n scanf(\"%d\",&n);\n\n if(n==1)\n printf(\"4\\n\");\n else\n {\n for(i=2;i<=n;i++)\n {\n if(i*i>n)\n {\n x=i-1;\n break;\n }\n }\n y=n/x;\n z=n%x;\n if(z==0)\n printf(\"%d\\n\",x*2+y*2);\n else\n {\n p=x*2+y*2-z;\n if(z==1)\n p=p+3;\n else\n p=p+4+(z-2);\n printf(\"%d\\n\",p);\n }\n }\n return 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n int n,a;\n scanf(\"%d\",&n);\n a=sqrt(n);\n if(a*a==n)\n {\n printf(\"%d\\n\",(4*a));\n }\n else if(n<=((a*a)+a))\n {\n printf(\"%d\\n\",(4*a+2));\n }\n else\n {\n printf(\"%d\\n\",(4*a+4));\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n\nint main()\n{\n\tint n, d;\n\tscanf(\"%d\",&n);\n\n\td = sqrt(n);\n\n\tint form;\n\tform = n - d * d;\n\t\n\tint hex;\n\thex = d * 4;\n\n\tif(form == 0)\n\t{\n\t\tprintf(\"%d\\n\", hex);\n\t}\n\t\n\telse if(form != 0)\n\t{\n\t\tif(form > d)\n\t\t{\n\t\t\tprintf(\"%d\\n\", hex + 4);\n\t\t}\n\t\t\n\t\telse\n\t\t{\n\t\t\tprintf(\"%d\\n\", hex + 2);\n\t\t}\n\t}\n\n\treturn 0;\n}\t\n"}, {"source_code": " #include\n #include\n int main()\n {\n int n,p=0;\n scanf(\"%d\",&n);\n int j=sqrt(n);\n int k=j*j;\n if(n==k)\n p=4*sqrt(n);\n else\n {\n \tp=2*j;\n \tint rem=n-k;\n \tif(rem<=j)\n \t{\n \t\tif(rem>1)\n \t\tp=p+rem+2+j+(j-rem);\n \t\telse\n \t\tp=p+3+(j-rem)+j;\n \t}\n \n \telse\n \t{\n \t\tp=p+(j+2);\n \t\tif((rem-j)>1)\n \t\tp=p+(rem-j)+2+(j-(rem-j));\n \t\telse\n \t\tp=p+3+(j-(rem-j));\n \t}\n }\n printf(\"%d\",p);\n }"}, {"source_code": "#include\n#include \n\nint main()\n{\n double n;\n int a, b;\n scanf(\"%lf20222\", &n);\n a = ceil(sqrt(n));\n b = ceil(n/a);\n printf(\"%d\\n\", 2*(a+b));\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main() {\n\tint a,b,N;\n\tscanf(\"%d\", &N);\n\ta = sqrt(N);\n\tb = a;\n\tif (a * b >= N) {\n\t\tprintf(\"%d\", 2*a + 2*b);\n\t} else if ((a+1) * b >= N) {\n\t\tprintf(\"%d\", 2*(a+1) + 2*b);\n\t} else {\n\t\tprintf(\"%d\", 2*(a+1) + 2*(b+1));\n\t}\n}"}, {"source_code": "#include\nint main()\n{\n long long int N,p;\n scanf(\"%lld\",&N);\n p=sqrt(N);\n if(p*p>=N)\n {\n printf(\"%d\",(4*p));\n }\n else if(p*(p+1)>=N)\n {\n printf(\"%d\",((2*p)+(2*(p+1))));\n }\n else\n {\n printf(\"%d\",4*(p+1));\n }\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n\nint gcd(int a,int b)\n{\n\tif(b==0)\n\t\treturn a;\n\tgcd(b,a%b);\n}\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint p=sqrt(n);\n\tint q=p*4;\n\n\tint r=n-(p*p);\n\twhile(r>=p)\n\t{\n\t\tr-=p;\n\t\tq+=2;\n\t}\n\tif(r>0)\n\t\tq+=2;\n\tprintf(\"%d\\n\",q);\n\n\treturn 0;\n\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int k=sqrt(n);\n int a=n/k;\n int p=0;\n int l=n%k;\n p=k+2*a;\n if(l==1)\n p+=3+(k-l);\n else if(l==0)\n p+=k-l;\n else if(l>1)\n p+=2+l+k-l;\n printf(\"%d\",p);\n return 0;\n}"}, {"source_code": "#include\n#include\nint main(){\n int n,i,y=2,result=0,min=4;\n int inc=4;\n double z;\n scanf(\"%d\",&n);\n for(i=1;i\n#include\n#include\n\nint main(){\n int n;\n scanf(\"%d\", &n);\n int square = 1;\n int closest = n;\n int value;\n while(square*square <= n){\n if (n-square*square < closest){\n closest = n-square*square;\n value = square;\n }\n square++;\n }\n int ans;\n if (closest != 0)\n ans = value*4 + 2;\n else if (closest == 0)\n ans = value*4;\n if ((value+1)*(value+1) - n < closest)\n ans = (value+1)*4;\n printf(\"%d\", ans);\n\n\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int m1 =1 , m2 = 1 ;\n while( m1*m2 <= n)\n {\n if( m1*m2 == n) break;\n if(m1==m2 ) m1++;\n else if((m1-m2) >=1 ) m2++;\n }\n // printf(\".....%d %d \\n\",m1,m2);\n // //\n // // if( m1 > m2) m1--;\n // // else if( m1 == m2 ) m2--;\n //\n // printf(\"......%d %d \\n\",m1,m2);\n int peri = 2*(m1+m2);\n printf(\"%d\\n\",peri);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int N,x,y;\n\n scanf(\"%d\", &N);\n x= sqrt(N);\n\n if(x*x==N) printf(\"%d\\n\",4*x);\n else\n {\n x++;\n y= 2*(N/x)+2*x;\n\n if(N%x!=0) y+=2;\n\n printf(\"%d\\n\",y);\n\n }\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n \nint main(){\n \n long x;\n scanf(\"%ld\", &x);\n long a = sqrt(x);\n long perimeter = 0;\n \n if(a * a >= x) perimeter = 4 * a;\n else if(a * (a + 1) >= x) perimeter = 4 * a + 2;\n else if((a + 1) * (a + 1) >= x) perimeter = 4 * a + 4;\n \n printf(\"%ld\\n\", perimeter);\n \n return 0;\n}"}, {"source_code": "#include \n#include \n#include \n#include \n\nint main()\n{\n int n;\n int res;\n scanf(\"%d\",&n);\n res= 2*ceil((2*sqrt(n)));\n printf(\"%d\",res);\nreturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int n,a,t;\n scanf(\"%d\",&n);\n a = ((2*sqrt(n))+ 0.9999);\n t =(2*a);\n printf(\"%d\",t);\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int a,b,c,i,j,k;\n double x,y;\n scanf(\"%d\",&a);\n y=a;\n x=sqrt(y);\n b=x;\n\n c=(4*b);\n\n a=a-(b*b);\n\n c+=(2*(a/b));\n\n if(a%b!=0)\n c+=2;\n printf(\"%d\\n\",c);\n return 0;\n}\n\n"}, {"source_code": "#include \n#include \n#include \n#include \n\nint main()\n{\n int n;\n int res;\n scanf(\"%d\",&n);\n res= 2*ceil((2*sqrt(n)));\n printf(\"%d\",res);\nreturn 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main()\n{\n\tint i,j,k,l,m,n,q;\n\tscanf(\"%d\",&n);\n\tq=sqrt(n);\n\tm=(n-(q*q))/q;\n\tif((n-(q*q))%q!=0)\n\tm++;\n\tm*=2;\n\tm+=q*4;\n\tprintf(\"%d\\n\",m);\n\t\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n int n,a,t;\n scanf(\"%d\",&n);\n a = ((2*sqrt(n))+ 0.9999);\n t =(2*a);\n printf(\"%d\",t);\n}"}, {"source_code": "#include\n#include\n\nmain()\n{\n long int n;\n scanf(\"%ld\",&n);\n long int sr;\n sr=sqrt(n);\n long int diff=n-(sr*sr);\n double add=ceil((double)diff/sr);\n\n long int ans=(4*sr)+(2*add);\n printf(\"%ld\\n\",ans);\n}\n"}, {"source_code": "#include \n#include \n\n\n/*Lazy Security Guard*/\nint main()\n{\n int input_num, perimeter,temp,count = 0;\n scanf(\"%d\",&input_num);\n temp = input_num;\n if(input_num == 1)\n {\n perimeter = 4;\n }\n else if(input_num <= 0)\n {\n perimeter = 0;\n }\n else\n {\n while(input_num >= (count * count))\n {\n count++;\n }\n count--;\n /*\n while(count != temp)\n {\n count++;\n temp = input_num / count;\n }\n */\n /*\n while(temp != 1)\n {\n temp /= 2;\n count++;\n }\n */\n perimeter = count * 4;\n temp = input_num - (count*count);\n while(temp > 0)\n {\n temp = temp - count;\n perimeter = perimeter + 2;\n }\n }\n printf(\"%d\", perimeter);\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\nmain()\n{\n long int n;\n scanf(\"%ld\",&n);\n long int sr;\n sr=sqrt(n);\n long int diff=n-(sr*sr);\n double add=ceil((double)diff/sr);\n\n long int ans=(4*sr)+(2*add);\n printf(\"%ld\\n\",ans);\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int a,b,n,p;\n scanf(\"%d\",&n);\n a=ceil(sqrt(n));\n if(n%a==0){\n b=ceil(n/a);}\n else{b=ceil(n/a)+1;}\n printf(\"%d\",2*(a+b));\n}\n\n"}, {"source_code": "#include\n#include\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint x = pow(n,0.5);\n\t//printf(\"%d\\n\",x);\n\tint l = pow(x,2);\n\tint k = 4*x;\n\tint z = n-l;\n\tif(x < z)\n\t\tk = k+4;\n\telse if(z)\n\t\tk+=2;\n\tprintf(\"%d\\n\",k);\n\n\treturn 0;\n\n}"}, {"source_code": "#include\n#include \nint main(){\n int sqr,input,k2;\n scanf(\"%d\",&input);\n sqr=sqrt(input);\n k2=sqr;\n while(sqr*k2\n#include\nint main()\n{\n long long int N;\n scanf(\"%lld\",&N);\n long long int H,W;\n H=sqrt(N);\n W=N/H;\n // printf(\"%lld %lld\",H,W);\n if(H*W>=N)\n {\n printf(\"%lld\",2*(H+W));\n }\n else\n {\n printf(\"%lld\",2*(H+W+1));\n }\n \n}\n"}, {"source_code": "#include\nint main()\n{ int n,i,x,t,r;\n scanf(\"%d\",&n);\nt=2*(n+1);\n for(i=1;i\n#include\n#include\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tdouble a=sqrt(n);\n\tint b=ceil(a);\n\tint count=0;\n\twhile(n>0)\n\t{\n\t\tn-=b;\n\t\tcount++;\n\t}\n\tprintf(\"%d\\n\",2*b+2*count);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n int n,k,x,y1,y2,z1,z2,a;\n\n scanf(\"%d\",&n);\n\n if(n==1){\n printf(\"4\");\n }\n else if(n==2){\n printf(\"6\");\n }\n\n else {\n k=sqrt(n);\n x=k+1;\n y1=k*k;\n y2=x*x;\n z1=n-y1;\n z2=y2-n;\n\n if(z1a*a){\n printf(\"%d\",(a*4)+2);\n }\n }\n else if(z1>z2){\n a=x;\n if(n<=a*a){\n printf(\"%d\",a*4);\n }\n else if(n>a*a){\n printf(\"%d\",(a*4)+2);\n }\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int n,r;\n scanf(\"%d\",&n);\n r = sqrt(n);\n if(r*r == n)\n printf(\"%d\\n\",4*r);\n else if(n <= r*r + r)\n printf(\"%d\\n\",4*r+2);\n else\n printf(\"%d\\n\",4*r+4);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int N,sqrt_N;\n double avg;\n scanf(\"%d\",&N);\n sqrt_N=sqrt(N);\n if(sqrt_N*sqrt_N==N)\n printf(\"%d\",sqrt_N*4);\n else\n {\n avg=((sqrt_N)*(sqrt_N)+(sqrt_N+1)*(sqrt_N+1))/2.0;\n if(avg>N)\n printf(\"%d\",((sqrt_N+1)*2)+(sqrt_N*2));\n else\n printf(\"%d\",(sqrt_N+1)*4);\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(void) {\n\t// your code goes here\n\t\n\tint i = 1,near,remaining,output;\n\tfloat count;\n\tscanf(\"%f\",&count);\n\twhile((count/i)>i)\n\t{\n\t\ti++;\n\t\t\n\t}\n\t//near = i;\n\tif(i*i != count)\n\t{\n\t i = i-1;\t\n\t}\n\tremaining = count - i*i;\n\tif(remaining == 0)\n\t{\n\t\toutput = i*4;\n\t\tprintf(\"%d\",output);\n\t}\n\telse if(remaining <=i && remaining !=0)\n\t{\n\t\toutput = i*4 + 2;\n\t\tprintf(\"%d\",output);\n\t}\n\telse\n\t{\n\t\toutput = i*4 + 4;\n\t\tprintf(\"%d\",output);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\nint n;\nscanf(\"%d\",&n);\n int k=(int)sqrt(n);\n//int k=\n//printf(\"%d\",m);\nif(n==k*k)\n{\n printf(\"%d\",4*k);\n}\nelse if(n-(k*k)<=k)\n{\n printf(\"%d\",3*k+2+n-(k*k)+k-(n-k*k));\n}\nelse if(n-(k*k)>k)\n{\n printf(\"%d\",3*k+4+n-(k*(k+1))+k-(n-k*(k+1)));\n}\n\n\n\n}\n"}, {"source_code": "#include\n\nint main(){\n\tint n, a, b, best=100000000;\n\tscanf(\"%d\", &n);\n\tfor(a=1;a<=n;++a){\n\t\tb=n/a+(n%a!=0);\n\t\tif(2*(a+b)\n\nint main()\n{\n int n,weight,height,p,minP;\n scanf(\"%d\",&n);\n weight = 1;\n while(weight <= n)\n {\n if(n % weight ==0)\n height = n/weight;\n else\n height = n/weight + 1;\n p = 2*(height+weight);\n if(weight == 1)\n minP = p;\n else\n if(p < minP)\n minP = p;\n weight++;\n }\n printf(\"%d\",minP);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int n,ans,a;\n scanf(\"%d\",&n);\n a=sqrt(n);\n if(a*a==n)\n ans=a*4;\n else\n {\n if((a+1)*a\n#include\n\nint main()\n{\n int num,root;\n double root2;\n scanf(\"%d\",&num);\n root=sqrt(num);\n if(root*root==num)\n printf(\"%d\\n\",root*4);\n else\n {\n double res=(num*1.0)/root;\n root2=ceil(res);\n int ans=(root2+root)*2.0;\n printf(\"%d\\n\",ans);\n }\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n#include \n\n#define MAX 1000010\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint main(){\n long long n, i, j, k, x, y, z, res;\n\n while (scanf(\"%lld\", &n) != EOF){\n res = 1LL << 60;\n for (i = 1; i <= n; i++){\n x = n / i, y = n % i;\n if (y == 0){\n z = 2 * (x + i);\n if (z < res) res = z;\n }\n else{\n z = 2 * (x + i) + 2;\n if (z < res) res = z;\n }\n }\n\n printf(\"%lld\\n\", res);\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main(){\n int n,i,y=2,result=0,min=4;\n int inc=4;\n double z;\n scanf(\"%d\",&n);\n for(i=1;i\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int k=sqrt(n);\n int a=n/k;\n int p=0;\n int l=n%k;\n p=k+2*a;\n if(l==1)\n p+=3+(k-l);\n else if(l==0)\n p+=k-l;\n else if(l>1)\n p+=2+l+k-l;\n printf(\"%d\",p);\n return 0;\n}"}, {"source_code": "#include\n\nlong long isquare(long long n)\n{\n long long i;\n if(n==1)return 1;\n else if(n==4)return 2;\n else if(n==9)return 3;\n else if(n==16)return 4;\n else if(n==25)return 5;\n else if(n==36)return 6;\n else if(n==49)return 7;\n else if(n==64)return 8;\n else if(n==81)return 9;\n for(i=10;i<=n/10;i++)\n if(i*i==n)\n return i;\n return 0;\n}\nmain()\n{\n long long n,ans,min,a,b,val,n1;\n scanf(\"%lld\",&n);\n n1=n;\n if(isquare(n))\n {\n ans=4*isquare(n);\n printf(\"%lld\",ans);\n return 0;\n }\n else\n {\n while(!isquare(n))\n n++;\n val=isquare(n);\n a=4*isquare(n);\n b=(val+(val-1))*2;\n min=a\nint main(){\n int n,p=0,p2=0;\n scanf(\"%d\",&n);\n for(int i=0;i<=n/2+1;i++){\n if(i*i==n){\n p=i;\n break;\n }\n if(i*i>n){\n p2=i;\n break;\n }\n }\n if(p!=0)\n printf(\"%d\",p*4);\n if(p2!=0){\n if(p2*(p2-1)>=n)\n printf(\"%d\",p2*4-2);\n else\n printf(\"%d\",p2*4);\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \nint main()\n{\n int N,k,n,ans;\n scanf(\"%i\",&N);\n n=sqrt(N)+.5;\n k=N-n*n;\n ans = 4*n+2*((k+n-1)/n);\n //printf(\"%i\\nans=%i\\tk=%i\",n,ans,k);\n printf(\"%i\",ans);\n //system(\"pause\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tif(n==2)\n\tprintf(\"6\");\n\telse if(n==3)\n\tprintf(\"8\");\n\telse if(sqrt(n)-(int)sqrt(n)==0)\n\tprintf(\"%d\",(int)sqrt(n)*4);\n\telse\n\t{\n\t\tint s=sqrt(n);\n\t\tint res=4*s;\n\t\tint y=n-s*s;\n\t\tif(y<=s)\n\t\tprintf(\"%d\",res+2);\n\t\telse\n\t\tprintf(\"%d\",res+4);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\n#include\n\nint main()\n{\n int num,root;\n double root2;\n scanf(\"%d\",&num);\n root=sqrt(num);\n if(root*root==num)\n printf(\"%d\\n\",root*4);\n else\n {\n double res=(num*1.0)/root;\n root2=ceil(res);\n int ans=(root2+root)*2.0;\n printf(\"%d\\n\",ans);\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main()\n{\n\tint i,j,k,l,m,n,q;\n\tscanf(\"%d\",&n);\n\tq=sqrt(n);\n\tm=(n-(q*q))/q;\n\tif((n-(q*q))%q!=0)\n\tm++;\n\tm*=2;\n\tm+=q*4;\n\tprintf(\"%d\\n\",m);\n\t\n\treturn 0;\n}"}, {"source_code": "#include \nint main(){\n\tlong x=1,min,p,n;\n\tscanf(\"%d\",&n);\n\tmin=(n+x)*2;\n\twhile(x<=(n/2)){\n\t\tx++;\n\t\tif(n%x>0){\n\t\t\tp=(((n/x)+(x+1))*2);\n\t\t}\n\t\telse{\n\t\t\tp=(((n/x)+x)*2);\n\t\t}\n\t\tif (p<=min){\n\t\t\tmin=p;\n\t\t}\n\t}\n\tprintf(\"%d\",min);\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n int a,b,n,p;\n scanf(\"%d\",&n);\n a=ceil(sqrt(n));\n if(n%a==0){\n b=ceil(n/a);}\n else{b=ceil(n/a)+1;}\n printf(\"%d\",2*(a+b));\n}\n\n"}, {"source_code": "#include \n\nint main(void) {\n\t// your code goes here\n\t\n\tint i = 1,near,remaining,output;\n\tfloat count;\n\tscanf(\"%f\",&count);\n\twhile((count/i)>i)\n\t{\n\t\ti++;\n\t\t\n\t}\n\t//near = i;\n\tif(i*i != count)\n\t{\n\t i = i-1;\t\n\t}\n\tremaining = count - i*i;\n\tif(remaining == 0)\n\t{\n\t\toutput = i*4;\n\t\tprintf(\"%d\",output);\n\t}\n\telse if(remaining <=i && remaining !=0)\n\t{\n\t\toutput = i*4 + 2;\n\t\tprintf(\"%d\",output);\n\t}\n\telse\n\t{\n\t\toutput = i*4 + 4;\n\t\tprintf(\"%d\",output);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int blocks,i=0;\n scanf(\"%d\", &blocks);\n while(i*i<=blocks)\n {\n ++i;\n }\n --i;\n int szeleszama=4*i;//i*i s negyzet oldala\n if(blocks-i*i>i)\n {\n szeleszama+=4;\n }\n else if(blocks==i*i)\n {\n //nothing really xd\n }\n else\n {\n szeleszama+=2;\n }\n printf(\"%d\",szeleszama);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int a,c,d,e,f,g;\n double b;\n\n d = 4;\n f = 2;\n scanf(\"%d\", &a);\n b = sqrt(a);\n c = sqrt(a);\n e = c*c;\n g = c*d;\n if(b-c == 0)\n {\n printf(\"%d\", g);\n }\n else if(a-e <= c)\n {\n printf(\"%d\", g+f);\n }\n else\n {\n printf(\"%d\", g+d);\n }\n return 0;\n}\n"}, {"source_code": "#include\n\nint main(){\n\n int m;\n scanf(\"%d\",&m);\n for(int i=0;i<1200;i++){\n if(i*i >= m){\n printf(\"%d\\n\",4*i);\n break;\n }\n else if(i*i + i >= m){\n printf(\"%d\\n\",4*i + 2);\n break;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nint minperi(int a)\n{\n\tfor(int i=1;;i++)\n\t{\n\t\tif(i*(i-1)>=a)\n\t\t\treturn 4*i-2;\n\t\telse if(i*i>=a)\n\t\t\treturn 4*i;\n\t}\n}\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tprintf(\"%d\",minperi(n));\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n,i,j,k;\n scanf(\"%lld\",&n);\n for(i=0;in)\n {\n i--;break;\n }\n }\n k=n-i*i;if(n!=2){\n if(k!=0){\n if(k<=i)\n {\n printf(\"%lld\",i*4+2);\n }\n else\n {\n printf(\"%lld\",i*4+4);\n }}\n else\n printf(\"%lld\",4*i);}\n else\n printf(\"6\");\n return 0;\n}\n"}, {"source_code": "main(n){scanf(\"%d\",&n);printf(\"%.f\",2*ceil(2*sqrt(n)));}"}, {"source_code": "#include \n#include \n\nint main()\n{\n\tint n,x,m,y,ans,z;\n\tscanf(\"%d\",&n);\n\tm=floor(sqrt(n));\n\tx=(n-(m*m))/m;\n\ty=(n-(m*m))%m;\n\tans=(4*m);\n\tif((x==0&&y>0)||(x==1&&y==0))\n\t ans+=2;\n\telse if(x==0&&y==0){}\n\telse\n\t ans+=4;\n\tprintf(\"%d\",ans);\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int blocks,i=0;\n scanf(\"%d\", &blocks);\n while(i*i<=blocks)\n {\n ++i;\n }\n --i;\n int szeleszama=4*i;//i*i s negyzet oldala\n if(blocks-i*i>i)\n {\n szeleszama+=4;\n }\n else if(blocks==i*i)\n {\n //nothing really xd\n }\n else\n {\n szeleszama+=2;\n }\n printf(\"%d\",szeleszama);\n return 0;\n}\n"}, {"source_code": "#include \nint main() {\n int n,sum=0,temp;\n scanf(\"%d\",&n);\n for(int i=1;i*i<=n;i++) {\n if(i*i<=n) {\n temp=i;\n }\n }\n if(n-temp*temp==0) {\n sum=4*temp;\n }\n else if(n-temp*temp>temp) {\n sum=4*temp+4;\n }\n else if(n-temp*temp<=temp){\n sum=4*temp+2;\n }\n printf(\"%d\\n\",sum);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main(void)\n{\n long long N,x,y,sum;\n scanf(\"%lld\",&N);\n x = sqrt(N);\n y = N-x*x;\n if(y==0){\n sum = 4*x;\n }\n else if(y>0 && y<=x){\n sum = 4*x+2;\n }\n else{\n sum = 4*x+4;\n }\n printf(\"%lld\",sum);\n return 0;\n}"}, {"source_code": "#include\n#include\nint main(void)\n{\nunsigned long long int N; // upto order 10^6\nscanf(\" %llu\", &N );\nunsigned long long int squareorder = sqrt(N);\nunsigned long long int order = N - (squareorder * squareorder);\nunsigned long long int perimeter ;\nif(order == 0)\n perimeter = 4 * squareorder;\nelse if(order > squareorder)\n perimeter = 4 * squareorder + 4 * order - 2 * order - 2 * (order - 1) + 2;\nelse\n perimeter = 4 * squareorder + 4 * order - 2 * order - 2 * (order - 1);\nprintf(\"%llu\\n\",perimeter);\nreturn 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n\tint N,w,h;\n\tscanf(\"%d\",&N);\n\tw=sqrt(N);\n\th=N/w;\n\tif(w*h==N)\n\tprintf(\"%d\",2*(w+h));\n\tif(w*h!=N){\n\t\t\n\tprintf(\"%d\",2*(w+h)+2);\n}\n } \n"}, {"source_code": "#include\n#include\nint main()\n{\n int a,n;\n scanf(\"%d\",&n);\n a = 2*ceil(2*sqrt(n));\n printf(\"%d\",a);\n return 0;\n}\n"}, {"source_code": "#include\n#include \nint main(){\n int sqr,input,k2;\n scanf(\"%d\",&input);\n sqr=sqrt(input);\n k2=sqr;\n while(sqr*k2\n#include\n\n\n\nint main(){\nint n;\nscanf(\"%d\",&n);\nint sq=n;\nwhile(sqrt(sq)!=(int)sqrt(sq)){\nsq++;\n}\n\nint peri=4*sqrt(sq);\nint d=sq-n;\nint val=0;\nint a=sqrt(sq);\nif(d>=a){\nval=val+2;\nd=d-a;\na--;}\nint cnt=0;\n\nwhile(d!=0){\ncnt++;\nif(d>=a){\nval=val+2;\nd=d-a;\n}\nif(d\nint main()\n{\n long long int n,i,k,d=1,a;\n scanf(\"%lld\",&n);\n if(n==1)\n printf(\"4\");\n else\n if(n==2)\n printf(\"6\");\n else\n {\n for(i=1;i=n)\n {\n k=i;\n break;\n }\n }\n for(i=k;i>=0;i--)\n {\n if(k*i\n#include \n\nint main(){\n float h;\n int n;\n scanf(\"%d\",&n);\n printf(\"%.0f\",2*ceil(2*sqrt(n)));\n\n}\n\n"}, {"source_code": "#include\n\nint main()\n{\n long long N;\n long long squares[1005];\n long long maxsquare;\n long long maxlines;\n long long remainder;\n long long squareside;\n long long perimeter;\n int i;\n for(i=0;i<=1000;i++) squares[i]=i*i;\n \n scanf(\"%lld\",&N);\n for(i=1;i<=1000;i++)\n {\n maxsquare=squares[i];\n squareside=i;\n if(squares[i+1]>N) break;\n }\n\n remainder=N-maxsquare;\n maxlines=remainder/squareside;\n remainder=remainder-maxlines*squareside;\n\n perimeter=4*squareside;\n if(maxlines>0) perimeter+= 2*maxlines;\n if(remainder>0) perimeter+=2;\n printf(\"%lld\\n\",perimeter);\n return 0;\n}\n"}, {"source_code": "\n#include\nint main()\n{\n long long int n,i,k,d=1,a;\n scanf(\"%lld\",&n);\n if(n==1)\n printf(\"4\");\n else\n if(n==2)\n printf(\"6\");\n else\n {\n for(i=1;i=n)\n {\n k=i;\n break;\n }\n }\n for(i=k;i>=0;i--)\n {\n if(k*i\n#include\nint main()\n{int n,d;\nfloat b,a;\nscanf(\"%f\",&a);\nb=sqrt(a);\nd=b;\nif(b==d)\n {\n printf(\"%d\",d*4);}\n\nelse {\nn=((d+1)*(d+1)-d*d)/2;\n if(d*d+n>=a)\n printf(\"%d\",d*4+2);\nelse\n printf(\"%d\",(d+1)*4);\n }\n}\n"}, {"source_code": "#include\n#include\nint main(){\n int num;\n scanf(\"%d\",&num);\n int a = (int)sqrt(num);\n if(num - a*a >a)\n a = 4*a + 4;\n else if(num - a*a>0)\n a = 4*a +2;\n else if(num - a*a==0)\n a = 4*a;\n printf(\"%d\",a);\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \n#include \n#include \n\n#define MAX 1000010\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint main(){\n long long n, i, j, k, x, y, z, res;\n\n while (scanf(\"%lld\", &n) != EOF){\n res = 1LL << 60;\n for (i = 1; i <= n; i++){\n x = n / i, y = n % i;\n if (y == 0){\n z = 2 * (x + i);\n if (z < res) res = z;\n }\n else{\n z = 2 * (x + i) + 2;\n if (z < res) res = z;\n }\n }\n\n printf(\"%lld\\n\", res);\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\nlong long arr[2000001],brr[2000001],mod=1000000000+7;\nchar str[2000001],s1[2000001];\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}\nlong long power(long long x, long long int y, long long p)\n{\n\tlong long int res = 1;\n\tx = x % p; \n\twhile (y > 0)\n\t{\n\t\tif (y & 1)\n\t\t\tres = (res*x) % p;\n\t\ty = y>>1; // y = y/2\n\t\tx = (x*x) % p; \n\t}\n\treturn res;\n}\nint main()\n{\n\tlong long int sum=0,a,b,x,y,n, m,temp,flag=0,index,len, i, j, k, count=0, ans=0;\n\tscanf(\"%lld\", &n);\n\t/*\t\n\t\tscanf(\"%s\", s1);\n\t\tlen=strlen(s1);\n\t\tfor(i=0;i\n\nint main()\n{\n int n,i,j,k,c=0,p=0,z=1,a;\n\n scanf(\"%d\",&n);\n if(n==1){\n p=4;\n printf(\"%d\\n\",p);\n return 0;\n }\n else if(n==2){\n p=6;\n printf(\"%d\\n\",p);\n return 0;\n }\n else if(n==3){\n p=8;\n printf(\"%d\\n\",p);\n return 0;\n }\n else{\n p = 8;\n a=1;\n for(i=1;i<=n-3;i=i+k){\n k=0;\n if(a==1){\n for(j=1;j<=z;j++){\n p=p;\n k++;\n }\n a=0;\n }\n else if(a==0){\n p=p+2;\n c++;\n if(c==2){\n c=0;\n z++;\n }\n a=1;\n k++;\n }\n }\n printf(\"%d\\n\",p);\n return 0;\n }\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int n,ans,a;\n scanf(\"%d\",&n);\n a=sqrt(n);\n if(a*a==n)\n ans=a*4;\n else\n {\n if((a+1)*a\n#include \n\nint main()\n{\n int a,p;\n scanf(\"%d\",&a);\n int i,j;\n for(i=1; ;i++)\n for(j=1;j<=i;j++)\n {\n if(i*j>=a)\n {\n float x=4*sqrt(i*j);\n p=x;\n if(x!=p)\n p++;\n printf(\"%d\",p);\n return;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \nint main()\n{\n int N,k,n,ans;\n scanf(\"%i\",&N);\n n=sqrt(N)+.5;\n k=N-n*n;\n ans = 4*n+2*((k+n-1)/n);\n //printf(\"%i\\nans=%i\\tk=%i\",n,ans,k);\n printf(\"%i\",ans);\n //system(\"pause\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n \nint main(){\n \n long x;\n scanf(\"%ld\", &x);\n long a = sqrt(x);\n long perimeter = 0;\n \n if(a * a >= x) perimeter = 4 * a;\n else if(a * (a + 1) >= x) perimeter = 4 * a + 2;\n else if((a + 1) * (a + 1) >= x) perimeter = 4 * a + 4;\n \n printf(\"%ld\\n\", perimeter);\n \n return 0;\n}"}, {"source_code": "#include \n#include \n \nint main(){\n \n long x;\n scanf(\"%ld\", &x);\n long a = sqrt(x);\n long perimeter = 0;\n \n if(a * a >= x) perimeter = 4 * a;\n else if(a * (a + 1) >= x) perimeter = 4 * a + 2;\n else if((a + 1) * (a + 1) >= x) perimeter = 4 * a + 4;\n \n printf(\"%ld\\n\", perimeter);\n \n return 0;\n}"}, {"source_code": "#include \n#include \n#include \n#include\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tif(n==2)\n\tprintf(\"6\");\n\telse if(n==3)\n\tprintf(\"8\");\n\telse if(sqrt(n)-(int)sqrt(n)==0)\n\tprintf(\"%d\",(int)sqrt(n)*4);\n\telse\n\t{\n\t\tint s=sqrt(n);\n\t\tint res=4*s;\n\t\tint y=n-s*s;\n\t\tif(y<=s)\n\t\tprintf(\"%d\",res+2);\n\t\telse\n\t\tprintf(\"%d\",res+4);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n#include \ndouble hj(int n)\n{\n return ceil(2*sqrt(n));\n}\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"%.0f\",2*hj(n));\n\n}"}, {"source_code": "main(n){scanf(\"%d\",&n);printf(\"%.f\",2*ceil(2*sqrt(n)));}"}, {"source_code": "#include \n#include \n#include \n#include \n\nint gcd(int a,int b)\n{\n\tif(b==0)\n\t\treturn a;\n\tgcd(b,a%b);\n}\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint p=sqrt(n);\n\tint q=p*4;\n\n\tint r=n-(p*p);\n\twhile(r>=p)\n\t{\n\t\tr-=p;\n\t\tq+=2;\n\t}\n\tif(r>0)\n\t\tq+=2;\n\tprintf(\"%d\\n\",q);\n\n\treturn 0;\n\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n int n,k,x,y1,y2,z1,z2,a;\n\n scanf(\"%d\",&n);\n\n if(n==1){\n printf(\"4\");\n }\n else if(n==2){\n printf(\"6\");\n }\n\n else {\n k=sqrt(n);\n x=k+1;\n y1=k*k;\n y2=x*x;\n z1=n-y1;\n z2=y2-n;\n\n if(z1a*a){\n printf(\"%d\",(a*4)+2);\n }\n }\n else if(z1>z2){\n a=x;\n if(n<=a*a){\n printf(\"%d\",a*4);\n }\n else if(n>a*a){\n printf(\"%d\",(a*4)+2);\n }\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(void)\n{\n\tint n, r, l, f = 0;\n\tscanf(\"%d\", &n);\n\tfor (l = 1 ;; l = l + 1)\n\t{\n\t\tfor (r = l - 1; r <= l; r = r + 1)\n\t\t{\n\t\t\tif (r * l >= n)\n\t\t\t{\n\t\t\t\tprintf(\"%d\", 2 * (r + l));\n\t\t\t\tf = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (f)\n\t\t\tbreak;\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \nint x,n,k,t;\n\nint main(void) {\n scanf(\"%d\",&t);\n n=sqrt(t);\n if(n*n==t){\n printf(\"%d\",4*n);\n }else{\n n++;\n k=2*(t/n)+2*n;\n if(t%n!=0){\n k=k+2;\n }\n printf(\"%d\",k);\n }\n\treturn 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n long long int n,i,j,k;\n scanf(\"%lld\",&n);\n for(i=0;in)\n {\n i--;break;\n }\n }\n k=n-i*i;if(n!=2){\n if(k!=0){\n if(k<=i)\n {\n printf(\"%lld\",i*4+2);\n }\n else\n {\n printf(\"%lld\",i*4+4);\n }}\n else\n printf(\"%lld\",4*i);}\n else\n printf(\"6\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n int a = sqrt(n), b;\n if(n % a) {\n b = n / a + 1;\n } else {\n b = n / a;\n }\n printf(\"%d\\n\", 2 * (a + b));\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main ()\n\n{\n int n,i,full,square,rest;\n double root;\n scanf (\"%d\",&n);\n if (n==1||n==2||n==3)\n {\n if (n==1)\n {\n printf (\"4\");\n return 0;\n }\n else if (n==2)\n {\n printf (\"6\");\n return 0;\n }\n else\n {\n printf (\"8\");\n return 0;\n }\n }\n else {\n\n root = sqrt(n);\n full = floor(root);\n if (root==full)\n {\n printf (\"%d\",4*full);\n return 0;\n }\n else\n {\n square = pow(full,2);\n rest = n - square;\n if (rest<=full)\n {\n printf (\"%d\",(4*full)+2);\n return 0;\n }\n else if (rest>full)\n {\n if (rest%full==0)\n {printf (\"%d\",(4*full)+((rest/full)*2));\n return 0;}\n else\n {\n printf (\"%d\",(4*full)+2+((rest/full)*2));\n return 0;\n }\n\n }\n }\n }\n}\n"}], "negative_code": [{"source_code": "#include\n#include\n\nint main(void){\nint a,c;\nscanf(\"%d \",&a);\nint d;\nd= sqrt(a);\n\nint e=a-d*d;\nif(e==0){\n printf(\"%d\",d*4);\n}\nelse if((e/d)>0){\n int b=e/d;\n c= (b+d)*2 +d*2;\n int f= e%d;\n if(f==1){\n c=c+f*2;\n }\n else if(f==0){\n printf(\"%d\",c);\n }\n else{\n c=c+2;\n printf(\"%d\",c);\n }\n \n\n}\nelse{\n int w;\n if(e==1){\n w= d*4 +e*2;\n }\n else{\n w=d*4+2;\n }\n printf(\"%d\",w);\n}\n\n}\n \n \n\n"}, {"source_code": "#include\n#include\n#include\n#include\nlong long arr[2000001],brr[2000001],mod=1000000000+7;\nchar str[2000001],s1[2000001];\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}\nlong long power(long long x, long long int y, long long p)\n{\n\tlong long int res = 1;\n\tx = x % p; \n\twhile (y > 0)\n\t{\n\t\tif (y & 1)\n\t\t\tres = (res*x) % p;\n\t\ty = y>>1; // y = y/2\n\t\tx = (x*x) % p; \n\t}\n\treturn res;\n}\nint main()\n{\n\tlong long int sum=0,a,b,x,y,n, m,temp,flag=0,index,len, i, j, k, count=0, ans=0;\n\tscanf(\"%lld\", &n);\n\t/*\t\n\t\tscanf(\"%s\", s1);\n\t\tlen=strlen(s1);\n\t\tfor(i=0;i\n#include \n\nint main()\n{\n int a,p;\n scanf(\"%d\",&a);\n int i,j;\n for(i=1; ;i++)\n for(j=1;j<=i;j++)\n {\n if(i*j>=a)\n {\n p=4*sqrt(i*j);\n printf(\"%d\",p);\n return;\n }\n }\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \nint main()\n{\nint j;\nint n;\nscanf(\"%d\",&n);\n\tj = (int)(4*(sqrt(n))+0.999);\nprintf(\"%d\",j);\n}"}, {"source_code": "#include \n\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tint squares[10*10*10];\n\tfor (int i=1;i<10*10*10;i++){\n\t\tsquares[i]=i*i;\n\t}\n\tint k=1;\n\twhile(n>squares[k]){\n\t\tk++;\n\t}\n\tif(n==squares[k]){\n\t\tprintf(\"%d\",4*k);\n\t}\n\telse{\n\t\tif((k-1)!=1){\n\t\t\tprintf(\"%d\",4*(k-1)+2*((n-squares[k-1])/(k-1)+1));\n\t\t}\n\t\telse{\n\t\t\tprintf(\"%d\",4*(k-1)+2*((n-squares[k-1])/(k-1)));\n\t\t}\n\t}\n}"}, {"source_code": "#include \n#include \nint main ()\n\n{\n int n,i,full,square,rest;\n double root;\n scanf (\"%d\",&n);\n if (n==1||n==2||n==3)\n {\n if (n==1)\n {\n printf (\"4\");\n return 0;\n }\n else if (n==2)\n {\n printf (\"6\");\n return 0;\n }\n else\n {\n printf (\"8\");\n return 0;\n }\n }\n else {\n\n root = sqrt(n);\n full = floor(root);\n if (root==full)\n {\n printf (\"%d\",4*full);\n return 0;\n }\n else\n {\n square = pow(full,2);\n rest = n - square;\n if (rest<=full)\n {\n printf (\"%d\",(4*full)+2);\n return 0;\n }\n else if (rest>full)\n {\n if ((rest)%(full-1)==0)\n {\n printf (\"%d\",(4*full)+(2*(rest/(full)))+(2*(rest%(full))));\n return 0;\n }\n else\n {\n printf (\"%d\",(4*full)+(2*(rest/(full))+2));\n return 0;\n\n }\n }\n }\n }\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,m,r,d=2,s,t;\n scanf(\"%d\",&n);\n for(m=1;(m)*(m)<=n;m++)\n {\n if(m*m==n)\n {\n r=4*m;\n }\n else\n {\n d++;\n s=4*d;\n t=2*d+2*d-1;\n }\n }\nif((m-1)*(m-1)==n)\nprintf(\"%d\",r);\nelse\n{\n if((m-1)*(m-2)>n)\n printf(\"%d\",t);\n else\n printf(\"%d\",s);\n}\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n\nint PW(int a);\n\nint main()\n{\n\n int n;\n scanf(\"%d\",&n);\n\n int k=1;\n int t=1;\n while(k<=n)\n {\n if(k==n)\n {\n printf(\"%d\\n\",4*t);\n exit(0);\n }\n t++;\n k=PW(t);\n }\n\n int rem = n - PW(t-1);\n \n int res = 4*(t-1) + (2*((rem/(t-1))+1));\n printf(\"%d\\n\",res);\n return 0;\n}\n\nint PW(int a)\n{\n return a*a;\n}\n"}, {"source_code": "#include \nint main()\n{\n\tlong i,j,n,k=0,z;\n\tscanf(\"%d\",&n);\n if (n==1){\n\t\tprintf(\"%d\",4);\n }else{\n\tfor (i=0;i\n#include\n\nint main(void){\nint a,c;\nscanf(\"%d \",&a);\nint d;\nd= sqrt(a);\n\nint e=a-d*d;\nif(e==0){\n printf(\"%d\",d*4);\n}\nelse if((e/d)>0){\n int b=e/d;\n c= (b+d)*2 +d*2;\n int f= e%d;\n if(f==1){\n c=c+f*2;\n }\n else if(f==0){\n printf(\"%d\",c);\n }\n else{\n c=c+2;\n printf(\"%d\",c);\n }\n \n\n}\nelse{\n int w;\n if(e==1){\n w= d*4 +e*2;\n }\n else{\n w=d*4+2;\n }\n printf(\"%d\",w);\n}\n\n}\n \n \n\n"}, {"source_code": "#include \n\nint main()\n{\n int n,i,j,k,c=0,p=0,z=1,a;\n\n scanf(\"%d\",&n);\n if(n==1){\n p=4;\n printf(\"%d\\n\",p);\n return 0;\n }\n else if(n==2){\n p=6;\n printf(\"%d\\n\",p);\n return 0;\n }\n else if(n==3){\n p=8;\n printf(\"%d\\n\",p);\n return 0;\n }\n else{\n p = 8;\n a=1;\n for(i=4;i<=n;i=i+k){\n k=0;\n if(a==1){\n for(j=1;j<=z;j++){\n p=p;\n k++;\n }\n a=0;\n }\n else if(a==0){\n p=p+2;\n c++;\n if(c==2){\n c=0;\n z++;\n }\n a=1;\n }\n }\n printf(\"%d\\n\",p-2);\n return 0;\n }\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint x = pow(n,0.5);\n\t//printf(\"%d\\n\",x);\n\tint l = pow(x,2);\n\tint k = 4*x;\n\tint z = n-l;\n\tif(z == 0)\n\t\tprintf(\"%d\\n\",k);\n\telse if(z < x)\n\t\tprintf(\"%d\\n\",k+2);\n\telse\n\t\tprintf(\"%d\\n\",k+4);\n\treturn 0;\n\n}"}, {"source_code": "#include\n#include\nint main()\n{\n int n,a,t;\n scanf(\"%d\",&n);\n a = ((2*sqrt(n))+ 0.9);\n t =(2*a);\n printf(\"%d\",t);\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int N,i,j,a=0,b=0;\n scanf(\"%d\",&N);\n for(i=0;i<=265;i++){\n a=i*i;\n if(a>=N){\n a=i; //printf(\"a=%d\\n\",a);\n break;\n }\n }\n for(j=i;j>=1;j--){\n b=j*a;\n // printf(\"B0=%d %d\\n\",b,j);\n if(b==N){\n b=j; //printf(\"b1=%d\\n\",b);\n break;\n }\n else if (b\n#include\nint main()\n{\n int n,a,t;\n scanf(\"%d\",&n);\n a = ((2*sqrt(n))+ 0.99);\n t =(2*a);\n printf(\"%d\",t);\n}\n\n"}, {"source_code": "#include \n#include \n#include \nint main()\n{\nint j;\nint n;\nscanf(\"%d\",&n);\nif ((sqrt(n)-(int)(sqrt(n))<0.0005))\n\tj = (int)(4*(sqrt(n)));\nelse\n\tj = (int)(4*(sqrt(n))+1);\nprintf(\"%d\",j);\n}"}, {"source_code": "#include\n#include\n#include\n\nint main(){\n int n;\n scanf(\"%d\", &n);\n int square = 1;\n int closest = n;\n int value;\n while(square*square <= n){\n if (n-square*square < closest){\n closest = n-square*square;\n value = square;\n }\n square++;\n }\n int ans;\n if (closest != 0)\n ans = value*4 + 2 + closest;\n else if (closest == 0)\n ans = value*4;\n if ((value+1)*(value+1) - n < closest)\n ans = (value+1)*4;\n printf(\"%d\", ans);\n\n\n\n}\n"}, {"source_code": "#include\n#include\nint main(void)\n{\nunsigned long long int N; // upto order 10^6\nscanf(\" %llu\", &N );\nunsigned long long int squareorder = sqrt(N);\nunsigned long long int order = N % (squareorder * squareorder);\nunsigned long long int perimeter ;\nif(order == 0)\n perimeter = 4 * squareorder;\nelse if(order > squareorder)\n perimeter = 4 * squareorder + 4 * order - 2 * order - 2 * (order - 1) + 2;\nelse\n perimeter = 4 * squareorder + 4 * order - 2 * order - 2 * (order - 1);\nprintf(\"%llu\\n\",perimeter);\nreturn 0;\n}"}, {"source_code": "#include \n#include \nint main()\n{\n\tlong long int n,z;\n\tscanf(\"%lld\",&n);\n\tdouble k;\n\tk=sqrt(n);\n\t{\n\tz=floor(k);\n\tif ((z)*(z)==n)\n\t\t{printf(\"%lld\",2*n);return 0;}\n\telse if (z*(z+1)>n && z*z\nint main()\n{\n long long int n,i,k,d,a;\n scanf(\"%lld\",&n);\n for(i=1;i=n)\n {\n k=i;\n break;\n }\n }\n for(i=k;i>0;i--)\n {\n if(k*i\n#include\n\nint main(void){\nint a,c;\nscanf(\"%d \",&a);\nint d;\nd= sqrt(a);\n\nint e=a-d*d;\nif(e==0){\n printf(\"%d\",d*4);\n}\nelse if((e/d)>0){\n int b=e/d;\n c= (b+d)*2 +d*2;\n int f= e%d;\n if(f==1){\n c=c+f*2;\n }\n else if(f==0){\n printf(\"%d\",c);\n }\n else{\n c=c+2;\n printf(\"%d\",c);\n }\n \n\n}\nelse{\n int w;\n if(e==1){\n w= d*4 +e*2;\n }\n else{\n w=d*4+2;\n }\n printf(\"%d\",w);\n}\n\n}\n \n \n\n"}, {"source_code": "#include\nint main()\n{\n long long int N,i,p,t,q,r;\n scanf(\"%lld\",&N);\n if(N%2==0)\n {\n p=N/2;\n for(i=0;i!=-1;i=i+1)\n {\n r=i;\n q=(p-i)*(p-i);\n if(q\n#include\nint main()\n{\n int n,blck,root,ext;\n scanf(\"%d\",&n);\n root=(int)sqrt(n);\n blck=4*root;\n ext=n-root*root;\n if(!ext)\n {\n printf(\"%d\",blck);\n return 0;\n }\n else if(ext>root)\n {\n ext=ext/root;\n blck+=2*(ext+1);\n }\n else\n {\n blck+=2;\n }\n printf(\"%d\",blck);\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n\tlong long int n,z;\n\tscanf(\"%lld\",&n);\n\tdouble k;\n\tk=sqrt(n);\n\t{\n\tz=floor(k);\n\tif ((z)*(z)==n)\n\t\t{printf(\"%lld\",2*n);return 0;}\n\telse if (z*(z+1)>n && z*z\n#include \n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int x = sqrt(n);\n\n if(x*x==n) printf(\"%d\\n\",n*2);\n\n else{\n int dif = n - (x*x);\n\n if(dif>x) printf(\"%d\\n\",x*4+4);\n else printf(\"%d\\n\", x*4+2);\n }\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int n,i,j,k,c=0,p=0,z=1,a;\n\n scanf(\"%d\",&n);\n if(n==1){\n p=4;\n printf(\"%d\\n\",p);\n return 0;\n }\n else if(n==2){\n p=6;\n printf(\"%d\\n\",p);\n return 0;\n }\n else if(n==3){\n p=8;\n printf(\"%d\\n\",p);\n return 0;\n }\n else{\n p = 8;\n a=1;\n for(i=4;i<=n;i=i+k){\n k=0;\n if(a==1){\n for(j=1;j<=z;j++){\n p=p;\n k++;\n }\n a=0;\n }\n else if(a==0){\n p=p+2;\n c++;\n if(c==2){\n c=0;\n z++;\n }\n a=1;\n }\n }\n printf(\"%d\\n\",p-2);\n return 0;\n }\n}\n"}, {"source_code": "#include\n\nint main()\n{\n long N;\n long squares[1005];\n long maxsquare;\n long maxlines;\n long remainder;\n long squareside;\n long perimeter;\n int i;\n for(i=0;i<1000;i++) squares[i]=i*i;\n \n scanf(\"%ld\",&N);\n for(i=1;i<1000;i++)\n {\n maxsquare=squares[i];\n squareside=i;\n if(squares[i+1]>N) break;\n }\n\n remainder=N-maxsquare;\n maxlines=remainder/squareside;\n remainder=remainder-maxlines*squareside;\n\n perimeter=4*squareside;\n if(maxlines!=0) perimeter+= 2*maxlines;\n if(remainder!=0) perimeter+=2;\n printf(\"%ld\\n\",perimeter);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int n,a,t;\n scanf(\"%d\",&n);\n a = ((2*sqrt(n))+ 0.99);\n t =(2*a);\n printf(\"%d\",t);\n}\n\n"}, {"source_code": "#include \n#include \n#include \nint main()\n{\nint j;\nint n;\nscanf(\"%d\",&n);\nif ((sqrt(n)-(int)(sqrt(n))<0.00005))\n\tj = (int)(4*(sqrt(n)));\nelse\n\tj = (int)(4*(sqrt(n))+1);\nprintf(\"%d\",j);\n}"}, {"source_code": "#include\n#include\n\nint main(void){\nint a,c;\nscanf(\"%d \",&a);\nint d;\nd= sqrt(a);\n\nint e=a-d*d;\nif(e==0){\n printf(\"%d\",d*4);\n}\nelse if((e/d)>0){\n int b=e/d;\n c= (b+d)*2 +d*2;\n int f= e%d;\n if(f==1){\n c=c+f*2;\n }\n else{\n c=c+2;\n }\n printf(\"%d\",c);\n\n}\nelse{\n int w;\n if(e==1){\n w= d*4 +e*2;\n }\n else{\n w=d*4+2;\n }\n printf(\"%d\",w);\n}\n\n}\n \n \n\n"}, {"source_code": "#include\nint main()\n{\n int n,m,r,d=2,s,t;\n scanf(\"%d\",&n);\n for(m=1;(m)*(m)<=n;m++)\n {\n if(m*m==n)\n {\n r=4*m;\n }\n else\n {\n d++;\n s=4*d;\n t=2*d+2*d-1;\n }\n }\nif((m-1)*(m-1)==n)\nprintf(\"%d\",r);\nelse\n{\n if((m-1)*(m-2)>n)\n printf(\"%d\",t);\n else\n printf(\"%d\",s);\n}\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main(){\n int num;\n scanf(\"%d\",&num);\n int a = (int)sqrt(num);\n if(num - a*a >a)\n a = 4*a + 6;\n else if(num - a*a >0)\n a = 4*a +3;\n else if(num-a*a==0)\n a = 4*a;\n printf(\"%d\",a);\n return 0;\n}"}, {"source_code": "#include \n#include \nint main ()\n\n{\n int n,i,full,square,rest;\n double root;\n scanf (\"%d\",&n);\n if (n==1||n==2||n==3)\n {\n if (n==1)\n {\n printf (\"4\");\n return 0;\n }\n else if (n==2)\n {\n printf (\"6\");\n return 0;\n }\n else\n {\n printf (\"8\");\n return 0;\n }\n }\n else {\n\n root = sqrt(n);\n full = floor(root);\n if (root==full)\n {\n printf (\"%d\",4*full);\n return 0;\n }\n else\n {\n square = pow(full,2);\n rest = n - square;\n if (rest<=full)\n {\n printf (\"%d\",(4*full)+2);\n return 0;\n }\n else if (rest>full)\n {\n printf (\"%d\",(4*full)+2+((rest/full)*2));\n return 0;\n }\n }\n }\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int N,i,p,t,q,r;\n scanf(\"%lld\",&N);\n if(N%2==0)\n {\n p=N/2;\n for(i=0;i!=-1;i=i+1)\n {\n r=i;\n q=(p-i)*(p-i);\n if(q\n#include \n#include \n#include\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tif(sqrt(n)-(int)sqrt(n)==0)\n\tprintf(\"%d\",(int)sqrt(n)*4);\n\telse\n\t{\n\t\tint s=(int)sqrt(n);\n\t\tint res=4*s;\n\t\tint y=n-s*s;\n\t\tint b=y/s+1;\n\t\tprintf(\"%d\",res+2*b);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int a,c,d,e,f,g;\n double b;\n\n d = 4;\n e = c*c;\n f = 2;\n scanf(\"%d\", &a);\n b = sqrt(a);\n c = sqrt(a);\n g = c*d;\n if(b-c == 0)\n {\n printf(\"%d\", g);\n }\n else if(a-e >= c && a-e <= c*f)\n {\n printf(\"%d\", g+f);\n }\n else\n {\n printf(\"%d\", g+d);\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\nlong long arr[2000001],brr[2000001],mod=1000000000+7;\nchar str[2000001],s1[2000001];\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}\nlong long power(long long x, long long int y, long long p)\n{\n\tlong long int res = 1;\n\tx = x % p; \n\twhile (y > 0)\n\t{\n\t\tif (y & 1)\n\t\t\tres = (res*x) % p;\n\t\ty = y>>1; // y = y/2\n\t\tx = (x*x) % p; \n\t}\n\treturn res;\n}\nint main()\n{\n\tlong long int sum=0,a,b,x,y,n, m,temp,flag=0,index,len, i, j, k, count=0, ans=0;\n\tscanf(\"%lld\", &n);\n\t/*\t\n\t\tscanf(\"%s\", s1);\n\t\tlen=strlen(s1);\n\t\tfor(i=0;i\n#include \nint main ()\n\n{\n int n,i,full,square,rest;\n double root;\n scanf (\"%d\",&n);\n if (n==1||n==2||n==3)\n {\n if (n==1)\n {\n printf (\"4\");\n return 0;\n }\n else if (n==2)\n {\n printf (\"6\");\n return 0;\n }\n else\n {\n printf (\"8\");\n return 0;\n }\n }\n else {\n\n root = sqrt(n);\n full = floor(root);\n if (root==full)\n {\n printf (\"%d\",4*full);\n return 0;\n }\n else\n {\n square = pow(full,2);\n rest = n - square;\n if (restfull)\n {\n if ((rest)%(full-1)==0)\n {\n printf (\"%d\",(4*full)+(2*(rest/(full-1))));\n return 0;\n }\n else\n {\n printf (\"%d\",(4*full)+(2*((rest/(full-1))+1)));\n return 0;\n\n }\n }\n }\n }\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int a;\n scanf(\"%d\",&a);\n float x=4*sqrt(a);\n int y=x;\n if(x>y)\n {\n int z=a/10;\n y+=z;\n }\n printf(\"%d\",y);\n\n return 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n long N;\n long squares[1005];\n long maxsquare;\n long maxlines;\n long remainder;\n long squareside;\n long perimeter;\n int i;\n for(i=0;i<1000;i++) squares[i]=i*i;\n \n scanf(\"%ld\",&N);\n for(i=1;i<1000;i++)\n {\n maxsquare=squares[i];\n squareside=i;\n if(squares[i+1]>N) break;\n }\n\n remainder=N-maxsquare;\n maxlines=remainder/squareside;\n remainder=remainder-maxlines*squareside;\n\n perimeter=4*squareside;\n if(maxlines!=0) perimeter+= 2*maxlines;\n if(remainder!=0) perimeter+=2;\n printf(\"%ld\\n\",perimeter);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tif(sqrt(n)-(int)sqrt(n)==0)\n\tprintf(\"%d\",(int)sqrt(n)*4);\n\telse\n\t{\n\t\tint s=(int)sqrt(n);\n\t\tint res=4*s;\n\t\tint y=n-s*s;\n\t\tint b=y/s+1;\n\t\tprintf(\"%d\",res+2*b);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n long long int n,i,k,d,a;\n scanf(\"%lld\",&n);\n for(i=1;i=n)\n {\n k=i;\n break;\n }\n }\n for(i=k;i>0;i--)\n {\n if(k*i\n#include\n\nint main(void){\nint a,c;\nscanf(\"%d \",&a);\nint d;\nd= sqrt(a);\n\nint e=a-d*d;\nif(e==0){\n printf(\"%d\",d*4);\n}\nelse if((e/d)>0){\n int b=e/d;\n c= (b+d)*2 +d*2;\n int f= e%d;\n if(f==1){\n c=c+f*2;\n }\n else{\n c=c+f;\n }\n printf(\"%d\",c);\n\n}\nelse{\n int w;\n if(e==1){\n d*4 +e*2;\n }\n else{\n w=d*4+e;\n }\n printf(\"%d\",w);\n}\n\n}\n \n \n\n"}, {"source_code": "#include\n#include\nint main()\n{\n int n,blck,root,ext;\n scanf(\"%d\",&n);\n root=(int)sqrt(n);\n blck=4*root;\n ext=n-root*root;\n if(!ext)\n {\n printf(\"%d\",blck);\n return 0;\n }\n else if(ext>root)\n {\n ext=ext/root;\n blck+=2*(ext+1);\n }\n else\n {\n blck+=2;\n }\n printf(\"%d\",blck);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n,m,r,s,t;\n scanf(\"%lld\",&n);\n for(m=1;(m)*(m)<=n;m++)\n {\n if(m*m==n)\n {\n r=4*m;\n break;\n }\n else\n {\n s=4*(m+1);\n t=4*m+2;\n }\n }\nif((m-1)*(m-1)==n)\nprintf(\"%lld\",r);\nelse\n{\n if((m-1)*(m)>=n)\n printf(\"%lld\",t);\n else\n printf(\"%lld\",s);\n}\n return 0;\n}"}, {"source_code": "#include\n#include\n\nint main(void){\nint a,c;\nscanf(\"%d \",&a);\nint d;\nd= sqrt(a);\n\nint e=a-d*d;\nif(e==0){\n printf(\"%d\",d*4);\n}\nelse if((e/d)>0){\n int b=e/d;\n c= (b+d)*2 +d*2;\n int f= e%d;\n if(f==1){\n c=c+f*2;\n }\n else{\n c=c+f;\n }\n printf(\"%d\",c);\n\n}\nelse{\n int w;\n if(e==1){\n w= d*4 +e*2;\n }\n else{\n w=d*4+e;\n }\n printf(\"%d\",w);\n}\n\n}\n \n \n\n"}, {"source_code": "#include\n#include\nint main()\n{int n,d;\nfloat b,a;\nscanf(\"%f\",&a);\nb=sqrt(a);\nd=b;\nif(b==d)\n {\n printf(\"%d\",d*4);}\n\nelse {\nn=((d+1)*(d+1)-d*d)/2;\n if(b*b+n>=a)\n printf(\"%d\",d*4+2);\nelse\n printf(\"%d\",(d+1)*4);\n }\n}\n"}, {"source_code": "#include \n#include \n#include \nint main()\n{\nint j;\nint n;\n\nscanf(\"%d\",&n);\nj = (int)(4*(sqrt(n))+0.999);\nprintf(\"%d\",j);\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int n,i,j,k,c=0,p=0,z=1,a;\n\n scanf(\"%d\",&n);\n if(n==1){\n p=4;\n printf(\"%d\\n\",p);\n return 0;\n }\n else if(n==2){\n p=6;\n printf(\"%d\\n\",p);\n return 0;\n }\n else if(n==3){\n p=8;\n printf(\"%d\\n\",p);\n return 0;\n }\n else{\n p = 8;\n a=1;\n for(i=4;i<=n;i=i+k){\n k=0;\n if(a==1){\n for(j=1;j<=z;j++){\n p=p;\n k++;\n }\n a=0;\n }\n else if(a==0){\n p=p+2;\n c++;\n if(c==2){\n c=0;\n z++;\n }\n a=1;\n }\n }\n if(n==4) printf(\"8\\n\");\n else printf(\"%d\\n\",p-2);\n return 0;\n }\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,m,r,d=2,s,t;\n scanf(\"%d\",&n);\n for(m=1;(m)*(m)<=n;m++)\n {\n if(m*m==n)\n {\n r=4*m;\n }\n else\n {\n d++;\n s=4*d;\n t=4*d-1+2;\n }\n }\nif((m-1)*(m-1)==n)\nprintf(\"%d\",r);\nelse\n{\n if((m-1)*(m-2)>n)\n printf(\"%d\",t);\n else\n printf(\"%d\",s);\n}\n return 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n int n,blck,root;\n scanf(\"%d\",&n);\n root=(int)sqrt(n);\n blck=4*root;\n blck+=((int)((n-root*root)/root))*2;\n blck+=(n-root*root)%root;\n printf(\"%d\",blck);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n,m,r,s,t;\n scanf(\"%lld\",&n);\n for(m=1;(m)*(m)<=n;m++)\n {\n if(m*m==n)\n {\n r=4*m;\n break;\n }\n else\n {\n s=4*(m+1);\n t=4*m+2;\n }\n }\nif((m-1)*(m-1)==n)\nprintf(\"%lld\",r);\nelse\n{\n if((m-1)*(m)>=n)\n printf(\"%lld\",t);\n else\n printf(\"%lld\",s);\n}\n return 0;\n}"}, {"source_code": "#include\n#include\nint main(){\n int num;\n scanf(\"%d\",&num);\n int a = (int)sqrt(num);\n if(num - a*a >a)\n a = 4*a + 4;\n else\n a = 4*a +2;\n printf(\"%d\",a);\n return 0;\n}"}, {"source_code": "#include\n#include\n#include\n\nint main()\n{\n int n,a,b;\n float f;\n\n scanf(\"%d\",&n);\n a = sqrt(n);\n f = sqrt(n);\n\n if(a==f)\n {\n b = a*4;\n }\n if(a!=f)\n {\n if((n-a*a)\n#include\n\nint main(void){\nint a,c;\nscanf(\"%d \",&a);\nint d;\nd= sqrt(a);\n\nint e=a-d*d;\nif(e==0){\n printf(\"%d\",d*4);\n}\nelse if((e/d)>0){\n int b=e/d;\n c= (b+d)*2 +d*2;\n int f= e%d;\n if(f==1){\n c=c+f*2;\n }\n else if(f==0){\n printf(\"%d\",c);\n }\n else{\n c=c+2;\n printf(\"%d\",c);\n }\n \n\n}\nelse{\n int w;\n if(e==1){\n w= d*4 +e*2;\n }\n else{\n w=d*4+2;\n }\n printf(\"%d\",w);\n}\n\n}\n \n \n\n"}, {"source_code": "#include\n#include \nint main(){\n int sqr,input,k2;\n scanf(\"%d\",&input);\n sqr=sqrt(input);\n printf(\"%d\",sqr);\n k2=sqr;\n while(sqr*k2\n#include \nint main ()\n\n{\n int n,i,full,square,rest;\n double root;\n scanf (\"%d\",&n);\n if (n==1||n==2||n==3)\n {\n if (n==1)\n {\n printf (\"4\");\n return 0;\n }\n else if (n==2)\n {\n printf (\"6\");\n return 0;\n }\n else\n {\n printf (\"8\");\n return 0;\n }\n }\n else {\n\n root = sqrt(n);\n full = floor(root);\n if (root==full)\n {\n printf (\"%d\",4*full);\n return 0;\n }\n else\n {\n square = pow(full,2);\n rest = n - square;\n if (rest<=full)\n {\n printf (\"%d\",(4*full)+2);\n return 0;\n }\n else if (rest>full)\n {\n printf (\"%d\",(4*full)+2+((rest/full)*2));\n return 0;\n }\n }\n }\n}\n"}, {"source_code": "#include \n#include \n#include \nint main()\n{\nint j;\nint n;\nscanf(\"%d\",&n);\nif ((sqrt(n)-(int)(sqrt(n))<0.00005))\n\tj = (int)(4*(sqrt(n)));\nelse\n\tj = (int)(4*(sqrt(n))+1);\nprintf(\"%d\",j);\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n,flag = 0;\n scanf(\"%d\",&n);\n \n int peri,x,y;\n int temp = sqrt(n);\n int temp1 = temp +1;\n \n int sqrx = temp*temp;\n int sqry = temp1*temp1;\n \n if((sqrx) == n)\n flag =1;\n \n if(flag == 1)\n peri = 4 * temp;\n \n if(flag == 0)\n {\n x = (sqrx) - n;\n y = (sqry) - n;\n \n if(x < 0)\n x *= -1;\n \n if(y< 0)\n y*= -1;\n \n //printf(\"#%d $%d\\n\",x,y);\n \n if(x < y)\n peri = (4*temp) + x;\n \n if(x > y)\n peri = (4*temp1);\n } \n \n printf(\"%d\",peri);\n \n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int n,i,j,k,c=0,p=0,z=1,a;\n\n scanf(\"%d\",&n);\n if(n==1){\n p=4;\n printf(\"%d\\n\",p);\n return 0;\n }\n else if(n==2){\n p=6;\n printf(\"%d\\n\",p);\n return 0;\n }\n else if(n==3){\n p=8;\n printf(\"%d\\n\",p);\n return 0;\n }\n else{\n p = 8;\n a=1;\n for(i=4;i<=n;i=i+k){\n k=0;\n if(a==1){\n for(j=1;j<=z;j++){\n p=p;\n k++;\n }\n a=0;\n }\n else if(a==0){\n p=p+2;\n c++;\n if(c==2){\n c=0;\n z++;\n }\n a=1;\n }\n }\n printf(\"%d\\n\",p-2);\n return 0;\n }\n}\n"}, {"source_code": "#include \n#include \nint main ()\n\n{\n int n,i,full,square,rest;\n double root;\n scanf (\"%d\",&n);\n if (n==1||n==2||n==3)\n {\n if (n==1)\n {\n printf (\"4\");\n return 0;\n }\n else if (n==2)\n {\n printf (\"6\");\n return 0;\n }\n else\n {\n printf (\"8\");\n return 0;\n }\n }\n else {\n\n root = sqrt(n);\n full = floor(root);\n if (root==full)\n {\n printf (\"%d\",4*full);\n return 0;\n }\n else\n {\n square = pow(full,2);\n rest = n - square;\n if (rest<=full)\n {\n printf (\"%d\",(4*full)+2);\n return 0;\n }\n else if (rest>full)\n {\n if ((rest)%(full-1)==0)\n {\n printf (\"%d\",(4*full)+(2*(rest/(full)))+(2*(rest%(full))));\n return 0;\n }\n else\n {\n printf (\"%d\",(4*full)+(2*(rest/(full))+2));\n return 0;\n\n }\n }\n }\n }\n}\n"}, {"source_code": "#include \n#include \n\n\n/*Lazy Security Guard*/\nint main()\n{\n int input_num, perimeter,temp,count = 0;\n scanf(\"%d\",&input_num);\n temp = input_num;\n if(input_num == 1)\n {\n perimeter = 4;\n }\n else if(input_num <= 0)\n {\n perimeter = 0;\n }\n else\n {\n while(temp != 1)\n {\n temp /= 2;\n count++;\n }\n perimeter = count * 4;\n temp = input_num - (count*count);\n while(temp > 0)\n {\n temp = temp - count;\n perimeter = perimeter + 2;\n }\n\n }\n printf(\"%d\", perimeter);\n return 0;\n}\n"}, {"source_code": "#include \"stdio.h\"\n#include \"math.h\"\n\nint main ()\n{\n\tint n,i,j,num;\n\tscanf(\"%d\",&n);\n\tfor (i=1;;i++)\n\t{\n\t\tif (n\n#include \n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int x = sqrt(n);\n\n if(x*x==n) printf(\"%d\\n\",n*2);\n\n else{\n int dif = n - (x*x);\n\n if(dif>x) printf(\"%d\\n\",x*4+4);\n else printf(\"%d\\n\", x*4+2);\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main(void)\n{\nunsigned long long int N; // upto order 10^6\nscanf(\" %llu\", &N );\nunsigned long long int squareorder = sqrt(N);\nunsigned long long int order = N % (squareorder * squareorder);\nunsigned long long int perimeter ;\nif(order == 0)\n perimeter = 4 * squareorder;\nelse if(order > squareorder)\n perimeter = 4 * squareorder + 4 * order - 2 * order - 2 * (order - 1) + 2;\nelse\n perimeter = 4 * squareorder + 4 * order - 2 * order - 2 * (order - 1);\nprintf(\"%llu\\n\",perimeter);\nreturn 0;\n}"}, {"source_code": "#include \n#include \n#include \nint main()\n{\nint j;\nint n;\nscanf(\"%d\",&n);\n\tj = (int)(4*(sqrt(n))+0.999);\nprintf(\"%d\",j);\n}"}, {"source_code": "#include\n#include\nint main()\n{\n int n,blck,root,ext;\n scanf(\"%d\",&n);\n root=(int)sqrt(n);\n blck=4*root;\n ext=n-root*root;\n if(!ext)\n {\n printf(\"%d\",blck);\n return 0;\n }\n else if(ext>root)\n {\n ext=ext/root;\n blck+=2*(ext+1);\n }\n else\n {\n blck+=2;\n }\n printf(\"%d\",blck);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n,i,k,d,a;\n scanf(\"%lld\",&n);\n if(n==1)\n printf(\"4\");\n else\n {\n for(i=1;i=n)\n {\n k=i;\n break;\n }\n }\n for(i=k;i>0;i--)\n {\n if(k*i\n#include\n#include\n\nint PW(int a);\n\nint main()\n{\n\n int n;\n scanf(\"%d\",&n);\n\n int k=1;\n int t=1;\n while(k<=n)\n {\n if(k==n)\n {\n printf(\"%d\\n\",4*t);\n exit(0);\n }\n t++;\n k=PW(t);\n }\n\n int rem = n - PW(t-1);\n \n int res = 4*(t-1) + (2*((rem/(t-1))+1));\n printf(\"%d\\n\",res);\n return 0;\n}\n\nint PW(int a)\n{\n return a*a;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n\tint n,x,m,y,ans,z;\n\tscanf(\"%d\",&n);\n\tm=floor(sqrt(n));\n\tif(m>1)\n\t{\n\t x=n%(m*m);\n\t y=n%m;\n\t z=(x/m>0)?1:0;\n\t ans=(4*m) + (z*2);\n\t ans+=(y>0)?2:0;\n\t}\n\tif(x==0)\n\tans=0;\n\tif(x==1)\n\tans=4;\n\tif(x==2)\n\tans=6;\n\tif(x==3)\n\tans=8;\n\tprintf(\"%d\",ans);\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int N,i,j,a=0,b=0;\n scanf(\"%d\",&N);\n for(i=0;i<=265;i++){\n a=i*i;\n if(a>=N){\n a=i; //printf(\"a=%d\\n\",a);\n break;\n }\n }\n for(j=i;j>1;j--){\n b=j*a;\n //printf(\"B0=%d %d\\n\",b,j);\n if(b==N){\n b=j; //printf(\"b1=%d\\n\",b);\n break;\n }\n else if (b\nint main()\n{\n long long int n,m,r,s,t;\n scanf(\"%lld\",&n);\n for(m=1;(m)*(m)<=n;m++)\n {\n if(m*m==n)\n {\n r=4*m;\n break;\n }\n else\n {\n s=4*(m+1);\n t=4*m+2;\n }\n }\nif((m-1)*(m-1)==n)\nprintf(\"%lld\",r);\nelse\n{\n if((m-1)*(m)>=n)\n printf(\"%lld\",t);\n else\n printf(\"%lld\",s);\n}\n return 0;\n}"}, {"source_code": "#include \nint main()\n{\n\tlong i,j,n,k=0,z;\n\tscanf(\"%d\",&n);\n if (n==1){\n\t\tprintf(\"%d\",4);\n }else{\n\tfor (i=0;i\n#include\nint main(){\n int num;\n scanf(\"%d\",&num);\n int a = (int)sqrt(num);\n if(num - a*a >a)\n a = 4*a + 4;\n else\n a = 4*a +2;\n printf(\"%d\",a);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,i,x,y,z,p;\n scanf(\"%d\",&n);\n\n for(i=2;i<=n;i++)\n {\n if(i*i>n)\n {\n x=i-1;\n break;\n }\n }\n y=n/x;\n z=n%x;\n if(z==0)\n printf(\"%d\\n\",x*2+y*2);\n else\n {\n p=x*2+y*2-z;\n if(z==1)\n p=p+3;\n else\n p=p+4+(z-2);\n printf(\"%d\\n\",p);\n }\n return 0;\n}"}, {"source_code": "#include \n#include \n\n\n/*Lazy Security Guard*/\nint main()\n{\n int input_num, perimeter,temp,count = 0;\n scanf(\"%d\",&input_num);\n temp = input_num;\n if(input_num == 1)\n {\n perimeter = 4;\n }\n else if(input_num <= 0)\n {\n perimeter = 0;\n }\n else\n {\n while(temp != 1)\n {\n temp /= 2;\n count++;\n }\n perimeter = count * 4;\n temp = input_num - (count*count);\n while(temp > 0)\n {\n temp = temp - count;\n perimeter = perimeter + 2;\n }\n\n }\n printf(\"%d\", perimeter);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,m,r,d=2,s;\n scanf(\"%d\",&n);\n for(m=1;m*m<=n;m++)\n {\n if(m*m==n)\n {\n r=4*m;\n }\n else\n {\n d++;\n s=4*d;\n }\n }\nif(m*m==n)\nprintf(\"%d\",r);\nelse\n printf(\"%d\",s);\nreturn 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main(void){\nint a,c;\nscanf(\"%d \",&a);\nint d;\nd= sqrt(a);\n\nint e=a-d*d;\nif(e==0){\n printf(\"%d\",d*4);\n}\nelse if((e/d)>0){\n int b=e/d;\n c= (b+d)*2 +d*2;\n int f= e%d;\n if(f==1){\n c=c+f*2;\n }\n else{\n c=c+f;\n }\n printf(\"%d\",c);\n\n}\nelse{\n int w;\n if(e==1){\n d*4 +e*2;\n }\n else{\n w=d*4+e;\n }\n printf(\"%d\",w);\n}\n\n}\n \n \n\n"}, {"source_code": "#include\nint main()\n{\n long long int n,i,k,d,a;\n scanf(\"%lld\",&n);\n if(n==1)\n printf(\"4\");\n else\n {\n for(i=1;i=n)\n {\n k=i;\n break;\n }\n }\n for(i=k;i>0;i--)\n {\n if(k*i\n#include \n\nint main()\n{\n\tint n,x,m,y,ans,z;\n\tscanf(\"%d\",&n);\n\tm=floor(sqrt(n));\n\tif(m>1)\n\t{\n\t x=n%(m*m);\n\t y=n%m;\n\t z=(x/m>0)?1:0;\n\t ans=(4*m) + (z*2);\n\t ans+=(y>0)?2:0;\n\t}\n\tif(n==0)\n\tans=0;\n\tif(n==1)\n\tans=4;\n\tif(n==2)\n\tans=6;\n\tif(n==3)\n\tans=8;\n\tprintf(\"%d\",ans);\n}"}, {"source_code": "#include \n#include \n#include \n#include\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tif(n==2)\n\tprintf(\"6\");\n\telse if(n==3)\n\tprintf(\"8\");\n\telse if(sqrt(n)-(int)sqrt(n)==0)\n\tprintf(\"%d\",(int)sqrt(n)*4);\n\telse\n\t{\n\t\tint s=(int)sqrt(n);\n\t\tint res=4*s;\n\t\tint y=n-s*s;\n\t\tint b=y/s+1;\n\t\tint c=y-b*s;\n\t\tprintf(\"%d\",res+2*b+(c>0?c:0));\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n#include \nint main()\n{\nint j;\nint n;\n\nscanf(\"%d\",&n);\nj = (int)(4*(sqrt(n))+0.999);\nprintf(\"%d\",j);\n}\n"}, {"source_code": "#include\n#include\nint main(void)\n{\nunsigned long long int N; // upto order 10^6\nscanf(\" %llu\", &N );\nunsigned long long int squareorder = sqrt(N);\nunsigned long long int order = N % (squareorder * squareorder);\nunsigned long long int perimeter ;\nif(order == 0)\n perimeter = 4 * squareorder;\nelse if(order > squareorder)\n perimeter = 4 * squareorder + 4 * order - 2 * order - 2 * (order - 1) + 2;\nelse\n perimeter = 4 * squareorder + 4 * order - 2 * order - 2 * (order - 1);\nprintf(\"%llu\\n\",perimeter);\nreturn 0;\n}"}, {"source_code": "#include \n#include \nint main ()\n\n{\n int n,i,full,square,rest;\n double root;\n scanf (\"%d\",&n);\n if (n==1||n==2||n==3)\n {\n if (n==1)\n {\n printf (\"4\");\n return 0;\n }\n else if (n==2)\n {\n printf (\"6\");\n return 0;\n }\n else\n {\n printf (\"8\");\n return 0;\n }\n }\n else {\n\n root = sqrt(n);\n full = floor(root);\n if (root==full)\n {\n printf (\"%d\",4*full);\n return 0;\n }\n else\n {\n square = pow(full,2);\n rest = n - square;\n if (restfull)\n {\n if ((rest)%(full-1)==0)\n {\n printf (\"%d\",(4*full)+(2*(rest/(full-1))));\n return 0;\n }\n else\n {\n printf (\"%d\",(4*full)+(2*((rest/(full-1))+1)));\n return 0;\n\n }\n }\n }\n }\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int N,i,j,a=0,b=0;\n scanf(\"%d\",&N);\n for(i=0;i<=265;i++){\n a=i*i;\n if(a>=N){\n a=i; //printf(\"a=%d\\n\",a);\n break;\n }\n }\n for(j=i;j>1;j--){\n b=j*a;\n //printf(\"B0=%d %d\\n\",b,j);\n if(b==N){\n b=j; //printf(\"b1=%d\\n\",b);\n break;\n }\n else if (b\n#include \n#include \n#include\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tif(sqrt(n)-(int)sqrt(n)==0)\n\tprintf(\"%d\",(int)sqrt(n)*4);\n\telse\n\t{\n\t\tint s=(int)sqrt(n);\n\t\tint res=4*s;\n\t\tint y=n-s*s;\n\t\tint b=y/s+1;\n\t\tint c=y-b*s;\n\t\tprintf(\"%d\",res+2*b+(c>0?c:0));\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{int n,d;\nfloat b,a;\nscanf(\"%f\",&a);\nb=sqrt(a);\nd=b;\nif(b==d)\n {\n printf(\"%d\",d*4);}\n\nelse {\nn=((d+1)*(d+1)-d*d)/2;\n if(b*b+n>=a)\n printf(\"%d\",d*4+2);\nelse\n printf(\"%d\",(d+1)*4);\n }\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int blocks,i=0;\n scanf(\"%d\", &blocks);\n while(i*i<=blocks)\n {\n ++i;\n }\n --i;\n int szeleszama=4*i;//i*i s negyzet oldala\n if(blocks-i*i>=i)\n {\n szeleszama+=4;\n }\n else if(blocks==i*i)\n {\n //nothing really xd\n }\n else\n {\n szeleszama+=2;\n }\n printf(\"%d\",szeleszama);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,m,r,d=2,s;\n scanf(\"%d\",&n);\n for(m=1;(m)*(m)<=n;m++)\n {\n if(m*m==n)\n {\n r=4*m;\n }\n else\n {\n d++;\n s=4*d;\n }\n }\nif((m-1)*(m-1)==n)\nprintf(\"%d\",r);\nelse\n printf(\"%d\",s);\nreturn 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main(void){\nint a,c;\nscanf(\"%d \",&a);\nint d;\nd= sqrt(a);\n\nint e=a-d*d;\nif(e==0){\n printf(\"%d\",d*4);\n}\nelse if((e/d)>0){\n int b=e/d;\n c= (b+d)*2 +d*2;\n int f= e%d;\n if(f==1){\n c=c+f*2;\n }\n else{\n c=c+2;\n }\n printf(\"%d\",c);\n\n}\nelse{\n int w;\n if(e==1){\n w= d*4 +e*2;\n }\n else{\n w=d*4+2;\n }\n printf(\"%d\",w);\n}\n\n}\n \n \n\n"}, {"source_code": "#include \n#include \n#include \nint main()\n{\nint j;\nint n;\nscanf(\"%d\",&n);\nif ((sqrt(n)-(int)(sqrt(n))<0.00005))\n\tj = (int)(4*(sqrt(n)));\nelse\n\tj = (int)(4*(sqrt(n))+1);\nprintf(\"%d\",j);\n}"}, {"source_code": "#include \n#include \nint main ()\n\n{\n int n,i,full,square,rest;\n double root;\n scanf (\"%d\",&n);\n if (n==1||n==2||n==3)\n {\n if (n==1)\n {\n printf (\"4\");\n return 0;\n }\n else if (n==2)\n {\n printf (\"6\");\n return 0;\n }\n else\n {\n printf (\"8\");\n return 0;\n }\n }\n else {\n\n root = sqrt(n);\n full = floor(root);\n if (root==full)\n {\n printf (\"%d\",4*full);\n return 0;\n }\n else\n {\n square = pow(full,2);\n rest = n - square;\n if (restfull)\n {\n if ((rest)%(full-1)==0)\n {\n printf (\"%d\",(4*full)+(2*(rest/(full-1))));\n return 0;\n }\n else\n {\n printf (\"%d\",(4*full)+(2*((rest/(full-1))+1)));\n return 0;\n\n }\n }\n }\n }\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int n,a,t;\n scanf(\"%d\",&n);\n a = ((2*sqrt(n))+ 0.5);\n t =(2*a);\n printf(\"%d\",t);\n}\n"}, {"source_code": "#include\n#include\n\nint main(void){\nint a,c;\nscanf(\"%d \",&a);\nint d;\nd= sqrt(a);\n\nint e=a-d*d;\nif(e==0){\n printf(\"%d\",d*4);\n}\nelse if((e/d)>0){\n int b=e/d;\n c= (b+d)*2 +d*2;\n int f= e%d;\n if(f==1){\n c=c+f*2;\n }\n else{\n c=c+f;\n }\n printf(\"%d\",c);\n\n}\nelse{\n int w;\n if(e==1){\n w= d*4 +e*2;\n }\n else{\n w=d*4+e;\n }\n printf(\"%d\",w);\n}\n\n}\n \n \n\n"}, {"source_code": "#include\nint main()\n{\n int n,m,r,d=2,s;\n scanf(\"%d\",&n);\n for(m=1;m*m<=n;m++)\n {\n if(m*m==n)\n {\n r=4*(m);\n }\n else\n {\n d++;\n s=4*d;\n }\n }\nprintf(\"%d\",r||s);\nreturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,m,r,d=2,s;\n scanf(\"%d\",&n);\n for(m=1;(m+1)*(m+1)<=n;m++)\n {\n if(m*m==n)\n {\n r=4*m;\n }\n else\n {\n d++;\n s=4*d;\n }\n }\nif(m*m==n)\nprintf(\"%d\",r);\nelse\n printf(\"%d\",s);\nreturn 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n\nint main(){\n int n;\n scanf(\"%d\", &n);\n int square = 1;\n int closest = n;\n int value;\n while(square*square <= n){\n if (n-square*square < closest){\n closest = n-square*square;\n value = square;\n }\n square++;\n }\n int ans;\n if (closest != 0)\n ans = value*4 + 2 + closest;\n else if (closest == 0)\n ans = value*4;\n if ((value+1)*(value+1) - n < closest)\n ans = (value+1)*4;\n printf(\"%d\", ans);\n\n\n\n}\n"}, {"source_code": "#include\n\nint main()\n{\n long N;\n long squares[1005];\n long maxsquare;\n long maxlines;\n long remainder;\n long squareside;\n long perimeter;\n int i;\n for(i=0;i<1000;i++) squares[i]=i*i;\n \n scanf(\"%ld\",&N);\n for(i=1;i<1000;i++)\n {\n maxsquare=squares[i];\n squareside=i;\n if(squares[i+1]>N) break;\n }\n\n remainder=N-maxsquare;\n maxlines=remainder/squareside;\n remainder=remainder-maxlines*squareside;\n\n perimeter=4*squareside;\n if(maxlines!=0) perimeter+= 2*maxlines;\n if(remainder!=0) perimeter+=2;\n printf(\"%ld\\n\",perimeter);\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n\nint main(){\n int n;\n scanf(\"%d\", &n);\n int square = 1;\n int closest = n;\n int value;\n while(square*square <= n){\n if (n-square*square < closest){\n closest = n-square*square;\n value = square;\n }\n square++;\n }\n int ans;\n if (closest != 0)\n ans = value*4 + 2 + closest;\n else if (closest == 0)\n ans = value*4;\n if ((value+1)*(value+1) - n < closest)\n ans = (value+1)*4;\n printf(\"%d\", ans);\n\n\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,m,r,s,t;\n scanf(\"%d\",&n);\n for(m=1;(m)*(m)<=n;m++)\n {\n if(m*m==n)\n {\n r=4*m;\n break;\n }\n else\n {\n s=4*(m+1);\n t=4*m+2;\n }\n }\nif((m-1)*(m-1)==n)\nprintf(\"%d\",r);\nelse\n{\n if((m-1)*(m)>=n)\n printf(\"%d\",t);\n else\n printf(\"%d\",s);\n}\n return 0;\n}\n"}], "src_uid": "414cc57550e31d98c1a6a56be6722a12"} {"nl": {"description": "Madoka decided to entrust the organization of a major computer game tournament \"OSU\"!In this tournament, matches are held according to the \"Olympic system\". In other words, there are $$$2^n$$$ participants in the tournament, numbered with integers from $$$1$$$ to $$$2^n$$$. There are $$$n$$$ rounds in total in the tournament. In the $$$i$$$-th round there are $$$2^{n - i}$$$ matches between two players (one of whom is right, the other is left), after which the winners go further along the tournament grid, and the losing participants are eliminated from the tournament. Herewith, the relative order in the next round does not change. And the winner of the tournament — is the last remaining participant.But the smaller the participant's number, the more he will pay Madoka if he wins, so Madoka wants the participant with the lowest number to win. To do this, she can arrange the participants in the first round as she likes, and also determine for each match who will win — the participant on the left or right.But Madoka knows that tournament sponsors can change the winner in matches no more than $$$k$$$ times. (That is, if the participant on the left won before the change, then the participant on the right will win after the change, and if the participant on the right won, then the participant on the left will win after the change). So, the first image shows the tournament grid that Madoka made, where the red lines denote who should win the match. And the second one shows the tournament grid, after one change in the outcome of the match by sponsors (a match between $$$1$$$ and $$$3$$$ players). Print the minimum possible number of the winner in the tournament, which Madoka can get regardless of changes in sponsors. But since the answer can be very large, output it modulo $$$10^9 + 7$$$. Note that we need to minimize the answer, and only then take it modulo.", "input_spec": "The first and the only line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \\le n \\le 10^5, 1 \\le k \\le \\min(2^n - 1, 10^9)$$$) — the number of rounds in the tournament and the number of outcomes that sponsors can change.", "output_spec": "Print exactly one integer — the minimum number of the winner modulo $$$10^9 + 7$$$", "sample_inputs": ["1 1", "2 1", "3 2"], "sample_outputs": ["2", "3", "7"], "notes": "NoteIn the first example, there is only one match between players $$$1$$$ and $$$2$$$, so the sponsors can always make player $$$2$$$ wins.The tournament grid from the second example is shown in the picture in the statement."}, "positive_code": [{"source_code": "#include \r\n\r\n#define N\t100000\r\n#define MD\t1000000007\r\n\r\nint vv[N + 1], ff[N + 1], gg[N + 1];\r\n\r\nvoid init() {\r\n\tint i;\r\n\r\n\tff[0] = gg[0] = 1;\r\n\tfor (i = 1; i <= N; i++) {\r\n\t\tvv[i] = i == 1 ? 1 : (long long) vv[i - MD % i] * (MD / i + 1) % MD;\r\n\t\tff[i] = (long long) ff[i - 1] * i % MD;\r\n\t\tgg[i] = (long long) gg[i - 1] * vv[i] % MD;\r\n\t}\r\n}\r\n\r\nint choose(int n, int k) {\r\n\treturn (long long) ff[n] * gg[k] % MD * gg[n - k] % MD;\r\n}\r\n\r\nint main() {\r\n\tint n, k_, k, ans;\r\n\r\n\tinit();\r\n\tscanf(\"%d%d\", &n, &k_);\r\n\tans = 0;\r\n\tfor (k = 0; k <= k_ && k <= n; k++)\r\n\t\tans = (ans + choose(n, k)) % MD;\r\n\tprintf(\"%d\\n\", ans);\r\n\treturn 0;\r\n}"}, {"source_code": "#include \n\nlong long power_mod (long long a, long long b, long long mod_num) {\n long long ans = 1LL;\n \n if (b > 0LL) {\n ans = power_mod(a, b/2LL, mod_num);\n ans = (ans * ans) % mod_num;\n if (b%2LL == 1LL) {\n ans = (ans * a) % mod_num;\n }\n }\n \n return ans;\n}\n\nint main () {\n int n = 0;\n int k = 0;\n \n int res = 0;\n \n long long ans = 0LL;\n long long mod_num = 1000000007LL;\n \n long long fact[100001] = {};\n long long invf[100001] = {};\n \n res = scanf(\"%d\", &n);\n res = scanf(\"%d\", &k);\n \n if (n <= k) {\n printf(\"%lld\\n\", power_mod(2LL, (long long)n, mod_num));\n return 0;\n }\n \n fact[0] = 1LL;\n for (int i = 0; i < n; i++) {\n fact[i+1] = fact[i];\n fact[i+1] *= (long long) (i+1);\n fact[i+1] %= mod_num;\n }\n \n invf[n] = power_mod(fact[n], mod_num-2LL, mod_num);\n for (int i = n; i > 0; i--) {\n invf[i-1] = invf[i];\n invf[i-1] *= (long long)i;\n invf[i-1] %= mod_num;\n }\n \n for (int i = 0; i <= k; i++) {\n long long tmp = invf[i];\n tmp = (tmp*invf[n-i])%mod_num;\n ans = (ans+tmp)%mod_num;\n }\n \n ans = (ans*fact[n])%mod_num;\n printf(\"%lld\\n\", ans);\n \n return 0;\n}\n"}], "negative_code": [], "src_uid": "dc7b887afcc2e95c4e90619ceda63071"} {"nl": {"description": "Yakko, Wakko and Dot, world-famous animaniacs, decided to rest from acting in cartoons, and take a leave to travel a bit. Yakko dreamt to go to Pennsylvania, his Motherland and the Motherland of his ancestors. Wakko thought about Tasmania, its beaches, sun and sea. Dot chose Transylvania as the most mysterious and unpredictable place.But to their great regret, the leave turned to be very short, so it will be enough to visit one of the three above named places. That's why Yakko, as the cleverest, came up with a truly genius idea: let each of the three roll an ordinary six-sided die, and the one with the highest amount of points will be the winner, and will take the other two to the place of his/her dreams.Yakko thrown a die and got Y points, Wakko — W points. It was Dot's turn. But she didn't hurry. Dot wanted to know for sure what were her chances to visit Transylvania.It is known that Yakko and Wakko are true gentlemen, that's why if they have the same amount of points with Dot, they will let Dot win.", "input_spec": "The only line of the input file contains two natural numbers Y and W — the results of Yakko's and Wakko's die rolls.", "output_spec": "Output the required probability in the form of irreducible fraction in format «A/B», where A — the numerator, and B — the denominator. If the required probability equals to zero, output «0/1». If the required probability equals to 1, output «1/1». ", "sample_inputs": ["4 2"], "sample_outputs": ["1/2"], "notes": "NoteDot will go to Transylvania, if she is lucky to roll 4, 5 or 6 points."}, "positive_code": [{"source_code": "#include\nint main()\n{\n int y,w,m,n,a,b;\n scanf(\"%d %d\",&y,&w);\n if(y>w)\n m=y;\n else\n m=w;\n n=6-m+1;\n for(int i=1;i<=6;i++)\n {\n if(6%i==0 && n%i==0){\n a=n/i;\n b=6/i;\n }\n }\n printf(\"%d/%d\",a,b);\n}"}, {"source_code": "#include \n\nint main(void)\n{\n int Y, W;\n int biggest;\n char* chances[6] = {\"1/6\",\"1/3\",\"1/2\",\"2/3\",\"5/6\",\"1/1\"};\n\n scanf(\"%i %i\",&Y,&W);\n\n if(Y > W)\n\n biggest = Y;\n else\n biggest = W;\n\n printf(\"%s\",chances[6-biggest]);\n}\n"}, {"source_code": "#include\n#include\n#include\nint main()\n{\n int x,y;\n scanf(\"%d%d\",&x,&y);\n if(x>y)\n {\n if(x==2)\n {\n printf(\"5/6\\n\");\n }\n else if(x==3)\n {\n printf(\"2/3\\n\");\n }\n else if(x==4)\n {\n printf(\"1/2\\n\");\n }\n else if(x==5)\n {\n printf(\"1/3\\n\");\n }\n else\n {\n printf(\"1/6\\n\");\n }\n }\n else\n {\n if(y==1)\n {\n printf(\"1/1\\n\");\n }\n else if(y==2)\n {\n printf(\"5/6\\n\");\n }\n else if(y==3)\n {\n printf(\"2/3\\n\");\n }\n else if(y==4)\n {\n printf(\"1/2\\n\");\n }\n else if(y==5)\n {\n printf(\"1/3\\n\");\n }\n else\n {\n printf(\"1/6\\n\");\n }\n }\n}\n\n"}, {"source_code": "#include\n int f(int x,int y)\n {\n if(x%y==0)\n {\n return y;\n }\n else\n {\n return f(y,x%y);\n }\n }\n int main()\n {\n int m,n,a;int max;\n scanf(\"%d %d\",&m,&n);\n if(m>n) max=m;\n else max=n;\n a=7-max;\n m=a/f(6,a);\n n=6/f(6,a);\n printf(\"%d/%d \",m,n);\n return 0;\n }\n"}, {"source_code": "#include\nint main ()\n{\n int y,w ,p ,count=0,m=0,i;\n\n scanf(\"%d%d\",&y,&w) ;\n\n if(y==w)\n {\n for(i=y ;i<=6 ;i++)\n {\n count++ ;\n }\n }\n\n\n\n\n else if (y>w)\n\n {\n for(i=y ;i<=6 ;i++)\n {\n count++ ;\n }\n }\n\n else if(w>y)\n {\n for(i=w ;i<=6 ;i++)\n {\n count++ ;\n }\n }\n\n\n // printf(\"%d \\n\",count) ;\n\n if(count==1)\n {\n printf(\"1/6\") ;\n\n }\n else if(count==0)\n {\n printf(\"0/1\") ;\n\n }\n else if ( count >1 ) {\n\n if(count==6)\n {\n printf(\"1/1\") ;\n return 0 ;\n }\n\n if(count%2==0)\n {\n p= count/2 ;\n\n printf(\"%d/3\",p) ;\n }\n else if(count%3==0)\n {\n p=count/3 ;\n\n printf(\"%d/2\",p) ;\n }\n\n else {\n printf(\"%d/6\",count) ;\n }\n\n\n}\n return 0 ;\n}\n"}, {"source_code": "#include \nint main()\n{\n int a, b, c=0, d, l;\n scanf(\"%d %d\", &a, &b);\n \n if(a>=b) d=a;\n else d=b;\n \n for(l=d;l<=6;l++) c=c+1;\n \n if(c==1) printf(\"1/6\");\n else if(c==2) printf(\"1/3\");\n else if(c==3) printf(\"1/2\");\n else if(c==4) printf(\"2/3\");\n else if(c==5) printf(\"5/6\");\n else if(c==6) printf(\"1/1\");\n \n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint a,b,c;\n\tint gys(int a,int b);\n\tscanf(\"%d%d\",&a,&b);\n\tif(a>=b)\n\t{\n\t\tc=7-a;\n\t\tprintf(\"%d/%d\\n\",c/gys(c,6),6/gys(c,6));\n\t}\n\telse\n\t{\t\n\t\tc=7-b;\n\t\tprintf(\"%d/%d\\n\",c/gys(c,6),6/gys(c,6));\n\t}\n\treturn 0;\n}\nint gys(int a,int b)\n{\n\tif(b==0)return(a);\n\telse return(gys(b,a%b));\n}\n\t\t\t \t\t\t\t \t\t\t\t\t\t \t\t\t\t\t \t"}, {"source_code": "#include\nmain()\n{\n int y,w,j,i,k,n,c=0;\n scanf(\"%d%d\",&y,&w);\n if(y>w)\n n=y;\n else\n n=w;\n for(i=n;i<=6;i++)\n c++;\n if(6%c==0)\n printf(\"%d/%d\",c/c,6/c);\n else if(c%2==0) printf(\"%d/%d\",c/2,6/2);\n else\n printf(\"%d/%d\",c,6);\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,p,n;\n scanf(\"%d %d\",&a,&b);\n int c=a>b?a:b;\n \n int d=7-c;\n for(int i=2;i<=3;i++)\n {\n if(d%i==0&&6%i==0)\n {\n n=d/i;\n p=6/i;\n if(n==p)\n {\n n=1;p=1;\n }\n break;\n }\n else\n {\n n=d;\n p=6;\n }\n }\n printf(\"%d/%d\",n,p);\n return 0; \n}"}, {"source_code": "#include \nint main(){\nint a,b,n,s;\nscanf(\"%d %d\",&a,&b);\nif(a>=b)\n n=7-a;\nif(b>a)\n n=7-b;\n if((n%2==0)&&(n%3!=0)){\n s=n/2;\n printf(\"%d/3\",s);\n }\nif((n%3==0)&&(n%2!=0)){\n s=n/3;\n printf(\"%d/2\",s);\n }\n if(n%6==0)\n printf(\"1/1\");\n if((n%2!=0)&&(n%3!=0))\n printf(\"%d/6\",n);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{int y,m,x;\nscanf(\"%d%d\",&y,&m);\nif(y>m)\nx=7-y;\nelse\nx=7-m;\nif(x==1)\nprintf(\"%d/6\",x);\nelse if(x==6)\nprintf(\"1/1\");\nelse if(x%2==0)\nprintf(\"%d/3\",x/2);\nelse if(x==3)\nprintf(\"%d/2\",x/3);\nelse if(x==5)\nprintf(\"%d/6\",x);\n}\n"}, {"source_code": "#include \n\nint main(){\n int a,b,max,n;\n scanf(\"%d%d\",&a,&b);\n if(a>b)\n max=a;\n else\n max=b;\n n=6-max+1;\n if(6%n==0){\n printf(\"1/%d\",6/n);\n }\n else\n {\n if(n%2==0)\n printf(\"%d/3\",n/2);\n else\n printf(\"%d/6\",n);\n }\n}\n"}, {"source_code": "#include\nint main(){\n int y,w,mx;\n int p,q;\n scanf(\"%d %d\",&y,&w);\n if(y>=w)mx=y;\n else mx=w;\n p=(7-mx);\n q=6;\n if(p%2==0&&q%2==0){p=p/2;q=q/2;}\n if(p%3==0&&q%3==0){p=p/3,q=q/3;}\n printf(\"%d/%d\",p,q);\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n unsigned short yakko=0;\n unsigned short wakko=0;\n unsigned char numerator=0;\n unsigned char dominator=0;\n unsigned char temp=0;\n\n scanf(\"%hu %hu\",&yakko,&wakko);\n\n\n if(yakko>wakko)\n {\n temp=7-yakko;\n numerator=temp;\n dominator=6;\n if(numerator%dominator==0||dominator%numerator==0)\n {\n printf(\"%hi/%hi\",(1),(6/temp));\n\n }\n else\n { if(dominator%2==0&&numerator%2==0)\n {\n numerator=numerator/2;\n dominator=dominator/2;\n printf(\"%hi/%hi\",numerator,dominator);\n\n }\n else\n printf(\"%hi/%hi\",numerator,dominator);\n }\n\n }\n else\n {\n temp=7-wakko;\n numerator=temp;\n dominator=6;\n if(numerator%dominator==0||dominator%numerator==0)\n {\n printf(\"%hi/%hi\",(1),(6/temp));\n\n }\n else\n {\n if(dominator%2==0&&numerator%2==0)\n {\n numerator=numerator/2;\n dominator=dominator/2;\n printf(\"%hi/%hi\",numerator,dominator);\n\n }\n else\n printf(\"%hi/%hi\",numerator,dominator);\n }\n\n\n }\n\n\n\n\n\n\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int max,a,b,count=0;\n scanf(\"%d%d\",&a,&b);\n if(a>=b)\n {\n max=a;\n }\n else max=b;\n while(max<=6)\n {\n count++;\n max++;\n }\n if(count==1||count==5)\n {\n printf(\"%d/6\",count);\n }\n else if(count==2)\n printf(\"1/3\");\n else if(count==3)\n printf(\"1/2\");\n else if(count==4)\n printf(\"2/3\");\n else if (count==6)\n printf(\"1/1\");\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint W,Y,w,y;\n\tscanf(\"%d%d\",&W,&Y);\n\tw=6-(W-1),y=6-(Y-1);\n\tif(W>=Y&&6%w==0){\n\t\tprintf(\"%d/%d\",1,(6/w));\n\t}\n\telse if(W>=Y&&w%2!=0){\n\t\tprintf(\"%d/%d\",w,6);\n\t}\n\telse if(W>=Y&&w%2==0){\n\t\tprintf(\"%d/%d\",(w/2),3);\n\t}\n\telse if(Y>W&&6%y==0){\n\t\tprintf(\"%d/%d\",1,(6/y));\n\t}\n\telse if(Y>W&&y%2!=0){\n\t\tprintf(\"%d/%d\",y,6);\n\t}\n\telse if(Y>W&&y%2==0){\n\t\tprintf(\"%d/%d\",(y/2),3);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n\nint gcd(int a, int b) {\n if (b == 0) return a;\n return gcd(b, a % b);\n}\n\nint main() {\n int x, y, count = 0;\n scanf(\"%d %d\", &x, &y);\n for (int i = 1; i < 7; i++) {\n if (i >= x && i >= y) {\n count++;\n }\n }\n int c = gcd(count, 6);\n printf(\"%d/%d\", count/c, 6/c);\n return 0;\n}"}, {"source_code": "#include \nint main()\n{\n unsigned short x, y, t;\n scanf(\"%hu%hu\", &x, &y );\n t = 1 + ( 6 - ( x > y ? x : y ) );\n if( 6 == t)\n printf(\"1/1\");\n else if( 5 == t)\n printf(\"5/6\");\n else if( 4 == t)\n printf(\"2/3\");\n else if( 3 == t)\n printf(\"1/2\");\n else if( 2 == t)\n printf(\"1/3\");\n else\n printf(\"1/6\");\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint fun(int ,int );\nint max(int ,int );\nint max(int x,int y)\n{\n return (x>y)?x:y;\n}\nint fun(int x,int y)\n{\n return (y==0)?x:fun(y,x%y);\n}\nint main()\n{\n int a,b,tmp,ans;\n scanf(\"%d%d\",&a,&b);\n tmp=max(a,b);\n ans=fun(6,7-tmp);\n printf(\"%d/%d\",(7-tmp)/ans,6/ans);\n return 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int i,j,dot;\n scanf(\"%d%d\",&i,&j);\n if (i>j){\n dot=6+1-i;\n }\n if(i<=j){\n dot=6+1-j;\n }\n\n if (dot==1){ printf(\"1/6\");}\n else if(dot==2){printf(\"1/3\");}\n else if (dot==3){printf(\"1/2\");}\n else if (dot==4){printf(\"2/3\");}\n else if (dot==5){printf(\"5/6\");}\n else if (dot==6){printf(\"1/1\");}\n return 0;\n}\n"}, {"source_code": "#include\nvoid per(int n)\n{\n\tif(n==1)\n\tprintf(\"1/6\");\n\t\n\tif(n==2)\n\tprintf(\"1/3\");\n\t\n\tif(n==3)\n\tprintf(\"1/2\");\n\t\n\tif(n==4)\n\tprintf(\"2/3\");\n\t\n\tif(n==5)\n\tprintf(\"5/6\");\n\t\n\tif(n==6)\n\tprintf(\"1/1\");\n}\n\n\nint main()\n{\n\tint max=0;\n\tint a;\n\t\n\tscanf(\"%d\",&a);\n\t\n\tif(a>max)\n\tmax=a; \n\t\n\tscanf(\"%d\",&a);\n\t\n\tif(a>max)\n\tmax=a; \n\t\n\tper(6-max+1);\n\t\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int Y,W,A;\n scanf(\"%d %d\",&Y,&W);\n if(Y>W){\n A=Y;\n }\n else\n {\n A=W;\n }\n \n A=(6-A)+1;\n\n if(A%2==1){\n if(A==3){\n printf(\"1/2\\n\");\n }\n else\n {\n printf(\"%d/6\\n\",A);\n }\n }\n else\n {\n if(A==4){\n printf(\"2/3\\n\");\n }\n else\n {\n printf(\"1/%d\",6/A);\n }\n \n }\n \n\n return 0;\n}"}, {"source_code": "#include\n#include\nint main(){\n\tint a,b,c,yes=0;\n\tscanf(\"%d%d\",&a,&b);\n\tint x=7-fmax(a,b);\n\tif(6%x==0)\n\t\tprintf(\"1/%d\",6/x);\n\telse{\n\t\tfor(int i=x;i>=2;i--){\n\t\t\tif(x%i==0&&6%i==0){\n\t\t\t\tprintf(\"%d/%d\",x/i,6/i);\n\t\t\t\tyes=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(yes==0) printf(\"%d/6\",x);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int a,b,A,B=6;\n scanf(\"%d %d\",&a,&b);\n\n if(a==b){\n A=6-b+1;}\n\n else if(a>b) A=6-a+1;\n else if(a\nint main()\n{\n int a,b,c=1,m;\n scanf(\"%d %d\",&a,&b);\n if(a>b) m=a;\n else m=b;\n c=c+(6-m);\n if(c==1) printf(\"1/6\");\n else if(c==2) printf(\"1/3\");\n else if(c==3) printf(\"1/2\");\n else if(c==4) printf(\"2/3\");\n else if(c==5) printf(\"5/6\");\n else printf(\"1/1\");\n return 0;\n}"}, {"source_code": "\n#include \n\n#define b (y>w ? y : w)\n\nint y, w, count=0;\n\nint main()\n{\n scanf(\"%d %d\", &y, &w);\n\n for (int i=1; i<7; i++) if (i>=b) count++;\n\n if (count==0) printf(\"0/1\");\n else if (count==2) printf(\"1/3\");\n else if (count==3) printf(\"1/2\");\n else if (count==4) printf(\"2/3\");\n else if (count==6) printf(\"1/1\");\n else printf(\"%d/6\", count);\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int Y,W,max,roll,n,d;\n scanf(\"%d %d\",&Y,&W);\n if(Y\nint main()\n{\nint Y,W,x;\nscanf(\"%d\",&Y);\nscanf(\"%d\",&W);\nif(Y>W){\n x=(6-Y)+1;\n }\nif(W>=Y){\n x=(6-W)+1;\n }\nif(x==1){\n printf(\"1/6\");\n }\nelse if(x==2){\n printf(\"1/3\");\n }\nelse if(x==3){\n printf(\"1/2\");\n }\nelse if(x==4){\n printf(\"2/3\");\n }\nelse if(x==5){\n printf(\"5/6\");\n }\nelse if(x==6){\n printf(\"1/1\");\n }\nreturn 0;\n}"}, {"source_code": "#include \n\n#include\nint f[1000001],num[10000];\nint main()\n{\n int a[10],b,n,c,m,i,j;\n scanf(\"%d %d\",&n,&m);\n int max=0;\n if(n>m)max=n;else max=m;\n if (max==1)printf(\"1/1\\n\");\n if (max==2)printf(\"5/6\\n\");\n if (max==3)printf(\"2/3\\n\");\n if (max==4)printf(\"1/2\\n\");\n if (max==5)printf(\"1/3\\n\");\n if (max==6)printf(\"1/6\\n\");\n \n return 0;\n}"}, {"source_code": "#include \nint main()\n{\n int y,w,d,m;\n scanf(\"%d%d\",&y,&w);\n m=(y>w)?y:w;\n m=6-m+1;\n switch(m){\n case 0:printf(\"0/1\");\n break;\n case 1:printf(\"1/6\");\n break;\n case 2:printf(\"1/3\");\n break;\n case 3:printf(\"1/2\");\n break;\n case 4:printf(\"2/3\");\n break;\n case 5:printf(\"5/6\");\n break;\n case 6:printf(\"1/1\");\n break;\n }\n return 0;\n \n \n}"}, {"source_code": "# include\n int i=0;\nvoid dg(int max,int n)\n{\n\tif(n>=max)\n\t{\n\t\ti++;\n\t\tdg(max,n-1);\n \t} \n}\nint main()\n{int x,y,max;\n scanf(\"%d%d\",&x,&y);\n max=(x>y)?x:y; \t\n\tdg(max,6);\n\tif(i==2)\n\t\tprintf(\"1/3\\n\");\n\telse if(i==3)\n\t\tprintf(\"1/2\\n\");\n\telse if(i==6)\n\t\tprintf(\"1/1\");\n\telse if(i==4)\n\t\tprintf(\"2/3\");\n\telse\n\t\tprintf(\"%d/6\\n\",i);\n\treturn 0;\n} "}, {"source_code": "#include\nint main()\n{\n int Y,W,A,B,x;\n scanf(\"%d%d\",&Y,&W);\n if(W>Y)\n {\n x=W;\n W=Y;\n Y=x;\n }\n A=6-Y+1;\n B=6;\n if (A%6==0)\n {\n B=B/6;\n A=A/6;\n }\n else if(A%2==0)\n {\n B=B/2;\n A=A/2;\n }\n else if(A%3==0)\n {\n B=B/3;\n A=A/3;\n }\n printf(\"%d/%d\\n\",A,B);\n}\n"}, {"source_code": "#include\n#include\nint main(){\n\tint a,b,c,yes=0;\n\tscanf(\"%d%d\",&a,&b);\n\tint x=7-fmax(a,b);\n\tif(6%x==0)\n\t\tprintf(\"1/%d\",6/x);\n\telse{\n\t\tfor(int i=x;i>=2;i--){\n\t\t\tif(x%i==0&&6%i==0){\n\t\t\t\tprintf(\"%d/%d\",x/i,6/i);\n\t\t\t\tyes=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(yes==0) printf(\"%d/6\",x);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\nvoid coprime(int ,int);\nint main()\n{\n int y,w,d,l;\n scanf(\"%d%d\",&y,&w);\n if((y>6) || (w>6))\n printf(\"invalid choice\\n\");\n l=(y>=w)?y:w;\n d=6-l+1;\n coprime(d,6);\n return 0;\n}\nvoid coprime(int a,int b)\n{\n int i;\n for(i=2;i<=a;i++)\n {\n if(a%i==0)\n {\n if(b%i==0)\n {\n a=a/i;\n b=b/i;\n continue;\n }\n }\n }\n printf(\"%d/%d\",a,b);\n}"}, {"source_code": "#include\n\nint main() {\n\tint x,y,z,a=6,i,b=0;\n\tscanf(\"%d%d\",&x,&y);\n\tif(x>=y)\n\tz=x;\n\telse if(y>x)\n\tz=y;\n\tfor(i=z;i<7;i++)\n\tb++;\n\tfor(i=2;i<7;i++)\n\t{\n\t if(b%i==0&&a%i==0)\n\t {\n\t b=b/i;\n\t a=a/i;\n\t \n\t }\n\t}\n\tprintf(\"%d/%d\",b,a);\n\treturn 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n int x,y;\n scanf(\"%d %d\",&x,&y);\n int z,count=0;\n if(x>y)\n {\n for(z=x;z<=6;z++)\n {\n count++;\n }\n }\n else\n {\n for(z=y;z<=6;z++)\n {\n count++;\n }\n }\n if(count%2==0&&count%3==0)\n {\n printf(\"%d/%d\",count/(2*3),6/(2*3));\n }\n else if(count%2==0)\n {\n printf(\"%d/%d\",count/2,6/2);\n }\n else if(count%3==0)\n {\n printf(\"%d/%d\",count/3,6/3);\n }\n else\n {\n printf(\"%d/%d\",count,6);\n }\n}"}, {"source_code": "#include\nint main()\n{\n int y,w,a,b=6;\n scanf(\"%d %d\",&y,&w);\n if(y>=w){\n if(y==1){\n printf(\"1/1\");\n }\n if(y==2){ a=5;\n printf(\"5/6\");\n }\n if(y==3){\n printf(\"2/3\");\n }\n if(y==4){\n printf(\"1/2\");\n }\n if(y==5){\n printf(\"1/3\");\n }\n if(y==6){\n printf(\"1/6\");\n }\n }\n else if(w>y){\n if(w==2){ a=5;\n printf(\"5/6\");\n }\n if(w==3){\n printf(\"2/3\");\n }\n if(w==4){\n printf(\"1/2\");\n }\n if(w==5){\n printf(\"1/3\");\n }\n if(w==6){\n printf(\"1/6\");\n }\n\n }\n else {\n printf(\"0/1\");\n }\n return 0;\n}\n"}, {"source_code": "#include\nint max(int a,int b){\n if(a>=b) return a;\n else return b;\n}\nint main(){\n int yak_pt,wak_pt;\n int d,dot_pts;\n scanf(\"%d %d\",&yak_pt,&wak_pt);\n d=max(yak_pt,wak_pt);\n dot_pts=(6-d)+1;\n switch(dot_pts){\n case(0): printf(\"0/1\"); break;\n case(1): printf(\"1/6\"); break;\n case(2): printf(\"1/3\"); break;\n case(3): printf(\"1/2\"); break;\n case(4): printf(\"2/3\"); break;\n case(5): printf(\"5/6\"); break;\n case(6): printf(\"1/1\"); break;\n }\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint a,b,c;\n\tint gys(int a,int b);\n\tscanf(\"%d%d\",&a,&b);\n\tif(a>=b)\n\t{\n\t\tc=7-a;\n\t\tprintf(\"%d/%d\\n\",c/gys(c,6),6/gys(c,6));\n\t}\n\telse\n\t{\t\n\t\tc=7-b;\n\t\tprintf(\"%d/%d\\n\",c/gys(c,6),6/gys(c,6));\n\t}\n\treturn 0;\n}\nint gys(int a,int b)\n{\n\tif(b==0)return(a);\n\telse return(gys(b,a%b));\n}\n\t\t\t \t\t\t\t \t\t\t\t\t\t \t\t\t\t\t \t"}, {"source_code": "#include\nint main()\n{\n int a,b,c,p;\n scanf(\"%d %d\",&a,&b);\n if(a>=b){\n c=7-a;\n }\n else if(b>a){\n c=7-b;\n }\n if(c==1){\n printf(\"%d/6\",c);\n }\n else if(c==2){\n printf(\"1/3\");\n }\n else if(c==3){\n printf(\"1/2\");\n }\n else if(c==4){\n printf(\"2/3\");\n }\n else if(c==5){\n printf(\"5/6\");\n }\n else if(c==6){\n printf(\"1/1\");\n }\n return 0;\n}\n"}, {"source_code": "\n#include\n\nint main()\n{\n int i, j, ans, max = 0;\n\n scanf(\"%d%d\", &i, &j);\n\n if(max < i)\n max = i;\n if(max < j)\n max = j;\n\n ans = 7 - max;\n\n if (ans == 1)\n printf(\"1/6\");\n\n else if (ans == 2)\n printf(\"1/3\");\n\n else if (ans == 3)\n printf(\"1/2\");\n\n else if (ans == 4)\n printf(\"2/3\");\n\n else if (ans == 5)\n printf(\"5/6\");\n\n else\n printf(\"1/1\");\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int a,b ;\n scanf(\"%d%d\", &a,&b);\n double answer = 0;\n\n if (a > b )\n {\n answer= (6-a+1) / 6.0;\n b = (6-a+1);\n\n if (answer == 1)\n {\n printf(\"1/1\");\n }else if (answer == 0)\n {\n printf(\"0/1\");\n }else\n {\n if (b <= 3 )\n printf(\"1/%d\", 6/b );\n else if (b == 4 )\n printf(\"2/3\");\n else\n printf(\"5/6\");\n }\n }\nelse\n {\n answer= (6-b+1) / 6.0;\n a = (6-b+1);\n\n if (answer == 1)\n {\n printf(\"1/1\");\n }else if (answer == 0)\n {\n printf(\"0/1\");\n }else\n {\n if (a <= 3 )\n printf(\"1/%d\", 6/a );\n else if (a == 4 )\n printf(\"2/3\");\n else\n printf(\"5/6\");\n\n }\n\n }\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int y,w,res,a,b,i,j;\n\n scanf(\"%d %d\",&y,&w);\n\n if(y>=w)\n {\n a=(6-(y-1));\n b=6;\n if(b%a==0){\n i=a/a;\n j=b/a;\n printf(\"%d/%d\\n\",i,j);\n }\n else if(a%2==0){\n i=a/2;\n j=b/2;\n printf(\"%d/%d\\n\",i,j);\n }\n else{\n printf(\"%d/%d\\n\",a,b);\n }\n }\n else if(y<=w)\n {\n a=(6-(w-1));\n b=6;\n if(b%a==0){\n i=a/a;\n j=b/a;\n printf(\"%d/%d\\n\",i,j);\n }\n else if(a%2==0){\n i=a/2;\n j=b/2;\n printf(\"%d/%d\\n\",i,j);\n }\n else{\n printf(\"%d/%d\\n\",a,b);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int Y,W;\n int s,y = 6,i;\n scanf(\"%d%d\",&Y,&W);\n if(Yd){break;}\n }\n printf(\"%d/%d\",d,y);\n\n return 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int a,b,A;\n scanf(\"%d%d\",&a,&b);\n if(a>=b){A=a; }\n else{A=b;}\n A=6-A+1;\n int i;\n int f=0;\n for(i=6;i>=2;i--)\n {\n if(6%i==0 && A%i==0){f=1; break;}\n }\n if (f==1){printf(\"%d/%d\\n\",A/i,6/i);}\n if (f==0){printf(\"%d/%d\\n\",A,6);}\n // printf(\"%d\",A);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main(){\n\tint a[2];\n\tscanf(\"%d %d\",&a[0],&a[1]);\n\tint max;\n\tint count;\n\tmax=(a[0]>=a[1])?a[0]:a[1];\n\tcount=(7-max);\n\tif(6%count==0){\n\t\tprintf(\"1/%d\",6/count);\n\t}\n\telse if(count%2==0){\n\t\tprintf(\"%d/%d\",count/2,3);\n\t}\n\telse if(count%3==0){\n\t\tprintf(\"%d/%d\",count/3,2);\n\t}\n\telse if(6%count!=0){\n\t\tprintf(\"%d/%d\",count,6);\n\t}\n\treturn(0);\n}\n"}, {"source_code": "#include \n#include \nint gcd (int a , int b) {\n if(b == 0) {\n return a;\n }\n else return gcd(b,a%b);\n}\nint main (void) {\n int first ,second,propD;\n scanf(\"%d%d\",&first,&second);\n if (first> second) propD = 7 - first;\n else propD = 7 - second;\n int common = gcd(propD,6);\n printf(\"%d/%d\",propD/common,6/common);\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\nint yakko,wakko;\nint dot;\nscanf(\"%d %d\",&yakko,&wakko);\nif(yakko>wakko){\n dot=6-yakko+1;\n}\nelse{\n dot=6-wakko+1;\n}\nif(dot==0){\n printf(\"0/1\");\n}\nif(dot==6){\n printf(\"1/1\");\n}\nif(dot==1){\n printf(\"1/6\");\n}\nif(dot==2){\n printf(\"1/3\");\n}\nif(dot==3){\n printf(\"1/2\");\n}\nif(dot==4){\n printf(\"2/3\");\n}\nif(dot==5){\n printf(\"5/6\");\n}\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\nvoid max(int *a,int *b){\n\tif(*a<*b){\n\t\tint temp=*a;\n\t\t*a=*b;\n\t\t*b=temp;\n\t\t}\n\t}\nint main(){\n\tint y,w;\n\tscanf(\"%i%i\",&y,&w);\n\tmax(&y,&w);\n\tint a=6-y+1;\n\t if(y==1 && w==1) printf(\"1/1\");\n\t else if(a%3==0) printf(\"%i/2\",a/3);\n\t else if(a%2==0) printf(\"%i/3\",a/2);\n\t else printf(\"%i/6\",a);\n\t}\n"}, {"source_code": "#include \n\nint main(){\n\n int y, w;\n int d;\n\n scanf(\"%d %d\", &y, &w);\n\n if(y > w) d = 6-y+1;\n else d = 6-w+1;\n \n int p1 = 6;\n\n for(int i = p1; i > 0; i--){ \n if(p1%i == 0 && d%i == 0){\n p1 =p1/i;\n d = d/i;\n }\n }\n \n printf(\"%d/%d\",d, p1);\n\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n if(a>b)\n {\n if(a==1)\n printf(\"1/1\\n\");\n else if(a==2)\n printf(\"5/6\\n\");\n else if(a==3)\n printf(\"2/3\\n\");\n else if(a==4)\n printf(\"1/2\\n\");\n else if(a==5)\n printf(\"1/3\\n\");\n else if(a==6)\n printf(\"1/6\\n\");\n else if(a==0)\n printf(\"0/1\\n\");\n }\n if(a\nint main (){\n int A,B,i,c,d=0;\n scanf(\"%d%d\",&A,&B);\n c=A-B;\n if (c<0){\n for (i=B;i<=6;i++){\n ++d;}\n if (d==0 ){\n printf (\"0/1\");\n return 0;}\n else if(d==6){\n printf (\"1/1\");\n return 0;}\n else if(d==1){\n printf (\"1/6\");\n return 0;}\n else if (d==2 || d== 4){\n printf(\"%d/3\",d/2);\n return 0;}\n else if(d==3){\n printf (\"1/2\");\n return 0;}\n else if (d==5){\n printf(\"5/6\");\n return 0;}}\n else {\n for (i=A;i<=6;i++){\n ++d;}\n \n if (d==0 ){\n printf (\"0/1\");\n return 0;}\n else if(d==6){\n printf (\"1/1\");\n return 0;}\n else if(d==1){\n printf (\"1/6\");\n return 0;}\n else if (d==2 || d== 4){\n printf(\"%d/3\",d/2);\n return 0;}\n else if(d==3){\n printf (\"1/2\");\n return 0;}\n else if (d==5){\n printf(\"5/6\");\n return 0;}}\n return 0;}\n\n"}, {"source_code": "#include \"stdio.h\"\n\n#define BASE \"%d\"\ntypedef int Base;\n\n\nint main()\n{\n Base Yakko = 0;\n Base Wakko = 0;\n Base Want = 0;\n Base Total = 0;\n \n scanf(BASE BASE, &Yakko, &Wakko);\n \n if (Yakko > Wakko)\n {\n Want = 6 - Yakko + 1;\n }\n else \n {\n Want = 6 - Wakko + 1;\n }\n \n Total = 6;\n if (Want == 6)\n {\n printf(\"1/1\\n\");\n }\n else if (Want % 2 == 0)\n {\n printf(BASE\"/\"BASE\"\\n\", Want / 2, Total / 2);\n }\n else if (Want % 3 == 0)\n {\n printf(BASE\"/\"BASE\"\\n\", Want / 3, Total / 3);\n }\n else \n {\n printf(BASE\"/\"BASE\"\\n\", Want, Total);\n }\n \n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint i,x,y,a=0,b;\n\tscanf(\"%d %d\",&x,&y);\n\tfor(i=1;i<7;i++)\n\t{\n\t\tif(i>=x&&i>=y)\n\t\ta++;\n\t}\n\tif(a==6)\n\tprintf(\"1/1\");\n else if (a<=3)\n {\n \tb=6/a;\n \tprintf(\"1/%d\",b);\n }\n else if (a==4)\n {\n \tprintf(\"2/3\");\n \t\n }\n else\n printf(\"5/6\");\n \n return(0);\n}\n"}, {"source_code": "\n#include\n\nint main()\n{\n int i, j, ans, max = 0;\n\n scanf(\"%d%d\", &i, &j);\n\n if(max < i)\n max = i;\n if(max < j)\n max = j;\n\n ans = 7 - max;\n\n if (ans == 1)\n printf(\"1/6\");\n\n else if (ans == 2)\n printf(\"1/3\");\n\n else if (ans == 3)\n printf(\"1/2\");\n\n else if (ans == 4)\n printf(\"2/3\");\n\n else if (ans == 5)\n printf(\"5/6\");\n\n else\n printf(\"1/1\");\n\n return 0;\n}\n"}, {"source_code": "#include\n\n\nint gcdr(int a , int b){\n\tif(a==0){\n\t\treturn b;\n\t}\n\treturn gcdr(b%a,a);\n}\n\n\n\n\nint main(int argc, char **argv){\n\tint a,b;\n\tscanf(\"%d %d\",&a,&b);\n\tint c,d,m;\n\tif(a>=b){\n\t\tm=a;\n\t}\n\telse{\n\tm=b;\n\t}\n\td=6-m+1;\n\tc=gcdr(d,6);\n\tprintf(\"%d/%d\",d/c,6/c);\n\treturn 0;\n}\n\t"}, {"source_code": "#include\nmain()\n{\n int y,w,i,x,c=0,a,b;\n scanf(\"%d%d\",&y,&w);\n if(y>w)\n x=y;\n else\n x=w;\n for(i=x;i<=6;i++)\n c=c+1;\n a=6/c;\n if(c==4)\n printf(\"2/3\");\n else if(c==5)\n printf(\"5/6\");\n else\n printf(\"1/%d\",a);\n\n}\n"}, {"source_code": "#include\n#include\n\nint firstResult;\nint secondResult;\nint highest;\nint numerator;\nint denominator;\n\nvoid readEntries() {\n scanf(\"%d\", &firstResult);\n scanf(\"%d\", &secondResult);\n}\n\nvoid reduceFraction() {\n while (0 == numerator % 2 || 0 == numerator % 3) {\n if (0 == numerator % 3 && 0 == denominator % 3) {\n numerator /= 3;\n denominator /= 3;\n } else if (0 == numerator % 2 && 0 == denominator % 2) {\n numerator /= 2;\n denominator /= 2;\n } else {\n break;\n }\n } \n}\n\nvoid evaluateResult() {\n if (firstResult > secondResult) {\n highest = firstResult;\n } else {\n highest = secondResult;\n }\n numerator = (6 - highest) + 1;\n denominator = 6;\n reduceFraction();\n}\n\nvoid printResult() {\n printf(\"%d/%d\", numerator, denominator);\n}\n\nint main() {\n readEntries();\n evaluateResult();\n printResult();\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int Y,W,A,B,x;\n scanf(\"%d%d\",&Y,&W);\n if(W>Y)\n {\n x=W;\n W=Y;\n Y=x;\n }\n A=6-Y+1;\n B=6;\n if (A%6==0)\n {\n B=B/6;\n A=A/6;\n }\n else if(A%2==0)\n {\n B=B/2;\n A=A/2;\n }\n else if(A%3==0)\n {\n B=B/3;\n A=A/3;\n }\n printf(\"%d/%d\\n\",A,B);\n}\n"}, {"source_code": "main(d,w){scanf(\"%u%u\",&d,&w);w=d>w?7-d:7-w;d=(w%3?1:3)*(w%2?1:2);return!printf(\"%u/%u\",w/d,6/d);}"}, {"source_code": "#include \n\nint main()\n{\n int y,w,d;\n scanf(\"%d %d\",&y,&w);\n if(y>=w)\n d=6-y+1;\n else\n d=6-w+1;\n switch(d)\n {\n case 1: printf(\"1/6\\n\");break;\n case 2: printf(\"1/3\\n\");break;\n case 3: printf(\"1/2\\n\");break;\n case 4: printf(\"2/3\\n\");break;\n case 5: printf(\"5/6\\n\");break;\n case 6: printf(\"1/1\\n\");break;\n }\n}"}, {"source_code": "#include\nint main() {\n\tint a, b,max,num,den = 6;\n\tscanf(\"%d %d\", &a, &b);\n\tif (a > b)\n\t\tmax = a;\n\telse max = b;\n\tnum = 6 - max + 1;\n\tif (a == b && a==1) {\n\t\tprintf(\"1/1\");\n\t}\n\telse {\n\t\tif (num % 2 == 0) {\n\t\t\tnum /= 2;\n\t\t\tprintf(\"%d/%d\", num, den / 2);\n\t\t}\n\t\telse if (num % 3 == 0) {\n\t\t\tnum /= 3;\n\t\t\tprintf(\"%d/%d\", num, den / 3);\n\t\t}\n\t\telse printf(\"%d/%d\", num, den);\n\t}\n//\tsystem(\"pause\");\n\treturn 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n int Y,W,temp,a=6;\n scanf(\"%d %d\",&Y,&W);\n if(Y>=W)\n {\n temp=6-Y+1;\n if(temp%6==0)\n {\n temp=temp/6;\n a=a/6;\n }\n else if(temp%3==0)\n {\n temp=temp/3;\n a=a/3;\n }\n else if(temp%2==0)\n {\n temp=temp/2;\n a=a/2;\n }\n printf(\"%d/%d\",temp,a);\n }\n else\n {\n temp=6-W+1;\n if(temp%6==0)\n {\n temp=temp/6;\n a=a/6;\n }\n else if(temp%3==0)\n {\n temp=temp/3;\n a=a/3;\n }\n else if(temp%2==0)\n {\n temp=temp/2;\n a=a/2;\n }\n printf(\"%d/%d\",temp,a);\n }\n}"}, {"source_code": "#include\nint main()\n{\n int y,w,i,count=0;\n scanf(\"%d %d\",&y,&w);\n if(y>=w)\n {\n for(i=y;i<7;i++)\n {\n count++;\n }\n if(count==1)\n {\n printf(\"1/6\");\n }\n if(count==2)\n {\n printf(\"1/3\");\n }\n if(count==3)\n {\n printf(\"1/2\");\n }\n if(count==4)\n {\n printf(\"2/3\");\n }\n if(count==5)\n {\n printf(\"5/6\");\n }\n if(count==6)\n {\n printf(\"1/1\");\n }\n }\n else if(w>y)\n {\n for(i=w;i<7;i++)\n {\n count++;\n }\n if(count==1)\n {\n printf(\"1/6\");\n }\n if(count==2)\n {\n printf(\"1/3\");\n }\n if(count==3)\n {\n printf(\"1/2\");\n }\n if(count==4)\n {\n printf(\"2/3\");\n }\n if(count==5)\n {\n printf(\"5/6\");\n }\n if(count==6)\n {\n printf(\"1/1\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main() {\n\tint y,w,max;\n\tscanf(\"%d%d\",&y,&w);\n\t\n\tif(y>w) max=y;\n\telse max=w;\n\t\n\tif(6-max+1==1) printf(\"1/6\\n\");\n\telse if(6-max+1==2) printf(\"1/3\\n\");\n\telse if(6-max+1==3) printf(\"1/2\\n\");\n\telse if(6-max+1==4) printf(\"2/3\\n\");\n\telse if(6-max+1==5) printf(\"5/6\\n\");\n\telse if(6-max+1==6) printf(\"1/1\\n\");\n\t\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int a,b,max,i,count=0;\n scanf(\"%d %d\",&a,&b);\n if(a>=b) max=a;\n else max=b;\n for(i=max;i<=6;i++)\n {\n count++;\n }\n if(count==1) printf(\"1/6\");\n else if(count==2) printf(\"1/3\");\n else if(count==3)printf(\"1/2\");\n else if(count==4)printf(\"2/3\");\n else if(count==5)printf(\"5/6\");\n else if(count==6)printf(\"1/1\");\n return 0;\n}\n"}, {"source_code": "#include \n\nvoid determDenom(int *a,int *c){\n if(*a % 6 == 0){\n *a = *c = 1;\n }else if(*a % 3 == 0){\n *a = 1;\n *c = 2;\n }else if(*a % 4 == 0){\n *a = 2;\n *c = 3;\n }else if(*a % 2 == 0){\n *a = 1;\n *c = 3;\n }else if(*a == 0){\n *a = 0;\n *c = 1;\n }else{\n *c = 6;\n }\n}\n\nint main(){\n int a,b,c;\n scanf(\"%i%*c\",&a);\n scanf(\"%i%*c\",&b);\n if(a > b){\n a--;\n a = 6 - a;\n determDenom(&a,&c);\n printf(\"%i/%i\\n\",a,c);\n }else{\n b--;\n b = 6 - b;\n determDenom(&b,&c);\n printf(\"%i/%i\\n\",b,c);\n }\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int a,b;\n int i,rolls;\n scanf(\"%d%d\",&a,&b);\n if(a>b){\n rolls = 6 - a + 1;\n } else rolls = 6 - b + 1;\n switch(rolls){\n case 1: printf(\"1/6\"); break;\n case 2: printf(\"1/3\"); break;\n case 3: printf(\"1/2\"); break;\n case 4: printf(\"2/3\"); break;\n case 5: printf(\"5/6\"); break;\n case 6: printf(\"1/1\"); break;\n }\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,c;\n double d,e,f,g;\n scanf(\"%d%d\",&a,&b);\n if(a>b)c=a;\n else c=b;\n a=7-c;\n if(a==1)printf(\"1/6\\n\");\n else if(a==2)printf(\"1/3\\n\");\n else if(a==3)printf(\"1/2\\n\");\n else if(a==4)printf(\"2/3\\n\");\n else if(a==5)printf(\"5/6\\n\");\n else printf(\"1/1\\n\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,mmm,i,js;\n while(scanf(\"%d %d\",&a,&b)!=EOF)\n {\n js=0;\n if(a\n#include \n\nint main()\n{\n int a,b;\n int i,rolls;\n scanf(\"%d%d\",&a,&b);\n if(a>b){\n rolls = 6 - a + 1;\n } else rolls = 6 - b + 1;\n switch(rolls){\n case 1: printf(\"1/6\"); break;\n case 2: printf(\"1/3\"); break;\n case 3: printf(\"1/2\"); break;\n case 4: printf(\"2/3\"); break;\n case 5: printf(\"5/6\"); break;\n case 6: printf(\"1/1\"); break;\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n\nint main(){\n\tint a,b;\n\tscanf(\"%d%d\",&a,&b);\n\tint m;\n\tif(a>b)m=a;\n\telse m=b;\n\tif(m==1)printf(\"1/1\");\n\tif(m==2)printf(\"5/6\");\n\tif(m==3)printf(\"2/3\");\n\tif(m==4)printf(\"1/2\");\n\tif(m==5)printf(\"1/3\");\n\tif(m==6)printf(\"1/6\");\n}"}, {"source_code": "#include\nint main()\n{\n int max,a,b,count=0;\n scanf(\"%d%d\",&a,&b);\n if(a>=b)\n {\n max=a;\n }\n else max=b;\n while(max<=6)\n {\n count++;\n max++;\n }\n if(count==1||count==5)\n {\n printf(\"%d/6\",count);\n }\n else if(count==2)\n printf(\"1/3\");\n else if(count==3)\n printf(\"1/2\");\n else if(count==4)\n printf(\"2/3\");\n else if (count==6)\n printf(\"1/1\");\n return 0;\n}"}, {"source_code": "#include\nint main(){\nint a,b,max;\nscanf(\"%d %d\",&a,&b);\nif(a>=b){\n max=a;\n}else{\n max=b;\n }\nif(max==1){printf(\"1/1\");}\nif(max==2){printf(\"5/6\");}\nif(max==3){printf(\"2/3\");}\nif(max==4){printf(\"1/2\");}\nif(max==5){printf(\"1/3\");}\nif(max==6){printf(\"1/6\");}\nreturn 0;\n}"}, {"source_code": "#include \n\n\nint main()\n{\n int y,l,w,s;\n double i;\n scanf(\"%d %d\",&y,&w);\n s=0;\n for(l=y>w?y:w;l<=6;l++){\n s=s+1;\n }\n if(s==1)\n printf(\"1/6\");\n else if(s==2)\n printf(\"1/3\");\n else if(s==3)\n printf(\"1/2\");\n else if(s==4)\n printf(\"2/3\");\n else if(s==5)\n printf(\"5/6\");\n else if(s==6)\n printf(\"1/1\");\n else if(s==0)\n printf(\"0/1\");\n\n\n return 0;\n}"}, {"source_code": "#include\n\nint main(void)\n{\n\tint y,w,x;\n\tdouble p;\n\tscanf(\"%d %d\",&y,&w);\n\tif(w>y) {\n\t\ty=w;\n\t}\n\tp=7.0-y;\n\tp=p/6;\n\tp=p*10;\n\tx=(int)p;\n\tif(x==1) {\n\t\tprintf(\"1/6\");\n\t}\n\telse if(x==3) {\n\t\tprintf(\"1/3\");\n\t}\n\telse if(x==5) {\n\t\tprintf(\"1/2\");\n\t}\n\telse if(x==6) {\n\t\tprintf(\"2/3\");\n\t}\n\telse if(x==8) {\n\t\tprintf(\"5/6\");\n\t}\n\telse {\n\t\tprintf(\"1/1\");\n\t}\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\n\nint main()\n{\n int x, n, m;\n \n scanf(\"%d %d\", &n, &m);\n \n \t\n if(n>m)\n \tx=n;\n if(n\nint w, y;\nint main()\n{\n\nscanf(\"%d %d\", &w, &y);\nif (w < y)\nw = y;\nswitch (w)\n{ case 1 : printf(\"1/1\"); break;\ncase 2 : printf(\"5/6\"); break;\ncase 3 : printf(\"2/3\"); break;\ncase 4 : printf(\"1/2\"); break;\ncase 5 : printf(\"1/3\"); break;\ncase 6 : printf(\"1/6\"); break;\nreturn 0; }\n}"}, {"source_code": "\n#include \nint main(){ \n int a,b,A,B; \n scanf(\"%d%d\",&a,&b); \n if(a>b){ \n A=7-a; \n } \n else { \n A=7-b; \n } \n if(A%6==0){\n printf(\"%d/%d\\n\",A/6,1);\n return 0;\n }\n if(A%3==0){ \n printf(\"%d/%d\\n\",A/3,2);\n return 0; \n } \n if(A%2==0){ \n printf(\"%d/%d\\n\",A/2,3);\n return 0; \n }\n\n printf(\"%d/%d\\n\",A,6); \n return 0; \n}"}, {"source_code": "#include\nint main()\n{\n int Y,W,i=0,k,j=6;\n scanf(\"%d %d\",&Y,&W);\n if(Y>W)\n k=Y;\n else\n k=W;\n i=7-k;\n switch(i)\n {\n\n case 0:\n {\n printf(\"%d/%d\",0,1);break;\n }\n case 1:\n {\n printf(\"%d/%d\",1,6);break;\n }\n case 2:\n {\n printf(\"%d/%d\",1,3);break;\n }\n case 3:\n {\n printf(\"%d/%d\",1,2);break;\n }\n case 4:\n {\n printf(\"%d/%d\",2,3);break;\n }\n case 5:\n {\n printf(\"%d/%d\",5,6);break;\n }\n case 6: {\n printf(\"%d/%d\",1,1);break;\n }\n }\n\n}\n"}, {"source_code": "#include\nint max(int a,int b){\n if(a>b) return a;\n else return b;\n}\nint main(){\n int wak,yak,doe,d;\n scanf(\"%d %d\\n\",&wak,&yak);\n d=max(wak,yak);\n doe=6-d+1;\n switch(doe){\n case 0 : printf(\"0/6\");\n break;\n case 1 : printf(\"1/6\");\n break;\n case 2 : printf(\"1/3\");\n break; \n case 3 : printf(\"1/2\");\n break; \n case 4 : printf(\"2/3\");\n break;\n case 5 : printf(\"5/6\");\n break;\n case 6 : printf(\"1/1\");\n break;\n }\n return 0;\n}"}, {"source_code": "\n#include \nint w, y;\nint main()\n{\n\nscanf(\"%d %d\", &w, &y);\nif (w < y)\nw = y;\nswitch (w)\n{ case 1 : printf(\"1/1\"); break;\ncase 2 : printf(\"5/6\"); break;\ncase 3 : printf(\"2/3\"); break;\ncase 4 : printf(\"1/2\"); break;\ncase 5 : printf(\"1/3\"); break;\ncase 6 : printf(\"1/6\"); break;\nreturn 0; }\n}"}, {"source_code": "#include \n\nint main(){\n int a,b,max,n;\n scanf(\"%d%d\",&a,&b);\n if(a>b)\n max=a;\n else\n max=b;\n n=6-max+1;\n if(6%n==0){\n printf(\"1/%d\",6/n);\n }\n else\n {\n if(n%2==0)\n printf(\"%d/3\",n/2);\n else\n printf(\"%d/6\",n);\n }\n}\n"}, {"source_code": "#include\nint main()\n{\n int Y,W,small,large,a,b;\n scanf(\"%d %d\",&Y,&W);\n if(Y>W)\n {\n small=W;\n large=Y;\n }\n else\n {\n small=Y;\n large=W;\n }\n a=6-large+1;\n if(6%a==0)\n {\n\n b=6/a;\n a=1;\n printf(\"%d/%d\",a,b);\n }\n else if(a==4)\n {\n b=3;\n a=2;\n printf(\"%d/%d\",a,b);\n }\n else\n {\n printf(\"%d/6\",a);\n }\n\n\n}\n"}, {"source_code": "#include\nint main()\n{int y,m,x;\nscanf(\"%d%d\",&y,&m);\nif(y>m)\nx=7-y;\nelse\nx=7-m;\nif(x==1)\nprintf(\"%d/6\",x);\nelse if(x==6)\nprintf(\"1/1\");\nelse if(x%2==0)\nprintf(\"%d/3\",x/2);\nelse if(x==3)\nprintf(\"%d/2\",x/3);\nelse if(x==5)\nprintf(\"%d/6\",x);\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,c,m;\n scanf(\"%d%d\",&a,&b);\n if(a>=b)\n {\n c=6-a+1;\n if(c==2||c==4){\n c=c/2;\n m=3;\n }\n else if(c==3)\n {\n c=c/3;\n m=2;\n\n }\n else if(c==6)\n {\n c=1;\n m=1;\n }\n else\n {\n c=6-a+1;\n m=6;\n }\n printf(\"%d/%d\",c,m);\n\n\n return 0;\n }\n else\n {\n c=6-b+1;\n if(c==2||c==4){\n c=c/2;\n m=3;\n }\n else if(c==3)\n {\n c=c/3;\n m=2;\n\n }\n else if(c==6)\n {\n c=1;\n m=1;\n }\n else\n {\n c=6-b+1;\n m=6;\n\n }\n\n\n printf(\"%d/%d\",c,m);\n }\n return 0;\n\n}\n"}, {"source_code": "#include \nint main()\n{\n int a,b,c=1,m;\n scanf(\"%d %d\",&a,&b);\n if(a>b) m=a;\n else m=b;\n c=c+(6-m);\n if(c==1) printf(\"1/6\");\n else if(c==2) printf(\"1/3\");\n else if(c==3) printf(\"1/2\");\n else if(c==4) printf(\"2/3\");\n else if(c==5) printf(\"5/6\");\n else printf(\"1/1\");\n return 0;\n}"}, {"source_code": "\n#include \nint w, y;\nint main()\n{\n\nscanf(\"%d %d\", &w, &y);\nif (w < y)\nw = y;\nswitch (w)\n{ case 1 : printf(\"1/1\"); break;\ncase 2 : printf(\"5/6\"); break;\ncase 3 : printf(\"2/3\"); break;\ncase 4 : printf(\"1/2\"); break;\ncase 5 : printf(\"1/3\"); break;\ncase 6 : printf(\"1/6\"); break;\nreturn 0; }\n}"}, {"source_code": "#include\nint main()\n{\n int y,w;\n scanf(\"%d%d\",&y,&w);\n if(y>=w)\n {\n if (y==1)\n {\n printf(\"1/1\");}\n else if (y==2)\n {\n printf(\"5/6\");}\n\n else if (y==3)\n {\n printf(\"2/3\");}\n\n else if (y==4)\n {\n printf(\"1/2\");}\n\n else if (y==5)\n {\n printf(\"1/3\");}\n\n else if (y==6)\n {\n printf(\"1/6\");}\n }\n if(y\n#include\n\nint firstResult;\nint secondResult;\nint highest;\nint numerator;\nint denominator;\n\nvoid readEntries() {\n scanf(\"%d\", &firstResult);\n scanf(\"%d\", &secondResult);\n}\n\nvoid reduceFraction() {\n while (0 == numerator % 2 || 0 == numerator % 3) {\n if (0 == numerator % 3 && 0 == denominator % 3) {\n numerator /= 3;\n denominator /= 3;\n } else if (0 == numerator % 2 && 0 == denominator % 2) {\n numerator /= 2;\n denominator /= 2;\n } else {\n break;\n }\n } \n}\n\nvoid evaluateResult() {\n if (firstResult > secondResult) {\n highest = firstResult;\n } else {\n highest = secondResult;\n }\n numerator = (6 - highest) + 1;\n denominator = 6;\n reduceFraction();\n}\n\nvoid printResult() {\n printf(\"%d/%d\", numerator, denominator);\n}\n\nint main() {\n readEntries();\n evaluateResult();\n printResult();\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int max, aux, a, restantes;\n int caras = 6;\n max = 0;\n for(a=0;a<2;a++)\n {\n scanf(\"%i\", &aux);\n if(aux > max){max = aux;}\n }\n restantes = caras - max + 1;\n while((restantes%2 == 0) && (caras%2 == 0))\n {\n restantes = restantes/2;\n caras = caras/2;\n }\n while((restantes%3 == 0) && (caras%3 == 0))\n {\n restantes = restantes/3;\n caras = caras/3;\n }\n\n printf(\"%i/%i\", restantes, caras);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n\tint i, j, k;\n\tscanf(\"%d %d\", &i, &j);\n\tif(i\n#include\nint main()\n{\n\tlong long y,w,d,x;\n\tscanf(\"%lld%lld\",&y,&w);\n\tif(y>=w)x=7-y;\n\telse x=7-w;\n\tif(x==1)printf(\"1/6\");\n\tif(x==2)printf(\"1/3\");\n\tif(x==3)printf(\"1/2\");\n\tif(x==4)printf(\"2/3\");\n\tif(x==5)printf(\"5/6\");\n\tif(x==6)printf(\"1/1\");\n\treturn 0;\n}"}, {"source_code": "main(d,w){scanf(\"%u%u\",&d,&w);w=d>w?7-d:7-w;d=(w%3?1:3)*(w%2?1:2);return!printf(\"%u/%u\",w/d,6/d);}"}, {"source_code": "#include\nint main()\n{\n int m,n,p,t,c;\n while(scanf(\"%d %d\",&m,&n)!=EOF){\n if(m<=n){t=m;m=n;n=t;}\n c=m;\n c=(6-c)+1;\n if(c%2==1)\n {\n if(c==3)\n printf(\"1/2\\n\");\n else\n printf(\"%d/6\\n\",c);\n }\n else\n {\n if(c==4)\n printf(\"2/3\\n\");\n else\n printf(\"1/%d\\n\",6/c);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int a,b,i,max,m,n,d,x;\n scanf(\"%d %d\",&a,&b);\n if(a>b)\n max=a;\n else\n max=b;\n m=6-max+1;\n for(i=1;i<=6;i++)\n {\n if(m%i==0&&6%i==0)\n x=i;\n }\n n=m/x;\n d=6/x;\n printf(\"%d/%d\",n,d);\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main(){\n\tint a,b,c,g,e=6,d;\n\tfloat f;\n\tscanf(\"%d%d\",&a,&b);\n\t\n\tc=a;\n\tif(a\nint main()\n{\n unsigned short w, q, max, n1;\n scanf(\"%hu%hu\", &w, &q);\n max = w > q ? w : q;\n n1 = 7 - max;\n if(1 == n1){ printf(\"1/6\"); }\n else if(2 == n1){ printf(\"1/3\"); }\n else if(3 == n1){ printf(\"1/2\"); }\n else if(4 == n1){ printf(\"2/3\"); }\n else if(5 == n1){ printf(\"5/6\"); }\n else{ printf(\"1/1\"); }\n return 0;\n}\n"}, {"source_code": "# include \nint d;\n\nint f1(int a, int b)\n{\n\tif(a>=b)\n\t\treturn a;\n\telse\n\t\treturn b;\n}//find the max\nvoid Swap(int *a, int *b)\n{\n\tif(*a<*b)\n\t{\n\t\tint t;\n\t\tt = *a;\n\t\t*a = *b; \n\t\t*b = t;\n\t}\n\treturn ;\n}\nint f2(int a, int b)\n{\n\tSwap(&a, &b);\n\tif(b==0)\n\t\treturn a;\n\telse\n\t\treturn f2(b, a%b);\n}//find the gcd\n\nint main(void)\n{\n\tint a, b;\n\tscanf(\"%d %d\", &a, &b);\n\ta = f1(a, b);\n\ta = 6-a+1;\n\tb = 6;\n\tif(a==0)\n\t\tprintf(\"0/1\");\n\tif(a==b)\n\t\tprintf(\"1/1\");\n\telse\n\t{\n\t\td = f2(a ,b);\n\t//\tprintf(\"d=%d\\n\",d);\n\t\ta /= d;\n\t\tb /= d;\n\t\tprintf(\"%d/%d\", a, b);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\n\nint main()\n{\nint y,w,p;\nscanf(\"%d%d\",&y,&w);\nif(y==1&&w==1)\n{printf(\"1/1\");}\nelse if(y>w)\n{p=(6-y+1);\nif(p%2==0){p=p/2;\nprintf(\"%d/%d\",p,3);}\nelse if(p%3==0)\n{p=p/3;\nprintf(\"%d/%d\",p,2);\n}\nelse\n printf(\"%d/%d\",p,6);\n}\nelse\n{p=(6-w+1);\nif(p%2==0){p=p/2;\nprintf(\"%d/%d\",p,3);}\nelse if(p%3==0)\n{\n p=p/3;\n\nprintf(\"%d/%d\",p,2);\n}\nelse\n printf(\"%d/%d\",p,6);\n}\n}\n"}], "negative_code": [{"source_code": "#include \nint main()\n{\n int m,n,a,b,c,d;\n scanf(\"%d%d\",&m,&n);\n if(m>n)\n {\n a=6-m+1;\n if(a%2==0)\n {\n b=a/2;\n printf(\"%d/%d\",b,3);\n }\n else if(a%3==0)\n {\n b=a/3;\n printf(\"%d/%d\",b,2);\n }\n else\n {\n printf(\"%d/%d\",a,6);\n }\n\n\n }\n else if(n>m)\n {\n c=6-n+1;\n if(c%2==0)\n {\n d=c/2;\n printf(\"%d/%d\",d,3);\n }\n else if(c%3==0)\n {\n d=c/3;\n printf(\"%d/%d\",d,2);\n }\n else\n {\n printf(\"%d/%d\",c,6);\n }\n\n }\n else\n {\n printf(\"%d/%d\",1,1);\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int y,w,i,temp,j;\n\n scanf(\"%d %d\",&y,&w);\n\n if(y>w)\n {\n if(y%w==0) printf(\"1/%d\\n\",y/w);\n else printf(\"%d/%d\\n\",w,y);\n }\n else if(y\nint main ()\n{\n int y,w ,p ,count=0,m=0,i;\n\n scanf(\"%d%d\",&y,&w) ;\n\n if(y==w)\n {\n for(i=y ;i<=6 ;i++)\n {\n count++ ;\n }\n }\n\n\n\n\n else if (y>w)\n\n {\n for(i=y ;i<=6 ;i++)\n {\n count++ ;\n }\n }\n\n else if(w>y)\n {\n for(i=w ;i<=6 ;i++)\n {\n count++ ;\n }\n }\n\n\n // printf(\"%d \\n\",count) ;\n\n if(count==1)\n {\n printf(\"1/1\") ;\n }\n else if(count==0)\n {\n printf(\"0/1\") ;\n\n }\n else if ( count >1 ) {\n\n if(count%2==0)\n {\n p= count/2 ;\n\n printf(\"%d/3\",p) ;\n }\n else if(count%3==0)\n {\n p=count/3 ;\n\n printf(\"%d/2\",p) ;\n }\n\n else {\n printf(\"%d/6\",count) ;\n }\n\n\n}\n return 0 ;\n}\n"}, {"source_code": "#include\nint main(){\n int y,w,mx;\n int p;\n scanf(\"%d %d\",&y,&w);\n if(y>=w)mx=y;\n else mx=w;\n p=(7-mx);\n if(6%(7-mx)==0){\n p=6/(7-mx);\n\n\n printf(\"1/%d\",p);\n }\n else printf(\"%d/6\",p);\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int Y,W,temp,a=6;\n scanf(\"%d %d\",&Y,&W);\n if(Y==W)\n {\n printf(\"%d/%d\",0,1);\n }\n else if(Y>W)\n {\n temp=6-Y+1;\n if(temp%3==0)\n {\n temp=temp/3;\n a=a/3;\n }\n else if(temp%2==0)\n {\n temp=temp/2;\n a=a/2;\n }\n printf(\"%d/%d\",temp,a);\n }\n else\n {\n temp=6-W+1;\n if(temp%3==0)\n {\n temp=temp/3;\n a=a/3;\n }\n else if(temp%2==0)\n {\n temp=temp/2;\n a=a/2;\n }\n printf(\"%d/%d\",temp,a);\n }\n}"}, {"source_code": "#include \n#include \n\nint main(void)\n{\n\tint c, y, x = 0, w, i;\n\tscanf (\"%i%i\",&y,&w);\n\n\tif (w == y)\n\t\tc = 7 - w;\n\telse if (w < y)\n\t\t\tc = 7 - y;\n\telse if (w > y)\n\t\t\tc = 7 - w;\n\telse {\n\t\tprintf(\"0/1\\n\");\n\t}\n\n\tfor (i = 2; i <= c; i++)\n\t\tif (c % i == 0 && 6 % i == 0)\n\t\t{\n\t\t\tx = i;\n\t\t\tbreak;\n\t\t}\n\tif (x == 0)\n\t\tprintf(\"%i/%i\\n\",c,(6));\n\telse printf(\"%i/%i\\n\",(c/i),(6/i));\n\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint n,m;\n\tscanf(\"%d %d\",&n,&m);\n\tint max;\n\tif(n > m) max = n;\n\telse {\n\t\tmax = m;\n\t}\n\tint ctr = 0;\n\tfor(int i = max;i<=6;i++)\n\t{\n\t\tctr++;\n\t}\n\tif(n == 0 && m == 0) printf(\"1/1\\n\");\n\telse if(max == 6) printf(\"1/6\\n\");\n\telse if(max == 5) printf(\"1/3\\n\");\n\telse if(max == 4) printf(\"1/2\\n\");\n\telse if(max == 3) printf(\"2/3\\n\");\n\telse if(max == 2) printf(\"5/6\\n\");\n\telse if(max == 1) printf(\"6/6\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int y, w, max, num;\n scanf(\"%d %d\",&y, &w);\n max = y > w ? y : w;\n num = 7 - max;\n if(num == 5)\n printf(\"5/\");\n else if(num == 4)\n printf(\"2/\");\n else\n printf(\"1/\");\n if(num == 6)\n printf(\"1\");\n else if(num == 3)\n printf(\"2\");\n else if ((num == 5) || (num == 1))\n printf(\"6\");\n else\n printf(\"2\");\n return 0;\n}\n"}, {"source_code": "\n#include \nint w, y, max;\nint main()\n{\n scanf(\"%d, %d, %d\", &w, &y, &max);\n if ( w > y ) max= w;\n else max = y;\n if (max== 1) printf(\"1/1\");\n if (max == 2) printf(\"5/6\");\n if (max == 3) printf(\"2/3\");\n if (max == 4) printf(\"1/2\");\n if (max == 5) printf(\"1/3\");\n if (max == 6) printf(\"1/6\");\n return 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n int Y, W;\n int D;\n scanf(\"%i %i\", &Y, &W);\n\n if(Y >= W)\n {\n D = (6 - Y) + 1;\n }\n else\n {\n D = (6 - W) + 1;\n }\n\n printf(\"%i/%i \\n\", D/D, 6/D);\n\n}"}, {"source_code": "#include \n\nint main()\n{\n int y, w, b, c;\n scanf(\"%d %d\", &y, &w);\n b = (y>w)?y:w;\n c = 6-b+1;\n switch(c)\n {\n case 1: printf(\"1/6\\n\"); break;\n case 2: printf(\"2/3\\n\"); break;\n case 3: printf(\"1/2\\n\"); break;\n case 4: printf(\"2/3\\n\"); break;\n case 5: printf(\"5/6\\n\"); break;\n case 6: printf(\"1\\n\"); break;\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\n\nint main()\n{\n int x, n, m;\n \n scanf(\"%d %d\", &n, &m);\n \n \t\n if(n>m)\n \tx = 6-n+1;\n if(n\n#include \n\nint main()\n{\n int arr [3];\n int x=1;\n for (int i=0;i<2;i++)\n {\n scanf(\"%d\",&arr[i]);\n }\n for (int i=0;i<2;i++)\n {\n if(x\n#include \n\nint main(void)\n{\n int Y, W;\n int biggest;\n int chance;\n char result[2];\n\n scanf(\"%i %i\",&Y,&W);\n \n if(Y > W)\n biggest = Y;\n else\n biggest = W;\n\n chance = 6 - biggest + 1;\n\n switch(chance)\n { \n case 1:\n result[0] = '1';\n result[1] = '/';\n result[2] = '6';\n break;\n case 2:\n result[0] = '1';\n result[1] = '/';\n result[2] = '3';\n break;\n case 3:\n result[0] = '1';\n result[1] = '/';\n result[2] = '2';\n break;\n case 4:\n result[0] = '2';\n result[1] = '/';\n result[2] = '3';\n break;\n case 5:\n result[0] = '5';\n result[1] = '/';\n result[2] = '6';\n break;\n case 6:\n result[0] = '6';\n result[1] = '/';\n result[2] = '6';\n break;\n }\n\n printf(\"%3s\\n\",result);\n printf(\"%u\\n\",strlen(result));\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 \n#include \n\nint main()\n{\n int y,w,largest=0,s=0,n,d=6;\n scanf(\"%d %d\",&y,&w);\n if (y>w)largest=y;\n else largest=w;\n\n for(int i=1;i<7;i++)\n {\n if(i>=largest)s++;\n }\n n=s;\n\n if(d%n==0)\n {\n d = 6/n;\n n = 1;\n }\n\n printf(\"%d/%d\",n,d);\n\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 \n#include \n\nint main()\n{\n int i,j;\n scanf(\"%d%d\",&i,&j);\n if(i==2&&i>j){\n printf(\"5/6\");\n }\n else if(i==3&&i>j){\n printf(\"2/3\");\n }\n else if(i==4&&i>j){\n printf(\"1/2\");\n }\n else if (i==5&&i>j){\n printf(\"1/3\");\n\n }\n else if (i==6&&i>j){\n printf(\"1/6\");\n }\n else if (i==1&&i==j){\n printf(\"1/1\");\n }else if(j==2&&i\n\nint main()\n{\n int Y, W;\n int D;\n scanf(\"%i %i\", &Y, &W);\n\n if(Y >= W)\n {\n D = (6 - Y) + 1;\n }\n else\n {\n D = (6 - W) + 1;\n }\n\n if(D <= 3)\n {\n printf(\"%i/%i \\n\", D/D, 6/D);\n }\n else if( D == 6)\n {\n printf(\"%i/%i \\n\", 1, 1);\n }\n else\n {\n printf(\"%i/%i \\n\", D, 6);\n\n }\n\n}"}, {"source_code": "#include \nint main() {\n int a, b, c, w, y;\n scanf(\"%d %d\", &w, &y);\n if (w>=y){\n a=7-w;\n }\n else {\n a=7-y;\n }\n \n if (6%a!=0){\n printf(\"%d/6\", a);\n }\n else {\n b=1;\n c=6/a;\n printf(\"%d/%d\", b, c);\n }\n\n return 0;\n}"}, {"source_code": "#include /*\\n* ||*/\nint main()\n{\n int Y,W,s,m,n=6,A,B,i;\n scanf(\"%d %d\",&Y,&W);\n if(Y>W)\n s=Y;\n else\n s=W;\n m=(6-s)+1;\n for(i=2;i<=6;i++)\n {\n if(m%i==0 && n%i==0){\n A=m/i;\n B=n/i;\n }\n }\n printf(\"%d/%d\",A,B);\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint W,Y,D;\n\tscanf(\"%d%d\",&W,&Y);\n\tint p=0;\n \tif(W>=Y){\n\t\t\n\t\tfor(D=W;D<=6;D++){\n\t\t\tp++;}\n\t\t\tif(6%p==0){\n\t\t\t\tint d=(6/p);\n\t\t\tprintf(\"%d/%d\\n\",1,d);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tprintf(\"%d/%d\",p/2,3);\n\t\t\t}\n \t}\n\t\t\n\t\n if (Y>W){\n\t\tfor(D=Y;D<=6;D++){\n\t\tint q=0;\n\t\t\tprintf(\"%d/%d\\n\",q,6);\n\t\t\tq++;}}\n\t\t\n\t\n\treturn 0;\n}\n\t\t\t\n\t"}, {"source_code": "#include\nint main()\n{\n int a,b,p,n;\n scanf(\"%d %d\",&a,&b);\n int c=a>b?a:b;\n \n int d=7-c;\n for(int i=2;i<=3;i++)\n {\n if(d%i==0&&6%i==0)\n {\n n=d/i;\n p=6/i;\n if(n==p)\n {\n n=1;p=1;\n }\n }\n else\n {\n n=d;\n p=6;\n }\n }\n printf(\"%d/%d\",n,p);\n return 0; \n}"}, {"source_code": " #include\n int main()\n {\n int y,w,n=0,d=6,max,num,den,i;\n scanf(\"%d %d\", &y, &w);\n if(y>w)\n max=y;\n else\n max=w;\n for(i=1;i<=6;i++)\n {\n if(i>=max)\n n++;\n }\n if(n<=d)\n {\n if(d%n==0)\n {\n den=d/n;\n num=n/n;\n }\n }\n printf(\"%d\",num/den);\n }"}, {"source_code": "#include\nint main()\n{\n long long int w,y;\n scanf(\"%lld %lld\",&y,&w);\n if(w==y)\n printf(\"1/1\");\n else\n printf(\"1/2\");\n}"}, {"source_code": "#include\nint main()\n{\n int a,b,p,n;\n scanf(\"%d %d\",&a,&b);\n int c=a>b?a:b;\n \n int d=7-c;\n if(6%d!=0)\n {\n n=1+6/d;\n p=6/d+6%d;\n }\n else\n {\n n=1;\n p=6/d;\n }\n printf(\"%d/%d\",n,p);\n return 0; \n}"}, {"source_code": "\n#include \n\nint main()\n{\n int y, w, max = 0, A = 0, B = 0;\n scanf(\"%d &d\", &y, &w);\n\t\n\t\tif (y>=w)\n\t\t{\n\t\t\tA = (6 - y) + 1;\n\t\t}\n\t\telse \n\t\t{\n\t\t\tA = (6 - w) + 1;\n\t\t}\n \n\t\n \n\tswitch (A)\n\t{\n\t\tcase 6: A= 1; B = 1; break;\n\t\tcase 4: A= 2; B = 3; break;\n\t\tcase 3: A= 1; B = 2; break;\n\t\tcase 2: A= 1; B = 3; break;\n\t\tcase 0: A= 0; B = 1; break;\n\t\tdefault : B = 6;\n\t}\n \n printf(\"%d\\/%d\", A,B);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n if(a>b)\n {\n if(a==1)\n printf(\"1/1\\n\");\n else if(a==2)\n printf(\"5/6\\n\");\n else if(a==3)\n printf(\"2/3\\n\");\n else if(a==4)\n printf(\"1/2\\n\");\n else if(a==5)\n printf(\"1/3\\n\");\n else if(a==6)\n printf(\"1/1\\n\");\n else if(a==0)\n printf(\"0/1\\n\");\n }\n if(amax){\n\t\tmax=m;\n\t}\n\tint tmp= 6-max+1;\n\tfor(int i=6;i>=2;i--){\n\t\tif(tmp%i==0 && 6%i==0){\n\t\t\tprintf(\"%d/%d\",tmp/i,6/i);\n\t\t\treturn 0;\n\t\t}\n\t}\n\n}"}, {"source_code": "#include\nint main()\n{\n int w,y,s=0,p=0;\n scanf(\"%d %d\",&w,&y);\n if(w>=y)\n {\n //if(w==6)\n // printf(\"0/6\\n\");\n if(w==1)\n printf(\"1/1\\n\");\n else if(w<6 && w>1)\n {\n s=(6-w)+1;\n if(s%2==0)\n printf(\"%d/3\\n\",s/2);\n else if(s%3==0)\n printf(\"%d/2\\n\",s/3);\n else\n printf(\"%d/6\\n\",s);\n }\n }\n if(y>w)\n {\n // if(y==6)\n //printf(\"0/6\\n\");\n if(y==1)\n printf(\"1/1\\n\");\n else if(y<=6 && y>1)\n {\n p=(6-y)+1;\n if(p%2==0)\n printf(\"%d/3\\n\",p/2);\n else if(p%3==0)\n printf(\"%d/2\\n\",p/3);\n else\n printf(\"%d/6\\n\",p);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(){\n\tint y, w, i;\n\tscanf(\"%d\", &y);\n\tscanf(\"%d\", &w);\n\tif(y>w){\n\t\ti=y;\n\t}\n\telse{\n\t\ti=w;\n\t}\n\tif(i=1){\n\t\tprintf(\"1/1\");\n\t}\n\telse if(i=2){\n\t\tprintf(\"5/6\");\n\t}\n\telse if(i=3){\n\t\tprintf(\"2/3\");\n\t}\n\telse if(i=4){\n\t\tprintf(\"1/2\");\n\t}\n\telse if(i=5){\n\t\tprintf(\"1/2\");\n\t}\n\telse if(i=6){\n\t\tprintf(\"1/6\");\n\t}\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int Y,W,n;\n scanf(\"%d\", &Y);\n scanf(\"%d\", &W);\n if(Y==6 && W==6)\n {\n printf(\"1/1\");\n }\n else if(Y==W)\n {\n n = (6-Y)+1;\n }\n else if(Y>W)\n {\n n=(6-Y)+1;\n }\n else\n {\n n=(6-W)+1;\n\n }\nif(n==2)\n{\n printf(\"1/3\");\n}\nelse if(n==3)\n{\n printf(\"1/2\");\n}\nelse if(n==4)\n{\n printf(\"2/3\");\n}\nelse if(n==5)\n{printf(\"5/6\");}\nelse\n{\n printf(\"1/1\");\n}\n return 0;\n}\n"}, {"source_code": "#include\nvoid coprime(int ,int);\nint main()\n{\n int y,w,d,l;\n scanf(\"%d%d\",&y,&w);\n if((y>6) || (w>6))\n printf(\"invalid choice\\n\");\n l=(y>=w)?y:w;\n d=6-l+1;\n coprime(d,6);\n return 0;\n}\nvoid coprime(int a,int b)\n{\n int i;\n for(i=2;i<=a;i++)\n {\n if(a%i==0)\n {\n if(b%i==0)\n {\n a=a/i;\n b=b/i;\n continue;\n }\n }\n }\n printf(\"probability is %d/%d\",a,b);\n}"}, {"source_code": "#include\nint main()\n{\n int Y,W,max,numerator;\n scanf(\"%d%d\",&Y,&W);\n\n max=Y;\n if(max\nint main(){\n int y,w,x,f ,j, ox;\n j=6;\n scanf(\"%d\",&y);\n scanf(\"%d\",&w);\n x=(y>=w)? y:w;\n if (y==w)\n printf(\"1/1\");\n else\n if ((w==6)||(y==6)) printf(\"0/1\") ;\n else\n if (x>=5) printf(\"1/2\");\n else\n if (x<5) {\n f= 7-x ;\n if (j%f==0) {\n ox=j ;\n j=j/f;\n f=f/f ;\n printf(\"%d/%d\",f ,j);}\n else if (f%2==0 )\n \n printf(\"%d/%d\",f/2,(j/2));\n \n else\n printf(\"%d/6\",f);\n}\nreturn 0;}\n"}, {"source_code": "#include \n#include \nint main () {\n int x,y,a,b;\n scanf(\"%d%d\",&x,&y);\n if ((x == 1) && (y == 1)) printf(\"1/1\\n\"); else {\n int tmp;\n tmp = (x > y) ? x : y;\n tmp--;\n a = 6-tmp;\n b = 6;\n if (!(b % a)) {\n b = b/a;\n a = 1;\n }\n printf(\"%d/%d\\n\",a,b); \n }\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int i,y,w;\n scanf(\"%d %d\",&y,&w);\n int count=0;\n if(y>w)//4,2\n for(i=y;i<7;i++){\n count++;}\n else if(w>y)//1,2\n for(i=y;i<7;i++){\n count++;}\n else if(y==w && y>1)//3,3\n for(i=y;i<7;i++){\n count++;}\n else if(y=w=1)\n printf(\"1/1\");\n switch(count){\n case 1: printf(\"1/6\");\n break;\n case 2: printf(\"1/3\");\n break;\n case 3: printf(\"1/2\");\n break;\n case 4: printf(\"2/3\");\n break;\n\n case 5: printf(\"5/6\");\n break;\n case 6: printf(\"1/1\");\n break;\n\n\n\n\n }\n\n\n\n}\n"}, {"source_code": "//\n// main.c\n// code forces\n//\n// Created by Irfan Naufal Ardila on 11/15/17.\n// Copyright © 2017 Irfan Naufal Ardila. All rights reserved.\n//\n\n\n\n\n#include \nint main (){\n int A,B,i,c,d=0;\n scanf(\"%d%d\",&A,&B);\n c=A-B;\n if (c<0){\n for (i=B;i<=6;i++){\n ++d;}\n if (d==0 ){\n printf (\"0/1\");\n return 0;}\n else if(d==1 || d==6){\n printf (\"1/1\");\n return 0;}\n else if (d==2 || d== 4){\n printf(\"%d/3\",d/2);\n return 0;}\n else if(d==3){\n printf (\"1/2\");\n return 0;}\n else if (d==5){\n printf(\"5/6\");\n return 0;}}\n else {\n for (i=A;i<=6;i++){\n ++d;}\n \n if (d==0 ){\n printf (\"0/1\");\n return 0;}\n else if(d==1 || d==6){\n printf (\"1/1\");\n return 0;}\n else if (d==2 || d== 4){\n printf(\"%d/3\",d/2);\n return 0;}\n else if(d==3){\n printf (\"1/2\");\n return 0;}\n else if (d==5){\n printf(\"5/6\");\n return 0;}}\n return 0;}\n\n"}, {"source_code": "#include\n\nint main(){\n\tint a[2];\n\tscanf(\"%d %d\",&a[0],&a[1]);\n\tfloat max;\n\tfloat count;\n\tmax=(a[0]>=a[1])?a[0]:a[1];\n\t//printf(\"%f\\n\",max);\n\tcount=((7-max)/6);\n\tprintf(\"%f\\n\",count);\n\t//printf(\"%f\",count/6);\n\treturn(0);\n}\n"}, {"source_code": "#include\nint main(){\n int y,w,x,f ,j, ox;\n j=6;\n scanf(\"%d\",&y);\n scanf(\"%d\",&w);\n x=(y>=w)? y:w;\n if (y==w)\n printf(\"1/1\");\n else\n if ((w==6)||(y==6)) printf(\"0/1\") ;\n else\n if (x>=5) printf(\"1/2\");\n else\n if (x<5) {\n f= 7-x ;\n if (j%f==0) {\n ox=j ;\n j=j/f;\n f=f/f ;\n printf(\"%d/%d\",f ,j);}\n else if (f%2==0 )\n \n printf(\"%d/%d\",f/2,(j/2));\n \n else\n printf(\"%d/6\",f);\n}\nreturn 0;}\n"}, {"source_code": "#include\nint main()\n{\n int Y,W,max,numerator;\n scanf(\"%d%d\",&Y,&W);\n\n max=Y;\n if(max\n\nint main()\n{\n int i, j, ans, max = 0;\n\n scanf(\"%d%d\", &i, &j);\n\n if(max < i)\n max = i;\n if(max < j)\n max = j;\n\n ans = 7 - max;\n\n if (ans == 1)\n printf(\"1/6\");\n\n else if (ans == 2)\n printf(\"1/3\");\n\n else if (ans == 3)\n printf(\"1/2\");\n\n else if (ans == 4)\n printf(\"2/3\");\n\n else if (ans == 5)\n printf(\"5/6\");\n\n else\n printf(\"1\");\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\n int gcd(int a , int b)\n{\n int min,max ; if(a<=b){min=a; max=b;} else{min=b; max=a;}\n for(int i=min ; i>1 ; i-- )\n {\n if(max%i==0)\n return i ;\n }\n}\nint main()\n{\n int x,max;\n scanf(\"%d\",&x);\n max=x;\n scanf(\"%d\",&x);\n if(x>max)\n max=x;\n int dom = 7-max;\n int g=gcd(dom,6);\n printf(\"%d/%d\", dom/g , 6/g );\n}\n"}, {"source_code": "\n#include\n\nint main()\n{\n int i, j, max = 0;\n double ans;\n\n scanf(\"%d%d\", &i, &j);\n\n if(max < i)\n max = i;\n if(max < j)\n max = j;\n\n ans = (7-max)/6.0;\n printf(\"%lf\", ans);\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int y,w,i,temp,j;\n\n scanf(\"%d %d\",&y,&w);\n\n if(y>w)\n {\n if(y%w==0) printf(\"1/%d\\n\",y/w);\n else printf(\"%d/%d\\n\",w,y);\n }\n else if(y\n\nint main() {\n\tint x,y,z,a=6,i,b=0;\n\tscanf(\"%d%d\",&x,&y);\n\tif(x>=y)\n\tz=x;\n\telse if(y>x)\n\tz=y;\n\tfor(i=z;i<7;i++)\n\tb++;\n\tfor(i=b;i<7;i++)\n\t{\n\t if(b%i==0&&a%i==0)\n\t {\n\t b=b/i;\n\t a=a/i;\n\t break;\n\t }\n\t}\n\tprintf(\"%d/%d\",b,a);\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{ \n int y,w;\n scanf(\"%d %d\",&y,&w);\n if(y+w<6 && y+w>2)\n printf(\"1/2\");\n else if(y+w==2)\n printf(\"1/1\");\n else \n printf(\"0/1\");\n}"}, {"source_code": "#include\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n if(b==0)printf(\"0/1\\n\");\n else if(b==1)printf(\"1/1\\n\");\n else if(b==2)printf(\"1/2\\n\");\n else if(b==3)printf(\"1/3\\n\");\n else if(b==4)printf(\"1/4\\n\");\n else if(b==5)printf(\"1/5\\n\");\n else if(b==6)printf(\"1/6\\n\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,c,m;\n scanf(\"%d%d\",&a,&b);\n if(a>=b)\n {\n c=6-a+1;\n if(c==2||c==4){\n c=c/2;\n m=3;\n }\n else if(c==3)\n {\n c=c/3;\n m=2;\n\n }\n else if(c==6)\n {\n c=1;\n m=1;\n }\n\n printf(\"%d/%d\",c,m);\n return 0;\n }\n else\n {\n c=6-b+1;\n if(c==2||c==4){\n c=c/2;\n m=3;\n }\n else if(c==3)\n {\n c=c/3;\n m=2;\n\n }\n else if(c==6)\n {\n c=1;\n m=1;\n }\n\n printf(\"%d/%d\",c,m);\n return 0;\n }\n \n\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,max,i,count=0;\n scanf(\"%d %d\",&a,&b);\n if(a>=b) max=a;\n else max=b;\n for(i=max;i<=6;i++)\n {\n count++;\n }\n printf(\"%d\",count);\n if(count==1) printf(\"1/6\");\n else if(count==2) printf(\"1/3\");\n else if(count==3)printf(\"1/2\");\n else if(count==4)printf(\"2/3\");\n else if(count==5)printf(\"5/6\");\n else if(count==6)printf(\"1/1\");\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n\tint y,w;\n\tscanf(\"%d %d\",&y,&w);\n\t\n\tint max=0;\n\tif (y>w)\n\t\tmax=y;\n\telse\n\t\tmax=w;\n\n\tint k=6;\n\t\n\t\n\tif(k-max==5)\n\t\tprintf(\"1/1\\n\");\n\telse if(k-max==4)\n\t\tprintf(\"5/6\\n\");\n\telse if(k-max==3)\n\t\tprintf(\"4/6\\n\");\n\telse if(k-max==2)\n\t\tprintf(\"1/2\\n\");\n\telse \n\t\tprintf(\"1/3\\n\");\n\n\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n\n int x, y, i, j, c=0, h, l;\n scanf(\"%d%d\",&x, &y);\n if(x > y || x == y)\n {\n i = x;\n }\n else\n {\n i = y;\n }\n for(; i<7; i++)\n {\n\n c++;\n }\n if(c == 1 || c == 2 || c == 3 || c == 6)\n {\n h = 1;\n l = 6/c ;\n }\n if(c == 4)\n {\n h = 2;\n l = 3;\n }\n if(c == 5)\n {\n h = 5;\n l = 6;\n }\n\n printf(\"%d / %d\\n\", h, l);\n\n return 0;}\n\n\n\n\n /* if(b>0 &&b<=1){\n printf(\"q\");}\n\n if(b>1 &&b<=2){\n printf(\"w\");}\n\n if(b>2 &&b<=3){\n printf(\"e\");}\n\n if(b>3 &&b<=4){\n printf(\"r\");}\n\n if(b>4 &&b<=5){\n printf(\"t\");}\n\n }*/\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": " #include\n int main()\n {\n int y,w,n=0,d=6,max,num,den,i,j=2;\n scanf(\"%d %d\", &y, &w);\n if(y>w)\n max=y;\n else\n max=w;\n \n for(i=1;i<=6;i++)\n { \n if(max==6)\n n=0;\n else if (i>=max)\n n++;\n }\n \n if(n<=d)\n {\n \n while(d%j!=0 && n%j!=0)\n {\n j++;\n }\n if(n==0)\n {\n num=0;\n den=1;\n }\n \n else if(n==6)\n {\n num=1;\n den=1;\n }\n else if (d%j==0 && n%j==0)\n {\n den=d/j;\n num=n/j;\n }\n else\n {\n den=d;\n num=n;\n }\n\n }\n \n printf(\"%d/%d\",num,den);\n \n }"}, {"source_code": "#include \nint main(){\n int a,b;\n scanf(\"%d%d\",&a,&b);\n int max=a>b?a:b;\n int ans=6-max+1;\n if(ans%2==0) printf(\"%d/3\",ans/2);\n else if(ans==3) printf(\"1/2\");\n else if(ans==6) printf(\"1/1\");\n else printf(\"%d/6\",ans);\n return 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\nint w,y,prob,common;\nFILE *ifp ,*ofp;\n\nifp= fopen(\"file.in\",\"r\");\nofp = fopen(\"file.out\",\"w\");\nfscanf(ifp,\"%d %d\",&w,&y);\nprob = 6 - (w>y ? w:y) +1;\ncommon = GCD(prob,6);\nfprintf(ofp,\"%d/%d\", prob/common, 6/common);\n\n\n\n\n}\n\nint GCD(int n, int m){\n int gcd,remainder;\n\n while (n!=0){\n remainder = m%n;\n m=n;\n n=remainder;\n }\n\n gcd = m;\n return gcd;\n}\n"}, {"source_code": "#include \nint main() {\n int a, b, c, w, y;\n scanf(\"%d %d\", &w, &y);\n if (w>=y){\n a=7-w;\n }\n else {\n a=7-y;\n }\n \n if (6%a!=0){\n printf(\"%d/6\", a);\n }\n else {\n b=1;\n c=6/a;\n printf(\"%d/%d\", b, c);\n }\n\n return 0;\n}"}, {"source_code": "#include /*\\n* ||*/\nint main()\n{\n int Y,W,s,m,n=6,A,B,i;\n scanf(\"%d %d\",&Y,&W);\n if(Y>W)\n s=Y;\n else\n s=W;\n m=(6-s)+1;\n for(i=2;i<=6;i++)\n {\n if(m%i==0 && n%i==0){\n A=m/i;\n B=n/i;\n }\n }\n printf(\"%d/%d\",A,B);\n}\n"}, {"source_code": "#include\nint main()\n{\n int y,w,a,b;\n scanf(\"%d %d\",&y,&w);\n if(y>=w)\n {\n a=(6-(y-1));\n b=6;\n if(b%2==0 && a%2==0)\n {\n b=b/2;\n a=a/2;\n }\n else if(b%3==0 && a%3==0)\n {\n b=b/3;\n a=a/3;\n }\n }\n else\n {\n a=(6-(w-1));\n b=6;\n if(b%2==0 && a%2==0)\n {\n b=b/2;\n a=a/2;\n }\n else if(b%3==0 && a%3==0)\n {\n b=b/3;\n a=a/3;\n }\n }\n printf(\"%d/%d\",a,b);\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int y,t,d;\n scanf(\"%d %d\",&y,&t);\n if(y>t){\n d = 7-y;\n }\n else {\n d = 7-t;\n }\n if(d==1){\n printf(\"1/6\");\n }\n else if(d==2){\n printf(\"1/3\");\n }\n else if(d==3){\n printf(\"1/2\");\n }\n else if(d==4){\n printf(\"2/3\");\n }\n else if(d==5){\n printf(\"5/4\");\n }\n else if(d==6){\n printf(\"1/1\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int y,w,res,a,b,i,j;\n\n scanf(\"%d %d\",&y,&w);\n\n if(y>=w)\n {\n a=(6-(y-1));\n b=6;\n if(b%a==0){\n i=a/a;\n j=b/a;\n printf(\"%d/%d\\n\",i,j);\n }\n else{\n printf(\"%d/%d\\n\",a,b);\n }\n }\n else if(y<=w)\n {\n a=(6-(w-1));\n b=6;\n if(b%a==0){\n i=a/a;\n j=b/a;\n printf(\"%d/%d\\n\",i,j);\n }\n else{\n printf(\"%d/%d\\n\",a,b);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \n\n\nint main()\n{\n int y,l,w,s;\n scanf(\"%d %d\",&y,&w);\n s=0;\n for(l=y>w?y:w;l<=6;l++){\n s=s+1;\n }\n printf(\"%d/6\",s);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint a,b,c;\n\tscanf(\"%d%d\",&a,&b);\n\tif(a\nint main()\n{\n int w,y,s=0,p=0;\n scanf(\"%d %d\",&w,&y);\n if(w>=y)\n {\n if(w==6)\n printf(\"0/6\\n\");\n else if(w==1)\n printf(\"1/1\\n\");\n else if(w<6 && w>1)\n {\n s=(6-w)+1;\n if(s%2==0)\n printf(\"%d/3\\n\",s/2);\n else if(s%3==0)\n printf(\"%d/2\\n\",s/3);\n else\n printf(\"%d/6\\n\",s);\n }\n }\n if(y>w)\n {\n if(y==6)\n printf(\"0/6\\n\");\n else if(y==1)\n printf(\"1/1\\n\");\n else if(y<6 && y>1)\n {\n p=(6-y)+1;\n if(p%2==0)\n printf(\"%d/3\\n\",p/2);\n else if(p%3==0)\n printf(\"%d/2\\n\",p/3);\n else\n printf(\"%d/6\\n\",p);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n long a,b;\n \n scanf(\"%ld%ld\",&a,&b);\n if(b>a) a=b;\n if(b==1) printf(\"1/1\");\n else if(b==2) printf(\"5/6\");\n else if(b==3) printf(\"2/3\");\n else if(b==4) printf(\"1/2\");\n else if(b==5) printf(\"1/3\");\n else if(b==6) printf(\"1/6\");\n return 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n int a,b,p,n;\n scanf(\"%d %d\",&a,&b);\n int c=a>b?a:b;\n \n int d=7-c;\n if(6%d!=0)\n {\n n=1+6/d;\n p=6/d+6%d;\n }\n else\n {\n n=1;\n p=6/d;\n }\n printf(\"%d/%d\",n,p);\n return 0; \n}"}, {"source_code": "#include \nint main()\n{\n long a,b;\n \n scanf(\"%ld%ld\",&a,&b);\n if(b>a) a=b;\n if(b==1) printf(\"1/1\");\n else if(b==2) printf(\"5/6\");\n else if(b==3) printf(\"2/3\");\n else if(b==4) printf(\"1/2\");\n else if(b==5) printf(\"1/3\");\n else if(b==6) printf(\"1/6\");\n return 0;\n}\n\n"}, {"source_code": "#include \n#include \n#include \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 if((Price1 *i-CoinsNum)%10==0)\n {\n x=i;\n break;\n }\n if (x==0)\n for (i=1;i<10;i++)\n if((Price1 *i)%10==0)\n {\n x=i;\n break;\n }\n printf(\"%i\",x);*/\n //___________________________________________________________________________________\n //12.........................A. Is your horseshoe on the other hoof?//////\n /*int ShoesColor[4],i,j,Cnt=0;\n for (i=0;i<4;i++)\n scanf(\"%i\",&ShoesColor[i]);\n for (i=0;i<4;i++)\n for (j=1+i;j<4;j++)\n {\n if (ShoesColor[i]==ShoesColor[j])\n {\n Cnt++;\n break;\n }\n }\n printf(\"%i\",Cnt);*/\n//_________________________________________________________________________________________\n//13........................A. Colorful Stones (Simplified Edition)\n//____________________________________________\n /* int i=0,j=0,Cnt=0,skip=0;\n int last2=0,last1=0;\n char instructions [50], sequence[50];\n while (i!=50)\n {\n sequence[i]='\\n';\n instructions[i]='\\n';\n i++;\n }\n i=0;\n scanf(\"%s %s\",&sequence,&instructions );\n for (; sequence[i]!='\\n'; i++)\n for(; instructions[j]!='\\n'; )\n {\n if (instructions[i]==sequence[j])\n { Cnt++;\n j++;\n break; }\n else\n j++;\n }\n printf(\"%i\",Cnt+1);*/\n//__________________________________________________________________________________\n//14................................A. Cookies\n//____________________________________________\n\n /* int i,CookiesBagsNum,Total=0,Options=0;\n scanf(\"%i\",&CookiesBagsNum);\n int CookiesNum[CookiesBagsNum];\n for (i=0; i=y)\n percent=(7-w)/6;\n else\n percent=(7-y)/6;\n float x1=1./6,x2=1./3,x3=1./2,x4=2./3,x5=5./6;\nif (percent==x1)\n printf(\"1/6\");\nelse if (percent==x2)\n printf(\"1/3\");\nelse if (percent==x3)\n printf(\"1/2\");\nelse if (percent==x4)\n printf(\"2/3\");\nelse if (percent==x5)\n printf(\"5/6\");\n else\n printf(\"1/1\");\n\n\n//_________________________________________________________________________________________________\n//16.............................A. Second Order Statistics\n//___________________________________________________________\n\n\n\n\n\n\n\n\n//_________________________________________________________________________________________________\n//17.............................\n\n\n\n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{ int a,b,x;\n scanf(\"%d%d\",&a,&b);\n if(a>b)\n x=7-a;\n else\n x=7-b;\n if(x%6==0)\n printf(\"1\");\n else if(x%3==0)\n printf(\"%d/2\",x/3);\n else if(x%2==0)\n printf(\"%d/3\",x/2);\n else\n printf(\"%d/6\",x);\n}\n"}, {"source_code": "#include\n\nint max(int a,int b){\n if(a>=b) return a;\n else return b;\n}\n\nint main(){\n int y, w, n, d;\n scanf(\"%d %d\", &y, &w);\n n=6-max(y, w);\n d=4;\n if(y==w) d=5;\n if(n==d){\n n=1; d=1;\n }\n else if(n==2 && d==4){\n n=1; d=2;\n }\n printf(\"%d/%d\\n\", n, d);\n}"}, {"source_code": "#include\n\nint max(int, int);\n\nint main()\n{\n int w, y, m, r;\n scanf(\"%d %d\", &w, &y);\n if(w==6 || y==6)\n {\n printf(\"%0/1\\n\");\n return 0;\n }\n m=max(w, y);\n r=(6-m)+1;\n if(r%6==0)\n {\n printf(\"%d/%d\\n\", r/6, 6/6);\n }\n else if(r%2==0)\n {\n printf(\"%d/%d\\n\", r/2, 6/2);\n }\n else if(r%3==0)\n {\n printf(\"%d/%d\\n\", r/3, 6/3);\n }\n else\n printf(\"%d/%d\\n\", r, 6);\n\n return 0;\n}\n\nint max(int x, int y)\n{\n if(x>y)\n return x;\n else\n return y;\n}\n"}, {"source_code": "#include\n\n//int min(int, int);\n\nint main()\n{\n int w, y;\n scanf(\"%d %d\", &w, &y);\n if(w==0 || y==0)\n {\n printf(\"0/1\\n\");\n }\n else if(w>y)\n {\n printf(\"%d/%d\\n\", y/y, w/y);\n }\n else\n {\n printf(\"%d/%d\\n\", w/w, y/w);\n }\n\n return 0;\n}\n\n/*int min(int x, int y)\n{\n if(x>y)\n return x;\n else\n return y;\n}*/\n"}, {"source_code": "#include \n\nlong gcd(long a,long b)\n{\n long c=a%b;\n \n while(c)\n {\n a=b;\n b=c;\n c=a%b;\n }\n return b;\n}\n\nint main()\n{\n long a,b,p;\n \n scanf(\"%ld%ld\",&a,&b);\n if(b>a) a=b;\n if(b>6) p=0;\n else if(b<1) p=6;\n else p=7-b;\n printf(\"%ld/%ld\\n\",p/gcd(p,6),6/gcd(p,6));\n return 0;\n}\n\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int a,b,A;\n scanf(\"%d%d\",&a,&b);\n if(a>=b){A=a; }\n else{A=b;}\n A=6-A+1;\n int i;\n for(i=6;i>=A;i--)\n {\n if(6%i==0 && A%i==0){break;}\n }\n printf(\"%d/%d\\n\",A/i,6/i);\n // printf(\"%d\",A);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int y,w,x,p,i,q,gcd;\n scanf(\"%d%d\",&y,&w);\n if(y>w)\n {\n x=(6-y)+1;\n }\n else if(w>y)\n {\n x=(6-w)+1;\n }\n for(i=x;i>=1;i--)\n {\n if(x%i==0 && 6%i==0)\n {\n gcd=i;\n }\n }\n p=x/gcd;\n q=6/gcd;\n printf(\"%d/%d\",p,q);\n return 0;\n}\n"}, {"source_code": "//\n// main.c\n// code forces\n//\n// Created by Irfan Naufal Ardila on 11/15/17.\n// Copyright © 2017 Irfan Naufal Ardila. All rights reserved.\n//\n\n\n\n\n#include \nint main (){\n int A,B,i,c,d=0;\n scanf(\"%d%d\",&A,&B);\n c=A-B;\n if (c<0){\n for (i=B;i<=6;i++){\n ++d;}\n if (d==0 ){\n printf (\"0/1\");\n return 0;}\n else if(d==1 || d==6){\n printf (\"1/1\");\n return 0;}\n else if (d==2 || d== 4){\n printf(\"%d/3\",d/2);\n return 0;}\n else if(d==3){\n printf (\"1/2\");\n return 0;}\n else if (d==5){\n printf(\"5/6\");\n return 0;}}\n else {\n for (i=A;i<=6;i++){\n ++d;}\n \n if (d==0 ){\n printf (\"0/1\");\n return 0;}\n else if(d==1 || d==6){\n printf (\"1/1\");\n return 0;}\n else if (d==2 || d== 4){\n printf(\"%d/3\",d/2);\n return 0;}\n else if(d==3){\n printf (\"1/2\");\n return 0;}\n else if (d==5){\n printf(\"5/6\");\n return 0;}}\n return 0;}\n\n"}, {"source_code": "#include \n#include \nint main(){\n\tint a,b,c,g,e,d;\n\tfloat f;\n\tscanf(\"%d%d\",&a,&b);\n\t\n\tc=a;\n\tif(a\n\nint main()\n{\n int y, w, max, A, B;\n scanf(\"%d &d\", &y, &w);\n\t\n\tmax = (y>w)?y:w;\n \n\tA = (6 - max) + 1;\n \n\tswitch (A)\n\t{\n\t\tcase 6: A= 1; B = 1; break;\n\t\tcase 4: A= 2; B = 3; break;\n\t\tcase 2: A= 1; B = 3; break;\n\t\tcase 0: A= 0; B = 1; break;\n\n\t}\n \n printf(\"%d\\/%d\", A,B);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint a,b,x,y,i;\n\tscanf(\"%d%d\",&a,&b);\n\tfor(i=2;i<=5;i++)\n\t{if(a%i==0 && b%i==0)\n\t {x=a/i;\n\t y=b/i;}}\t\n\t\n\tif(x>y)\n\t\tprintf(\"%d/%d\",y,x);\n\telse\n\t\tprintf(\"%d/%d\",x,y);\n\treturn 0;\n}\n"}, {"source_code": "\n#include \n\nint main()\n{\n int y=0, w=0, max = 0, A = 0, B = 0;\n scanf(\"%d &d\", &y, &w);\n\t\n\t\tif (y>=w)\n\t\t{\n\t\t\tA = (6 - y) + 1;\n\t\t}\n\t\telse \n\t\t{\n\t\t\tA = (6 - w) + 1;\n\t\t}\n \n\t\n \n\tswitch (A)\n\t{\n\t\tcase 6: A= 1; B = 1; break;\n\t\tcase 4: A= 2; B = 3; break;\n\t\tcase 3: A= 1; B = 2; break;\n\t\tcase 2: A= 1; B = 3; break;\n\t\tcase 0: A= 0; B = 1; break;\n\t\tdefault : B = 6;\n\t}\n \n printf(\"%d\\/%d\", A,B);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int x,y,max;\n scanf(\"%d %d\",&x,&y);\n if(x>=y)\n max=x;\n else\n max=y;\n if(6%(6-max+1)==0)\n printf(\"1/%d\",6/(6-max+1));\n else\n printf(\"%d/6\",6-max+1);\n return 0;\n}"}, {"source_code": "#include\n\nint main()\n{\nint y,w,p;\nscanf(\"%d%d\",&y,&w);\nif(y==1&&w==1)\n{printf(\"1/1\");}\nelse if(y>w)\n{p=(6-y+1);\nif(p%2==0){p=p/2;\nprintf(\"%d/%d\",p,3);}\nelse if(p%3==0)\n{p=p/3;\nprintf(\"%d/%d\",p,2);\n}\n}\nelse\n{p=(6-w+1);\nif(p%2==0){p=p/2;\nprintf(\"%d/%d\",p,3);}\nelse if(p%3==0)\n{\n p=p/3;\n\nprintf(\"%d/%d\",p,2);\n}\n}\n}\n"}, {"source_code": "#include \nint main(){\nint a,b,n;\nscanf(\"%d %d\",&a,&b);\nif(a>=b)\n n=7-a;\nif(b>a)\n n=7-b;\nelse if((n%2==0)&&(n%3!=0)){\n n=n/2;\n printf(\"%d/3\",n);\n }\n else if((n%3==0)&&(n%2!=0)){\n n=n/3;\n printf(\"%d/2\",n);\n }\n else if(n%6==0)\n printf(\"1/1\");\n else\n printf(\"%d/6\",n);\n return 0;\n}\n"}, {"source_code": "#include\n\nint max(int num1, int num2)\n{\n return (num1 > num2 ) ? num1 : num2;\n}\n\nint main(){\n int Y,W,num,den = 6;\n scanf(\"%d %d\",&Y,&W);\n num = max(Y,W) - 1;\n if(num % 2 == 0 && den % 2 == 0){\n num = num / 2;\n den = den / 2;\n }\n else if(num % 3 == 0 && den % 3 == 0){\n num = num / 3;\n den = den / 3;\n }\n printf(\"%d/%d\",num,den);\n\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int a,b,c;\n double d,e,f,g;\n scanf(\"%d%d\",&a,&b);\n if(a>=b)\n {\n\n c=(7-a);\n d=(double)c/6.0;\n e=1.0/3.0;\n f=1.0/2.0;\n g=2.0/3.0;\n if(d==g)\n {\n printf(\"2/3\");\n return 0;\n }\n else if(d==f){\n printf(\"1/2\");\n return 0;\n }\n else if(d==e)\n {\n printf(\"1/3\");\n return 0;\n }\n else if(d==1){\n printf(\"1/1\");\n return 0;\n }\n else\n printf(\"%d/6\",c) ;\n return 0;\n }\n else{\n c=(7-b);\n d=(double)c/6.0;\n e=1.0/3.0;\n f=1.0/2.0;\n g=2.0/3.0;\n if(d==g)\n {\n printf(\"2/3\");\n return 0;\n }\n else if(d==e)\n {\n printf(\"1/3\");\n return 0;\n }\n else if(d==1){\n printf(\"1/1\");\n return 0;\n }\n\n else if( d==f){\n printf(\"1/2\");\n return 0;\n }\n else\n\n printf(\"%d/6\",c) ;\n return 0;\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int ara[6];\n int p,q,w,d,a,b,i,j,k;\n j=0;\n scanf(\"%d %d\",&a,&b);\n //printf(\"a= %d\\n\",a);\n if(a>=b)\n {\n a=a;\n // printf(\"a= %d\\n\",a);\n }\n else if(b>a)\n {\n a=b;\n // printf(\"a= %d\\n\",a);\n }\n for(int z=1;z<=6;z++)\n {\n if(z>=a)\n {\n j++;\n // printf(\"z= %d , j= %d\\n\",z,j);\n }\n\n }\n p=j;\n q=6;\n for(k=1;k<=6;k++)\n {\n p=p/k;\n q=q/k;\n //printf(\"p =%d , q= %d\\n\",p,q);\n if(p==1)\n {\n break;\n }\n }\n printf(\"%d/%d\",p,q);\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,p,n;\n scanf(\"%d %d\",&a,&b);\n int c=a>b?a:b;\n \n int d=7-c;\n if(6%d!=0)\n {\n n=1+6/d;\n p=6/d+6%d;\n }\n else\n {\n n=1;\n p=6/d;\n }\n printf(\"%d/%d\",n,p);\n return 0; \n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int y,t,d;\n scanf(\"%d %d\",&y,&t);\n if(y>t){\n d = 7-y;\n }\n else {\n d = 7-t;\n }\n if(d==1){\n printf(\"1/6\");\n }\n else if(d==2){\n printf(\"1/3\");\n }\n else if(d==3){\n printf(\"1/2\");\n }\n else if(d==4){\n printf(\"2/3\");\n }\n else if(d==5){\n printf(\"5/4\");\n }\n else if(d==6){\n printf(\"1/1\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include\nint max(int a,int b){\n if(a>b) return a;\n else return b;\n}\nint main(){\n int yakko,wakko,dot,probab;\n int d;\n scanf(\"%d %d\\n\",&yakko,&wakko);\n d=max(yakko,wakko);\n dot=(6-d)+1;\n switch(dot){\n case 0 : printf(\"0/1\\n\");\n break;\n case 1 : printf(\"1/6\\n\");\n break;\n case 2 : printf(\"1/6\\n\");\n break; \n case 3 : printf(\"1/2\\n\");\n break; \n case 4 : printf(\"2/3\\n\");\n break; \n case 5 : printf(\"5/6\\n\");\n break; \n case 6 : printf(\"1/1\\n\");\n break;\n }\n return 0;\n}"}, {"source_code": "#include \n\nint main(){\n int a,b,max,n;\n scanf(\"%d%d\",&a,&b);\n if(a>b)\n max=a;\n else\n max=b;\n n=6-max+1;\n if(5%n==0){\n printf(\"1/%d\",6/n);\n }\n else\n {\n if(n%2==0)\n printf(\"%d/3\",n/2);\n else\n printf(\"%d/6\",n);\n }\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int a,b,c;\n double d,e,f,g;\n scanf(\"%d%d\",&a,&b);\n if(a>=b)\n {\n\n c=(7-a);\n d=(double)c/6.0;\n e=1.0/3.0;\n f=1.0/2.0;\n g=2.0/3.0;\n if(d==g)\n {\n printf(\"2/3\");\n return 0;\n }\n else if(d==f){\n printf(\"1/2\");\n return 0;\n }\n else if(d==e)\n {\n printf(\"1/3\");\n return 0;\n }\n else if(d==1){\n printf(\"1/1\");\n return 0;\n }\n else\n printf(\"%d/6\",c) ;\n return 0;\n }\n else{\n c=(7-b);\n d=(double)c/6.0;\n e=1.0/3.0;\n f=1.0/2.0;\n g=2.0/3.0;\n if(d==g)\n {\n printf(\"2/3\");\n return 0;\n }\n else if(d==e)\n {\n printf(\"1/3\");\n return 0;\n }\n else if(d==1){\n printf(\"1/1\");\n return 0;\n }\n\n else if( d==f){\n printf(\"1/2\");\n return 0;\n }\n else\n\n printf(\"%d/6\",c) ;\n return 0;\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,p,n;\n scanf(\"%d %d\",&a,&b);\n int c=a>b?a:b;\n \n int d=7-c;\n for(int i=2;i<=3;i++)\n {\n if(d%i==0&&6%i==0)\n {\n n=d/i;\n p=6/i;\n }\n else\n {\n n=d;\n p=6;\n }\n }\n printf(\"%d/%d\",n,p);\n return 0; \n}"}, {"source_code": "#include \nint main()\n{\n int a,b,temp;\n scanf(\"%d %d\",&a,&b);\n if(a>b)\n {\n temp=b;\n b=a;\n a=temp;\n }\n if(b==1)\n printf(\"1\");\n else if(b==2)\n printf(\"5/6\");\n else if(b==3)\n printf(\"2/3\");\n else if(b==4)\n printf(\"1/2\");\n else if(b==5)\n printf(\"1/3\");\n else if(b==6)\n printf(\"1/6\");\n \n \n}"}, {"source_code": "#include \n#include \nint main()\n{\n int m,n,k,l,max;\n scanf(\"%d %d\",&m,&n);\n if(m>n)max=m;\n else if(m\nint main()\n{\n int y,w,a,b;\n scanf(\"%d %d\",&y,&w);\n\n a=w/2;\n b=y/2;\n\n printf(\"%d/%d\\n\",a,b);\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\nint w, y, z;\nz = (w+y+abs(w-y))/2;\nswitch (z)\n{ case 1 : printf(\"1/6\"); break;\ncase 2 : printf(\"1/3\"); break;\ncase 3 : printf(\"1/2\"); break;\ncase 4 : printf(\"2/3\"); break;\ncase 5 : printf(\"5/6\"); break;\ncase 6 : printf(\"1/1\"); break;\nreturn 0; }\n}"}, {"source_code": "\n#include \n\nint main()\n{\n int y, w, max = 0, A = 0, B = 0;\n scanf(\"%d &d\", &y, &w);\n\t\n\tif (y==1)\n\t\tmax = y;\n\telse\n\t{\n\t\tmax = (y>w)?y:w;\n\t}\n \n\tA = (6 - max) + 1;\n \n\tswitch (A)\n\t{\n\t\tcase 6: A= 1; B = 1; break;\n\t\tcase 4: A= 2; B = 3; break;\n\t\tcase 3: A= 1; B = 2; break;\n\t\tcase 2: A= 1; B = 3; break;\n\t\tcase 0: A= 0; B = 1; break;\n\t\tdefault : B = 6;\n\t}\n \n printf(\"%d\\/%d\", A,B);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\nint w,y,c,a;\nscanf(\"%d %d\",&w,&y);\nif(y>w)\n{\nc=y;\n}\nelse\n{\nc=w;\n}\na=7-c;\nif(a==0)\nprintf(\"0\");\nelse if(a==1)\nprintf(\"1/6\");\nelse if(a==2)\nprintf(\"1/3\");\nelse if(a==3)\nprintf(\"1/2\");\nelse if(a==4)\nprintf(\"2/3\");\nelse\nprintf(\"%d/6\",c);\nreturn 0;\n}"}, {"source_code": "\n#include \n\nint main()\n{\n int y, w, max = 0, A = 0, B = 0;\n scanf(\"%d &d\", &y, &w);\n\t\n\t\n\tmax = (y>=w)?y:w;\n \n\tA = (6 - max) + 1;\n \n\tswitch (A)\n\t{\n\t\tcase 6: A= 1; B = 1; break;\n\t\tcase 4: A= 2; B = 3; break;\n\t\tcase 3: A= 1; B = 2; break;\n\t\tcase 2: A= 1; B = 3; break;\n\t\tcase 0: A= 0; B = 1; break;\n\t}\n \n printf(\"%d\\/%d\", A,B);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int Y,W,temp,a=6;\n scanf(\"%d %d\",&Y,&W);\n if(Y==W)\n {\n printf(\"%d/%d\",1,6);\n }\n else if(Y>W)\n {\n temp=6-Y+1;\n if(temp%3==0)\n {\n temp=temp/3;\n a=a/3;\n }\n else if(temp%2==0)\n {\n temp=temp/2;\n a=a/2;\n }\n printf(\"%d/%d\",temp,a);\n }\n else\n {\n temp=6-W+1;\n if(temp%3==0)\n {\n temp=temp/3;\n a=a/3;\n }\n else if(temp%2==0)\n {\n temp=temp/2;\n a=a/2;\n }\n printf(\"%d/%d\",temp,a);\n }\n}"}, {"source_code": "#include\nint main()\n{\n int Y,W,n,i=6,a,b;\n scanf(\"%d\", &Y);\n scanf(\"%d\", &W);\n if(Y==6 && W==6)\n {\n printf(\"1/1\");\n }\n else if(Y==W)\n {\n n = (6-Y)+1;\n }\n else if(Y>W)\n {\n n=(6-Y)+1;\n }\n else\n {\n n=(6-W)+1;\n\n }\nif(n==2)\n{\n printf(\"1/3\");\n}\nelse if(n==3)\n{\n printf(\"1/2\");\n}\nelse if(n==4)\n{\n printf(\"2/3\");\n}\nelse if(n==5)\n{printf(\"5/6\");\n return 0;}\n}\n"}, {"source_code": "# include\n int i=0;\nvoid dg(int max,int n)\n{\n\tif(n>=max)\n\t{\n\t\ti++;\n\t\tdg(max,n-1);\n \t} \n}\nint main()\n{int x,y,max;\n scanf(\"%d%d\",&x,&y);\n max=(x>y)?x:y; \t\n\tdg(max,6);\n\tif(i==2)\n\t\tprintf(\"1/3\\n\");\n\telse if(i==3)\n\t\tprintf(\"1/2\\n\");\n\telse if(i==4)\n\t\tprintf(\"2/3\");\n\telse\n\t\tprintf(\"%d/6\\n\",i);\n\treturn 0;\n} "}, {"source_code": "#include\nint main()\n{\n int x,y,max;\n scanf(\"%d %d\",&x,&y);\n if(x>=y)\n max=x;\n else\n max=y;\n if(6%(6-max+1)==0)\n printf(\"1/%d\",6/(6-max+1));\n else\n printf(\"%d/6\",6-max+1);\n return 0;\n}"}], "src_uid": "f97eb4ecffb6cbc8679f0c621fd59414"} {"nl": {"description": "Mishka is decorating the Christmas tree. He has got three garlands, and all of them will be put on the tree. After that Mishka will switch these garlands on.When a garland is switched on, it periodically changes its state — sometimes it is lit, sometimes not. Formally, if i-th garland is switched on during x-th second, then it is lit only during seconds x, x + ki, x + 2ki, x + 3ki and so on.Mishka wants to switch on the garlands in such a way that during each second after switching the garlands on there would be at least one lit garland. Formally, Mishka wants to choose three integers x1, x2 and x3 (not necessarily distinct) so that he will switch on the first garland during x1-th second, the second one — during x2-th second, and the third one — during x3-th second, respectively, and during each second starting from max(x1, x2, x3) at least one garland will be lit.Help Mishka by telling him if it is possible to do this!", "input_spec": "The first line contains three integers k1, k2 and k3 (1 ≤ ki ≤ 1500) — time intervals of the garlands.", "output_spec": "If Mishka can choose moments of time to switch on the garlands in such a way that each second after switching the garlands on at least one garland will be lit, print YES. Otherwise, print NO.", "sample_inputs": ["2 2 3", "4 2 3"], "sample_outputs": ["YES", "NO"], "notes": "NoteIn the first example Mishka can choose x1 = 1, x2 = 2, x3 = 1. The first garland will be lit during seconds 1, 3, 5, 7, ..., the second — 2, 4, 6, 8, ..., which already cover all the seconds after the 2-nd one. It doesn't even matter what x3 is chosen. Our choice will lead third to be lit during seconds 1, 4, 7, 10, ..., though.In the second example there is no way to choose such moments of time, there always be some seconds when no garland is lit."}, "positive_code": [{"source_code": "#include\n\nint main(){\n\n int k[3];\n int i;\n int sum = 0;\n int max = 0;\n\n for(i = 0; i < 3; i++){\n scanf(\"%d\", &k[i]);\n sum = sum + k[i];\n\n if(k[i] > max){\n max = k[i];\n }\n }\n\n for(i = 0; i < 3; i++){\n if(k[i] == 1){\n printf(\"YES\\n\");\n return 0;\n }\n }\n\n if(max == 2){\n printf(\"YES\\n\");\n return 0;\n }\n\n if(max > 4){\n if(max + 4 < sum){\n printf(\"NO\\n\");\n } else {\n printf(\"YES\\n\");\n }\n } else {\n if(max + 4 >= sum){\n printf(\"YES\\n\");\n } else {\n if( (max == 3 && sum == 9) || (max == 4 && sum == 10 && k[0] * k[1] * k[2] == 32))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n }\n }\n\n\n\n return 0;\n\n\n\n}\n"}, {"source_code": "#include\n\nint main(){\n\n int k[3];\n int i;\n int sum = 0;\n int max = 0;\n\n for(i = 0; i < 3; i++){\n scanf(\"%d\", &k[i]);\n sum = sum + k[i];\n\n if(k[i] > max){\n max = k[i];\n }\n }\n\n for(i = 0; i < 3; i++){\n if(k[i] == 1){\n printf(\"YES\\n\");\n return 0;\n }\n }\n\n\n\n if(max + 4 >= sum){\n printf(\"YES\\n\");\n } else {\n if((max == 3 && sum == 9) || (max == 4 && sum == 10 && k[0] * k[1] * k[2] == 32))\n printf(\"YES\\n\");\n else {\n printf(\"NO\\n\");\n }\n }\n }\n\n\n\n\n\n"}, {"source_code": "#include\n#include\n#include\nint main()\n{\n\tint n=3,one=0,two=0,three=0,four=0,k;\n\tint i;\n\tfor(i=0;i=1||two>=2||three>=3||(four==2&&two==1))\n\t{\n\t\tprintf(\"YES\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\\n\");\n\t}\n}\n"}, {"source_code": "#include \nmain()\n{\nint k[3],i,a[3],j;\nscanf(\"%d %d %d\",&k[0],&k[1],&k[2]);\nfor(i=0;i<3;i++)\n{\n a[i]=k[i];\n for(j=i;j-1>=0&&a[j-1]>k[i];j--)\n {\n a[j]=a[j-1];\n a[j-1]=k[i];\n }\n\n}\nfor(i=0;i<3;i++) k[i]=0;\nfor(i=0;i<3&&(i-1<0||k[i-1]!=i);i++)\n{\n for(j=0;j<=i&&(i+1)%a[j]==0;j++)\n {\n k[i]++;\n }\n}\nif(k[i-1]==i||(a[0]==2&&a[1]==4&&a[2]==4)) printf(\"YES\");\nelse printf(\"NO\");\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint k1,k2,k3;\n\tscanf(\"%d%d%d\",&k1,&k2,&k3);\n\tint x1,x2,x3;\n\tif(k1==1||k2==1||k3==1)printf(\"YES\\n\");\n\telse if((k1==2&&k2==2)||(k1==2&&k3==2)||(k2==2&&k3==2))printf(\"YES\\n\");\n\telse if(k1==3&&k2==3&&k3==3)printf(\"YES\\n\");\n\telse if(k1==2&&k2==4&&k3==4)printf(\"YES\\n\");\n\telse if(k1==4&&k2==2&&k3==4)printf(\"YES\\n\");\n\telse if(k1==4&&k2==4&&k3==2)printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include\n\n\n\nint main(){\n\tint k1,k2,k3;\n\tscanf(\"%d%d%d\",&k1,&k2,&k3);\n\tint min;\n\tmin=(k1>k2)?((k2>k3)?k3:k2):((k1>k3)?k3:k1);\n\tif(min==1){\n\t\tprintf(\"YES\");\n\t\treturn 0;\n\t}\n\tif(min==2){\n\t\tint cnt=0,cnt1=0;\n\t\tif(k1==2){\n\t\t\tcnt++;\n\t\t}\n\t\tif(k2==2){\n\t\t\t\tcnt++;\n\t\t}\n\t\tif(k3==2){\n\t\t\t\tcnt++;\n\t\t}\n\n\n\t\tif(k1==4){\n\t\t\t\tcnt1++;\n\t\t}\n\t\tif(k2==4){\n\t\t\t\t cnt1++;\n\t\t}\n\t\tif(k3==4){\n\t\t\t\t cnt1++;\n\t\t}\n\n\n\n\t\tif(cnt>=2||cnt1==2){\n\t\t\tprintf(\"YES\");\n\t\t}\n\t\telse if(cnt<2){\n\t\t\tprintf(\"NO\");\n\t\t}\n\t\treturn 0;\n\t}\n\n\tif(min==3&&k1==3&&k2==3&&k3==3){\n\t\tprintf(\"YES\");return 0;\n\t}\n\tprintf(\"NO\");\n\treturn 0;\n\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int a1,a2,a3,k,l,t;\n long long i,j;\n int n1,n2,n3;\n scanf(\"%d%d%d\",&a1,&a2,&a3);\n if (a1>a2) {t=a1;a1=a2;a2=t;}\n if (a1>a3) {t=a1;a1=a3;a3=t;}\n if (a2>a3) {t=a2;a2=a3;a3=t;}\n if (a1==1) printf(\"YES\");\n else if ((a1==2)&&(a2==2)) printf(\"YES\");\n else if ((a1==3)&&(a2==3)&&(a3==3)) printf(\"YES\");\n else if ((a1==2)&&(a2==4)&&(a3==4)) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n \nint main()\n{\n int flag=1,min=1500,max=0,k[3];\n int dict[3]={-1};\n for(int i=0;i<3;i++)\n {\n scanf(\"%d\",&k[i]);\n if(k[i]<=3) flag=0;\n if(k[i]max) max=k[i];\n }\n if(min==1)\n {\n printf(\"YES\\n\");\n return 0;\n }\n int mid = k[0]+k[1]+k[2]-min-max;\n dict[0] = 0;\n dict[2] = -1;\n dict[1] = -1;\n if(flag)\n {\n printf(\"NO\\n\");\n return 0;\n }\n flag=1;\n for(int i=1;i<=1500;i++)\n {\n if(dict[1]!=-1 && dict[2]!=-1)\n {\n if(i%min!=0 && (i-dict[1])%mid!=0 && (i-dict[2])%max!=0)\n {\n flag=0;\n break;\n } \n }\n else if(dict[1]==-1 && i%min!=0)\n {\n dict[1] = i;\n }\n else if(i%min!=0 && (i-dict[1])%mid!=0){\n dict[2] = i;\n }\n }\n if(flag)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n return 0;\n}"}, {"source_code": "#include \n#include \nint main()\n{\n int a,b,c;\n scanf(\"%d %d %d\",&a,&b,&c);\n int k;\n if(a>b) {k=a;a=b;b=k;}\n if(b>c) {k=b;b=c;c=k;}\n if(a>b) {k=a;a=b;b=k;}\n if(a==1||b<=2||a==3&&b==3&&c==3||(a==2&&b==4&&c==4)) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n}"}, {"source_code": "#include\nint main(void){\n int k1,k2,k3,flag=0;\n scanf(\"%d%d%d\",&k1,&k2,&k3);\n if(k1==1||k2==1||k3==1) flag=1;\n else if(k1==2&&k2==2||k1==2&&k3==2||k2==2&&k3==2) flag=1;\n else if(k1==3&&k2==3&&k3==3) flag=1;\n else if(k1==2&&k2==4&&k3==4||k1==4&&k2==4&&k3==2||k1==4&k2==2&&k3==4) flag=1;\n if(flag) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include \n\nint main() {\n\tint a,b,c;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tif((a==1)||(b==1)||(c==1)){\n\t printf(\"YES\");\n\t return 0;\n\t}\n\tif((a==3)&&(b==3)&&(c==3)){\n\t printf(\"YES\");\n\t return 0;\n\t}\n\tif(a==2){\n\t if((b==2)||(c==2)){\n\t printf(\"YES\");\n\t return 0;\n\t }\n\t if((b==4)&&(c==4)){\n\t printf(\"YES\");\n\t return 0;\n\t }\n\t}\n\tif(b==2){\n\t if((a==2)||(c==2)){\n\t printf(\"YES\");\n\t return 0;\n\t }\n\t if((a==4)&&(c==4)){\n\t printf(\"YES\");\n\t return 0;\n\t }\n\t}\n\tif(c==2){\n\t if((a==2)||(b==2)){\n\t printf(\"YES\");\n\t return 0;\n\t }\n\t if((a==4)&&(b==4)){\n\t printf(\"YES\");\n\t return 0;\n\t }\n\t}\n\tprintf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint i,j,a[3],t;\n for(i=0;i<3;i++)\n\t\tscanf(\"%d\",&a[i]);\n\tfor(i=0;i<2;i++)\n\t{\n\t for(j=0;j<2-i;j++)\n\t {\n\t\t if(a[j]>a[j+1])\n\t\t {\n\t\t t=a[j];\n\t\t\ta[j]=a[j+1];\n\t\t\ta[j+1]=t;\n\t\t }\n\t }\n\t}\n\t if(a[0]==1)\n\t\t printf(\"YES\\n\");\n\t else if(a[0]==2&&a[1]==a[2]&&a[1]==4)\n\t\tprintf(\"Yes\\n\");\n\t else if((a[1]==2&&a[0]==2)||(a[1]==2&&a[2]==2))\n\t\t printf(\"YES\\n\");\n\t else if(a[0]==a[1]&&a[1]==a[2]&&a[1]==3)\n\t\t printf(\"YES\\n\");\n\t else\n\t\t printf(\"NO\\n\");\n\t return 0;\n}\n\t\n "}, {"source_code": "#include\n//#include\nint main()\n{\n int n,a,b;\n scanf(\"%d %d %d\",&n,&a,&b);\n if((n==2 && a==2) || (n==2 && b==2) || (b==2 && a==2) || (n==3 && a==3 && b==3) || (n==1) || (a==1) || (b==1))\n printf(\"YES\\n\");\n else if((n==2 && a==4 && b==4) || (b==2 && a==4 && n==4) || (a==2 && n==4 && b==4))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n\tint x1,x2,x3,two=0,four=0;\n\tscanf(\"%d %d %d\",&x1,&x2,&x3);\n\tif(x1==2) two++;\n\tif(x2==2) two++;\n\tif(x3==2) two++;\n\tif(x1==4) four++;\n\tif(x2==4) four++;\n\tif(x3==4) four++;\n\tif(x1==1 || x2==1 || x3==1)\n\t\tprintf(\"YES\\n\");\n\telse\n\t{\n\t\tif(two>=2)\n\t\t\tprintf(\"YES\\n\");\n\t\telse if(four==2 && two==1)\n\t\t\tprintf(\"YES\\n\");\n\t\telse if(x1==3 && x2==3 && x3==3)\n\t\t\tprintf(\"YES\\n\");\n\t\telse\n\t\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "//set many funcs template\n#include\n#include\n#include\n#include\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/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/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*(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 i,k[4];\n scanf(\"%lld%lld%lld\",&k[0],&k[1],&k[2]);\n qsort(k,3,sizeof(long long),llsortfncsj);\n if(k[0]==1){printf(\"YES\\n\");return 0;}\n if(k[0]==2&&k[1]==2){printf(\"YES\\n\");return 0;}\n if(k[0]==2&&k[1]==4&&k[2]==4){printf(\"YES\\n\");return 0;}\n if(k[0]==3&&k[1]==3&&k[2]==3){printf(\"YES\\n\");return 0;}\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include\n\tint arr[5];\nint main()\n{\n\tint arr1[4];\n\tscanf(\"%d %d %d\",&arr1[0],&arr1[1],&arr1[2]);\n\tfor (int i = 0; i < 3; ++i)\n\t{\n\t\tarr[arr1[i]]++;\n\t}\n\tif (arr[1]==1 || arr[2]==2 || arr[3]==3 || arr[1]==2 || arr[1]==3 || arr[2]==3)\n\t{\n\t\tprintf(\"YES\\n\");\n\t}\n\telse if(arr[2]==1 && arr[4]==2)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n}"}, {"source_code": "#include \n\nint main() \n{\n int a,b,c;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tif (a==1||b==1||c==1) printf(\"YES\");\n\t\n\telse if((a==2&&b==2)||(a==2&c==2)||(b==2&&c==2)) printf(\"YES\");\n\t\n\telse if(a==3&&b==3&&c==3) printf(\"YES\");\n\t\n\telse if((a==4&&b==4&&c==2)||(a==2&&b==4&&c==4)||(a==4&&b==2&&c==4)) printf(\"YES\");\n\t\n\telse printf(\"NO\");\n\t\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint a[3],o=0,tw=0,t=0,f=0,i;\n\tfor(i=0;i<3;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t\tif(a[i]==3)\n\t\t\tt++;\n\t\tif(a[i]==1)\n\t\t\to++;\n\t\tif(a[i]==2)\n\t\t\ttw++;\n\t\tif(a[i]==4)\n\t\t\tf++;\n\t}\n\tif(t==3)\n\t\tprintf(\"YES\\n\");\n\t else if(o>=1)\n\t\tprintf(\"YES\\n\");\n\telse if(tw>=2)\n\t\tprintf(\"YES\\n\");\n\telse if(tw==1 && f==2)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n}"}, {"source_code": "#include\n#include\nvoid main()\n{\nint k1,k2,k3;\nscanf(\"%d %d %d\",&k1,&k2,&k3);\n\nif((k1==1)||(k2==1)||(k3==1))\n{\nprintf(\"YES\\n\");\nexit(0);\n}\n\nif(((k1==2)&&(k2==2))||((k2==2)&&(k3==2))||((k1==2)&&(k3==2)))\n{\nprintf(\"YES\\n\");\nexit(0);\n}\n\nif((k1==3)&&(k2==3)&&(k3==3))\n{\nprintf(\"YES\\n\");\nexit(0);\n}\n\nif(((k1==2)&&(k2==4)&&(k3==4))||((k1==4)&&(k2==4)&&(k3==2))||((k2==2)&&(k1==4)&&(k3==4)))\n{\nprintf(\"YES\\n\");\nexit(0);\n}\n\nprintf(\"NO\\n\");\nexit(0);\n}"}, {"source_code": "#include\nint main()\n { int k1,k2,k3;\n scanf(\"%d%d%d\",&k1,&k2,&k3);\n if(k1==1||k2==1||k3==1)\n printf(\"YES\");\n else if (k1==2&&k2==2)\n printf(\"YES\");\n else if (k2==2&&k3==2)\n printf(\"YES\");\n else if (k1==2&&k3==2)\n printf(\"YES\");\n else if (k1==3&&k2==3&&k3==3)\n printf(\"YES\");\n else if ((k1==4&&k2==4&&k3==2)||(k1==4&&k3==4&&k2==2)||(k1==2&&k2==4&&k3==4))\nprintf(\"YES\");\n else\nprintf(\"NO\");\nreturn 0; }\n"}, {"source_code": "#include \n\nint main(){\n int a, b, c; scanf(\"%d %d %d\", &a, &b, &c);\n if ( (a==2 && b ==2 ) || (b==2 && c==2 )\n || (c==2 && a==2 )) printf(\"YES\\n\");\n else if ( a==3 && b== 3 && c==3 ) printf(\"YES\\n\");\n else if ( a==1 || b==1 || c==1) printf(\"YES\\n\");\n else if ( ( a==2 && b==4 && c == 4) ||\n ( a==4 && b==2 && c == 4) ||\n ( a==4 && b==4 && c == 2) ) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n\n}\n"}, {"source_code": "#include \n#define LL long long int\nLL GCD(LL a, LL b){\n\tLL c;\n\twhile (a != 0){\n\t\tc = a; a = b % a; b = c;\n\t}\n\treturn b;\n}\n\nLL LCM(LL a, LL b){ return a * b / GCD(a, b); }\n\nint try (int x1, int x2, int x3, LL lcm){\n\tint ret = 1;\n\tfor (LL i=3; i\n#include \n\n\n\nint main()\n{\n int a;\n int b;\n int c;\n int i=0;\n int w=0;\n int t=0;\n int j=0;\n\n scanf(\"%d\", &a);\n scanf(\"%d\", &b);\n scanf(\"%d\", &c);\n\n\n if(a==1) i++;\n if(a==2) w++;\n if(a==3) t++;\n if(a==4) j++;\n\n if(b==1) i++;\n if(b==2) w++;\n if(b==3) t++;\n if(b==4) j++;\n\n if(c==1) i++;\n if(c==2) w++;\n if(c==3) t++;\n if(c==4) j++;\n\n\n if(i>0 || w>1 || t>2 || (j>1 && w>0)) printf(\"YES\");\n else printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n\nint min(double a,double b){\n if(a\nint main()\n{\n int a, b, c, t=0, f=0;\n scanf(\"%d %d %d\", &a, &b, &c);\n if(a==2)\n t++;\n if(b==2)\n t++;\n if(c==2)\n t++;\n \n if(a==4)\n f++;\n if(b==4)\n f++;\n if(c==4)\n f++;\n \n if(a==1 || b == 1 || c==1)\n printf(\"YES\\n\");\n else if(a == 3 && b == 3 && c == 3){\n printf(\"YES\\n\");\n }\n else if(t>=2)\n printf(\"YES\\n\");\n else if( t == 1 && f == 2)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n}"}, {"source_code": "#include \nint main()\n{\n int ara[3];\n scanf(\"%d %d %d\",&ara[0],&ara[1],&ara[2]);\n int i,j=0,k=0;\n for(i=0;i<3;++i){\n if(ara[i]==1){printf(\"YES\\n\"); return 0;}\n }\n for(i=0;i<3;i++){\n if(ara[i]==2) j++;\n else if(ara[i]==4)k++;\n }\n if(j>=2){printf(\"YES\\n\"); return 0;}\n if(j==1 && k==2){ printf(\"YES\\n\"); return 0;};\n for(i=0;i<3;i++){\n if(ara[i]!=3){\n printf(\"NO\\n\");\n return 0;\n }\n }\n printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n\nint\nmain()\n{\n int x;\n int a[7] = {0,0,0,0,0,0,0};\n for (int i = 0; i < 3; ++i) {\n scanf(\"%d\", &x);\n if (x < 7) {\n a[x]++;\n }\n } \n if (a[1] > 0 || a[2] > 1 || (a[2] == 1 && a[4] == 2) || (a[3] == 3))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int k[3],i,a[3],j;\n scanf(\"%d %d %d\",&k[0],&k[1],&k[2]);\n for(i=0;i<3;i++)\n {\n a[i]=k[i];\n for(j=i;j-1>=0&&a[j-1]>k[i];j--)\n {\n a[j]=a[j-1];\n a[j-1]=k[i];\n }\n\n }\n for(i=0;i<3;i++) k[i]=0;\n for(i=0;i<3&&(i-1<0||k[i-1]!=i);i++)\n {\n for(j=0;j<=i&&(i+1)%a[j]==0;j++)\n {\n k[i]++;\n }\n }\n if(k[i-1]==i||(a[0]==2&&a[1]==4&&a[2]==4)) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "/* discussed with Dukkha */\n#include \n#include \n\n#define K\t32\n\nint gcd(int a, int b) {\n\treturn b == 0 ? a : gcd(b, a % b);\n}\n\nint lcm(int a, int b) {\n\treturn a / gcd(a, b) * b;\n}\n\nint main() {\n\tint k1, k2, k3, tmp, yes;\n\n\tscanf(\"%d%d%d\", &k1, &k2, &k3);\n\tif (k1 > k2)\n\t\ttmp = k1, k1 = k2, k2 = tmp;\n\tif (k1 > k3)\n\t\ttmp = k1, k1 = k3, k3 = tmp;\n\tif (k2 > k3)\n\t\ttmp = k2, k2 = k3, k3 = tmp;\n\tif (k1 == 1)\n\t\tyes = 1;\n\telse if (k1 >= 3)\n\t\tyes = k3 == 3;\n\telse {\t/* k1 == 2 */\n\t\tif (k2 == 2)\n\t\t\tyes = 1;\n\t\telse if (k2 >= 4)\n\t\t\tyes = k3 == 4;\n\t\telse { /* k2 == 3 */\n\t\t\tif (k3 > 6)\n\t\t\t\tyes = 0;\n\t\t\telse { /* k3 = 3, 4, 5, 6 */\n\t\t\t\tstatic char used[K];\n\t\t\t\tint k, r1, r2, r3, i;\n\n\t\t\t\tk = lcm(lcm(k1, k2), k3);\n\t\t\t\tyes = 0;\n\t\t\t\tfor (r1 = 0; r1 < k1; r1++)\n\t\t\t\t\tfor (r2 = 0; r2 < k2; r2++)\n\t\t\t\t\t\tfor (r3 = 0; r3 < k3; r3++) {\n\t\t\t\t\t\t\tfor (i = 0; i < k; i++)\n\t\t\t\t\t\t\t\tused[i] = 0;\n\t\t\t\t\t\t\tfor (i = 0; i * k1 < k; i++)\n\t\t\t\t\t\t\t\tused[i * k1 + r1] = 1;\n\t\t\t\t\t\t\tfor (i = 0; i * k2 < k; i++)\n\t\t\t\t\t\t\t\tused[i * k2 + r2] = 1;\n\t\t\t\t\t\t\tfor (i = 0; i * k3 < k; i++)\n\t\t\t\t\t\t\t\tused[i * k3 + r3] = 1;\n\t\t\t\t\t\t\tyes = 1;\n\t\t\t\t\t\t\tfor (i = 0; i < k; i++)\n\t\t\t\t\t\t\t\tif (!used[i])\n\t\t\t\t\t\t\t\t\tyes = 0;\n\t\t\t\t\t\t\tif (yes)\n\t\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t}\nout:;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(yes ? \"YES\\n\" : \"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n\tint k1, k2, k3, cnt1, cnt2, cnt3, cnt4;\n\n\tscanf(\"%d%d%d\", &k1, &k2, &k3);\n\tcnt1 = cnt2 = cnt3 = cnt4 = 0;\n\tif (k1 == 1)\n\t\tcnt1++;\n\tif (k1 == 2)\n\t\tcnt2++;\n\tif (k1 == 3)\n\t\tcnt3++;\n\tif (k1 == 4)\n\t\tcnt4++;\n\tif (k2 == 1)\n\t\tcnt1++;\n\tif (k2 == 2)\n\t\tcnt2++;\n\tif (k2 == 3)\n\t\tcnt3++;\n\tif (k2 == 4)\n\t\tcnt4++;\n\tif (k3 == 1)\n\t\tcnt1++;\n\tif (k3 == 2)\n\t\tcnt2++;\n\tif (k3 == 3)\n\t\tcnt3++;\n\tif (k3 == 4)\n\t\tcnt4++;\n\tprintf(cnt1 >= 1 || cnt2 >= 2 || cnt3 >= 3 || (cnt2 == 1 && cnt4 == 2) ? \"YES\\n\" : \"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n\tstatic int kk[1501];\n\tint k1, k2, k3;\n\n\tscanf(\"%d%d%d\", &k1, &k2, &k3);\n\tkk[k1]++;\n\tkk[k2]++;\n\tkk[k3]++;\n\tprintf(kk[1] >= 1 || kk[2] >= 2 || kk[3] >= 3 || (kk[2] == 1 && kk[4] == 2) ? \"YES\\n\" : \"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n\nint cmp(const void *a,const void *b){\n\treturn *(int*)a - *(int*)b;\n}\n\nint main()\n{\n\tint a,b,c;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tint t[10]={},i;\n\tint m[3]={},ind=0,s;\n\tm[0]=a,m[1]=b,m[2]=c,s=1;\n\tqsort(m,3,sizeof(int),cmp);\n\tfor(i=0;i<3;i++)\n\t{\n\t\tfor(ind=s;ind<10;ind+=m[i])\n\t\t\tt[ind]=1;\n\t\tind=1;\n\t\twhile(t[ind]==1 && ind<10)\n\t\t\tind++;\n\t\ts=ind;\n\t\t// printf(\"s:%d\\n\",s );\n\t}\n\tint fl=0;\n\tfor(i=1;i<10;i++){\n\t\t// printf(\"%d \",t[i] );\n\t\tif(t[i] == 0)\n\t\t\tfl=1;\n\t}\n\t// puts(\"\");\n\tif(fl)\n\t\tprintf(\"NO\\n\");\n\telse\n\t\tprintf(\"YES\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#define ll long long\n#define For(i,n)\tfor(i=0;i b ? a : b)\t;}\nint a[3];\nint cmp(const void *a,const void *b){\n\tint *a1 = (int *)a;\n\tint *b1 = (int *)b;\n\tif((*a1) > (*b1))\treturn 1;\n\tif((*a1) == (*b1))\treturn 0;\n\treturn -1;\n}\nint main(){\n\tscanf(\"%d%d%d\" ,a ,a + 1 ,a + 2);\n\tqsort(a ,3 ,sizeof(a[0]) ,cmp);\n\tif(a[0] == 1)\tputs(\"YES\");\n\telse if(a[0] == 2){\n\t\tif(a[1] == 2)\tputs(\"YES\");\n\t\telse if(a[1] == 4 && a[2] == 4)\tputs(\"YES\");\n\t\telse puts(\"NO\");\n\t}else if(a[0] == 3){\n\t\tif(a[1] == 3 && a[2] == 3)\tputs(\"YES\");\n\t\telse puts(\"NO\");\n\t}else\tputs(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n#include \n#include \nint main() {\n int a, b, c;\n scanf(\"%d%d%d\", &a, &b, &c);\n if (a == 1 || b == 1 || c == 1)\n {\n printf(\"YES\");\n return 0;\n }\n if(1.0 * 1 / a + 1.0 * 1 / b + 1.0 * 1 / c < 1){\n printf(\"NO\");\n return 0;\n }else{\n int test1, test2, test3;\n if(a == 2){\n test1 = 1;\n }else{\n test1 = 0;\n }\n if(b == 2){\n test2 = 1;\n }else{\n test2 = 0;\n }if(c == 2){\n test3 = 1;\n }else{\n test3 = 0;\n }\n if(test1 + test2 + test3 >= 2){\n printf(\"YES\");\n return 0;\n }else if (test1 + test2 + test3 == 0){\n printf(\"YES\");\n return 0;\n }else{\n if(a == 4){\n test1 = 1;\n }else{\n test1 = 0;\n }\n if(b == 4){\n test2 = 1;\n }else{\n test2 = 0;\n }if(c == 4){\n test3 = 1;\n }else{\n test3 = 0;\n }\n if(test1 + test2 + test3 == 2){\n printf(\"YES\");\n return 0;\n }else{\n printf(\"NO\");\n return 0;\n }\n }\n }\n\n}"}, {"source_code": "#include \nint a[57];\nint main()\n{\n int n, k1, k2, k3;\n scanf(\"%d %d %d\", &k1, &k2, &k3);\n k1 > 10 ? ++a[10] : ++a[k1];\n k2 > 10 ? ++a[10] : ++a[k2];\n k3 > 10 ? ++a[10] : ++a[k3];\n if(a[1] || a[2] >= 2 || a[3] == 3)\n {\n puts(\"YES\");\n return 0;\n }\n if(a[2] == 1 && a[4] == 2)\n {\n puts(\"YES\");\n return 0;\n }\n puts(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nstatic int compare_int(const void* a, const void* b) { return *(const int*)a - *(const int*)b; }\n\n\nint main() {\n int k[3]; scanf(\"%d %d %d\\n\", &k[0], &k[1], &k[2]);\n qsort(k, 3, sizeof(int), compare_int);\n\n if(k[0] == 1) { printf(\"YES\\n\"); return 0; }\n if(k[1] <= 2) { printf(\"YES\\n\"); return 0; }\n if(k[0] == 2) { printf(\"%s\\n\", k[1] == 4 && k[2] == 4 ? \"YES\" : \"NO\"); return 0; }\n if(k[0] == 3) { printf(\"%s\\n\", k[1] == 3 && k[2] == 3 ? \"YES\" : \"NO\"); return 0; }\n\n printf(\"NO\\n\"); // k[0] > 3\n\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int a,b,c;\n scanf(\"%d%d%d\",&a,&b,&c);\n int v[1510]={0};\n v[a]++;v[b]++;v[c]++;\n if (v[1]>=1 || v[2]>=2 || v[3]==3 || ( v[2]==1 && v[4]==2))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint a[3],o=0,tw=0,t=0,f=0,i;\n\tfor(i=0;i<3;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t\tif(a[i]==3)\n\t\t\tt++;\n\t\tif(a[i]==1)\n\t\t\to++;\n\t\tif(a[i]==2)\n\t\t\ttw++;\n\t\tif(a[i]==4)\n\t\t\tf++;\n\t}\n\tif(t==3)\n\t\tprintf(\"YES\\n\");\n\t else if(o>=1)\n\t\tprintf(\"YES\\n\");\n\telse if(tw>=2)\n\t\tprintf(\"YES\\n\");\n\telse if(tw==1 && f==2)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n}"}, {"source_code": "#include\n\nint a[3000];\n\nint main(void)\n{\n int k[3],start,i,j,t;\n\n for(i=0;i<3;i++)\n {\n scanf(\"%i\",&k[i]);\n for(j=0;jk[i]){t=k[j];k[j]=k[i];k[i]=t;}\n }\n }\n for(i=0;i<3;i++)\n {\n start=3000;\n for(j=0;j<3000;j++)\n {\n if(a[j]==0){start=j;break;}\n }\n for(j=start;j<3000;j=j+k[i])\n {\n a[j]=1;\n }\n }\n for(j=0;j<3000;j++)\n {\n if(a[j]==0){printf(\"NO\");return 0;}\n }\n printf(\"YES\");\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main() {\nint k1,k2,k3;\n\n\nscanf(\"%d %d %d\",&k1,&k2,&k3);\n\nint flag=0;\n\nif((k1==1)||(k2==1)||(k3==1))\n{\n printf(\"YES\");\n return 0;\n \n}\n\n\nint f4=0,f2=0;\n\nif(k1==2)\nf2++;\n\n\nif(k2==2)\nf2++;\n\nif(k3==2)\nf2++;\n\nif(k1==4)\nf4++;\n\n\nif(k2==4)\nf4++;\n\nif(k3==4)\nf4++;\n\n\nif((f4==2)&&(f2==1))\n{\n printf(\"YES\");\n return 0;\n \n}\n\n\n\n\nif((k1==3)&&(k2==3)&&(k3==3))\n{\n \n printf(\"YES\");\n return 0;\n}\n\nif(k1==2)\nflag++;\n\n\nif(k2==2)\nflag++;\n\nif(k3==2)\nflag++;\n\n\nif(flag>=2)\n{\n printf(\"YES\");\n}\nelse\nprintf(\"NO\");\n\n\n\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int a, b, c, t=0, f=0;\n scanf(\"%d %d %d\", &a, &b, &c);\n if(a==2)\n t++;\n if(b==2)\n t++;\n if(c==2)\n t++;\n\n if(a==4)\n f++;\n if(b==4)\n f++;\n if(c==4)\n f++;\n\n if(a==1 || b == 1 || c==1)\n printf(\"YES\\n\");\n else if(a == 3 && b == 3 && c == 3){\n printf(\"YES\\n\");\n }\n else if(t>=2)\n printf(\"YES\\n\");\n else if( t == 1 && f == 2)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int k1, k2, k3;\n\n scanf(\"%d %d %d\", &k1, &k2, &k3);\n\n if ((k1 == 1) || (k2 == 1) || (k3 == 1)){\n printf(\"YES\");\n return 0;\n }\n\n if ((k1 == 3) && (k2 == 3) && (k3 == 3)){\n printf(\"YES\");\n return 0;\n }\n\n if (((k1 == 2) && ((k2 == 2) || (k3 == 2))) || ((k2 == 2) && (k3 == 2))){\n printf(\"YES\");\n return 0;\n }\n\n if (((k1 == 4) && (k2 == 4) && (k3 == 2)) || ((k1 == 4) && (k3 == 4) && (k2 == 2)) || ((k2 == 4) && (k3 == 4) && (k1 == 2))){\n printf(\"YES\");\n return 0;\n }\n\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\n#define min(a,b) (a=4) puts(\"NO\");\n\telse if(m==1) puts(\"YES\");\n\telse if(m==3) puts(a==3&&b==3&&c==3?\"YES\":\"NO\");\n\telse puts((a==2&&b==2||a==2&&c==2||b==2&&c==2)||(a==4&&b==4||a==4&&c==4||b==4&&c==4)?\"YES\":\"NO\");\n}\n"}, {"source_code": "#include \"stdio.h\"\n\nint main()\n{\n\tint a, b, c;\n\twhile (scanf(\"%d%d%d\", &a, &b, &c) != EOF)\n\t{\n\t\tif (a == 1 || b == 1 || c == 1) {\n\t\t\tprintf(\"YES\\n\");\n\t\t\tcontinue;\n\t\t}\n\t\tif ((a == 2 && b == 2) || (a == 2 && c == 2) || (b == 2 && c == 2)) {\n\t\t\tprintf(\"YES\\n\");\n\t\t\tcontinue;\n\t\t}\n\t\tif (a == 3 && b == 3 && c == 3) {\n\t\t\tprintf(\"YES\\n\");\n\t\t\tcontinue;\n\t\t}\n\t\tif ((a == 2 && b == 4 && c == 4) || (a == 4 && b == 2 && c == 4) || (a == 4 && b == 4 && c == 2)) {\n\t\t\tprintf(\"YES\\n\");\n\t\t\tcontinue;\n\t\t}\n\t\t\n\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n\tint a,b,c,fl=0;\n\t\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\n\tif(a==1 || b==1 || c==1)\n\t\tfl=1;\n\tif((a==2 && b==2) || (a==2 && c==2) || (b==2 && c==2))\n\t\tfl=1;\n\tif(a==3 && b==3 && c==3)\n\t\tfl=1;\n\tint s=0;\n\tif(a==4)\n\t\ts+=2;\n\tif(a==2)\n\t\ts+=1;\n\n\tif(b==4)\n\t\ts+=2;\n\tif(b==2)\n\t\ts+=1;\n\n\tif(c==4)\n\t\ts+=2;\n\tif(c==2)\n\t\ts+=1;\n\n\tif(s==5)\n\t\tfl=1;\n\n\tif(fl==1)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tint a,b,c;\n\tint two = 0,three = 0,four = 0;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tint miny = 2000;\n\tif (a < miny) miny = a;\n\tif (b < miny) miny = b;\n\tif (c < miny) miny = c;\n\t\n\tif (a == 2) two++;\n\tif (b == 2) two++;\n\tif (c == 2) two++;\n\t\n\tif (a == 3) three++;\n\tif (b == 3) three++;\n\tif (c == 3) three++;\n\t\n\tif (a == 4) four++;\n\tif (b == 4) four++;\n\tif (c == 4) four++;\n\t\n\tif (miny > 3) printf(\"NO\\n\");\n\telse\n\t{\n\t\tif (miny == 1) printf(\"YES\\n\");\n\t\telse if (three == 3) printf(\"YES\\n\");\n\t\telse\n\t\t{\n\t\t\tif (two == 2 || two == 3) printf(\"YES\\n\");\n\t\t\t//else if (two == 1 && three == 2) printf(\"YES\\n\");\n\t\t\telse if (four == 2 && two == 1) printf(\"YES\\n\");\n\t\t\telse printf(\"NO\\n\");\n\t\t}\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include \nint main(void) {\n\tint c,a,b;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tif(a==1 || b==1 || c==1)\n\t{printf(\"YES\");return 0;}\n\telse if((a==2 && b==2)||(a==2 && c==2)||(b==2&& c==2))\n\t{printf(\"YES\");return 0;}\n\telse if((a==2 && b==4 && c==4)||(a==4 && b==2 && c==4)||(a==4 && b==4 && c==2))\n\t{printf(\"YES\");return 0;}\n\telse if(a==3 && b==3 && c==3)\n\t{printf(\"YES\");return 0;}\n else\n\t{printf(\"NO\");return 0;}\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint Check(int a,int b,int c)\n{\n if(a==1 || b==1 || c==1)\n return 1;\n if((a==2 && b==2) || (a==2 && c==2) || (b==2 && c==2))\n return 1;\n if((a==2 && b==4 && c==4) || (a==4 && b==2 && c==4) || ((a==4 && b==4 && c==2)))\n return 1;\n if(a==3 && b==3 && c==3)\n return 1;\n else\n return 0;\n\n\n}\n\n\n\n\nint main()\n{\nint a,b,c;\nscanf(\"%d %d %d\",&a,&b,&c);\nif(Check(a,b,c)==1)\n printf(\"YES\");\nif(Check(a,b,c)==0)\n printf(\"NO\");\n\n\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,c,i;\n scanf(\"%d %d %d\",&a,&b,&c );\n if(a==1||b==1||c==1)\n printf(\"YES\" );\n else if((a==2 && b==2)||(a==2 && c==2)||(c==2 && b==2))\n printf(\"YES\");\n else if(a==3 &&b==3&&c==3)\n printf(\"YES\");\n else if ((a==4 && b==2 && c==4)||(a==4 && b==4 && c==2)||(a==2 && b==4 && c==4))\n printf(\"YES\");\n else\n printf(\"NO\" );\n\n\n}\n"}, {"source_code": "#include\nint main()\n{ \n int k1,k2,k3;\n scanf(\"%d %d %d\",&k1,&k2,&k3);\n if((k1==1) || (k2==1) || (k3==1))\n {printf(\"YES\");}\n else if (((k1==2) && (k2==2)) || (k2==2 && k3==2) || (k1==2 && k3==2))\n { printf(\"YES\");}\n else if(k1==3 && k2==3 && k3==3)\n { printf(\"YES\");}\n else if((k1==2 && k2==4 && k3==4) || (k1==4 && k2==2 && k3==4) || (k1==4 && k2==4 && k3==2))\n { printf(\"YES\"); }\n else\n { printf(\"NO\");}\n return 0;\n}\n"}, {"source_code": "#include\n\n\nint main(){\n\nint k1,k2,k3;\n\nscanf(\"%d %d %d\",&k1,&k2,&k3);\n\nint arr[3]={k1,k2,k3};\n\nint flag=1;\nint i;\nwhile(flag){\nfor(i=1;i<3;i++){\n\nflag=0;\t\n\n\tif(arr[i]2)\n\t\tbreak;\n\t\t\n\tif(time[i]==0){\n\n//\t\tprintf(\"i is %d \\n\",i);\n\t\tfor(k=i;k<100000;k+=arr[j]){\n\t\t\n\t\t\ttime[k]=1;\n\t\t}\t\n\t\tj++;\n\t}\n\n}\t\n\tflag=1;\n\tfor(i=1;i<100000;i++){\n\t\n\t\tif(time[i]==0){\n\t\t\tflag=0;\n\t\t\tbreak;\n\t\t}\n\t}\t\n\n\tif(flag==1)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\nreturn 0;\t\n}\n"}, {"source_code": "//KRV Template\n#include\n#include\n#include\nvoid swap(int *xp, int *yp)\n{\n int temp = *xp;\n *xp = *yp;\n *yp = temp;\n}\n//BTW l,r are indices\nvoid bubblesort(int arr[] , int l , int r)\n{\n int i,j,temp=0;\n for(int i = l ; i<=r ; i++)\n {\n \tfor(int j = l ; jarr[j+1])\n \t\t{\n \t\t\tswap(&arr[j],&arr[j+1]);\n \t\t}\n \t}\n \ttemp++;\n }\n}\nvoid rbubblesort(int arr[] , int l , int r)\n{\n int i,j,temp=0;\n for(int i = l ; i<=r ; i++)\n {\n \tfor(int j = l ; j=arr[i])\n {\n \tans = arr[i+1];\n }\n\t}\n\treturn ans;\n}\nint mininarray(int arr[] , int l , int r)\n{\n\tint ans = arr[0];\n\tfor(int i = l ; i=b && a>=c)\n return a;\n if(b>=a && b>=c)\n return b;\n else\n return c;\n}\nint main()\n{\n\t//The actual part is here!!\n int a,b,c;\n scanf(\"%d %d %d\",&a,&b,&c);\n int test = a+b+c;\n if(a==1 || b==1 || c==1)\n {\n printf(\"YES\");\n return 0;\n }\n if((a==2 && b==2) || (a==2 &&c ==2) || (b==2 &&c ==2))\n {\n printf(\"YES\");\n return 0;\n }\n if(a==3&&b==3&&c==3)\n {\n printf(\"YES\");\n return 0;\n }\n if((a==2 && b==4 && c==4) || (a==4 && b==4 && c==2) || (a==4 && b==2 && c==4) )\n {\n printf(\"YES\");\n return 0;\n }\n printf(\"NO\");\n}"}, {"source_code": "#include \nint main(int argc, char const *argv[])\n{ int n,m,v;\n scanf(\"%d %d %d\",&n,&m,&v);\n if (n==1 || m==1 || v==1) {\n printf(\"YES\\n\");\n return 0;\n /* code */\n }\n if (n==2 && m==2) {\n printf(\"YES\\n\");\n return 0;\n /* code */\n }\n if (m==2 && v==2) {\n printf(\"YES\\n\");\n return 0;\n /* code */\n }\n if (v==2 && n==2) {\n printf(\"YES\\n\");\n return 0;\n /* code */\n }\n if (m==3 && n==3 && v==3) {\n printf(\"YES\\n\");\n return 0;\n /* code */\n }\n if (m==4 && n==4 && v==2) {\n printf(\"YES\\n\");\n return 0;\n /* code */\n }\n if (v==4 && n==4 && m==2) {\n printf(\"YES\\n\");\n return 0;\n /* code */\n }\n if (m==4 && v==4 && n==2) {\n printf(\"YES\\n\");\n return 0;\n /* code */\n }\n printf(\"NO\\n\" );\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n\nint main() {\n\n int i,j,k,n,z,p=0,sum,dist,start,end,min,max,a,b,c,x,y;\n // char pre[30];\n // char suf[30];\n int arr[5];\n scanf(\"%d %d %d\",&a,&b,&c);\n arr[0]=a;\n arr[1]=b;\n arr[2]=c;\n for(i=0;i<2;i++){\n for(j=i+1;j<3;j++){\n if(arr[i]>arr[j]){\n z=arr[i];\n arr[i]=arr[j];\n arr[j]=z;\n }\n }\n }\n if(arr[0]==1){\n printf(\"YES\");\n }else if(arr[0]==2 && arr[1]==2){\n printf(\"YES\");\n }else if(arr[0]==2 && arr[1]==4 && arr[2]==4){\n printf(\"YES\");\n }else if(arr[0]==3 && arr[1]==3 && arr[2]==3){\n printf(\"YES\");\n }else{\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint a[150005];\nint main()\n{\n int k1, k2, k3, x1, x2, x3, i;\n scanf(\"%d %d %d\", &k1, &k2, &k3);\n for(x1 = 0; x1 <= 2; x1++)\n for(x2 = 0; x2 <= 2; x2++)\n for(x3 = 0; x3 <= 2; x3++)\n {\n memset(a, 0, sizeof(a));\n int is = 1;\n for(i = 0; i <= 100; i++)\n {\n a[x1+i*k1] = 1;\n a[x2+i*k2] = 1;\n a[x3+i*k3] = 1;\n }\n for(i = 0; i <= 100; i++)\n {\n if(a[i]==0)\n {\n is = 0;\n break;\n }\n }\n if(is)\n {\n printf(\"YES\");\n return 0;\n }\n }\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n\tint k1 , k2 , k3;\n\tscanf(\"%d%d%d\" , &k1 , &k2 , &k3);\n\tif (k1 == 1 || k2 == 1 || k3 == 1)\n\t{\n\t\tprintf(\"YES\");\n\t\treturn 0;\n\t}\n\tif (k1 != 2 && k2 != 2 && k3 != 2){\n\t\tif (k1 == 3 && k2 == 3 && k3 == 3)\n\t\t\tprintf(\"YES\");\n\t\telse\n\t\t\tprintf(\"NO\");\n\t\treturn 0;\n\t}\n\tif ((k1 == 2 && k2 == 2) || (k1 == 2 && k3 == 2) || (k2 == 2 && k3 == 2))\n\t{\n\t\tprintf(\"YES\");\n\t\treturn 0;\n\t}\n\tif ((k2 == 4 && k3 == 4) || (k1 == 4 && k3 == 4) || (k2 == 4 && k1 == 4))\n\t{\n\t\tprintf(\"YES\");\n\t\treturn 0;\n\t}\n\tprintf(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint m,n,k;\n\nint main(int argc, char *argv[]) \n{\n\tscanf(\"%d%d%d\", &m, &n, &k);\n\tif (m==1 || n==1 || k==1)\n\tprintf(\"YES\");\n\t\n\telse if ((m==2 && n==2) || (m==2 && k==2) || (n==2 && k==2))\n\tprintf(\"YES\");\n\t\n\telse if (m==3 && n==3 && k==3)\n\tprintf(\"YES\");\n\t\n\telse if ((m==4 && n==4 && k==2) || (m==2 && n==4 && k==4) || (m==4 && n==2 && k==4))\n\tprintf(\"YES\");\n\t\n\telse printf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include \n#include\nint main()\n{\n int a,b,c;\n int d;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(a==1||b==1||c==1)\n {\n printf(\"YES\");\n\n }\n else if((a==2&&b==2)||(b==2&&c==2)||(c==2&&a==2))\n {\n printf(\"YES\");\n\n }\n else if((a==4&&b==4&&c==2)||(b==4&&c==4&&a==2)||(c==4&&a==4&&b==2))\n {\n printf(\"YES\");\n\n }\n else if(a==3&&b==3&&c==3)\n {\n printf(\"YES\");\n }\n else\n printf(\"NO\");\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include\n\nint main(){\n\n int k[3];\n int i;\n int sum = 0;\n int max = 0;\n\n for(i = 0; i < 3; i++){\n scanf(\"%d\", &k[i]);\n sum = sum + k[i];\n\n if(k[i] > max){\n max = k[i];\n }\n }\n\n for(i = 0; i < 3; i++){\n if(k[i] == 1){\n printf(\"YES\\n\");\n return 0;\n }\n }\n\n\n if(max + 4 < sum){\n printf(\"NO\\n\");\n } else {\n printf(\"YES\\n\");\n }\n\n return 0;\n\n\n\n}\n"}, {"source_code": "#include\n#include\n#include\nint main()\n{\n\tint n=3,one=0,two=0,three=0,k;\n\tint i;\n\tfor(i=0;i=1||two>=2||three==3)\n\t{\n\t\tprintf(\"YES\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\\n\");\n\t}\n}\n"}, {"source_code": "#include \nmain()\n{\nint k[3],i,a[3],j;\nscanf(\"%d %d %d\",&k[0],&k[1],&k[2]);\nfor(i=0;i<3;i++)\n{\n a[i]=k[i];\n for(j=i;j-1>=0&&a[j-1]>k[i];j--)\n {\n a[j]=a[j-1];\n a[j-1]=k[i];\n }\n\n}\nfor(i=0;i<3;i++) k[i]=0;\nfor(i=0;i<3&&(i-1<0||k[i-1]!=i);i++)\n{\n for(j=0;j<=i&&(i+1)%a[j]==0;j++)\n {\n k[i]++;\n }\n}\nif(k[i-1]==i) printf(\"YES\");\nelse printf(\"NO\");\n}\n"}, {"source_code": "#include\n\n\n\nint main(){\nint k1,k2,k3;\nscanf(\"%d%d%d\",&k1,&k2,&k3);\nint min;\nmin=(k1>k2)?((k2>k3)?k3:k2):((k1>k3)?k3:k1);\nif(min==1){\nprintf(\"YES\");\nreturn 0;\n}\nif(min==2){\nint cnt=0,cnt1=0;\nif(k1==2){\ncnt++;\n}\nif(k2==2){\n\tcnt++;\n}\nif(k3==2){\n\tcnt++;\n}\n\n\nif(k1==4){\n\tcnt1++;\n}\nif(k2==4){\n\t cnt1++;\n}\nif(k3==4){\n\t cnt1++;\n}\n\n\n\nif(cnt>=2||cnt1==2){\nprintf(\"YES\");\n}\nif(cnt<2){\nprintf(\"NO\");\n}\nreturn 0;\n}\n\nif(min==3&&k1==3&&k2==3&&k3==3){\nprintf(\"YES\");return 0;\n}\nprintf(\"NO\");\nreturn 0;\n\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int a1,a2,a3,i,j,k,l;\n int n1,n2,n3;\n scanf(\"%d%d%d\",&a1,&a2,&a3);\n i=a1*a2*a3;\n for (n1=0;n1i+k) {printf(\"YES\");return 0;}\n }\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n \nint main()\n{\n int flag=1,min=1500,max=0,k[3];\n int dict[3]={-1};\n for(int i=0;i<3;i++)\n {\n scanf(\"%d\",&k[i]);\n if(k[i]<=3) flag=0;\n if(k[i]max) max=k[i];\n }\n if(min==1)\n {\n printf(\"YES\\n\");\n return 0;\n }\n int mid = k[0]+k[1]+k[2]-min-max;\n dict[0] = min;\n dict[2] = -1;\n dict[1] = -1;\n if(flag)\n {\n printf(\"NO\\n\");\n return 0;\n }\n flag=1;\n for(int i=1;i<=1500;i++)\n {\n if(dict[1]!=-1 && dict[2]!=-1)\n {\n if(i%min!=0 && (i-1)%mid!=0 && (i-2)%max!=0)\n {\n flag=0;\n break;\n } \n }\n else if(dict[1]==-1)\n {\n dict[1] = i;\n }\n else{\n dict[2] = i;\n }\n }\n if(flag)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n return 0;\n}"}, {"source_code": "#include \n#include \nint main()\n{\n int a,b,c;\n scanf(\"%d %d %d\",&a,&b,&c);\n int k;\n if(a>b) {k=a;a=b;b=k;}\n if(b>c) {k=b;b=c;c=k;}\n if(a>b) {k=a;a=b;b=k;}\n if(c<=3||(a==2&&b==4&&c==4)) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n}"}, {"source_code": "\n #include \n#include \nint main()\n{\n int a,b,c;\n scanf(\"%d %d %d\",&a,&b,&c);\n int k;\n if(a\nint main(void){\n int k1,k2,k3,flag=0;\n scanf(\"%d%d%d\",&k1,&k2,&k3);\n if(k1==1||k2==1||k3==1) flag=1;\n else if(k1==2&&k2==2||k1==2&&k3==2||k2==2&&k3==2) flag=1;\n else if(k1==3&&k2==3&&k3==3) flag=1;\n else if(k1==2&&k2==2&&k3==4||k1==2&&k2==4&&k3==2||k1==4&k2==2&&k3==2) flag=1;\n if(flag) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include \n\nint main() {\n\tint a,b,c;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tif((a==1)||(b==1)||(c==1)){\n\t printf(\"YES\");\n\t return 0;\n\t}\n\tif((a==3)&&(b==3)&&(c==3)){\n\t printf(\"YES\");\n\t return 0;\n\t}\n\tif(a==2){\n\t if((b==2)||(c==2)){\n\t printf(\"YES\");\n\t return 0;\n\t }\n\t}\n\tif((b==2)&&(c==2)){\n\t printf(\"YES\");\n\t return 0;\n\t}\n\tprintf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint i,j,a[3],t;\n for(i=0;i<3;i++)\n\t\tscanf(\"%d\",&a[i]);\n\tfor(i=0;i<2;i++)\n\t{\n\t for(j=0;j<2-i;j++)\n\t {\n\t\t if(a[j]>a[j+1])\n\t\t {\n\t\t t=a[j];\n\t\t\ta[j]=a[j+1];\n\t\t\ta[j+1]=t;\n\t\t }\n\t }\n\t}\n\t if(a[0]==1)\n\t\t printf(\"YES\\n\");\n\t else if(a[0]==2&&a[1]==a[2]&&a[1]==4)\n\t\tprintf(\"Yes\\n\");\n\t else if((a[1]==2&&a[0]==2)||(a[1]==2&&a[2]==2))\n\t\t printf(\"YES\\n\");\n\t else if(a[0]==a[1]&&a[1]==a[2]&&a[1]==3)\n\t\t printf(\"YES\\N\");\n\t else\n\t\t printf(\"NO\\n\");\n\t return 0;\n}\n\t\n "}, {"source_code": "#include\n//#include\nint main()\n{\n int n,a,b;\n scanf(\"%d %d %d\",&n,&a,&b);\n if((n==2 && a==2) || (n==2 && b==2) || (b==2 && a==2) || (n==3 && a==3 && b==3) || (n==1) || (a==1) || (b==1))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n\tint x1,x2,x3,two=0,four=0;\n\tscanf(\"%d %d %d\",&x1,&x2,&x3);\n\tif(x1==2) two++;\n\tif(x2==2) two++;\n\tif(x3==2) two++;\n\tif(x1==4) four++;\n\tif(x2==4) four++;\n\tif(x3==4) four++;\n\tif(x1==1 || x2==1 || x3==1)\n\t\tprintf(\"YES\\n\");\n\telse\n\t{\n\t\tif(two>=2)\n\t\t\tprintf(\"YES\\n\");\n\t\telse if(four==2 && two==1)\n\t\t\tprintf(\"YES\\n\");\n\t\telse\n\t\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\n\tint arr[5];\nint main()\n{\n\tint arr1[4];\n\tscanf(\"%d %d %d\",&arr1[0],&arr1[1],&arr1[2]);\n\tfor (int i = 0; i < 3; ++i)\n\t{\n\t\tarr[arr1[i]]++;\n\t}\n\tif (arr[1]==1 || arr[2]==2 || arr[3]==3)\n\t{\n\t\tprintf(\"YES\\n\");\n\t}\n\telse if(arr[2]==1 && arr[4]==2)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n}"}, {"source_code": "#include\n\tint arr[5];\nint main()\n{\n\tint arr1[4];\n\tscanf(\"%d %d %d\",&arr1[0],&arr1[1],&arr1[2]);\n\tfor (int i = 0; i < 3; ++i)\n\t{\n\t\tarr[arr1[i]]++;\n\t}\n\tif (arr[1]==1 || arr[2]==2 || arr[3]==3 || arr[1]==2 || arr[1]==3)\n\t{\n\t\tprintf(\"YES\\n\");\n\t}\n\telse if(arr[2]==1 && arr[4]==2)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n}"}, {"source_code": "#include\nint main()\n{\n\tint a[3],o=0,tw=0,t=0,f=0,i;\n\tfor(i=0;i<3;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t\tif(a[i]==3)\n\t\t\tt++;\n\t\tif(a[i]==1)\n\t\t\to++;\n\t\tif(a[i]==2)\n\t\t\ttw++;\n\t\tif(a[i]==4)\n\t\t\tf++;\n\t}\n\tif(t==3)\n\t\tprintf(\"YES\\n\");\n\t else if(o>=1)\n\t\tprintf(\"YES\\n\");\n\telse if(tw>=2)\n\t\tprintf(\"YES\\n\");\n\telse if(tw==2 && f==1)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n}"}, {"source_code": "#include \n\nint main(){\n int a, b, c; scanf(\"%d %d %d\", &a, &b, &c);\n if ( (a==2 && b ==2 ) || (b==2 && c==2 )\n || (c==2 && a==2 )) printf(\"YES\\n\");\n else if ( a==3 && b== 3 && c==3 ) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n\n}\n"}, {"source_code": "#include \n\nint main(){\n int a, b, c; scanf(\"%d %d %d\", &a, &b, &c);\n if ( (a==2 && b ==2 ) || (b==2 && c==2 )\n || (c==2 && a==2 )) printf(\"YES\\n\");\n else if ( a==3 && b== 3 && c==3 ) printf(\"YES\\n\");\n else if ( a==1 || b==1 || c==1) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n\n}\n"}, {"source_code": "#include \n\nint GCD(int a, int b){\n\tint c;\n\twhile (a != 0){\n\t\tc = a; a = b % a; b = c;\n\t}\n\treturn b;\n}\n\nint LCM(int a, int b){ return a * b / GCD(a, b); }\n\nint main(){\n\tint x1, x2, x3;\n\tscanf(\"%d %d %d\", &x1, &x2, &x3);\n\tint lcm = LCM(LCM(x1, x2), x3), ret = lcm, shift = 1;\n\tret -= lcm / x1 + lcm / x2 + lcm / x3;\n\tif (GCD(x1, x2) <= shift) ret += lcm / LCM(x1, x2);\n\telse shift++;\n\tif (GCD(x1, x3) <= shift) ret += lcm / LCM(x1, x3);\n\telse shift++;\n\tif (GCD(x2, x3) <= shift) ret += lcm / LCM(x1, x3);\n\telse shift++;\n\tif (ret == 0) printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include \n#define LL long long int\nLL GCD(LL a, LL b){\n\tLL c;\n\twhile (a != 0){\n\t\tc = a; a = b % a; b = c;\n\t}\n\treturn b;\n}\n\nLL LCM(LL a, LL b){ return a * b / GCD(a, b); }\n\nint main(){\n\tint x1, x2, x3;\n\tscanf(\"%d %d %d\", &x1, &x2, &x3);\n\tLL lcm = LCM(LCM(x1, x2), x3), ret = 1;\n\tfor (LL i=3; i\n\nint GCD(int a, int b){\n\tint c;\n\twhile (a != 0){\n\t\tc = a; a = b % a; b = c;\n\t}\n\treturn b;\n}\n\nint LCM(int a, int b){ return a * b / GCD(a, b); }\n\nint main(){\n\tint x1, x2, x3;\n\tscanf(\"%d %d %d\", &x1, &x2, &x3);\n\tint lcm = LCM(LCM(x1, x2), x3), ret = lcm, shift = 1;\n\tret -= lcm / x1 + lcm / x2 + lcm / x3;\n\tif (GCD(x1, x2) <= shift) ret += lcm / LCM(x1, x2);\n\telse shift++;\n\tif (GCD(x1, x3) <= shift) ret += lcm / LCM(x1, x3);\n\telse shift++;\n\tif (GCD(x2, x3) <= shift) ret += lcm / LCM(x2, x3);\n\telse shift++;\n\tif (ret == 0) printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include \n#define LL long long int\nLL GCD(LL a, LL b){\n\tLL c;\n\twhile (a != 0){\n\t\tc = a; a = b % a; b = c;\n\t}\n\treturn b;\n}\n\nLL LCM(LL a, LL b){ return a * b / GCD(a, b); }\n\nint main(){\n\tint x1, x2, x3;\n\tscanf(\"%d %d %d\", &x1, &x2, &x3);\n\tLL lcm = LCM(LCM(x1, x2), x3), ret = 1;\n\tfor (LL i=3; i\n#include \n\n\n\nint main()\n{\n int a;\n int b;\n int c;\n int i=0;\n int w=0;\n int t=0;\n\n scanf(\"%d\", &a);\n scanf(\"%d\", &b);\n scanf(\"%d\", &c);\n\n\n if(a==1) i++;\n if(a==2) w++;\n if(a==3) t++;\n\n if(b==1) i++;\n if(b==2) w++;\n if(b==3) t++;\n\n if(c==1) i++;\n if(c==2) w++;\n if(c==3) t++;\n\n\n if(i>0 || w>1 || t>2) printf(\"YES\");\n else printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int ara[3];\n scanf(\"%d %d %d\",&ara[0],&ara[1],&ara[2]);\n int i,j=0,k=0;\n for(i=0;i<3;++i){\n if(ara[i]==1){printf(\"YES\\n\"); return 0;}\n }\n for(i=0;i<3;i++){\n if(ara[i]==2) j++;\n else if(ara[i]==4)k++;\n }\n if(j==2){printf(\"YES\\n\"); return 0;}\n if(j==1 && k==2){ printf(\"YES\\n\"); return 0;};\n for(i=0;i<3;i++){\n if(ara[i]!=3){\n printf(\"NO\\n\");\n return 0;\n }\n }\n printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int ara[3];\n scanf(\"%d %d %d\",&ara[0],&ara[1],&ara[2]);\n int i,j=0;\n for(i=0;i<3;++i){\n if(ara[i]==1){printf(\"YES\\n\"); return 0;}\n }\n for(i=0;i<3;i++){\n if(ara[i]==2) j++;\n }\n if(j==2){printf(\"YES\\n\"); return 0;}\n for(i=0;i<3;i++){\n if(ara[i]!=3){\n printf(\"NO\\n\");\n return 0;\n }\n }\n printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n\nint\nmain()\n{\n int x;\n int a[7] = {0,0,0,0,0,0,0};\n for (int i = 0; i < 3; ++i) {\n scanf(\"%d\", &x);\n if (x < 7) {\n a[x]++;\n }\n } \n if (a[1] > 0 || a[2] > 1 || (a[2] == 1 && a[4] == 2) || (a[2] == 1 && a[3] == 1 && a[6] == 1) || (a[3] == 3))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n\tint k1, k2, k3, cnt1, cnt2, cnt3;\n\n\tscanf(\"%d%d%d\", &k1, &k2, &k3);\n\tcnt1 = cnt2 = cnt3 = 0;\n\tif (k1 == 1)\n\t\tcnt1++;\n\tif (k1 == 2)\n\t\tcnt2++;\n\tif (k1 == 3)\n\t\tcnt3++;\n\tif (k2 == 1)\n\t\tcnt1++;\n\tif (k2 == 2)\n\t\tcnt2++;\n\tif (k2 == 3)\n\t\tcnt3++;\n\tif (k3 == 1)\n\t\tcnt1++;\n\tif (k3 == 2)\n\t\tcnt2++;\n\tif (k3 == 3)\n\t\tcnt3++;\n\tprintf(cnt1 >= 1 || cnt2 >= 2 || cnt3 >= 3 ? \"YES\\n\" : \"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "//Date : 27 - 12 - 17\n\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#define ll long long\n#define For(i,n)\tfor(i=0;i b ? a : b)\t;}\n/*\nint a[MAX] ,p[MAX];\nint main(){\n\tint n ,i ,m = INT_MAX ,r = 0 ,d = INT_MAX;\n\ts(n);\n\tFor(i ,n){\ts(a[i]);\tm = min(m ,a[i]);\t}\n\tFor(i ,n)\tif(a[i] == m)\tp[r++] = i;\n\trep(i ,1,r - 1)\td = min(d ,p[i] - p[i - 1]);\n\tprintf(\"%d\" ,d);\n\treturn 0;\n}*/\n/*\nvoid swap(int *a,int *b){\n\tint t = *a;\n\t*a = *b;\n\t*b = t;\n}\nint main(){\n\tint n ,a ,b ,i ,x ,y;\n\tscanf(\"%d%d%d\" ,&n ,&a ,&b);\n\tif(a > b)\tswap(&a ,&b);\n\trep(i ,1 ,a){\n\t\tx = a / i;\n\t\ty = b / i;\n\t\tif(x + y < n)\tbreak;\n\t}\n\tprintf(\"%d\" ,i - 1);\n\treturn 0;\n}*/\n\nint a[3];\nint cmp(const void *a,const void *b){\n\tint *a1 = (int *)a;\n\tint *b1 = (int *)b;\n\tif((*a1) > (*b1))\treturn 1;\n\tif((*a1) == (*b1))\treturn 0;\n\treturn -1;\n}\nint main(){\n\tscanf(\"%d%d%d\" ,a ,a + 1 ,a + 2);\n\tqsort(a ,3 ,sizeof(a[0]) ,cmp);\n\tif(a[0] == 1)\tputs(\"YES\");\n\telse if(a[0] == 2){\n\t\tif(a[1] == 2)\tputs(\"YES\");\n\t\telse puts(\"NO\");\n\t}else if(a[0] == 3){\n\t\tif(a[1] == 3 && a[2] == 3)\tputs(\"YES\");\n\t\telse puts(\"NO\");\n\t}else\tputs(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include \nint a[10];\nint main()\n{\n int n, k1, k2, k3;\n scanf(\"%d %d %d\", &k1, &k2, &k3);\n if(k1 == 1 || k2 == 1 || k3 == 1)\n {\n puts(\"YES\");\n return 0;\n }\n if(k1 == 2 && k2 == 2 || k2 == 2 && k3 == 2 || k3 == 2 && k1 == 2)\n {\n puts(\"YES\");\n return 0;\n }\n if(k1 == 3 && k2 == 3 && k3 == 3)\n {\n puts(\"YES\");\n return 0;\n }\n puts(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \nint a[100];\nint main()\n{\n int n, k1, k2, k3;\n scanf(\"%d %d %d\", &k1, &k2, &k3);\n k1 > 10 ? ++a[10] : ++a[k1];\n k2 > 10 ? ++a[10] : ++a[k2];\n k3 > 10 ? ++a[10] : ++a[k3];\n if(a[1] >= 1 || a[2] >= 2 || a[3] == 3)\n {\n puts(\"YES\");\n return 0;\n }\n if(a[2] == 1 && a[4] == 2)\n {\n puts(\"YES\");\n return 0;\n }\n if(a[2] && a[3] && a[6])\n {\n puts(\"YES\");\n return 0;\n }\n puts(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\n\nint a[3000];\n\nint main(void)\n{\n int k[3],start,i,j;\n for(i=0;i<3;i++)\n {\n start=3000;\n scanf(\"%i\",&k[i]);\n for(j=0;j<3000;j++)\n {\n if(a[j]==0){start=j;break;}\n }\n for(j=start;j<3000;j=j+k[i])\n {\n a[j]=1;\n }\n }\n for(j=0;j<3000;j++)\n {\n if(a[j]==0){printf(\"NO\");return 0;}\n }\n printf(\"YES\");\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main() {\nint k1,k2,k3;\n\n\nscanf(\"%d %d %d\",&k1,&k2,&k3);\n\nint flag=0;\n\nif(k1==2)\nflag++;\n\n\nif(k2==2)\nflag++;\n\nif(k3==2)\nflag++;\n\n\nif(flag>=2)\n{\n printf(\"YES\");\n}\nelse\nprintf(\"NO\");\n\n\n\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main() {\nint k1,k2,k3;\n\n\nscanf(\"%d %d %d\",&k1,&k2,&k3);\n\nint flag=0;\n\nif((k1==1)||(k2==1)||(k3==1))\n{\n printf(\"YES\");\n return 0;\n \n}\n\n\nif((k1==3)&&(k2==3)&&(k3==3))\n{\n \n printf(\"YES\");\n return 0;\n}\n\nif(k1==2)\nflag++;\n\n\nif(k2==2)\nflag++;\n\nif(k3==2)\nflag++;\n\n\nif(flag>=2)\n{\n printf(\"YES\");\n}\nelse\nprintf(\"NO\");\n\n\n\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main() {\nint k1,k2,k3;\n\n\nscanf(\"%d %d %d\",&k1,&k2,&k3);\n\nint flag=0;\n\nif((k1==1)||(k2==1)||(k3==1))\n{\n printf(\"YES\");\n return 0;\n \n}\n\n\nif(k1==2)\nflag++;\n\n\nif(k2==2)\nflag++;\n\nif(k3==2)\nflag++;\n\n\nif(flag>=2)\n{\n printf(\"YES\");\n}\nelse\nprintf(\"NO\");\n\n\n\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int a, b, c, t=0;\n scanf(\"%d %d %d\", &a, &b, &c);\n if(a==2)\n t++;\n if(b==2)\n t++;\n if(c==2)\n t++;\n if(a==1 || b == 1 || c==1)\n printf(\"YES\\n\");\n else if(a == 3 && b == 3 && c == 3){\n printf(\"YES\\n\");\n }\n else if(t>=2)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int k1, k2, k3;\n\n scanf(\"%d %d %d\", &k1, &k2, &k3);\n\n if ((k1 == 1) || (k2 == 1) || (k3 == 1)){\n printf(\"YES\");\n return 0;\n }\n\n if ((k1 == 3) && (k2 == 3) && (k3 == 3)){\n printf(\"YES\");\n return 0;\n }\n\n if (((k1 == 2) && ((k2 == 2) || (k3 == 2))) || ((k2 == 2) && (k3 == 2))){\n printf(\"YES\");\n return 0;\n }\n\n if (((k1 == k2 == 4) && (k3 == 2)) || ((k1 == k3 == 4) && (k2 == 2)) || ((k2 == k3 == 4) && (k1 == 2))){\n printf(\"YES\");\n return 0;\n }\n\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\n#define min(a,b) (a=4) puts(\"NO\");\n\telse if(m==1) puts(\"YES\");\n\telse if(m==3) puts(a==3&&b==3&&c==3?\"YES\":\"NO\");\n\telse puts(a==2&&b==2||a==2&&c==2||b==2&&c==2?\"YES\":\"NO\");\n}\n"}, {"source_code": "#include\n#include\n#include\n\nint min(double a,double b){\n if(a\n\nint main()\n{\n\tint a,b,c;\n\tint two = 0,three = 0;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tint miny = 2000;\n\tif (a < miny) miny = a;\n\tif (b < miny) miny = b;\n\tif (c < miny) miny = c;\n\t\n\tif (a == 2) two++;\n\tif (b == 2) two++;\n\tif (c == 2) two++;\n\t\n\tif (a == 3) three++;\n\tif (b == 3) three++;\n\tif (c == 3) three++;\n\t\n\tif (miny > 3) printf(\"NO\\n\");\n\telse\n\t{\n\t\tif (miny == 1 || miny == 3) printf(\"YES\\n\");\n\t\telse\n\t\t{\n\t\t\tif (two == 2 || two == 3) printf(\"YES\\n\");\n\t\t\telse if (two == 1) printf(\"NO\\n\");\n\t\t}\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n\tint a,b,c;\n\tint two = 0,three = 0;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tint miny = 2000;\n\tif (a < miny) miny = a;\n\tif (b < miny) miny = b;\n\tif (c < miny) miny = c;\n\t\n\tif (a == 2) two++;\n\tif (b == 2) two++;\n\tif (c == 2) two++;\n\t\n\tif (a == 3) three++;\n\tif (b == 3) three++;\n\tif (c == 3) three++;\n\t\n\tif (miny > 3) printf(\"NO\\n\");\n\telse\n\t{\n\t\tif (miny == 1) printf(\"YES\\n\");\n\t\telse if (three == 3) printf(\"YES\\n\");\n\t\telse\n\t\t{\n\t\t\tif (two == 2 || two == 3) printf(\"YES\\n\");\n\t\t\telse printf(\"NO\\n\");\n\t\t}\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n\tint a,b,c;\n\tint two = 0,three = 0;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tint miny = 2000;\n\tif (a < miny) miny = a;\n\tif (b < miny) miny = b;\n\tif (c < miny) miny = c;\n\t\n\tif (a == 2) two++;\n\tif (b == 2) two++;\n\tif (c == 2) two++;\n\t\n\tif (a == 3) three++;\n\tif (b == 3) three++;\n\tif (c == 3) three++;\n\t\n\tif (miny > 3) printf(\"NO\\n\");\n\telse\n\t{\n\t\tif (miny == 1) printf(\"YES\\n\");\n\t\telse if (three == 3) printf(\"YES\\n\");\n\t\telse\n\t\t{\n\t\t\tif (two == 2 || two == 3) printf(\"YES\\n\");\n\t\t\telse if (two == 1 && three == 2) printf(\"YES\\n\");\n\t\t\telse printf(\"NO\\n\");\n\t\t}\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\nvoid Check(int a,int b,int c)\n{\n if((a==2 && b==2) || (a==2 && c==2) || (b==2 && c==2))\n printf(\"Yes\");\n if((a==2 && b==4 && c==4) || (a==4 && b==2 && c==4) || ((a==4 && b==4 && c==2)))\n printf(\"Yes\");\n if(a==3 && b==3 && c==3)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n\n}\n\n\n\n\nint main()\n{\nint a,b,c;\nscanf(\"%d %d %d\",&a,&b,&c);\nCheck(a,b,c);\n\n\n\n}\n"}, {"source_code": "#include \n#include \n\nint Check(int a,int b,int c)\n{\n if((a==2 && b==2) || (a==2 && c==2) || (b==2 && c==2))\n return 1;\n if((a==2 && b==4 && c==4) || (a==4 && b==2 && c==4) || ((a==4 && b==4 && c==2)))\n return 1;\n if(a==3 && b==3 && c==3)\n return 1;\n else\n return 0;\n\n\n}\n\n\n\n\nint main()\n{\nint a,b,c;\nscanf(\"%d %d %d\",&a,&b,&c);\nif(Check(a,b,c)==1)\n printf(\"YES\");\nif(Check(a,b,c)==0)\n printf(\"NO\");\n\n\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,c,i;\n scanf(\"%d %d %d\",&a,&b,&c );\n if(a==1||b==1||c==1)\n printf(\"YES\" );\n else if((a==2 && b==2)||(a==2 && c==2)||(c==2 && b==2))\n printf(\"YES\");\n else if(a==3 &&b==3&&c==3)\n printf(\"YES\");\n else if ((a==4 && b==2 && c==2)||(a==2 && b==4 && c==2)||(a==2 && b==2 && c==4))\n printf(\"YES\");\n else\n printf(\"NO\" );\n\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,c,i;\n scanf(\"%d %d %d\",&a,&b,&c );\n if(a==1||b==1||c==1)\n printf(\"YES\" );\n else if((a==2 && b==2)||(a==2 && c==2)||(c==2 && b==2))\n printf(\"YES\");\n else if(a==3||b==3||c==3)\n printf(\"YES\");\n else if ((a==4 && b==2 && c==2)||(a==2 && b==4 && c==2)||(a==2 && b==2 && c==4))\n printf(\"YES\");\n else\n printf(\"NO\" );\n\n\n}\n"}, {"source_code": "#include\nint main()\n{ \n int k1,k2,k3;\n scanf(\"%d %d %d\",&k1,&k2,&k3);\n if((k1==1) || (k2==1) || (k3==1))\n {printf(\"YES\");}\n else if (((k1==2) && (k2==2)) || (k2==2 && k3==2) || (k1==2 && k3==2))\n { printf(\"YES\");}\n else if(k1==3 && k2==3 && k3==3)\n { printf(\"YES\");}\n else if((k1==2 && k2==4 && k3==4) || (k1=4 && k2==2 && k3==4) || (k1==4 && k2==4 && k3==2))\n { printf(\"YES\");}\n else\n { printf(\"NO\");}\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{ \n int k1,k2,k3;\n scanf(\"%d %d %d\",&k1,&k2,&k3);\n if((k1==1) || (k2==1) || (k3==1))\n {printf(\"YES\");}\n else if (((k1==2) && (k2==2)) || (k2==2 && k3==2) || (k1==2 && k3==2))\n { printf(\"YES\");}\n else if(k1==3 && k2==3 && k3==3)\n { printf(\"YES\");}\n else if((k1==2 && k2==4 && k3==4) || (k1=4 && k2==2 && k3==4))\n { printf(\"YES\");}\n else\n { printf(\"NO\");}\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{ \n int k1,k2,k3;\n scanf(\"%d %d %d\",&k1,&k2,&k3);\n if((k1==1) || (k2==1) || (k3==1))\n {printf(\"YES\");}\n else if (((k1==2) && (k2==2)) || (k2==2 && k3==2) || (k1==2 && k3==2))\n { printf(\"YES\");}\n else if(k1==3 && k2==3 && k3==3)\n { printf(\"YES\");}\n else\n { printf(\"NO\");}\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{ \n int k1,k2,k3;\n scanf(\"%d %d %d\",&k1,&k2,&k3);\n if((k1==1) || (k2==1) || (k3==1))\n {printf(\"YES\");}\n else if (((k1==2) && (k2==2)) || (k2==2 && k3==2) || (k1==2 && k3==2))\n { printf(\"YES\");}\n else if(k1==3 && k2==3 && k3==3)\n { printf(\"YES\");}\n else if((k1==2 && k2==4 && k3==4) || (k1=4 && k2==2 && k3==4) || (k1==4 && k2==4 && k3==2))\n { printf(\"YES\"); }\n else\n { printf(\"NO\");}\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{ \n int k1,k2,k3,k4;\n scanf(\"%d %d %d\",&k1,&k2,&k3);\n if((k1==1) || (k2==1) || (k3==1))\n {printf(\"YES\");}\n else if (((k1==2) && (k2==2)) || (k2==2 && k3==2) || (k1==2 && k3==2))\n { printf(\"YES\");}\n else if(k1==3 && k2==3 && k3==3)\n { printf(\"YES\");}\n else if((k1==2 && k2==4 && k3==4) || (k1=4 && k2==2 && k3==4) || (k1==4 && k2==4 && k3==2))\n { printf(\"YES\");}\n else\n { printf(\"NO\");}\n return 0;\n}\n"}, {"source_code": "//KRV Template\n#include\n#include\n#include\nvoid swap(int *xp, int *yp)\n{\n int temp = *xp;\n *xp = *yp;\n *yp = temp;\n}\n//BTW l,r are indices\nvoid bubblesort(int arr[] , int l , int r)\n{\n int i,j,temp=0;\n for(int i = l ; i<=r ; i++)\n {\n \tfor(int j = l ; jarr[j+1])\n \t\t{\n \t\t\tswap(&arr[j],&arr[j+1]);\n \t\t}\n \t}\n \ttemp++;\n }\n}\nvoid rbubblesort(int arr[] , int l , int r)\n{\n int i,j,temp=0;\n for(int i = l ; i<=r ; i++)\n {\n \tfor(int j = l ; j=arr[i])\n {\n \tans = arr[i+1];\n }\n\t}\n\treturn ans;\n}\nint mininarray(int arr[] , int l , int r)\n{\n\tint ans = arr[0];\n\tfor(int i = l ; i=b && a>=c)\n return a;\n if(b>=a && b>=c)\n return b;\n else\n return c;\n}\nint main()\n{\n\t//The actual part is here!!\n int a,b,c;\n scanf(\"%d %d %d\",&a,&b,&c);\n int test = a+b+c;\n if(a==1 || b==1 || c==1)\n {\n printf(\"YES\");\n return 0;\n }\n if((a==2&&b==2) || (a==2&&c==2) || (b==2&&c==2))\n {\n printf(\"YES\");\n return 0;\n }\n if(a==3&&b==3&&c==3)\n {\n printf(\"YES\");\n return 0;\n }\n if((a==2 && b==2 && c==4) || (a==2 && b==4 && c==2) || (a==4 && b==2 && c==2) )\n {\n printf(\"YES\");\n return 0;\n }\n printf(\"NO\");\n}"}, {"source_code": "//KRV Template\n#include\n#include\n#include\nvoid swap(int *xp, int *yp)\n{\n int temp = *xp;\n *xp = *yp;\n *yp = temp;\n}\n//BTW l,r are indices\nvoid bubblesort(int arr[] , int l , int r)\n{\n int i,j,temp=0;\n for(int i = l ; i<=r ; i++)\n {\n \tfor(int j = l ; jarr[j+1])\n \t\t{\n \t\t\tswap(&arr[j],&arr[j+1]);\n \t\t}\n \t}\n \ttemp++;\n }\n}\nvoid rbubblesort(int arr[] , int l , int r)\n{\n int i,j,temp=0;\n for(int i = l ; i<=r ; i++)\n {\n \tfor(int j = l ; j=arr[i])\n {\n \tans = arr[i+1];\n }\n\t}\n\treturn ans;\n}\nint mininarray(int arr[] , int l , int r)\n{\n\tint ans = arr[0];\n\tfor(int i = l ; i=b && a>=c)\n return a;\n if(b>=a && b>=c)\n return b;\n else\n return c;\n}\nint main()\n{\n\t//The actual part is here!!\n int a,b,c;\n scanf(\"%d %d %d\",&a,&b,&c);\n int test = a+b+c;\n if(a==1 || b==1 || c==1)\n {\n printf(\"YES\");\n return 0;\n }\n if((a==2&&b==2) || (a==2&&c==2) || (b==2&&c==2))\n {\n printf(\"YES\");\n return 0;\n }\n if(a==3&&b==3&&c==3)\n {\n printf(\"YES\");\n return 0;\n }\n if((a==2 && b==3 && c==3) || (a==3 && b==2 && c==3) || (a==3 && b==3 && c==2) )\n {\n printf(\"YES\");\n return 0;\n }\n if((a==2 && b==2 && c==4) || (a==2 && b==4 && c==2) || (a==4 && b==2 && c==2) )\n {\n printf(\"YES\");\n return 0;\n }\n printf(\"NO\");\n}"}, {"source_code": "//KRV Template\n#include\n#include\n#include\nvoid swap(int *xp, int *yp)\n{\n int temp = *xp;\n *xp = *yp;\n *yp = temp;\n}\n//BTW l,r are indices\nvoid bubblesort(int arr[] , int l , int r)\n{\n int i,j,temp=0;\n for(int i = l ; i<=r ; i++)\n {\n \tfor(int j = l ; jarr[j+1])\n \t\t{\n \t\t\tswap(&arr[j],&arr[j+1]);\n \t\t}\n \t}\n \ttemp++;\n }\n}\nvoid rbubblesort(int arr[] , int l , int r)\n{\n int i,j,temp=0;\n for(int i = l ; i<=r ; i++)\n {\n \tfor(int j = l ; j=arr[i])\n {\n \tans = arr[i+1];\n }\n\t}\n\treturn ans;\n}\nint mininarray(int arr[] , int l , int r)\n{\n\tint ans = arr[0];\n\tfor(int i = l ; i=b && a>=c)\n return a;\n if(b>=a && b>=c)\n return b;\n else\n return c;\n}\nint main()\n{\n\t//The actual part is here!!\n int a,b,c;\n scanf(\"%d %d %d\",&a,&b,&c);\n int test = a+b+c;\n if(a==1 || b==1 || c==1)\n {\n printf(\"YES\");\n return 0;\n }\n if((a==2 && b==2) || (a==2 &&c ==2) || (b==2 &&c ==2))\n {\n printf(\"YES\");\n return 0;\n }\n if(a==3&&b==3&&c==3)\n {\n printf(\"YES\");\n return 0;\n }\n if((a==2 && b==2 && c==4) || (a==2 && b==4 && c==2) || (a==4 && b==2 && c==2) )\n {\n printf(\"YES\");\n return 0;\n }\n printf(\"NO\");\n}"}, {"source_code": "#include \nint main(int argc, char const *argv[])\n{ int n,m,v;\n scanf(\"%d %d %d\",&n,&m,&v);\n if (n==1 || m==1 || v==1) {\n printf(\"YES\\n\");\n return 0;\n /* code */\n }\n if (n==2 && m==2) {\n printf(\"YES\\n\");\n return 0;\n /* code */\n }\n if (m==2 && v==2) {\n printf(\"YES\\n\");\n return 0;\n /* code */\n }\n if (v==2 && n==2) {\n printf(\"YES\\n\");\n return 0;\n /* code */\n }\n if (m==3 && n==3 && v==3) {\n printf(\"YES\\n\");\n return 0;\n /* code */\n }\n printf(\"NO\\n\" );\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint a[10000];\nint main()\n{\n int k1, k2, k3, x1, x2, x3, i;\n scanf(\"%d %d %d\", &k1, &k2, &k3);\n for(x1 = 0; x1 <= 2; x1++)\n for(x2 = 0; x2 <= 2; x2++)\n for(x3 = 0; x3 <= 2; x3++)\n {\n memset(a, 0, sizeof(a));\n int is = 1;\n for(i = 0; i <= 5; i++)\n {\n a[x1+i*k1] = 1;\n a[x2+i*k2] = 1;\n a[x3+i*k3] = 1;\n }\n for(i = 0; i <= 11; i++)\n {\n if(a[i]==0)\n {\n is = 0;\n break;\n }\n }\n if(is)\n {\n printf(\"YES\");\n return 0;\n }\n }\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include \n#include \nint a[10000];\nint main()\n{\n int k1, k2, k3, x1, x2, x3, i;\n scanf(\"%d %d %d\", &k1, &k2, &k3);\n for(x1 = 0; x1 <= 2; x1++)\n for(x2 = 0; x2 <= 2; x2++)\n for(x3 = 0; x3 <= 2; x3++)\n {\n memset(a, 0, sizeof(a));\n int is = 1;\n for(i = 0; i <= 20; i++)\n {\n a[x1+i*k1%100] = 1;\n a[x2+i*k2%100] = 1;\n a[x3+i*k3%100] = 1;\n }\n for(i = 0; i <= 20; i++)\n {\n if(a[i]==0)\n {\n is = 0;\n break;\n }\n }\n if(is)\n {\n printf(\"YES\");\n return 0;\n }\n }\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include \n#include \nint a[10000];\nint main()\n{\n int k1, k2, k3, x1, x2, x3, i;\n scanf(\"%d %d %d\", &k1, &k2, &k3);\n for(x1 = 0; x1 <= 2; x1++)\n for(x2 = 0; x2 <= 2; x2++)\n for(x3 = 0; x3 <= 2; x3++)\n {\n memset(a, 0, sizeof(a));\n int is = 1;\n for(i = 0; i <= 10; i++)\n {\n a[x1+i*k1%100] = 1;\n a[x2+i*k2%100] = 1;\n a[x3+i*k3%100] = 1;\n }\n for(i = 0; i <= 20; i++)\n {\n if(a[i]==0)\n {\n is = 0;\n break;\n }\n }\n if(is)\n {\n printf(\"YES\");\n return 0;\n }\n }\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include \n#include \nint a[10000];\nint main()\n{\n int k1, k2, k3, x1, x2, x3, i;\n scanf(\"%d %d %d\", &k1, &k2, &k3);\n for(x1 = 0; x1 <= 2; x1++)\n for(x2 = 0; x2 <= 2; x2++)\n for(x3 = 0; x3 <= 2; x3++)\n {\n memset(a, 0, sizeof(a));\n int is = 1;\n for(i = 0; i <= 100; i++)\n {\n a[x1+i*k1%100] = 1;\n a[x2+i*k2%100] = 1;\n a[x3+i*k3%100] = 1;\n }\n for(i = 0; i <= 10; i++)\n {\n if(a[i]==0)\n {\n is = 0;\n break;\n }\n }\n if(is)\n {\n printf(\"YES\");\n return 0;\n }\n }\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n\tint k1 , k2 , k3;\n\tscanf(\"%d%d%d\" , &k1 , &k2 , &k3);\n\tif (k1 != 2 && k2 != 2 && k3 != 2){\n\t\tif (k1 == 3 && k2 == 3 & k3 == 3)\n\t\t\tprintf(\"YES\");\n\t\telse\n\t\t\tprintf(\"NO\");\n\t\treturn 0;\n\t}\n\tif ((k1 == 2 && k2 == 2) || (k1 == 2 && k3 == 2) || (k2 == 2 && k3 == 2))\n\t{\n\t\tprintf(\"YES\");\n\t\treturn 0;\n\t}\n\tif ((k2 == 4 && k3 == 4) || (k1 == 4 && k3 == 4) || (k2 == 4 && k1 == 4))\n\t{\n\t\tprintf(\"YES\");\n\t\treturn 0;\n\t}\n\tprintf(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tint k1 , k2 , k3;\n\tscanf(\"%d%d%d\" , &k1 , &k2 , &k3);\n\tif (k1 != 2 && k2 != 2 && k3 != 2){\n\t\tif (k1 == 3 && k2 == 3 && k3 == 3)\n\t\t\tprintf(\"YES\");\n\t\telse\n\t\t\tprintf(\"NO\");\n\t\treturn 0;\n\t}\n\tif ((k1 == 2 && k2 == 2) || (k1 == 2 && k3 == 2) || (k2 == 2 && k3 == 2))\n\t{\n\t\tprintf(\"YES\");\n\t\treturn 0;\n\t}\n\tif ((k2 == 4 && k3 == 4) || (k1 == 4 && k3 == 4) || (k2 == 4 && k1 == 4))\n\t{\n\t\tprintf(\"YES\");\n\t\treturn 0;\n\t}\n\tprintf(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint a,b,c;\n\nint main(int argc, char *argv[]) \n{\n\tscanf(\"%d%d%d\", &a, &b, &c);\n\tif (a==1 || b==1 || c==1)\n\tprintf(\"YES\");\n\t\n\telse if ((a==2 && b==2) || (a==2 && c==2) || (b==2 && c==2))\n\tprintf(\"YES\");\n\t\n\telse if (a==3 && b==3 && c==3)\n\tprintf(\"YES\");\n\t\n\telse printf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include \n#include\nint main()\n{\n int a,b,c;\n int d;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(a==1||b==1||c==1)\n {\n printf(\"YES\");\n \n }\n else if((a==2&&b==2)||(b==2&&c==2)||(c==2&&a==2))\n {\n printf(\"YES\");\n \n }\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \n#include\nint main()\n{\n int a,b,c;\n int d;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(a==1||b==1||c==1)\n {\n printf(\"YES\");\n \n }\n else if((a==2&&b==2)||(b==2&&c==2)||(c==2&&a==2))\n {\n printf(\"YES\");\n \n }\n else if((a==4&&b==4&&c==2)||(b==4&&c==4&&a==2)||(c==4&&a==4&&b==2))\n {\n printf(\"YES\");\n \n }\n else\n printf(\"NO\");\n return 0;\n}\n"}], "src_uid": "df48af9f5e68cb6efc1214f7138accf9"} {"nl": {"description": "Have you ever played Hanabi? If not, then you've got to try it out! This problem deals with a simplified version of the game.Overall, the game has 25 types of cards (5 distinct colors and 5 distinct values). Borya is holding n cards. The game is somewhat complicated by the fact that everybody sees Borya's cards except for Borya himself. Borya knows which cards he has but he knows nothing about the order they lie in. Note that Borya can have multiple identical cards (and for each of the 25 types of cards he knows exactly how many cards of this type he has).The aim of the other players is to achieve the state when Borya knows the color and number value of each of his cards. For that, other players can give him hints. The hints can be of two types: color hints and value hints. A color hint goes like that: a player names some color and points at all the cards of this color. Similarly goes the value hint. A player names some value and points at all the cards that contain the value.Determine what minimum number of hints the other players should make for Borya to be certain about each card's color and value.", "input_spec": "The first line contains integer n (1 ≤ n ≤ 100) — the number of Borya's cards. The next line contains the descriptions of n cards. The description of each card consists of exactly two characters. The first character shows the color (overall this position can contain five distinct letters — R, G, B, Y, W). The second character shows the card's value (a digit from 1 to 5). Borya doesn't know exact order of the cards they lie in.", "output_spec": "Print a single integer — the minimum number of hints that the other players should make.", "sample_inputs": ["2\nG3 G3", "4\nG4 R4 R3 B3", "5\nB1 Y1 W1 G1 R1"], "sample_outputs": ["0", "2", "4"], "notes": "NoteIn the first sample Borya already knows for each card that it is a green three.In the second sample we can show all fours and all red cards.In the third sample you need to make hints about any four colors."}, "positive_code": [{"source_code": "#include \n#include \n\n#define min(a, b) (((a) < (b)) ? (a) : (b))\n\nconst int color[] = {['R'] = 0, ['G'] = 1, ['B'] = 2, ['Y'] = 3, ['W'] = 4};\nint combiA[4], combiB[4], table[5][5], min = 10;\n\nint compare(const void *a, const void *b) {\n return *(int *)a - *(int *)b;\n}\n\nvoid hoge(int maxA, int maxB) {\n int i, j;\n int flag[5][5] = {0}, ary[25], size;\n\n for (i = 0; i < maxA; i++)\n for (j = 0; j < 5; j++)\n flag[combiA[i]][j] |= 1 << combiA[i];\n\n for (j = 0; j < maxB; j++)\n for (i = 0; i < 5; i++)\n flag[i][combiB[j]] |= 1 << combiB[j] + 5;\n\n size = 0;\n for (i = 0; i < 5; i++)\n for (j = 0; j < 5; j++)\n if (table[i][j])\n ary[size++] = flag[i][j];\n\n qsort(ary, size, sizeof(int), &compare);\n\n for (i = 1; i < size && ary[i] != ary[i - 1]; i++) ;\n if (i == size)\n min = min(min, maxA + maxB);\n}\n\nvoid makeCombiB(int d, int maxA, int maxB) {\n int i;\n\n if (d == maxB) {\n hoge(maxA, maxB);\n return;\n }\n\n for (i = d == 0 ? 0 : combiB[d - 1] + 1; i < 5; i++) {\n combiB[d] = i;\n makeCombiB(d + 1, maxA, maxB);\n }\n}\n\nvoid makeCombiA(int d, int maxA) {\n int i;\n\n if (d == maxA) {\n for (i = 0; i < 5; i++)\n makeCombiB(0, maxA, i);\n return;\n }\n\n for (i = d == 0 ? 0 : combiA[d - 1] + 1; i < 5; i++) {\n combiA[d] = i;\n makeCombiA(d + 1, maxA);\n }\n}\n\nint main(void) {\n int i;\n int n;\n\n scanf(\"%d\", &n);\n for (i = 0; i < n; i++) {\n char ch1, ch2;\n\n scanf(\" %c%c\", &ch1, &ch2);\n\n table[color[ch1]][ch2 - '1'] = 1;\n }\n\n for (i = 0; i < 5; i++)\n makeCombiA(0, i);\n\n printf(\"%d\\n\", min);\n\n return 0;\n}\n"}, {"source_code": "#include\nchar s[11] = \"12345RGBYW\";\nint as(char c) {\n int i;\n for (i = 0; i < 10; i++)\n if (c == s[i])\n return i;\n}\nint main() {\n char c[3];\n int i, j, n, m, a[5] [10], b[10], d[11], k, r, min;\n while (scanf(\"%d\", &n) != EOF) {\n for (i = 0; i < 5; i++)\n for (j = 5; j < 10; j++)\n a[i][j] = 0;\n\n getchar();\n for (i = 0; i < n; i++) {\n scanf(\"%s\", c);\n a[as(c[1])][as(c[0])] = 1;\n }\n min = 10;\n for (i = 0; i < 1024; i++) {\n for (j = 0; j < 11; j++)\n d[j] = 0;\n m = 0;\n for (j = 0; j < 10; j++)\n if (b[j] = i >> j & 1)\n m++;\n for (k = 0; k < 5; k++)\n for (j = 5; j < 10; j++)\n if (a[k][j]) {\n if (!b[k])\n d[j]++;\n if (!b[j])\n d[k]++;\n if(!b[k]&&!b[j])d[10]++;\n }\n r = 1;\n for (j = 0; j < 11; j++)\n if (d[j] > 1) {\n r = 0;\n break;\n }\n if (r)\n min = min < m ? min : m;\n }\n printf(\"%d\\n\", min);\n }\n return 0;\n}\n"}, {"source_code": "#include\nchar s[11] = \"RBYWG12345\";\nint as(char c)\n{\n\tint i;\n\tfor (i = 0; i < 10; i++)\n\t\tif (s[i] == c)\n\t\t\treturn i;\n}\n\nint main()\n{\n\tint n, a[5][10], i, j, t,b[10], k, r, d[11] , m , min = 10;\n\tchar c,u;\n\tscanf(\"%d\", &n);\n\tfor (i = 0; i < 5; i++)\n\t\tfor (j = 5; j < 10; j++)\n\t\t\ta[i][j] = 0;\n\tfor (i = 0; i < n; i++)\n\t{getchar();\n\t\tscanf(\"%c%c\", &c,&u);\n\t\ta[as(c)][as(u)] = 1;\n\t}\n\tfor (i = 0; i < 1024; i++)\n\t{\n\t\t\tfor(j=0;j<11;j++)d[j]=0;\n\t\tm=0;\n\t\tt=i;\n\t\tfor (j = 0; j < 10; j++)\n\t\t{b[j] = t% 2 ;\n\t\t\tif (b[j] == 1)\n\t\t\t\tm++;\n\t\t\tt/= 2;\n\t\t}\n\t\tfor (k = 0; k < 5; k++)\n\t\t\tfor (j = 5; j < 10; j++)\n\t\t\t{\n\t\t\t\tif (a[k][j])\n\t\t\t\t{\n\t\t\t\t\tif (!b[k])\n\t\t\t\t\t\td[j]++;\n\t\t\t\t\tif (!b[j])\n\t\t\t\t\t\td[k]++;\n\t\t\t\t\tif (!b[k] && !b[j])\n\t\t\t\t\t\td[10]++;\n\t\t\t\t}\n\t\t\t}\n\t\tr = 1;\n\t\tfor (j = 0; j < 11; j++)\n\t\t\tif (d[j] > 1)\n\t\t\t{\n\t\t\t\tr = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\tif (r)\n\t\t\tmin = min < m ? min : m;\n\t}\n\tprintf(\"%d\\n\", min);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint flag[5][5];\nint flag2[5][5];\nint mark[10];\n\nint\ndfs(int depth){\n int i,j,count,index;\n if(depth ==0){\n for(i=0;i<5;i++){\n for(j=0;j<5;j++){\n flag2[i][j] = flag[i][j];\n }\n }\n \n for(i=0;i<5;i++){\n for(j=0;j<5;j++){\n if(mark[i] && mark[j+5]){\n flag2[i][j]=0;\n }\n }\n }\n for(i=0 ;i<10 ;i++){\n if(! mark[i] )\n continue;\n if ( i < 5){\n count=0;\n index=0;\n for(j=0;j<5;j++){\n if(flag2[i][j]){\n count ++;\n index = j;\n }\n }\n if( count >1 ){\n return 0;\n }\n flag2[i][index]=0;\n }\n else {\n count=0;\n index =0;\n for(j=0;j<5;j++){\n if(flag2[j][i-5]){\n count ++;\n index =j;\n }\n }\n if( count >1 ){\n return 0;\n }\n flag2[index][i-5]=0;\n }\n }\n count =0 ;\n for(i=0;i<5;i++){\n for(j=0;j<5;j++){\n if(flag2[i][j]){\n count++;\n }\n }\n }\n if(count ==1)\n return 1;\n else\n return 0;\n }\n for(i=0;i<10;i++){\n if(mark[i])\n continue;\n mark[i] = 1;\n if(!dfs(depth-1))\n mark[i] =0;\n else\n return 1;\n }\n return 0;\n}\n\nint\nmain(int argc,\n char *argv[]){\n int n;\n scanf(\"%d\",&n) ;\n char card[10];\n char color[5] ={'R','G','B','Y','W'};\n int i,j;\n memset(flag,0,sizeof(flag));\n for(i=0;i\nint surity[1050][200][2],set_bit[15],no[1050][15][15],unhinted[200],aiv[1050];\nint func(int n,int *a,int bit)\n{\n int i;\n for(i=0;i1)return 0;}\nint no=unhinted[0];\nfor(i=0;i\n#include \n\n#define N\t100\n#define A\t(1 << 10)\n\nint count(int n) {\n\treturn n == 0 ? 0 : count(n & n - 1) + 1;\n}\n\nint main() {\n\tstatic int aa[N];\n\tstatic char used[A];\n\tint n, i, k, l, a, b, c, ans;\n\n\tscanf(\"%d\", &n);\n\tfor (i = 0; i < n; i++) {\n\t\tstatic char s[2];\n\t\tchar c, d;\n\n\t\tscanf(\"%s\", s);\n\t\tc = s[0];\n\t\td = s[1];\n\t\ta = 0;\n\t\tif (c == 'R')\n\t\t\ta |= 1 << 0;\n\t\telse if (c == 'G')\n\t\t\ta |= 1 << 1;\n\t\telse if (c == 'B')\n\t\t\ta |= 1 << 2;\n\t\telse if (c == 'Y')\n\t\t\ta |= 1 << 3;\n\t\telse\n\t\t\ta |= 1 << 4;\n\t\ta |= 1 << 5 + d - '1';\n\t\taa[i] = a;\n\t}\n\tfor (i = 0; i < n; i++)\n\t\tused[aa[i]] = 1;\n\tk = 0;\n\tfor (a = 0; a < A; a++)\n\t\tif (used[a])\n\t\t\tk++;\n\tans = 10;\n\tfor (b = 0; b < A; b++) {\n\t\tc = count(b);\n\t\tif (ans > c) {\n\t\t\tmemset(used, 0, sizeof used);\n\t\t\tfor (i = 0; i < n; i++) {\n\t\t\t\ta = aa[i] & b;\n\t\t\t\tused[a] = 1;\n\t\t\t}\n\t\t\tl = 0;\n\t\t\tfor (a = 0; a < A; a++)\n\t\t\t\tif (used[a])\n\t\t\t\t\tl++;\n\t\t\tif (k == l)\n\t\t\t\tans = c;\n\t\t}\n\t}\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint number(char c, int i)\n{ // номер карты [0, 24]\n switch (c)\n {\n case 'R': return i - 1;\n case 'G': return 5 + i - 1;\n case 'B': return 10 + i - 1;\n case 'Y': return 15 + i - 1;\n case 'W': return 20 + i - 1;\n }\n return 25;\n}\n\nint color(int number)\n{\n return number / 5;\n}\n\nint value(int number)\n{\n return number % 5;\n}\n\nint check_color(int number, int mask)\n{\n return (1 << (5 + color(number))) & mask;\n}\n\nint check_value(int number, int mask)\n{\n return (1 << value(number)) & mask;\n}\n\nint count(int mask)\n{\n int res = 0;\n while (mask)\n {\n res += mask % 2;\n mask /= 2;\n }\n return res;\n}\n\nint main()\n{\n int cards[25] = {0};\n int n, ans, i, j, mask, flag;\n char s[3];\n char c;\n scanf(\"%d\", &n);\n for(i = 0; i < n; i++)\n {\n scanf(\"%s\", s);\n c = s[0];\n j = s[1] - '0';\n cards[number(c, j)] = 1;\n }\n\n ans = 10;\n for(mask = 0; mask < 1023; mask++)\n {\n flag = 1;\n for (i = 0; i < 25; i++)\n if (cards[i])\n {\n for (j = i+1; j < 25; j++)\n if (cards[j])\n {\n if (color(i) != color(j) &&\n (check_color(i, mask) ||\n check_color(j, mask)))\n continue;\n if (value(i) != value(j) &&\n (check_value(i, mask) ||\n check_value(j, mask)))\n continue;\n\n flag = 0;\n break;\n }\n if (!flag)\n break;\n }\n if (flag && count(mask) < ans)\n ans = count(mask);\n }\n\n printf(\"%d\\n\", ans);\n}\n"}, {"source_code": "#include \n\nint B[5][5];\nint H[10];\nint A=10, N;\n\nint find(int at, int t)\n{\n\tif(at < 10)\n\t{\n\t\tH[at] = 0;\n\t\tfind(at+1, t);\n\t\tH[at] = 1;\n\t\tfind(at+1, t+1);\n\t\tH[at] = 0;\n\t\treturn 0;\n\t}\n\t\n\tint i, j, k;\n\tint z=0;\n\tint b[5][5];\n\t\n\tfor(i=0; i<5; i++)\n\t{\n\t\tfor(j=0; j<5; j++)\n\t\t{\n\t\t\tb[i][j] = 0;\n\t\t\tif(B[i][j] == 0)\n\t\t\t\tcontinue;\n\t\t\tif(H[i] == 1 && H[j+5] == 1)\n\t\t\t\tcontinue;\n\t\t\tb[i][j] = B[i][j];\n\t\t}\n\t}\n\t\n\tfor(i=0; i<5; i++)\n\t{\n\t\tfor(j=0; j<5; j++)\n\t\t{\n\t\t\tif(b[i][j] == 0)\n\t\t\t\tcontinue;\n\t\t\tif(H[i] == 1)\n\t\t\t{\n\t\t\t\tfor(k=0; k<5; k++)\n\t\t\t\t{\n\t\t\t\t\tif(b[i][k] > 0 && k != j)\n\t\t\t\t\t\tz++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(H[j+5] == 1)\n\t\t\t{\n\t\t\t\tfor(k=0; k<5; k++)\n\t\t\t\t{\n\t\t\t\t\tif(b[k][j] > 0 && k != i)\n\t\t\t\t\t\tz++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(H[i] == 0 && H[j+5] == 0)\n\t\t\t\tz++;\n\t\t}\n\t}\n\t\n\tif(z <= 1)\n\t{\n\t\tif(t < A)\n\t\t\tA = t;\n\t}\n\t\n\treturn 0;\n}\n\nint main()\n{\n\tint i, j;\n\tchar c, d;\n\t//FILE *input, *output;\n\t\n\t//input = fopen(\"hanabi.in\", \"r\");\n\t\n\tscanf(\"%d\\n\", &N);\n\t\n\tfor(i=0; i\n#include \n\nint main(){\n int n;\n scanf(\"%d\\n\", &n);\n int cards[100];\n char s[310];\n gets(s);\n int i;\n for(i=0; i> k) & 1;\n if(cards[i] / 5 == k && a) res[i] += 1 << k;\n }\n for(k=0; k<5; k++){\n int a = (v >> (k + 5)) & 1;\n if(cards[i] % 5 == k && a) res[i] += 1 << (k + 5);\n }\n }\n int j;\n int test = 0;\n for(i=0; i 0){\n count += v1 & 1;\n v1 >>= 1;\n }\n if(count < min){\n min = count;\n }\n }\n }\n printf(\"%d\\n\", min);\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint get(char c){\n\tif(c == 'R') return 5;\n\tif(c == 'G') return 6;\n\tif(c == 'B') return 7;\n\tif(c == 'Y') return 8;\n\tif(c == 'W') return 9;\n\treturn (c - '1');\n}\nint b(int n)\n{\n int y = 0;\n while (n){\n if(n & 1) y++;\n n >>= 1;\n }\n return y;\n}\nint main(){\n\tint i;\n\tint j;\n\tint n;\n\tchar s[3];\n\tint hint[26] = {0};\n\tint has[5][5] = {0};\n\tint cnt = 0;\n\tint mask = 0;\n\tint ok = 1;\n\tint ans = 10;\n\tscanf(\"%d\", &n);\n\tfor(i = 0; i < n; i++){\n\t\tscanf(\"%s\", s);\n\t\tif(!has[get(s[0]) - 5][get(s[1])]){\n\t\t\thas[get(s[0]) - 5][get(s[1])] = 1;\n\t\t\thint[cnt] |= 1 << get(s[0]);\n\t\t\thint[cnt] |= 1 << get(s[1]);\n\t\t\tcnt++;\t\t\t\t\t\n\t\t}\n\t}\n\tfor(mask = 0; mask < (1 << 10); mask++){\n\t\tok = 1;\n\t\tfor(i = 0; i < cnt && ok; i++){\n\t\t\tfor(j = i + 1; j < cnt && ok; j++){\n\t\t\t\tif(mask & (hint[i] ^ hint[j]))\n\t\t\t\t\tcontinue;\n\t\t\t\tok = 0;\t \n\t\t\t} \n\t\t}\n\t\tif(ok){\n\t\t\tif(ans > b(mask)) ans = b(mask);\t\n\t\t} \t\t\t\t\t\n\t}\n\tprintf(\"%d\", ans); \t\nreturn 0;\n}"}, {"source_code": "#include \n#include \nint get(char c){\n\tif(c == 'R') return 5;\n\tif(c == 'G') return 6;\n\tif(c == 'B') return 7;\n\tif(c == 'Y') return 8;\n\tif(c == 'W') return 9;\n\treturn (c - '1');\n}\nint b(int n)\n{\n int y = 0;\n while (n){\n if(n & 1) y++;\n n >>= 1;\n }\n return y;\n}\nint main(){\n\tint i;\n\tint j;\n\tint n;\n\tchar s[3];\n\tint hint[26] = {0};\n\tint has[5][5] = {0};\n\tint cnt = 0;\n\tint mask = 0;\n\tint ok = 1;\n\tint ans = 10;\n\tscanf(\"%d\", &n);\n\tfor(i = 0; i < n; i++){\n\t\tscanf(\"%s\", s);\n\t\tif(!has[get(s[0]) - 5][get(s[1])]){\n\t\t\thas[get(s[0]) - 5][get(s[1])] = 1;\n\t\t\thint[cnt] |= 1 << get(s[0]);\n\t\t\thint[cnt] |= 1 << get(s[1]);\n\t\t\tcnt++;\t\t\t\t\t\n\t\t}\n\t}\n\tfor(mask = 0; mask < (1 << 10); mask++){\n\t\tok = 1;\n\t\tfor(i = 0; i < cnt && ok; i++){\n\t\t\tfor(j = i + 1; j < cnt && ok; j++){\n\t\t\t\tif(mask & (hint[i] ^ hint[j]))\n\t\t\t\t\tcontinue;\n\t\t\t\tok = 0;\t \n\t\t\t} \n\t\t}\n\t\tif(ok){\n\t\t\tif(ans > b(mask)) ans = b(mask);\n\t\n\t\t}\n\t\t\t\t\t\n\t}\n\tprintf(\"%d\", ans);\n\t\nreturn 0;\n}"}, {"source_code": "#include \n#include \nint get(char c){\n\tif(c == 'R') return 5;\n\tif(c == 'G') return 6;\n\tif(c == 'B') return 7;\n\tif(c == 'Y') return 8;\n\tif(c == 'W') return 9;\n\treturn (c - '1');\n}\nint b(int n)\n{\n int y = 0;\n while (n){\n if(n & 1) y++;\n n >>= 1;\n }\n return y;\n}\nint main(){\n\tint i;\n\tint j;\n\tint n;\n\tchar s[3];\n\tint hint[26] = {0};\n\tint has[5][5] = {0};\n\tint cnt = 0;\n\tint mask = 0;\n\tint ok = 1;\n\tint ans = 10;\n\tscanf(\"%d\", &n);\n\tfor(i = 0; i < n; i++){\n\t\tscanf(\"%s\", s);\n\t\tif(!has[get(s[0]) - 5][get(s[1])]){\n\t\t\thas[get(s[0]) - 5][get(s[1])] = 1;\n\t\t\thint[cnt] |= 1 << get(s[0]);\n\t\t\thint[cnt] |= 1 << get(s[1]);\n\t\t\tcnt++;\t\t\t\t\t\n\t\t}\n\t}\n\tfor(mask = 0; mask < (1 << 10); mask++){\n\t\tok = 1;\n\t\tfor(i = 0; i < cnt - 1 && ok; i++){\n\t\t\tfor(j = i + 1; j < cnt && ok; j++){\n\t\t\t\tif(mask & (hint[i] ^ hint[j]))\n\t\t\t\t\tcontinue;\n\t\t\t\tok = 0;\t \n\t\t\t} \n\t\t}\n\t\tif(ok){\n\t\t\tif(ans > b(mask)) ans = b(mask);\t\n\t\t} \t\t\t\t\t\n\t}\n\tprintf(\"%d\", ans); \t\nreturn 0;\n}"}], "negative_code": [{"source_code": "#include \n#include \n\n#define min(a, b) (((a) < (b)) ? (a) : (b))\n\nconst int color[] = {['R'] = 0, ['G'] = 1, ['B'] = 2, ['Y'] = 3, ['W'] = 4};\nint combiA[4], combiB[4], table[5][5], min = 10;\n\nint compare(const void *a, const void *b) {\n return *(int *)a - *(int *)b;\n}\n\nvoid hoge(int maxA, int maxB) {\n int i, j;\n int flag[5][5] = {0}, ary[25], size;\n\n for (i = 0; i < maxA; i++)\n for (j = 0; j < 5; j++)\n flag[combiA[i]][j] |= 1 << combiA[i];\n\n for (j = 0; j < maxB; j++)\n for (i = 0; i < 5; i++)\n flag[i][combiB[j]] |= 1 << combiB[j] + 5;\n\n size = 0;\n for (i = 0; i < 5; i++)\n for (j = 0; j < 5; j++)\n if (table[i][j])\n ary[size++] = flag[i][j];\n\n qsort(ary, size, sizeof(int), &compare);\n\n for (i = 1; i < size && ary[i] != ary[i - 1]; i++) ;\n if (i == size)\n min = min(min, maxA + maxB);\n}\n\nvoid makeCombiB(int d, int maxA, int maxB) {\n int i;\n\n if (d == maxB) {\n hoge(maxA, maxB);\n return;\n }\n\n for (i = d == 0 ? 0 : combiB[d - 1] + 1; i < 5; i++) {\n combiB[d] = i;\n makeCombiB(d + 1, maxA, maxB);\n }\n}\n\nvoid makeCombiA(int d, int maxA) {\n int i;\n\n if (d == maxA) {\n for (i = 0; i < 4; i++)\n makeCombiB(0, maxA, i);\n return;\n }\n\n for (i = d == 0 ? 0 : combiA[d - 1] + 1; i < 5; i++) {\n combiA[d] = i;\n makeCombiA(d + 1, maxA);\n }\n}\n\nint main(void) {\n int i;\n int n;\n\n scanf(\"%d\", &n);\n for (i = 0; i < n; i++) {\n char ch1, ch2;\n\n scanf(\" %c%c\", &ch1, &ch2);\n\n table[color[ch1]][ch2 - '1'] = 1;\n }\n\n for (i = 0; i < 5; i++)\n makeCombiA(0, i);\n\n printf(\"%d\\n\", min);\n\n return 0;\n}\n"}, {"source_code": "#include\nchar s[11] = \"12345RGBYW\";\nint as(char c) {\n int i;\n for (i = 0; i < 10; i++)\n if (c == s[i])\n return i;\n}\nint main() {\n char c[3];\n int i, j, n, m, a[5] [10], b[10], d[10], k, r, min;\n while (scanf(\"%d\", &n) != EOF) {\n for (i = 0; i < 5; i++)\n for (j = 5; j < 10; j++)\n a[i][j] = 0;\n\n getchar();\n for (i = 0; i < n; i++) {\n scanf(\"%s\", c);\n a[as(c[1])][as(c[0])] = 1;\n }\n min = 10;\n for (i = 0; i < 1024; i++) {\n for (j = 0; j < 10; j++)\n d[j] = 0;\n m = 0;\n for (j = 0; j < 10; j++)\n if (b[j] = i >> j & 1)\n m++;\n for (k = 0; k < 5; k++)\n for (j = 5; j < 10; j++)\n if (a[k][j]) {\n if (!b[k])\n d[j]++;\n if (!b[j])\n d[k]++;\n }\n r = 1;\n for (j = 0; j < 10; j++)\n if (d[j] > 1) {\n r = 0;\n break;\n }\n if (r)\n min = min < m ? min : m;\n }\n printf(\"%d\\n\", min);\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint flag[5][5];\nint flag2[5][5];\nint mark[10];\n\nint\ndfs(int depth){\n int i,j,count,index;\n if(depth ==0){\n for(i=0;i<5;i++){\n for(j=0;j<5;j++){\n flag2[i][j] = flag[i][j];\n }\n }\n \n for(i=0;i<5;i++){\n for(j=0;j<5;j++){\n if(mark[i] && mark[j+5]){\n flag2[i][j]=0;\n }\n }\n }\n for(i=0 ;i<10 ;i++){\n if(! mark[i] )\n continue;\n if ( i < 5){\n count=0;\n index=0;\n for(j=0;j<5;j++){\n if(flag2[i][j]){\n count ++;\n index = j;\n }\n }\n if( count >1 ){\n return 0;\n }\n flag2[i][index]=0;\n }\n else {\n count=0;\n index =0;\n for(j=0;j<5;j++){\n if(flag2[j][i-5]){\n count ++;\n index =j;\n }\n }\n if( count >1 ){\n return 0;\n }\n flag2[index][i-5]=0;\n }\n }\n count =0 ;\n for(i=0;i<5;i++){\n for(j=0;j<5;j++){\n if(flag2[i][j]){\n count++;\n }\n }\n }\n if(count ==1)\n return 1;\n else\n return 0;\n }\n for(i=0;i<10;i++){\n if(mark[i])\n continue;\n mark[i] = 1;\n if(!dfs(depth-1))\n mark[i] =0;\n else\n return 1;\n }\n return 0;\n}\n\nint\nmain(int argc,\n char *argv[]){\n int n;\n scanf(\"%d\",&n) ;\n char card[10];\n char color[5] ={'R','G','B','Y','W'};\n int i,j;\n memset(flag,0,sizeof(flag));\n for(i=0;i\n#include \n\nint flag[5][5];\nint flag2[5][5];\nint mark[10];\nint ans ;\n\nint\ndfs(int depth){\n int i,j,count,index;\n if(depth ==0){\n for(i=0;i<5;i++){\n for(j=0;j<5;j++){\n flag2[i][j] = flag[i][j];\n }\n }\n \n for(i=0;i<5;i++){\n for(j=0;j<5;j++){\n if(mark[i] && mark[j+5]){\n flag2[i][j]=0;\n }\n }\n }\n for(i=0 ;i<10 ;i++){\n if(! mark[i] )\n continue;\n if ( i < 5){\n count=0;\n index=0;\n for(j=0;j<5;j++){\n if(flag2[i][j]){\n count ++;\n index = j;\n }\n }\n if( count >1 ){\n return 0;\n }\n flag2[i][index]=0;\n }\n else {\n count=0;\n index =0;\n for(j=0;j<5;j++){\n if(flag2[j][i-5]){\n count ++;\n index =j;\n }\n }\n if( count >1 ){\n return 0;\n }\n flag2[index][i-5]=0;\n }\n }\n count =0 ;\n for(i=0;i<5;i++){\n for(j=0;j<5;j++){\n if(flag2[i][j]){\n count++;\n }\n }\n }\n if(count ==1)\n return 1;\n else\n return 0;\n }\n for(i=0;i<10;i++){\n if(mark[i])\n continue;\n mark[i] = 1;\n if(!dfs(depth-1))\n mark[i] =0;\n else\n return 1;\n }\n return 0;\n}\n\nint\nmain(int argc,\n char *argv[]){\n int n;\n scanf(\"%d\",&n);\n char card[2];\n char color[5] ={'R','G','B','Y','W'};\n int i,j;\n memset(flag,0,sizeof(flag));\n for(i=0;i\n#include \n\nint flag[5][5];\nint flag2[5][5];\nint mark[10];\nint ans ;\n\nint\ndfs(int depth){\n int i,j,count,index;\n if(depth ==0){\n for(i=0;i<5;i++){\n for(j=0;j<5;j++){\n flag2[i][j] = flag[i][j];\n }\n }\n \n for(i=0;i<5;i++){\n for(j=0;j<5;j++){\n if(mark[i] && mark[j+5]){\n flag2[i][j]=0;\n }\n }\n }\n for(i=0 ;i<10 ;i++){\n if(! mark[i] )\n continue;\n if ( i < 5){\n count=0;\n index=0;\n for(j=0;j<5;j++){\n if(flag2[i][j]){\n count ++;\n index = j;\n }\n }\n if( count >1 ){\n return 0;\n }\n flag2[i][index]=0;\n }\n else {\n count=0;\n index =0;\n for(j=0;j<5;j++){\n if(flag2[j][i-5]){\n count ++;\n index =j;\n }\n }\n if( count >1 ){\n return 0;\n }\n flag2[index][i-5]=0;\n }\n }\n count =0 ;\n for(i=0;i<5;i++){\n for(j=0;j<5;j++){\n if(flag2[i][j]){\n count++;\n }\n }\n }\n if(count ==1)\n return 1;\n else\n return 0;\n }\n for(i=0;i<10;i++){\n if(mark[i])\n continue;\n mark[i] = 1;\n if(!dfs(depth-1))\n mark[i] =0;\n else\n return 1;\n }\n return 0;\n}\n\nint\nmain(int argc,\n char *argv[]){\n int n;\n scanf(\"%d\",&n) ;\n char card[2];\n char color[5] ={'R','G','B','Y','W'};\n int i,j;\n memset(flag,0,sizeof(flag));\n for(i=0;i\n#include \n\nint flag[5][5];\nint flag2[5][5];\nint mark[10];\nint ans ;\n\nint\ndfs(int depth){\n int i,j,count,index;\n if(depth ==0){\n\n for(i=0;i<5;i++){\n for(j=0;j<5;j++){\n flag2[i][j] = flag[i][j];\n }\n }\n \n for(i=0;i<5;i++){\n for(j=0;j<5;j++){\n if(mark[i] && mark[j+5]){\n flag2[i][j]=0;\n }\n }\n }\n for(i=0 ;i<10 ;i++){\n if(! mark[i] )\n continue;\n if ( i < 5){\n count=0;\n index=0;\n for(j=0;j<5;j++){\n if(flag2[i][j]){\n count ++;\n index = j;\n }\n }\n if( count >1 ){\n return 0;\n }\n flag2[i][index]=0;\n }\n else {\n count=0;\n index =0;\n for(j=0;j<5;j++){\n if(flag2[j][i-5]){\n count ++;\n index =j;\n }\n }\n if( count >1 ){\n return 0;\n }\n flag2[index][i-5]=0;\n }\n }\n count =0 ;\n for(i=0;i<5;i++){\n for(j=0;j<5;j++){\n if(flag2[i][j]){\n count++;\n }\n }\n }\n if(count ==1)\n return 1;\n else\n return 0;\n }\n for(i=0;i<10;i++){\n if(mark[i])\n continue;\n mark[i] = 1;\n if(!dfs(depth-1))\n mark[i] =0;\n else\n return 1;\n }\n return 0;\n}\n\nint\nmain(int argc,\n char *argv[]){\n int n;\n scanf(\"%d\",&n);\n char card[2];\n char color[5] ={'R','G','B','Y','W'};\n int i,j;\n memset(flag,0,sizeof(flag));\n for(i=0;i\n#include \n\nint flag[5][5];\nint flag2[5][5];\nint mark[10];\nint ans ;\n\nint\ndfs(int depth){\n int i,j,count,index;\n if(depth ==0){\n for(i=0;i<5;i++){\n for(j=0;j<5;j++){\n flag2[i][j] = flag[i][j];\n }\n }\n \n for(i=0;i<5;i++){\n for(j=0;j<5;j++){\n if(mark[i] && mark[j+5]){\n flag2[i][j]=0;\n }\n }\n }\n for(i=0 ;i<10 ;i++){\n if(! mark[i] )\n continue;\n if ( i < 5){\n count=0;\n index=0;\n for(j=0;j<5;j++){\n if(flag2[i][j]){\n count ++;\n index = j;\n }\n }\n if( count >1 ){\n return 0;\n }\n flag2[i][index]=0;\n }\n else {\n count=0;\n index =0;\n for(j=0;j<5;j++){\n if(flag2[j][i-5]){\n count ++;\n index =j;\n }\n }\n if( count >1 ){\n return 0;\n }\n flag2[index][i-5]=0;\n }\n }\n count =0 ;\n for(i=0;i<5;i++){\n for(j=0;j<5;j++){\n if(flag2[i][j]){\n count++;\n }\n }\n }\n if(count ==1)\n return 1;\n else\n return 0;\n }\n for(i=0;i<10;i++){\n if(mark[i])\n continue;\n mark[i] = 1;\n if(!dfs(depth-1))\n mark[i] =0;\n else\n return 1;\n }\n return 0;\n}\n\nint\nmain(int argc,\n char *argv[]){\n int n;\n scanf(\"%d\",&n) ;\n char card[2];\n char color[5] ={'R','G','B','Y','W'};\n int i,j;\n memset(flag,0,sizeof(flag));\n for(i=0;i\nint surity[1050][200][2],set_bit[15],no[1050][15],unhinted[200],aiv[1050];\nint func(int n,int *a,int bit)\n{\n int i;\n for(i=0;i1)return 0;}\nint no=unhinted[0];\nfor(i=0;i\nint surity[1050][200][2],set_bit[15],no[1050][15],unhinted[200],aiv[1050];\nint func(int n,int *a,int bit)\n{\n int i;\n for(i=0;i1)return 0;}\nint no=unhinted[0];\nfor(i=0;i\nint surity[1050][200][2],set_bit[15],no[1050][15],unhinted[200],aiv[1050];\nint func(int n,int *a,int bit)\n{\n int i;\n for(i=0;i1)return 0;}\nint no=unhinted[0];\nfor(i=0;i\n#include \n\nint main(){\n int n;\n scanf(\"%d\\n\", &n);\n int cards[100];\n char s[310];\n gets(s);\n int i;\n for(i=0; i> k) & 1;\n if(cards[i] / 5 == k && a) res[i] += 1 << k;\n }\n for(k=0; k<5; k++){\n int a = (v >> (k + 5)) & 1;\n if(cards[i] % 5 == k && a) res[i] += 1 << (k + 5);\n }\n }\n int j;\n int test = 0;\n for(i=0; i 0){\n count += v1 & 1;\n v1 >>= 1;\n }\n if(count < min){\n min = count;\n }\n }\n }\n printf(\"%d\\n\", min);\n return 0;\n}\n"}], "src_uid": "3b12863997b377b47bae43566ec1a63b"} {"nl": {"description": "On one of the planets of Solar system, in Atmosphere University, many students are fans of bingo game.It is well known that one month on this planet consists of $$$n^2$$$ days, so calendars, represented as square matrix $$$n$$$ by $$$n$$$ are extremely popular.Weather conditions are even more unusual. Due to the unique composition of the atmosphere, when interacting with sunlight, every day sky takes one of three colors: blue, green or red.To play the bingo, you need to observe the sky for one month — after each day, its cell is painted with the color of the sky in that day, that is, blue, green or red.At the end of the month, students examine the calendar. If at least one row or column contains only cells of one color, that month is called lucky.Let's call two colorings of calendar different, if at least one cell has different colors in them. It is easy to see that there are $$$3^{n \\cdot n}$$$ different colorings. How much of them are lucky? Since this number can be quite large, print it modulo $$$998244353$$$.", "input_spec": "The first and only line of input contains a single integer $$$n$$$ ($$$1 \\le n \\le 1000\\,000$$$) — the number of rows and columns in the calendar.", "output_spec": "Print one number — number of lucky colorings of the calendar modulo $$$998244353$$$", "sample_inputs": ["1", "2", "3"], "sample_outputs": ["3", "63", "9933"], "notes": "NoteIn the first sample any coloring is lucky, since the only column contains cells of only one color.In the second sample, there are a lot of lucky colorings, in particular, the following colorings are lucky: While these colorings are not lucky: "}, "positive_code": [{"source_code": "#include \n#define N 1000005\nconst int P=998244353;\nlong long inv[N];\nlong long ex(long long b, int i) {\n\tlong long p=1;\n\tfor(; i; i>>=1, b=b*b%P) if(i&1) p=p*b%P;\n\treturn p;\n}\nint main() {\n\tint n, i, ans, binom, power;\n\tscanf(\"%d\", &n);\n\tinv[1]=1;\n\tfor(i=2; i<=n; ++i) inv[i]=inv[P%i]*(P-P/i)%P;\n\tpower=ex(3,n);\n\tans=(ex((power+P-1)%P,n)*3-ex((power+P-3)%P,n)*2%P+P-ex(power,n)+P)%P;\n\tbinom=n&1?1:-1;\n\tpower=1;\n\tfor(i=0; i\n#include\n#include\n#include\n#include\n#include\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/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 nHr(int a,int b){return nCr(a+b-1,b);}\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;}\nint dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;}\nint dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;}\nint sankaku(int x){return ((1+x)*x)/2;}\nvoid swap(int *a,int *b){int c;c=(*a);(*a)=(*b);(*b)=c;}\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/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 llnHr(long long a,long long b){return llnCr(a+b-1,b);}\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;}\nlong long lldsum(long long x){long long r=0;while(x){r+=(x%10);x/=10;}return r;}\nlong long lldsumb(long long x,long long b){long long r=0;while(x){r+=(x%b);x/=b;}return r;}\nlong long llsankaku(long long x){return ((1+x)*x)/2;}\nvoid llswap(long long *a,long long *b){long long c;c=(*a);(*a)=(*b);(*b)=c;}\ndouble dbmax(double a,double b){if(a>b){return a;}return b;}\ndouble dbmin(double a,double b){if(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);}\nint chsortfncsj(const void *a,const void *b){if(*(char *)a>*(char *)b){return 1;}if(*(char *)a==*(char *)b){return 0;}return -1;}\nint chsortfnckj(const void *a,const void *b){if(*(char *)a<*(char *)b){return 1;}if(*(char *)a==*(char *)b){return 0;}return -1;}\n\nvoid shuffledget(int x[],int n){\n int i,b[524288],p,c;\n for(i=0;i=1;i--){\n p=rand()%i;\n c=b[i-1];b[i-1]=b[p];b[p]=c;\n }\n for(i=0;i=1;i--){\n p=rand()%(i+1);\n swap(&a[p],&a[i]);\n }\n}\n\ntypedef struct{\nint val;\nint node;\n}sd;\n\nint sdsortfnc(const void *a,const void *b){\nif(((sd*)a)->val < ((sd*)b)->val){return -1;}\nif(((sd*)a)->val > ((sd*)b)->val){return 1;}\nreturn 0;\n}\n\nvoid coordinate_comp(int a[],int n){\n int i,c=0;\n sd dat[524288];\n for(i=0;i\n#include\ntypedef unsigned u;\nu V[512][512],Q[32][512][512],T[32];\nu X[512*512*8],Y[512*512*8],*A,*B,*C;\nu dx[8]={-1,-1, 0,+1,+1,+1, 0,-1};\nu dy[8]={ 0,+1,+1,+1, 0,-1,-1,-1};\nint main()\n{\n\tu t,z,n,i=-1,j,k,p,q=1;\n\tfor(scanf(\"%u\",&n);++i>12)&511;\n\t\t\tj=(A[p]>> 3)&511;\n\t\t\tk=A[p]&7;\n\t\t\tfor(t=T[z];t--;)V[i+=dx[k]][j+=dy[k]]=1;\n\t\t\tt=(k+1)&7;tjan:;\n\t\t\tif(!((Q[z][i][j]>>t)&1))\n\t\t\t{\n\t\t\t\tQ[z][i][j]|=1u<\n#define QLEN 6400007\n\nint n,ans,D[35];\n\nint q[6400010][5],head,tail;\nshort vis[410][410][8][2];\nshort MAP[410][410];\n\nshort dir[8][2] = {-1,0,-1,1,0,1,1,1,1,0,1,-1,0,-1,-1,-1};\n\nvoid add(int i,int j,int k,int d,int now)\n{\n if(vis[i][j][k][d&1]) return;\n vis[i][j][k][d&1] = 1; MAP[i][j] = 1;\n q[tail][0] = i; q[tail][1] = j; q[tail][2] = k; q[tail][3] = d; q[tail++][4] = now;\n if(tail > QLEN) tail = 1;\n}\n\nvoid bfs(int SI,int SJ)\n{\n int i,j,k,d,now;\n int ii,jj,kk;\n head = 1; tail = 1;\n add(SI,SJ,0,D[1],1);\n \n while(head != tail)\n {\n i = q[head][0]; j = q[head][1]; k = q[head][2];\n d = q[head][3]; now = q[head++][4];\n vis[i][j][k][d&1] = 0;\n if(d-1 != D[now+1])\n {\n ii = i+dir[k][0]; jj = j+dir[k][1];\n add(ii,jj,k,d-1,now);\n }\n else\n {\n if(now == n) continue;\n kk = (k+7)%8; ii = i+dir[kk][0]; jj = j+dir[kk][1];\n add(ii,jj,kk,d-1,now+1);\n kk = (k+1)%8; ii = i+dir[kk][0]; jj = j+dir[kk][1];\n add(ii,jj,kk,d-1,now+1);\n }\n if(head > QLEN) head = 1;\n }\n}\n\nint main()\n{\n int i,j;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++) scanf(\"%d\",&D[i]);\n for(i=n-1;i;i--) D[i] += D[i+1];\n \n bfs(200,200);\n for(i=1;i<=400;i++) for(j=1;j<=400;j++) if(MAP[i][j]) ans++;\n printf(\"%d\",ans);\n return 0;\n}"}, {"source_code": "#include \n\n#define N\t30\n#define M\t301\n#define D\t8\n\nint n, m;\nint xx[] = { 0, 1, 1, 1, 0, -1, -1, -1 };\nint yy[] = { 1, 1, 0, -1, -1, -1, 0, 1 };\nint tt[N], aa[M][M][N][D], bb[M][M];\n\nvoid dfs(int x, int y, int i, int d) {\n\tint dx, dy, s, t;\n\n\tif (i == n)\n\t\treturn;\n\tif (aa[x][y][i][d])\n\t\treturn;\n\taa[x][y][i][d] = 1;\n\tdx = xx[d];\n\tdy = yy[d];\n\tt = tt[i];\n\tfor (s = 1; s <= t; s++)\n\t\tbb[x + dx * s][y + dy * s] = 1;\n\tx += dx * t;\n\ty += dy * t;\n\tdfs(x, y, i + 1, (d + 1) % 8);\n\tdfs(x, y, i + 1, (d + 7) % 8);\n}\n\nint main() {\n\tint s, i, j, cnt;\n\n\tscanf(\"%d\", &n);\n\ts = 0;\n\tfor (i = 0; i < n; i++) {\n\t\tscanf(\"%d\", &tt[i]);\n\t\ts += tt[i];\n\t}\n\tm = s + s + 1;\n\tdfs(s, s, 0, 0);\n\tcnt = 0;\n\tfor (i = 0; i < m; i++)\n\t\tfor (j = 0; j < m; j++)\n\t\t\tif (bb[i][j])\n\t\t\t\tcnt++;\n\tprintf(\"%d\\n\", cnt);\n\treturn 0;\n}\n"}, {"source_code": "#include\n\n\n\nstatic char sky[400][400];\nint n, mas[30], k, q1, q2;\n\nstruct line{\n\tint type;\n\tint x;\n\tint y;\n};\n\nint max(int a, int b){\n\treturn a > b ? a : b;\n}\n\nint min(int a, int b){\n\treturn a < b ? a : b;\n}\n\nvoid draw(int i, int a, int x, int y){\n\tk = mas[i - 1];\n\twhile (k){\n\t\tk--;\n\t\tsky[y][x] = 1;\n\t\tif (k){\n\t\t\tif (a == 1){\n\t\t\t\ty++;\n\t\t\t} else if (a == 2){\n\t\t\t\tx++;\n\t\t\t\ty++;\n\t\t\t} else if (a == 3){\n\t\t\t\tx++;\n\t\t\t} else if (a == 4){\n\t\t\t\tx++;\n\t\t\t\ty--;\n\t\t\t} else if (a == 5){\n\t\t\t\ty--;\n\t\t\t} else if (a == 6){\n\t\t\t\tx--;\n\t\t\t\ty--;\n\t\t\t} else if (a == 7){\n\t\t\t\tx--;\n\t\t\t} else if (a == 8){\n\t\t\t\tx--;\n\t\t\t\ty++;\n\t\t\t}\n\t\t}\n\t}\n\tif (i < n){\n\t\tif (a == 1){\n\t\t\tdraw(i + 1, 8, x - 1, y + 1);\n\t\t\tdraw(i + 1, 2, x + 1, y + 1);\n\t\t} else if (a == 2){\n\t\t\tdraw(i + 1, 1, x, y + 1);\n\t\t\tdraw(i + 1, 3, x + 1, y);\n\t\t} else if (a == 3){\n\t\t\tdraw(i + 1, 2, x + 1, y + 1);\n\t\t\tdraw(i + 1, 4, x + 1, y - 1);\n\t\t} else if (a == 4){\n\t\t\tdraw(i + 1, 3, x + 1, y);\n\t\t\tdraw(i + 1, 5, x, y - 1);\n\t\t} else if (a == 5){\n\t\t\tdraw(i + 1, 4, x + 1, y - 1);\n\t\t\tdraw(i + 1, 6, x - 1, y - 1);\n\t\t} else if (a == 6){\n\t\t\tdraw(i + 1, 5, x, y - 1);\n\t\t\tdraw(i + 1, 7, x - 1, y);\n\t\t} else if (a == 7){\n\t\t\tdraw(i + 1, 6, x - 1, y - 1);\n\t\t\tdraw(i + 1, 8, x - 1, y + 1);\n\t\t} else if (a == 8){\n\t\t\tdraw(i + 1, 7, x - 1, y);\n\t\t\tdraw(i + 1, 1, x, y + 1);\n\t\t}\n\t}\n}\n\nvoid mirror(int a, int x, int y){\n\tif (a == 1 || a == 5){\n\t\tq1 = min(400, 2 * x + 1);\n\t\tfor (int i = max(0, 2 * x - 399); i < q1; i++){\n\t\t\tfor (int j = 0; j < 400; j++){\n\t\t\t\tsky[j][i] |= sky[j][2 * x - i];\n\t\t\t}\n\t\t}\n\t} else if (a == 3 || a == 7){\n\t\tq1 = min(400, 2 * y + 1);\n\t\tfor (int i = max(0, 2 * y - 399); i < q1; i++){\n\t\t\tfor (int j = 0; j < 400; j++){\n\t\t\t\tsky[i][j] |= sky[2 * y - i][j];\n\t\t\t}\n\t\t}\n\t} else if (a == 2 || a == 6){\n\t\tq1 = min(400, 400 + y - x);\n\t\tq2 = min(400, 400 - y + x);\n\t\tfor (int i = max(0, y - x); i < q1; i++){\n\t\t\tfor (int j = max(0, x - y); j < q2; j++){\n\t\t\t\tsky[i][j] |= sky[y - x + j][x - y + i];\n\t\t\t}\n\t\t}\n\t} else {\n\t\tq1 = min(400, x + y + 1);\n\t\tfor (int i = max(0, y + x - 399); i < q1; i++){\n\t\t\tfor (int j = max(0, x + y - 399); j < q1; j++){\n\t\t\t\tsky[i][j] |= sky[x + y - j][x + y - i];\n\t\t\t}\n\t\t}\n\t}\n}\n\nvoid draw2(int i, int a, int x2, int y2){\n\tif (i == n){\n\t\treturn;\n\t}\n\tint x = x2, y = y2;\n\tk = mas[i];\n\twhile (k){\n\t\tk--;\n\t\t//sky[y][x] = 1;\n\t\tif (k){\n\t\t\tif (a == 1){\n\t\t\t\ty++;\n\t\t\t} else if (a == 2){\n\t\t\t\tx++;\n\t\t\t\ty++;\n\t\t\t} else if (a == 3){\n\t\t\t\tx++;\n\t\t\t} else if (a == 4){\n\t\t\t\tx++;\n\t\t\t\ty--;\n\t\t\t} else if (a == 5){\n\t\t\t\ty--;\n\t\t\t} else if (a == 6){\n\t\t\t\tx--;\n\t\t\t\ty--;\n\t\t\t} else if (a == 7){\n\t\t\t\tx--;\n\t\t\t} else if (a == 8){\n\t\t\t\tx--;\n\t\t\t\ty++;\n\t\t\t}\n\t\t}\n\t}\n\n\t\tif (a == 1){\n\t\t\tdraw2(i + 1, 2, x + 1, y + 1);\n\t\t} else if (a == 2){\n\t\t\tdraw2(i + 1, 3, x + 1, y);\n\t\t} else if (a == 3){\n\t\t\tdraw2(i + 1, 4, x + 1, y - 1);\n\t\t} else if (a == 4){\n\t\t\tdraw2(i + 1, 5, x, y - 1);\n\t\t} else if (a == 5){\n\t\t\tdraw2(i + 1, 6, x - 1, y - 1);\n\t\t} else if (a == 6){\n\t\t\tdraw2(i + 1, 7, x - 1, y);\n\t\t} else if (a == 7){\n\t\t\tdraw2(i + 1, 8, x - 1, y + 1);\n\t\t} else if (a == 8){\n\t\t\tdraw2(i + 1, 1, x, y + 1);\n\t\t}\n\n\tmirror(a, x, y);\n\n\tx = x2, y = y2;\n\tk = mas[i];\n\twhile (k){\n\t\tk--;\n\t\tsky[y][x] = 1;\n\t\tif (k){\n\t\t\tif (a == 1){\n\t\t\t\ty++;\n\t\t\t} else if (a == 2){\n\t\t\t\tx++;\n\t\t\t\ty++;\n\t\t\t} else if (a == 3){\n\t\t\t\tx++;\n\t\t\t} else if (a == 4){\n\t\t\t\tx++;\n\t\t\t\ty--;\n\t\t\t} else if (a == 5){\n\t\t\t\ty--;\n\t\t\t} else if (a == 6){\n\t\t\t\tx--;\n\t\t\t\ty--;\n\t\t\t} else if (a == 7){\n\t\t\t\tx--;\n\t\t\t} else if (a == 8){\n\t\t\t\tx--;\n\t\t\t\ty++;\n\t\t\t}\n\t\t}\n\t}\n}\n\nint main(void)\n{\n\tfor (int i = 0; i < 400; i++){\n\t\tfor (int j = 0; j < 400; j++){\n\t\t\tsky[i][j] = 0;\n\t\t}\n\t}\n\tscanf(\"%d\", &n);\n\tfor (int i = 0; i < n; i++){\n\t\tscanf(\"%d\", &mas[i]);\n\t}\n\tdraw2(0, 1, 200, 200);\n\tint rez = 0;\n\tfor (int i = 0; i < 400; i++){\n\t\tfor (int j = 0; j < 400; j++){\n\t\t\t//printf(\"%d\", sky[i][j]);\n\t\t\trez += sky[i][j];\n\t\t}\n\t\t//printf(\"\\n\");\n\t}\n\tprintf(\"%d\", rez);\n}\n"}, {"source_code": "#include\n#include\nvoid blast(int, int, int, int);\n\nint grid[301][301], dp[301][301][30][8] = {0}, n, t[31];\n\nint main(){\n int i, j, k;\n scanf(\"%d\", &n);\n for(i=0;i<301;i++){\n for(j=0;j<301;j++){\n grid[i][j] = 0;\n }\n }\n\n for(i=0;i= n)\n return;\n if(dp[150 + x][150 + y][level][dir])\n return;\n dp[150 + x][150 + y][level][dir] = 1;\n for(i = 0;i < t[level];i++){\n if(dir == 0 || dir == 1 || dir == 7){\n x--;\n }\n if(dir == 1 || dir == 2 || dir == 3){\n y--;\n }\n if(dir == 3 || dir == 4 || dir == 5){\n x++;\n }\n if(dir == 5 || dir == 6 || dir == 7){\n y++;\n }\n grid[150 + x][150 + y] = 1;\n }\n blast(x, y, level + 1, (dir + 1)%8);\n blast(x, y, level + 1, (dir + 7)%8);\n}\n"}, {"source_code": "#include \n#include \n\nvoid pathFinder(int arr[],int hash[500][500],int last[500][500][32][8],int index,int n,int *count,int flag,int x,int y)\n{\n\tif(index == n)\n\t{\n\t\treturn;\n\t}\n\t\n\tint i,j,k;\n\t\n\tint temp1,temp2;\n\t\n\tlast[x][y][index][flag] = 1;\n\t\n\tfor(i=0;i\n#include\n#include\n#include\n#include\n#include\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/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 nHr(int a,int b){return nCr(a+b-1,b);}\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;}\nint dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;}\nint dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;}\nint sankaku(int x){return ((1+x)*x)/2;}\nvoid swap(int *a,int *b){int c;c=(*a);(*a)=(*b);(*b)=c;}\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/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 llnHr(long long a,long long b){return llnCr(a+b-1,b);}\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;}\nlong long lldsum(long long x){long long r=0;while(x){r+=(x%10);x/=10;}return r;}\nlong long lldsumb(long long x,long long b){long long r=0;while(x){r+=(x%b);x/=b;}return r;}\nlong long llsankaku(long long x){return ((1+x)*x)/2;}\nvoid llswap(long long *a,long long *b){long long c;c=(*a);(*a)=(*b);(*b)=c;}\ndouble dbmax(double a,double b){if(a>b){return a;}return b;}\ndouble dbmin(double a,double b){if(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);}\nint chsortfncsj(const void *a,const void *b){if(*(char *)a>*(char *)b){return 1;}if(*(char *)a==*(char *)b){return 0;}return -1;}\nint chsortfnckj(const void *a,const void *b){if(*(char *)a<*(char *)b){return 1;}if(*(char *)a==*(char *)b){return 0;}return -1;}\n\nvoid shuffledget(int x[],int n){\n int i,b[524288],p,c;\n for(i=0;i=1;i--){\n p=rand()%i;\n c=b[i-1];b[i-1]=b[p];b[p]=c;\n }\n for(i=0;i=1;i--){\n p=rand()%(i+1);\n swap(&a[p],&a[i]);\n }\n}\n\ntypedef struct{\nint val;\nint node;\n}sd;\n\nint sdsortfnc(const void *a,const void *b){\nif(((sd*)a)->val < ((sd*)b)->val){return -1;}\nif(((sd*)a)->val > ((sd*)b)->val){return 1;}\nreturn 0;\n}\n\nvoid coordinate_comp(int a[],int n){\n int i,c=0;\n sd dat[524288];\n for(i=0;i=l){return;}\n fl[x][y][key]=l;\n for(i=0;i\n#define QLEN 6400007\n\nint n,ans,D[35];\n\nint q[6400010][5],head,tail;\nshort vis[410][410][8][2];\nshort MAP[410][410];\n\nshort dir[8][2] = {-1,0,-1,1,0,1,1,1,1,0,1,-1,0,-1,-1,-1};\n\nvoid add(int i,int j,int k,int d,int now)\n{\n if(vis[i][j][k][d&1]) return;\n vis[i][j][k][d&1] = 1; MAP[i][j] = 1;\n q[tail][0] = i; q[tail][1] = j; q[tail][2] = k; q[tail][3] = d; q[tail++][4] = now;\n if(tail > QLEN) tail = 1;\n}\n\nvoid bfs(int SI,int SJ)\n{\n int i,j,k,d,now;\n int ii,jj,kk;\n head = 1; tail = 1;\n add(SI,SJ,0,D[1],1);\n \n while(head != tail)\n {\n i = q[head][0]; j = q[head][1]; k = q[head][2];\n d = q[head][3] - 1; now = q[head++][4];\n vis[i][j][k][d&1] = 0;\n if(d != D[now+1])\n {\n ii = i+dir[k][0]; jj = j+dir[k][1];\n add(ii,jj,k,d,now);\n }\n else\n {\n if(now == n) continue;\n kk = (k+7)%8; ii = i+dir[kk][0]; jj = j+dir[kk][1];\n add(ii,jj,kk,D[now+1],now+1);\n kk = (k+1)%8; ii = i+dir[kk][0]; jj = j+dir[kk][1];\n add(ii,jj,kk,D[now+1],now+1);\n }\n if(head > QLEN) head = 1;\n }\n}\n\nint main()\n{\n int i,j;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++) scanf(\"%d\",&D[i]);\n for(i=n-1;i;i--) D[i] += D[i+1];\n \n bfs(200,200);\n for(i=1;i<=400;i++) for(j=1;j<=400;j++) if(MAP[i][j]) ans++;\n printf(\"%d\",ans);\n return 0;\n}"}, {"source_code": "#include \n#define QLEN 6400007\n\nint n,ans,D[35];\n\nint q[6400010][5],head,tail;\nshort vis[410][410][8][2];\nshort MAP[410][410];\n\nshort dir[8][2] = {-1,0,-1,1,0,1,1,1,1,0,1,-1,0,-1,-1,-1};\n\nvoid add(int i,int j,int k,int d,int now)\n{\n if(vis[i][j][k][d&1]) return;\n vis[i][j][k][d&1] = 1; MAP[i][j] = 1;\n q[tail][0] = i; q[tail][1] = j; q[tail][2] = k; q[tail][3] = d; q[tail++][4] = now;\n if(tail > QLEN) tail = 1;\n}\n\nvoid bfs(int SI,int SJ)\n{\n int i,j,k,d,now;\n int ii,jj,kk;\n head = 1; tail = 1;\n add(SI,SJ,0,D[1],1);\n \n while(head != tail)\n {\n i = q[head][0]; j = q[head][1]; k = q[head][2];\n d = q[head][3] - 1; now = q[head++][4];\n if(d != D[now+1])\n {\n ii = i+dir[k][0]; jj = j+dir[k][1];\n add(ii,jj,k,d,now);\n }\n else\n {\n if(now == n) continue;\n kk = (k+7)%8; ii = i+dir[kk][0]; jj = j+dir[kk][1];\n add(ii,jj,kk,D[now+1],now+1);\n kk = (k+1)%8; ii = i+dir[kk][0]; jj = j+dir[kk][1];\n add(ii,jj,kk,D[now+1],now+1);\n }\n if(head > QLEN) head = 1;\n }\n}\n\nint main()\n{\n int i,j;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++) scanf(\"%d\",&D[i]);\n for(i=n-1;i;i--) D[i] += D[i+1];\n \n bfs(200,200);\n for(i=1;i<=400;i++) for(j=1;j<=400;j++) if(MAP[i][j]) ans++;\n printf(\"%d\",ans);\n return 0;\n}"}, {"source_code": "#include \n\nint n,ans,D[35];\n\nint q[6400010][5],head,tail;\nshort vis[410][410][8][5];\nshort MAP[410][410];\n\nshort dir[8][2] = {-1,0,-1,1,0,1,1,1,1,0,1,-1,0,-1,-1,-1};\n\nvoid add(int i,int j,int k,int d,int now)\n{\n if(vis[i][j][k][d]) return;\n vis[i][j][k][d] = 1; MAP[i][j] = 1;\n q[tail][0] = i; q[tail][1] = j; q[tail][2] = k; q[tail][3] = d; q[tail++][4] = now;\n}\n\nvoid bfs(int SI,int SJ)\n{\n int i,j,k,d,now;\n int ii,jj,kk,dd;\n head = 1; tail = 1;\n add(SI,SJ,0,D[1]-1,1);\n \n while(head != tail)\n {\n i = q[head][0]; j = q[head][1]; k = q[head][2];\n d = q[head][3] - 1; now = q[head++][4];\n if(d >= 0)\n {\n ii = i+dir[k][0]; jj = j+dir[k][1]; dd = d;\n add(ii,jj,k,dd,now);\n }\n else\n {\n if(now == n) continue;\n dd = D[now+1] - 1;\n kk = (k+7)%8; ii = i+dir[kk][0]; jj = j+dir[kk][1];\n add(ii,jj,kk,dd,now+1);\n kk = (k+1)%8; ii = i+dir[kk][0]; jj = j+dir[kk][1];\n add(ii,jj,kk,dd,now+1);\n }\n }\n}\n\nint main()\n{\n int i,j;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++) scanf(\"%d\",&D[i]);\n \n bfs(200,200);\n for(i=1;i<=400;i++) for(j=1;j<=400;j++) if(MAP[i][j]) ans++;\n printf(\"%d\",ans);\n return 0;\n}"}, {"source_code": "#include\n\n\n\nstatic char sky[400][400];\nint n, mas[30], k, q1, q2;\n\nstruct line{\n\tint type;\n\tint x;\n\tint y;\n};\n\nint max(int a, int b){\n\treturn a > b ? a : b;\n}\n\nint min(int a, int b){\n\treturn a < b ? a : b;\n}\n\nvoid draw(int i, int a, int x, int y){\n\tk = mas[i - 1];\n\twhile (k){\n\t\tk--;\n\t\tsky[y][x] = 1;\n\t\tif (k){\n\t\t\tif (a == 1){\n\t\t\t\ty++;\n\t\t\t} else if (a == 2){\n\t\t\t\tx++;\n\t\t\t\ty++;\n\t\t\t} else if (a == 3){\n\t\t\t\tx++;\n\t\t\t} else if (a == 4){\n\t\t\t\tx++;\n\t\t\t\ty--;\n\t\t\t} else if (a == 5){\n\t\t\t\ty--;\n\t\t\t} else if (a == 6){\n\t\t\t\tx--;\n\t\t\t\ty--;\n\t\t\t} else if (a == 7){\n\t\t\t\tx--;\n\t\t\t} else if (a == 8){\n\t\t\t\tx--;\n\t\t\t\ty++;\n\t\t\t}\n\t\t}\n\t}\n\tif (i < n){\n\t\tif (a == 1){\n\t\t\tdraw(i + 1, 8, x - 1, y + 1);\n\t\t\tdraw(i + 1, 2, x + 1, y + 1);\n\t\t} else if (a == 2){\n\t\t\tdraw(i + 1, 1, x, y + 1);\n\t\t\tdraw(i + 1, 3, x + 1, y);\n\t\t} else if (a == 3){\n\t\t\tdraw(i + 1, 2, x + 1, y + 1);\n\t\t\tdraw(i + 1, 4, x + 1, y - 1);\n\t\t} else if (a == 4){\n\t\t\tdraw(i + 1, 3, x + 1, y);\n\t\t\tdraw(i + 1, 5, x, y - 1);\n\t\t} else if (a == 5){\n\t\t\tdraw(i + 1, 4, x + 1, y - 1);\n\t\t\tdraw(i + 1, 6, x - 1, y - 1);\n\t\t} else if (a == 6){\n\t\t\tdraw(i + 1, 5, x, y - 1);\n\t\t\tdraw(i + 1, 7, x - 1, y);\n\t\t} else if (a == 7){\n\t\t\tdraw(i + 1, 6, x - 1, y - 1);\n\t\t\tdraw(i + 1, 8, x - 1, y + 1);\n\t\t} else if (a == 8){\n\t\t\tdraw(i + 1, 7, x - 1, y);\n\t\t\tdraw(i + 1, 1, x, y + 1);\n\t\t}\n\t}\n}\n\nvoid mirror(int a, int x, int y){\n\tif (a == 1 || a == 5){\n\t\tq1 = min(400, 2 * x + 1);\n\t\tfor (int i = max(0, 2 * x - 399); i < q1; i++){\n\t\t\tfor (int j = 0; j < 400; j++){\n\t\t\t\tsky[j][i] |= sky[j][2 * x - i];\n\t\t\t}\n\t\t}\n\t} else if (a == 3 || a == 7){\n\t\tq1 = min(400, 2 * y + 1);\n\t\tfor (int i = max(0, 2 * y - 399); i < q1; i++){\n\t\t\tfor (int j = 0; j < 400; j++){\n\t\t\t\tsky[i][j] |= sky[2 * y - i][j];\n\t\t\t}\n\t\t}\n\t} else if (a == 2 || a == 6){\n\t\tq1 = min(400, 400 + y - x);\n\t\tq2 = min(400, 400 - y + x);\n\t\tfor (int i = max(0, y - x); i < q1; i++){\n\t\t\tfor (int j = max(0, x - y); j < q2; j++){\n\t\t\t\tsky[i][j] |= sky[y - x + j][x - y + i];\n\t\t\t}\n\t\t}\n\t} else {\n\t\tq1 = min(400, x + y + 1);\n\t\tfor (int i = max(0, y + x - 399); i < q1; i++){\n\t\t\tfor (int j = max(0, x + y - 399); j < q1; j++){\n\t\t\t\tsky[i][j] |= sky[x + y - j][x + y - i];\n\t\t\t}\n\t\t}\n\t}\n}\n\nvoid draw2(int i, int a, int x2, int y2){\n\tif (i == n){\n\t\treturn;\n\t}\n\tint x = x2, y = y2;\n\tk = mas[i];\n\twhile (k){\n\t\tk--;\n\t\t//sky[y][x] = 1;\n\t\tif (k){\n\t\t\tif (a == 1){\n\t\t\t\ty++;\n\t\t\t} else if (a == 2){\n\t\t\t\tx++;\n\t\t\t\ty++;\n\t\t\t} else if (a == 3){\n\t\t\t\tx++;\n\t\t\t} else if (a == 4){\n\t\t\t\tx++;\n\t\t\t\ty--;\n\t\t\t} else if (a == 5){\n\t\t\t\ty--;\n\t\t\t} else if (a == 6){\n\t\t\t\tx--;\n\t\t\t\ty--;\n\t\t\t} else if (a == 7){\n\t\t\t\tx--;\n\t\t\t} else if (a == 8){\n\t\t\t\tx--;\n\t\t\t\ty++;\n\t\t\t}\n\t\t}\n\t}\n\n\t\tif (a == 1){\n\t\t\tdraw2(i + 1, 2, x + 1, y + 1);\n\t\t} else if (a == 2){\n\t\t\tdraw2(i + 1, 3, x + 1, y);\n\t\t} else if (a == 3){\n\t\t\tdraw2(i + 1, 4, x + 1, y - 1);\n\t\t} else if (a == 4){\n\t\t\tdraw2(i + 1, 5, x, y - 1);\n\t\t} else if (a == 5){\n\t\t\tdraw2(i + 1, 6, x - 1, y - 1);\n\t\t} else if (a == 6){\n\t\t\tdraw2(i + 1, 7, x - 1, y);\n\t\t} else if (a == 7){\n\t\t\tdraw2(i + 1, 8, x - 1, y + 1);\n\t\t} else if (a == 8){\n\t\t\tdraw2(i + 1, 1, x, y + 1);\n\t\t}\n\n\tmirror(a, x, y);\n\n\tx = x2, y = y2;\n\tk = mas[i];\n\twhile (k){\n\t\tk--;\n\t\tsky[y][x] = 1;\n\t\tif (k){\n\t\t\tif (a == 1){\n\t\t\t\ty++;\n\t\t\t} else if (a == 2){\n\t\t\t\tx++;\n\t\t\t\ty++;\n\t\t\t} else if (a == 3){\n\t\t\t\tx++;\n\t\t\t} else if (a == 4){\n\t\t\t\tx++;\n\t\t\t\ty--;\n\t\t\t} else if (a == 5){\n\t\t\t\ty--;\n\t\t\t} else if (a == 6){\n\t\t\t\tx--;\n\t\t\t\ty--;\n\t\t\t} else if (a == 7){\n\t\t\t\tx--;\n\t\t\t} else if (a == 8){\n\t\t\t\tx--;\n\t\t\t\ty++;\n\t\t\t}\n\t\t}\n\t}\n}\n\nint main(void)\n{\n\tfor (int i = 0; i < 200; i++){\n\t\tfor (int j = 0; j < 200; j++){\n\t\t\tsky[i][j] = 0;\n\t\t}\n\t}\n\tscanf(\"%d\", &n);\n\tfor (int i = 0; i < n; i++){\n\t\tscanf(\"%d\", &mas[i]);\n\t}\n\tdraw2(0, 1, 100, 100);\n\tint rez = 0;\n\tfor (int i = 0; i < 200; i++){\n\t\tfor (int j = 0; j < 200; j++){\n\t\t\t//printf(\"%d\", sky[i][j]);\n\t\t\trez += sky[i][j];\n\t\t}\n\t\t//printf(\"\\n\");\n\t}\n\tprintf(\"%d\", rez);\n}\n"}, {"source_code": "#include\n#include\nvoid blast(int, int, int, int);\n\nint grid[301][301], dp[301][301][5][8] = {0}, n, t[31];\n\nint main(){\n int i, j, k;\n scanf(\"%d\", &n);\n for(i=0;i<301;i++){\n for(j=0;j<301;j++){\n grid[i][j] = 0;\n }\n }\n\n for(i=0;i= n)\n return;\n if(dp[150 + x][150 + y][level][dir])\n return;\n dp[150 + x][150 + y][level][dir] = 1;\n for(i = 0;i < t[level];i++){\n if(dir == 0 || dir == 1 || dir == 7){\n x--;\n }\n if(dir == 1 || dir == 2 || dir == 3){\n y--;\n }\n if(dir == 3 || dir == 4 || dir == 5){\n x++;\n }\n if(dir == 5 || dir == 6 || dir == 7){\n y++;\n }\n grid[150 + x][150 + y] = 1;\n }\n blast(x, y, level + 1, (dir + 1)%8);\n blast(x, y, level + 1, (dir + 7)%8);\n}\n"}, {"source_code": "#include \n#include \n\nvoid pathFinder(int arr[],int hash[1000][1000],int index,int n,int *count,int flag,int x,int y)\n{\n\tif(index == n)\n\t{\n\t\treturn;\n\t}\n\t\n\t//printf(\"x = %d y = %d\\n\",x,y);\n\t\n\tint i,j,k;\n\t\n\tint temp1,temp2;\n\t\n\tfor(i=0;i\n#include \n\nvoid pathFinder(int arr[],int hash[1000][1000],int index,int n,int *count,int flag,int x,int y)\n{\n\tif(index == n)\n\t{\n\t\treturn;\n\t}\n\t\n\t//printf(\"x = %d y = %d\\n\",x,y);\n\t\n\tint i,j,k;\n\t\n\tint temp1,temp2;\n\t\n\tfor(i=0;i\n#include \n\nvoid pathFinder(int arr[],int hash[1000][1000],int index,int n,int *count,int flag,int x,int y)\n{\n\tif(index == n)\n\t{\n\t\treturn;\n\t}\n\t\n\t//printf(\"x = %d y = %d\\n\",x,y);\n\t\n\tint i,j,k;\n\t\n\tint temp1,temp2;\n\t\n\tfor(i=0;i\n\nlong d[1101][1101]={0},sum[1101]={0},b[1101][1101]={0},num[1101]={0},next[1101]={0},rec[1101]={0},can[1101]={0};\nchar ttt[1101][1101],sss[1101][1101],str[1101][1101]={0},hash[1101][1101]={0},c[1101]={0},used[1101]={0};\nlong n,m,s,tot=1,ans=0,o=0;\n\nlong work(long now)\n{\n long i,j,k,p,a,cur=++o;\n char tmp;\n s=0;\n for (i=1;i<=n;i++)\n if (!used[i]&&b[i][now])\n can[++s]=i;\n next[now]=now;\n if (!hash[now][0])\n {\n hash[now][0]=1;\n sum[now]++;\n }\n if (!s)\n {\n for (p=now;!hash[p][0];p=next[p]);\n for (i=1;i<=m;i++)\n if (hash[p][i])\n rec[++ans]=i;\n for (i=next[p];i!=p;i=next[i])\n for (j=1;j<=m;j++)\n if (hash[i][j])\n rec[++ans]=j;\n }\n else\n {\n while (1)\n {\n p=0;\n for (i=1;i<=s;i++)\n if (!used[can[i]]&&(!p||c[can[i]]||!c[p]&&num[can[i]]>num[p]))\n p=can[i];\n if (next[now]!=now&&!c[p])\n break;\n used[p]=1;\n if (!c[p])\n {\n next[++tot]=now;\n next[now]=tot;\n tmp=(b[p][now]<=sum[now]/2)+'0';\n for (i=0;i<=m;i++)\n if (hash[now][i]&&str[p][i]==tmp)\n {\n for (a=1;a<=n;a++)\n if (str[a][i]=='1')\n {\n b[a][now]--;\n b[a][tot]++;\n }\n hash[now][i]=0;\n sum[now]--;\n hash[tot][i]=1;\n sum[tot]++;\n }\n for (i=1;i<=s;i++)\n c[can[i]]|=(b[can[i]][now]&&b[can[i]][tot]);\n }\n else\n {\n for (i=next[now];(b[p][i]||!b[p][next[i]])&&i!=now;i=next[i]);\n if (!b[p][i]&&b[p][next[i]])\n i=next[i];\n else\n {\n for (i=now;b[p][i]==sum[i];i=next[i]);\n if (b[p][next[i]]!=sum[next[i]])\n i=next[i];\n }\n j=i;\n while (b[p][next[j]]&&next[j]!=i)\n j=next[j];\n for (k=next[i];k!=j;k=next[k])\n if (b[p][k]!=sum[k])\n return 0;\n for (k=next[j];k!=i;k=next[k])\n if (b[p][k])\n return 0;\n if (b[p][i]!=sum[i])\n {\n if (b[p][i]<=sum[i]/2)\n { \n next[++tot]=next[i];\n next[i]=tot;\n }\n else\n {\n for(k=next[i];next[k]!=i;k=next[k]);\n next[++tot]=i;\n next[k]=tot;\n }\n tmp=(b[p][i]<=sum[i]/2)+'0';\n for (k=0;k<=m;k++)\n if (hash[i][k]&&str[p][k]==tmp)\n {\n for (a=1;a<=n;a++)\n if (str[a][k]=='1')\n {\n b[a][i]--;\n b[a][tot]++;\n }\n hash[i][k]=0;\n sum[i]--;\n hash[tot][k]=1;\n sum[tot]++;\n }\n for (k=1;k<=s;k++)\n c[can[k]]|=(b[can[k]][i]&&b[can[k]][tot]);\n }\n if (b[p][j]!=sum[j])\n {\n if (b[p][j]<=sum[j]/2)\n { \n for(k=next[j];next[k]!=j;k=next[k]);\n next[++tot]=j;\n next[k]=tot;\n }\n else\n {\n next[++tot]=next[j];\n next[j]=tot;\n }\n tmp=(b[p][j]<=sum[j]/2)+'0';\n for (k=0;k<=m;k++)\n if (hash[j][k]&&str[p][k]==tmp)\n {\n for (a=1;a<=n;a++)\n if (str[a][k]=='1')\n {\n b[a][j]--;\n b[a][tot]++;\n }\n hash[j][k]=0;\n sum[j]--;\n hash[tot][k]=1;\n sum[tot]++;\n }\n for (k=1;k<=s;k++)\n c[can[k]]|=(b[can[k]][j]&&b[can[k]][tot]);\n }\n }\n }\n for (p=now;!hash[p][0];p=next[p]);\n d[cur][++d[cur][0]]=p;\n for (i=next[p];i!=p;i=next[i])\n d[cur][++d[cur][0]]=i;\n for (i=1;i<=d[cur][0];i++)\n if (!work(d[cur][i]))\n return 0;\n }\n return 1;\n}\n\nint main()\n{\n long i,j;\n scanf(\"%ld\\n\",&n);\n m=n;\n for (i=1;i<=n;i++)\n {\n str[i][0]='0';\n gets(str[i]+1);\n strcpy(ttt[i]+1,str[i]+1);\n for (j=1;j<=m;j++)\n if (str[i][j]=='1')\n num[i]++;\n b[i][1]=num[i];\n }\n sum[1]=m;\n for (i=1;i<=m;i++)\n hash[1][i]=1;\n if (work(1))\n {\n puts(\"YES\");\n for (i=1;i<=m;i++)\n for (j=1;j<=n;j++)\n sss[j][i]=ttt[j][rec[i]];\n for (i=1;i<=n;i++)\n puts(sss[i]+1);\n }\n else\n puts(\"NO\");\n return 0;\n}"}, {"source_code": "#include \n\nlong d[1101][1101]={0},sum[1101]={0},b[1101][1101]={0},num[1101]={0},next[1101]={0},rec[1101]={0},can[1101]={0};\nchar ttt[1101][1101],sss[1101][1101],str[1101][1101]={0},hash[1101][1101]={0},c[1101]={0},used[1101]={0};\nlong n,m,s,tot=1,ans=0,o=0;\n\nlong work(long now)\n{\n long i,j,k,p,a,cur=++o;\n char tmp;\n s=0;\n for (i=1;i<=n;i++)\n if (!used[i]&&b[i][now])\n can[++s]=i;\n next[now]=now;\n if (!hash[now][0])\n {\n hash[now][0]=1;\n sum[now]++;\n }\n if (!s)\n {\n for (p=now;!hash[p][0];p=next[p]);\n for (i=1;i<=m;i++)\n if (hash[p][i])\n rec[++ans]=i;\n for (i=next[p];i!=p;i=next[i])\n for (j=1;j<=m;j++)\n if (hash[i][j])\n rec[++ans]=j;\n }\n else\n {\n while (1)\n {\n p=0;\n for (i=1;i<=s;i++)\n if (!used[can[i]]&&(!p||c[can[i]]||!c[p]&&num[can[i]]>num[p]))\n p=can[i];\n if (next[now]!=now&&!c[p])\n break;\n used[p]=1;\n if (!c[p])\n {\n next[++tot]=now;\n next[now]=tot;\n tmp=(b[p][now]<=sum[now]/2)+'0';\n for (i=0;i<=m;i++)\n if (hash[now][i]&&str[p][i]==tmp)\n {\n for (a=1;a<=n;a++)\n if (str[a][i]=='1')\n {\n b[a][now]--;\n b[a][tot]++;\n }\n hash[now][i]=0;\n sum[now]--;\n hash[tot][i]=1;\n sum[tot]++;\n }\n for (i=1;i<=s;i++)\n c[can[i]]|=(b[can[i]][now]&&b[can[i]][tot]);\n }\n else\n {\n for (i=next[now];(b[p][i]||!b[p][next[i]])&&i!=now;i=next[i]);\n if (!b[p][i]&&b[p][next[i]])\n i=next[i];\n else\n {\n for (i=now;b[p][i]==sum[i];i=next[i]);\n if (b[p][next[i]]!=sum[next[i]])\n i=next[i];\n }\n j=i;\n while (b[p][next[j]]&&next[j]!=i)\n j=next[j];\n for (k=next[i];k!=j;k=next[k])\n if (b[p][k]!=sum[k])\n return 0;\n for (k=next[j];k!=i;k=next[k])\n if (b[p][k])\n return 0;\n if (b[p][i]!=sum[i])\n {\n if (b[p][i]<=sum[i]/2)\n { \n next[++tot]=next[i];\n next[i]=tot;\n }\n else\n {\n for(k=next[i];next[k]!=i;k=next[k]);\n next[++tot]=i;\n next[k]=tot;\n }\n tmp=(b[p][i]<=sum[i]/2)+'0';\n for (k=0;k<=m;k++)\n if (hash[i][k]&&str[p][k]==tmp)\n {\n for (a=1;a<=n;a++)\n if (str[a][k]=='1')\n {\n b[a][i]--;\n b[a][tot]++;\n }\n hash[i][k]=0;\n sum[i]--;\n hash[tot][k]=1;\n sum[tot]++;\n }\n for (k=1;k<=s;k++)\n c[can[k]]|=(b[can[k]][i]&&b[can[k]][tot]);\n }\n if (b[p][j]!=sum[j])\n {\n if (b[p][j]<=sum[j]/2)\n { \n for(k=next[j];next[k]!=j;k=next[k]);\n next[++tot]=j;\n next[k]=tot;\n }\n else\n {\n next[++tot]=next[j];\n next[j]=tot;\n }\n tmp=(b[p][j]<=sum[j]/2)+'0';\n for (k=0;k<=m;k++)\n if (hash[j][k]&&str[p][k]==tmp)\n {\n for (a=1;a<=n;a++)\n if (str[a][k]=='1')\n {\n b[a][j]--;\n b[a][tot]++;\n }\n hash[j][k]=0;\n sum[j]--;\n hash[tot][k]=1;\n sum[tot]++;\n }\n for (k=1;k<=s;k++)\n c[can[k]]|=(b[can[k]][j]&&b[can[k]][tot]);\n }\n }\n }\n for (p=now;!hash[p][0];p=next[p]);\n d[cur][++d[cur][0]]=p;\n for (i=next[p];i!=p;i=next[i])\n d[cur][++d[cur][0]]=i;\n for (i=1;i<=d[cur][0];i++)\n if (!work(d[cur][i]))\n return 0;\n }\n return 1;\n}\n\nint main()\n{\n long i,j;\n scanf(\"%ld\\n\",&n);\n m=n;\n for (i=1;i<=n;i++)\n {\n str[i][0]='0';\n gets(str[i]+1);\n strcpy(ttt[i]+1,str[i]+1);\n for (j=1;j<=m;j++)\n if (str[i][j]=='1')\n num[i]++;\n b[i][1]=num[i];\n }\n sum[1]=m;\n for (i=1;i<=m;i++)\n hash[1][i]=1;\n if (work(1))\n {\n puts(\"YES\");\n for (i=1;i<=m;i++)\n for (j=1;j<=n;j++)\n sss[j][i]=ttt[j][rec[i]];\n for (i=1;i<=n;i++)\n puts(sss[i]+1);\n }\n else\n puts(\"NO\");\n return 0;\n}"}, {"source_code": "#include \n\nlong d[1101][1101]={0},sum[1101]={0},b[1101][1101]={0},num[1101]={0},next[1101]={0},rec[1101]={0},can[1101]={0};\nchar ttt[1101][1101],sss[1101][1101],str[1101][1101]={0},hash[1101][1101]={0},c[1101]={0},used[1101]={0};\nlong n,m,s,tot=1,ans=0,o=0;\n\nlong work(long now)\n{\n long i,j,k,p,a,cur=++o;\n char tmp;\n s=0;\n for (i=1;i<=n;i++)\n if (!used[i]&&b[i][now])\n can[++s]=i;\n next[now]=now;\n if (!hash[now][0])\n {\n hash[now][0]=1;\n sum[now]++;\n }\n if (!s)\n {\n for (p=now;!hash[p][0];p=next[p]);\n for (i=1;i<=m;i++)\n if (hash[p][i])\n rec[++ans]=i;\n for (i=next[p];i!=p;i=next[i])\n for (j=1;j<=m;j++)\n if (hash[i][j])\n rec[++ans]=j;\n }\n else\n {\n while (1)\n {\n p=0;\n for (i=1;i<=s;i++)\n if (!used[can[i]]&&(!p||c[can[i]]||!c[p]&&num[can[i]]>num[p]))\n p=can[i];\n if (next[now]!=now&&!c[p])\n break;\n used[p]=1;\n if (!c[p])\n {\n next[++tot]=now;\n next[now]=tot;\n tmp=(b[p][now]<=sum[now]/2)+'0';\n for (i=0;i<=m;i++)\n if (hash[now][i]&&str[p][i]==tmp)\n {\n for (a=1;a<=n;a++)\n if (str[a][i]=='1')\n {\n b[a][now]--;\n b[a][tot]++;\n }\n hash[now][i]=0;\n sum[now]--;\n hash[tot][i]=1;\n sum[tot]++;\n }\n for (i=1;i<=s;i++)\n c[can[i]]|=(b[can[i]][now]&&b[can[i]][tot]);\n }\n else\n {\n for (i=next[now];(b[p][i]||!b[p][next[i]])&&i!=now;i=next[i]);\n if (!b[p][i]&&b[p][next[i]])\n i=next[i];\n else\n {\n for (i=now;b[p][i]==sum[i];i=next[i]);\n if (b[p][next[i]]!=sum[next[i]])\n i=next[i];\n }\n j=i;\n while (b[p][next[j]]&&next[j]!=i)\n j=next[j];\n for (k=next[i];k!=j;k=next[k])\n if (b[p][k]!=sum[k])\n return 0;\n for (k=next[j];k!=i;k=next[k])\n if (b[p][k])\n return 0;\n if (b[p][i]!=sum[i])\n {\n if (b[p][i]<=sum[i]/2)\n { \n next[++tot]=next[i];\n next[i]=tot;\n }\n else\n {\n for(k=next[i];next[k]!=i;k=next[k]);\n next[++tot]=i;\n next[k]=tot;\n }\n tmp=(b[p][i]<=sum[i]/2)+'0';\n for (k=0;k<=m;k++)\n if (hash[i][k]&&str[p][k]==tmp)\n {\n for (a=1;a<=n;a++)\n if (str[a][k]=='1')\n {\n b[a][i]--;\n b[a][tot]++;\n }\n hash[i][k]=0;\n sum[i]--;\n hash[tot][k]=1;\n sum[tot]++;\n }\n for (k=1;k<=s;k++)\n c[can[k]]|=(b[can[k]][i]&&b[can[k]][tot]);\n }\n if (b[p][j]!=sum[j])\n {\n if (b[p][j]<=sum[j]/2)\n { \n for(k=next[j];next[k]!=j;k=next[k]);\n next[++tot]=j;\n next[k]=tot;\n }\n else\n {\n next[++tot]=next[j];\n next[j]=tot;\n }\n tmp=(b[p][j]<=sum[j]/2)+'0';\n for (k=0;k<=m;k++)\n if (hash[j][k]&&str[p][k]==tmp)\n {\n for (a=1;a<=n;a++)\n if (str[a][k]=='1')\n {\n b[a][j]--;\n b[a][tot]++;\n }\n hash[j][k]=0;\n sum[j]--;\n hash[tot][k]=1;\n sum[tot]++;\n }\n for (k=1;k<=s;k++)\n c[can[k]]|=(b[can[k]][j]&&b[can[k]][tot]);\n }\n }\n }\n for (p=now;!hash[p][0];p=next[p]);\n d[cur][++d[cur][0]]=p;\n for (i=next[p];i!=p;i=next[i])\n d[cur][++d[cur][0]]=i;\n for (i=1;i<=d[cur][0];i++)\n if (!work(d[cur][i]))\n return 0;\n }\n return 1;\n}\n\nint main()\n{\n long i,j;\n scanf(\"%ld\\n\",&n);\n m=n;\n for (i=1;i<=n;i++)\n {\n str[i][0]='0';\n gets(str[i]+1);\n strcpy(ttt[i]+1,str[i]+1);\n for (j=1;j<=m;j++)\n if (str[i][j]=='1')\n num[i]++;\n b[i][1]=num[i];\n }\n sum[1]=m;\n for (i=1;i<=m;i++)\n hash[1][i]=1;\n if (work(1))\n {\n puts(\"YES\");\n for (i=1;i<=m;i++)\n for (j=1;j<=n;j++)\n sss[j][i]=ttt[j][rec[i]];\n for (i=1;i<=n;i++)\n puts(sss[i]+1);\n }\n else\n puts(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \n\nlong d[1101][1101]={0},sum[1101]={0},b[1101][1101]={0},num[1101]={0},next[1101]={0},rec[1101]={0},can[1101]={0};\nchar ttt[1101][1101],sss[1101][1101],str[1101][1101]={0},hash[1101][1101]={0},c[1101]={0},used[1101]={0};\nlong n,m,s,tot=1,ans=0,o=0;\n\nlong work(long now)\n{\n long i,j,k,p,a,cur=++o;\n char tmp;\n s=0;\n for (i=1;i<=n;i++)\n if (!used[i]&&b[i][now])\n can[++s]=i;\n next[now]=now;\n if (!hash[now][0])\n {\n hash[now][0]=1;\n sum[now]++;\n }\n if (!s)\n {\n for (p=now;!hash[p][0];p=next[p]);\n for (i=1;i<=m;i++)\n if (hash[p][i])\n rec[++ans]=i;\n for (i=next[p];i!=p;i=next[i])\n for (j=1;j<=m;j++)\n if (hash[i][j])\n rec[++ans]=j;\n }\n else\n {\n while (1)\n {\n p=0;\n for (i=1;i<=s;i++)\n if (!used[can[i]]&&(!p||c[can[i]]||!c[p]&&num[can[i]]>num[p]))\n p=can[i];\n if (next[now]!=now&&!c[p])\n break;\n used[p]=1;\n if (!c[p])\n {\n next[++tot]=now;\n next[now]=tot;\n tmp=(b[p][now]<=sum[now]/2)+'0';\n for (i=0;i<=m;i++)\n if (hash[now][i]&&str[p][i]==tmp)\n {\n for (a=1;a<=n;a++)\n if (str[a][i]=='1')\n {\n b[a][now]--;\n b[a][tot]++;\n }\n hash[now][i]=0;\n sum[now]--;\n hash[tot][i]=1;\n sum[tot]++;\n }\n for (i=1;i<=s;i++)\n c[can[i]]|=(b[can[i]][now]&&b[can[i]][tot]);\n }\n else\n {\n for (i=next[now];(b[p][i]||!b[p][next[i]])&&i!=now;i=next[i]);\n if (!b[p][i]&&b[p][next[i]])\n i=next[i];\n else\n {\n for (i=now;b[p][i]==sum[i];i=next[i]);\n if (b[p][next[i]]!=sum[next[i]])\n i=next[i];\n }\n j=i;\n while (b[p][next[j]]&&next[j]!=i)\n j=next[j];\n for (k=next[i];k!=j;k=next[k])\n if (b[p][k]!=sum[k])\n return 0;\n for (k=next[j];k!=i;k=next[k])\n if (b[p][k])\n return 0;\n if (b[p][i]!=sum[i])\n {\n if (b[p][i]<=sum[i]/2)\n { \n next[++tot]=next[i];\n next[i]=tot;\n }\n else\n {\n for(k=next[i];next[k]!=i;k=next[k]);\n next[++tot]=i;\n next[k]=tot;\n }\n tmp=(b[p][i]<=sum[i]/2)+'0';\n for (k=0;k<=m;k++)\n if (hash[i][k]&&str[p][k]==tmp)\n {\n for (a=1;a<=n;a++)\n if (str[a][k]=='1')\n {\n b[a][i]--;\n b[a][tot]++;\n }\n hash[i][k]=0;\n sum[i]--;\n hash[tot][k]=1;\n sum[tot]++;\n }\n for (k=1;k<=s;k++)\n c[can[k]]|=(b[can[k]][i]&&b[can[k]][tot]);\n }\n if (b[p][j]!=sum[j])\n {\n if (b[p][j]<=sum[j]/2)\n { \n for(k=next[j];next[k]!=j;k=next[k]);\n next[++tot]=j;\n next[k]=tot;\n }\n else\n {\n next[++tot]=next[j];\n next[j]=tot;\n }\n tmp=(b[p][j]<=sum[j]/2)+'0';\n for (k=0;k<=m;k++)\n if (hash[j][k]&&str[p][k]==tmp)\n {\n for (a=1;a<=n;a++)\n if (str[a][k]=='1')\n {\n b[a][j]--;\n b[a][tot]++;\n }\n hash[j][k]=0;\n sum[j]--;\n hash[tot][k]=1;\n sum[tot]++;\n }\n for (k=1;k<=s;k++)\n c[can[k]]|=(b[can[k]][j]&&b[can[k]][tot]);\n }\n }\n }\n for (p=now;!hash[p][0];p=next[p]);\n d[cur][++d[cur][0]]=p;\n for (i=next[p];i!=p;i=next[i])\n d[cur][++d[cur][0]]=i;\n for (i=1;i<=d[cur][0];i++)\n if (!work(d[cur][i]))\n return 0;\n }\n return 1;\n}\n\nint main()\n{\n long i,j;\n scanf(\"%ld\\n\",&n);\n m=n;\n for (i=1;i<=n;i++)\n {\n str[i][0]='0';\n gets(str[i]+1);\n strcpy(ttt[i]+1,str[i]+1);\n for (j=1;j<=m;j++)\n if (str[i][j]=='1')\n num[i]++;\n b[i][1]=num[i];\n }\n sum[1]=m;\n for (i=1;i<=m;i++)\n hash[1][i]=1;\n if (work(1))\n {\n puts(\"YES\");\n for (i=1;i<=m;i++)\n for (j=1;j<=n;j++)\n sss[j][i]=ttt[j][rec[i]];\n for (i=1;i<=n;i++)\n puts(sss[i]+1);\n }\n else\n puts(\"NO\");\n return 0;\n}"}], "negative_code": [], "src_uid": "af8d46722e1bd8f7392e5596eaf4def8"} {"nl": {"description": "Let's define the permutation of length n as an array p = [p1, p2, ..., pn] consisting of n distinct integers from range from 1 to n. We say that this permutation maps value 1 into the value p1, value 2 into the value p2 and so on.Kyota Ootori has just learned about cyclic representation of a permutation. A cycle is a sequence of numbers such that each element of this sequence is being mapped into the next element of this sequence (and the last element of the cycle is being mapped into the first element of the cycle). The cyclic representation is a representation of p as a collection of cycles forming p. For example, permutation p = [4, 1, 6, 2, 5, 3] has a cyclic representation that looks like (142)(36)(5) because 1 is replaced by 4, 4 is replaced by 2, 2 is replaced by 1, 3 and 6 are swapped, and 5 remains in place. Permutation may have several cyclic representations, so Kyoya defines the standard cyclic representation of a permutation as follows. First, reorder the elements within each cycle so the largest element is first. Then, reorder all of the cycles so they are sorted by their first element. For our example above, the standard cyclic representation of [4, 1, 6, 2, 5, 3] is (421)(5)(63).Now, Kyoya notices that if we drop the parenthesis in the standard cyclic representation, we get another permutation! For instance, [4, 1, 6, 2, 5, 3] will become [4, 2, 1, 5, 6, 3].Kyoya notices that some permutations don't change after applying operation described above at all. He wrote all permutations of length n that do not change in a list in lexicographic order. Unfortunately, his friend Tamaki Suoh lost this list. Kyoya wishes to reproduce the list and he needs your help. Given the integers n and k, print the permutation that was k-th on Kyoya's list.", "input_spec": "The first line will contain two integers n, k (1 ≤ n ≤ 50, 1 ≤ k ≤ min{1018, l} where l is the length of the Kyoya's list).", "output_spec": "Print n space-separated integers, representing the permutation that is the answer for the question. ", "sample_inputs": ["4 3", "10 1"], "sample_outputs": ["1 3 2 4", "1 2 3 4 5 6 7 8 9 10"], "notes": "NoteThe standard cycle representation is (1)(32)(4), which after removing parenthesis gives us the original permutation. The first permutation on the list would be [1, 2, 3, 4], while the second permutation would be [1, 2, 4, 3]."}, "positive_code": [{"source_code": "#include\nlong long int fib[55];\nvoid fibo(long long int n)\n{\n\tif(n==53)\n\t\treturn;\n\tfib[n]=fib[n-1]+fib[n-2];\n\tfibo(n+1);\n}\nvoid func(long long int k,long long int r,long long int n)\n{\n\tif(n==0)\n\t\treturn;\n\tif(k<=fib[n])\n\t{\n\t\tprintf(\"%lld \",1+r);\n\t\tfunc(k,r+1,n-1);\n\t}\n\telse\n\t{\n\t\tprintf(\"%lld %lld \",2+r,1+r);\n\t\tfunc(k-fib[n],r+2,n-2);\n\t}\n}\nlong long int main()\n{\n\tlong long int n,k;\n\tscanf(\"%lld %lld\",&n,&k);\n\tfib[1]=1;\n\tfib[2]=1;\n\tfibo(3);\n\tfunc(k,0,n);\n\tprintf(\"\\n\");\n\treturn 0;\n}\n"}, {"source_code": "/* practice with Dukkha */\n#include \n\n#define N\t50\n\nint main() {\n\tstatic long long ff[N + 1];\n\tint n, i, a;\n\tlong long k;\n\n\tscanf(\"%d%lld\", &n, &k);\n\tff[0] = ff[1] = 1;\n\tfor (i = 2; i <= n; i++)\n\t\tff[i] = ff[i - 1] + ff[i - 2];\n\ta = 0;\n\twhile (n > 0)\n\t\tif (k <= ff[n - 1]) {\n\t\t\tprintf(\"%d \", a + 1);\n\t\t\ta++;\n\t\t\tn--;\n\t\t} else {\n\t\t\tk -= ff[n - 1];\n\t\t\tprintf(\"%d %d \", a + 2, a + 1);\n\t\t\ta += 2;\n\t\t\tn -= 2;\n\t\t}\n\tprintf(\"\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include\n#define ll long long\nll fib[51];\n\nvoid solve( int n, int *a, ll k ) {\n\tif( n == 0 )\n\t\treturn;\n\tif( k <= fib[n-1] ) {\n\t\tsolve( n-1, a+1, k );\n\t}\n\telse {\n\t\tint t = a[0];\n\t\ta[0] = a[1];\n\t\ta[1] = t;\n\t\tsolve( n-2, a+2, k - fib[n-1]);\n\t}\n\treturn;\n}\n\nint main() {\n\tint n;\n\tlong long k;\n\tscanf(\"%d%lld\", &n, &k);\n\tint a[n];\n\tfib[0]=1;\n\tfib[1]=1;\n\tfor( int i=0; i\n#include \n#include \n\nuint64_t fib[51];\n\nvoid findperm(uint64_t n, uint64_t k, uint64_t offset){\n assert( k <= fib[n]);\n if (n == 0){\n puts(\"\");\n return;\n }\n if (n == 1){\n printf(\"%llu\\n\", offset);\n return;\n }\n if ( k <= fib[n-1]){\n printf(\"%llu \", offset);\n findperm(n-1, k, offset+1);\n }\n else{\n printf(\"%llu %llu \", offset+1, offset);\n findperm(n-2, k -fib[n-1], offset+2);\n }\n}\n \n \nint main(void){\n uint64_t n, k;\n fib[0] = 1;\n fib[1] = 1;\n for (size_t k = 2; k <= 50; k++)\n fib[k] = fib[k-1]+fib[k-2];\n \n scanf(\"%llu %llu\", &n, &k);\n findperm(n, k, 1);\n return 0;\n} \n "}, {"source_code": "#include\n\nlong long f[51];\nint a[51];\n\nint main()\n{\n int i,n;\n long long k;\n\n scanf(\"%d%I64d\",&n,&k);\n f[1]=1;\n f[2]=2;\n for(i=3;i<=n;i++)f[i]=f[i-1]+f[i-2];\n for(i=1;i\ntypedef long long unsigned llu;\ntypedef unsigned u;\nllu F[64];\nvoid C(u n,llu l,u p)\n{\n\tif(!n){putchar('\\n');return;}\n\tif(F[n-1]>=l)\n\t{\n\t\tprintf(\"%u \",p);\n\t\tC(n-1,l,p+1);\n\t}\n\telse\n\t{\n\t\tprintf(\"%u %u \",p+1,p);\n\t\tC(n-2,l-F[n-1],p+2);\n\t}\n\treturn;\n}\nint main()\n{\n\tu i,j,k,n;llu l;\n\tfor(F[F[0]=i=1]=1;++i<64;F[i]=F[i-1]+F[i-2]);\n\tscanf(\"%u%I64u\",&n,&l);\n\tC(n,l,1);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nlong long fib[52];\n\nvoid F(int n, long long k, int inc){\n if (n == 1) printf(\"%d \", 1 + inc);\n if (n == 2){\n if (k == 1) printf(\"%d %d \", 1 + inc, 2 + inc);\n else printf(\"%d %d \", 2 + inc, 1 + inc);\n }\n if (n < 3) return;\n\n if (k <= fib[n - 1]){\n printf(\"%d \", 1 + inc);\n F(n - 1, k, inc + 1);\n }\n else{\n printf(\"%d %d \", 2 + inc, 1 + inc);\n F(n - 2, k - fib[n - 1], inc + 2);\n }\n}\n\nint main(){\n int i, j, n;\n long long k;\n\n fib[0] = 1, fib[1] = 1;\n for (i = 2; i < 52; i++) fib[i] = fib[i - 1] + fib[i - 2];\n\n while (scanf(\"%d %I64d\", &n, &k) != EOF){\n F(n, k, 0);\n puts(\"\");\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main(){\n\tint n,i;\n\tlong long k,*left;\n\tscanf(\"%d %I64d\",&n,&k);\n\tif(n<3){\n\t\tif(k==1){\n\t\t\tprintf(\"1\");\n\t\t\tif(n==1)\n\t\t\t\tprintf(\"\\n\");\n\t\t\telse\n\t\t\t\tprintf(\" 2\\n\");\n\t\t}\n\t\telse\n\t\t\tprintf(\"2 1\\n\");\n\t\treturn 0;\n\t}\n\tleft=(long long *)malloc(sizeof(long long)*n);\n\tleft[n-1]=0;\n\tleft[n-2]=1;\n\tfor(i=n-3;i>0;i--){\n\t\tleft[i]=left[i+1]+left[i+2]+1;\n\t}\n\tk--;\n\tfor(i=1;ileft[i]){\n\t\t\tprintf(\"%d %d \",i+1,i);\n\t\t\tk-=left[i]+1;\n\t\t\ti++;\n\t\t}\n\t\telse\n\t\t\tprintf(\"%d \",i);\n\t}\n\tif(i==n)\n\t\tprintf(\"%d \",n);\n\tprintf(\"\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nlong long f[60],k;\nint i,j;\nint n;\nint p[60];\n\nvoid dfs(int,int,long long);\n\nint main()\n{\n scanf(\"%d%lld\",&n,&k);\n f[0]=f[1]=1;\n for(i=2;i<=n;i++)\n {\n f[i]=f[i-1]+f[i-2];\n }\n dfs(1,n,k);\n for(i=1;i=tmp)\n {\n w=i+k-1;\n ww=i+k-1;\n while(i<=ww)\n {\n p[i]=w;\n i++;\n w--;\n }\n dfs(i,j-k,tmp);\n return;\n }\n else tmp-=f[j-k];\n }\n}"}], "negative_code": [{"source_code": "#include\nlong long int fib[55];\nvoid fibo(int n)\n{\n\tif(n==53)\n\t\treturn;\n\tfib[n]=fib[n-1]+fib[n-2];\n\tfibo(n+1);\n}\nvoid func(int k,int r,int n)\n{\n\tif(n==0)\n\t\treturn;\n\tif(k<=fib[n])\n\t{\n\t\tprintf(\"%d \",1+r);\n\t\tfunc(k,r+1,n-1);\n\t}\n\telse\n\t{\n\t\tprintf(\"%d %d \",2+r,1+r);\n\t\tfunc(k-fib[n],r+2,n-2);\n\t}\n}\nint main()\n{\n\tint n,k;\n\tscanf(\"%d %d\",&n,&k);\n\tfib[1]=1;\n\tfib[2]=1;\n\tfibo(3);\n\tfunc(k,0,n);\n\tprintf(\"\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nlong long f[51],sum[51];\nint a[51];\n\nint main()\n{\n int i,n;\n long long k;\n\n scanf(\"%d%I64d\",&n,&k);\n f[1]=1;\n sum[1]=1;\n f[2]=2;\n sum[2]=3;\n for(i=3;i<=n;i++)\n {\n f[i]=f[i-1]+f[i-2];\n sum[i]=sum[i-1]+f[i];\n }\n for(i=1;i\ntypedef long long unsigned llu;\ntypedef unsigned u;\nvoid F(u n,llu l,u p)\n{\n\tif(!n){printf(\"%u\\n\",p);return;}\n\tu i=1,j=n-1;\n\twhile((1llu<=i)F(n-i,l,p+i);\n\treturn;\n}\nint main()\n{\n\tu n;llu l;\n\tscanf(\"%u%I64u\",&n,&l);\n\tF(n-1,l,1);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nlong long fib[52];\n\nvoid F(int n, int k, int inc){\n if (n == 1) printf(\"%d \", 1 + inc);\n if (n == 2){\n if (k == 1) printf(\"%d %d \", 1 + inc, 2 + inc);\n else printf(\"%d %d \", 2 + inc, 1 + inc);\n }\n if (n < 3) return;\n\n if (k <= fib[n - 1]){\n printf(\"%d \", 1 + inc);\n F(n - 1, k, inc + 1);\n }\n else{\n printf(\"%d %d \", 2 + inc, 1 + inc);\n F(n - 2, k - fib[n - 1], inc + 2);\n }\n}\n\nint main(){\n int i, j, n;\n long long k;\n\n fib[0] = 1, fib[1] = 1;\n for (i = 2; i < 52; i++) fib[i] = fib[i - 1] + fib[i - 2];\n\n while (scanf(\"%d %I64d\", &n, &k) != EOF){\n F(n, k, 0);\n puts(\"\");\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main(){\n\tint n,i;\n\tlong long k,*left;\n\tscanf(\"%d %I64d\",&n,&k);\n\tif(n<3){\n\t\tif(k==1){\n\t\t\tprintf(\"1\");\n\t\t\tif(n==1)\n\t\t\t\tprintf(\"\\n\");\n\t\t\telse\n\t\t\t\tprintf(\" 2\\n\");\n\t\t}\n\t\telse\n\t\t\tprintf(\"2 1\\n\");\n\t\treturn 0;\n\t}\n\tleft=(long long *)malloc(sizeof(long long)*n);\n\tleft[n-1]=0;\n\tleft[n-2]=1;\n\tleft[n-3]=2;\n\tfor(i=n-4;i>0;i--){\n\t\tleft[i]=left[i+1]+left[i+3]+2;\n\t}\n\tk--;\n\tfor(i=1;ileft[i]){\n\t\t\tprintf(\"%d %d \",i+1,i);\n\t\t\tk-=left[i]+1;\n\t\t\ti++;\n\t\t}\n\t\telse\n\t\t\tprintf(\"%d \",i);\n\t}\n\tif(i==n)\n\t\tprintf(\"%d \",n);\n\tprintf(\"\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main(){\n\tint n,i;\n\tlong long k,*left;\n\tscanf(\"%d %I64d\",&n,&k);\n\tif(n<3){\n\t\tif(k==1){\n\t\t\tprintf(\"1\");\n\t\t\tif(n==1)\n\t\t\t\tprintf(\"\\n\");\n\t\t\telse\n\t\t\t\tprintf(\" 2\\n\");\n\t\t}\n\t\telse\n\t\t\tprintf(\"2 1\\n\");\n\t\treturn 0;\n\t}\n\tleft=(long long *)malloc(sizeof(long long)*n);\n\tleft--;\n\tleft[n]=-1;\n\tleft[n-1]=0;\n\tleft[n-2]=1;\n\tfor(i=n-3;i>0;i--){\n\t\tleft[i]=left[i+1]+left[i+3]+2;\n\t}\n\tk--;\n\tfor(i=1;ileft[i]){\n\t\t\tprintf(\"%d %d \",i+1,i);\n\t\t\tk-=left[i]+1;\n\t\t\ti++;\n\t\t}\n\t\telse\n\t\t\tprintf(\"%d \",i);\n\t}\n\tif(i==n)\n\t\tprintf(\"%d \",n);\n\tprintf(\"\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nlong long f[60];\nint i,j;\nint n,k;\nint p[60];\n\nvoid dfs(int,int,long long);\n\nint main()\n{\n scanf(\"%d%lld\",&n,&k);\n f[0]=f[1]=1;\n for(i=2;i<=n;i++)\n {\n f[i]=f[i-1]+f[i-2];\n }\n dfs(1,n,k);\n for(i=1;i=tmp)\n {\n w=i+k-1;\n ww=i+k-1;\n while(i<=ww)\n {\n p[i]=w;\n i++;\n w--;\n }\n dfs(i,j-k,tmp);\n return;\n }\n else tmp-=f[j-k];\n }\n}\n"}, {"source_code": "#include \n\nlong long f[60];\nint i,j;\nint n,k;\nint p[60];\n\nvoid dfs(int,int,long long);\n\nint main()\n{\n scanf(\"%d%d\",&n,&k);\n f[0]=f[1]=1;\n for(i=2;i<=n;i++)\n {\n f[i]=f[i-1]+f[i-2];\n }\n dfs(1,n,k);\n for(i=1;i=tmp)\n {\n w=i+k-1;\n ww=i+k-1;\n while(i<=ww)\n {\n p[i]=w;\n i++;\n w--;\n }\n dfs(i,j-k,tmp);\n return;\n }\n else tmp-=f[j-k];\n }\n}"}, {"source_code": "#include \n\nlong long f[60];\nint i,j;\nint n,k;\nint p[60];\n\nvoid dfs(int,int,long long);\n\nint main()\n{\n scanf(\"%d%d\",&n,&k);\n f[0]=f[1]=1;\n for(i=2;i<=n;i++)\n {\n f[i]=f[i-1]*2;\n }\n dfs(1,n,k);\n for(i=1;i=tmp)\n {\n w=i+k-1;\n ww=i+k-1;\n while(i<=ww)\n {\n p[i]=w;\n i++;\n w--;\n }\n dfs(i,j-k,tmp);\n return;\n }\n else tmp-=f[j-k];\n }\n}"}], "src_uid": "e03c6d3bb8cf9119530668765691a346"} {"nl": {"description": "Amr bought a new video game \"Guess Your Way Out!\". The goal of the game is to find an exit from the maze that looks like a perfect binary tree of height h. The player is initially standing at the root of the tree and the exit from the tree is located at some leaf node. Let's index all the leaf nodes from the left to the right from 1 to 2h. The exit is located at some node n where 1 ≤ n ≤ 2h, the player doesn't know where the exit is so he has to guess his way out!Amr follows simple algorithm to choose the path. Let's consider infinite command string \"LRLRLRLRL...\" (consisting of alternating characters 'L' and 'R'). Amr sequentially executes the characters of the string using following rules: Character 'L' means \"go to the left child of the current node\"; Character 'R' means \"go to the right child of the current node\"; If the destination node is already visited, Amr skips current command, otherwise he moves to the destination node; If Amr skipped two consecutive commands, he goes back to the parent of the current node before executing next command; If he reached a leaf node that is not the exit, he returns to the parent of the current node; If he reaches an exit, the game is finished. Now Amr wonders, if he follows this algorithm, how many nodes he is going to visit before reaching the exit?", "input_spec": "Input consists of two integers h, n (1 ≤ h ≤ 50, 1 ≤ n ≤ 2h).", "output_spec": "Output a single integer representing the number of nodes (excluding the exit node) Amr is going to visit before reaching the exit by following this algorithm.", "sample_inputs": ["1 2", "2 3", "3 6", "10 1024"], "sample_outputs": ["2", "5", "10", "2046"], "notes": "NoteA perfect binary tree of height h is a binary tree consisting of h + 1 levels. Level 0 consists of a single node called root, level h consists of 2h nodes called leaves. Each node that is not a leaf has exactly two children, left and right one. Following picture illustrates the sample test number 3. Nodes are labeled according to the order of visit."}, "positive_code": [{"source_code": "#include \n\nint main(void)\n{\n long long n, h, v = 0;\n scanf(\"%I64d %I64d\", &h, &n);\n n = (n - 1) + (1LL << h);\n for (long long i = 0, p = 1LL << (h + 1); i < h; i++, p >>= 1)\n if (!(((n >> (h - i)) ^ (n >> (h - i - 1))) & 1))\n v += (p - 1) / 2;\n printf(\"%I64d\", v + h);\n}"}, {"source_code": "#include \n\nint main(int argc, char const *argv[]){\n\tint h,i=0;\n\tlong long n, acc=0, l;\n\tscanf(\"%d%I64d\", &h, &n);\n\tl = 1ll << h;\n\twhile (h--){\n\t\ti = !i;\n\t\tl >>= 1;\n\t\tif ((i && n<=l) || (!i && n>l)){\n\t\t\t++acc;\n\t\t}\n\t\telse{\n\t\t\tacc += 1ll << (h+1);\n\t\t\ti = !i;\n\t\t}\n\t\tif (n>l) n -= l;\n\t}\n\tprintf(\"%I64d\\n\", acc);\n\treturn 0;\n}"}, {"source_code": "/* practice with Dukkha */\n#include \n\nint ancestor(long long a, long long b) {\n\twhile (b > a)\n\t\tb >>= 1;\n\treturn b == a;\n}\t\n\nint main() {\n\tint h, c;\n\tlong long n, x, ans;\n\n\tscanf(\"%d%lld\", &h, &n);\n\tn += (1LL << h) - 1;\n\tx = 1, ans = h;\n\tc = 0;\n\twhile (x != n)\n\t\tif (ancestor(x, n)) {\n\t\t\tx = x << 1 ^ c; c ^= 1;\n\t\t\th--;\n\t\t} else {\n\t\t\tans += (1LL << h + 1) - 1;\n\t\t\tx >>= 1;\n\t\t\th++;\n\t\t}\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n char goL = 1;\n int H;\n long long N, M, Ans = 0;\n scanf(\"%d %I64d\", &H, &N);\n M = 1LL << H;\n while(H) {\n if(goL) {\n if(N > (M >> 1)) {\n Ans += M;\n N -= M >> 1;\n } else {\n ++Ans;\n goL = 0;\n }\n } else {\n if(N <= (M >> 1)) {\n Ans += M;\n } else {\n ++Ans;\n goL = 1;\n N -= M >> 1;\n }\n }\n --H;\n M = 1LL << H;\n }\n printf(\"%I64d\\n\", Ans);\n return 0;\n}\n"}, {"source_code": "#include \n\nlong long int potencia (long long int exp){\n long long int i, resultado = 1;\n for(i = 0; i < exp; i++)\n resultado *= 2;\n return resultado;\n}\n\nint main(){\n long long int comeco, quantidade = 0, i, h, n, atual, l;\n char passos[100];\n for(i = 0; i < 55; i++)\n if(i%2 == 0)\n passos[i] = 'L';\n else\n passos[i] = 'R';\n scanf(\"%I64d %I64d\", &h, &n);\n i = 0;\n comeco = atual = 1;\n l = h;\n while(n != atual - potencia(l) + 1){\n if(passos[i] == 'L'){\n if(n <= comeco + potencia(h)/2 - 1){\n quantidade += 1;\n h--;\n atual = 2*atual;\n i++;\n }else{\n quantidade += potencia(h);\n h--;\n comeco += potencia(h);\n atual = 2*atual + 1;\n }\n }else{\n if(n <= comeco + potencia(h)/2 - 1){\n quantidade += potencia(h);\n h--;\n atual = 2*atual;\n }else{\n quantidade += 1;\n h--;\n comeco += potencia(h);\n atual = 2*atual + 1;\n i++;\n }\n }\n }\n printf(\"%I64d\\n\", quantidade);\n return 0;\n}\n"}, {"source_code": "#include \nlong long arr[65];\nint main(void) {\n long long i,a[65],h,j,k,m,n,x,y,z,next,ans;\n scanf(\"%lld %lld\",&h,&n);\n arr[0]=1;\n for(i=1;i<62;++i) arr[i]=arr[i-1]*2;\n n=arr[h]-1+n;\n m=n;\n for(i=h-1;i>=0;--i){\n x=m/2;\n if(2*x==m) a[i]=0;\n else a[i]=1;\n m=m/2;\n // printf(\"%lld %lld\\n\",m,a[i]);\n }\n z=0;\n next=0;\n ans=1;\n while(z\n#include \n#include \n\n\n\nunsigned long long calculateNodesOfTree(int h){\n unsigned long long count = 0;\n for(int i = 0; i <= h ;i++){\n count = count + pow(2,i);\n }\n return count;\n}\n\nunsigned long long countNodes(int h, unsigned long long n){\n unsigned long long count = 0;\n int h0 = h;\n while(1){\n h--;\n if(h == -1) break;\n unsigned long long k1 = (double)n/2;\n\n unsigned long long k2; //parent node\n if(n % 2 == 0) k2 = n/2;\n else k2 = n/2 + 1;\n\n count++;\n if(k2 == 1 && h == 0){ //root node\n if(k1 == k2){ //node is Right of root node\n count = count + calculateNodesOfTree(h0-h-1);\n }\n }else{\n if(k2 % 2 == 0){ //even number - LR\n if(k1 == k2){ //node is Right of parent node\n count = count + calculateNodesOfTree(h0-h-1);\n }\n }else if(k2 % 2 == 1){ //odd number - RL\n if(k1 < k2){ //node is Left of parent node\n count = count + calculateNodesOfTree(h0-h-1);\n }\n }\n }\n n = k2;\n }\n return count;\n}\n\nint main() {\n\tint h;\n\tunsigned long long n;\n\tscanf(\"%d %I64d\", &h,&n);\n\tprintf(\"%I64d\", countNodes(h,n));\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nlong long int ans=0;\nvoid compute(char cmd,long long int n,long long int h,long long int power)\n{\n\tif(h==0)\n\t\treturn ;\n\tlong long int l=power;\n\tlong long int m=l/2;\n\tif(cmd=='L' && n>m)\n\t{\n\t\tans=ans+l;\n\t\tlong long int o=n%m;\n\t\tif(o==0)\n\t\t\to=m;\n\n\t\tcompute('L',o,h-1,l/2);\n\t}\n\telse if(cmd=='L' && n<=m)\n\t{\n\t\tans=ans+1;\n\t\tcompute('R',n,h-1,l/2);\n\t}\n\telse if(cmd=='R' && n<=m)\n\t{\n\t\tans=ans+l;\n\t\tcompute('R',n,h-1,l/2);\n\t}\n\telse if(cmd=='R' && n>m)\n\t{\n\n\t\tlong long int o=n%m;\n\t\tif(o==0)\n\t\t\to=m;\n\t\tans=ans+1;\n\t\tcompute('L',o,h-1,l/2);\n\t}\n\t\n}\t\t\nint main()\n{\n\tlong long int h,n;\n\tscanf(\"%lld %lld\",&h,&n);\n\tlong long int power=pow(2,h);\n\tcompute('L',n,h,power);\n\tprintf(\"%lld\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tlong long int n,sum=0;\n\tlong long int h;\n\tscanf(\"%I64d%I64d\",&h,&n);\n\tint i=0;\n\tlong long int l,r,m1,m2;\n\tl=1;\n\tr=1ll<=l)\n\t\t{\n\t\t\tsum+=1;\n\t\t\tfanxiang=1;\n\t\t\ts=1;\n\t\t}\n\t\telse if(fanxiang==0&&n>=m2&&n<=r)\n\t\t{\n\t\t\tsum+=(1ll<<(h-i));\n\t\t\ts=2;\n\t\t}\n\t\telse if(fanxiang==1&&n<=m1)\n\t\t{\n\t\t\tsum+=(1ll<<(h-i));\n\t\t\ts=1;\n\t\t}\n\t\telse if(fanxiang==1&&n>=m2&&n<=r)\n\t\t{\n\t\t\tsum+=1;\n\t\t\tfanxiang=0;\n\t\t\ts=2;\n\t\t}\n\t\tif(s==1)\n\t\t{\n\t\t\tr=m1;\n\t\t}\n\t\tif(s==2)\n\t\t{\n\t\t\tl=m2;\n\t\t}\n\t\t\n\t}\n\tprintf(\"%I64d\\n\",sum);\n\treturn 0;\n\t\n}"}, {"source_code": "#include\nlong long int a[51],ans;\nvoid count(long long int h,long long int n,long long int flag){\n\tif(h==0)\n\t\treturn ;\n\tif(flag==0){\n\t\tif(n <= a[h]/2){\n\t\t\tans++;\n//\t\t\tprintf(\"%d \",ans);\n\t\t\tcount(h-1,n,1);\n\t\t}\n\t\telse{\n\t\t\tans = ans + a[h];\n//\t\t\tprintf(\"%d \",ans);\n\t\t\tcount(h-1,n-a[h]/2,0);\n\t\t}\n\t}\n\telse{\n\t\tif(n > a[h]/2){\n\t\t\tans++;\n//\t\t\tprintf(\"%d \",ans);\n\t\t\tcount(h-1,n-a[h]/2,0);\n\t\t}\n\t\telse{\n\t\t\tans = ans + a[h];\n//\t\t\tprintf(\"%d \",ans);\n\t\t\tcount(h-1,n,1);\n\t\t}\n\t}\n\treturn ;\n}\nint main(){\n\tlong long int h,i,j,k,l,n,m;\n\tans=0;\n\ta[0] = 1;\n\tfor(i=1;i<=50;i++)\n\t\ta[i]=a[i-1]*2;\n//\tfor(i=0;i<10;i++)\n//\t\tprintf(\"%d \",a[i]);\n\tscanf(\"%lld%lld\",&h,&n);\n\tcount(h,n,0);\n\tprintf(\"%lld\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nlong long answer(long long n,int h)\n{\n\tint i,j,check;\n\tlong long total = 0,temp = 0,temp1 = 0;\n\tfor(i = h;i > 0;i--)\n\t{\n\t\ttemp = 1;\n\t\tif(i == 1 && (n % 2) == 0)\n\t\t{\t\n\t\t\tfor(j = 0;j < h - i + 1;j++) temp *= 2;\n\t\t\ttotal += temp;\n\t\t\tcontinue;\n\t\t}\n\t\telse if(i == 1 && (n % 2) != 0)\n\t\t{\n\t\t\ttotal++;\n\t\t\tcontinue;\n\t\t}\n\t\tif((n % 2 == 0 && (n / 2) % 2 == 0) || (n % 2 != 0 && ((n + 1) / 2) % 2 != 0))\n\t\t{\n\t\t\tif(i == h)\n\t\t\t{\n\t\t\t\ttotal += 2;\n\t\t\t\ttemp1 = n;\n\t\t\t\tn /= 2;\n\t\t\t\tif(temp1 % 2 > 0) \n\t\t\t\tn++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfor(j = 0;j < h - i + 1;j++) temp *= 2;\n\t\t\ttotal += temp;\n\t\t}\n\t\telse \n\t\t\ttotal++;\n\t\ttemp1 = n;\n\t\tn /= 2;\n\t\tif(temp1 % 2 > 0) \n\t\t\tn++;\n\t}\n\treturn total;\n}\n\nint main()\n{\n\tint h,i;\n\tlong long total = 0,n;\n\tscanf(\"%d%lld\",&h,&n);\n\tprintf(\"%lld\",answer(n,h));\n\treturn 0;\n}"}, {"source_code": "#include\n#include\ntypedef long long ll;\nint main()\n{\n int h;\n ll n;\n while(scanf(\"%d%I64d\",&h,&n) != EOF)\n {\n ll a,b,s = 0;\n for( ; h > 0; h--)\n {\n a = pow(2,h);\n if(a/2 >= n)\n {\n s++;\n n = a/2-n+1;\n continue;\n }\n else if (a/2 < n)\n {\n s += a;\n n -= a/2;\n continue;\n }\n\n }\n\n printf(\"%I64d\\n\",s);\n }\n return 0;\n}\n"}, {"source_code": "#include\ntypedef long long ll;\nll array[55];\nint check(ll dest,ll cur)\n{\n if(cur==dest)\n return 1;\n while(cur>=1)\n {\n cur = cur/2;\n if(cur==dest)\n return 1;\n }\n return 0;\n}\nint main()\n{\n int i;\n array[0] = 1;\n for(i=1;i<55;i++)\n array[i]= (array[i-1]+1)*2-1;\n ll h,n;\n scanf(\"%lld%lld\",&h,&n);\n n = n + array[h-1];\n ll count = 1;\n ll index = 1,tmp,ht = h-1;\n int flag=0;\n while(index!=n)\n {\n if(flag==0)\n tmp=2*index;\n else if(flag==1)\n tmp = index*2+1;\n if(check(tmp,n))\n {\n count+=1;\n index = index*2+flag;\n flag = (flag+1)%2;\n ht--;\n }\n else \n {\n count+=array[ht];\n flag = (flag+1)%2;\n \n }\n \n }\n count--;\n printf(\"%lld\\n\",count);\n}"}, {"source_code": "#include \n#include \n#include \n\nlong long getpath(long long pos, long long h, long long n, int indi, int *found)\n{\n long long x = 0;\n if (h == 0 && n == pos) { *found = 1; return 0; }\n else if (h == 0) return 1;\n long long tmp = n;\n \n tmp = tmp>>(h);\n long long y = 1;\n if (tmp != pos) return (y<<(h + 1)) - 1;\n \n x = getpath(pos * 2 + indi, h - 1, n, !indi, found);\n if (!*found) x += getpath(pos * 2 + !indi, h - 1, n, indi, found);\n \n return x + 1;\n \n}\nint main(int argc, char **argv)\n{\n long long h, n;\n scanf(\"%I64d%I64d\", &h, &n);\n n--;\n long long x = 0;\n int found = 0;\n x = getpath(0, h, n, 0, &found);\n printf(\"%I64d\\n\", x);\n //system(\"pause\");\n return 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n\tint i, h, x;\n\tlong long int n, tn, r;\n\tscanf(\"%d%lld\", &h, &n);\n\tn -= 1;\n\ttn = 1;\n\tr = 0;\n\tfor (i = 0; i < h; ++i)\n\t{\n\t\ttn *= 2;\n\t}\n\tx = 0;\n\tfor (i = 0; i < h; ++i)\n\t{\n\t\ttn /= 2;\n\t\tr += 1;\n\t\tif (tn & n)\n\t\t{\n\t\t\tif (x == 0)\n\t\t\t{\n\t\t\t\tr += 2 * tn - 1;\n\t\t\t}\n\t\t\tx = 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (x == 1)\n\t\t\t{\n\t\t\t\tr += 2 * tn - 1;\n\t\t\t}\n\t\t\tx = 1;\n\t\t}\n\t}\n\tprintf(\"%lld\\n\", r);\n\treturn 0;\n}\n"}, {"source_code": "// for level 2, it is {1, 2}\n// for level 3, it is {3, 2, 5, 6}\n// FIXED: wrong result for (39 457181784666) => \n// WRONG ANSWER, where the correct answer is \n// 830699159852\n\n\n#include \n#include \n#include \n#include \n#include \n\ntypedef uint64_t ull;\n\null f(ull h, ull k)\n// number of nodes visited before exiting at k-th leaf nodes\n{\n\t//printf(\"calling [%\"PRIu64 \", %\"PRIu64\"]\\n\", h, k);\n\tif(h == 1) return k;\n\tif( k > (1ULL<<(h - 1))) \n\t\treturn (1ULL<\nint main(void){\n int h;\n long long int mocniny[56];\n long long int n;\n scanf(\"%i %I64d\", &h, &n);\n int i;\n n--;\n long long int r=1;\n mocniny[0]=1;\n for(i=1;i<54;i++){\n mocniny[i]=2*mocniny[i-1];\n }\n long long int res=h;\n int maxi=h;\n int stav=1; // stav==1 kdyz jde pro licha doleva\n for(i=0;i\nunsigned long long int ans=0;\nunsigned long long int po(int h)\n{\n\tif(h==0)\n\t\treturn 1;\n\tif(h==1)\n\t\treturn 2;\n\tunsigned long long int a=po(h/2);\n\tif(h%2==0)\n\t\treturn a*a;\n\telse\n\t\treturn a*a*2;\n}\nvoid func(int h,unsigned long long int n,int m)\n{\n\tif(h==0)\n\t{\n//\t\tans++;\n\t\treturn;\n\t}\n\tunsigned long long int a=po(h);\n\tif(m==0)\n\t{\n\t\tif(n<=a/2)\n\t\t{\n\t\t\tans++;\n\t\t\tfunc(h-1,n,1);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tans+=a;\n\t\t\tfunc(h-1,n-a/2,0);\n\t\t}\n\t}\n\telse\n\t{\n\t\tif(n<=a/2)\n\t\t{\n\t\t\tans+=a;\n\t\t\tfunc(h-1,n,1);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tans++;\n\t\t\tfunc(h-1,n-a/2,0);\n\t\t}\n\t}\n}\nint main()\n{\n\tint h;\n\tunsigned long long int n;\n\tscanf(\"%d %llu\",&h,&n);\n\tfunc(h,n,0);\n\tprintf(\"%llu\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \nint flag = 1;\nlong long to(int h){\n long long ans = 0;\n while(h >= 0){\n ans+= pow(2 , h);\n --h;\n }\n if(ans % 2 == 1){\n flag = flag == 1?1:0;\n }else{\n flag = flag == 1?0:1;\n }\nreturn ans;\n}\nint main()\n{\n int h ,i; long long n;\n scanf(\"%d%I64d\", &h , &n);\n long long low = 1 , high = pow(2, h),current = 1,level = 1 , mid = 1;\n for(i = 0 ; i < h;++i){\n mid = (high+low)/2;\n if(n > mid){\n low = mid+1;\n if(flag == 1){\n current += to(h-level)+1;\n }else{\n current++;\n flag = flag == 1?0:1;\n }\n }\n else{\n high = mid;\n if(flag == 0){\n current += to(h-level)+1;\n }else{\n current++;\n flag = flag == 1?0:1;\n }\n }\n ++level;\n }\n printf(\"%I64d\",current-1);\n return 0;\n}\n"}, {"source_code": "#include \n#include \nlong long int power(long long int x)\n{\n long long int i,t;\n t=0;\n for(i=0;i<=x;i++)\n {\n t=t+pow(2,i);\n }\n return t;\n}\nint main()\n{\n long long int h,n,l,i,d,j;\n scanf(\"%lld %lld\",&h,&n);\n l=pow(2,h);\n d=0;\n j=1;\n for(i=1;i<=h;i++)\n {\n d=d+1;\n if(j==1)\n {\n if(pow(2,h-i)=n)\n {\n d=d+power(h-i);\n }\n else\n {\n n=n-pow(2,h-i);\n j=1;\n }\n }\n\n }\n printf(\"%lld\",d);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nlong long int recurse(long long int h, long long int n,char flag)\n{\n\tif(h==0)\n\t\treturn 0;\n\tif(flag=='L')\n\t{\n\t\tlong long int sub;\n\t\tsub=pow(2,h-1);\n\t\tif(n>sub)\n\t\t{\n\t\t\tlong long int k=pow(2,h);\n\t\t\treturn k-1+recurse(h,n,'R');\n\t\t}\n\t\telse\n\t\t\treturn 1+recurse(h-1,n,'R'); \n\t}\n\tif(flag=='R')\n\t{\n\t\tlong long int sub;\n\t\tsub=pow(2,h-1);\n\t\tif(n<=sub)\n\t\t{\n\t\t\tlong long int k=pow(2,h);\n\t\t\treturn k-1+recurse(h,n,'L');\n\t\t}\t\n\t\telse\n\t\t\treturn 1+recurse(h-1,n-sub,'L');\n\t}\n}\nint main()\n{\n\tlong long int h,n;\n\tscanf(\"%lld%lld\",&h,&n);\n\tprintf(\"%lld\\n\",recurse(h,n,'L'));\nreturn 0;\n\n}"}, {"source_code": "#include\n#include\nlong long powr(int a,int b)\n{\n\tint i;long long p=1;\n\tfor(i=0;i=0;c--)\n\t{\n\t\tk=n>>c;\n\t\tif(k&1)\n\t\ta[h-1-c]=1;\n\t\telse a[h-1-c]=0;\n\t}\n\tlong long ans=0;int j;\n\tfor(i=0;i\nlong long off;\nint main(){\n\tint h,fl;\n\tlong long n,start,stop,size,present,ans,mid;\n\tscanf(\"%d %I64d\",&h,&n);\n\tsize=(long long)1<>1;\n\t\tif(fl==0){\n\t\t\tif(mid>=1;\n\t}\n\tprintf(\"%I64d\\n\",ans);\n\treturn 0;\n}\n\n"}, {"source_code": "#include \n#include \n#include \nlong long leaves_counter(int counter,int h ,long long i,long long f,long long target)\n{\n long long mid=(f+i)/2;//shmal 1 ymin 0\n static long long leave=0;\n static int direction=1;\n if (counter>h)\n return 0;\n if (target>mid)\n {\n if (direction)\n {\n leave+=pow(2,h-counter+1);\n direction=1;\n }\n else\n {\n leave+=1;\n direction=1;\n }\n leaves_counter(counter+1,h,mid+1,f,target);\n }\n else\n {\n if (direction)\n {\n leave+=1;\n direction=0;\n }\n else\n {\n leave+=pow(2,h-counter+1);\n direction=0;\n }\n leaves_counter(counter+1,h,i,mid,target);\n }\n\n return leave;\n\n}\n\nint main()\n{\n int h;\n long long n;\n scanf(\"%d %lld\",&h,&n);\n printf(\"%lld\",leaves_counter(1,h,1,pow(2,h),n));\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main(){\n long long h , n ,ans = 0 , i;\n scanf(\"%I64d%I64d\",&h,&n);\n int OE = 1 ;\n while (h>0){\n if (n > pow(2,h-1)){\n if(OE){\n ans+=pow(2,h);\n \n }\n else {\n ans ++ ;\n OE = 1 - OE ;\n }\n n-=pow(2,h-1);\n }\n else {\n if (OE){\n OE=1-OE;\n ans++;\n }\n else \n ans = ans + pow(2,h);\n \n }\n h--;\n \n \n }\n printf(\"%I64d\",ans);\n return 0 ;\n}"}, {"source_code": "#include\n#include\n#define ll long long int\nll pow2[51];\nll sum[51];\nll numNodes(ll n,ll h,char ch,ll a,ll b)\n{\n if(h == 0)\n return 0;\n\n int rightFlag;\n if(n > (ll)(a+b)/2)\n rightFlag = 1;\n else\n rightFlag = 0;\n\n if(rightFlag == 0 && ch == 'L')\n {\n // escape is in the right\n return 1+numNodes(n,h-1,'R',a,(a+b)/2);\n }\n else if(rightFlag == 1 && ch == 'R')\n {\n // escape is in the right\n return 1+numNodes(n,h-1,'L',1+((a+b)/2),b);\n }\n else\n {\n ll s = sum[h-1];\n if(ch == 'L')\n return 1+s+numNodes(n,h-1,'L',1+((a+b)/2),b);\n else\n return 1+s+ numNodes(n,h-1,'R',a,(a+b)/2);\n }\n}\nint main()\n{\n ll h,n,i,j,ans;\n pow2[0]=1;\n pow2[1]=2;\n sum[0]=1;\n sum[1] = 3;\n for(i=2;i<51;i++)\n {\n pow2[i] = 2*pow2[i-1];\n sum[i] = sum[i-1] + pow2[i];\n }\n scanf(\"%I64d %I64d\",&h,&n);\n ans = numNodes(n,h,'L',1,pow2[h]);\n printf(\"%I64d\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n\tlong long int h,n,l,k,j,i;\n\tlong long int path[53];\n\tscanf(\"%lld\",&h);\n\tscanf(\"%lld\",&n);\n\tl=0;\n\tk=n;\n\tfor(l=0;l\n#include\n__int64 a[100];\n__int64 f(__int64 h, __int64 n){\n if(h == 0) return 0;\n if(h == 1 && n == 1) return 1;\n if(h == 1 && n == 2) return 2;\n if( n - pow(2, h - 1) < 1e-8 ) return f(h - 1, pow(2, h - 1) - n + 1) + 1;\n else return a[h] + 1 + f(h - 1, n - (pow(2, h - 1)) );\n}\nint main(){\n __int64 h, n;\n int i;\n a[1] = 1;\n for(i = 2; i <= 55; i ++){\n a[i] = a[i - 1] + pow(2, i - 1);\n }\n while(scanf(\"%I64d%I64d\", &h, &n) != EOF){\n printf(\"%I64d\\n\", f(h, n));\n }\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include \n\nint main()\n{\n char goL = 1;\n int H;\n long long N, M, Ans = 0;\n scanf(\"%d %I64d\", &H, &N);\n M = 1LL << H;\n while(H) {\n if(goL) {\n if(N > (M >> 1)) {\n Ans += M;\n N -= M >> 1;\n } else {\n ++Ans;\n goL = 0;\n }\n } else {\n if(N <= (M >> 1)) {\n Ans += M;\n } else {\n ++Ans;\n goL = 1;\n }\n }\n --H;\n M = 1LL << H;\n }\n printf(\"%I64d\\n\", Ans);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint calculateNodesOfTree(int h){\n int count = 0;\n for(int i = 0; i <= h ;i++){\n count = count + pow(2,i);\n }\n return count;\n}\n\nint countNodes(int h, int n){\n int count = 0;\n int h0 = h;\n while(1){\n h--;\n if(h == -1) break;\n double k1 = n/2;\n int k2; //parent node\n if(n % 2 == 0) k2 = n/2;\n else k2 = n/2 + 1;\n\n\n count++;\n if(k2 == 1){ //root node\n if(k1 == k2){ //node is Right of root node\n count = count + calculateNodesOfTree(h0-h-1);\n }\n }else{\n if(k2 % 2 == 0){ //even number - LR\n if(k1 == k2){ //node is Right of parent node\n count = count + calculateNodesOfTree(h0-h-1);\n }\n }else if(k2 % 2 == 1){ //odd number - RL\n if(k1 < k2){ //node is Left of parent node\n count = count + calculateNodesOfTree(h0-h-1);\n }\n }\n }\n n = k2;\n }\n return count;\n}\n\nint main(){\n\tint h,n;\n\tscanf(\"%d %d\", &h, &n);\n\tint a=countNodes(h,n);\n\tprintf(\"%d\",a);\n\treturn 0;}\n"}, {"source_code": "#include \n#include \n#include \n\n\n\nint calculateNodesOfTree(int h){\n int count = 0;\n for(int i = 0; i <= h ;i++){\n count = count + pow(2,i);\n }\n return count;\n}\n\nint countNodes(int h, int n){\n int count = 0;\n int h0 = h;\n while(1){\n h--;\n if(h == -1) break;\n double k1 = (double)n/2;\n\n int k2; //parent node\n if(n % 2 == 0) k2 = n/2;\n else k2 = n/2 + 1;\n\n count++;\n if(k2 == 1 && h == 0){ //root node\n if(k1 == k2){ //node is Right of root node\n count = count + calculateNodesOfTree(h0-h-1);\n }\n }else{\n if(k2 % 2 == 0){ //even number - LR\n if(k1 == k2){ //node is Right of parent node\n count = count + calculateNodesOfTree(h0-h-1);\n }\n }else if(k2 % 2 == 1){ //odd number - RL\n if(k1 < k2){ //node is Left of parent node\n count = count + calculateNodesOfTree(h0-h-1);\n }\n }\n }\n n = k2;\n }\n return count;\n}\n\nint main() {\n\tint n,h;\n\tscanf(\"%d %d\", &h,&n);\n\tprintf(\"%d\", countNodes(h,n));\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nlong long int ans=0;\nvoid compute(char cmd,long long int n,long long int h,long long int power)\n{\n\tif(h==0)\n\t\treturn ;\n\tlong long int l=power;\n\tlong long int m=l/2;\n\tif(cmd=='L' && n>m)\n\t{\n\t\tans=ans+l;\n\t\tlong long int o=n%m;\n\t\tif(o==0)\n\t\t\to=m;\n\n\t\tcompute('L',o,h-1,l/2);\n\t}\n\telse if(cmd=='L' && n<=m)\n\t{\n\t\tans=ans+1;\n\t\tcompute('R',n,h-1,l/2);\n\t}\n\telse if(cmd=='R' && n<=m)\n\t{\n\t\tans=ans+l;\n\t\tcompute('R',n,h-1,l/2);\n\t}\n\telse if(cmd=='R' && n>m)\n\t{\n\n\t\tint o=n%m;\n\t\tif(o==0)\n\t\t\to=m;\n\t\tans=ans+1;\n\t\tcompute('L',o,h-1,l/2);\n\t}\n\t\n}\t\t\nint main()\n{\n\tlong long int h,n;\n\tscanf(\"%lld %lld\",&h,&n);\n\tlong long int power=pow(2,h);\n\tcompute('L',n,h,power);\n\tprintf(\"%lld\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tlong long int n,sum=0;\n\tint h;\n\tscanf(\"%d%I64d\",&h,&n);\n\tint i=0;\n\tlong long int l,r,m1,m2;\n\tl=1;\n\tr=1<=l)\n\t\t{\n\t\t\tsum+=1;\n\t\t\tfanxiang=1;\n\t\t\ts=1;\n\t\t}\n\t\telse if(fanxiang==0&&n>=m2&&n<=r)\n\t\t{\n\t\t\tsum+=(1<<(h-i));\n\t\t\ts=2;\n\t\t}\n\t\telse if(fanxiang==1&&n<=m1)\n\t\t{\n\t\t\tsum+=(1<<(h-i));\n\t\t\ts=1;\n\t\t}\n\t\telse if(fanxiang==1&&n>=m2&&n<=r)\n\t\t{\n\t\t\tsum+=1;\n\t\t\tfanxiang=0;\n\t\t\ts=2;\n\t\t}\n\t\tif(s==1)\n\t\t{\n\t\t\tr=m1;\n\t\t}\n\t\tif(s==2)\n\t\t{\n\t\t\tl=m2;\n\t\t}\n\t\t\n\t}\n\tprintf(\"%I64d\\n\",sum);\n\treturn 0;\n\t\n}"}, {"source_code": "#include\nlong long int a[51],ans;\nvoid count(long long int h,long long int n,long long int flag){\n\tif(flag==0){\n\t\tif(h==1){\n\t\t\tif(n==1){\n\t\t\t\tans++;\n//\t\t\t\tprintf(\"%lld\\n\",ans);\n\t\t\t}\n\t\t\telse if(n==2){\n\t\t\t\tans=ans+2;\n//\t\t\t\tprintf(\"%lld\\n\",ans);\n\t\t\t}\n\t\t\treturn ;\n\t\t}\n\t\telse{\n\t\t\tif(n>a[h]/2){\n\t\t\t\tans = ans+a[h];\n\t\t\t\tcount(h-1,n-a[h]/2,0);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tans++;\n\t\t\t\tcount(h-1,n,1);\n\t\t\t}\n\t\t}\n\t}\n\telse{\n\t\tif(h==1){\n if(n==1){\n\t\t\t\t ans=ans+2;\n// printf(\"%lld\\n\",ans);\n\t\t\t }\n else if(n==2){\n ans=ans+1;\n // printf(\"%lld\\n\",ans);\n }\n return ;\n }\n else{\n if(n>a[h]/2){\n ans=ans+a[h];\n count(h-1,n-a[h]/2,1);\n }\n else{\n ans=ans++;\n count(h-1,n,0);\n }\n }\n }\n\treturn ;\n}\nint main(){\n\tlong long int h,i,j,k,l,n,m,pow,flag;\n\tm=2;\n\ta[0]=1;\n\tfor(i=1;i<=50;i++){\n\t\ta[i]=a[i-1]*m;\n//\t\tprintf(\"%lld \",a[i]);\n\t}\n\tans=0;\n\tscanf(\"%lld%lld\",&h,&n);\n\tcount(h,n,0);\n\tprintf(\"%lld\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include\nlong long int a[51],ans;\nvoid count(long long int h,long long int n,long long int flag){\n\tif(flag==0){\n\t\tif(h==1){\n\t\t\tif(n==1){\n\t\t\t\tans++;\n//\t\t\t\tprintf(\"%lld\\n\",ans);\n\t\t\t}\n\t\t\telse if(n==2){\n\t\t\t\tans=ans+2;\n//\t\t\t\tprintf(\"%lld\\n\",ans);\n\t\t\t}\n\t\t\treturn ;\n\t\t}\n\t\telse{\n\t\t\tif(n>a[h]/2){\n\t\t\t\tans = ans+a[h];\n////\t\t\t\tcount(h-1,n-a[h]/2,0);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tans++;\n//\t\t\t\tcount(h-1,n,1);\n\t\t\t}\n\t\t}\n\t}\n\telse{\n\t\tif(h==1){\n if(n==1){\n\t\t\t\t ans=ans+2;\n// printf(\"%lld\\n\",ans);\n\t\t\t }\n else if(n==2){\n ans=ans+1;\n // printf(\"%lld\\n\",ans);\n }\n return ;\n }\n else{\n if(n>a[h]/2){\n ans=ans+a[h];\n count(h-1,n-a[h]/2,1);\n }\n else{\n ans=ans++;\n count(h-1,n,0);\n }\n }\n }\n\treturn ;\n}\nint main(){\n\tlong long int h,i,j,k,l,n,m,pow,flag;\n\tm=2;\n\ta[0]=1;\n\tfor(i=1;i<=50;i++){\n\t\ta[i]=a[i-1]*m;\n//\t\tprintf(\"%lld \",a[i]);\n\t}\n\tans=0;\n\tscanf(\"%lld%lld\",&h,&n);\n\tcount(h,n,0);\n\tprintf(\"%lld\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint a[51],ans;\nvoid count(int h,int n,int flag){\n\tif(h==0)\n\t\treturn ;\n\tif(flag==0){\n\t\tif(n <= a[h]/2){\n\t\t\tans++;\n//\t\t\tprintf(\"%d \",ans);\n\t\t\tcount(h-1,n,1);\n\t\t}\n\t\telse{\n\t\t\tans = ans + a[h];\n//\t\t\tprintf(\"%d \",ans);\n\t\t\tcount(h-1,n-a[h]/2,0);\n\t\t}\n\t}\n\telse{\n\t\tif(n > a[h]/2){\n\t\t\tans++;\n//\t\t\tprintf(\"%d \",ans);\n\t\t\tcount(h-1,n-a[h]/2,0);\n\t\t}\n\t\telse{\n\t\t\tans = ans + a[h];\n//\t\t\tprintf(\"%d \",ans);\n\t\t\tcount(h-1,n,1);\n\t\t}\n\t}\n\treturn ;\n}\nint main(){\n\tint h,i,j,k,l,n,m;\n\tans=0;\n\ta[0] = 1;\n\tfor(i=1;i<=50;i++)\n\t\ta[i]=a[i-1]*2;\n//\tfor(i=0;i<10;i++)\n//\t\tprintf(\"%d \",a[i]);\n\tscanf(\"%d%d\",&h,&n);\n\tcount(h,n,0);\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include\nlong long int a[51],ans;\nvoid count(long long int h,long long int n,long long int flag){\n\tif(flag==0){\n\t\tif(h==1){\n\t\t\tif(n==1){\n\t\t\t\tans++;\n//\t\t\t\tprintf(\"%lld\\n\",ans);\n\t\t\t}\n\t\t\telse if(n==2){\n\t\t\t\tans=ans+2;\n//\t\t\t\tprintf(\"%lld\\n\",ans);\n\t\t\t}\n\t\t\treturn ;\n\t\t}\n\t\telse{\n\t\t\tif(n>a[h]/2){\n\t\t\t\tans = ans+a[h];\n////\t\t\t\tcount(h-1,n-a[h]/2,0);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tans++;\n//\t\t\t\tcount(h-1,n,1);\n\t\t\t}\n\t\t}\n\t}\n\telse{\n\t\tif(h==1){\n if(n==1){\n\t\t\t\t ans=ans+2;\n// printf(\"%lld\\n\",ans);\n\t\t\t }\n else if(n==2){\n ans=ans+1;\n // printf(\"%lld\\n\",ans);\n }\n return ;\n }\n else{\n if(n>a[h]/2){\n ans=ans+a[h];\n count(h-1,n-a[h]/2,1);\n }\n else{\n ans=ans++;\n count(h-1,n,0);\n }\n }\n }\n\treturn ;\n}\nint main(){\n\tlong long int h,i,j,k,l,n,m,pow,flag;\n\tm=2;\n\ta[0]=1;\n\tfor(i=1;i<=50;i++){\n\t\ta[i]=a[i-1]*m;\n\t\tprintf(\"%lld \",a[i]);\n\t}\n\tans=0;\n\tscanf(\"%lld%lld\",&h,&n);\n\tcount(h,n,0);\n\tprintf(\"%lld\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint check(int n)\n{\n\tif((n / 2) % 2 == 0) return 1;\n\telse return 0;\n}\n\nint answer(long long num,int n,int h)\n{\n\tint i,j,total = 0,check,temp = 1,temp1 = 0;\n\tfor(i = h;i > 0;i--)\n\t{\n\t\ttemp = 1;\n\t\tif(i == 1 && (n % 2) == 0)\n\t\t{\t\n\t\t\tfor(j = 0;j < h - i + 1;j++) temp *= 2;\n\t\t\ttotal += temp;\n\t\t\tcontinue;\n\t\t}\n\t\telse if(i == 1 && (n % 2) != 0)\n\t\t{\n\t\t\ttotal++;\n\t\t\tcontinue;\n\t\t}\n\t\tif((n % 2 == 0 && (n / 2) % 2 == 0) || (n % 2 != 0 && ((n + 1) / 2) % 2 != 0))\n\t\t{\n\t\t\tif(i == h)\n\t\t\t{\n\t\t\t\ttotal += 2;\n\t\t\t\ttemp1 = n;\n\t\t\t\tn /= 2;\n\t\t\t\tif(temp1 % 2 > 0) \n\t\t\t\tn++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfor(j = 0;j < h - i + 1;j++) temp *= 2;\n\t\t\ttotal += temp;\n\t\t}\n\t\telse \n\t\t\ttotal++;\n\t\ttemp1 = n;\n\t\tn /= 2;\n\t\tif(temp1 % 2 > 0) \n\t\t\tn++;\n\t}\n\treturn total;\n}\n\nint main()\n{\n\tint h,n,i,total = 0;\n\tlong long time,num = 1;\n\tscanf(\"%d%d\",&h,&n);\n\tfor(i = 0;i < h;i++)\n\t\tnum *= 2;\n\ttotal += answer(num,n,h);\n\tprintf(\"%d\",total);\n\treturn 0;\n}"}, {"source_code": "#include \n\nint check(int n)\n{\n\tif((n / 2) % 2 == 0) return 1;\n\telse return 0;\n}\n\nint answer(long long num,int n,int h)\n{\n\tint i,j,total = 0,check,temp = 1,temp1 = 0;\n\tfor(i = h;i > 0;i--)\n\t{\n\t\ttemp = 1;\n\t\tif(i == 1 && (n % 2) == 0)\n\t\t{\t\n\t\t\tfor(j = 0;j < h - i + 1;j++) temp *= 2;\n\t\t\ttotal += temp;\n\t\t\tcontinue;\n\t\t}\n\t\tif((n % 2 == 0 && (n / 2) % 2 == 0) || (n % 2 != 0 && ((n + 1) / 2) % 2 != 0))\n\t\t{\n\t\t\tif(i == h)\n\t\t\t{\n\t\t\t\ttotal += 2;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfor(j = 0;j < h - i + 1;j++) temp *= 2;\n\t\t\ttotal += temp;\n\t\t}\n\t\telse \n\t\t\ttotal++;\n\t\ttemp1 = n;\n\t\tn /= 2;\n\t\tif(temp1 % 2 > 0) \n\t\t\tn++;\n\t}\n\treturn total;\n}\n\nint main()\n{\n\tint h,n,i,total = 0;\n\tlong long time,num = 1;\n\tscanf(\"%d%d\",&h,&n);\n\tfor(i = 0;i < h;i++)\n\t\tnum *= 2;\n\ttotal += answer(num,n,h);\n\tprintf(\"%d\",total);\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main(int argc, char **argv)\n{\n return 0;\n\n}"}, {"source_code": "#include \n\nint main(int argc, char **argv)\n{\n int h, n;\n scanf(\"%d%d\", &h, &n);\n n--;\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \n\nlong long getpath(long long pos, int h, int origh, int n, int indi, int *found)\n{\n long long x = 0;\n if (h == 0 && n == pos) { *found = 1; return 0; }\n else if (h == 0) return 1;\n int tmp = n;\n \n tmp = tmp>>(h);\n if (tmp != pos) return (1<<(h + 1)) - 1;\n \n x = getpath(pos * 2 + indi, h - 1, h, n, !indi, found);\n if (!*found) x += getpath(pos * 2 + !indi, h - 1, h, n, indi, found);\n \n return x + 1;\n \n}\nint main(int argc, char **argv)\n{\n int h, n;\n scanf(\"%d%d\", &h, &n);\n n--;\n long long x = 0;\n int found = 0;\n x = getpath(0, h, h, n, 0, &found);\n printf(\"%I64d\\n\", x);\n //system(\"pause\");\n return 0;\n}"}, {"source_code": "// for level 2, it is {1, 2}\n// for level 3, it is {3, 2, 5, 6}\n\n#include \n#include \n#include \n\nint f(int h, int k)\n// number of nodes visited before exiting at k-th leaf nodes\n{\n\t//printf(\"calling [%d %d]\\n\", h, k);\n\tif(h == 2) return k;\n\tif( k > (1<<(h - 2))) \n\t\treturn (1<<(h-1)) + f(h - 1, k - (1<<(h-2)));\n\telse return 1 + f(h - 1, (1<<(h - 2)) - k + 1);\n}\n\nint main()\n{\n\tint h, n;\n\tscanf(\"%d %d\", &h, &n);\n\t\n\tprintf(\"%d\", f(h+1, n));\n\treturn 0;\n}\n"}, {"source_code": "#include\nunsigned long long int ans=0;\nunsigned long long int po(int h)\n{\n\tif(h==0)\n\t\treturn 1;\n\tif(h==1)\n\t\treturn 2;\n\tunsigned long long int a=po(h/2);\n\tif(h%2==0)\n\t\treturn a*a;\n\telse\n\t\treturn a*a*2;\n}\nvoid func(int h,int n,int m)\n{\n\tif(h==0)\n\t{\n//\t\tans++;\n\t\treturn;\n\t}\n\tunsigned long long int a=po(h);\n\tif(m==0)\n\t{\n\t\tif(n<=a/2)\n\t\t{\n\t\t\tans++;\n\t\t\tfunc(h-1,n,1);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tans+=a;\n\t\t\tfunc(h-1,n-a/2,0);\n\t\t}\n\t}\n\telse\n\t{\n\t\tif(n<=a/2)\n\t\t{\n\t\t\tans+=a;\n\t\t\tfunc(h-1,n,1);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tans++;\n\t\t\tfunc(h-1,n-a/2,0);\n\t\t}\n\t}\n}\nint main()\n{\n\tint h;\n\tunsigned long long int n;\n\tscanf(\"%d %llu\",&h,&n);\n\tif(h==39 && n==457181784666)\n\t\tprintf(\"830699159852\\n\");\n\telse if(h==33 && n==2599588275)\n\t\tprintf(\"1357401405\\n\");\n\telse\n\t{\n\t\tfunc(h,n,0);\n\t\tprintf(\"%llu\\n\",ans);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\nunsigned long long int ans=0;\nunsigned long long int po(int h)\n{\n\tif(h==0)\n\t\treturn 1;\n\tif(h==1)\n\t\treturn 2;\n\tunsigned long long int a=po(h/2);\n\tif(h%2==0)\n\t\treturn a*a;\n\telse\n\t\treturn a*a*2;\n}\nvoid func(int h,int n,int m)\n{\n\tif(h==0)\n\t{\n//\t\tans++;\n\t\treturn;\n\t}\n\tunsigned long long int a=po(h);\n\tif(m==0)\n\t{\n\t\tif(n<=a/2)\n\t\t{\n\t\t\tans++;\n\t\t\tfunc(h-1,n,1);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tans+=a;\n\t\t\tfunc(h-1,n-a/2,0);\n\t\t}\n\t}\n\telse\n\t{\n\t\tif(n<=a/2)\n\t\t{\n\t\t\tans+=a;\n\t\t\tfunc(h-1,n,1);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tans++;\n\t\t\tfunc(h-1,n-a/2,0);\n\t\t}\n\t}\n}\nint main()\n{\n\tint h;\n\tunsigned long long int n;\n\tscanf(\"%d %llu\",&h,&n);\n\tif(h==39 && n==457181784666)\n\t\tprintf(\"830699159852\\n\");\n\telse\n\t{\n\t\tfunc(h,n,0);\n\t\tprintf(\"%llu\\n\",ans);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\nlong long int ans=0;\nlong long int po(int h)\n{\n\tif(h==0)\n\t\treturn 1;\n\tif(h==1)\n\t\treturn 2;\n\tlong long int a=po(h/2);\n\tif(h%2==0)\n\t\treturn a*a;\n\telse\n\t\treturn a*a*2;\n}\nint func(int h,int n,int m)\n{\n\tif(h==0)\n\t{\n//\t\tans++;\n\t\treturn;\n\t}\n\tlong long int a=po(h);\n\tif(m==0)\n\t{\n\t\tif(n<=a/2)\n\t\t{\n\t\t\tans++;\n\t\t\tfunc(h-1,n,1);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tans+=a;\n\t\t\tfunc(h-1,n-a/2,0);\n\t\t}\n\t}\n\telse\n\t{\n\t\tif(n<=a/2)\n\t\t{\n\t\t\tans+=a;\n\t\t\tfunc(h-1,n,1);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tans++;\n\t\t\tfunc(h-1,n-a/2,0);\n\t\t}\n\t}\n}\nint main()\n{\n\tint h,n;\n\tscanf(\"%d %d\",&h,&n);\n\tfunc(h,n,0);\n\tprintf(\"%lld\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include\nlong long int recurse(long long int h, long long int n,char flag)\n{\n\tif(h==0)\n\t\treturn 0;\n\tif(flag=='L')\n\t{\n\t\tlong long int sub;\n\t\tsub=1<<(h-1);\n\t\tif(n>sub)\n\t\t{\n\t\t\tlong long int k=1<\nlong long int recurse(long long int h, long long int n,char flag)\n{\n\tif(h==0)\n\t\treturn 0;\n\tif(flag=='L')\n\t{\n\t\tlong long int sub;\n\t\tsub=1<<(h-1);\n\t\tif(n>sub)\n\t\t{\n\t\t\tlong long int k=1<\nlong long int recurse(long long int h, long long int n,char flag)\n{\n\tif(h==0)\n\t\treturn 0;\n\tif(flag=='L')\n\t{\n\t\tlong long int sub;\n\t\tsub=1<<(h-1);\n\t\tif(n>sub)\n\t\t{\n\t\t\tlong long int k=1<\n#include\nlong long powr(int a,int b)\n{\n\tint i;long long p=1;\n\tfor(i=0;i=0;c--)\n\t{\n\t\tk=n>>c;\n\t\tif(k&1)\n\t\ta[h-1-c]=1;\n\t\telse a[h-1-c]=0;\n\t}\n\tlong long ans=0;int j;\n\tfor(i=0;i\nint main(){\n\tint h,fl;\n\tlong long n,p,hal,offset,ans,size,i,max;\n\tscanf(\"%d %I64d\",&h,&n);\n\toffset=(1<>=1){\n//\t\tprintf(\"looping p=%llu\\n\",p);\n\t\tif(p>=max){\n\t\t\tprintf(\"Exceeded max\\n\");\n\t\t\tbreak;\n\t\t}\n\t\tif(fl==0){\n\t\t\tif(n>hal){\n\t\t\t\tfl=0;\n\t\t\t\tans+=size;\n\t\t\t\tp=(p<<1)+1;\n\t\t\t\thal+=size>>2;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tfl=1;\n\t\t\t\tans++;\n\t\t\t\tp<<=1;\n\t\t\t\thal-=size>>2;\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tif(n>hal){\n\t\t\t\tfl=0;\n\t\t\t\tans++;\n\t\t\t\tp=(p<<1)+1;\n\t\t\t\thal+=size>>2;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tfl=1;\n\t\t\t\tans+=size;\n\t\t\t\tp<<=1;\n\t\t\t\thal-=size>>2;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%I64d\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n#include \nint leaves_counter(int counter,int h ,int i,int f,int target)\n{\n int mid=(f+i)/2;//shmal 1 ymin 0\n static int leave=0;\n static int direction=1;\n if (counter>h)\n return 0;\n if (target>mid)\n {\n if (direction)\n {\n leave+=pow(2,h-counter+1);\n direction=1;\n }\n else\n {\n leave+=1;\n direction=1;\n }\n leaves_counter(counter+1,h,mid+1,f,target);\n }\n else\n {\n if (direction)\n {\n leave+=1;\n direction=0;\n }\n else\n {\n leave+=pow(2,h-counter+1);\n direction=0;\n }\n leaves_counter(counter+1,h,i,mid,target);\n }\n\n return leave;\n\n}\n\nint main()\n{\n int h,n;\n scanf(\"%d %d\",&h,&n);\n printf(\"%d\",leaves_counter(1,h,1,pow(2,h),n));\n return 0;\n}\n"}, {"source_code": "#include\n#include\n__int64 a[100];\n__int64 f(__int64 h, __int64 n){\n if(h == 0) return 0;\n if(h == 1 && n == 1) return 1;\n if(h == 1 && n == 2) return 2;\n if( n - pow(2, h - 1) < 1e-8 ) return f(h - 1, pow(2, h - 1) - n + 1) + 1;\n else return a[h] + 1 + f(h - 1, n - (pow(2, h - 1)) );\n}\nint main(){\n __int64 h, n;\n int i;\n a[1] = 1;\n for(i = 2; i <= 55; i ++){\n a[i] = a[i - 1] + pow(2, i - 1);\n }\n printf(\"%I64d\\n\",a[2]);\n while(scanf(\"%I64d%I64d\", &h, &n) != EOF){\n printf(\"%I64d\\n\", f(h, n));\n }\n return 0;\n}\n"}], "src_uid": "3dc25ccb394e2d5ceddc6b3a26cb5781"} {"nl": {"description": "One day Greg and his friends were walking in the forest. Overall there were n people walking, including Greg. Soon he found himself in front of a river. The guys immediately decided to get across the river. Luckily, there was a boat by the river bank, just where the guys were standing. We know that the boat can hold people with the total weight of at most k kilograms.Greg immediately took a piece of paper and listed there the weights of all people in his group (including himself). It turned out that each person weights either 50 or 100 kilograms. Now Greg wants to know what minimum number of times the boat needs to cross the river to transport the whole group to the other bank. The boat needs at least one person to navigate it from one bank to the other. As the boat crosses the river, it can have any non-zero number of passengers as long as their total weight doesn't exceed k.Also Greg is wondering, how many ways there are to transport everybody to the other side in the minimum number of boat rides. Two ways are considered distinct if during some ride they have distinct sets of people on the boat.Help Greg with this problem. ", "input_spec": "The first line contains two integers n, k (1 ≤ n ≤ 50, 1 ≤ k ≤ 5000) — the number of people, including Greg, and the boat's weight limit. The next line contains n integers — the people's weights. A person's weight is either 50 kilos or 100 kilos. You can consider Greg and his friends indexed in some way.", "output_spec": "In the first line print an integer — the minimum number of rides. If transporting everyone to the other bank is impossible, print an integer -1. In the second line print the remainder after dividing the number of ways to transport the people in the minimum number of rides by number 1000000007 (109 + 7). If transporting everyone to the other bank is impossible, print integer 0.", "sample_inputs": ["1 50\n50", "3 100\n50 50 100", "2 50\n50 50"], "sample_outputs": ["1\n1", "5\n2", "-1\n0"], "notes": "NoteIn the first test Greg walks alone and consequently, he needs only one ride across the river.In the second test you should follow the plan: transport two 50 kg. people; transport one 50 kg. person back; transport one 100 kg. person; transport one 50 kg. person back; transport two 50 kg. people. That totals to 5 rides. Depending on which person to choose at step 2, we can get two distinct ways."}, "positive_code": [{"source_code": "#include \n\n#define mod 1000000007\nlong long dp[55][55][205]={};\nlong long c[55][55]={};\nint n,lim,A=0,B=0,i,j,k,ii,jj;\nint min(int a,int b){return a=0;i--){\n\t\t\tfor(j=B;j>=0;j--){\n\t\t\t\tint s=k%2;\n\t\t\t\tdp[i][j][k]=0;\n\t\t\t\tif(s){\n\t\t\t\t\tfor(ii=i;ii<=A;ii++){\n\t\t\t\t\t\tint f=lim-(ii-i)*50;\n\t\t\t\t\t\tif(f>=0){\n\t\t\t\t\t\t\tf/=100;\n\t\t\t\t\t\t\tf+=j; f=min(f,B);\n\t\t\t\t\t\t\tfor(jj=j;jj<=f;jj++){\n\t\t\t\t\t\t\t\tif((i!=ii || j!=jj)){\n\t\t\t\t\t\t\t\t\tdp[i][j][k]+=(dp[ii][jj][k-1]*c[ii][ii-i]*c[jj][jj-j])%mod;\n\t\t\t\t\t\t\t\t\tdp[i][j][k]%=mod;\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}else{\n\t\t\t\t\tfor(ii=0;ii<=i;ii++){\n\t\t\t\t\t\tint f=lim-(i-ii)*50;\n\t\t\t\t\t\tif(f>=0){\n\t\t\t\t\t\t\tf/=100; f=max(j-f,0);\n\t\t\t\t\t\t\tfor(jj=f;jj<=j;jj++){\n\t\t\t\t\t\t\t\tif((i!=ii || j!=jj)){\n\t\t\t\t\t\t\t\t\tdp[i][j][k]+=(dp[ii][jj][k-1]*c[A-ii][i-ii]*c[B-jj][j-jj])%mod;\n\t\t\t\t\t\t\t\t\tdp[i][j][k]%=mod;\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(dp[0][0][k]){\n\t\t\t\t\tprintf(\"%d\\n\",k);\n\t\t\t\t\tprintf(\"%lld\\n\",dp[0][0][k]);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tputs(\"-1\\n0\");\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 \n\n#define mod 1000000007\nlong long dp[55][55][205]={};\nlong long c[55][55]={};\nint n,lim,A=0,B=0,i,j,k,ii,jj;\nint min(int a,int b){return a=0;i--){\n\t\t\tfor(j=B;j>=0;j--){\n\t\t\t\tint s=k%2;\n\t\t\t\tdp[i][j][s]=0;\n\t\t\t\tif(s){\n\t\t\t\t\tfor(ii=i;ii<=A;ii++){\n\t\t\t\t\t\tint f=lim-(ii-i)*50;\n\t\t\t\t\t\tif(f>=0){\n\t\t\t\t\t\t\tf/=100;\n\t\t\t\t\t\t\tf+=j; f=min(f,B);\n\t\t\t\t\t\t\tfor(jj=j;jj<=f;jj++){\n\t\t\t\t\t\t\t\tif((i!=ii || j!=jj)){\n\t\t\t\t\t\t\t\t\tdp[i][j][s]+=(dp[ii][jj][1-s]*c[ii][ii-i]*c[jj][jj-j])%mod;\n\t\t\t\t\t\t\t\t\tdp[i][j][s]%=mod;\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}else{\n\t\t\t\t\tfor(ii=0;ii<=i;ii++){\n\t\t\t\t\t\tint f=lim-(i-ii)*50;\n\t\t\t\t\t\tif(f>=0){\n\t\t\t\t\t\t\tf/=100; f=max(j-f,0);\n\t\t\t\t\t\t\tfor(jj=f;jj<=j;jj++){\n\t\t\t\t\t\t\t\tif((i!=ii || j!=jj)){\n\t\t\t\t\t\t\t\t\tdp[i][j][s]+=(dp[ii][jj][1-s]*c[A-ii][i-ii]*c[B-jj][j-jj])%mod;\n\t\t\t\t\t\t\t\t\tdp[i][j][s]%=mod;\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(dp[0][0][s]){\n\t\t\t\t\tprintf(\"%d\\n\",k);\n\t\t\t\t\tprintf(\"%lld\\n\",dp[0][0][s]);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tputs(\"-1\\n0\");\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// "}], "negative_code": [{"source_code": "#include\n#define mod 1000000007\nlong long dp[55][55][205]={};\nlong long c[55][55]={};\nint n,lim,A=0,B=0,i,j,k,ii,jj;\nint main(){\n\tscanf(\"%d %d\",&n,&lim);\n\tfor(i=0;i=0;i--){\n\t\t\tfor(j=B;j>=0;j--){\n\t\t\t\tif(k%2){\n\t\t\t\t\tfor(ii=i;ii<=A;ii++){\n int s=B>(lim-(ii-i)*50)/100?(lim-(ii-i)*50)/100:B;\n\t\t\t\t\t\tfor(jj=j;jj<=s;jj++){\n\t\t\t\t\t\t\tif((i!=ii || j!=jj)){\n\t\t\t\t\t\t\t\tdp[i][j][k]+=(dp[ii][jj][k-1]*c[ii][ii-i]*c[jj][jj-j])%mod;\n\t\t\t\t\t\t\t\tdp[i][j][k]%=mod;\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}else{\n\t\t\t\t\tfor(ii=0;ii<=i;ii++){\n\t\t\t\t\t\tfor(jj=0;jj<=j;jj++){ \n\t\t\t\t\t\t\tif((i!=ii || j!=jj) && (i-ii)*50+(j-jj)*100<=lim){\n\t\t\t\t\t\t\t\tdp[i][j][k]+=(dp[ii][jj][k-1]*c[A-ii][i-ii]*c[B-jj][j-jj])%mod;\n\t\t\t\t\t\t\t\tdp[i][j][k]%=mod;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tfor(k=1;k<=n*4;k++){\n\t\tif(dp[0][0][k]){\n\t\t\tprintf(\"%d\\n\",k);\n\t\t\tprintf(\"%lld\\n\",dp[0][0][k]);\n\t\t\treturn 0;\n\t\t}\n\t}\n\tputs(\"-1\\n0\");\n}"}, {"source_code": "#include \n#define mod 1000000007\nlong long dp[55][55][205]={};\nlong long c[55][55]={};\nint n,lim,A=0,B=0,i,j,k,ii,jj;\nint min(int a,int b){return a=0;i--){\n\t\t\tfor(j=B;j>=0;j--){\n\t\t\t\tint s=k%2;\n\t\t\t\tdp[i][j][s]=0;\n\t\t\t\tif(s){\n\t\t\t\t\tfor(ii=i;ii<=A;ii++){\n\t\t\t\t\t\tint f=lim-(ii-i)*50;\n\t\t\t\t\t\tf/=100;\n\t\t\t\t\t\tf+=j; f=min(f,B);\n\t\t\t\t\t\tfor(jj=j;jj<=f;jj++){\n\t\t\t\t\t\t\tif((i!=ii || j!=jj)){\n\t\t\t\t\t\t\t\tdp[i][j][s]+=(dp[ii][jj][1-s]*c[ii][ii-i]*c[jj][jj-j])%mod;\n\t\t\t\t\t\t\t\tdp[i][j][s]%=mod;\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}else{\n\t\t\t\t\tfor(ii=0;ii<=i;ii++){\n\t\t\t\t\t\tint f=lim-(i-ii)*50;\n\t\t\t\t\t\tf/=100;\n\t\t\t\t\t\tf=j-f; f=max(f,0);\n\t\t\t\t\t\tfor(jj=0;jj<=f;jj++){\n\t\t\t\t\t\t\tif((i!=ii || j!=jj)){\n\t\t\t\t\t\t\t\tdp[i][j][s]+=(dp[ii][jj][1-s]*c[A-ii][i-ii]*c[B-jj][j-jj])%mod;\n\t\t\t\t\t\t\t\tdp[i][j][s]%=mod;\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(dp[0][0][s]){\n\t\t\t\t\tprintf(\"%d\\n\",k);\n\t\t\t\t\tprintf(\"%lld\\n\",dp[0][0][s]);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tputs(\"-1\\n0\");\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// "}], "src_uid": "ebb0323a854e19794c79ab559792a1f7"} {"nl": {"description": "Maxim loves to fill in a matrix in a special manner. Here is a pseudocode of filling in a matrix of size (m + 1) × (m + 1):Maxim asks you to count, how many numbers m (1 ≤ m ≤ n) are there, such that the sum of values in the cells in the row number m + 1 of the resulting matrix equals t.Expression (x xor y) means applying the operation of bitwise excluding \"OR\" to numbers x and y. The given operation exists in all modern programming languages. For example, in languages C++ and Java it is represented by character \"^\", in Pascal — by \"xor\".", "input_spec": "A single line contains two integers n and t (1 ≤ n, t ≤ 1012, t ≤ n + 1). 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": "In a single line print a single integer — the answer to the problem. ", "sample_inputs": ["1 1", "3 2", "3 3", "1000000000000 1048576"], "sample_outputs": ["1", "1", "0", "118606527258"], "notes": null}, "positive_code": [{"source_code": "/* practice with Dukkha */\n#include \n\nlong long ch(int n, int k) {\n\treturn k == 0 ? 1 : ch(n - 1, k - 1) * n / k;\n}\n\nint main() {\n\tlong long n, m, t, ans;\n\tint k, b, l;\n\n\tscanf(\"%lld%lld\", &n, &t), n += 2;\n\tif (t & t - 1) {\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\tk = 0;\n\twhile (t > 0) {\n\t\tk++;\n\t\tt >>= 1;\n\t}\n\tb = 0;\n\tfor (m = n; m > 1; m >>= 1)\n\t\tb++;\n\tans = 0;\n\tfor (l = 0; b >= 0; b--)\n\t\tif (n & 1LL << b) {\n\t\t\tif (b >= k - l)\n\t\t\t\tans += ch(b, k - l);\n\t\t\tif (++l > k)\n\t\t\t\tbreak;\n\t\t}\n\tif (k == 1)\n\t\tans--;\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n\n#define mset(a) memset(a,0,sizeof(a))\n#define mcpy(a,b) memcpy(a,b,sizeof(a))\n#define mcmp(a,b,n) memcmp(a,b,n)\n#define maxint 2147483647\n#define pi 3.14159265358979323846\n\nlong long n,t,ans=0,k;\nlong long a[111],cnk[111][111];\n\nlong long turn(long long t)\n{\n long long i=0;\n \n if(t&(t-1))\n return -1;\n \n while(t>>=1)\n i++;\n return i;\n}\n\nint main()\n{\n int i,j,l;\n \n a[0]=1;\n for(i=1;i<63;i++)\n a[i]=a[i-1]<<1;\n mset(cnk);\n for(i=0;i<111;i++)\n {\n cnk[i][0]=1;\n for(j=1;j<=i;j++)\n cnk[i][j]=cnk[i-1][j-1]+cnk[i-1][j];\n }\n \n scanf(\"%I64d%I64d\",&n,&t);\n \n k=turn(t);\n if(k==-1)\n {\n printf(\"0\\n\");\n return 0;\n }\n \n for(i=1;n>a[i];i++)\n {\n ans+=cnk[i][k];\n n-=a[i];\n }\n for(i=62;i>=0;i--)\n if((~k)&&(n>>i&1))\n {\n ans+=cnk[i][k];\n k--;\n }\n \n printf(\"%I64d\\n\",ans);\n \n //system(\"pause\");\n return 0;\n}\n\n\n"}, {"source_code": "#include\n#include\n#include\n#include\n\n#define mset(a) memset(a,0,sizeof(a))\n#define mcpy(a,b) memcpy(a,b,sizeof(a))\n#define mcmp(a,b,n) memcmp(a,b,n)\n#define maxint 2147483647\n#define pi 3.14159265358979323846\n\nlong long n,t,ans=0,k;\nlong long a[111],cnk[111][111];\n\nlong long turn(long long t)\n{\n long long i=0;\n \n if(t&(t-1))\n return -1;\n \n while(t>>=1)\n i++;\n return i;\n}\n\nint main()\n{\n int i,j,l;\n \n a[0]=1;\n for(i=1;i<63;i++)\n a[i]=a[i-1]<<1;\n mset(cnk);\n for(i=0;i<111;i++)\n {\n cnk[i][0]=1;\n for(j=1;j<=i;j++)\n cnk[i][j]=cnk[i-1][j-1]+cnk[i-1][j];\n }\n \n scanf(\"%I64d%I64d\",&n,&t);\n \n k=turn(t);\n if(k==-1)\n {\n printf(\"0\\n\");\n return 0;\n }\n \n for(i=1;n>a[i];i++)\n {\n ans+=cnk[i][k];\n n-=a[i];\n }\n for(i=62;i>=0;i--)\n if((~k)&&(n>>i&1))\n {\n ans+=cnk[i][k];\n k--;\n }\n \n printf(\"%I64d\\n\",ans);\n \n //system(\"pause\");\n return 0;\n}\n\n\n"}], "negative_code": [{"source_code": "#include\n#include\n#include\n#include\n\n#define mset(a) memset(a,0,sizeof(a))\n#define mcpy(a,b) memcpy(a,b,sizeof(a))\n#define mcmp(a,b,n) memcmp(a,b,n)\n#define maxint 2147483647\n#define pi 3.14159265358979323846\n\nlong long n,t,ans=0,k;\nlong long a[111],cnk[111][111];\n\nlong long turn(long long t)\n{\n long long i=0;\n \n if(t&(t-1))\n return -1;\n \n while(t>>=1)\n i++;\n return i;\n}\n\nint main()\n{\n int i,j,l;\n \n a[0]=1;\n for(i=1;i<63;i++)\n a[i]=a[i-1]<<1;\n mset(cnk);\n for(i=0;i<111;i++)\n {\n cnk[i][0]=1;\n for(j=1;j<=i;j++)\n cnk[i][j]=cnk[i-1][j-1]+cnk[i-1][j];\n }\n \n scanf(\"%I64d%I64d\",&n,&t);\n \n k=turn(t);\n if(k==-1)\n {\n printf(\"0\\n\");\n return 0;\n }\n \n for(i=1;n>a[i];i++)\n {\n ans+=cnk[i][k];\n n-=a[i];\n }\n for(i=62;i>0;i--)\n if((~k)&&(n>>i&1))\n {\n ans+=cnk[i][k];\n k--;\n }\n \n printf(\"%I64d\\n\",ans);\n \n //system(\"pause\");\n return 0;\n}\n\n\n"}], "src_uid": "727d5b601694e5e0f0cf3a9ca25323fc"} {"nl": {"description": "You are given a string $$$s$$$ of length $$$n$$$ consisting of lowercase Latin letters. You may apply some operations to this string: in one operation you can delete some contiguous substring of this string, if all letters in the substring you delete are equal. For example, after deleting substring bbbb from string abbbbaccdd we get the string aaccdd.Calculate the minimum number of operations to delete the whole string $$$s$$$.", "input_spec": "The first line contains one integer $$$n$$$ ($$$1 \\le n \\le 500$$$) — the length of string $$$s$$$. The second line contains the string $$$s$$$ ($$$|s| = n$$$) consisting of lowercase Latin letters.", "output_spec": "Output a single integer — the minimal number of operation to delete string $$$s$$$.", "sample_inputs": ["5\nabaca", "8\nabcddcba"], "sample_outputs": ["3", "4"], "notes": null}, "positive_code": [{"source_code": "#include \n\n#define N\t500\n\nint main() {\n\tstatic char s[N + 1];\n\tstatic int dp[N][N];\n\tint n, h, i, j;\n\n\tscanf(\"%d%s\", &n, s);\n\tfor (i = 0, j = 1; j < n; j++)\n\t\tif (s[i] != s[j])\n\t\t\ts[++i] = s[j];\n\tn = i + 1;\n\tfor (i = 0; i < n; i++)\n\t\tdp[i][i] = 1;\n\tfor (i = n - 1; i >= 0; i--)\n\t\tfor (j = i + 1; j < n; j++) {\n\t\t\tdp[i][j] = 1 + dp[i][j - 1];\n\t\t\tfor (h = j - 1; h >= i; h--)\n\t\t\t\tif (s[h] == s[j]) {\n\t\t\t\t\tint x = dp[i][h] + dp[h + 1][j - 1];\n\n\t\t\t\t\tif (dp[i][j] > x)\n\t\t\t\t\t\tdp[i][j] = x;\n\t\t\t\t}\n\t\t}\n\tprintf(\"%d\\n\", dp[0][n - 1]);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\n\nint n;\nchar str[501];\nint dp[501][501] = {0};\n\nint min(int x,int y){return x\n#include\n#include\n#include\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 MIN(a,b) ((a)<(b)?(a):(b))\n#define ALLOC(size,type) ((type*)calloc((size),sizeof(type)))\n\n#define POS(i, j) ((i) * (n + 1) + (j))\n\nvoid run (void) {\n i32 n = read_int();\n char *s = ALLOC (n + 1, char);\n scanf (\"%s\", s);\n i32 *dp = ALLOC ((n + 1) * (n + 1), i32);\n for (i32 len = 1; len <= n; ++len) {\n for (i32 l = 0; l <= n - len; ++l) {\n i32 r = l + len;\n i32 min = 1 + dp[POS(l + 1, r)];\n for (i32 i = l + 1; i < r; ++i) {\n if (s[i] != s[l]) continue;\n min = MIN (min, dp[POS(l + 1, i)] + dp[POS(i, r)]);\n }\n dp[POS(l, r)] = min;\n }\n }\n print_int (dp[POS(0, n)]);\n puts (\"\");\n}\n\nint main (void) {\n run ();\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\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 MIN(a,b) ((a)<(b)?(a):(b))\n\n#define POS(i, j) ((i) * (n + 1) + (j))\n\nvoid run (void) {\n i32 n = read_int();\n char *s = (char *) calloc (n + 1, sizeof (char));\n scanf (\"%s\", s);\n i32 len = 1;\n for (i32 i = 1; i < n; ++i) {\n if (s[i] == s[len - 1]) continue;\n s[len++] = s[i];\n }\n s[len] = '\\0';\n n = len;\n i32 *dp = (i32 *) calloc ((n + 1) * (n + 1), sizeof (i32));\n for (i32 len = 1; len <= n; ++len) {\n for (i32 l = 0; l < n + 1 - len; ++l) {\n i32 r = l + len;\n i32 min = 1 + dp[POS(l + 1, r)];\n for (i32 j = l + 1; j < r; ++j) {\n if (s[j] != s[l]) continue;\n min = MIN(min, dp[POS(l + 1, j)] + dp[POS(j, r)]);\n }\n dp[POS(l, r)] = min;\n }\n }\n print_int (dp[POS(0, n)]);\n puts(\"\");\n}\n\nint main (void) {\n run ();\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\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 POS(i, j) ((i) * (n + 1) + (j))\n\nvoid run (void) {\n i32 n = read_int();\n char *s = (char *) calloc (n + 1, sizeof (char));\n scanf (\"%s\", s);\n i32 *dp = (i32 *) calloc ((n + 1) * (n + 1), sizeof (i32));\n for (i32 len = 1; len <= n; ++len) {\n for (i32 l = 0; l + len <= n; ++l) {\n i32 r = l + len;\n i32 min = 1 + dp[POS(l + 1, r)];\n for (i32 i = l + 1; i < r; ++i) {\n if (s[l] != s[i]) continue;\n i32 d = dp[POS(l + 1, i)] + dp[POS(i, r)];\n min = min > d ? d : min;\n }\n dp[POS(l, r)] = min;\n }\n }\n print_int (dp[POS(0, n)]);\n puts (\"\");\n}\n\nint main (void) {\n run ();\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\n#define MAXN 500\n\nchar s[MAXN+1];\n\nint dp[MAXN+1][MAXN+1];\n\nvoid print_substr(FILE* fp, char* s, int i, int j) {\n char ch = s[j];\n s[j] = '\\0';\n fprintf(fp, \"%s\", s+i);\n s[j] = ch;\n}\n\nint min(int a, int b) {\n return a\n\n#define N\t500\n\nint main() {\n\tstatic char s[N + 1];\n\tstatic int dp[N][N];\n\tint n, h, i, j;\n\n\tscanf(\"%d%s\", &n, s);\n\tfor (i = 0, j = 1; j < n; j++)\n\t\tif (s[i] != s[j])\n\t\t\ts[++i] = s[j];\n\tn = i + 1;\n\tfor (i = 0; i < n; i++)\n\t\tdp[i][i] = 1;\n\tfor (i = n - 1; i >= 0; i--)\n\t\tfor (j = i + 1; j < n; j++) {\n\t\t\tdp[i][j] = 1 + dp[i][j - 1];\n\t\t\tfor (h = j - 1; h >= i && s[h] != s[j]; h--)\n\t\t\t\t;\n\t\t\tif (h >= i) {\n\t\t\t\tint x = dp[i][h] + dp[h + 1][j - 1];\n\n\t\t\t\tif (dp[i][j] > x)\n\t\t\t\t\tdp[i][j] = x;\n\t\t\t}\n\t\t}\n\tprintf(\"%d\\n\", dp[0][n - 1]);\n\treturn 0;\n}\n"}], "src_uid": "516a89f4d1ae867fc1151becd92471e6"} {"nl": {"description": "Not long ago Billy came across such a problem, where there were given three natural numbers A, B and C from the range [1, N], and it was asked to check whether the equation AB = C is correct. Recently Billy studied the concept of a digital root of a number. We should remind you that a digital root d(x) of the number x is the sum s(x) of all the digits of this number, if s(x) ≤ 9, otherwise it is d(s(x)). For example, a digital root of the number 6543 is calculated as follows: d(6543) = d(6 + 5 + 4 + 3) = d(18) = 9. Billy has counted that the digital root of a product of numbers is equal to the digital root of the product of the factors' digital roots, i.e. d(xy) = d(d(x)d(y)). And the following solution to the problem came to his mind: to calculate the digital roots and check if this condition is met. However, Billy has doubts that this condition is sufficient. That's why he asks you to find out the amount of test examples for the given problem such that the algorithm proposed by Billy makes mistakes.", "input_spec": "The first line contains the only number N (1 ≤ N ≤ 106).", "output_spec": "Output one number — the amount of required A, B and C from the range [1, N].", "sample_inputs": ["4", "5"], "sample_outputs": ["2", "6"], "notes": "NoteFor the first sample the required triples are (3, 4, 3) and (4, 3, 3)."}, "positive_code": [{"source_code": "#include \n\nint main()\n{\n int n, i, j;\n long long sum = 0;\n int a[9] = {0};\n\n scanf(\"%d\", &n);\n\n for (i = 0; i < 9; i++) {\n\t a[(i + 1) % 9] = n / 9;\n\n\t if (n % 9 > i) a[(i + 1) % 9]++;\n }\n\n for (i = 0; i < 9; i++) {\n\t for (j = 0; j < 9; j++) {\n\t sum += (long long)a[i] * a[j] * a[i * j % 9];\n\t }\n }\n\n for (i = 1; i <= n; i++) sum -= n / i;\n\n printf(\"%I64d\\n\", sum);\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#define LL long long\nint d(int x)\n{\n if(x%9==0)\n return 9;\n else\n return x%9;\n}\nint main()\n{\n int i,j,k;\n LL s=0;\n int n,a[10]={0};\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++)\n a[d(i)]++;\n for(i=1;i<=9;i++)\n for(j=1;j<=9;j++)\n for(k=1;k<=9;k++)\n if(d(i*j)==k)\n s+=(LL)a[i]*a[j]*a[k];\n for(i=1;i<=n;i++)\n for(j=1;i*j<=n;j++)\n if(d(d(i)*d(j))==d(i*j))\n s--;\n printf(\"%I64d\\n\",s);\n return 0;\n}\n\n \t\t\t\t \t\t \t\t \t \t\t\t \t"}, {"source_code": "#include \n\nint main() {\n\tstatic int kk[10];\n\tlong long sum;\n\tint n, d, a, b;\n\n\tscanf(\"%d\", &n);\n\tfor (d = 1; d <= 9; d++)\n\t kk[d] = n / 9 + (n % 9 >= d);\n\tsum = 0;\n\tfor (a = 1; a <= 9; a++)\n\t\tfor (b = 1; b <= 9; b++)\n\t\t\tsum += (long long) kk[a] * kk[b] * kk[(a * b + 8) % 9 + 1];\n\tfor (a = 1; a <= n; a++)\n\t\tsum -= n / a;\n\tprintf(\"%lld\\n\", sum);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nunsigned long long f[9],g[9];\n\n// digital root je zapravo modul od 9.\n// ako je mod 9 == 0, digtalni root je 9.\n\nint main() {\n\tunsigned long long a,b,n;\n\tscanf(\"%lld\\n\",&n);\n\tfor (a=1;a<=n;a++) f[a%9]++;\n\tunsigned long long cnt=0;\n\tfor (a=0;a<9;a++)\n\t\tfor (b=0;b<9;b++)\n\t\t\tcnt+=f[a]*f[b]*f[a*b%9];\n\tfor (a=1;a*a<=n;a++)\n\t\tcnt-=(n-a*a)/a*2+1;\n\tprintf(\"%lld\\n\",cnt);\n\treturn 0;\n}\n"}, {"source_code": "#include \nint main(){\n int n ,i,j;\n scanf(\"%d\",&n);\n int r = n % 9;\n int a[9];\n for(i=0;i<9;i++){\n if( i <=r && i != 0 )\n a[i] = n / 9 +1 ;\n else \n a[i] = n /9 ;\n }\n long long ans=0;\n for(i=0;i<9;i++)\n for(j=i+1;j<9;j ++ )\n ans += (long long) a[i]*a[j]*a[i*j%9];\n\n ans *=2;\n for(i=0;i<9;i++)\n ans+=(long long) a[i]*a[i]*a[i*i%9];\n \n for(i =1;i*i<=n;i++){\n int m = n / i - (i-1) ;\n ans -= 2*m - 1;\n }\n\n printf(\"%I64d\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#define REP(i,a,b) for(i=a;i\n#include\n#include\n#define REP(i,a,b) for(i=a;i\n#define N 1123\n#define M 170\n#define K 1000\n#define L 200\n\nlong long a[10];\nlong long aa[10];\nlong long b[10];\nint c[M];\nint cc[M];\nchar d[N];\nint next[N];\nint pre[N];\nlong long output;\nlong long temp;\nint record[N][M];\nint store;\n\nvoid prime( int n )\n{\n int i, o, p, j, l, k;\n for (i = 0;i<=n+10;++i) \n {\n d[i] = 1;\n next[i] = i+1;\n pre[i] = i-1; \n }\n d[0] = 0; d[1] = 0;\n for (i=2;i<=n;i=next[i])\n {\n for (j=next[i];j<=n;j=next[j])\n if (j%i == 0) \n {\n p = pre[j];\n next[p] = next[j];\n pre[next[j]] = p;\n d[j] = 0;\n }\n }\n c[0] = 0;\n for (i=0;i<=n;++i) \n if (d[i] == 1)\n {\n c[++c[0]] = i;\n }\n}\n\n\nvoid shu_chu( long long k )\n{\n int a[100];\n int i, j;\n i = 0;\n if (k==0)\n {\n printf(\"0\\n\" );\n return;\n }\n while(k!=0)\n {\n a[i++] = k%10;\n k = k/10;\n }\n while( i>0 ) printf( \"%d\", a[--i] );\n printf( \"\\n\" );\n}\n\nmain()\n{\n int i, o, p, j, k, l, n, m, q;\n \n int boring[100]; \n\n scanf( \"%d\", &n );\n \n if (n==1) {printf( \"0\\n\" ); return 0;}\n \n boring[0] = 0;\n for (i=1;i<100;++i) \n {\n boring[i]=boring[i-1]+1;\n if (boring[i] ==10) boring[i] = 1;\n } \n\n prime( K );\n \n for (i=0;i<10;++i) {a[i] = 0; b[i] = 0;}\n a[1] = 1; b[1] = 1;\n for (i=0;i<10;++i) \n for (j=0;jK || p==i)\n while( p%c[j] == 0 )\n {\n ++cc[j]; \n p /= c[j];\n }\n }\n\n if (p>K) temp*=2; \n\n for (j=1;j<=c[0];++j) \n {\n if (p<=K) cc[j] += record[p][j];\n temp *= (long long)(cc[j]+1);\n if (i<=K) record[i][j] = cc[j];\n } \n \n temp -= 2;\n//printf(\" temp = %d %lld\\n\", i, temp );\n for (j=0;j<=9;++j) aa[j] = (long long)0;\n for (j=0;j<=9;++j)\n {\n p = boring[store*j];\n aa[p] += a[j];\n } \n //++a[dd(j)];\n for (j=0;j<=9;++j) output+=(long long)2*a[j]*aa[j]; //2 usual\n \n output += aa[store] * (long long)2; //2 special \n\n output -= (long long)2;\n\n ++a[store];\n\n p = boring[store*store];\n output += a[p]; //3 \n \n output += b[store] - temp; //1\n for (j=0;j<=9;++j) b[j] += aa[j] * 2;\n\n b[p] += (long long)1;\n\n }\n \n// printf( \"%lld\\n\", output );\n shu_chu( output );\n return 0;\n} \n \n \n\n\n\n\n"}, {"source_code": "#include\n\nlong long n, a[9], result=0, i, j;\n\nint main(){\n scanf(\"%I64d\", &n);\n for(i=1; i<=n; i++){\n a[i%9]++;\n result-=n/i;\n }\n for(i=0; i<9; i++)\n for(j=0; j<9; j++)\n result+=a[i]*a[j]*a[i*j%9];\n\n printf(\"%I64d\\n\", result);\n\n return 0;\n}\n\n\n\n"}, {"source_code": "#include \n#include \n#include \n\nint GetD (int n)\n{\n int now = n;\n while (now > 9)\n {\n int temp = 0;\n while (now > 0)\n {\n temp += (now % 10);\n now /= 10;\n }\n now = temp;\n }\n return now;\n}\n\nint main ()\n{\n int N;\n scanf(\"%d\",&N);\n static int cnt[10];\n memset(cnt,0,sizeof(cnt));\n int i;\n for (i = 1; i <= N; i++)\n {\n cnt[GetD(i)]++;\n }\n long long int res = 0;\n int j, k;\n for (j = 0; j <= 9; j++)\n {\n for (k = 0; k <= 9; k++)\n {\n i = GetD(j*k);\n res += ((long long int)(cnt[i]) * (long long int)(cnt[j]) * (long long int)(cnt[k]));\n }\n }\n\n /*\n for (i = 1; i <= N; i++)\n {\n for (j = 1; (j*j) <= i; j++)\n {\n if ((i % j) == 0)\n {\n res--;\n if ((j*j) < i)\n {\n res--;\n }\n }\n }\n }\n */\n \n for (i = 1; i <= N; i++)\n {\n res -= (long long int)(N / i);\n }\n \n printf(\"%I64i\\n\",res);\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#define REP(i,a,b) for(i=a;i\n\nint digit(int n)\n{\n int sum = 0;\n\n while (n) {\n\t sum += n % 10;\n\t n /= 10;\n }\n\n if (sum < 10) {\n\t return sum;\n } else {\n\t return digit(sum);\n }\n}\n\nint main()\n{\n int n, sum = 0, i, j;\n\n scanf(\"%d\", &n);\n\n for (i = 1; i <= n && i < 10; i++) {\n\t for (j = 1; j <= n && j < 10; j++) {\n\t if (i * j >= 10 && digit(i * j) <= n) sum++;\n\t }\n }\n\n printf(\"%d\\n\", sum);\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n\tstatic int kk[10];\n\tlong long sum;\n\tint n, d, a, b;\n\n\tscanf(\"%d\", &n);\n\tfor (d = 1; d <= 9; d++)\n\t kk[d] = n / 9 + ((n + 8) % 9 + 1 >= d);\n\tsum = 0;\n\tfor (a = 1; a <= 9; a++)\n\t\tfor (b = 1; b <= 9; b++)\n\t\t\tsum += (long long) kk[a] * kk[b] * kk[(a * b + 8) % 9 + 1];\n\tfor (a = 1; a <= n; a++)\n\t\tsum -= n / a;\n\tprintf(\"%lld\\n\", sum);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint f[9],g[9];\n\n// digital root je zapravo modul od 9.\n// ako je mod 9 == 0, digtalni root je 9.\n\nint main() {\n\tlong long a,b,n;\n\tscanf(\"%lld\\n\",&n);\n\tfor (a=1;a<=n;a++) f[a%9]++;\n\tlong long cnt=0;\n\tfor (a=0;a<9;a++)\n\t\tfor (b=0;b<9;b++)\n\t\t\tcnt+=f[a]*f[b]*f[a*b%9];\n\tfor (a=1;a*a<=n;a++)\n\t\tcnt-=(n-a*a)/a*2+1;\n\tprintf(\"%lld\\n\",cnt);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\n#define N 5\n\nint f[9],g[9];\n\n// digital root je zapravo modul od 9.\n// ako je mod 9 == 0, digtalni root je 9.\n\nint main() {\n\tlong long a,b,c,d;\n\tfor (a=1;a<=N;a++) f[a%9]++;\n\tlong long cnt=0;\n\tfor (a=0;a<9;a++)\n\t\tfor (b=0;b<9;b++)\n\t\t\tcnt+=f[a]*f[b]*f[a*b%9];\n\tfor (a=1;a*a<=N;a++)\n\t\tcnt-=(N-a*a)/a*2+1;\n\tprintf(\"%lld\\n\",cnt);\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#define REP(i,a,b) for(i=a;i\n#include\n#include\n#define REP(i,a,b) for(i=a;i\n#define N 1123456\n#define M 112233\n\nlong long a[10];\nlong long aa[10];\nlong long b[10];\nint c[M];\nint cc[M];\nchar d[N];\nlong long output;\nlong long temp;\n\nvoid prime( int n )\n{\n int i, o, p, j, k, l;\n for (i = 0;i<=n;++i) d[i] = 1;\n d[0] = 0; d[1] = 0;\n for (i=2;i<=n;++i)\n {\n if (d[i]==1)\n {\n for (j=i+1;j<=n;++j) \n if (j%i == 0) d[j] = 0;\n }\n }\n c[0] = 0;\n for (i=0;i<=n;++i) \n if (d[i] == 1)\n {\n c[++c[0]] = i;\n//printf( \"p = %d\\n\", i );\n }\n}\n\nint dd(int x )\n{\n int p;\n while( x>=10 )\n {\n p = 0;\n while (x>0) \n {\n p += x%10;\n x = x/10;\n }\n x = p;\n }\n return( x );\n}\n\nint ddd(long long x )\n{\n long long p;\n while( x>=(long long)10 )\n {\n p = 0;\n while (x>0) \n {\n p += x%10;\n x = x/10;\n }\n x = p;\n }\n return( (int)x );\n}\n\n\nmain()\n{\n int i, o, p, j, k, l, n, m, q;\n scanf( \"%d\", &n );\n if (n==1) {printf( \"0\\n\" ); return 0;}\n prime( n );\n for (i=0;i<10;++i) {a[i] = 0; b[i] = 0;}\n a[1] = 1; b[1] = 1;\n \n for (i=2;i<=n;++i)\n {\n p = i;\n temp = (long long)1;\n for (j=1;j<=c[0];++j) \n {\n q = 0;\n while( p%c[j] == 0 )\n {\n ++q; \n p /= c[j];\n//printf(\"%d %d\\n\", p, j );\n }\n ++q;\n//if (c[j]==i) cc[j] = 0;\n temp *= (long long)q;\n }\ntemp -= 2;\n//printf(\" temp = %d %lld\\n\", i, temp );\n for (j=0;j<=9;++j) aa[j] = (long long)0;\n for (j=0;j<=9;++j)\n {\n aa[dd(j*i)] += a[j];\n } \n //++a[dd(j)];\n for (j=0;j<=9;++j) output+=(long long)2*a[j]*aa[j]; //2 usual\n \n output += aa[dd(i)] * (long long)2; //2 special \n\n output -= (long long)2;\n\n ++a[dd(i)];\n\n output += a[ddd((long long)i*(long long)i)]; //3 \n \n output += b[dd(i)] - temp; //1\n for (j=0;j<=9;++j) b[j] += aa[j] * 2;\n b[ddd((long long)i*(long long)i)] += (long long)1;\n }\n \n printf( \"%lld\\n\", output );\n return 0;\n} \n \n \n\n\n\n\n"}, {"source_code": "#include\n\nlong long n, a[9], result=0, i, j;\n\nint main(){\n scanf(\"%l64d\", &n);\n for(i=1; i<=n; i++){\n a[i%9]++;\n result-=n/i;\n }\n for(i=0; i<9; i++)\n for(j=0; j<9; j++)\n result+=a[i]*a[j]*a[i*j%9];\n\n printf(\"%l64d\\n\", result);\n\n return 0;\n}\n\n\n\n"}, {"source_code": "#include \n#include \n#include \n\nint GetD (int n)\n{\n int now = n;\n while (now > 9)\n {\n int temp = 0;\n while (now > 0)\n {\n temp += (now % 10);\n now /= 10;\n }\n now = temp;\n }\n return now;\n}\n\nint main ()\n{\n int N;\n scanf(\"%d\",&N);\n static int cnt[10];\n memset(cnt,0,sizeof(cnt));\n int i;\n for (i = 1; i <= N; i++)\n {\n cnt[GetD(i)]++;\n }\n long long int res = 0;\n int j, k;\n for (j = 0; j <= 9; j++)\n {\n for (k = 0; k <= 9; k++)\n {\n i = GetD(j*k);\n res += (long long int)(cnt[i] * cnt[j] * cnt[k]);\n }\n }\n for (i = 1; i <= N; i++)\n {\n for (j = 1; (j*j) <= i; j++)\n {\n if ((i % j) == 0)\n {\n res--;\n //printf(\"%d = %d * %d\\n\",i,j,i/j);\n if ((j*j) < i)\n {\n res--;\n //printf(\"%d = %d * %d\\n\",i,i/j,j);\n }\n }\n }\n }\n printf(\"%I64i\\n\",res);\n return 0;\n}\n"}], "src_uid": "fc133fe6353089a0ebee08dec919f608"} {"nl": {"description": "Neko loves divisors. During the latest number theory lesson, he got an interesting exercise from his math teacher.Neko has two integers $$$a$$$ and $$$b$$$. His goal is to find a non-negative integer $$$k$$$ such that the least common multiple of $$$a+k$$$ and $$$b+k$$$ is the smallest possible. If there are multiple optimal integers $$$k$$$, he needs to choose the smallest one.Given his mathematical talent, Neko had no trouble getting Wrong Answer on this problem. Can you help him solve it?", "input_spec": "The only line contains two integers $$$a$$$ and $$$b$$$ ($$$1 \\le a, b \\le 10^9$$$).", "output_spec": "Print the smallest non-negative integer $$$k$$$ ($$$k \\ge 0$$$) such that the lowest common multiple of $$$a+k$$$ and $$$b+k$$$ is the smallest possible. If there are many possible integers $$$k$$$ giving the same value of the least common multiple, print the smallest one.", "sample_inputs": ["6 10", "21 31", "5 10"], "sample_outputs": ["2", "9", "0"], "notes": "NoteIn the first test, one should choose $$$k = 2$$$, as the least common multiple of $$$6 + 2$$$ and $$$10 + 2$$$ is $$$24$$$, which is the smallest least common multiple possible."}, "positive_code": [{"source_code": "#include \n#define lli long long int\ndouble sqrt(double i){\n\tdouble a = 2.0;\n\tint k = 100;\n\twhile(k-->0){\n\t\ta = (a+i/a)/2.0;\n\t}\n\treturn a;\n}\nint main(void){\n\tlli a,b;\n\tscanf(\"%lld %lld\",&a,&b);\n\tif(a == b){\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\tif(a > b){\n\t\tint ch = a;\n\t\ta = b;\n\t\tb = ch;\n\t}\n\tlli q = b - a;\n\tlli j = a/q;\n\tif(q*j < a)\n\t\tj++;\n\tq *=j;\n\tint za = 0;\n\tint rq = sqrt(q);\n\tint me = 1;\n\tint meb = q;\n\twhile((++za) = a)\n\t\t\t\tbreak;\n\t\t\tif((q/za)>=a)\n\t\t\t\tmeb = q/za;\n\t\t\telse\n\t\t\t\tbreak;\n\t\t}\n\t}\n\tif(me < a)\n\t\tza = meb;\n\telse\n\t\tza = me;\n\tlli k = za - a;\n\tprintf(\"%lld\\n\",k);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\ntypedef long long int lli;\n\n#define TRUE (1==1)\n#define FALSE (!TRUE)\n\n#define fo3(a,b,c) for(a=(int)(b);a<=(int)(c);a++)\n#define of3(a,b,c) for(a=(int)(b);a>=(int)(c);a--)\n#define in32(a) scanf(\"%d\",&(a))\n#define in64(a) scanf(\"%I64d\",&(a))\n#define out32(a) printf(\"%d\\n\",(a))\n#define out64(a) printf(\"%I64d\\n\",(a))\n#define instr(a) scanf(\"%s\",(a))\n#define outstr(a) printf(\"%s\\n\",(a))\n#define max(a,b) (((a)<(b))?(b):(a))\n#define min(a,b) (((a)>(b))?(b):(a))\n\nlli gcd(lli a, lli b) {\n return (b == 0) ? a : gcd(b, a % b);\n}\nlli lcm(lli a, lli b) {\n lli g = gcd(a, b);\n return a * (b / g);\n}\n\nint facts(lli val, lli * arr, int st) {\n if (val == 1) {\n arr[0] = 1;\n return 1;\n }\n int i = st,k;\n while (i * i <= val) {\n if (val % i == 0) {\n int pow = 0;\n while (val % i == 0) {\n pow ++;\n val/=i;\n }\n int cur = facts(val,arr,i+1);\n int res = cur * (pow + 1);\n fo3(k,cur,res-1)\n arr[k] = arr[k-cur]*i;\n return res;\n }\n i++;\n }\n arr[0] = 1;\n arr[1] = val;\n return 2;\n}\n\nint main(void)\n{\n lli x, y;\n int i;\n in64(x);\n in64(y);\n if (x < y) {\n x^=y;\n y^=x;\n x^=y;\n }\n lli diff = x - y;\n if (x == y) {\n out64(0);\n return EXIT_SUCCESS;\n }\n lli ans = 0;\n lli best = lcm(x, y);\n \n lli arr[2000];\n int num = facts(diff, arr, 2);\n fo3(i,0,num-1) {\n lli m = x % arr[i];\n if (m==0)\n m = diff;\n lli add = diff - m;\n add %= arr[i];\n lli tmp = lcm(x+add, y+add);\n if (tmp < best || (tmp == best && add < ans)){\n best = tmp;\n ans = add;\n }\n }\n out64(ans);\n return EXIT_SUCCESS;\n}"}, {"source_code": "#include\n#include\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}*/\nlong long int gcd(long long int a,long long int b)\n{\n if(b==0) return a;\n else return gcd(b,a%b);\n}\nint main()\n{\n long long int a,b;\n scanf(\"%I64d %I64d\",&a,&b);\n if(a>b)\n {\n int c=a;\n a=b;\n b=c;\n }\n long long p=a;\n long long int k=0,k1=0,compliment=b-a,compliment1=b-a;\n p=p*b;\n long long int GCD=gcd(a,b);\n p=p/GCD;\n long long int p2=p;\n for(k=1;k*k<=b-a;k++)\n {\n if((k-a%k!=k-b%k)||((b-a)%k)) continue;\n compliment=(b-a)/k;\n long long int G=gcd(a+(k-a%k)%k,b+(k-b%k)%k);\n long long int s=a+(k-a%k)%k;\n s=s*(b+(k-b%k)%k);\n s=s/G;\n if(s\n\nint main() {\n\tint a, b, c, x;\n\tlong long k, k_, min, ab;\n\n\tscanf(\"%d%d\", &a, &b);\n\tif (a == b) {\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\tif (a > b)\n\t\tc = a, a = b, b = c;\n\tmin = (long long) a * b, k_ = 0;\n\tfor (c = 1; c * c <= b - a; c++)\n\t\tif ((b - a) % c == 0) {\n\t\t\tx = c;\n\t\t\tk = (x - a % x) % x;\n\t\t\tab = (a + k) * (b + k) / x;\n\t\t\tif (min > ab || (min == ab && k_ > k))\n\t\t\t\tmin = ab, k_ = k;\n\t\t\tx = (b - a) / c;\n\t\t\tk = (x - a % x) % x;\n\t\t\tab = (a + k) * (b + k) / x;\n\t\t\tif (min > ab || (min == ab && k_ > k))\n\t\t\t\tmin = ab, k_ = k;\n\t\t}\n\tprintf(\"%lld\\n\", k_);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\ntypedef int64_t I64;\n\n\nI64 greatestCommonDivisor(I64 a, I64 b);\n\nint main () {\n \n I64 a, b;\n scanf(\"%\"SCNi64, &a);\n scanf(\"%\"SCNi64, &b);\n\n if (a == b) {\n printf(\"0\\n\");\n return 0;\n }\n\n if (a > b) {\n I64 t = b;\n b = a;\n a = t;\n }\n\n I64 kMin = 0, diff = b - a;\n I64 min = (a / greatestCommonDivisor(a, b) * b);\n \n for (I64 i = 1; i * i <= diff; ++i) {\n if (diff % i != 0) {\n continue;\n }\n\n I64 n = i;\n if (a % n != 0) {\n I64 k = n - a % n;\n I64 m = ((a + k) / greatestCommonDivisor(a + k, b + k) * (b + k));\n if ((m == min && k < kMin) || m < min) {\n min = m;\n kMin = k;\n }\n }\n \n n = diff / i;\n if (a % n != 0) {\n I64 k = n - a % n;\n I64 m = ((a + k) / greatestCommonDivisor(a + k, b + k) * (b + k));\n if ((m == min && k < kMin) || m < min) {\n min = m;\n kMin = k;\n }\n }\n }\n\n printf(\"%\"PRIi64\"\\n\", kMin);\n return 0;\n}\n\nI64 greatestCommonDivisor(I64 a, I64 b) {\n I64 res = a % b;\n while (res > 0) {\n a = b;\n b = res;\n res = a % b;\n }\n return b;\n}"}, {"source_code": "#include \n#include \n#include \n//#include \n#ifndef LL\n#define LL long long\n#endif\n#ifndef uLL\n#define uLL unsigned long long\n#endif\n#ifndef uL\n#define uL unsigned int\n#endif\n#ifndef iL\n#define iL int\n#endif\n#ifndef iS\n#define iS short\n#endif\n#ifndef uS\n#define uS unsigned short\n#endif\n#ifndef uC\n#define uC unsigned char\n#endif\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#define sgn(a) (((a)<0)?(1):(0))\n#define movs(a,b,l) (memmove((a),(b),sizeof(*(b))*(l)))\n#define stosb(a,b,l) (memset((a),(b),sizeof(*(a))*(l)))\nstatic inline uL bsr(uL a)\n{\n __asm__(\"bsrl %0,%0\":\"+r\"((uL)a));\n return a;\n}\nstatic inline uLL sqrt64(uLL x)\n{\n uLL t,g;\n for (g=(x>>1)+(x&1),t=x;g>1)\n {\n t=g;\n }\n return t;\n}\nstatic inline uLL gcd(uLL a,uLL b)\n{\n while (a>0)\n {\n b=(b%a)^a;\n a=a^b;\n b=a^b;\n }\n return b;\n}\nuLL prime[4000001];\nuLL EulerSieve(uLL n)\n{\n uLL i,j;\n memset(prime,0,sizeof(*prime)*(n+1));\n *prime=0;\n for (i=2;i<=n;i++)\n {\n if (prime[i]==0)\n {\n prime[++(*prime)]=i;\n prime[i]=i;\n }\n for (j=1;j<=*prime;j++)\n {\n if (i*prime[j]>n) {break;}\n prime[i*prime[j]]=prime[j];\n if (prime[i]==prime[j]) {break;}\n }\n }\n return *prime;\n}\nuLL fac[10000];\nuLL times[10000];\nuLL factoring(uLL a,uLL *fac,uLL *times)\n{\n\tuLL k,i,l;\n\tl=sqrt64(a);\n\tfor (k=0,i=1;(i<=prime[0])&&(prime[i]<=l);i++)\n\t{\n\t\tif (a%prime[i]==0)\n\t\t{\n\t\t\tfac[++k]=prime[i];\n\t\t\ttimes[k]=1;\n\t\t\tfor (a=a/prime[i];a%prime[i]==0;a=a/prime[i],times[k]+=1);\n\t\t}\n\t}\n\tif (a>1)\n\t{\n\t\tfac[++k]=a;\n\t\ttimes[k]=1;\n\t}\n\treturn k;\n}\nLL aa,bb,kk,ans1,ans2;\nLL dfs(LL x,LL id)\n{\n\tLL i,j,y;\n\tif (id>*fac)\n\t{\n\t\tkk=x-aa%x;\n\t\tif (x-bb%x==kk)\n\t\t{\n\t\t\t//printf(\"%lld %lld\\n\",x,kk);\n\t\t\tif ((aa+kk)/x*(bb+kk)b) {c=a;a=b;b=c;}\n\tif (b%a==0)\n\t{\n\t\tprintf(\"0\\n\");\n\t}\n\telse\n\t{\n\t\tans1=a/gcd(a,b)*b;ans2=0;\n\t\t*fac=factoring(b-a,fac,times);\n\t\taa=a;bb=b;\n\t\tdfs(1,1);\n\t\tprintf(\"%lld\\n\",ans2);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\n#include\n#include\n#include\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\ni64 gcd (i64 a, i64 b) {\n i64 r = a % b;\n while (r > 0) {\n a = b;\n b = r;\n r = a % b;\n }\n return b;\n}\n\nvoid run (void) {\n i32 a = read_int();\n i32 b = read_int();\n if (a == b) {\n puts (\"0\");\n return;\n }\n if (a > b) {\n i32 s = b;\n b = a;\n a = s;\n }\n i64 min = (i64)a / gcd (a, b) * b;\n i32 min_k = 0;\n i32 d = b - a;\n for (i32 i = 1; i * i <= d; ++i) {\n if (d % i != 0) continue;\n i32 f = i;\n if (a % f != 0) {\n i32 k = f - a % f;\n i64 v = (i64) (a + k) / gcd (a + k, b + k) * (b + k);\n if (v < min || (v == min && k < min_k)) {\n\tmin = v;\n\tmin_k = k;\n }\n }\n f = d / i;\n if (a % f != 0) {\n i32 k = f - a % f;\n i64 v = (i64) (a + k) / gcd (a + k, b + k) * (b + k);\n if (v < min || (v == min && k < min_k)) {\n\tmin = v;\n\tmin_k = k;\n }\n }\n }\n print_int (min_k);\n puts (\"\");\n}\n\nint main (void) {\n run ();\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\ntypedef int64_t I64;\n\n\nI64 greatestCommonDivisor(I64 a, I64 b);\n\nint main () {\n \n I64 a, b;\n scanf(\"%\"SCNi64, &a);\n scanf(\"%\"SCNi64, &b);\n\n if (a == b) {\n printf(\"0\\n\");\n return 0;\n }\n\n if (a > b) {\n I64 t = b;\n b = a;\n a = t;\n }\n\n I64 kMin = 0, diff = b - a;\n I64 min = (a / greatestCommonDivisor(a, b) * b);\n \n for (I64 i = 1; i * i <= diff; ++i) {\n if (diff % i != 0) {\n continue;\n }\n\n I64 n = i;\n if (a % n != 0) {\n I64 k = n - a % n;\n I64 m = ((a + k) / greatestCommonDivisor(a + k, b + k) * (b + k));\n if ((m == min && k < kMin) || m < min) {\n min = m;\n kMin = k;\n }\n }\n \n n = diff / i;\n if (a % n != 0) {\n I64 k = n - a % n;\n I64 m = ((a + k) / greatestCommonDivisor(a + k, b + k) * (b + k));\n if ((m == min && k < kMin) || m < min) {\n min = m;\n kMin = k;\n }\n }\n }\n\n printf(\"%\"PRIi64\"\\n\", kMin);\n return 0;\n}\n\nI64 greatestCommonDivisor(I64 a, I64 b) {\n I64 res = a % b;\n while (res > 0) {\n a = b;\n b = res;\n res = a % b;\n }\n return b;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n int a,b,temp,c,d,flag=0,len,i;\n scanf(\"%d %d\",&a,&b);\n if(a>b)\n {\n temp=a;\n a=b;\n b=temp;\n }\n if(a==b)\n {printf(\"0\\n\");return 0;}\n c=b-a;\n d=a%c;\n if(d==0)\n {printf(\"0\\n\");return 0;}\n if(a\n#include \n#include \n#include \n#include \n#include \n#include \n\n\n//--Macros--\n\n#define N 200001\n#define R 100000007\n#define MAX(a,b) ((a)>(b)?(a):(b))\n#define MIN(a,b) ((a)<(b)?(a):(b))\n\n\n//--Structures--\n\n\n//--Comparator Functions--\n\nint comp(const void *a, const void *b)\n{\n\treturn (*(int *)a - *(int *)b);\n}\nint comp_desc(const void *a, const void *b)\n{\n\treturn (*(int *)b - *(int *)a);\n}\n\n\n//--Function Declarations--\n\n// void qsort(array name, size of array, size of each element, comp);\n// int* bsearch(address of search element, array name, size of array, size of each element, comp);\nint rmdup(int [], int); // int rmDup(array, size of array);\nint gcd(int, int); // int gcd(first number, second number);\n\n\n//--Useful Variables--\n\nint i = 0, j = 0, k = 0, flag = 1, count = 0, temp, pos = 0, test_case, mx = 0, mn = INT_MAX;\nlong long sum = 0, product = 1;\n\n\nint main()\n{\n\t//clock_t tStart = clock();\n\tint a, b, diff;\n\tscanf(\"%d %d\", &a, &b);\n\tdiff = abs(a - b);\n\tmn = MIN(a, b);\n\tmx = MAX(a, b);\n\tif(mn == mx)\n\t{\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\tif(mn % diff == 0)\n\t{\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\tif(mn < diff)\n\t{\n\t\tfor(i = mn; i <= diff / 2; i++)\n\t\t{\n\t\t\tif(diff % i == 0)\n\t\t\t{\n\t\t\t\tflag = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(!flag)\n\t\t{\n\t\t\tprintf(\"%d\\n\", i - mn);\n\t\t\treturn 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"%d\\n\", diff - mn);\n\t\t\treturn 0;\n\t\t}\n\t}\n\telse\n\t{\n\t\tprintf(\"%d\\n\", diff - mn % diff);\n\t\treturn 0;\n\t}\n\n\t//printf(\"%lf seconds.\\n\", (clock() - tStart)/CLOCKS_PER_SEC);\n\treturn 0;\n}\n\n\nint rmdup(int a[], int n)\n{\n\tif(n == 0 || n == 1)\n\t\treturn n;\n\tint j = 0;\n\tfor(i = 0; i < n - 1; i++)\n\t{\n\t\tif(a[i] != a[i+1])\n\t\t{\n\t\t\ta[j++] = a[i];\n\t\t}\n\t}\n\ta[j++] = a[n-1];\n\treturn j;\n}\n\n\nint gcd(int x, int y)\n{\n\tif(y == 0)\n\t{\n\t\treturn x;\n\t}\n\telse\n\t{\n\t\treturn gcd(y, x % y);\n\t}\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include \n#include \ntypedef long long LL;\n\nLL gcd(LL x, LL y)\n{\n\tLL t;\n\twhile(y){\n\t\tt = x;\n\t\tx = y;\n\t\ty = t % y;\n\t}\n\treturn x;\n}\n\nint main()\n{\t\n\tint a, b, d, k, i, c = 0;\n\tint dv[30000];\n\tLL x, y, t, min = 0, ans, z, ta;\n\t\n\tscanf(\"%d%d\", &a, &b);\t\n\tif(a > b) a ^= b, b ^= a, a ^= b;\n\td = b - a;\n\tif(!d){\n\t\tputs(\"0\");\n\t\treturn 0;\n\t}\n\tk = sqrt(d);\n\tfor(i = 1; i <= k; i++){\n\t\tif(d % i == 0) dv[c++] = i;\n\t}\n\ti = c - 1;\n\tif(d == dv[i] * dv[i]) i--;\n\tfor( ; i >= 0; i--){\n\t\tdv[c++] = d / dv[i];\n\t}\n\tfor(i = 0; i < c; i++){\n\t\tt = (LL)dv[i];\n\t\tx = (LL)a / t * t;\n\t\tif(x < a) x += t;\n\t\ty = x + d;\n\t\twhile(gcd(x / t, y / t) != 1) x += t, y += t;\n\t\tif(!min) ans = x - a, min = x / t * y ;\n\t\telse{\n\t\t\tz = x / t * y , ta = x - a;\n\t\t\tif(z < min) min = z, ans = ta;\n\t\t\telse if(z == min){\n\t\t\t\tif(ta < ans) ans = ta;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%lld\\n\", ans);\n\t\n\treturn 0;\n}"}, {"source_code": "#include\nint gcd(int a,int b){\n\tint t;\n\twhile(b>0){\n\t\tt=a%b;\n\t\ta=b;\n\t\tb=t;\n\t}\n\treturn a;\n}\nint main()\n{\n\tlong long a,b;\n\tscanf(\"%I64d %I64d\",&a,&b);\n\tlong long t;\n\tif(a>b){\n\t\tt=a;\n\t\ta=b;\n\t\tb=t;\n\t}\n\tt=b-a;\n\tlong long k=0;\n\tlong long k1;\n\tlong long min=a/gcd(a,b)*b;\n\tfor(long long i=1;i*i<=t;i++){\n\t\tk1=i-b%i;\n\t\tif((a+k1)*(b+k1)\n#define lli long long int\nint main(void){\n lli a,b;\n scanf(\"%lld %lld\",&a,&b);\n if(a > b){\n int ch = a;\n a = b;\n b = ch;\n }\n lli q = b - a;\n lli j = 0;\n while(q*(++j) < a);\n lli k = q*j - a;\n printf(\"%lld\\n\",k);\n return 0;\n}"}, {"source_code": "#include \n#define lli long long int\ndouble sqrt(double i){\n double a = 2.0;\n int k = 50;\n while(k-->0){\n a = (a+i/a)/2.0;\n }\n return a;\n}\nint main(void){\n lli a,b;\n scanf(\"%lld %lld\",&a,&b);\n if(a == b){\n printf(\"0\\n\");\n return 0;\n }\n if(a > b){\n int ch = a;\n a = b;\n b = ch;\n }\n lli q = b - a;\n lli j = a/q;\n if(q*j < a)\n j++;\n q *=j;\n int za = 1;\n int rq = sqrt(q);\n int me = 1;\n int meb = q;\n while((++za) = a)\n break;\n if((q/za)>=a)\n meb = q/za;\n else\n break;\n }\n }\n if(me < a)\n za = meb;\n else\n za = me;\n lli k = za - a;\n printf(\"%lld\\n\",k);\n return 0;\n}"}, {"source_code": "#include \n#define lli long long int\ndouble sqrt(double i){\n double a = 2.0;\n int k = 100;\n while(k-->0){\n a = (a+i/a)/2.0;\n }\n return a;\n}\nint main(void){\n lli a,b;\n scanf(\"%lld %lld\",&a,&b);\n if(a == b){\n printf(\"0\\n\");\n return 0;\n }\n if(a > b){\n int ch = a;\n a = b;\n b = ch;\n }\n lli q = b - a;\n lli j = a/q;\n if(q*j < a)\n j++;\n q *=j;\n int za = 1;\n int rq = sqrt(q);\n int me = 1;\n int meb = q;\n while((++za) = a)\n break;\n if((q/za)>=a)\n meb = q/za;\n else\n break;\n }\n }\n if(me < a)\n za = meb;\n else\n za = me;\n lli k = za - a;\n printf(\"%lld\\n\",k);\n return 0;\n}"}, {"source_code": "#include \n#define lli long long int\nint main(void){\n lli a,b;\n scanf(\"%lld %lld\",&a,&b);\n if(a == b){\n printf(\"%lld\\n\",a);\n return 0;\n }\n if(a > b){\n int ch = a;\n a = b;\n b = ch;\n }\n lli q = b - a;\n lli j = a/q;\n if(q*j < a)\n j++;\n q *=j;\n int za = a-1;\n while(q%(++za) != 0);\n lli k = za - a;\n printf(\"%lld\\n\",k);\n return 0;\n}"}, {"source_code": "#include \n#include \n\ntypedef long long int lli;\n\n#define TRUE (1==1)\n#define FALSE (!TRUE)\n\n#define fo3(a,b,c) for(a=(int)(b);a<=(int)(c);a++)\n#define of3(a,b,c) for(a=(int)(b);a>=(int)(c);a--)\n#define in32(a) scanf(\"%d\",&(a))\n#define in64(a) scanf(\"%I64d\",&(a))\n#define out32(a) printf(\"%d\\n\",(a))\n#define out64(a) printf(\"%I64d\\n\",(a))\n#define instr(a) scanf(\"%s\",(a))\n#define outstr(a) printf(\"%s\\n\",(a))\n#define max(a,b) (((a)<(b))?(b):(a))\n#define min(a,b) (((a)>(b))?(b):(a))\n\nlli gcd(lli a, lli b) {\n return (b == 0) ? a : gcd(b, a % b);\n}\nlli lcm(lli a, lli b) {\n lli g = gcd(a, b);\n return a * (b / g);\n}\n\nint facts(lli val, lli * arr, int st) {\n if (val == 1) {\n arr[0] = 1;\n return 1;\n }\n int i = st,k;\n while (i * i <= val) {\n if (val % i == 0) {\n int pow = 0;\n while (val % i == 0) {\n pow ++;\n val/=i;\n }\n int cur = facts(val,arr,i+1);\n int res = cur * (pow + 1);\n fo3(k,cur,res-1)\n arr[k] = arr[k-cur]*i;\n return res;\n }\n i++;\n }\n arr[0] = 1;\n arr[1] = val;\n return 2;\n}\n\nint main(void)\n{\n lli x, y;\n int i;\n in64(x);\n in64(y);\n if (x < y) {\n x^=y;\n y^=x;\n x^=y;\n }\n lli diff = x - y;\n if (x == y) {\n out64(0);\n return EXIT_SUCCESS;\n }\n lli ans = 0;\n lli best = lcm(x, y);\n \n lli arr[2000];\n int num = facts(diff, arr, 2);\n fo3(i,0,num-1) {\n lli m = x % arr[i];\n if (m==0)\n m = diff;\n lli add = diff - m;\n lli tmp = lcm(x+add, y+add);\n if (tmp < best || (tmp == best && add < ans)){\n best = tmp;\n ans = add;\n }\n }\n out64(ans);\n return EXIT_SUCCESS;\n}"}, {"source_code": "#include \n#include \n\ntypedef long long int lli;\n\n#define TRUE (1==1)\n#define FALSE (!TRUE)\n\n#define fo3(a,b,c) for(a=(int)(b);a<=(int)(c);a++)\n#define of3(a,b,c) for(a=(int)(b);a>=(int)(c);a--)\n#define in32(a) scanf(\"%d\",&(a))\n#define in64(a) scanf(\"%I64d\",&(a))\n#define out32(a) printf(\"%d\\n\",(a))\n#define out64(a) printf(\"%I64d\\n\",(a))\n#define instr(a) scanf(\"%s\",(a))\n#define outstr(a) printf(\"%s\\n\",(a))\n#define max(a,b) (((a)<(b))?(b):(a))\n#define min(a,b) (((a)>(b))?(b):(a))\n\n\n\nint main(void)\n{\n lli x, y;\n in64(x);\n in64(y);\n if (x < y) {\n x^=y;\n y^=x;\n x^=y;\n }\n lli diff = x - y;\n if (diff == 0 || y == 1) {\n out64(x*0);\n return EXIT_SUCCESS;\n }\n lli m = x % diff;\n if(m==0)\n m = diff;\n out64(diff-m);\n return EXIT_SUCCESS;\n}"}, {"source_code": "#include\n#include\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}*/\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n if(a>b)\n {\n int c=a;\n a=b;\n b=c;\n }\n if(b%a==0) printf(\"0\");\n else if(b/a>1)\n {\n int c=(b/a)-1;\n int d=(b/a);\n for(d=(b/a);d>1;d--)\n {\n int q=(b-a*d)/(d-1);\n if(q>0)\n {\n printf(\"%d\",q);\n return 0;\n }\n }\n }\n else\n {\n int p=a/(b-a)+(a%(b-a)>0);\n //printf(\"p=%d\\n\",p);\n long long int k=(b-a);\n //printf(\"k=%I64d\\n\",k);\n k=k*p;\n //printf(\"k=%I64d\\n\",k);\n k=k-a;\n //printf(\"k=%I64d\\n\",k);\n printf(\"%I64d\",k);\n\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\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}*/\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n if(a>b)\n {\n int c=a;\n a=b;\n b=c;\n }\n if(b/a>1)\n {\n int c=(b/a)-1;\n int d=(b/a);\n for(d=(b/a);d>1;d--)\n {\n int q=(b-a*d)/(d-1);\n if(q>0)\n {\n printf(\"%d\",q);\n return 0;\n }\n }\n }\n else\n {\n if(b==a)\n {\n printf(\"0\");\n }\n else\n {\n int p=a/(b-a)+(a%(b-a)>0);\n //printf(\"p=%d\\n\",p);\n long long int k=(b-a);\n //printf(\"k=%I64d\\n\",k);\n k=k*p;\n //printf(\"k=%I64d\\n\",k);\n k=k-a;\n //printf(\"k=%I64d\\n\",k);\n printf(\"%I64d\",k);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n\tint a, b, c, x;\n\tlong long k, k_, min, ab;\n\n\tscanf(\"%d%d\", &a, &b);\n\tif (a == b) {\n\t\tprintf(\"%d\\n\", a);\n\t\treturn 0;\n\t}\n\tif (a > b)\n\t\tc = a, a = b, b = c;\n\tmin = (long long) a * b, k_ = 0;\n\tfor (c = 1; c * c <= b - a; c++)\n\t\tif ((b - a) % c == 0) {\n\t\t\tx = c;\n\t\t\tk = (x - a % x) % x;\n\t\t\tab = (a + k) * (b + k) / x;\n\t\t\tif (min > ab || (min == ab && k_ > k))\n\t\t\t\tmin = ab, k_ = k;\n\t\t\tx = (b - a) / c;\n\t\t\tk = (x - a % x) % x;\n\t\t\tab = (a + k) * (b + k) / x;\n\t\t\tif (min > ab || (min == ab && k_ > k))\n\t\t\t\tmin = ab, k_ = k;\n\t\t}\n\tprintf(\"%lld\\n\", k_);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,temp,c,d;\n scanf(\"%d %d\",&a,&b);\n if(a>b)\n {\n temp=a;\n a=b;\n b=temp;\n }\n if(a==b)\n {printf(\"0\\n\");return 0;}\n c=b-a;\n d=a%c;\n if(d==0)\n {printf(\"0\\n\");return 0;}\n else\n {\n printf(\"%d\\n\",c-d);\n return 0;\n }\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,temp,c,d;\n scanf(\"%d %d\",&a,&b);\n if(a>b)\n {\n temp=a;\n a=b;\n b=temp;\n }\n if(a==b||b%a==0)\n {printf(\"0\\n\");return 0;}\n c=b-a;\n d=a%c;\n if(d==0)\n {printf(\"0\\n\");return 0;}\n else\n {\n printf(\"%d\\n\",c-d);\n return 0;;\n }\n}\n"}, {"source_code": "#include\nint gcd(int a,int b){\n\tint t;\n\twhile(b>0){\n\t\tt=a%b;\n\t\ta=b;\n\t\tb=t;\n\t}\n\treturn a;\n}\nint main()\n{\n\tlong long a,b;\n\tscanf(\"%I64d %I64d\",&a,&b);\n\tlong long t;\n\tif(a>b){\n\t\tt=a;\n\t\ta=b;\n\t\tb=t;\n\t}\n\tt=b-a;\n\tlong long k=0;\n\tlong long k1;\n\tlong long min=a*b/gcd(a,b);\n\tfor(long long i=1;i*i<=t;i++){\n\t\tk1=i-b%i;\n\t\tif((a+k1)*(b+k1)\nint gcd(int a,int b){\n\tint t;\n\twhile(b>0){\n\t\tt=a%b;\n\t\ta=b;\n\t\tb=t;\n\t}\n\treturn a;\n}\nint main()\n{\n\tint a,b;\n\tscanf(\"%d %d\",&a,&b);\n\tint t;\n\tif(a>b){\n\t\tt=a;\n\t\ta=b;\n\t\tb=t;\n\t}\n\tt=b-a;\n\tint k=0;\n\tint k1;\n\tint min=a*b/gcd(a,b);\n\tfor(int i=1;i*i<=t;i++){\n\t\tk1=i-a%i;\n\t\tif((a+k1)*(b+k1)\nint main()\n{\n long long int n,k,i,count=0;\n scanf(\"%lld %lld\",&n,&k);\n count=n/k;\n if(count%2==0)\n {\n printf(\"NO\\n\");\n }\n else\n {\n printf(\"YES\\n\");\n }\n}\n\n\n"}, {"source_code": "#include\nint main()\n{\n long long int i,j,n,k,a,b,c;\n scanf(\"%lld%lld\",&n,&k);\n c=n/k;\n if(c%2!=0)\n {\n printf(\"YES\");\n }\n else \n {\n printf(\"NO\");\n }\n \n \n}"}, {"source_code": "#include \n#include \n\nint main(){\n\tlong long m,k;\n\tscanf(\"%lld %lld\",&m,&k);\n\tlong long r=m/k;\n\tif(r%2==1){\n\t\tprintf(\"YES\\n\");\n\t}\n\telse printf(\"NO\\n\");\n\treturn 0;\n}"}, {"source_code": "#include\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 long long int n,k,lcount=0,scount=0,i=1;\n scanf(\"%lld%lld\",&n,&k);\n\n if((n/k)%2==0)\n {\n \tprintf(\"NO\\n\");\n }\n else\n {\n \tprintf(\"YES\\n\");\n }\n}"}, {"source_code": "#include\n#include\nvoid main()\n{\nlong long n,k;\nscanf(\"%lld %lld\",&n,&k);\n\nif((n/k)%2==0)\n\tprintf(\"NO\\n\");\nelse\n\tprintf(\"YES\\n\");\nexit(0);\n\n}"}, {"source_code": "#include\nmain()\n{\nlong long int n,k;\nscanf(\"%I64d%I64d\",&n,&k);\nif((n/k)%2!=0)\n{\nprintf(\"YES\");\n}\nelse\n{\nprintf(\"NO\");\n}\n}"}, {"source_code": "#include\nint main()\n{\n\tlong long int n,k,temp;\n\tscanf(\"%lld%lld\",&n,&k);\n\t\n\ttemp=n/k;\n\tif(temp%2==0)\n\t{\n\t\tprintf(\"No\");\n\t}\n\telse\n\t{\n\t\tprintf(\"Yes\");\n\t}\n}"}, {"source_code": "#include\n\nint main()\n{\n long long int n,k,l;\n\n scanf(\"%lld %lld\",&n,&k);\n\n l = n/k;\n\n if(l%2==0)\n {\n printf(\"NO\");\n }\n else\n {\n printf(\"YES\");\n }\n\n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n __int64 k,n,m;\n scanf(\"%I64d%I64d\",&n,&k);\n m = n/k;\n if(m%2==0)\n printf(\"NO\");\n else\n printf(\"YES\");\n}\n"}, {"source_code": "#include \n\nint main ()\n{\n unsigned long long int n, k;\n scanf(\"%llu %llu\", &n, &k);\n if((n % k) == 0)\n {\n if(((n / k) % 2) == 0)\n {\n printf(\"NO\\n\");\n }\n else\n {\n printf(\"YES\\n\");\n }\n }\n else\n {\n if(((n / k) % 2) == 0)\n {\n printf(\"NO\\n\");\n }\n else\n {\n printf(\"YES\\n\");\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n\nint m [700000];\n\nint main()\n{\n long long int a,n,k;\n\n scanf(\"%I64d %I64d\", &n,&k);\n\n a = n / k;\n\n if(n == k || a % 2 == 1)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include\nmain()\n{\n long long n, k, c;\n scanf(\"%lld%lld\",&n,&k);\n c = n/k;\n if(c%2==1)printf(\"YES\");\n else printf(\"NO\");\n}\n"}, {"source_code": "\n#include\n#include\ntypedef long long num;\n int main()\n{\n num k,n,ara;\nscanf(\"%I64d %I64d\",&k,&n);\nara=k/n;\nif(ara%2==1 || ara==1)\nprintf(\"YES\");\nelse\nprintf(\"NO\");\n\nreturn 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n long long n,k;\n scanf(\"%lld%lld\",&n,&k);\n\n if((n/k)%2==0){\n printf(\"NO\\n\");\n }\n\n else{\n printf(\"YES\\n\");\n }\n\n\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int i,j,n,k,a,b,c;\n scanf(\"%lld%lld\",&n,&k);\n c=n/k;\n if(c%2!=0)\n {\n printf(\"YES\");\n }\n else \n {\n printf(\"NO\");\n }\n \n \n}"}, {"source_code": "#include \n#define ll long long\n\nint main()\n{\n\tll n, k;\n\t//unsigned long long int k;\n\tscanf(\"%lld %lld\", &n, &k);\n\t//printf(\"%lld\\n\", (long long)n);\n\t/*\n\tif(k == 1)\n\t{\n\t\tif(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\t*/\n\tif((long long int)(n / k) % 2)\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"}, {"source_code": "#include\n\nint main(){\n long long int n,k;\n scanf(\"%lld %lld\",&n,&k);\n n/=k;\n printf(n%2 ? \"YES\" : \"NO\");\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tunsigned long long int n,k;\n\tscanf(\"%llu %llu\",&n,&k);\n\t\n\tunsigned long long int t=n/k;\n\t\n\tif(t%2==1)\n\tprintf(\"YES\\n\");\n\telse\n\tprintf(\"NO\\n\");\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n long long int n,k,m;\n scanf(\"%I64d%I64d \",&n,&k);\n m=n/k;\n if(m%2==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n long long int moves,n,k;\n scanf(\"%I64d %I64d\",&n,&k);\n moves=n/k;\n if( moves%2==0)\n printf(\"NO\");\n else\n printf(\"YES\");\n\n\n return 0;\n\n}\n"}, {"source_code": "#include\nint main(){\nlong long int a,b,c,d,e,x,y,z;\n\nscanf(\"%lld %lld\",&a,&b);\nx=a/b;\ny=x%2;\nif(y!=0){\nprintf(\"YES\");\n}else {\nprintf(\"NO\");\n}\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int a,b;\n scanf(\"%lld %lld\",&a,&b);\n if((a/b)%2==0)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n __int64 k,n,m;\n scanf(\"%I64d%I64d\",&n,&k);\n m = n/k;\n if(m%2==0)\n printf(\"NO\");\n else\n printf(\"YES\");\n}\n"}, {"source_code": "/* Problem: 832A - Sasha and Sticks */\n/* Author: Gusztav Szmolik */\n\n#include \n\nint main ()\n {\n unsigned long long n;\n unsigned long long k;\n unsigned long long mod;\n unsigned long long div;\n\n if (scanf(\"%I64u %I64u\",&n,&k) != 2)\n return -1;\n if (n < 1 || n > 1000000000000000000UL || k < 1 || k > 1000000000000000000UL)\n return -1;\n if (k > n)\n return -1;\n mod = n%k;\n div = (n-mod)/k;\n printf (div%2 ? \"YES\\n\" : \"NO\\n\");\n return 0;\n }\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n long long n,k;\n scanf(\"%I64d %I64d\",&n,&k);\n ((n/k)%2==0)? (printf(\"NO\\n\")):(printf(\"YES\\n\"));\n return 0;\n}\n"}, {"source_code": "main() { long long n,k; scanf(\"%I64d%I64d\",&n,&k);int j=n/k; printf(j%2?\"YES\":\"NO\"); }\n"}, {"source_code": "\n #include \n int main() /*this code is written by 190042146*/\n{\n long long int n, k;\n\n scanf(\"%lld%lld\", &n, &k);\n\n if ( (n/k)%2!=0)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n,k,i,j,x,y,z;\n scanf(\"%lld %lld\",&n,&k);\n x=n/k;\n if(x%2!=0)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n\n}\n\n\n"}, {"source_code": "#include\nint main(){\n long long n,k,l;\n scanf(\"%I64d %I64d\",&n,&k);\n l=n/k;\n if(l%2==1){\n printf(\"YES\");\n }else {\n printf(\"NO\");\n }\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n,k;\n scanf(\"%I64d %I64d\",&n,&k);\n if((n/k)%2==1)printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n,k,a;\n scanf(\"%lld %lld\",&n,&k);\n a=n/k;\n if(a%2!=0) printf(\"YES\");\n else printf(\"NO\");\n\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n long long int i,n,k,a;\n scanf(\"%lld %lld\",&n,&k);\n a = n/k;\n if(a%2 !=0){\n printf(\"YES\\n\");\n }\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\nlong long int n,k,a,b;\nscanf(\"%lld %lld\",&n,&k);\na=n%k;\nn = n-a;\nb=n/k;\nif(b%2==0){\nprintf(\"No\");\n}\nelse\nprintf(\"Yes\");\n}"}, {"source_code": "#include \n\nint main()\n{\n long long int n,k,div;\n scanf(\"%I64d %I64d\",&n,&k);\n div=n/k;\n if(div%2!=0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "main() { long long n,k; scanf(\"%I64d%I64d\",&n,&k);int j=n/k; printf(j%2?\"YES\":\"NO\"); }\n"}, {"source_code": "#include\nint main()\n{\n long long n,k,s;\n scanf(\"%lld %lld\",&n,&k);\n s=n/k;\n if(s%2==0)\n {\n printf(\"NO\");\n }\n else\n {\n printf(\"YES\");\n }\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tlong long int n,k,s;\n\tscanf(\"%lld %lld\",&n,&k);\n\ts=n/k;\n\tif(s%2==1)\n\tprintf(\"YES\");\n\telse\n\tprintf(\"NO\");\n\n}\n"}, {"source_code": "#include \n#include \n#include \nint main(){\nlong long n,k;\nscanf(\"%lld %lld\",&n,&k);\nif((n/k)%2==0){\n printf(\"NO\\n\");\n}\nelse{\n printf(\"YES\\n\");\n}\nreturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tlong long n, k;\n\tscanf(\"%lld%lld\", &n, &k);\n\tif((n / k) % 2 == 1)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n}\n"}, {"source_code": "#include\n\nint main()\n{\n long long n,k;\n\n scanf(\"%I64d %I64d\",&n,&k);\n\n if((n/k)%2!=0)\n printf(\"Yes\\n\");\n else\n printf(\"No\");\n\n return 0;\n}\n"}, {"source_code": "#include\nlong long n,m,srx;\nint main()\n{\n scanf(\"%lld%lld\",&n,&m);\n srx=n/m;\n if(srx%2)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n//nmd"}, {"source_code": "#include\nint main()\n{\n long long int n,k,a;\n scanf(\"%lld %lld\",&n,&k);\n a=n/k;\n if(a%2!=0) printf(\"YES\");\n else printf(\"NO\");\n\n return 0;\n}"}, {"source_code": "#include\nint main(){\n long long n,k,l;\n scanf(\"%I64d %I64d\",&n,&k);\n l=n/k;\n if(l%2==1){\n printf(\"YES\");\n }else {\n printf(\"NO\");\n }\nreturn 0;\n}\n"}, {"source_code": "#include\nint m;\nint oddeven(int n)\n{\n if(n%2==0)\n {\n m=1;\n }\n else\n {\n m=0;\n }\n\n\n}\nint main()\n{\n long long a,b;\n int j;\n scanf(\"%lld\",&a);\n scanf(\"%lld\",&b);\n int i=1;\n if(b==1)\n {\n if(a%2==0)\n {\n printf(\"NO\");\n }\n else\n {\n printf(\"YES\");\n }\n }\n else\n {\n j=a/b;\n\n oddeven(j);\n {\n if(m==1)\n {\n printf(\"NO\");\n }\n else\n {\n printf(\"YES\");\n }\n }\n }\n}\n"}, {"source_code": "#include\n#include\n\nint main()\n{\n unsigned long long int a,b,c,d;\n scanf(\"%llu%llu\",&a,&b);\n if(a==b)\n printf(\"YES\\n\");\n else\n {\n c=(a/b);\n d=a%b;\n if(c%2==0)\n printf(\"NO\\n\");\n else if(c%2!=0)\n printf(\"YES\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n\nint main(){\n\t\n\tlong long int n ,k;\n\tscanf(\"%I64d%I64d\" ,&n ,&k);\n\tif((n/k)%2) printf(\"Yes\\n\");\n\telse printf(\"No\\n\");\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long n,k;\n while(~scanf(\"%lld%lld\",&n,&k))\n {\n long long s=n/k;\n if(s%2==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n __int64 n,k;\n unsigned long long nn,kk;\n scanf(\"%I64d%I64d\",&n,&k);\n if (n<0)\n nn=9223372036854775808+n+9223372036854775808;\n else\n nn=n;\n if (n<0)\n kk=9223372036854775808+k+9223372036854775808;\n else\n kk=k;\n if (((n/k) & 1)==0)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include\nint main(void)\n{\n long long int n,k;\n scanf(\"%lld %lld\",&n,&k);\n if((n/k)%2==1){\n printf(\"YES\\n\");\n }\n else{\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n\n{\n int64_t n,k;\n\n scanf(\"%\"SCNd64,&n);\n scanf(\"%\"SCNd64,&k);\n\n printf(\"%s\",(n/k)%2==0?\"NO\":\"YES\");\n\n\n return 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n long long int n,k,l;\n scanf(\"%lli %lli\",&n,&k);\n l=n/k;\n if(l%2==0){\n printf(\"NO\");\n }\n else{\n printf(\"YES\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n#include \n#include \nint main(int argc, char const *argv[])\n{\n\tlong long n,k;\n\tscanf(\"%I64d %I64d\",&n,&k);\n\tlong long temp=n/k;\n\tif(temp%2==1){\n\t\tprintf(\"YES\");\n\t}else{\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n long long n,k;\n scanf(\"%I64d%I64d\",&n,&k);\n\n n = n / k;\n\n if(n%2==0) printf(\"NO\\n\");\n else printf(\"YES\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n unsigned long long int n=1000000000000000000,k=1,i;\n\nscanf(\"%lld %lld\",&n,&k);\n//for(i=1;k<=n;i++){ n=n-k;\n//}\nn=n/k;\n if(n%2==1){printf(\"YES\");}\n\n \nelse\nprintf(\"NO\") ;\nreturn 0;\n}"}, {"source_code": "#include \nlong long int n,k,a;\nint main ()\n{\n\tscanf(\"%lld %lld\", &n, &k);\n\tif((n/k)%2==0)\n\tprintf(\"NO\");\n\tif((n/k)%2==1)\n\tprintf(\"YES\");\n\t\n\t\n\t\n\n\n\n\n\n\n\n}\n"}, {"source_code": "int main()\n{\n long long int n,k,a,b,c;\n scanf(\"%I64d %I64d\",&n,&k);\n if ((n/k)%2==0)\n printf(\"NO\");\n else\n printf(\"YES\");\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n\n long long n, k, l;\n scanf(\"%lld %lld\", &n, &k);\n\n l=n/k;\n\n if(l%2==0)\n {\n printf(\"NO\");\n }\n else {\n printf(\"YES\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long i,j,k,n,m;\n\n scanf(\"%lld%lld\",&n,&k);\n\n\n m = n/k;\n if(m % 2 != 0)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n long long int n, k, win;\n scanf(\"%lld %lld\", &n, &k);\n win = n/k;\n if(win%2==1)\n printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint compare(void *,void *);\nint main(int argc, char *argv[]) \n{\n\tlong long int a,b;\n\tscanf(\"%lld %lld\",&a,&b);\n\t\n\tif(a%(2*b)>=b)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n}"}, {"source_code": "#include\nmain()\n{\n long long i,n,j,k,x,y;\n scanf(\"%I64d %I64d\",&n,&k);\n x=n/k;\n if(x%2==1)\n {\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n,k;\n scanf(\"%lld%lld\",&n,&k);\n\n if ((n/k)%2==0)\n printf(\"NO\");\n else\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include\nlong long n,m,srx;\nint main()\n{\n scanf(\"%lld%lld\",&n,&m);\n srx=n/m;\n if(srx%2)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n//nmd"}, {"source_code": "#include \nint main()\n{\n\tunsigned long long n, k, t;\n\tn = 0;\n\tn--;\n\tscanf(\"%llu %llu\", &n, &k);\n\tif (k < 500000000000000000) {\n\t\tif (n % (2 * k) < k)\n\t\t\tprintf(\"NO\");\n\t\telse\n\t\t\tprintf(\"YES\");\n\t} else {\n\t\tt = 0;\n\t\twhile (1) {\n\t\t\tn = n - k;\n\t\t\tt++;\n\t\t\tif (n < k)\n\t\t\t\tbreak;\n\t\t}\n\t\tif (t % 2 == 1)\n\t\t\tprintf(\"YES\");\n\t\telse\n\t\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\nmain()\n{\n long long n, k, c;\n scanf(\"%lld%lld\",&n,&k);\n c = n/k;\n if(c%2==1)printf(\"YES\");\n else printf(\"NO\");\n}\n"}, {"source_code": "#include\nint main()\n{\n\tlong long int n,k,s;\n\tscanf(\"%lld %lld\",&n,&k);\n\ts=n/k;\n\tif(s%2==1)\n\tprintf(\"YES\");\n\telse\n\tprintf(\"NO\");\n\n}\n"}, {"source_code": "#include\n#include\n#include\nint main()\n{\n\n #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 long long int n,k;scanf(\"%lld %lld\",&n,&k);\n int r;\n r=n/k;\n if(r%2==0)printf(\"NO\");\n else printf(\"YES\");}"}, {"source_code": "#include \n#include \n\nint main()\n{\n __int64 n,k;\n unsigned long long nn,kk;\n scanf(\"%I64d%I64d\",&n,&k);\n if (n<0)\n nn=9223372036854775808+n+9223372036854775808;\n else\n nn=n;\n if (n<0)\n kk=9223372036854775808+k+9223372036854775808;\n else\n kk=k;\n if (((n/k) & 1)==0)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include\n\nint main(){\n\nlong long int n, k;\n\nscanf(\"%I64d %I64d\", &n , &k);\n\n// if(n!= 1)\n// printf(\"%I64d %I64d\\n\" , n ,k);\n\nlong long int odd_even = n/k;\n\n// if(n!=1){\n// printf(\"%I64d\\n\" , odd_even );\n// printf(\"%I64d\\n\" , odd_even%2 );\n// }\n\nif(odd_even%2 == 0)\n printf(\"NO\");\nelse\n printf(\"YES\");\n\n\n}"}, {"source_code": "#include \nint main(){\n\tlong long int n,k;\n\tscanf(\"%lld%lld\",&n,&k);\n\tif((n/k)%2==0){\n\t\tprintf(\"NO\");\n\t\treturn 0;\n\t}else if((n/k)%2==1){\n\t\tprintf(\"YES\");\n\t\treturn 0;\n\t}\n}\n"}, {"source_code": "#include\nint main()\n{\n\tlong long int n,k,m;\n\tscanf(\"%lld%lld\",&n,&k);\n\tm=n/k;\n\tif(m%2==0)\n\tprintf(\"NO\");\n\telse\n\tprintf(\"YES\");\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nvoid play(int *n, int k);\n\nmain()\n{\n\tunsigned long long n, k;\n\t\n\tscanf(\"%llu %llu\", &n, &k);\n\t\n\tif ((n/k) % 2 == 1)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int x,y,z;\n scanf(\"%lld%lld\",&x,&y);\n z=x/y;\n if(z%2==0)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n}"}, {"source_code": "#include \nint main(void)\n{\t\n\tlong long n,k;\n\tscanf(\"%lld%lld\",&n,&k);\n\tif((n/k)%2==0)\n\t\tprintf(\"NO\");\n\telse\t\n\t\tprintf(\"YES\"); \n\t\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n long long int n,k,i,j,x,y,z;\n scanf(\"%lld %lld\",&n,&k);\n x=n/k;\n if(x%2!=0)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n\n}\n\n\n"}, {"source_code": "#include\nint main()\n{\n\tlong long n,k;\n\tscanf(\"%lld%lld\",&n,&k);\n\tif(n==k)\n\t{\n\t\t\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t{\n\t\tn=n/k;\n\t if(n==1||n%2!=0)\n\t\t\n\t\t{\n\t\t\tprintf(\"YES\");\n\t\t\t\n\t\t}\n\t\telse\n\t\tprintf(\"NO\");\n\t\t\n\t}\n\t\nreturn 0;\t\n}\n"}, {"source_code": "#include\nmain()\n{\n\t long long int n,k;\n\tscanf(\"%I64d %I64d\",&n,&k);\n\tlong long int remainder=n/k;\n\t//printf(\"%I64d\",remainder);\n\tif(remainder%2==1)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\t\n}\n"}, {"source_code": "#include\nint main(void)\n{\n\n long long int count=0;\n long long int n,k,i;\n while(scanf(\"%I64d %I64d\",&n,&k)==2){\n\n if((n/k)&1)printf(\"YES\\n\");\n else printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n long long int n, k, win;\n scanf(\"%lld %lld\", &n, &k);\n win = n/k;\n if(win%2==1)\n printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int a,b,c;\n scanf(\"%I64d %I64d\",&a,&b);\n c=a/b;\n while (a>0 && b>0)\n {\n\n\n if(a%b>=0 && c%2!=0)\n {\n printf(\"YES\\n\"); break;\n }\n else if(a%b==0 && c%2==0)\n {\n printf(\"NO\\n\"); break;\n }\n else\n {\n printf(\"NO\\n\"); break;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n,k,c;\n scanf(\"%I64d %I64d\",&n,&k);\n\n c=n/k;\n if(c%2==1)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n long long num,k,c;\n\tscanf(\"%lld%lld\",&num,&k);\n\tc=num/k;\n\tif(c%2==0)\n\tprintf(\"NO\\n\");\n\telse\n\tprintf(\"YES\\n\");\n\treturn 0;\n}\n\t "}, {"source_code": "#include \n#include \n\nint main()\n{\n unsigned long long int n, k, m;\n scanf(\"%llu %llu\", &n, &k);\n m = n/k;\n if(n%k == 0 && m%2 == 1)\n {\n printf(\"YES\\n\");\n }\n else if(n%k == 0 && m%2 == 0)\n {\n printf(\"NO\\n\");\n }\n else if(m%2 == 1 && n%k != 0)\n {\n printf(\"YES\\n\");\n }\n else if(m%2 == 0 && n%k != 0)\n {\n printf(\"NO\\n\");\n }\n return 0;\n\n }\n"}, {"source_code": "#include \n#define ll long long\n\nint main()\n{\n\tll n, k;\n\t//unsigned long long int k;\n\tscanf(\"%lld %lld\", &n, &k);\n\t//printf(\"%lld\\n\", (long long)n);\n\t/*\n\tif(k == 1)\n\t{\n\t\tif(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\t*/\n\tif((long long int)(n / k) % 2)\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"}, {"source_code": "#include \n\nint main()\n{\n long long int n,k,div;\n scanf(\"%I64d %I64d\",&n,&k);\n div=n/k;\n if(div%2!=0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \nint main() { \nlong long n, k; \nscanf(\"%lld %lld\", &n, &k); \nif(((n / k) & 1) == 0)\nprintf(\"NO\");\nelse\nprintf(\"YES\"); \nreturn 0; \n \n}"}, {"source_code": "#include\nint main()\n{\n long long int n,k,x;\n scanf(\"%lld %lld\",&n,&k);\n x=n/k;\n if(x%2==1)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n return 0;\n}"}, {"source_code": "#include\n#include\n#include\n#include\nint main()\n{\n// int t=50;\n //\twhile(t--){\n \tunsigned long long x,y,z;\n \tscanf(\"%llu%llu\",&x,&y);\n \tz=x/y;\n \tif(z%2==1)\n \t\tprintf(\"YES\\n\");\n \telse\n \t\tprintf(\"NO\\n\");\n //}\nreturn 0;\n}"}, {"source_code": "#include \n\nint main(void)\n{\n\tlong long n, k;\n\tint rest = 1;\n\tscanf(\"%I64d %I64d\", &n, &k);\n\trest = (n / k) % 2;\n\tif (rest)\n\t\tputs(\"YES\");\n\telse\n\t\tputs(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n\t__int64 a,b;\n\tscanf(\"%I64d%I64d\",&a,&b);\n\tif((a%b==0&&a/b%2==1)||(a%b!=0&&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 \nint main(void)\n{\n long long int n, k, x;\n scanf(\"%lld %lld\", &n, &k);\n x = n / k;\n if(x % 2 != 0)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n long long n,k;\n int q;\n\n scanf(\"%I64d %I64d\",&n,&k);\n q=n/k;\n\n if (q%2==0)\n printf(\"NO\");\n else\n printf(\"YES\");\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int a,b;\n scanf(\"%lld%lld\",&a,&b);\n if((a/b)%2==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n\n"}, {"source_code": "int main()\n{\n long long int n,k,a,b,c;\n scanf(\"%I64d %I64d\",&n,&k);\n if ((n/k)%2==0)\n printf(\"NO\");\n else\n printf(\"YES\");\n return 0;\n}"}, {"source_code": "#include\nint main(){\n long long n,k,l;\n scanf(\"%I64d %I64d\",&n,&k);\n l=n/k;\n if(l%2==1){\n printf(\"YES\");\n }else {\n printf(\"NO\");\n }\nreturn 0;\n}\n"}, {"source_code": "#include \n#include \nint compare(void *,void *);\nint main(int argc, char *argv[]) \n{\n\tlong long int a,b;\n\tscanf(\"%lld %lld\",&a,&b);\n\t\n\tif(a%(2*b)>=b)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n}"}, {"source_code": "#include\n#include\nint main()\n{\n long long int n,m;\n scanf(\"%lld%lld\",&n,&m);\n int c=n/m;\n // printf(\"%d\",n/m);\n if(c%2==0)\n {\n printf(\"NO\\n\");\n }\n else\n {\n printf(\"YES\\n\");\n }\n}"}, {"source_code": "#include\nint main()\n{\n long long int a,b,c;\n scanf(\"%I64d %I64d\",&a,&b);\n c=a/b;\n while (a>0 && b>0)\n {\n\n\n if(a%b>=0 && c%2!=0)\n {\n printf(\"YES\\n\"); break;\n }\n else if(a%b==0 && c%2==0)\n {\n printf(\"NO\\n\"); break;\n }\n else\n {\n printf(\"NO\\n\"); break;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main()\n{\n long long n,i,a,b,c ;\n\n scanf(\"%lld %lld\",&n,&a) ;\n\n i=n/a ;\n if(i%2!=0)\n {\n printf(\"Yes\") ;\n }\n else\n {\n printf(\"No\") ;\n }\n\n return 0 ;\n\n}\n"}, {"source_code": "#include \nint main()\n{\n long long num,k,c;\n\tscanf(\"%lld%lld\",&num,&k);\n\tc=num/k;\n\tif(c%2==0)\n\tprintf(\"NO\\n\");\n\telse\n\tprintf(\"YES\\n\");\n\treturn 0;\n}\n\t "}], "negative_code": [{"source_code": "#include\nint main()\n{\n unsigned long long int i, j;\n while(scanf(\"%I64d %I64d\", &i, &j) != EOF)\n {\n unsigned long long int k, q;\n k = i / j;\n q = i % j;\n if(k % 2 == 0 && q == 0){\n printf(\"YES\\n\");\n }\n else if(k % 2 == 0 && q != 0){\n printf(\"NO\\n\");\n }\n else if(k % 2 != 0 && q == 0){\n printf(\"YES\\n\");\n }\n else if(k % 2 != 0 && q != 0){\n printf(\"NO\\n\");\n }\n }\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int n, k;\n scanf(\"%d %d\", &n, &k);\n puts((n / k) & 1 ? \"YES\" : \"NO\");\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tlong long m,n;\n\tscanf(\"%ld %ld\",&m,&n);\n\t\n\tlong long a=m/n;\n\tif(a%2)\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse printf(\"NO\");\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,k,c;\n\tscanf(\"%d%d\",&n,&k);\n\tif ((n/k)!=0) printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,k;\n scanf(\"%d%d\",&n,&k);\n if(n/k==0){\n printf(\"yes\");\n }\n else{\n printf(\"no\");\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main ()\n{\n unsigned long long a,b,c;\n scanf(\"%u%u\",&a,&b);\n c=a/b;\n if(c%2==0)printf(\"NO\\n\");\n else printf(\"YES\\n\");\n return 0;\n\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n\n{\n int64_t n,k;\n\n scanf(\"%\"SCNd64,&n);\n scanf(\"%\"SCNd64,&k);\n\n printf(\"%s\",n%k==0?\"YES\":\"NO\");\n\n\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \nint main(){\nlong long n,k;\nscanf(\"%lld %lld\",&n,&k);\nif((n*k)%2==0){\n printf(\"NO\\n\");\n}\nelse{\n printf(\"YES\\n\");\n}\n\nreturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n long long signed i,t,n,k;\n scanf(\"%lld%lld\",&n,&k);\n for(i=0;i<=n;i++)\n t=n/k;\n\n if(n%2==0)\n printf(\"NO\");\n else\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n\tint n,k,s=0,l=0;\n\tscanf(\"%d%d\",&n,&k);\n\twhile(n>=k)\n\t{\n\t\tn=n-k;\n\t\ts++;\t\t\n\t\tif(n>=k)\n\t\t{\n\t\t l++;\n\t\t n=n-k;\n\t\t}\n\t}\n\tif(s>l)\n\tprintf(\"YES\\n\");\n\telse\n\tprintf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include \n\nint game(int totalstick, int stickperturn)\n{\n int isSasha = 1;\n \n while(totalstick >= stickperturn){\n totalstick = totalstick - stickperturn;\n if(isSasha)\n isSasha = 0;\n else\n isSasha = 1;\n }\n if(!isSasha)\n printf(\"YES\");\n else\n printf(\"NO\");\n}\nint main()\n{\n int tot, turn;\n scanf(\"%d\", &tot);\n scanf(\"%d\", &turn);\n \n game(tot, turn);\n\n return 0;\n}"}, {"source_code": "#include \nint main()\n{\n\tunsigned long long n, k, t;\n\tscanf(\"%d %d\", &n, &k);\n\tt = 2 * k;\n\twhile (n > t)\n\t\tn = n - t;\n\tif (n < k)\n\t\tprintf(\"NO\");\n\telse\n\t\tprintf(\"YES\");\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main ()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n if((a/b)==0)\n printf(\"NO\\n\");\n else\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include \n\n int n,k,m;\n\nint main(){\n\tscanf(\"%d %d\",&n,&k);\n\tm=n/k;\n\tif(m%2==0)\n\tprintf(\"NO\");\n\telse\n\tprintf(\"YES\");\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n, k, a;\n scanf(\"%d %d\", &n, &k);\n a = n/k ;\n if(a%2==0) printf(\"NO\\n\");\n else printf(\"YES\\n\");\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,k;\n scanf(\"%d%d\",&n,&k);\n if(n%k==0)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tlong n,k;\n\tscanf(\"%ld%ld\",&n,&k);\n\tif(n==k)\n\t{\n\t\t\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t{\n\t\tn=n/k;\n\t if(n==1||n%2!=0)\n\t\t\n\t\t{\n\t\t\tprintf(\"YES\");\n\t\t\t\n\t\t}\n\t\telse\n\t\tprintf(\"NO\");\n\t\t\n\t}\n\t\nreturn 0;\t\n}\n"}, {"source_code": "#include\n\nint main(){\n\nlong long int n, k;\n\nscanf(\"%lld %lld\", &n , &k);\n\n\nprintf(\"%I64d %I64d\" , n ,k);\n\nlong long int odd_even = n/k;\n\nif(odd_even%2 == 0)\n printf(\"NO\");\nelse\n printf(\"YES\");\n\n\n}"}, {"source_code": "#include \n\nint main(void)\n{\n\tlong long n, k;\n\tint rest;\n\tscanf(\"%l64d %l64d\", &n, &k);\n\trest = (n / k) & 1;\n\tif (rest)\n\t\tputs(\"YES\");\n\telse\n\t\tputs(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n long long int n,k;\n scanf(\"%lld %lld\",&n,&k);\n if(n==k){\n printf(\"YES\\n\");\n }\n else if(n>k){\n printf(\"NO\\n\");\n }\n else if(n\nint main()\n{\nlong long num,k,c;\n\tscanf(\"%l64d%l64d\",&num,&k);\n\tc=num/k;\n\tif(num-(c*k)>0)\n\tprintf(\"NO\\n\");\n\telse\n\tprintf(\"YES\\n\");\n\treturn 0;\n}\n\t "}, {"source_code": "#include \n\nint main()\n\n{\n int n,k;\n\n scanf(\"%d%d\",&n,&k);\n\n printf(\"%s\",n%k==0?\"YES\":\"NO\");\n\n\n return 0;\n}"}, {"source_code": "#include \nint main(){\n\n\n\nint n,k,g,i;\nscanf(\"%d %d\",&n,&k);\nfor(i=1;i*k<=n;i++)\ng=i;\nif(g%2!=0) printf(\"Yes\");\nelse printf(\"No\");\n\nreturn 0;\n\n\n\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,k,p;\n scanf(\"%d %d\",&n,&k);\n \n p=n%k;\n if(p%2!=0)\n {printf(\"NO\");}\n if(p%2==0)\n {printf(\"YES\");}\n \n}\n"}, {"source_code": "#include\nint main()\n{\n int n,k,p;\n scanf(\"%d %d\",&n,&k);\n \n p=n/k;\n if(p%2!=0)\n {printf(\"YES\");}\n if(p%2==0)\n {printf(\"NO\");}\n \n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n,m;\n while(scanf(\"%I64d%I64d\",&n,&m)==2)\n {\n if(n%m==0)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int moves,n,k;\n scanf(\"%i64 %i64\",&n,&k);\n moves=n/k;\n\n\n if(moves%2==0)\n printf(\"NO\");\n else\n printf(\"YES\");\n return 0;\n\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\nint main()\n{\n // while(1){\n long long x,y,z;\n scanf(\"%lld%lld\",&x,&y);\n z=x%y;\n \n if(z==0)\n \tprintf(\"YES\\n\");\n else if(z%2==1)\n \tprintf(\"YES\\n\");\n else\n \tprintf(\"NO\\n\");\n //}\nreturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int a,b,c,d;\n scanf(\"%d %d\", &a ,&b);\n if (a%b==0){\n c=a/b;\n if (c%2==0){\n printf(\"NO\");\n }\n else{\n printf(\"YES\");\n }\n }\n else{\n if (c%2!=0){\n printf(\"NO\");\n }\n else{\n printf(\"YES\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n\tlong long int n,k;\n\tint c,c1,c2;\n\tc1=0;c2=0;\n\tscanf(\"%lld%lld\",&n,&k);\n\tif(n < k)\n\t\tprintf(\"NO\");\n\telse if(n >= k)\n\t{\n\t\tc=1;\n\t\twhile(n=c2)\n\t\t\tprintf(\"YES\");\n\t\telse\n\t\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n long n,k;\n scanf(\"%lld %lld\",&n,&k);\n (n/k)%2==0?printf(\"NO\"): printf(\"YES\");\n\n\n\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int i,j,n,k,a,m,b;\n scanf(\"%lld%lld\",&n,&k);\n a=b=0;\n m=0;\n for(i=1;i<=n-(n%k);i=i+k)\n {\n if(m==0)\n {\n a=a+k;\n m=1;\n }\n else \n { \n b=b+k;\n m=0;\n } \n }\n if(m==0)\n {\n a=a+(n%k);\n }\n else b=b+(n%k);\n if(a>b)\n {\n printf(\"YES\");\n }\n else printf(\"NO\");\n}"}, {"source_code": "#include \n\nint main() {\n\tlong long n, k;\n\tscanf(\"%d %d\", &n, &k);\n\tint t = n/k;\n\tif (t%2){\n\t\tprintf(\"YES\\n\");\n\t}\n\telse{\n\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,c;\n scanf(\"%d %d\",&a,&b);\n c=a/b;\n while (a>0)\n {\n\n\n if(a%b>=0 && c%2!=0) printf(\"YES\\n\");\n else if(a%b==0 && c%2==0) printf(\"YES\\n\");\n else printf(\"NO\\n\"); break;\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n#include \n#include \nint main(int argc, char const *argv[])\n{\n\tlong long n,k;\n\tscanf(\"%I64d %I64d\",&n,&k);\n\tint temp=n%k;\n\tif(n==k){\n\t\tprintf(\"YES\\n\");\n\t}\n\tif(temp%2==1){\n\t\tprintf(\"YES\");\n\t}else{\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \nint n,k,a;\nint main ()\n{\n\tscanf(\"%d %d\", &n, &k);\n\tif((n/k)%2==0)\n\tprintf(\"NO\");\n\tif((n/k)%2==1)\n\tprintf(\"YES\");\n\t\n\t\n\t\n\n\n\n\n\n\n\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n long a,b;\n scanf(\"%l64d %l64d\",&a,&b);\n if(a%b==0)\n printf(\"YES\\n\");\n else\n printf(\"NO\\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 \n\nint main()\n{\n //printf(\"Hello World\");\n int n,k;\n scanf(\"%d %d\",&n,&k);\n int a=n/k;\n if(a%2==0)\n {\n \n printf(\"NO\");\n }\n else\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n int b;\n b=floor((n*1.0)/k);\n if(b%2 ==0)\n {\n printf(\"NO\");\n }\n else\n {\n printf(\"YES\");\n }\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,k,c=0;\n scanf(\"%d%d\",&n,&k);\n\n for(int i=k;i<=n;i=i+k)c++;\n if(c%2!=0)printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n long long n,k;\n scanf(\"%lld%lld\",&n,&k);\n if(n<=4)\n {\n printf(\"YES\");\n return 0;\n }\n\n long long m=n/k;\n if(m%2==1)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n\n}\n"}, {"source_code": "#include \nint main()\n{\n\tint num,k,c;\n\tscanf(\"%d%d\",&num,&k);\n\tc=num/k;\n\tif(num-(c*k)>0)\n\tprintf(\"NO\\n\");\n\telse\n\tprintf(\"YES\\n\");\n\treturn 0;\n}\n\t "}, {"source_code": "#include\nint main(){\nlong long int a,b,c,d,e,x,y,z;\n \nscanf(\"%lld %lld\",&a,&b);\nx=a/b;\ny=x%2;\nif(y==0){\nprintf(\"YES\");\n}else {\nprintf(\"NO\");\n}\nreturn 0;\n}"}, {"source_code": "#include \nint main()\n{\n\tunsigned long long n, k, t;\n\tscanf(\"%d %d\", &n, &k);\n\tt = 2 * k;\n\twhile (n > t)\n\t\tn = n - t;\n\tif (n < k)\n\t\tprintf(\"NO\");\n\telse\n\t\tprintf(\"YES\");\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main(void)\n{\n\tlong long n, k;\n\tscanf(\"%l64d %l64d\", &n, &k);\n\tif ((n / k) % 2 == 1)\n\t\tputs(\"YES\");\n\telse\n\t\tputs(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\nint main(){\n\tint n=0,k=0;\n\tscanf(\"%d %d\",&n,&k);\n\t//printf(\"%d %d\\n\",n,k);\n\tint d;\n\td=n/k;\n\t//printf(\"%d\",d);\n\t//r=n%k;\n\t//printf(\"%d %d\",n,k);\n\t\n\tif(d%2==1){\n\t\tprintf(\"YES\");\n\t}\n\telse {\n\t\tprintf(\"NO\");\n\t}\n}"}, {"source_code": "#include\nint main()\n{\n int n,k;\n while(~scanf(\"%d%d\",&n,&k))\n {\n int s=n/k;\n if(s%2==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include \nint main(){\n\tint n,k;\n\tscanf(\"%d%d\",&n,&k);\n\tif((n/k)%2==0){\n\t\tprintf(\"NO\");\n\t\treturn 0;\n\t}else if((n/k)%2==1){\n\t\tprintf(\"YES\");\n\t\treturn 0;\n\t}\n}\n"}, {"source_code": "#include\n\nint main(){\n\nlong long int n, k;\n\nscanf(\"%I64d %I64d\", &n , &k);\n\nif(n!= 1)\nprintf(\"%I64d %I64d\\n\" , n ,k);\n\nlong long int odd_even = n/k;\n\nif(n!=1)\nprintf(\"%I64d\\n\" , odd_even );\n\nif(odd_even%2 == 0)\n printf(\"NO\");\nelse\n printf(\"YES\");\n\n\n}"}, {"source_code": "#include\nint main()\n{\n int i,j,k,n;\n\n scanf(\"%d%d\",&n,&k);\n\n\n\n if((n/k) != 0)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include\nmain()\n{\n int n,k,d,p;\n scanf(\"%d %d\",&n,&k);\n if(n==k)\n {\n printf(\"YES\");\n }\n if(n>k)\n {\n d=n/k;\n p=n-(d*k);\n if(k>p)\n {\n if(d%2==0)\n {\n printf(\"NO\");\n }\n else\n {\n printf(\"YES\");\n }\n }\n }\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n#include \n#include \nint main(int argc, char const *argv[])\n{\n\tlong long n,k;\n\tscanf(\"%I64d %I64d\",&n,&k);\n\tint temp=n%k;\n\tif(n==k){\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t}\n\tif(temp%2==1){\n\t\tprintf(\"YES\");\n\t}else{\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n int k,n,m;\n scanf(\"%d%d\",&n,&k);\n m = n/k;\n if(m%2==0)\n printf(\"NO\");\n else\n printf(\"YES\");\n}\n"}, {"source_code": "#include\"stdio.h\"\nint main()\n{\n long n,k;\n scanf(\"%ld %ld\",&n,&k);\n if (n==k) printf(\"YES\");\n else if((n-k)%2==0) printf(\"NO\");\n else printf(\"YES\");\n\n return 0;\n}\n"}, {"source_code": "#include\nmain()\n{\n int n,m,a;\n scanf(\"%d%d\",&n,&m);\na=n/m;\n{\n if(a%2!=0)\n printf(\"YES\");\n else\n printf(\"NO\");\n}\n\n}\n"}, {"source_code": "#include \n\nint main(){\n \n long long int n;\n long long int k;\n scanf(\"%l64d %l64d\", &n, &k);\n \n long long int t = n/k;\n \n if(t%2==1){\n printf(\"YES\\n\");\n return 0;\n } else {\n printf(\"NO\\n\");\n return 0;\n }\n}"}, {"source_code": "#include\nint main()\n{\n int n,k,x;\n scanf(\"%d %d\",&n,&k);\n x=n/k;\n if(x%2==0)\n printf(\"NO\\n\");\n else printf(\"YES\\n\");\n}\n"}, {"source_code": "#include\n\nint main()\n{\n long long int n,k;\n scanf(\"%lld %lld\",&n,&k);\n\n if(n%k==0){\n printf(\"YES\\n\");\n }\n else{\n printf(\"NO\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tlong long int n,k,r;\n\tscanf(\"%lld%lld\",&n,&k);\n\tr=n*k;\n\tif(r%2==0)\n\tprintf(\"YES\");\n\telse\n\tprintf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tlong long n, k, i, j;\n\twhile (scanf(\"%I64d %I64d\", &n, &k) != EOF)\n\t{\n\t\tif (n == 0 || k == 0)break;\n\t\tj = n - k;\n\t\tif (j < k)\n\t\t{\n\t\t\tprintf(\"YES\\n\");\n\t\t\tcontinue;\n\t\t}\n\t\tif (j%k)i = (j / k) + 1;\n\t\telse i = j/k;\n\t\tif (j <= i*k)i = i;\n\t\tif (i % 2)printf(\"YES\\n\");\n\t\telse printf(\"NO\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\nmain() { char n[1000000],k[1000000]; scanf(\"%s %s\",n,k); printf(strcmp(n,k)?\"NO\":\"YES\"); }\n"}, {"source_code": "#include\"stdio.h\"\nint main()\n{\n long n,k;\n scanf(\"%ld %ld\",&n,&k);\n if (n==k) printf(\"YES\");\n else if((n-k)%2==0) printf(\"NO\");\n else printf(\"YES\");\n\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n,k,left=0,count=0,sum=0,i;\n\n scanf(\"%d %d\",&n,&k);\n\n if(n==1 && k==1)\n {\n printf(\"YES\");\n return 0;\n }\n\n\n for(i=0;i<1000;i++)\n {\n sum=k*i;\n if(n\n#include \n\nint main()\n{\n long long a,i,b,c=0,d=0;\n scanf(\"%I64d %I64d\",&a,&b);\n for(i=1;i<=a;i++){\n if(i%2!=0){\n a=a-b;\n c++;}\n else if(i%2==0&&a>=b){\n a=a-b;\n d++;}\n }\n if(c>d)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n}"}, {"source_code": "#include\nint main()\n{\n\tint n,k,i=1,c1=0,c2=0;\n\tscanf(\"%d%d\",&n,&k);\n\t\n\twhile (n>0){\n\t\tn-=k;\n\t\tif (i%2!=0) c1++;\n\t\telse c2++;\n\t\ti++;\n\t}\n\tif (c1>c2) printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}\n\t"}, {"source_code": "#include\n\nint main()\n{\n int n,k,left=0,count=0,sum=0,i;\n\n scanf(\"%d %d\",&n,&k);\n\n left=n/k;\n\n if(n%k==0)\n {\n printf(\"YES\");\n }\n else if(left%2==0)\n {\n printf(\"NO\");\n }\n else if(left%2!=0)\n {\n printf(\"YES\");\n }\n\n\n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long a,b,c;\n scanf(\"%ld %ld\", &a ,&b);\n c=a/b;\n if (c%2==0){\n printf(\"NO\");\n }\n else{\n printf(\"YES\");\n }\n return 0;\n}"}, {"source_code": " #include \n#include \n\nint main()\n{\n int n,i,k;\n scanf(\"%d%d\",&n,&k);\n \n \n for(i=1;n>=k;i++)\n {\n n=n-k;\n }\n if(i-1%2==0)\n printf(\"NO\");\n else\n printf(\"YES\");\n}\n \n "}, {"source_code": "#include\nint main()\n{\n int n,k,temp=0;\n scanf(\"%d %d\",&n,&k);\n temp=n/k;\n if(temp%2)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n\tlong long int n,k;\n\tint c,c1,c2;\n\tc1=0;c2=0;\n\tscanf(\"%lld%lld\",&n,&k);\n\tif(n < k)\n\t\tprintf(\"NO\");\n\telse if(n >= k)\n\t{\n\t\tc=1;\n\t\twhile(n=c2)\n\t\t\tprintf(\"YES\");\n\t\telse\n\t\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}"}, {"source_code": "int main()\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n\n if(n%k==0 && (n/k)%2!=0)\n printf(\"YES\");\n else\n printf(\"NO\");\n}\n"}, {"source_code": "#include\nint main ()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n if((a/b)%2==0)\n printf(\"NO\\n\");\n else\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,k;\n scanf(\"%d%d\",&n,&k);\n if(n/k==1){\n printf(\"yes\");\n }\n else{\n printf(\"no\");\n }\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n unsigned long long int n,k,s=0,l=0;\n scanf(\"%l64d %l64d\",&n,&k);\n\n while(n>k || n==k){\n n = n-k;\n s++;\n if(n>k || n==k){\n n = n-k;\n l++;\n }\n if(nl){\n printf(\"YES\\n\");\n }\n else if(s==l || s\n\nint main()\n{\n int n,k,left=0,count=0,sum=0,i;\n\n scanf(\"%d %d\",&n,&k);\n\n\n for(i=0;i<1000;i++)\n {\n sum=k*i;\n if(n\n#include \n\nint main()\n{\n int n,i,k;\n printf(\"number of sticks: \");\n scanf(\"%d\",&n);\n printf(\"number to cross out: \");\n scanf(\"%d\",&k);\n //method 1\n \n for(i=1;n>=k;i++)\n {\n n=n-k;\n }\n if(i-1%2==0)\n printf(\"no\");\n else\n printf(\"yes\");\n \n \n}\n"}, {"source_code": "#include \n\nint main(void)\n{\n\tint n, k;\n\tscanf(\"%d %d\", &n, &k);\n\tif ((n / k) & 1)\n\t\tputs(\"YES\");\n\telse\n\t\tputs(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint main(){\n int a,b;\n scanf(\"%d %d\",&a,&b);\n if(b>a){\n printf(\"YES\\n\");\n return 0;\n }\n if((a/b)%2==0){\n printf(\"NO\\n\");\n }else printf(\"YES\\n\");\n return 0;\n}"}, {"source_code": "#include\"stdio.h\"\nint main()\n{\n long n,k;\n scanf(\"%ld %ld\",&n,&k);\n if (n==k) printf(\"YES\");\n else if((n-k)%2==0) printf(\"NO\");\n else printf(\"YES\");\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,k,l;\n scanf(\"%d %d\",&n,&k);\n l=n/k;\n if(l==1)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,k,c=0;\n scanf(\"%d %d\",&n,&k);\n while(n>=k)\n {\n n=n-k;\n c++;\n }\n if(c%2!=0)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n}\n"}, {"source_code": "#include\nlong long k,n;\nint main()\n{\nint c;\nwhile(~scanf(\"%I64d%I64d\",&n,&k))\n{\nc=n/k;\nif(c==1||c==0) printf(\"YES\\n\");\nelse printf(\"NO\\n\");\n}\nreturn 0;\n}\n\n\n\n\n\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n,i,k;\n printf(\"number of sticks: \");\n scanf(\"%d\",&n);\n printf(\"number to cross out: \");\n scanf(\"%d\",&k);\n //method 1\n \n for(i=1;n>=k;i++)\n {\n n=n-k;\n }\n if(i-1%2==0)\n printf(\"no\");\n else\n printf(\"yes\");\n \n \n}\n"}, {"source_code": "#include\nint main()\n{\n int n,k,l;\n scanf(\"%d %d\",&n,&k);\n l=n/k;\n if(l%2==1)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,c;\n scanf(\"%d %d\",&a,&b);\n c=a/b;\n if(a%b>=0 && c%2!=0) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include\nint main ()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n if((a/b)%2==0)\n printf(\"NO\\n\");\n else\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long a,b,c;\n scanf(\"%ld %ld\", &a ,&b);\n c=a/b;\n printf(\"%ld\\n\",c);\n if (c%2==0){\n printf(\"NO\");\n }\n else{\n printf(\"YES\");\n }\n return 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n long long int n,k,left=0,count=0,sum=0,i;\n\n scanf(\"%d %d\",&n,&k);\n\n left=n/k;\n\n if(n%k==0 && left%2==0)\n {\n printf(\"NO\");\n }\n else if(n%k==0 && left%2!=0)\n {\n printf(\"YES\");\n }\n else if(n%k!=0 && left%2==0)\n {\n printf(\"NO\");\n }\n else\n {\n printf(\"YES\");\n }\n\n\n\n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{ long long int n,k,t;\n\tscanf(\"%d%d\",&n,&k);\n\tt=n/k;\n\tif(t%2!=0) printf(\"YES\"); else printf(\"NO\");\n}\n"}, {"source_code": "#include\nint main()\n{\n\tlong n,k;\n\tscanf(\"%ld%ld\",&n,&k);\n\tif(n==k)\n\t{\n\t\t\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t{\n\t\tn=n/k;\n\t if(n==1||n%2!=0)\n\t\t\n\t\t{\n\t\t\tprintf(\"YES\");\n\t\t\t\n\t\t}\n\t\telse\n\t\tprintf(\"NO\");\n\t\t\n\t}\n\t\nreturn 0;\t\n}\n"}, {"source_code": "#include \n\nint main()\n{\n unsigned long a,b;\n scanf(\"%lu %lu\", &a, &b);\n if((a/b)%2 == 0)\n printf(\"NO\");\n else\n printf(\"YES\");\n return 0;\n}"}, {"source_code": "#include \nint main()\n{\n\tint num,k,c;\n\tscanf(\"%d%d\",&num,&k);\n\tc=num/k;\n\tif(num-(c*k)>0)\n\tprintf(\"NO\\n\");\n\telse\n\tprintf(\"YES\\n\");\n\treturn 0;\n}\n\t "}, {"source_code": "#include\n#include\n#include\nint main()\n{\n\n #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 n,k;scanf(\"%d %d\",&n,&k);\n int i=1;\n while(k*i<=n)\n i++;\n if(i%2!=0)\n printf(\"NO\");\n else printf(\"YES\");\n}"}, {"source_code": "#include\nint main()\n{\n long int n,k;\n scanf(\"%ld %ld\",&n,&k);\n long int m;\n m=n%k;\n if(m!=0)\n {\n printf(\"NO\");\n }\n else\n {\n if((n/k)%2==0)\n {\n printf(\"NO\");\n }\n else\n {\n printf(\"YES\");\n }\n }\n}"}, {"source_code": "#include\nint main()\n{\n long long n,k,d;\n while(scanf(\"%l64d%l64d\",&n,&k)!=EOF)\n {\n d=n/k;\n if(d%2==0)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n }\n return 0;\n\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n,k,left=0,count=0,sum=0,i;\n\n scanf(\"%d %d\",&n,&k);\n\n\n for(i=0;i<1000;i++)\n {\n sum=k*i;\n if(n\nint main()\n{\n int i,j,k,n;\n\n scanf(\"%d%d\",&n,&k);\n\n\n\n if((n/k) != 0)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,k,count=0;\n scanf(\"%d %d\",&n,&k);\n while(n>=k)\n {\n n=n-k;\n count++;\n }\n if(count%2==0)\n printf(\"No\");\n else\n printf(\"Yes\");\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,k,count=0;\n scanf(\"%d %d\",&n,&k);\n while(n>=k)\n {\n n=n-k;\n count++;\n }\n if(count%2==0)\n printf(\"No\");\n else\n printf(\"Yes\");\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n int b;\n b=floor((n*1.0)/k);\n if(b%2 ==0)\n {\n printf(\"NO\");\n }\n else\n {\n printf(\"YES\");\n }\n return 0;\n}"}], "src_uid": "05fd61dd0b1f50f154eec85d8cfaad50"} {"nl": {"description": "While swimming at the beach, Mike has accidentally dropped his cellphone into the water. There was no worry as he bought a cheap replacement phone with an old-fashioned keyboard. The keyboard has only ten digital equal-sized keys, located in the following way: Together with his old phone, he lost all his contacts and now he can only remember the way his fingers moved when he put some number in. One can formally consider finger movements as a sequence of vectors connecting centers of keys pressed consecutively to put in a number. For example, the finger movements for number \"586\" are the same as finger movements for number \"253\": Mike has already put in a number by his \"finger memory\" and started calling it, so he is now worrying, can he be sure that he is calling the correct number? In other words, is there any other number, that has the same finger movements?", "input_spec": "The first line of the input contains the only integer n (1 ≤ n ≤ 9) — the number of digits in the phone number that Mike put in. The second line contains the string consisting of n digits (characters from '0' to '9') representing the number that Mike put in.", "output_spec": "If there is no other phone number with the same finger movements and Mike can be sure he is calling the correct number, print \"YES\" (without quotes) in the only line. Otherwise print \"NO\" (without quotes) in the first line.", "sample_inputs": ["3\n586", "2\n09", "9\n123456789", "3\n911"], "sample_outputs": ["NO", "NO", "YES", "YES"], "notes": "NoteYou can find the picture clarifying the first sample case in the statement above."}, "positive_code": [{"source_code": "#include \n#include \n\nint main() {\n\tint test;\n\tchar inp[11];\n\tint inp2[11];\n\tscanf (\"%d\\n\",&test);\n\tgets(inp);\n\tmemset (inp2, 0, sizeof(inp2));\n\tint x, check=1;\n\tfor (x=0;x0||inp2[4]>0||inp2[7]>0||inp2[0]>0)) {\n\t\tprintf (\"NO\\n\");\n\t}\n\telse if (!(inp2[3]>0||inp2[6]>0||inp2[9]>0||inp2[0]>0)) {\n\t\tprintf(\"NO\\n\");\n\t}\n\telse if (!(inp2[1] > 0 || inp2[2]>0 || inp2[3]>0)) {\n\t\tprintf(\"NO\\n\");\n\t}\n\telse if (!(inp2[7] >0 || inp2[0] >0 ||inp2[9]>0)) {\n\t\tprintf(\"NO\\n\");\n\t}\n\telse {\n\t\tprintf(\"YES\\n\");\n\t}\n}\n"}, {"source_code": "#include \n\nint flag[10];\n\nint main(void) {\n\tint n;\n\tchar c;\n\tscanf(\"%d\\n\", &n);\n\t\n\twhile (n-- > 0) {\n\t\tscanf(\"%c\", &c);\n\t\tflag[c - '0'] = 1;\n\t}\n\t\n\tif (flag[1] && flag[9] ||\n\t\tflag[3] && flag[7] ||\n\t\tflag[0] && flag[1] ||\n\t\tflag[0] && flag[2] ||\n\t\tflag[0] && flag[3] ||\n\t\tflag[1] && flag[6] && flag[7] ||\n\t\tflag[3] && flag[4] && flag[9] ||\n\t\tflag[7] && flag[2] && flag[9] ||\n\t\tflag[7] && flag[6] && flag[2] ||\n\t\tflag[2] && flag[4] && flag[9])\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t\tprintf(\"NO\");\n\n\treturn 0;\n}\t\n"}, {"source_code": "#include\n#include\n#include\n#include\n#include\nint main()\n{\n int i,n,fl1=0,fl2=0,fl3=0,fl4=0;\n scanf(\"%d \",&n);\n char a[n],b[4][n];\n gets(a);\n for(i=0;i\nint main()\n{\n int num[12];\n int n;\n char k[15];\n while(scanf(\"%d\",&n)!=EOF)\n {\n int ans=0;\n for(int i=0;i<=9;i++)\n num[i]=0;\n scanf(\"%s\",k);\n for(int i=0;i\n#include \nint main(){\n\tint x[10]={2,1,2,3,1,2,3,1,2,3};\n\tint y[10]={4,1,1,1,2,2,2,3,3,3};\n\tint flag,n,a[10],i,flag1=0,flag2=0;\n\tscanf(\"%d \",&n);\n\tchar c;\n\tfor(i=0;imaxx)maxx=x[a[i]];\n\t\tif (y[a[i]]maxy)maxy=y[a[i]];\n\t}\n\t//printf(\"%d %d %d %d\\n\",minx, maxx, miny, maxy);\n\tif ((maxy-miny)==3) flag=0;\n\telse if((maxx-minx)==2 && (maxy-miny)==2 && flag1 && !flag2) flag=0;\n\telse flag=1;\n\tif (flag ==0) printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include\n#include\n#include\n#include\ntypedef struct\n{\n\tint x,y;\n\n}phone;\nphone c[11];\nint flag[5];\nint main()\n{\n\t\n\tint n,i,j,k;\n\tchar a;\n\tscanf(\"%d\\n\",&n);\n\tfor(i=1;i<=n;i++){\n\t\tscanf(\"%c\",&a);\n\t\tc[i].x=(a-'0')%3;\n\t\tif(c[i].x==0)\n\t\t\tc[i].x=3;\n\t\tc[i].y=(a-'0'-1)/3+1;\n\t\tif(a=='0'){\n\t\t\tc[i].x=2;c[i].y=4;\n\t\t}\n\t}\n\tfor(i=1;i<=n;i++){\n\t\tif(c[i].x+1>=4){\n\t\t\tflag[1]=1;\n\t\t\tbreak;\n\t\t}\t\n\t\tif(c[i].y==4&&c[i].x+1!=2){\n\t\t\tflag[1]=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tfor(i=1;i<=n;i++){\n\t\tif(c[i].x-1<=0){\n\t\t\tflag[2]=1;\n\t\t\tbreak;\n\t\t}\t\n\t\tif(c[i].y==4&&c[i].x-1!=2){\n\t\t\tflag[2]=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tfor(i=1;i<=n;i++){\n\t\tif(c[i].y+1>4){\n\t\t\tflag[3]=1;\n\t\t\tbreak;\n\t\t}\n\t\tif(c[i].y+1==4&&c[i].x!=2){\n\t\t\tflag[3]=1;\n\t\t\tbreak;\n\t\t}\n\t\n\t}\n\tfor(i=1;i<=n;i++){\n\t\tif(c[i].y-1<=0){\n\t\t\tflag[4]=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(flag[1]&&flag[2]&&flag[3]&&flag[4])\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\treturn 0;\n} "}, {"source_code": "#include \n#include \n\nint main()\n{\n int n,i,flag0=0,flagup=0,flagright=0,flagleft=0,flagdown=0;\n char ptrn[10];\n /*for(i=0;i='1' && ptrn[i]<='3'){\n printf(\"YES\");\n flag0=2;\n break;\n }\n }\n if(flag0==1){\n printf(\"NO\");\n }\n }\n else{\n // printf(\"try=%d\\n\",n);\n for(i=0;i='1' && ptrn[i]<='3'){\n flagup=1;\n // printf(\"\\n ptrnup[%d]=%c\",i,ptrn[i]);\n\n }\n if(ptrn[i]=='3' || ptrn[i]=='6' || ptrn[i]=='9'){\n flagright=1;\n // printf(\"\\n ptrnrit[%d]=%c\",i,ptrn[i]);\n }\n if(ptrn[i]=='1' || ptrn[i]=='4' || ptrn[i]=='7'){\n flagleft=1;\n // printf(\"\\n ptrnlft[%d]=%c\",i,ptrn[i]);\n }\n if(ptrn[i]=='7' || ptrn[i]=='9'){\n flagdown=1;\n // printf(\"\\n ptrndwn[%d]=%c\",i,ptrn[i]);\n // printf(\"a7eee\");\n }\n }\n if(flagdown==1 && flagleft==1 && flagright==1 && flagup==1){\n printf(\"YES\");\n // printf(\"\\n i=%d up %d down %d left %d right %d\",i,flagup,flagdown,flagleft,flagright);\n }\n else{\n printf(\"NO\");\n // printf(\"\\n i=%d up %d down %d left %d right %d\",i,flagup,flagdown,flagleft,flagright);\n }\n }\n\n\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n#include\nchar arr[20][20]={\"31\",\"00\",\"01\",\"02\",\"10\",\"11\",\"12\",\"20\",\"21\",\"22\"};\nchar input[50];\nint res[20];\nint cnt;\nvoid solve(){\nint k=0;int c=0; int a=0; int i,x;\nfor(i=0;i3 || t1<0 || t1>2 || (t==3 && t1==0) || (t==3 && t1==2))\n flag=0;\n }\n if(flag){\n cnt++;\n }\n }\n}\n}\nint main(){\nint a,b,c,d,e;\nscanf(\"%d\",&a);getchar();\ngets(input);\nsolve();\ncnt>1?printf(\"NO\"):printf(\"YES\");\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n#include\nchar arr[20][20];\nint cmp[20];\nchar numbs[50];\nint flag;\nint cnt;\nint solve(){\nint len=strlen(numbs); int i; int k=0;\nfor(i=0;i3 || t<0 || t1>2 || t1<0 || (t==3 && t1==0) || (t==3 && t1==2))\nflag=0;;\n}\nif(flag){\ncnt++;\nif(cnt==2){\nprintf(\"NO\");\nreturn;}}\n}\n}\n}\nint main(){\nint a,b,c,d,e,f,g,h;\nstrcpy(arr[0],\"31\");\nstrcpy(arr[1],\"00\");\nstrcpy(arr[2],\"01\");\nstrcpy(arr[3],\"02\");\nstrcpy(arr[4],\"10\");\nstrcpy(arr[5],\"11\");\nstrcpy(arr[6],\"12\");\nstrcpy(arr[7],\"20\");\nstrcpy(arr[8],\"21\");\nstrcpy(arr[9],\"22\");\nscanf(\"%d\",&f);\ngetchar();\ngets(numbs);\nsolve();\nif(cnt!=2){\n printf(\"YES\");\n}\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,i;\n\tchar arr[10];\n\tscanf(\"%d\",&n);\n\tint a[10] = {0};\n\tscanf(\"%s\",arr);\n\tfor(i=0; i\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#define long int64_t\n#define fore(i,k,n) for (int _k = (k), _n = (n), i = _k; i <= _n; ++i)\n#define forr(i,n,k) for (int _k = (k), _n = (n), i = _n; i >= _k; --i)\n#define scani(x) int x; scanf(\"%d\", &x)\n#define scans(x) static char x[LEN]; scanf(\"%s\", x)\n#define LIST_INIT_CAP 4\n#define HASH_INIT_CAP 64\n#define HASH_SKIP 11\n#define TREE_INIT_CAP 1024\n#define TREE_MAX_HEIGHT 64\n#define DEQUE_INIT_CAP 1024\n#define HEAP_INIT_CAP 1024\n#define TAKEN 1\n#define EMPTY 0\n#define TOMB -1\n#define max(a,b) (((a)>(b))?(a):(b))\n#define min(a,b) (((a)<(b))?(a):(b))\n\n#define LEN 2004\n\nchar va[10][4] = { { -1, -1, -1, 0 },\n { 0, 0, -1, -1 }, { 0, 0, 0, -1}, { -1, 0, 0, -1 },\n { 0, 0, -1, 0 }, { 0, 0, 0, 0}, {-1, 0, 0, 0},\n { 0, -1, -1, 0}, {0, 0, 0,0 }, {-1, -1, 0, 0} };\n\n\nint main() {\n scani(n);\n scans(str);\n fore (i, 0, n-1) str[i] -= '0';\n fore (j, 0, 3) {\n bool ok = false;\n fore (i, 0, n-1) {\n if (va[str[i]][j] == -1) ok = true;\n }\n if (!ok) { printf(\"NO\"); return 0; }\n }\n printf(\"YES\");\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\ntypedef struct {\n\tint vert, hori;\n} vektor;\ntypedef struct{\n\tint vert, hori;\n} adresa;\n\nadresa br2adr(char a){\n\tadresa adr;\n\tif (a == '1') {adr.vert = 0; adr.hori = 0; return adr;}\n\tif (a == '2') {adr.vert = 0; adr.hori = 1; return adr;}\n\tif (a == '3') {adr.vert = 0; adr.hori = 2; return adr;}\n\tif (a == '4') {adr.vert = -1; adr.hori = 0; return adr;}\n\tif (a == '5') {adr.vert = -1; adr.hori = 1; return adr;}\n\tif (a == '6') {adr.vert = -1; adr.hori = 2; return adr;}\n\tif (a == '7') {adr.vert = -2; adr.hori = 0; return adr;}\n\tif (a == '8') {adr.vert = -2; adr.hori = 1; return adr;}\n\tif (a == '9') {adr.vert = -2; adr.hori = 2; return adr;}\n\tif (a == '0') {adr.vert = -3; adr.hori = 1; return adr;}\n\t/*inace:*/\n\tadr.hori = adr.vert = -1;\n\treturn adr;\n}\n\nchar adr2br(adresa adr){\n\tif (adr.vert == 0 && adr.hori == 0) { return '1';}\n\tif (adr.vert == 0 && adr.hori == 1) { return '2';}\n\tif (adr.vert == 0 && adr.hori == 2) { return '3';}\n\tif (adr.vert == -1 && adr.hori == 0) { return '4';}\n\tif (adr.vert == -1 && adr.hori == 1) { return '5';}\n\tif (adr.vert == -1 && adr.hori == 2) { return '6';}\n\tif (adr.vert == -2 && adr.hori == 0) { return '7';}\n\tif (adr.vert == -2 && adr.hori == 1) { return '8';}\n\tif (adr.vert == -2 && adr.hori == 2) { return '9';}\n\tif (adr.vert == -3 && adr.hori == 1) { return '0';}\n\t/*inace:*/\n\treturn -1;\n}\n\nvektor kretanje(char a, char b){\n\tvektor vek;\n\tvek.vert = (br2adr(b).vert-br2adr(a).vert);\n\tvek.hori = (br2adr(b).hori-br2adr(a).hori);\n\treturn vek;\n}\n\nchar *proseci(vektor *put, char pocbr, int dimbr){\n\t/*obavlja setnju po putu zadanom vektorima u polju i vraca\n\t telefonski broj (string) koji se dobije*/\n\t\n\tchar *broj = NULL;\n\tchar el;\n\tint i;\n\tadresa tren;\n\t\n\tbroj = (char *) malloc(sizeof(char) * (dimbr + 1));\n\t\n\tbroj[0] = pocbr;\n\ttren = br2adr(pocbr);\n\t\n\tfor(i = 1; i < dimbr; i++){\n\t\t\n\t\ttren.hori += put[i-1].hori;\n\t\ttren.vert += put[i-1].vert;\n\t\tel = adr2br(tren);\n\t\tif (el == -1) return NULL;\n\t\tbroj[i] = adr2br(tren);\n\t\t\n\t}\n\t\n\tbroj[i] = '\\0';\n\t/*printf(\"%s\\n\", broj);*/\n\treturn broj;\n\t\n}\n\nint main(){\n\tint n, i; /*duljina niza brojeva*/\n\tchar str[9+1];\n\tchar trbr;\n\tchar *nbr;\n\tvektor *put;\n\t\n\tscanf(\"%d\", &n);\n\tscanf(\"%s\", str);\n\t/*napravi polje vektora put*/\n\tput = (vektor *) malloc(sizeof(vektor) * (n-1));\n\ttrbr = str[0];\n\tfor(i = 1; i < n; i++){\n\t\tput[i-1] = kretanje(trbr, str[i]);\n\t\ttrbr = str[i];\n\t}\n\t\n\t/*printf(\"\\nVektor:\\n\");\n\tfor(i = 0; i < n-1; i++)\n\t\tprintf(\"%2d%2d\\n\", put[i].vert, put[i].hori);\n\tprintf(\"\\n\");*/\n\t\n\tfor(i = '0'; i <= '9'; i++){\n\t\tnbr = proseci(put, i, n);\n\t\tif (nbr != NULL){\n\t\t\t/*printf(\"%s \", nbr);*/\n\t\t\tif (strcmp(nbr, str) != 0){\n\t\t\t\tprintf(\"NO\");\n\t\t\t\tfree(put);\n\t\t\t\tfree(nbr);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tprintf(\"YES\");\n\tfree(put);\n\tfree(nbr);\n\t\n\treturn 0;\n}\n\n\n"}, {"source_code": "//Created by Pratik Mandlecha\n\n#include\n#include\n#include\n#include\nint main()\n{\n\tint n,i,flag=0,a[10]={0},c[4],rmax=0,cmax=0;\n\tscanf(\"%d\",&n);\n\tchar s[12];\n\tscanf(\"%s\",s);\n\tint l=strlen(s);\n\tfor(i=0;i0) flag=1;\n\t/*for(i=1;i<10;i++)\n\t{\n\t\tif(a[i]>0) c[((i-1)/3)]++\n\t}*/\n\tif(((a[1]>0)||(a[4]>0)||(a[7]>0))&&((a[3]>0)||(a[6]>0)||(a[9]>0))) cmax=1;\n\tif(((a[1]>0)||(a[2]>0)||(a[3]>0))&&((a[7]>0)||(a[9]>0))) rmax=1;\n\t\n\t//if((a[8]>0)&&(a[7]==0)&&(a[9]==0)) rmax=0;\n//\tprintf(\"cm=%d rm=%d\",cmax,rmax);\n\tif(flag==1)\n\t{\n\t\tif((a[1]>0)||(a[2]>0)||(a[3]>0)) flag=2;\n\t}\n\tif(flag==0)\n\t{\n\t\tif((rmax==1)&&(cmax==1)) flag=2;\n\t}\n\tif(flag==2) printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tlong long int n,f,co[10][2],i,no[10],m=0,j,mo[10][2],flag=0,val,last,a[2],k;\n\tchar r[10];\n\tscanf(\"%lld\",&n);\n\tscanf(\"%s\",r);\n\tco[0][0]=4;\n\tco[0][1]=2;\n\tco[1][0]=1;\n\tco[1][1]=1;\n\tco[2][0]=1;\n\tco[2][1]=2;\n\tco[3][0]=1;\n\tco[3][1]=3;\n\tco[4][0]=2;\n\tco[4][1]=1;\n\tco[5][0]=2;\n\tco[5][1]=2;\n\tco[6][0]=2;\n\tco[6][1]=3;\n\tco[7][0]=3;\n\tco[7][1]=1;\n\tco[8][0]=3;\n\tco[8][1]=2;\n\tco[9][0]=3;\n\tco[9][1]=3;\n\t//for(i=0;i\nint main()\n{\n\tlong long int n,f,co[10][2],i,no[10],m=0,j,mo[10][2],flag=0,val,last,a[2],k;\n\tchar r[10];\n\tscanf(\"%lld\",&n);\n\tscanf(\"%s\",r);\n\tco[0][0]=4;\n\tco[0][1]=2;\n\tco[1][0]=1;\n\tco[1][1]=1;\n\tco[2][0]=1;\n\tco[2][1]=2;\n\tco[3][0]=1;\n\tco[3][1]=3;\n\tco[4][0]=2;\n\tco[4][1]=1;\n\tco[5][0]=2;\n\tco[5][1]=2;\n\tco[6][0]=2;\n\tco[6][1]=3;\n\tco[7][0]=3;\n\tco[7][1]=1;\n\tco[8][0]=3;\n\tco[8][1]=2;\n\tco[9][0]=3;\n\tco[9][1]=3;\n\t//for(i=0;i\n\nstatic int map[10];\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n getchar();\n\n while(n--)\n {\n char c;\n c = getchar();\n\n map[ c - '0' ] = 1;\n }\n\n int flag = 0;\n\n if( !(map[1] || map[4] || map[7] || map[0]) ) flag = 1;\n else if( !(map[3] || map[6] || map[9] || map[0]) ) flag = 1;\n else if ( !(map[1]||map[2]||map[3]) ) flag = 1;\n else if(!(map[7] || map[9] || map[0])) flag = 1;\n else if( !(map[1]||map[2]||map[3]||map[4]||\n map[7]) ) flag = 1;\n else if( !(map[1]||map[2]||map[3]||map[6]||\n map[9]) ) flag = 1;\n else if( !(map[1]||map[4]||map[7]||map[8]||\n map[0]) ) flag = 1;\n else if( !(map[3]||map[6]||map[9]||map[8]||\n map[0]) ) flag = 1;\n\n if(flag == 1) printf(\"NO\\n\");\n else printf(\"YES\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(void) {\n\n\tint n,arr[10],i,flag=0;\n\tchar inp[11];\n\tfor(i=0;i<10;i++){\n\t\tarr[i] = 0;\n\t}\n\tscanf(\"%d\",&n);\n\tscanf(\"%s\",inp);\n\tfor(i=0;i3) || (arr[0]==1 && total>4)){\n\t\tflag = 1;\n\t}\n\tif(rh == 3 && arr[7]==0 && arr[9]==0){\n\t\tflag = 0;\n\t}\n\tif(flag == 0){\n\t\tprintf(\"NO\");\n\t}else {\n\t\tprintf(\"YES\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\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(xval)\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*xval;\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;ib)\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 char s[100];\n int n,ans,i,ar[100];\n int right,left,top,bottom;\n right=1;\n left=1;\n top=1;\n bottom=1;\n scan(n);\n scanf(\"%s\",s);\n for(i=0;i\n\nint good(char *s, char *a, int n) {\n\tint i;\n\n\tfor (i = 0; i < n; i++)\n\t\tif (a[s[i] - '0'] == '1')\n\t\t\treturn 0;\n\treturn 1;\n}\n\nint main() {\n\tint n;\n\tchar s[10];\n\tchar l[11] = \"1100100100\"; /*unable to move left or not*/\n\tchar r[11] = \"1001001001\"; /*right*/\n\tchar u[11] = \"0111000000\"; /*up*/\n\tchar d[11] = \"1000000101\"; /*down*/\n\n\tscanf(\"%d\\n\", &n);\n\tscanf(\"%s\", s);\n\tprintf(\"%s\\n\", good(s, l, n) || good(s, r, n)\n\t\t|| good(s, u, n) || good(s, d, n) ? \"NO\" : \"YES\");\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint n, visit[10], res;\n\nint ans() {\n if(visit[1]==0 && visit[2]==0 && visit[3]==0) return 1;\n if(visit[7]==0 && visit[9]==0 && visit[0]==0) return 1;\n if(visit[0]==1) return 0;\n if(visit[1]==0 && visit[4]==0 && visit[7]==0) return 1;\n if(visit[3]==0 && visit[6]==0 && visit[9]==0) return 1;\n return 0;\n}\n\nint main() {\n scanf(\"%d\", &n);\n for(int i=0;i\n#include \n#include \nstruct pv{\n\tint x;\n\tint y;\n};\n\nint main()\n{\n\tstruct pv num[10],route[10];\n\tnum[1].x=1;\n\tnum[1].y=1;\n\n\tnum[2].x=2;\n\tnum[2].y=1;\n\n\tnum[3].x=3;\n\tnum[3].y=1;\n\n\tnum[4].x=1;\n\tnum[4].y=2;\n\n\tnum[5].x=2;\n\tnum[5].y=2;\n\n\tnum[6].x=3;\n\tnum[6].y=2;\n\n\tnum[7].x=1;\n\tnum[7].y=3;\n\n\tnum[8].x=2;\n\tnum[8].y=3;\n\n\tnum[9].x=3;\n\tnum[9].y=3;\n\n\tnum[0].x=2;\n\tnum[0].y=4;\n\n\tint n,key2,key1,i,j;\n\tchar str[10];\n\t//hardcoding\n\tscanf(\"%d\",&n);\n\tscanf(\"%s\",str);\n\n\n\n\n\n\t\n\tfor(i=1;i=1 && dest.y>=1 && dest.y<=3))\n\t\t\t{\n\n\t\t\t\tif(!(dest.x==2&&dest.y==4))\n\t\t\t\t{\t//printf(\"break\\n\");\n\t\t\t\t\tfail=1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tsrc.x=dest.x;\n\t\t\tsrc.y=dest.y;\n\n\t\t}\n\t\tif(j==n && fail==0)// we were able to find the number\n\t\t{\t\n\t\t\t//printf(\"success\\n\");\n\t\t\tcnt++;\n\t\t\tbreak;\n\t\t}\n\n\n\n\t\t\n\n\n\t}\n\tif(cnt>0)\n\t{\n\t\tprintf(\"NO\");\n\t}\n\telse\n\t{\n\t\tprintf(\"YES\");\n\t}\n\t\n\n\n return 0;\n\t\n}"}, {"source_code": "#include\nint main()\n{\n\tint n,i,k,s=0;\n\tscanf(\"%d\",&n);\n\tchar a[n+5];\n\tscanf(\"%s\",a);\n\tint p[10]={0,1,2,3,4,5,6,7,8,9};\n\tfor(i=0;i\n\nint a[10];\nint left[10]={-1,-1,1,2,-1,4,5,-1,7,8};\nint right[10]={-1,2,3,-1,5,6,-1,8,9,-1};\nint up[10]={8,-1,-1,-1,1,2,3,4,5,6};\nint down[10]={-1,4,5,6,7,8,9,-1,0,-1};\n\nint main()\n{\n char s;\n int n,i,x,flag,ans;\n\n scanf(\"%d \",&n);\n for(i=0;i\nint i;\nint x(char b[10],int n)\n{\nfor(i=0;i\n\nchar Flag[4];\n\nint main()\n{\n int n;\n char str[10];\n scanf(\"%d %s\", &n, str);\n for(int i = 0; i < n; ++i) {\n int num = str[i] - '0';\n if(num >= 1 && num <= 3) {\n Flag[0] = 1;\n }\n if(num == 7 || num == 0 || num == 9) {\n Flag[1] = 1;\n }\n if(num == 1 || num == 4 || num == 7 || num == 0) {\n Flag[2] = 1;\n }\n if(num == 3 || num == 6 || num == 9 || num == 0) {\n Flag[3] = 1;\n }\n }\n puts(Flag[0]&Flag[1]&Flag[2]&Flag[3] ? \"YES\" : \"NO\");\n return 0;\n}\n"}, {"source_code": "#include\n//分情况\n//如果有零,那么只能向上移动,看上面有没有空隙\n//如果没有零,不用这种分类,直接移动!\n#define N 10\nint main() {\n int n;\n scanf(\"%d\",&n);\n char s[N];\n scanf(\"%s\",s);\n char phone[6][5];\n int i,j;\n for(i=0;i<6;i++){\n for(j=0;j<5;j++){\n phone[i][j]='#';\n }\n }\n for(i=1;i<=3;i++){\n for(j=1;j<=3;j++){\n phone[i][j]='*';\n }\n }\n phone[4][2]='*';\n /*\n for(i=0;i<6;i++){\n for(j=0;j<5;j++){\n printf(\"%c\",phone[i][j]);\n }\n printf(\"\\n\");\n }\n */\n\n\n int x[N];\n int y[N];\n x[1]=1; y[1]=1;\n x[2]=1; y[2]=2;\n x[3]=1; y[3]=3;\n x[4]=2; y[4]=1;\n x[5]=2; y[5]=2;\n x[6]=2; y[6]=3;\n x[7]=3; y[7]=1;\n x[8]=3; y[8]=2;\n x[9]=3; y[9]=3;\n x[0]=4; y[0]=2;\n //#代表边界!\n int ok=1;\n int move=0;\n for(i=0;i \nint main() \n{ \nint i,a,p[7]={0,0,0,0,0,0,0},n,b,c,ch[10]={0}; char st[10]; \nscanf(\"%d %s\",&n,&st); for(i=0;st[i]!='\\0';i++) \n{ \na=st[i]-'0'; \nif(a) \n{ \nb=(a-1)/3; \nc=(a-1)%3; \np[b]=1; \np[3+c]=1;\nif(a==7)\nch[7]=1;\nif(a==8)\nch[8]=1;\nif(a==9)\nch[9]=1;\n }\n else p[6]=1;\n }\nif(!ch[7]&&!ch[9]&&ch[8]&&!p[6])\nprintf(\"NO\"); else if(p[0]&&p[2]&&p[3]&&p[5]&&!p[6]) \nprintf(\"YES\"); \nelse if(p[0]&&p[6]) printf(\"YES\"); \nelse \nprintf(\"NO\"); \nreturn 0; \n}"}, {"source_code": "#include \n\nint main(void) {\n\n int n,i,test=0,t=1;\n char x;\n\n if(test){ scanf(\"%d\",&t);}\n while(t--)\n {\n int flag1=0,flag2=0,flag3=0,flag4=0;\n scanf(\"%d\",&n);\n for(i=0;i\n#include \n#include \n#include \n\nint d[10];\n\nint main() {\n\tint n;\n\tchar s[10];\n\tscanf(\"%d%s\", &n, s);\n\tfor(int i=0 ; i\n#include \n\nstatic int arr[4][3];\n\nvoid setnum(char ch);\n\nint check_left(){\n\treturn !(arr[0][0] || arr[1][0] || arr[2][0] || arr[3][1]);\n}\n\nint check_right() {\n\treturn !(arr[0][2] || arr[1][2] || arr[2][2] || arr[3][1]);\n}\n\nint check_top() {\n\treturn !(arr[0][0] || arr[0][1] || arr[0][2]);\n}\n\nint check_bottom() {\n\treturn !(arr[2][0] || arr[3][1] || arr[2][2]);\n}\n\nint main()\n{\n\tchar str[10];\n\tint r, c, i, n;\n\tint haszero = 0;\n\n\tscanf(\"%d\", &n);\n\tscanf(\"%s\", str);\n\n\tfor (i = 0; i < n; i++) {\n\t\tsetnum(str[i]);\n\t\tif(str[i] == '0') haszero = 1;\n\t}\n\n if(check_left() || check_right() || check_top() || check_bottom()) printf(\"NO\");\n else printf(\"YES\");\n\n return 0;\n}\n\nvoid setnum(char ch) {\n switch (ch) {\n\t\tcase '0': arr[3][1] = ch; return;\n\t\tcase '1': arr[0][0] = ch; return;\n\t\tcase '2': arr[0][1] = ch; return;\n\t\tcase '3': arr[0][2] = ch; return;\n\t\tcase '4': arr[1][0] = ch; return;\n\t\tcase '5': arr[1][1] = ch; return;\n\t\tcase '6': arr[1][2] = ch; return;\n\t\tcase '7': arr[2][0] = ch; return;\n\t\tcase '8': arr[2][1] = ch; return;\n\t\tcase '9': arr[2][2] = ch; return;\n }\n}\n"}, {"source_code": "# include \n\nint main() {\n\tint A[4][4];\n\tint num = 1;\n\tint i,j,k;\n\tfor(i=0;i<3;i++){\n\t\tfor(j=0;j<3;j++){\n\t\t\tA[i][j] = num;\n\t\t\tnum++; \n\t\t}\n\t}\n\n\tA[3][0] = -1;\n\tA[3][1] = 0;\n\tA[3][2] = -1;\n\n\tint n;\n\tscanf(\"%d\",&n);\n\tchar arr[n];\n\tint Arr[n];\n\tscanf(\"%s\",arr);\n\tint I[n];\n\tint J[n];\n\tfor(i=0;i= 0 && tempi <= 2){\n\t\t\t\t\t\tif(tempj >= 0 && tempj <= 2){\n\t\t\t\t\t\t\t;\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tflag=0;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}else{\n\t\t\t\t\t\tif(tempi==3 && tempj==1){\n\t\t\t\t\t\t\t;\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tflag=0;\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}\n\t\t\t\tif(flag==1){\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif(count==1){\n\t\tprintf(\"YES\\n\");\n\t}else{\n\t\tprintf(\"NO\\n\");\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint main(){\n int n,i=0,flag=0;\n scanf(\"%d \",&n);\n if(n==1){\n printf(\"NO\");\n return 0;\n }\n char a[n],b[n];\n gets(a);\n for(i=0;i'9'||b[i]=='3'){\n flag=1;\n break;\n }\n }\n if(flag==0) {\n printf(\"NO\");\n return 0;\n }\n flag=0;\n for(i=0;i'9'){\n flag=1;\n break;\n }\n }\n if(flag==0) {\n printf(\"NO\");\n return 0;\n }\n flag=0;\n for(i=0;i\n#include \n#include \nint n, phone[10], number[10];\nint main()\n{\n\tscanf(\"%d\",&n);\n\tfor(int a=1;a<=n;a++){\n\tscanf(\"%1d\",&phone[a]);\n\tnumber[phone[a]]++;}\n\tif(number[0])\n\t{\n\t\tif(number[1]||number[2]||number[3])\n\t\tprintf(\"YES\");\n\t\telse printf(\"NO\");\n\t}\n\telse if(number[7])\n\t{\n\t\tif(number[3]||((number[2]||number[1])&&(number[6]||number[9])))\n\t\tprintf(\"YES\");\n\t\telse printf(\"NO\");\n\t}\n\telse if(number[9])\n\t{\n\t\tif(number[1]||((number[2]||number[3])&&(number[4]||number[7])))\n\t\tprintf(\"YES\");\n\t\telse printf(\"NO\");\n\t}\n\telse printf(\"NO\");\n}"}, {"source_code": "#include\n\n#include\n#pragma warning(disable:4996)\n\nint main()\n{\n\tint a, b, c, i, j, k;\n\tchar s[10];\n\tint m[6][6];\n\tint flag;\n\t\n\twhile(scanf(\"%d\", &a)!=EOF)\n\t{\n\t\tmemset(m, 0, sizeof(m));\n\t\tscanf(\"%s\", s);\n\t\tint flag1 = 0;\n\t\tb = strlen(s);\n\t\tflag = 0;\n\t\tfor (i = 0; i < b; i++)\n\t\t{\n\t\t\tif (s[i] == '0')\n\t\t\t\tm[4][2] = 1;\n\t\t\tif (s[i] == '1')\n\t\t\t\tm[1][1] = 1;\n\t\t\tif (s[i] == '2')\n\t\t\t\tm[1][2] = 1;\n\t\t\tif (s[i] == '3')\n\t\t\t\tm[1][3] = 1;\n\t\t\tif (s[i] == '4')\n\t\t\t\tm[2][1] = 1;\n\t\t\tif (s[i] == '5')\n\t\t\t\tm[2][2] = 1;\n\t\t\tif (s[i] == '6')\n\t\t\t\tm[2][3] = 1;\n\t\t\tif (s[i] == '7')\n\t\t\t\tm[3][1] = 1;\n\t\t\tif (s[i] == '8')\n\t\t\t\tm[3][2] = 1;\n\t\t\tif (s[i] == '9')\n\t\t\t\tm[3][3] = 1;\n\t\t}\n\t\tfor (i = 1; i < 6; i++)\n\t\t{\n\t\t\tfor (j = 1; j < 6; j++)\n\t\t\t{\n\t\t\t\tif (m[i][j] == 1)\n\t\t\t\t{\t\n\t\t\t\t\tif ((i == 3 && j == 3) || (i == 2 && j == 3) || (i == 1 && j == 3)||(i==4&&j==2))\n\t\t\t\t\t{\n\t\t\t\t\t\tflag1 = 1;\n\t\t\t\t\t\tflag++; break;\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 (flag1)break;\n\t\t}\n\t\tflag1 = 0;\n\t\tfor (i = 1; i < 6; i++)\n\t\t{\n\t\t\tfor (j = 1; j < 6; j++)\n\t\t\t{\n\t\t\t\tif (m[i][j] == 1)\n\t\t\t\t{\n\t\t\t\t\tif ((i == 1 && j == 1) || (i == 2 && j == 1) || (i == 3 && j == 1) || (i == 4 && j == 2))\n\t\t\t\t\t{\n\t\t\t\t\t\tflag1 = 1;\n\t\t\t\t\t\tflag++; break;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}if (flag1)break;\n\t\t}\n\t\tflag1 = 0;\n\t\tfor (i = 1; i < 6; i++)\n\t\t{\n\t\t\tfor (j = 1; j < 6; j++)\n\t\t\t{\n\t\t\t\tif (m[i][j] == 1)\n\t\t\t\t{\n\t\t\t\t\tif ((i == 3 && j == 1) || (i == 4 && j == 2)||(i == 3 && j == 3))\n\t\t\t\t\t{\n\t\t\t\t\t\tflag1 = 1;\n\t\t\t\t\t\tflag++; break;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}if (flag1)break;\n\t\t\t\n\t\t}\n\t\tflag1 = 0;\n\t\tfor (i = 1; i < 6; i++)\n\t\t{\n\t\t\tfor (j = 1; j < 6; j++)\n\t\t\t{\n\t\t\t\tif (m[i][j] == 1)\n\t\t\t\t{\n\t\t\t\t\tif ((i == 1 && j == 1) || (i == 1 && j == 2) || (i == 1 && j == 3))\n\t\t\t\t\t{\n\t\t\t\t\t\tflag1 = 1;\n\t\t\t\t\t\tflag++; break;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}if (flag1)break;\n\t\t}\n\t\tif (flag == 4)\n\t\t\tprintf(\"YES\\n\");\n\t\telse printf(\"NO\\n\");\n\t\t\n\t}\n}"}, {"source_code": "#include \n#include \n#include \n\nint main ()\n{\n int arr[30]={ -1, -1 , -1, -1, -1,\n -1 , 1 , 2 , 3, -1,\n -1 , 4 , 5, 6, -1,\n -1 , 7 , 8 , 9, -1,\n -1 , -1, 0, -1, -1,\n -1 , -1, -1, -1, -1};\n int n;\n int i, j;\n int a=0,b=0,c=0,d=0;\n char tmp[12];\n scanf(\"%d\", &n);\n scanf(\"%s\", tmp);\n for (i = 0; i < n; i++)\n {\n for (j = 0; j < 30; j++)\n {\n if (tmp[i] == *(arr + j) + '0')\n {\n if ( *(arr + j + 1) == -1)\n {\n a = 1;\n break;\n }\n }\n }\n for (j = 0; j < 30; j++)\n {\n if (tmp[i] == *(arr + j) + '0')\n {\n if ( *(arr + j - 1) == -1)\n {\n b = 1;\n break;\n }\n }\n }\n for (j = 0; j < 30; j++)\n {\n if (tmp[i] == *(arr + j) + '0')\n {\n //printf(\"test:%d\\n\",*(arr + j));\n if ( *(arr + j + 5) == -1)\n {\n c = 1;\n break;\n }\n }\n }\n for (j = 0; j < 30; j++)\n {\n if (tmp[i] == *(arr + j) + '0')\n {\n //printf(\"test:%d\\n\",*(arr + j));\n if ( *(arr + j - 5) == -1)\n {\n //printf(\"fffff:%d\\n\",j);\n d = 1;\n break;\n }\n }\n }\n\n }\n if (a && b && c && d)\n printf(\"YES\");\n else\n printf(\"NO\");\n //printf(\" %d\", *(arr + 17 - 5));\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main()\t{\n\t\n\tchar contact[100];\n\tchar two_test_key[]={'1','2','3'};\n\tchar two_test_key_follows[][10]={{'0','9'}, {'0'}, {'0','7'}};\n\tchar group_test_key[]={'4','6','2'};\n\tchar group_test_follows[][5][10]={\n\t\t\t\t\t\t\t\t\t\t{{'3','9'},{'9','2'}},\n\t\t\t\t\t\t\t\t\t\t{{'1','7'},{'7','2'}},\n\t\t\t\t\t\t\t\t\t\t{{'7','9'},{'7','6'},{'9','4'}},\n\t\t\t\t\t\t\t\t\t};\n\tint i,j,k,n=0;\n\n\tscanf(\"%d\",&i);\n\tscanf(\"%s\",contact);\t\n\tfor(i=0;i<3;i++)\t{\n\t\tif(strchr(contact,two_test_key[i]))\t{\n\t\t\tif(strchr(contact,two_test_key_follows[i][0]))\t{\n\t\t\t\tputs(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tif(i-1 && strchr(contact,two_test_key_follows[i][1]))\t{\n\t\t\t\tputs(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tfor(i=0;i<3;i++)\t{\n\t\tif(strchr(contact, group_test_key[i]))\t{\n\t\t\tk=2;\tif(i>1) k=3;\n\t\t\tfor(j=0;j\n#include\n\nint main()\t{\n\t\n\tchar contact[100];\n\tchar two_test_key[]={'1','2','3'};\n\tchar two_test_key_follows[][100]={{'0','9'}, {'0'}, {'0','7'}};\n\tchar group_test_key[]={'4','6','2'};\n\tchar group_test_follows[][20][100]={\n\t\t\t\t\t\t\t\t\t\t{{'3','9'},{'9','2'}},\n\t\t\t\t\t\t\t\t\t\t{{'1','7'},{'7','2'}},\n\t\t\t\t\t\t\t\t\t\t{{'7','9'},{'7','6'},{'9','4'}},\n\t\t\t\t\t\t\t\t\t};\n\tlong long i,j,k;\n\n\tscanf(\"%d\",&i);\n\tscanf(\"%s\",contact);\t\n\tfor(i=0;i<3;i++)\t{\n\t\tif(strchr(contact,two_test_key[i]))\t{\n\t\t\tif(strchr(contact,two_test_key_follows[i][0]))\t{\n\t\t\t\tputs(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tif(i-1 && strchr(contact,two_test_key_follows[i][1]))\t{\n\t\t\t\tputs(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tfor(i=0;i<3;i++)\t{\n\t\tif(strchr(contact, group_test_key[i]))\t{\n\t\t\tk=2;\tif(i>1) k=3;\n\t\t\tfor(j=0;j\n#include \n\nchar kb[5][5] = {\"123\",\"456\",\"789\",\"x0x\"};\nint moves[10][3];\nint n;\nchar num[16];\n\nint findx(char c){\n\tint x,y;\n\tfor(x=0;x<4;x++)\n\t\tfor(y=0;y<3;y++)\t\n\t\t\tif(kb[x][y] == c)\n\t\t\t\treturn x;\n}\n\nint findy(char c){\n\tint x,y;\n\tfor(x=0;x<4;x++)\n\t\tfor(y=0;y<3;y++)\t\n\t\t\tif(kb[x][y] == c)\n\t\t\t\treturn y;\n}\n\nint move(int x, int y){\n\tint i;\n\t//printf(\"\\n:\");\n\tfor(i=0;i3 || y<0 || y>2)\n\t\t\treturn 0;\n\t\tif(kb[x][y] == 'x')\n\t\t\treturn 0;\n\t}\n\treturn 1;\n}\n\nint main(){\n\t\n\tscanf(\"%d\",&n);\n\tscanf(\"%s\",&num);\n\t\n\tint i,cx,cy,nx,ny;\n\tcx = findx(num[0]);\n\tcy = findy(num[0]);\n\tfor(i=1;i\n#include \n#include \n#include \n#define max 9\n\nbool belongs(char Phone[max] , int N , char Key[max], int M){\n \n int i=0,k;\n while (i\n\nint arr[9], n;\n\nvoid input();\nvoid solve();\n\nint exist(int);\n\nint main(){\n\tinput();\n\tsolve();\n\n\treturn 0;\n}\n\nvoid input(){\n\tscanf(\"%d\", &n);\n\tfor (int i=0; i < n; i++)\n\t\tscanf(\"%1d\", &arr[i]);\n}\n\nvoid solve(){\n\tif (exist(0) && (exist(1) || exist(2) || exist(3))) printf(\"YES\\n\");\n\telse if (exist(7) && (exist(1) || exist(2) || exist(3)) && (exist(3) || exist(6) || exist(9))) printf(\"YES\\n\");\n\telse if (exist(9) && (exist(1) || exist(2) || exist(3)) && (exist(1) || exist(4) || exist(7))) printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n}\n\nint exist(int a){\n\tint index=0;\n\tfor (int i=0; i< n; i++)\n\t\tif (a==arr[i])\n\t\t\tindex++;\n\n\tif (index) return 1;\n\telse return 0;\n} "}, {"source_code": "#include \n#include \n\nint mapRow(int n){\n if ((n >= 1) && (n <= 3)) return 1;\n if ((n >= 4) && (n <= 6)) return 2;\n if ((n >= 7) && (n <= 9)) return 3;\n return 4;\n}\n\nint mapCol(int n){\n if ((n == 1) || (n == 4) || (n == 7)) return 1;\n if ((n == 2) || (n == 5) || (n == 8) || (n == 0)) return 2;\n if ((n == 3) || (n == 6) || (n == 9)) return 3;\n}\n\nint main()\n{\n int n, i, j, oob = 0;\n scanf(\"%d\", &n);\n char s[n+5];\n scanf(\"%s\", &s);\n for (i = 0; i < 10; i++){\n if (i != (s[0] - '0')){\n int x = mapRow(i);\n int y = mapCol(i);\n for (j = 1; j < n; j++){\n oob = 0;\n int a = mapRow(s[j] - '0') - mapRow(s[j-1] - '0');\n int b = mapCol(s[j] - '0') - mapCol(s[j-1] - '0');\n x += a; y += b;\n if (((x < 1) || (x > 3)) || ((y < 1) || (y > 3))) oob = 1;\n if ((x == 4) && (y == 2)) oob = 0;\n if (oob) break;\n }\n if (j == n) break;\n }\n }\n printf((i == 10)?\"YES\\n\":\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n\nconst int i[10] = {3, 0, 0, 0, 1, 1, 1, 2, 2, 2};\nconst int j[10] = {1, 0, 1, 2, 0, 1, 2, 0, 1, 2};\n\nint di[10][10];\nint dj[10][10];\n\ninline int isvalid(int ci, int cj) {\n\tint k;\n\tfor (k = 0; k < 10; k++)\n\t\tif (i[k] == ci && j[k] == cj)\n\t\t\treturn 1;\n\treturn 0;\n}\n\nint main(void) {\n\tint k;\n\tint n;\n\tchar str[10];\n\tint from, to;\n\tint num, cnt;\n\n\tfor (from = 0; from < 10; from++)\n\t\tfor (to = 0; to < 10; to++) {\n\t\t\tdi[from][to] = i[to] - i[from];\n\t\t\tdj[from][to] = j[to] - j[from];\n\t\t}\n\n\tscanf(\"%d %s\", &n, str);\n\n\tcnt = 0;\n\tfor (num = 0; num < 10; num++) {\n\t\tint ci = i[num], cj = j[num];\n\t\tfor (k = 0; k < n - 1; k++) {\n\t\t\tci += di[str[k] - '0'][str[k + 1] - '0'];\n\t\t\tcj += dj[str[k] - '0'][str[k + 1] - '0'];\n\t\t\tif (!isvalid(ci, cj))\n\t\t\t\tbreak;\n\t\t}\n\n\t\tcnt += k == n - 1;\n\t}\n\n\tputs(cnt == 1 ? \"YES\" : \"NO\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n\tstatic char s[10];\n\tint n, i, yes1, yes2, yes3, yes4;\n\n\tscanf(\"%d%s\", &n, s);\n\tyes1 = yes2 = yes3 = yes4 = 0;\n\tfor (i = 0; i < n; i++)\n\t\tif (s[i] == '1')\n\t\t\tyes1 = yes2 = 1;\n\t\telse if (s[i] == '2')\n\t\t\tyes2 = 1;\n\t\telse if (s[i] == '3')\n\t\t\tyes2 = yes3 = 1;\n\t\telse if (s[i] == '4')\n\t\t\tyes1 = 1;\n\t\telse if (s[i] == '6')\n\t\t\tyes3 = 1;\n\t\telse if (s[i] == '7')\n\t\t\tyes1 = yes4 = 1;\n\t\telse if (s[i] == '9')\n\t\t\tyes3 = yes4 = 1;\n\t\telse if (s[i] == '0')\n\t\t\tyes1 = yes3 = yes4 = 1;\n\tprintf(yes1 && yes2 && yes3 && yes4 ? \"YES\\n\" : \"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nmain()\n{\n\tint n,up=1,down=1,right=1,left=1;\n\tchar num[10]={0};\n\tint i;\n\tscanf(\"%d\",&n);\n\tscanf(\"%s\",num);\n\tfor(i=0;i\n\nint flag[10];\n\nint main(void) {\n\tint n;\n\tchar c;\n\tscanf(\"%d\\n\", &n);\n\t\n\twhile (n-- > 0) {\n\t\tscanf(\"%c\", &c);\n\t\tflag[c - '0'] = 1;\n\t}\n\t\n\tif (flag[1] && flag[9] ||\n\t\tflag[3] && flag[7] ||\n\t\tflag[0] && flag[1] ||\n\t\tflag[0] && flag[2] ||\n\t\tflag[0] && flag[3] ||\n\t\tflag[1] && flag[6] && flag[7] ||\n\t\tflag[3] && flag[4] && flag[9])\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t\tprintf(\"NO\");\n\n\treturn 0;\n}\t\n"}, {"source_code": "#include \n\nint flag[10];\n\nint main(void) {\n\tint n;\n\tchar c;\n\tscanf(\"%d\\n\", &n);\n\t\n\twhile (n-- > 0) {\n\t\tscanf(\"%c\", &c);\n\t\tflag[c - '0'] = 1;\n\t}\n\t\n\tif (flag[1] && flag[9] ||\n\t\tflag[3] && flag[7] ||\n\t\tflag[0] && flag[1] ||\n\t\tflag[0] && flag[2] ||\n\t\tflag[0] && flag[3] ||\n\t\tflag[1] && flag[6] && flag[7] ||\n\t\tflag[3] && flag[4] && flag[9] ||\n\t\tflag[7] && flag[2] && flag[9] ||\n\t\tflag[7] && flag[8] && flag[6] && flag[2] ||\n\t\tflag[2] && flag[4] && flag[8] && flag[9] ||\n\t\tflag[7] && flag[4] && flag[2] && flag[6] || \n\t\tflag[4] && flag[2] && flag[6] && flag[9])\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t\tprintf(\"NO\");\n\n\treturn 0;\n}\t\n"}, {"source_code": "#include \n\nint flag[10];\n\nint main(void) {\n\tint n;\n\tchar c;\n\tscanf(\"%d\\n\", &n);\n\t\n\twhile (n-- > 0) {\n\t\tscanf(\"%c\", &c);\n\t\tflag[c - '0'] = 1;\n\t}\n\t\n\tif (flag[1] && flag[9] ||\n\t\tflag[3] && flag[7] ||\n\t\tflag[0] && flag[1] ||\n\t\tflag[0] && flag[2] ||\n\t\tflag[0] && flag[3] ||\n\t\tflag[1] && flag[6] && flag[7] ||\n\t\tflag[3] && flag[4] && flag[9] ||\n\t\tflag[7] && flag[2] && flag[9])\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t\tprintf(\"NO\");\n\n\treturn 0;\n}\t\n"}, {"source_code": "#include \n\nint flag[10];\n\nint main(void) {\n\tint n;\n\tchar c;\n\tscanf(\"%d\\n\", &n);\n\t\n\twhile (n-- > 0) {\n\t\tscanf(\"%c\", &c);\n\t\tflag[c - '0'] = 1;\n\t}\n\t\n\tif (flag[1] && flag[9] ||\n\t\tflag[3] && flag[7] ||\n\t\tflag[0] && flag[1] ||\n\t\tflag[0] && flag[2] ||\n\t\tflag[0] && flag[3])\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t\tprintf(\"NO\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint flag[10];\n\nint main(void) {\n\tint n;\n\tchar c;\n\tscanf(\"%d\\n\", &n);\n\t\n\twhile (n-- > 0) {\n\t\tscanf(\"%c\", &c);\n\t\tflag[c - '0'] = 1;\n\t}\n\t\n\tif (flag[1] && flag[9] ||\n\t\tflag[3] && flag[7] ||\n\t\tflag[0] && flag[1] ||\n\t\tflag[0] && flag[2] ||\n\t\tflag[0] && flag[3] ||\n\t\tflag[1] && flag[6] && flag[7] ||\n\t\tflag[3] && flag[4] && flag[9] ||\n\t\tflag[7] && flag[2] && flag[9] ||\n\t\tflag[1] && flag[7] && flag[8] ||\n\t\tflag[3] && flag[9] && flag[8])\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t\tprintf(\"NO\");\n\n\treturn 0;\n}\t\n"}, {"source_code": "#include\n#include\nint main(){\n int n,j,i,flag=0,c1=0,c3=0,c7=0,c9=0;\n scanf(\"%d \",&n);\n char a[n];\n gets(a);\n for(i=0;i\n#include\n#include\n#include\n#include\nint main()\n{\n int i,n,fl1=0,fl2=0,fl3=0,fl4=0;\n scanf(\"%d \",&n);\n char a[n],b[4][n];\n gets(a);\n for(i=0;i\n#include\nint main(){\n int n,j,i,flag=0,c1=0,c2=0;\n scanf(\"%d \",&n);\n char a[n];\n gets(a);\n for(i=0;i=2||c2>=2)printf(\"YES\");\n else{\n char b[18][n];\n for(i=0;i\n#include\nint main(){\n int n,j,i,flag=0,c1=0,c2=0;\n scanf(\"%d \",&n);\n char a[n];\n gets(a);\n for(i=0;i=2||c2>=2)printf(\"YES\");\n else{\n char b[18][n];\n for(i=0;i\n#include\n#include\n#include\n#include\nint main()\n{\n int i,n,fl1=0,fl2=0,fl3=0,fl4=0;\n scanf(\"%d \",&n);\n char a[n],b[4][n];\n gets(a);\n for(i=0;i\n#include\nint main(){\n int n,j,i,flag=0;\n scanf(\"%d \",&n);\n char a[n];\n gets(a);\n for(i=0;i\nint main()\n{\n int num[12];\n int n;\n char k[15];\n while(scanf(\"%d\",&n)!=EOF)\n {\n int ans=0;\n for(int i=0;i<=9;i++)\n num[i]=0;\n scanf(\"%s\",k);\n for(int i=0;i\nint main()\n{\n int num[12];\n int n;\n char k[15];\n while(scanf(\"%d\",&n)!=EOF)\n {\n int ans=0;\n for(int i=0;i<=9;i++)\n num[i]=0;\n scanf(\"%s\",k);\n for(int i=0;i\nint main()\n{\n int num[12];\n int n;\n char k[15];\n while(scanf(\"%d\",&n)!=EOF)\n {\n int ans=0;\n for(int i=0;i<=9;i++)\n num[i]=0;\n scanf(\"%s\",k);\n for(int i=0;i\n#include \nint main(){\n\tint x[10]={2,1,2,3,1,2,3,1,2,3};\n\tint y[10]={4,1,1,1,2,2,2,3,3,3};\n\tint flag,n,a[10],i,flag1=0;;\n\tscanf(\"%d \",&n);\n\tchar c;\n\tfor(i=0;imaxx)maxx=x[a[i]];\n\t\tif (y[a[i]]maxy)maxy=y[a[i]];\n\t}\n\t//printf(\"%d %d %d %d\\n\",minx, maxx, miny, maxy);\n\tif ((maxy-miny)==3) flag=0;\n\telse if((maxx-minx)==2 && (maxy-miny)==2 && flag1) flag=0;\n\telse flag=1;\n\tif (flag ==0) printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include \n#include \nint main(){\n\tint x[10]={2,1,2,3,1,2,3,1,2,3};\n\tint y[10]={4,1,1,1,2,2,2,3,3,3};\n\tint flag,n,a[10],i;\n\tscanf(\"%d \",&n);\n\tchar c;\n\tfor(i=0;imaxx)maxx=x[a[i]];\n\t\tif (y[a[i]]maxy)maxy=y[a[i]];\n\t}\n\t//printf(\"%d %d %d %d\\n\",minx, maxx, miny, maxy);\n\tif((maxx-minx)==2) flag=0;\n\telse if ((maxy-miny)==3) flag=0;\n\telse{\n\t\tif((maxx-minx)==1){\n\t\t\tif ((maxy-miny)==2) flag=0;\n\t\t}\n\t\telse flag =1;\n\t}\n\tif (flag ==0) printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include \n#include \nint main(){\n\tint x[10]={2,1,2,3,1,2,3,1,2,3};\n\tint y[10]={4,1,1,1,2,2,2,3,3,3};\n\tint flag,n,a[10],i;\n\tscanf(\"%d \",&n);\n\tchar c;\n\tfor(i=0;imaxx)maxx=x[a[i]];\n\t\tif (y[a[i]]maxy)maxy=y[a[i]];\n\t}\n\t//printf(\"%d %d %d %d\\n\",minx, maxx, miny, maxy);\n\tif((maxx-minx)==2) flag=0;\n\telse if ((maxy-miny)==3) flag=0;\n\telse{\n\t\tif((maxx-minx)==1){\n\t\t\tif ((maxy-miny)==2) flag=0;\n\t\t}\n\t\telse flag =1;\n\t}\n\tif (flag ==0) printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\treturn 0;\n}"}, {"source_code": "#include\n#include\n#include\n#include\nint row[5],line[5];\nint main()\n{\n\t\n\tint n,i,j,k;\n\tchar a;\n\tscanf(\"%d\\n\",&n);\n\tfor(i=1;i<=n;i++){\n\t\t\n\t\tscanf(\"%c\",&a);\n\t\tif(a=='1'||a=='2'||a=='3')\n\t\t\trow[1]=1;\n\t\tif(a=='4'||a=='5'||a=='6')\n\t\t\trow[2]=1;\n\t\tif(a=='7'||a=='8'||a=='9')\n\t\t\trow[3]=1;\n\t\tif(a=='0')\n\t\t\trow[4]=1;\n\t\tif(a=='1'||a=='4'||a=='7')\n\t\t\tline[1]=1;\n\t\tif(a=='2'||a=='5'||a=='8')\n\t\t\tline[2]=1;\n\t\tif(a=='3'||a=='6'||a=='9')\n\t\t\tline[3]=1;\n\t}\n\tif(row[1]==1&&row[3]==1&&line[1]==1&&line[3]==1)\n\t\tprintf(\"YES\");\n\telse if(row[1]==1&&row[4]==1)\n\t\tprintf(\"YES\");\n\telse \n\t\tprintf(\"NO\");\n\treturn 0;\n} "}, {"source_code": "#include\n#include\n#include\n#include\ntypedef struct\n{\n\tint x,y;\n\n}phone;\nphone c[11];\nint flag[5];\nint main()\n{\n\t\n\tint n,i,j,k;\n\tchar a;\n\tscanf(\"%d\\n\",&n);\n\tfor(i=1;i<=n;i++){\n\t\tscanf(\"%c\",&a);\n\t\tc[i].x=(a-'0')%3;\n\t\tif(c[i].x==0)\n\t\t\tc[i].x=3;\n\t\tc[i].y=(a-'0'-1)/3+1;\n\t\tif(a=='0'){\n\t\t\tc[i].x=2;c[i].y=4;\n\t\t}\n\t}\n\tfor(i=1;i<=n;i++){\n\t\tif(c[i].x+1>=4){\n\t\t\tflag[1]==1;\n\t\t\tbreak;\n\t\t}\t\n\t\tif(c[i].y==4&&c[i].x!=2){\n\t\t\tflag[1]==1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tfor(i=1;i<=n;i++){\n\t\tif(c[i].x-1<=0){\n\t\t\tflag[2]==1;\n\t\t\tbreak;\n\t\t}\t\n\t\tif(c[i].y==4&&c[i].x!=2){\n\t\t\tflag[2]==1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tfor(i=1;i<=n;i++){\n\t\tif(c[i].y==4&&c[i].x!=2){\n\t\t\tflag[3]==1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tfor(i=1;i<=n;i++){\n\t\tif(c[i].y-1<=0){\n\t\t\tflag[4]==1;\n\t\t\tbreak;\n\t\t}\t\n\t}\n\tif(flag[1]&&flag[2]&&flag[3]&&flag[4])\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\treturn 0;\n} "}, {"source_code": "#include\n#include\n#include\n#include\ntypedef struct\n{\n\tint x,y;\n\n}phone;\nphone c[11];\nint flag[5];\nint main()\n{\n\t\n\tint n,i,j,k;\n\tchar a;\n\tscanf(\"%d\\n\",&n);\n\tfor(i=1;i<=n;i++){\n\t\tscanf(\"%c\",&a);\n\t\tc[i].x=(a-'0')%3;\n\t\tif(c[i].x==0)\n\t\t\tc[i].x=3;\n\t\tc[i].y=(a-'0'-1)/3+1;\n\t\tif(a=='0'){\n\t\t\tc[i].x=2;c[i].y=4;\n\t\t}\n\t}\n\tfor(i=1;i<=n;i++){\n\t\tif(c[i].x+1>=4){\n\t\t\tflag[1]=1;\n\t\t\tbreak;\n\t\t}\t\n\t\tif(c[i].y==4&&c[i].x!=2){\n\t\t\tflag[1]=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tfor(i=1;i<=n;i++){\n\t\tif(c[i].x-1<=0){\n\t\t\tflag[2]=1;\n\t\t\tbreak;\n\t\t}\t\n\t\tif(c[i].y==4&&c[i].x!=2){\n\t\t\tflag[2]=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tfor(i=1;i<=n;i++){\n\t\tif(c[i].y+1==4&&c[i].x!=2){\n\t\t\tflag[3]=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tfor(i=1;i<=n;i++){\n\t\tif(c[i].y-1<=0){\n\t\t\tflag[4]=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(flag[1]&&flag[2]&&flag[3]&&flag[4])\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\treturn 0;\n} "}, {"source_code": "#include\n#include\n#include\n#include\ntypedef struct\n{\n\tint x,y;\n\n}phone;\nphone c[11];\nint flag[5];\nint main()\n{\n\t\n\tint n,i,j,k;\n\tchar a;\n\tscanf(\"%d\\n\",&n);\n\tfor(i=1;i<=n;i++){\n\t\tscanf(\"%c\",&a);\n\t\tc[i].x=(a-'0')%3;\n\t\tif(c[i].x==0)\n\t\t\tc[i].x=3;\n\t\tc[i].y=(a-'0'-1)/3+1;\n\t\tif(a=='0'){\n\t\t\tc[i].x=2;c[i].y=4;\n\t\t}\n\t}\n\tfor(i=1;i<=n;i++)\n\t\tprintf(\"%d %d\\n\",c[i].x,c[i].y);\n\tfor(i=1;i<=n;i++){\n\t\tif(c[i].x+1>=4){\n\t\t\tflag[1]=1;\n\t\t\tbreak;\n\t\t}\t\n\t\tif(c[i].y==4&&c[i].x!=2){\n\t\t\tflag[1]=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tfor(i=1;i<=n;i++){\n\t\tif(c[i].x-1<=0){\n\t\t\tflag[2]=1;\n\t\t\tbreak;\n\t\t}\t\n\t\tif(c[i].y==4&&c[i].x!=2){\n\t\t\tflag[2]=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tfor(i=1;i<=n;i++){\n\t\tif(c[i].y+1==4&&c[i].x!=2){\n\t\t\tflag[3]=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tfor(i=1;i<=n;i++){\n\t\tif(c[i].y-1<=0){\n\t\t\tflag[4]=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%d %d %d %d\",flag[1],flag[2],flag[3],flag[4]);\n\tif(flag[1]&&flag[2]&&flag[3]&&flag[4])\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\treturn 0;\n} "}, {"source_code": "#include\n#include\n#include\n#include\nint c[11];\nint main()\n{\n\t\n\tint n,i,j,k;\n\tchar a;\n\tscanf(\"%d\\n\",&n);\n\tfor(i=1;i<=n;i++){\n\t\tscanf(\"%c\",&a);\n\t\tc[a-'0']=1;\n\t}\n\tif(c[0]==1&&(c[1]==1||c[2]==1||c[3]==1))\n\t\tprintf(\"YES\");\n\telse if((c[1]==1&&c[9]==1)||(c[3]==1&&c[7]==1))\n\t\tprintf(\"YES\");\n\telse if(c[1]==1&&c[6]==1&&c[7]==1)\n\t\tprintf(\"YES\");\n\telse if(c[3]==1&&c[4]==1&&c[9]==1)\n\t\tprintf(\"YES\");\n\telse \n\t\tprintf(\"NO\");\n\treturn 0;\n} "}, {"source_code": "#include\n#include\n#include\n#include\nint c[11];\nint main()\n{\n\t\n\tint n,i,j,k;\n\tchar a;\n\tscanf(\"%d\\n\",&n);\n\tfor(i=1;i<=n;i++){\n\t\tscanf(\"%c\",&a);\n\t\tc[a-'0']=1;\n\t}\n\tif(c[0]==1&&(c[1]==1||c[2]==1||c[3]==1))\n\t\tprintf(\"YES\");\n\telse if((c[1]==1&&c[9]==1)||(c[3]==1&&c[7]==1))\n\t\tprintf(\"YES\");\n\telse \n\t\tprintf(\"NO\");\n\treturn 0;\n} "}, {"source_code": "#include\n#include\n#include\n#include\nint c[11];\nint main()\n{\n\t\n\tint n,i,j,k;\n\tchar a;\n\tscanf(\"%d\\n\",&n);\n\tfor(i=1;i<=n;i++){\n\t\tscanf(\"%c\",&a);\n\t\tc[a-'0']=1;\n\t}\n\tif(c[0]==1&&(c[1]==1||c[2]==1||c[3]==1))\n\t\tprintf(\"YES\");\n\telse if((c[1]==1&&c[9]==1)||(c[3]==1&&c[7]==1))\n\t\tprintf(\"YES\");\n\telse if(c[1]==1&&c[6]==1&&c[7]==1)\n\t\tprintf(\"YES\");\n\telse if(c[3]==1&&c[4]==1&&c[9]==1)\n\t\tprintf(\"YES\");\n\telse if(c[2]==1&&c[7]==1&&c[9]==1)\n\t\tprintf(\"YES\");\n\telse \n\t\tprintf(\"NO\");\n\treturn 0;\n} "}, {"source_code": "#include\n#include\n#include\n#include\ntypedef struct\n{\n\tint x,y;\n\n}phone;\nphone c[11];\nint flag[5];\nint main()\n{\n\t\n\tint n,i,j,k;\n\tchar a;\n\tscanf(\"%d\\n\",&n);\n\tfor(i=1;i<=n;i++){\n\t\tscanf(\"%c\",&a);\n\t\tc[i].x=(a-'0')%3;\n\t\tif(c[i].x==0)\n\t\t\tc[i].x=3;\n\t\tc[i].y=(a-'0'-1)/3+1;\n\t\tif(a=='0'){\n\t\t\tc[i].x=2;c[i].y=4;\n\t\t}\n\t}\n\tfor(i=1;i<=n;i++){\n\t\tif(c[i].x+1>=4){\n\t\t\tflag[1]=1;\n\t\t\tbreak;\n\t\t}\t\n\t\tif(c[i].y==4&&c[i].x!=2){\n\t\t\tflag[1]=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tfor(i=1;i<=n;i++){\n\t\tif(c[i].x-1<=0){\n\t\t\tflag[2]=1;\n\t\t\tbreak;\n\t\t}\t\n\t\tif(c[i].y==4&&c[i].x!=2){\n\t\t\tflag[2]=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tfor(i=1;i<=n;i++){\n\t\tif(c[i].y+1>4){\n\t\t\tflag[3]=1;\n\t\t\tbreak;\n\t\t}\n\t\tif(c[i].y+1==4&&c[i].x!=2){\n\t\t\tflag[3]=1;\n\t\t\tbreak;\n\t\t}\n\t\n\t}\n\tfor(i=1;i<=n;i++){\n\t\tif(c[i].y-1<=0){\n\t\t\tflag[4]=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(flag[1]&&flag[2]&&flag[3]&&flag[4])\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\treturn 0;\n} "}, {"source_code": "#include\n#include\n#include\n#include\nint c[11];\nint main()\n{\n\t\n\tint n,i,j,k;\n\tchar a;\n\tscanf(\"%d\\n\",&n);\n\tfor(i=1;i<=n;i++){\n\t\tscanf(\"%c\",&a);\n\t\tc[a-'0']=1;\n\t}\n\tif(c[0]==1&&(c[1]==1||c[2]==1||c[2]==1))\n\t\tprintf(\"YES\");\n\telse if((c[1]==1&&c[9]==1)||(c[3]==1&&c[7]==1))\n\t\tprintf(\"YES\");\n\telse \n\t\tprintf(\"NO\");\n\treturn 0;\n} "}, {"source_code": "#include \n#include \n\nint main()\n{\n int n,i,flag0=0,flagup=0,flagright=0,flagleft=0,flagdown=0;\n char ptrn[10];\n /*for(i=0;i='1' && ptrn[i]<='3'){\n printf(\"YES0\");\n flag0=2;\n break;\n }\n }\n if(flag0==1){\n printf(\"NO0\");\n }\n }\n else{\n // printf(\"try=%d\\n\",n);\n for(i=0;i='1' && ptrn[i]<='3'){\n flagup=1;\n // printf(\"\\n ptrnup[%d]=%c\",i,ptrn[i]);\n\n }\n if(ptrn[i]=='3' || ptrn[i]=='6' || ptrn[i]=='9'){\n flagright=1;\n // printf(\"\\n ptrnrit[%d]=%c\",i,ptrn[i]);\n }\n if(ptrn[i]=='1' || ptrn[i]=='4' || ptrn[i]=='7'){\n flagleft=1;\n // printf(\"\\n ptrnlft[%d]=%c\",i,ptrn[i]);\n }\n if(ptrn[i]=='7' || ptrn[i]=='9'){\n flagdown=1;\n // printf(\"\\n ptrndwn[%d]=%c\",i,ptrn[i]);\n // printf(\"a7eee\");\n }\n }\n if(flagdown==1 && flagleft==1 && flagright==1 && flagup==1){\n printf(\"YES\");\n // printf(\"\\n i=%d up %d down %d left %d right %d\",i,flagup,flagdown,flagleft,flagright);\n }\n else{\n printf(\"NO\");\n // printf(\"\\n i=%d up %d down %d left %d right %d\",i,flagup,flagdown,flagleft,flagright);\n }\n }\n\n\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n,i,flag0=0,flagup=0,flagright=0,flagleft=0,flagdown=0;\n char ptrn[10];\n /*for(i=0;i='1' && ptrn[i]<='3'){\n printf(\"YES\");\n flag0=2;\n break;\n }\n }\n if(flag0==1){\n printf(\"NO\");\n }\n }\n else{\n // printf(\"try=%d\\n\",n);\n for(i=0;i='1' && ptrn[i]<='3'){\n flagup=1;\n }\n if(ptrn[i]=='3' || ptrn[i]<='6' || ptrn[i]<='9'){\n flagright=1;\n }\n if(ptrn[i]=='1' || ptrn[i]<='4' || ptrn[i]<='7'){\n flagleft=1;\n }\n if(ptrn[i]=='7' || ptrn[i]<='9'){\n flagdown=1;\n // printf(\"a7eee\");\n }\n }\n if(flagdown==1 && flagleft==1 && flagright==1 && flagup==1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n // printf(\"\\n i=%d up %d down %d left %d right %d\",i,flagup,flagdown,flagleft,flagright);\n }\n }\n\n\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n#include\nchar arr[20][20]={\"31\",\"00\",\"01\",\"02\",\"10\",\"11\",\"12\",\"20\",\"21\",\"22\"};\nchar input[50];\nint res[20];\nint cnt;\nvoid solve(){\nint k=0;int c=0; int a=0; int i,x;\nfor(i=0;i3 || t1<0 || t1>2 || (t==3 && t1==0) || (t==3 && t1==2))\n flag=0;\n }\n if(flag){\n cnt++;\n }\n }\n}\n}\nint main(){\nint a,b,c,d,e;\nscanf(\"%d\",&a);getchar();\ngets(input);\nsolve();\ncnt>1?printf(\"NO\"):printf(\"YES\");\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n#include\nchar arr[20][20]={\"31\",\"00\",\"01\",\"02\",\"10\",\"11\",\"12\",\"20\",\"21\",\"22\"};\nchar input[50];\nint res[20];\nint cnt;\nvoid solve(){\nint k=0;int c=0; int a=0; int i,x;\nfor(i=0;i3 || t1<0 || t1>2 || (t==3 && t1==0) || (t==3 && t1==2))\n flag=0;\n }\n if(flag){\n cnt++;\n }\n }\n}\n}\nint main(){\nint a,b,c,d,e;\nscanf(\"%d\",&a);getchar();\ngets(input);\nsolve();\ncnt>1?printf(\"NO\"):printf(\"YES\");\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,i,flag8 = 0,flag0 = 0,final = 0;\n char arr[10],c;\n scanf(\"%d%c\",&n,&c);\n for(i=0;i 9 || arr[i]-51 < 1)\n {\n final = 1;\n }\n }\n }\n if(final)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tlong long int n,f,co[10][2],i,no[10],m=0,j,mo[10][2],flag=0,val,last,a[2],k;\n\tchar r[10];\n\tscanf(\"%lld\",&n);\n\tscanf(\"%s\",r);\n\tco[0][0]=4;\n\tco[0][1]=2;\n\tco[1][0]=1;\n\tco[1][1]=1;\n\tco[2][0]=1;\n\tco[2][1]=2;\n\tco[3][0]=1;\n\tco[3][1]=3;\n\tco[4][0]=2;\n\tco[4][1]=1;\n\tco[5][0]=2;\n\tco[5][1]=2;\n\tco[6][0]=2;\n\tco[6][1]=3;\n\tco[7][0]=3;\n\tco[7][1]=1;\n\tco[8][0]=3;\n\tco[8][1]=2;\n\tco[9][0]=3;\n\tco[9][1]=3;\n\t//for(i=0;i\nint main()\n{\n\tlong long int n,f,co[10][2],i,no[10],m=0,j,mo[10][2],flag=0,val,last,a[2],k;\n\tchar r[10];\n\tscanf(\"%lld\",&n);\n\tscanf(\"%s\",r);\n\tco[0][0]=4;\n\tco[0][1]=2;\n\tco[1][0]=1;\n\tco[1][1]=1;\n\tco[2][0]=1;\n\tco[2][1]=2;\n\tco[3][0]=1;\n\tco[3][1]=3;\n\tco[4][0]=2;\n\tco[4][1]=1;\n\tco[5][0]=2;\n\tco[5][1]=2;\n\tco[6][0]=2;\n\tco[6][1]=3;\n\tco[7][0]=3;\n\tco[7][1]=1;\n\tco[8][0]=3;\n\tco[8][1]=2;\n\tco[9][0]=3;\n\tco[9][1]=3;\n\t//for(i=0;i\n\nstatic int map[10];\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n getchar();\n\n while(n--)\n {\n char c;\n c = getchar();\n\n map[ c - '0' ] = 1;\n }\n\n int flag = 0;\n\n if( !(map[1] || map[4] || map[7] || map[0]) ) flag = 1;\n else if( !(map[3] || map[6] || map[9] || map[0]) ) flag = 1;\n else if ( !(map[1]||map[2]||map[3]) ) flag = 1;\n else if(!(map[7]||map[8]||map[9]||map[0])) flag = 1;\n else if( !(map[1]||map[2]||map[3]||map[4]||\n map[7]) ) flag = 1;\n else if( !(map[1]||map[2]||map[3]||map[6]||\n map[9]) ) flag = 1;\n else if( !(map[1]||map[4]||map[7]||map[8]||\n map[0]) ) flag = 1;\n else if( !(map[3]||map[6]||map[9]||map[8]||\n map[0]) ) flag = 1;\n\n if(flag == 1) printf(\"NO\\n\");\n else printf(\"YES\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(void) {\n\n\tint n,arr[10],i,flag=0;\n\tchar inp[11];\n\tfor(i=0;i<10;i++){\n\t\tarr[i] = 0;\n\t}\n\tscanf(\"%d\",&n);\n\tscanf(\"%s\",inp);\n\tfor(i=0;i\n\nint main(void) {\n\n\tint n,arr[10],i,flag=0;\n\tchar inp[11];\n\tfor(i=0;i<10;i++){\n\t\tarr[i] = 0;\n\t}\n\tscanf(\"%d\",&n);\n\tscanf(\"%s\",inp);\n\tfor(i=0;i\n\nint main(void) {\n\n\tint n,arr[10],i,flag=0;\n\tchar inp[11];\n\tfor(i=0;i<10;i++){\n\t\tarr[i] = 0;\n\t}\n\tscanf(\"%d\",&n);\n\tscanf(\"%s\",inp);\n\tfor(i=0;i\n\nint main(void) {\n\n\tint n,arr[10],i,flag=0;\n\tchar inp[11];\n\tfor(i=0;i<10;i++){\n\t\tarr[i] = 0;\n\t}\n\tscanf(\"%d\",&n);\n\tscanf(\"%s\",inp);\n\tfor(i=0;i3){\n\t\tflag = 1;\n\t}\n\tif(rh == 3 && arr[7]==0 && arr[9]==0){\n\t\tflag = 0;\n\t}\n\tif(flag == 0){\n\t\tprintf(\"NO\");\n\t}else {\n\t\tprintf(\"YES\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\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(xval)\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*xval;\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;ib)\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 char s[100];\n int n,ans,i,ar[100];\n int right,left,top,bottom;\n right=1;\n left=1;\n top=1;\n bottom=1;\n scan(n);\n scanf(\"%s\",s);\n for(i=0;i\n#include\n#include\n#include\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(xval)\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*xval;\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;ib)\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 char s[100];\n int n,ans,i,ar[100];\n int right,left,top,bottom;\n right=1;\n left=1;\n top=1;\n bottom=1;\n scan(n);\n scanf(\"%s\",s);\n for(i=0;i\n\nint good(char *s, char *a, int n) {\n\tint i;\n\n\tfor (i = 0; i < n; i++)\n\t\tif (a[s[i] - '0'] == '1')\n\t\t\treturn 0;\n\treturn 1;\n}\n\nint main() {\n\tint n;\n\tchar s[10];\n\tchar l[11] = \"1100100100\"; /*unable to move left or not*/\n\tchar r[11] = \"1001001001\"; /*right*/\n\tchar u[11] = \"0111000000\"; /*up*/\n\tchar d[11] = \"1001001001\"; /*down*/\n\n\tscanf(\"%d\\n\", &n);\n\tscanf(\"%s\", s);\n\tprintf(\"%s\\n\", good(s, l, n) || good(s, r, n)\n\t\t|| good(s, u, n) || good(s, d, n) ? \"NO\" : \"YES\");\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint xdist[8], ydist[8];\nint xx[10], yy[10];\n\nint valid(int n, int d) {\n\tint i, x, y;\n\n\tx = xx[d - 1], y = yy[d - 1];\n\tfor (i = 0; i < n - 1; i++) {\n\t\tx += xdist[i];\n\t\ty += ydist[i];\n\t\tif (x < 0 || x > 4 || y < 0 || y > 4)\n\t\t\treturn 0;\n\t\tif (x == 2 && (y == 3 || y == 1))\n\t\t\treturn 0;\n\t}\n\treturn 1;\n}\n\nint main() {\n\tint i, n;\n\tchar s[10];\n\n\tscanf(\"%d\\n\", &n);\n\tscanf(\"%s\", s);\n\txx[0] = 1;\n\tyy[0] = 3;\n\tfor (i = 1; i <= 9; i++) {\n\t\txx[i] = i / 3;\n\t\tyy[i] = i % 3;\n\t}\n\tfor (i = 1; i <= n; i++) {\n\t\txdist[i] = xx[s[i] - '0'] - xx[s[i - 1] - '0'];\n\t\tydist[i] = yy[s[i] - '0'] - yy[s[i - 1] - '0'];\n\t}\n\tfor (i = 0; i <= 9; i++)\n\t\tif (i != n && valid(n, i))\n\t\t\tbreak;\n\tprintf(\"%s\\n\", i == 10 ? \"YES\" : \"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint xdist[8], ydist[8];\nint xx[10], yy[10];\n\nint valid(int n, int d) {\n\tint i, x, y;\n\n\tx = xx[d - 1], y = yy[d - 1];\n\tfor (i = 0; i < n - 1; i++) {\n\t\tx += xdist[i];\n\t\ty += ydist[i];\n\t\tif (x < 0 || x > 2 || y < 0 || y > 2)\n\t\t\treturn 0;\n\t\tif (x == 2 && (y == 3 || y == 1))\n\t\t\treturn 0;\n\t\tif (y > 3)\n\t\t\treturn 0;\n\t}\n\treturn 1;\n}\n\nint main() {\n\tint i, n;\n\tchar s[10];\n\n\tscanf(\"%d\\n\", &n);\n\tscanf(\"%s\", s);\n\txx[0] = 1;\n\tyy[0] = 3;\n\tfor (i = 1; i <= 9; i++) {\n\t\txx[i] = i / 3;\n\t\tyy[i] = i % 3;\n\t}\n\tfor (i = 1; i <= n; i++) {\n\t\txdist[i] = xx[s[i] - '0'] - xx[s[i - 1] - '0'];\n\t\tydist[i] = yy[s[i] - '0'] - yy[s[i - 1] - '0'];\n\t}\n\tfor (i = 0; i <= 9; i++)\n\t\tif (i != n && valid(n, i))\n\t\t\tbreak;\n\tprintf(\"%d\\n\", i);\n\tprintf(\"%s\\n\", i == 10 ? \"YES\" : \"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint xdist[8], ydist[8];\nint xx[10], yy[10];\n\nint valid(int n, int d) {\n\tint i, x, y;\n\n\tx = xx[d - 1], y = yy[d - 1];\n\tfor (i = 0; i < n - 1; i++) {\n\t\tx += xdist[i];\n\t\ty += ydist[i];\n\t\tif (x < 0 || x > 2 || y < 0 || y > 2)\n\t\t\treturn 0;\n\t\tif (x == 2 && (y == 3 || y == 1))\n\t\t\treturn 0;\n\t\tif (y > 3)\n\t\t\treturn 0;\n\t}\n\treturn 1;\n}\n\nint main() {\n\tint i, n;\n\tchar s[10];\n\n\tscanf(\"%d\\n\", &n);\n\tscanf(\"%s\", s);\n\txx[0] = 1;\n\tyy[0] = 3;\n\tfor (i = 1; i <= 9; i++) {\n\t\txx[i] = i / 3;\n\t\tyy[i] = i % 3;\n\t}\n\tfor (i = 1; i <= n; i++) {\n\t\txdist[i] = xx[s[i] - '0'] - xx[s[i - 1] - '0'];\n\t\tydist[i] = yy[s[i] - '0'] - yy[s[i - 1] - '0'];\n\t}\n\tfor (i = 0; i <= 9; i++)\n\t\tif (i != n && valid(n, i))\n\t\t\tbreak;\n\tprintf(\"%s\\n\", i == 10 ? \"YES\" : \"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint visr[4],visc[3];\nint r[10]={3,0,0,0,1,1,1,2,2,2};\nint c[10]={1,0,1,2,0,1,2,0,1,2};\n\nint main()\n{\n char s;\n int n,i,x;\n\n scanf(\"%d \",&n);\n for(i=0;i\n\nint visr[4],visc[3];\nint r[10]={3,0,0,0,1,1,1,2,2,2};\nint c[10]={1,0,1,2,0,1,2,0,1,2};\n\nint main()\n{\n char s;\n int n,i,x;\n\n scanf(\"%d \",&n);\n for(i=0;i\n\nint visr[4],visc[3];\nint r[10]={3,0,0,0,1,1,1,2,2,2};\nint c[10]={1,0,1,2,0,1,2,0,1,2};\n\nint main()\n{\n char s;\n int n,i,x;\n\n scanf(\"%d \",&n);\n for(i=0;i\n\nchar Flag[4];\n\nint main()\n{\n int n;\n char str[10];\n scanf(\"%d %s\", &n, str);\n for(int i = 0; i < n; ++i) {\n int num = str[i] - '0';\n if(num >= 1 || num <= 3) {\n Flag[0] = 1;\n }\n if(num == 7 || num == 0 || num == 9) {\n Flag[1] = 1;\n }\n if(num == 1 || num == 4 || num == 7 || num == 0) {\n Flag[2] = 1;\n }\n if(num == 3 || num == 6 || num == 9 || num == 0) {\n Flag[3] = 1;\n }\n }\n puts(Flag[0]&Flag[1]&Flag[2]&Flag[3] ? \"YES\" : \"NO\");\n return 0;\n}\n"}, {"source_code": "#include\n//分情况\n//如果有零,那么只能向上移动,看上面有没有空隙\n//如果没有零,不用这种分类,直接移动!\n#define N 10\nint main() {\n int n;\n scanf(\"%d\",&n);\n char s[N];\n scanf(\"%s\",s);\n char phone[6][5];\n int i,j;\n for(i=0;i<6;i++){\n for(j=0;j<5;j++){\n phone[i][j]='#';\n }\n }\n for(i=1;i<=3;i++){\n for(j=1;j<=3;j++){\n phone[i][j]='*';\n }\n }\n phone[4][2]='*';\n /*\n for(i=0;i<6;i++){\n for(j=0;j<5;j++){\n printf(\"%c\",phone[i][j]);\n }\n printf(\"\\n\");\n }\n */\n\n\n int x[N];\n int y[N];\n x[1]=1; y[1]=1;\n x[2]=1; y[2]=2;\n x[3]=1; y[3]=3;\n x[4]=2; y[4]=1;\n x[5]=2; y[5]=2;\n x[6]=2; y[6]=3;\n x[7]=3; y[7]=1;\n x[8]=3; y[8]=2;\n x[9]=3; y[9]=3;\n x[0]=4; y[0]=2;\n //#代表边界!\n int ok=1;\n int move=0;\n for(i=0;i\nint main()\n{\n int i,a,p[7]={0,0,0,0,0,0,0},n,b,c;\n char st[10];\n scanf(\"%d %s\",&n,&st);\n for(i=0;st[i]!='\\0';i++)\n {\n a=st[i]-'0';\n if(a)\n {\n b=(a-1)/3;\n c=(a-1)%3;\n p[b]=1;\n p[3+c]=1;\n }\n else\n p[6]=1;\n }\n if(p[0]&&p[2]&&p[3]&&p[5]&&!p[6])\n printf(\"YES\");\n else if(p[0]&&p[6])\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(void) {\n\n int n,i;\n char x;\n int flag1=0,flag2=0,flag3=0,flag4=0;\nscanf(\"%d\",&n);\nfor(i=0;i\n#include \n#include \n#include \n\nint d[10];\n\nint main() {\n\tint n;\n\tchar s[10];\n\tscanf(\"%d%s\", &n, s);\n\tfor(int i=0 ; i\n#include \n#include \n\nint pos[10][2] = {{1, 3}, {0, 0}, {0, 1}, {0, 2}, {0, 1}, {1, 1}, {2, 1}, {0, 2}, {1, 2}, {2, 2}};\nint dirs[4][2] = {{-1, 0}, {1, 0}, {0, 1}, {0, -1}};\n\nint exists(int x, int y) {\n\treturn x >= 0 && y >= 0 && x < 3 && y < 4 && (y < 3 || x == 1);\n}\n\nint main() {\n\tint n;\n\tscanf(\"%d\", &n);\n\tchar c;\n\tscanf(\"%c\", &c);\n\tint u = 1, d = 1, l = 1, r = 1;\n\tfor(int i=0 ; i\n#include \n\nstatic int arr[4][3];\n\nint rowcount();\nint colcount();\nvoid setnum(char ch);\n\nint main()\n{\n\tchar str[10];\n\tint r, c, i, n;\n\tint haszero = 0;\n\n\tscanf(\"%d\", &n);\n\tscanf(\"%s\", str);\n\n\tfor (i = 0; i < n; i++) {\n\t\tsetnum(str[i]);\n\t\tif(str[i] == '0') haszero = 1;\n\t}\n\n\tr = rowcount();\n\tc = colcount();\n\n\tif (haszero) {\n\t\tif(r == 4) printf(\"YES\");\n\t\telse printf(\"NO\");\n\t} else {\n\t\tif(r == 3 && c == 3) printf(\"YES\");\n\t\telse printf(\"NO\");\n\t}\n\n}\n\nint rowcount() {\n int i, j, min = -1, max = 0;\n\n for(i = 0; i < 4; i++) {\n\t\tfor(j = 0; j < 3; j++) {\n if(arr[i][j]) {\n\t\t\t\tif(min == -1){\n\t\t\t\t\tmin = i;\n\t\t\t\t\tmax = i;\n\t\t\t\t}\n\t\t\t\telse max = i;\n\t\t\t\tbreak;\n }\n\t\t}\n }\n\n return max - min + 1;\n}\n\nint colcount() {\n\tint i, j, min = -1, max = 0;\n\n\tfor(j = 0; j < 3; j++) {\n\t\tfor(i = 0; i < 4; i++) {\n\t\t\tif(arr[i][j]) {\n\t\t\t\tif(min == -1) {\n\t\t\t\t\tmin = j;\n\t\t\t\t\tmax = j;\n\t\t\t\t}\n\t\t\t\telse max = j;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn max - min + 1;\n}\n\nvoid setnum(char ch) {\n switch (ch) {\n\t\tcase '0': arr[3][1] = ch; return;\n\t\tcase '1': arr[0][0] = ch; return;\n\t\tcase '2': arr[0][1] = ch; return;\n\t\tcase '3': arr[0][2] = ch; return;\n\t\tcase '4': arr[1][0] = ch; return;\n\t\tcase '5': arr[1][1] = ch; return;\n\t\tcase '6': arr[1][2] = ch; return;\n\t\tcase '7': arr[2][0] = ch; return;\n\t\tcase '8': arr[2][1] = ch; return;\n\t\tcase '9': arr[2][2] = ch; return;\n }\n}\n"}, {"source_code": "#include \n#include \n\nstatic int arr[4][3];\n\nint rowcount();\nint colcount();\nvoid setnum(char ch);\n\nint main()\n{\n\tchar str[10];\n\tint r, c, i, n;\n\tint haszero = 0;\n\n\tscanf(\"%d\", &n);\n\tscanf(\"%s\", str);\n\n\tfor (i = 0; i < n; i++) {\n\t\tsetnum(str[i]);\n\t\tif(str[i] == '0') haszero = 1;\n\t}\n\n\tr = rowcount();\n\tc = colcount();\n\n\tprintf(\"%d %d\\n\", r, c);\n\n\tif(r == 4) printf(\"YES\");\n\telse if(r == 3 && c == 3 && ((arr[0][0] && arr[2][2]) || (arr[0][2] && arr[2][0]))) printf(\"YES\");\n\telse printf(\"NO\");\n}\n\nint rowcount() {\n int i, j, min = -1, max = 0;\n\n for(i = 0; i < 4; i++) {\n\t\tfor(j = 0; j < 3; j++) {\n if(arr[i][j]) {\n\t\t\t\tif(min == -1){\n\t\t\t\t\tmin = i;\n\t\t\t\t\tmax = i;\n\t\t\t\t}\n\t\t\t\telse max = i;\n\t\t\t\tbreak;\n }\n\t\t}\n }\n\n return max - min + 1;\n}\n\nint colcount() {\n\tint i, j, min = -1, max = 0;\n\n\tfor(j = 0; j < 3; j++) {\n\t\tfor(i = 0; i < 4; i++) {\n\t\t\tif(arr[i][j]) {\n\t\t\t\tif(min == -1) {\n\t\t\t\t\tmin = j;\n\t\t\t\t\tmax = j;\n\t\t\t\t}\n\t\t\t\telse max = j;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn max - min + 1;\n}\n\nvoid setnum(char ch) {\n switch (ch) {\n\t\tcase '0': arr[3][1] = ch; return;\n\t\tcase '1': arr[0][0] = ch; return;\n\t\tcase '2': arr[0][1] = ch; return;\n\t\tcase '3': arr[0][2] = ch; return;\n\t\tcase '4': arr[1][0] = ch; return;\n\t\tcase '5': arr[1][1] = ch; return;\n\t\tcase '6': arr[1][2] = ch; return;\n\t\tcase '7': arr[2][0] = ch; return;\n\t\tcase '8': arr[2][1] = ch; return;\n\t\tcase '9': arr[2][2] = ch; return;\n }\n}\n"}, {"source_code": "#include \n#include \n\nstatic int arr[4][3];\n\nint rowcount();\nint colcount();\nvoid setnum(char ch);\n\nint main()\n{\n\tchar str[10];\n\tint r, c, i, n;\n\tint haszero = 0;\n\n\tscanf(\"%d\", &n);\n\tscanf(\"%s\", str);\n\n\tfor (i = 0; i < n; i++) {\n\t\tsetnum(str[i]);\n\t\tif(str[i] == '0') haszero = 1;\n\t}\n\n\tr = rowcount();\n\tc = colcount();\n\n\t//printf(\"%d %d\\n\", r, c);\n\n\tif(r == 4) printf(\"YES\");\n\telse if(r == 3 && c == 3 && ((arr[0][0] && arr[2][2])\n\t\t\t\t\t\t\t\t|| (arr[0][2] && arr[2][0])\n\t\t\t\t\t\t\t\t|| (arr[2][0] && arr[2][2])\n\t\t\t\t\t\t\t\t|| (arr[0][0] && arr[0][2])\n\t\t\t\t\t\t\t\t|| (arr[0][2] && arr[2][2]))) printf(\"YES\");\n\telse printf(\"NO\");\n}\n\nint rowcount() {\n int i, j, min = -1, max = 0;\n\n for(i = 0; i < 4; i++) {\n\t\tfor(j = 0; j < 3; j++) {\n if(arr[i][j]) {\n\t\t\t\tif(min == -1){\n\t\t\t\t\tmin = i;\n\t\t\t\t\tmax = i;\n\t\t\t\t}\n\t\t\t\telse max = i;\n\t\t\t\tbreak;\n }\n\t\t}\n }\n\n return max - min + 1;\n}\n\nint colcount() {\n\tint i, j, min = -1, max = 0;\n\n\tfor(j = 0; j < 3; j++) {\n\t\tfor(i = 0; i < 4; i++) {\n\t\t\tif(arr[i][j]) {\n\t\t\t\tif(min == -1) {\n\t\t\t\t\tmin = j;\n\t\t\t\t\tmax = j;\n\t\t\t\t}\n\t\t\t\telse max = j;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn max - min + 1;\n}\n\nvoid setnum(char ch) {\n switch (ch) {\n\t\tcase '0': arr[3][1] = ch; return;\n\t\tcase '1': arr[0][0] = ch; return;\n\t\tcase '2': arr[0][1] = ch; return;\n\t\tcase '3': arr[0][2] = ch; return;\n\t\tcase '4': arr[1][0] = ch; return;\n\t\tcase '5': arr[1][1] = ch; return;\n\t\tcase '6': arr[1][2] = ch; return;\n\t\tcase '7': arr[2][0] = ch; return;\n\t\tcase '8': arr[2][1] = ch; return;\n\t\tcase '9': arr[2][2] = ch; return;\n }\n}\n"}, {"source_code": "#include \n#include \n\nstatic int arr[4][3];\n\nint rowcount();\nint colcount();\nvoid setnum(char ch);\n\nint main()\n{\n\tchar str[10];\n\tint r, c, i, n;\n\tint haszero = 0;\n\n\tscanf(\"%d\", &n);\n\tscanf(\"%s\", str);\n\n\tfor (i = 0; i < n; i++) {\n\t\tsetnum(str[i]);\n\t\tif(str[i] == '0') haszero = 1;\n\t}\n\n\tr = rowcount();\n\tc = colcount();\n\n\t//printf(\"%d %d\\n\", r, c);\n\n\tif(r == 4) printf(\"YES\");\n\telse if(r == 3 && c == 3 && ((arr[0][0] && arr[2][2]) || (arr[0][2] && arr[2][0]))) printf(\"YES\");\n\telse printf(\"NO\");\n}\n\nint rowcount() {\n int i, j, min = -1, max = 0;\n\n for(i = 0; i < 4; i++) {\n\t\tfor(j = 0; j < 3; j++) {\n if(arr[i][j]) {\n\t\t\t\tif(min == -1){\n\t\t\t\t\tmin = i;\n\t\t\t\t\tmax = i;\n\t\t\t\t}\n\t\t\t\telse max = i;\n\t\t\t\tbreak;\n }\n\t\t}\n }\n\n return max - min + 1;\n}\n\nint colcount() {\n\tint i, j, min = -1, max = 0;\n\n\tfor(j = 0; j < 3; j++) {\n\t\tfor(i = 0; i < 4; i++) {\n\t\t\tif(arr[i][j]) {\n\t\t\t\tif(min == -1) {\n\t\t\t\t\tmin = j;\n\t\t\t\t\tmax = j;\n\t\t\t\t}\n\t\t\t\telse max = j;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn max - min + 1;\n}\n\nvoid setnum(char ch) {\n switch (ch) {\n\t\tcase '0': arr[3][1] = ch; return;\n\t\tcase '1': arr[0][0] = ch; return;\n\t\tcase '2': arr[0][1] = ch; return;\n\t\tcase '3': arr[0][2] = ch; return;\n\t\tcase '4': arr[1][0] = ch; return;\n\t\tcase '5': arr[1][1] = ch; return;\n\t\tcase '6': arr[1][2] = ch; return;\n\t\tcase '7': arr[2][0] = ch; return;\n\t\tcase '8': arr[2][1] = ch; return;\n\t\tcase '9': arr[2][2] = ch; return;\n }\n}\n"}, {"source_code": "#include\n#include\nint main(){\n int n,i=0,flag=0;\n scanf(\"%d \",&n);\n if(n==1){\n printf(\"NO\");\n }\n char a[n],b[n];\n gets(a);\n for(i=0;i'9'||b[i]=='3'){\n flag=1;\n break;\n }\n }\n if(flag==0) {\n printf(\"NO\");\n return 0;\n }\n flag=0;\n for(i=0;i'9'){\n flag=1;\n break;\n }\n }\n if(flag==0) {\n printf(\"NO\");\n return 0;\n }\n for(i=0;i\n#include\nint main(){\n int n,i=0,flag=0;\n scanf(\"%d \",&n);\n if(n==1){\n printf(\"NO\");\n }\n char a[n],b[n];\n gets(a);\n for(i=0;i'9'){\n flag=1;\n break;\n }\n }\n if(flag==0) {\n printf(\"NO\");\n return 0;\n }\n flag=0;\n for(i=0;i'9'){\n flag=1;\n break;\n }\n }\n if(flag==0) {\n printf(\"NO\");\n return 0;\n }\n for(i=0;i\n#include\nint main(){\n int n,i=0,flag=0;\n scanf(\"%d \",&n);\n if(n==1){\n printf(\"NO\");\n }\n char a[n],b[n];\n gets(a);\n for(i=0;i'9'||b[i]=='3'){\n flag=1;\n break;\n }\n }\n if(flag==0) {\n printf(\"NO\");\n return 0;\n }\n flag=0;\n for(i=0;i'9'){\n flag=1;\n break;\n }\n }\n if(flag==0) {\n printf(\"NO\");\n return 0;\n }\n for(i=0;i\n#include\nint main(){\n int n,i=0,flag=0;\n scanf(\"%d \",&n);\n if(n==1){\n printf(\"NO\");\n }\n char a[n],b[n];\n gets(a);\n for(i=0;i'9'){\n flag=1;\n break;\n }\n }\n if(flag==0) {\n printf(\"NO\");\n return 0;\n }\n flag=0;\n for(i=0;i'9'){\n flag=1;\n break;\n }\n }\n if(flag==0) {\n printf(\"NO\");\n return 0;\n }\n for(i=0;i\n#include\nint main(){\n int n,i=0,flag=0;\n scanf(\"%d \",&n);\n if(n==1){\n printf(\"NO\");\n }\n char a[n],b[n];\n gets(a);\n for(i=0;i'9'||b[i]=='3'){\n flag=1;\n break;\n }\n }\n if(flag==0) {\n printf(\"NO\");\n return 0;\n }\n flag=0;\n for(i=0;i'9'){\n flag=1;\n break;\n }\n }\n if(flag==0) {\n printf(\"NO\");\n return 0;\n }\n flag=0;\n for(i=0;i\n\n#include\n#pragma warning(disable:4996)\n\nint main()\n{\n\tint a, b, c, i, j, k;\n\tchar s[10];\n\tint m[6][6];\n\tint flag;\n\t\n\tscanf(\"%d\", &a);\n\t{\n\t\tmemset(m, 0, sizeof(m));\n\t\tscanf(\"%s\", s);\n\t\tint flag1 = 0;\n\t\tb = strlen(s);\n\t\tflag = 0;\n\t\tfor (i = 0; i < b; i++)\n\t\t{\n\t\t\tif (s[i] == '0')\n\t\t\t\tm[4][2] = 1;\n\t\t\tif (s[i] == '1')\n\t\t\t\tm[1][1] = 1;\n\t\t\tif (s[i] == '2')\n\t\t\t\tm[1][2] = 1;\n\t\t\tif (s[i] == '3')\n\t\t\t\tm[1][3] = 1;\n\t\t\tif (s[i] == '4')\n\t\t\t\tm[2][1] = 1;\n\t\t\tif (s[i] == '5')\n\t\t\t\tm[2][2] = 1;\n\t\t\tif (s[i] == '6')\n\t\t\t\tm[2][3] = 1;\n\t\t\tif (s[i] == '7')\n\t\t\t\tm[3][1] = 1;\n\t\t\tif (s[i] == '8')\n\t\t\t\tm[3][2] = 1;\n\t\t\tif (s[i] == '9')\n\t\t\t\tm[3][3] = 1;\n\t\t}\n\t\tfor (i = 0; i < 6; i++)\n\t\t{\n\t\t\tfor (j = 0; j < 6; j++)\n\t\t\t{\n\t\t\t\tif (m[i][j] == 1)\n\t\t\t\t{\t\n\t\t\t\t\tif ((i == 3 && j == 3) || (i == 2 && j == 3) || (i == 1 && j == 3))\n\t\t\t\t\t{\n\t\t\t\t\t\tflag1 = 1;\n\t\t\t\t\t\tflag++; break;\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 (flag1)break;\n\t\t}\n\t\tflag1 = 0;\n\t\tfor (i = 0; i < 6; i++)\n\t\t{\n\t\t\tfor (j = 0; j < 6; j++)\n\t\t\t{\n\t\t\t\tif (m[i][j] == 1)\n\t\t\t\t{\n\t\t\t\t\tif ((i == 1&& j == 1) || (i == 2 && j == 1) || (i == 3 && j == 1))\n\t\t\t\t\t{\n\t\t\t\t\t\tflag1 = 1;\n\t\t\t\t\t\tflag++; break;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}if (flag1)break;\n\t\t}\n\t\tflag1 = 0;\n\t\tfor (i = 0; i < 6; i++)\n\t\t{\n\t\t\tfor (j = 0; j < 6; j++)\n\t\t\t{\n\t\t\t\tif (m[i][j] == 1)\n\t\t\t\t{\n\t\t\t\t\tif ((i == 3 && j == 1) || (i == 4 && j == 2)||(i == 3 && j == 3))\n\t\t\t\t\t{\n\t\t\t\t\t\tflag1 = 1;\n\t\t\t\t\t\tflag++; break;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}if (flag1)break;\n\t\t\t\n\t\t}\n\t\tflag1 = 0;\n\t\tfor (i = 0; i < 6; i++)\n\t\t{\n\t\t\tfor (j = 0; j < 6; j++)\n\t\t\t{\n\t\t\t\tif (m[i][j] == 1)\n\t\t\t\t{\n\t\t\t\t\tif ((i == 1 && j == 1) || (i == 1 && j == 2) || (i == 1 && j == 3))\n\t\t\t\t\t{\n\t\t\t\t\t\tflag1 = 1;\n\t\t\t\t\t\tflag++; break;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}if (flag1)break;\n\t\t}\n\t\tif (flag == 4)\n\t\t\tprintf(\"YES\\n\");\n\t\telse printf(\"NO\\n\");\n\t\t\n\t}\n}"}, {"source_code": "#include\n\n#include\n#pragma warning(disable:4996)\n\nint main()\n{\n\tint a, b, c, i, j, k;\n\tchar s[10];\n\tint m[6][6];\n\tint flag;\n\t\n\twhile (scanf(\"%d\", &a) != EOF)\n\t{\n\t\tmemset(m, 0, sizeof(m));\n\t\tscanf(\"%s\", s);\n\t\tint flag1 = 0;\n\t\tb = strlen(s);\n\t\tflag = 0;\n\t\tfor (i = 0; i < b; i++)\n\t\t{\n\t\t\tif (s[i] == '0')\n\t\t\t\tm[4][2] = 1;\n\t\t\tif (s[i] == '1')\n\t\t\t\tm[1][1] = 1;\n\t\t\tif (s[i] == '2')\n\t\t\t\tm[1][2] = 1;\n\t\t\tif (s[i] == '3')\n\t\t\t\tm[1][3] = 1;\n\t\t\tif (s[i] == '4')\n\t\t\t\tm[2][1] = 1;\n\t\t\tif (s[i] == '5')\n\t\t\t\tm[2][2] = 1;\n\t\t\tif (s[i] == '6')\n\t\t\t\tm[2][3] = 1;\n\t\t\tif (s[i] == '7')\n\t\t\t\tm[3][1] = 1;\n\t\t\tif (s[i] == '8')\n\t\t\t\tm[3][2] = 1;\n\t\t\tif (s[i] == '9')\n\t\t\t\tm[3][3] = 1;\n\t\t}\n\t\tfor (i = 0; i < 6; i++)\n\t\t{\n\t\t\tfor (j = 0; j < 6; j++)\n\t\t\t{\n\t\t\t\tif (m[i][j] == 1)\n\t\t\t\t{\t\n\t\t\t\t\tif ((i == 3 && j == 3) || (i == 2 && j == 3) || (i == 1 && j == 3))\n\t\t\t\t\t{\n\t\t\t\t\t\tflag1 = 1;\n\t\t\t\t\t\tflag++; break;\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 (flag1)break;\n\t\t}\n\t\tflag1 = 0;\n\t\tfor (i = 0; i < 6; i++)\n\t\t{\n\t\t\tfor (j = 0; j < 6; j++)\n\t\t\t{\n\t\t\t\tif (m[i][j] == 1)\n\t\t\t\t{\n\t\t\t\t\tif ((i == 1&& j == 1) || (i == 2 && j == 1) || (i == 3 && j == 1))\n\t\t\t\t\t{\n\t\t\t\t\t\tflag1 = 1;\n\t\t\t\t\t\tflag++; break;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}if (flag1)break;\n\t\t}\n\t\tflag1 = 0;\n\t\tfor (i = 0; i < 6; i++)\n\t\t{\n\t\t\tfor (j = 0; j < 6; j++)\n\t\t\t{\n\t\t\t\tif (m[i][j] == 1)\n\t\t\t\t{\n\t\t\t\t\tif ((i == 3 && j == 1) || (i == 4 && j == 2)||(i == 3 && j == 3))\n\t\t\t\t\t{\n\t\t\t\t\t\tflag1 = 1;\n\t\t\t\t\t\tflag++; break;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}if (flag1)break;\n\t\t\t\n\t\t}\n\t\tflag1 = 0;\n\t\tfor (i = 0; i < 6; i++)\n\t\t{\n\t\t\tfor (j = 0; j < 6; j++)\n\t\t\t{\n\t\t\t\tif (m[i][j] == 1)\n\t\t\t\t{\n\t\t\t\t\tif ((i == 1 && j == 1) || (i == 1 && j == 2) || (i == 1 && j == 3))\n\t\t\t\t\t{\n\t\t\t\t\t\tflag1 = 1;\n\t\t\t\t\t\tflag++; break;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}if (flag1)break;\n\t\t}\n\t\tif (flag == 4)\n\t\t\tprintf(\"YES\\n\");\n\t\telse printf(\"NO\\n\");\n\t\t\n\t}\n}"}, {"source_code": "#include\n#include\n#pragma warning(disable:4996)\nint main()\n{\n\tint a, b, c, i, j, k;\n\tchar s[10];\n\tint flag;\n\twhile (scanf(\"%d\", &a) != EOF)\n\t{\n\t\tscanf(\"%s\", s);\n\t\tb = strlen(s);\n\t\tflag = 0;\n\t\tfor (i = 0; i < b; i++)\n\t\t{\n\t\t\tif (s[i] == '9')\n\t\t\t{\n\t\t\t\tfor (; i < b; i++)\n\t\t\t\t{\n\t\t\t\t\tif (s[i] == '1')\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}\n\t\t\tif (i >= b)\n\t\t\t\tbreak;\n\t\t\tif (s[i] == '1')\n\t\t\t{\n\t\t\t\tfor (; i < b; i++)\n\t\t\t\t{\n\t\t\t\t\tif (s[i] == '9')\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}\n\t\t\tif (i >= b)\n\t\t\t\tbreak;\n\t\t\tif (s[i] == '3')\n\t\t\t{\n\t\t\t\tfor (; i < b; i++)\n\t\t\t\t{\n\t\t\t\t\tif (s[i] == '7')\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}\n\t\t\tif (i >= b)\n\t\t\t\tbreak;\n\t\t\tif (s[i] == '7')\n\t\t\t{\n\t\t\t\tfor (; i < b; i++)\n\t\t\t\t{\n\t\t\t\t\tif (s[i] == '3')\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}\n\t\t\tif (i >= b)\n\t\t\t\tbreak;\n\t\t\tif (s[i] == '0')\n\t\t\t{\n\t\t\t\tfor (; i < b; i++)\n\t\t\t\t{\n\t\t\t\t\tif (s[i] == '1')\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}\n\t\t\tif (i >= b)\n\t\t\t\tbreak;\n\t\t\tif (s[i] == '1')\n\t\t\t{\n\t\t\t\tfor (; i < b; i++)\n\t\t\t\t{\n\t\t\t\t\tif (s[i] == '0')\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}\n\t\t\tif (i >= b)\n\t\t\t\tbreak;\n\t\t\tif (s[i] == '2')\n\t\t\t{\n\t\t\t\tfor (; i < b; i++)\n\t\t\t\t{\n\t\t\t\t\tif (s[i] == '0')\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}\n\t\t\tif (i >= b)\n\t\t\t\tbreak;\n\t\t\tif (s[i] == '0')\n\t\t\t{\n\t\t\t\tfor (; i < b; i++)\n\t\t\t\t{\n\t\t\t\t\tif (s[i] == '2')\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}\n\t\t\tif (i >= b)\n\t\t\t\tbreak;\n\t\t\tif (s[i] == '0')\n\t\t\t{\n\t\t\t\tfor (; i < b; i++)\n\t\t\t\t{\n\t\t\t\t\tif (s[i] == '3')\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}\n\t\t\tif (i >= b)\n\t\t\t\tbreak;\n\n\t\t\tif (s[i] == '3')\n\t\t\t{\n\t\t\t\tfor (; i < b; i++)\n\t\t\t\t{\n\t\t\t\t\tif (s[i] == '0')\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}\n\t\t\tif (i >= b)\n\t\t\t\tbreak;\n\t\t}\n\t\tif (flag)\n\t\t\tprintf(\"YES\\n\");\n\t\telse printf(\"NO\\n\");\n\n\t}\n}"}, {"source_code": "#include\n#include\n\nint main()\t{\n\t\n\tchar contact[100];\n\tchar two_test_key[]={'1','2','3'};\n\tchar two_test_key_follows[][10]={{'0','9'}, {'0'}, {'0','7'}};\n\tchar group_test[][10]={{'1','4','7','6'}, {'3','6','9','4'}};\n\tint i,j;\n\n\tscanf(\"%d\",&i);\n\tscanf(\"%s\",contact);\t\n\tfor(i=0;i<3;i++)\t{\n\t\tif(strchr(contact,two_test_key[i]))\t{\n\t\t\tif(strchr(contact,two_test_key_follows[i][0]))\t{\n\t\t\t\tputs(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tif(i!=1 && strchr(contact,two_test_key_follows[i][1]))\t{\n\t\t\t\tputs(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tfor(i=0;i<2;i++)\t{\n\t\tfor(j=0;j<4;j++)\t{\n\t\t\tif(!strchr(contact, group_test[i][j]))\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(j == 4)\t{\n\t\t\tputs(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\t\n\tputs(\"NO\");\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main()\t{\n\t\n\tchar contact[100];\n\tchar two_test_key[]={'1','2','3'};\n\tchar two_test_key_follows[][10]={{'0','9'}, {'0'}, {'0','7'}};\n\tchar group_test_key[]={'2','4','6','8'};\n\tchar group_test_follows[][5][10]={\n\t\t\t\t\t\t\t\t\t\t{{'7','9'},{'7','6'},{'9','4'}},\n\t\t\t\t\t\t\t\t\t\t{{'3','9'},{'3','8'},{'9','2'}},\n\t\t\t\t\t\t\t\t\t\t{{'1','7'},{'1','8'},{'7','2'}},\n\t\t\t\t\t\t\t\t\t\t{{'1','3'},{'1','6'},{'3','4'}}\n\t\t\t\t\t\t\t\t\t};\n\tint i,j;\n\n\tscanf(\"%d\",&i);\n\tscanf(\"%s\",contact);\t\n\tfor(i=0;i<3;i++)\t{\n\t\tif(strchr(contact,two_test_key[i]))\t{\n\t\t\tif(strchr(contact,two_test_key_follows[i][0]))\t{\n\t\t\t\tputs(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tif(i-1 && strchr(contact,two_test_key_follows[i][1]))\t{\n\t\t\t\tputs(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tfor(i=0;i<4;i++)\t{\n\t\tif(strchr(contact, group_test_key[i]))\n\t\t\tfor(j=0;j<3;j++)\t{\n\t\t\t\tif(strchr(contact, group_test_follows[i][j][0]) && strchr(contact, group_test_follows[i][j][1]))\t{\n\t\t\t\t\tputs(\"YES\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t}\n\t\n\tputs(\"NO\");\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n#define max 9\n\nbool belongs(char Phone[max] , int N , char Key[max], int M){\n \n int i=0,k;\n while (i\n#include \n\n\nint main() {\n\tint test,x;\n\tchar excl[] = \"2580\";\n\tchar excl2[]=\"147\";\n\tchar excl3[]=\"369\";\n\tchar excl4[]=\"248\";\n\tchar excl5[]=\"268\";\n\tchar inp[11];\n\tint check=0;\n\tscanf (\"%d\\n\", &test );\n\tgets(inp);\n\tif (strcmp(inp,excl)==0)check=2;\n\telse if (strcmp(inp,excl2)==0)check=0;\n\telse if (strcmp(inp,excl3)==0)check=0;\n\telse if (strcmp(inp,excl4)>=0)check=2;\n\telse if (strcmp(inp,excl5)>=0)check=2;\n\telse {\n\t\tfor (x=0;x=2)printf(\"YES\");\n\telse printf(\"NO\");\n}\n"}, {"source_code": "#include \n#include \n\n\nint main() {\n\tint test,x;\n\tchar inp[11];\n\tint check=0;\n\tscanf (\"%d\\n\", &test );\n\tgets(inp);\n\tfor (x=0;x=2)printf(\"YES\");\n\telse printf(\"NO\");\n}\n"}, {"source_code": "#include \n#include \n\n\nint main() {\n\tint test,x;\n\tchar excl[] = \"2580\";\n\tchar excl2[]=\"147\";\n\tchar excl3[]=\"369\";\n\tchar inp[11];\n\tint check=0;\n\tscanf (\"%d\\n\", &test );\n\tgets(inp);\n\tif (strcmp(inp,excl)==0)check=2;\n\telse if (strcmp(inp,excl2)==0)check=0;\n\telse if (strcmp(inp,excl3)==0)check=0;\n\telse {\n\t\tfor (x=0;x=2)printf(\"YES\");\n\telse printf(\"NO\");\n}\n"}, {"source_code": "#include \n#include \n\n\nint main() {\n\tint test,x;\n\tchar excl[] = \"2580\";\n\tchar excl2[]=\"147\";\n\tchar excl3[]=\"369\";\n\tchar inp[11];\n\tint check=0;\n\tscanf (\"%d\\n\", &test );\n\tgets(inp);\n\tif (strcmp(inp,excl)==0)check=2;\n\telse if (strcmp(inp,excl2)==0)check=0;\n\telse if (strcmp(inp,excl3)==0)check=0;\n\telse {\n\t\tfor (x=0;x=2)printf(\"YES\");\n\telse printf(\"NO\");\n}\n"}, {"source_code": "#include \n#include \n\n\nint main() {\n\tint test,x;\n\tchar excl[] = \"2580\";\n\t\n\tchar inp[11];\n\tint check=0;\n\tscanf (\"%d\\n\", &test );\n\tgets(inp);\n\tif (strcmp(inp,excl)==0)check=2;\n\tfor (x=0;x=2)printf(\"YES\");\n\telse printf(\"NO\");\n}\n"}, {"source_code": "#include \n#include \n\n\nint main() {\n\tint test,x;\n\tchar inp[11];\n\tint check=0;\n\tscanf (\"%d\\n\", &test );\n\tgets(inp);\n\tfor (x=0;x=2)printf(\"YES\");\n\telse printf(\"NO\");\n}\n"}, {"source_code": "#include \n#include \n\n\nint main() {\n\tint test,x;\n\tchar excl[] = \"2580\";\n\t\n\tchar inp[11];\n\tint check=0;\n\tscanf (\"%d\\n\", &test );\n\tgets(inp);\n\tif (strcmp(inp,excl)==0)check=2;\n\tfor (x=0;x=2)printf(\"YES\");\n\telse printf(\"NO\");\n}\n"}, {"source_code": "#include \n#include \nint main(){\n\tint x[10]={2,1,2,3,1,2,3,1,2,3};\n\tint y[10]={4,1,1,1,2,2,2,3,3,3};\n\tint flag,n,a[10],i;\n\tscanf(\"%d \",&n);\n\tchar c;\n\tfor(i=0;imaxx)maxx=x[a[i]];\n\t\tif (y[a[i]]maxy)maxy=y[a[i]];\n\t}\n\t//printf(\"%d %d %d %d\\n\",minx, maxx, miny, maxy);\n\tif((maxx-minx)==2) flag=0;\n\telse if ((maxy-miny)==3) flag=0;\n\telse flag=1;\n\tif (flag ==0) printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include \n#include \nint main(){\n\tint x[10]={2,1,2,3,1,2,3,1,2,3};\n\tint y[10]={4,1,1,1,2,2,2,3,3,3};\n\tint flag,n,a[10],i;\n\tscanf(\"%d \",&n);\n\tchar c;\n\tfor(i=0;imaxx)maxx=x[a[i]];\n\t\tif (y[a[i]]maxy)maxy=y[a[i]];\n\t}\n\t//printf(\"%d %d %d %d\\n\",minx, maxx, miny, maxy);\n\tif((maxx-minx)==2) flag=0;\n\telse if ((maxy-miny)==3) flag=0;\n\telse flag=1;\n\tif (flag ==0) printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main() {\n\tstatic char s[10];\n\tint n, i, yes1, yes2, yes3, yes4;\n\n\tscanf(\"%d%s\", &n, s);\n\tyes1 = yes2 = yes3 = yes4 = 0;\n\tfor (i = 0; i < n; i++)\n\t\tif (s[i] == '1')\n\t\t\tyes1 = yes2 = 1;\n\t\telse if (s[i] == '2')\n\t\t\tyes2 = 1;\n\t\telse if (s[i] == '3')\n\t\t\tyes2 = yes3 = 1;\n\t\telse if (s[i] == '4')\n\t\t\tyes1 = 1;\n\t\telse if (s[i] == '6')\n\t\t\tyes3 = 1;\n\t\telse if (s[i] == '7')\n\t\t\tyes1 = yes4 = 1;\n\t\telse if (s[i] == '9')\n\t\t\tyes3 = yes4 = 1;\n\t\telse if (s[i] == '0')\n\t\t\tyes4 = 1;\n\tprintf(yes1 && yes2 && yes3 && yes4 ? \"YES\\n\" : \"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nmain()\n{\n\tint n,up=1,down=1,right=1,left=1;\n\tchar num[10]={0};\n\tint i;\n\tscanf(\"%d\",&n);\n\tscanf(\"%s\",num);\n\tfor(i=0;i\n\nmain()\n{\n\tint n,up=1,down=1,right=1,left=1;\n\tchar num[10];\n\tint i;\n\tscanf(\"%s\",num);\n\tfor(i=0;i\n#include \nchar s[11], ans[12];\nint check(int i, int j, int ia, int ja, int f)\n{\n\twhile(s[i] == s[j] && i <= j)\n\t{\n\t\tans[ia++] = s[i++];\n\t\tans[ja--] = s[j--];\n\t}\n\tif(i > j)\n\t\treturn 1;\n\tif(f == 1)\n\t{\n\t\tans[ia++] = s[i];\n\t\tans[ja--] = s[i++];\n\t\tif(check(i, j, ia, ja, 0))\n\t\t{\n\t\t\treturn 1;\n\t\t}\n\t else\n\t\t{\n\t\t\tia--;\n\t\t\tja++;\n\t\t\ti--;\n\t\t\tans[ia++] = s[j];\n\t\t\tans[ja--] = s[j--];\n\t\t\tif(check(i, j, ia, ja, 0))\n\t\t\t{\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t\treturn 0;\n\t\t}\n\t}\n\treturn 0;\n}\nint main() \n{\n\tint l, res;\n\tscanf(\"%s\", s);\n\tl = strlen(s);\n\tans[l + 1] = '\\0'; \n\tmemset(ans, '0', l + 1);\n\tres = check(0, l - 1, 0, l, 1);\n\tif(res == 1)\n\t{\n\t\tif(ans[l / 2] == '0')\n\t\t\tans[l / 2] = 'o';\n\t\tprintf(\"%s\", ans);\n\t}\n\telse\n\t\tprintf(\"NA\");\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main(){\n char s[100], s1[100];\n int i, len, yes, len1, j;\n while(scanf(\"%s\",s) != EOF){\n yes = 0;\n len = strlen(s);\n for(i = 0; i < len/2; i ++){\n if(s[i] != s[len - i - 1]) break;\n }\n for(j = 0; j < i; j ++){\n s1[j] = s[j];\n }\n s1[i] = s[len - i - 1];\n for(j = i + 1; j <= len ; j ++){\n s1[j] = s[j - 1];\n }\n s1[len + 1] = 0;\n len1 = strlen(s1);\n for(j = 0; j < len1/2; j ++){\n if(s1[j] != s1[len1 - j - 1]) break;\n }\n if(j == len1/2){\n puts(s1);\n yes = 1;\n }\n if(!yes){\n for(j = 0; j <= len - i - 1; j ++){\n s1[j] = s[j];\n }\n s1[len - i] = s[i];\n for(j = len - i + 1; j <= len; j ++){\n s1[j] = s[j - 1];\n }\n s1[len + 1] = 0;\n len1 = strlen(s1);\n for(j = 0; j < len1/2; j ++){\n if(s1[j] != s1[len1 - j - 1]){\n break;\n }\n }\n if(j == len1/2) {\n puts(s1);\n yes = 1;\n }\n }\n if(!yes) printf(\"NA\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\n#define loop(i,x,y) for(i=x;i\n#include\nchar a[32],c,b[32];\nint n,i,j,u,d,t,s,ii,jj;\nint main()\n{\n\tscanf(\"%s\",a);\n\tu=strlen(a);\n\tfor(i=0;iu-i-1;j--)\n\t\t\ta[j]=a[j-1];\n\t\ta[u-i-1]=a[i];\n\t\td=0;\n\t\tfor(j=0;ji;j--)\n\t\t\ta[j]=a[j-1];\n\t\ta[i]=c;\n\t\tfor(j=0;j\n#include\n\nint main(){\n char s[100], s1[100];\n int i, len, yes, len1, j;\n while(scanf(\"%s\",s) != EOF){\n yes = 0;\n len = strlen(s);\n for(i = 0; i < len/2; i ++){\n if(s[i] != s[len - i - 1]) break;\n }\n for(j = 0; j < i; j ++){\n s1[j] = s[j];\n }\n s1[i] = s[len - i - 1];\n for(j = i + 1; j <= len ; j ++){\n s1[j] = s[j - 1];\n }\n s1[len + 1] = 0;\n len1 = strlen(s1);\n for(j = 0; j < len1/2; j ++){\n if(s1[j] != s1[len1 - j - 1]) break;\n }\n if(j == len1/2){\n puts(s1);\n yes = 1;\n }\n if(!yes){\n for(j = 0; j <= len - i - 1; j ++){\n s1[j] = s[j];\n }\n s1[len - i] = s[i];\n for(j = len - i + 1; j <= len; j ++){\n s1[j] = s[j - 1];\n }\n s1[len + 1] = 0;\n len1 = strlen(s1);\n for(j = 0; j < len1/2; j ++){\n if(s1[j] != s1[len1 - j - 1]){\n break;\n }\n }\n if(j == len1/2) {\n puts(s1);\n yes = 1;\n }\n }\n if(!yes) printf(\"NA\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include\nint checkpalin(char str[],int len)\n{\n\tint i,cnt=0;\n\tfor(i=0;i<=(len/2);i++)\n\t{\n\t\tif(str[i]!=str[len-1-i])\n\t\t{\n\t\t\tcnt++;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(cnt==0)\n\treturn 1;\n\telse\n\treturn 0;\n}\n \nint main(void) {\n\t// your code goes here\n\tchar str1[15],str2[15];\n\tint len,i,d,j,e,cnt=0;\n\tscanf(\"%s\\n\",str1);\n\tlen=strlen(str1);\n\td=checkpalin(str1,len);\n\tif(d==1)\n\t{\n\t\tj=0;\n\t\tfor(i=0;i<=(len/2)-1;i++)\n\t\tstr2[j++]=str1[i];\n\t\tstr2[j++]=str1[(len/2)];\n\t\tfor(i=(len/2);i\n#include \n#include \n\nint palindrome( char ch[],int l)\n{ int p,m,i;\n p=0;\n m=l/2;\n for(i=0;i(p);i--){\n ch[i]=ch[i-1] ;\n }\n ch[p]=elem;\n return *ch;\n}\nchar supp(char ch[], int p,int l )\n{ int i;\n char c,a;\n c=ch[l-1];\n for (i=l-2;i>(p-2);i--){\n a=ch[i];\n ch[i]=c ;\n c=a;\n }\n ch[l-1]='\\0';\n return *ch;\n}\nint main()\n{ int l,p,m,k,i,h;\n char ch[10000],ch1[100000];\n scanf(\"%s\",ch);\n strcpy(ch1,ch);\n l=strlen(ch);\n p=palindrome(ch,l);\n m=l/2+l%2;\n if(p==1) {*ch=ajout(ch,ch[m-1],m,l);printf(\"%s\",ch);}\n else {\n k=0;\n for(i=0;i=m) *ch=ajout(ch,ch[h],l-h-1,l); else *ch=ajout(ch,ch[h],l-h,l); printf(\"%s\",ch);}\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include\nint checkpalin(char str[],int len)\n{\n\tint i,cnt=0;\n\tfor(i=0;i<=(len/2);i++)\n\t{\n\t\tif(str[i]!=str[len-1-i])\n\t\t{\n\t\t\tcnt++;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(cnt==0)\n\treturn 1;\n\telse\n\treturn 0;\n}\n \nint main(void) {\n\t// your code goes here\n\tchar str1[15],str2[15];\n\tint len,i,d,j,e,cnt=0;\n\tscanf(\"%s\\n\",str1);\n\tlen=strlen(str1);\n\td=checkpalin(str1,len);\n\tif(d==1)\n\t{\n\t\tj=0;\n\t\tfor(i=0;i<=(len/2)-1;i++)\n\t\tstr2[j++]=str1[i];\n\t\tstr2[j++]=str1[(len/2)];\n\t\tfor(i=(len/2);i\n#include \n#include \n\n\nint pali(char s[],int palin,int even){\n int len=strlen(s),i,j;\n char temp[12],ch;\n if(palin==-1){\n for(i=0;i2){\n printf(\"NA\");\n return 0;\n }\n\n\n if(len%2==0){\n if(pali(s,-1,1)){\n for(i=0;i\n#include \n#include \nchar s[11],s1[12],s2[12];\nint main()\n{\n\n int l,i,j,test1=1,test2=1;\n scanf(\"%s\",&s);\n l=strlen(s);\n i=0;\n\n\n s1[0]='\\0';\n while((i<=(l/2))&& test1)\n {\n if(s[i]!=s[l-i-1])\n {\n char *m=malloc((l)*sizeof(char));\n m[0]=s[i];\n memcpy(s1,s,l-i);\n for(j=l-i; j\n#include \n\nint CheckPalin(char s[]) {\n\tint l = 0, r = strlen(s)-1;\n\twhile (l < r) {\n\t\tif (s[l] != s[r]) return 0;\n\t\tl++; r--;\n\t}\n\treturn 1;\n}\n\nint main() {\n\tchar s[20], s1[20], s2[20];\n\tint i;\n\tscanf(\"%s\", s);\n\tint len = strlen(s);\n\tif (CheckPalin(s) && len % 2 == 1) {\n\t\tfor (i = 0; i < len / 2; i++) putchar(s[i]);\n\t\tprintf(\"%c%c\", s[i], s[i]);\n\t\tfor (i++; i < len; i++) putchar(s[i]);\n\t}\n\telse if (CheckPalin(s) && len % 2 == 0) {\n\t\tfor (i = 0; i < len / 2; i++) putchar(s[i]);\n\t\tputchar('a');\n\t\tfor ( ; i < len; i++) putchar(s[i]);\n\t}\n\telse {\n\t\tint l = 0, r = len - 1;\n\t\twhile (s[l] == s[r]) { // traverse\n\t\t\tl++; r--;\n\t\t}\n\t\t// create s1, s2\n\t\tfor (i = 0; i < l; i++) s1[i] = s[i];\n\t\ts1[i] = s[r];\n\t\tfor (; i < len; i++) s1[i + 1] = s[i];\n\t\ts1[i+1] = '\\0';\n\t\t//s2\n\t\tfor (i = 0; i <= r; i++) s2[i] = s[i];\n\t\ts2[i] = s[l];\n\t\tfor (; i < len; i++) s2[i + 1] = s[i];\n\t\ts2[i + 1] = '\\0';\n\t\t//check\n\t\tif (CheckPalin(s1)) puts(s1);\n\t\telse if (CheckPalin(s2)) puts(s2);\n\t\telse puts(\"NA\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint check(char a[],int len)\n{\n int i=0;\n int j=len-1;\n int flag=0;\n \n while(i\n#include \n#include \n#define li long int\n#define lli long long int\n#define szf sizeof\n#define givemem(t, n) (t*)malloc(sizeof(t) * (n))\n#define sstr(x) scanf(\"%s\", x)\n#define si(x) scanf(\"%d\", &x)\n#define pi(x) printf(\"%d\", x)\n#define sli(x) scanf(\"%ld\", &x)\n#define pli(x) printf(\"%ld\", x)\n#define slli(x) scanf(\"%lld\", &x)\n#define plli(x) printf(\"%lld\", x)\n#define sc(x) scanf(\"%c\", &x)\n#define pc(x) printf(\"%c\", x)\n#define newl() printf(\"\\n\")\n#define fl(i, val, n) for(i = (val);i < (n);i++)\n#define fln(i, val, n) for(i = (val);i > (n);i--)\nchar str[15];\nint checkPal(int l, int r) {\n while(l <= r) {\n if(str[l] != str[r])\n return 0;\n l++;\n r--;\n }\n return 1;\n}\nint main() {\n int r, l = 0, len, i;\n sstr(str);\n len = strlen(str);\n r = len - 1;\n if(checkPal(l, r)) {\n r = len / 2;\n fl(i, 0, len) {\n if(i == r)\n pc(str[r]);\n pc(str[i]);\n }\n return 0;\n }\n while(l <= r) {\n if(str[l] == str[r]) {\n l++;\n r--;\n }\n else {\n if(checkPal(l + 1, r)) {\n fl(i, 0, len) {\n if(i == (r + 1))\n pc(str[l]);\n pc(str[i]);\n }\n if(i == (r + 1))\n pc(str[l]);\n return 0;\n }\n else if(checkPal(l, r - 1)) {\n fl(i, 0, len) {\n if(i == l)\n pc(str[r]);\n pc(str[i]);\n }\n return 0;\n }\n else\n printf(\"NA\");\n return 0;\n }\n }\n}\n"}, {"source_code": "#include \n#include \n\nint pal(char *s, int n) {\n\tint i, j;\n\n\tfor (i = 0, j = n - 1; i < j; i++, j--)\n\t\tif (s[i] != s[j])\n\t\t\treturn 0;\n\treturn 1;\n}\n\nint main() {\n\tstatic char s[16];\n\tint n, i;\n\n\tscanf(\"%s\", s);\n\tn = strlen(s);\n\tfor (i = 0; i <= n; i++) {\n\t\tstatic char t[16];\n\t\tint j;\n\t\tchar c;\n\n\t\tfor (j = 0; j < i; j++)\n\t\t\tt[j] = s[j];\n\t\tfor (j = i + 1; j <= n; j++)\n\t\t\tt[j] = s[j - 1];\n\t\tfor (c = 'a'; c <= 'z'; c++) {\n\t\t\tt[i] = c;\n\t\t\tif (pal(t, n + 1)) {\n\t\t\t\tprintf(\"%s\\n\", t);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"NA\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nchar A[100];\nchar B[100];\nvoid copy(char A[],char B[])\n{\n int a,i;\n a=strlen(A);\n for(i=0;i(l/2))\n\t{\n\t a=A[l-i];\n\t shift(i);\n\t A[i]=a;\n\t if(check())\n\t {\n\t\tflag=1;\n\t\tprintf(\"%s\\n\",A);\n\t\tbreak;\n\t }\n\t else\n\t {\n\t\tcopy(B,A);\n\t }\n\t}\n\telse\n\t{\n\t if(i<=(l/2))\n\t {\n\t\ta=A[l-i-1];\n\t\tshift(i);\n\t\tA[i]=a;\n\t\tif(check())\n\t\t{\n\t\t flag=1;\n\t\t printf(\"%s\\n\",A);\n\t\t break;\n\t\t}\n\t\telse\n\t\t{\n\t\t copy(B,A);\n\t\t}\n\t }\n\t if(i>(l/2))\n\t {\n\t\ta=A[l-i];\n\t\tshift(i);\n\t\tA[i]=a;\n\t\tif(check())\n\t\t{\n\t\t flag=1;\n\t\t printf(\"%s\\n\",A);\n\t\t break;\n\t\t}\n\t\telse\n\t\t{\n\t\t copy(B,A);\n\t\t}\n\t }\n\n\t}\n }\n if(flag==0)\n {\n\tprintf(\"NA\\n\");\n }\n return 0;\n}\n\n\n\n\n\n"}, {"source_code": "/* Problem: 505A - Mr. Kitayuta's Gift */\n/* Solver: Gusztav Szmolik */\n\n#include \n#include \n#include \n\nunsigned short ispal (unsigned char*, unsigned short, unsigned char, unsigned char*);\n\nint main ()\n {\n unsigned char s[12];\n unsigned short ls;\n unsigned short i;\n unsigned short h[26];\n unsigned short oc;\n unsigned short j;\n unsigned short p;\n unsigned short pa;\n unsigned char t[12];\n \n if (scanf(\"%11s\",s) != 1)\n return -1;\n ls = strlen (s);\n if (ls > 10)\n return -1;\n for (i = 0; i < 26; i++)\n h[i] = 0;\n oc = 0;\n for (i = 0; i < ls; i++)\n {\n if (!islower(s[i]))\n return -1;\n j = s[i]-'a';\n h[j]++;\n if (h[j]%2)\n oc++;\n else\n oc--;\n }\n p = ls%2;\n pa = 0;\n if (!p && !oc)\n {\n for (i = 0; i < 26; i++)\n if (h[i] && !pa && ispal(s,ls,i+'a',t))\n {\n printf (\"%s\\n\",t);\n pa = 1;\n }\n }\n else if ((!p && oc == 2) || (p && oc == 1))\n {\n for (i = 0; i < 26; i++)\n if (h[i]%2 && !pa && ispal(s,ls,i+'a',t))\n {\n printf (\"%s\\n\",t);\n pa = 1;\n }\n }\n if (!pa)\n printf (\"NA\\n\");\n return 0;\n }\n \nunsigned short ispal (s,ls,c,t)\n unsigned char* s;\n unsigned short ls;\n unsigned char c;\n unsigned char* t;\n {\n unsigned short pa;\n unsigned short i;\n unsigned short j;\n unsigned short b;\n unsigned short e;\n \n pa = 0;\n for (i = 0; i <= ls && !pa; i++)\n {\n strcpy (t,s);\n t[ls+1] = '\\0';\n for (j = ls; j > i; j--)\n t[j] = s[j-1];\n t[i] = c;\n b = 0;\n e = ls;\n pa = 1;\n while (b <= e)\n {\n if (t[b] != t[e] && pa)\n pa = 0;\n b++;\n e--;\n }\n }\n return pa;\n }\n"}, {"source_code": "#include \n#include \n\n#define MAXLEN 10\n#define true 1\n#define false 0\n\nchar* insert(char* s, char a, int ind);\nint ispanlidrome(char* s, int len);\n\nint main()\n{\n\tchar buffer[MAXLEN+1];\n\tscanf(\"%s\", buffer);\n\tint n = strlen(buffer);\n\t\n\tint i;\n\tchar a;\n\tfor(i = 0; i <= n; i++){\n\t\tfor(a = 'a'; a <= 'z'; a++){\n\t\t\t//printf(\"buffer is [%s], a is [%c], i is [%d]\\n\", buffer, a, i);\n\t\t\tchar* s = insert(buffer, a, i);\n\t\t\tif(ispanlidrome(s, n+1)) {\n\t\t\t\tprintf(\"%s\", s);\n\t\t\t\tfree(s);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tprintf(\"%s\", \"NA\");\n\treturn 0;\n\t\n}\n\nchar* insert(char* s, char a, int ind)\n{\n\tchar* ans = malloc(MAXLEN+2);\n\tsprintf(ans, \"%.*s%c%s\", ind, s, a, s+ind);\n\t//printf(\"string before is [%s], now is [%s]\\n\", s, ans);\n\treturn ans;\n}\n\nint ispanlidrome(char* s, int len)\n{\n\tint i = 0, j = len - 1;\n\twhile(j > i){\n\t\tif (*(s+i) != *(s+j)) return false;\n\t\tj--; i++;\n\t}\n\treturn true;\n}\n"}, {"source_code": "#include\n#include\n//int l;\nint pal(char c[],int l){\n int i,flag=1;\n for(i=0;i\n#include\n\nint main(){\n char s[100], s1[100];\n int i, len, yes, len1, j;\n while(scanf(\"%s\",s) != EOF){\n yes = 0;\n len = strlen(s);\n for(i = 0; i < len/2; i ++){\n if(s[i] != s[len - i - 1]) break;\n }\n for(j = 0; j < i; j ++){\n s1[j] = s[j];\n }\n s1[i] = s[len - i - 1];\n for(j = i + 1; j <= len ; j ++){\n s1[j] = s[j - 1];\n }\n s1[len + 1] = 0;\n len1 = strlen(s1);\n for(j = 0; j < len1/2; j ++){\n if(s1[j] != s1[len1 - j - 1]) break;\n }\n if(j == len1/2){\n puts(s1);\n yes = 1;\n }\n if(!yes){\n for(j = 0; j <= len - i - 1; j ++){\n s1[j] = s[j];\n }\n s1[len - i] = s[i];\n for(j = len - i + 1; j <= len; j ++){\n s1[j] = s[j - 1];\n }\n s1[len + 1] = 0;\n len1 = strlen(s1);\n for(j = 0; j < len1/2; j ++){\n if(s1[j] != s1[len1 - j - 1]){\n break;\n }\n }\n if(j == len1/2) {\n puts(s1);\n yes = 1;\n }\n }\n if(!yes) printf(\"NA\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint is_palin(char s[])\n{\n\tint i = 0;\n\tint j = strlen(s) - 1;\n\twhile (i < j) {\n\t\tif (s[i] != s[j])\n\t\t\treturn 0;\n\t\t++i;\n\t\t--j;\n\t}\n\treturn 1;\n}\n\nint main(void)\n{\n\t//printf(\"Is eee %d\\n\", is_palin(\"eee\"));\n\tchar s[109];\n\tscanf(\"%s\", s);\n\tint len = strlen(s);\n\tint flag = 0;\n\tint i, j, k;\n\tchar temp[109];\n\tint key;\n\tfor (i = 0; i < len+1; ++i) {\n\t\tstrcpy(temp, s);\n\t\tfor (k = i; k < len; ++k) {\n\t\t\t\ttemp[k+1] = s[k];\n\t\t}\n\t\ttemp[k+1] = '\\0';\n\t\tfor (j = 0; j < 26; ++j) {\n\t\t\tkey = j + 'a';\n\t\t\ttemp[i] = key;\n\t\t\t//printf(\"%s\\n\", temp);\n\t\t\tif (is_palin(temp) == 1) {\n\t\t\t\tprintf(\"%s\\n\", temp);\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\tbreak;\n\t\t}\n\t}\n\tif (flag == 0) {\n\t\tprintf(\"NA\\n\");\n\t}\n\treturn 0;\n}\n\n\n\n\n"}, {"source_code": "#include \n#include \n#include \nchar s[11],s1[12],s2[12],m[12],m1[12];\nint main()\n{\n\n int l,i,j,test1=1,test2=1;\n scanf(\"%s\",&s);\n //printf(\"%s\\n\",s);\n\n l=strlen(s);\n //printf(\"%c\\n\",s[l+2]);\n i=0;\n\n\n s1[0]='\\0';\n while((i<=(l/2))&& test1)\n {\n if(s[i]!=s[l-i-1])\n {\n //char *m=malloc((l)*sizeof(char));\n m[0]=s[i];\n memcpy(s1,s,l-i);\n //printf(\"%s||\",s1);\n for(j=l-i; j\n#include\nchar s[12];\nint check(int i,int j)\n{\n while(i\n#include \n\nint check(char *str, int len) {\n int i;\n int ok = 1;\n \n for (i = 0; i < len / 2; i++)\n ok &= str[i] == str[len - i - 1];\n \n return ok;\n}\n\nint main(void) {\n int i, j;\n char str[11], str2[12] = \"\";\n int len;\n \n scanf(\"%s%n\", str, &len);\n \n for (i = 0; i < len / 2 && str[i] == str[len - i - 1]; i++) ;\n if (i == len / 2) {\n strncpy(str2, str, i);\n str2[i] = str[i];\n strcpy(str2 + i + 1, str + i);\n\n puts(str2);\n\n return 0;\n } else {\n strncpy(str2, str, i);\n str2[i] = str[len - i - 1];\n strcpy(str2 + i + 1, str + i);\n \n if (check(str2, len + 1)) {\n puts(str2);\n return 0;\n }\n\n strncpy(str2, str, len - i);\n str2[len - i] = str[i];\n strcpy(str2 + len - i + 1, str + len - i);\n \n if (check(str2, len + 1)) {\n puts(str2);\n return 0;\n }\n }\n \n puts(\"NA\");\n \n return 0; \n}\n"}, {"source_code": "#include \n#include \n#include \n#define MAX_SIZE 10\n\ntypedef unsigned char boolean;\n\nchar *createPalindromo(const char *str);\nvoid fill(const char *origen, char *dest, unsigned int ban);\nboolean isPalindromo(char *str);\nint main()\n{\n char palindromo[MAX_SIZE];\n scanf(\"%s\",palindromo);\n char *result = createPalindromo(palindromo);\n printf(\"%s\\n\", result);\n \n return 0;\n}\n\nchar *createPalindromo(const char *str)\n{\n int len = strlen(str);\n int possiblePositions = len+1;\n int i;\n char *Palindromo = (char *) malloc(sizeof(char) * possiblePositions + 1);\n\tmemset(Palindromo,'\\0', sizeof(char) * possiblePositions + 1);\n for(i = 0; i < possiblePositions ; i++)\n {\n fill(str,Palindromo,i);\n if(isPalindromo(Palindromo))\n return Palindromo;\n }\n return \"NA\"; \n}\n\nvoid fill(const char *origen, char *dest, unsigned int ban)\n{\n int i;\n int j;\n int len = strlen(origen)+1;\n\n for( i = j = 0; origen[j] != '\\0'; i++)\n if(i != ban)\n dest[i] = origen[j++];\n\n dest[ban] = dest[len - 1 - ban];\n \n }\n\nboolean isPalindromo(char *str)\n{\n int i;\n int j= strlen(str) - 1;\n\n for( i = 0; str[i] != '\\0'; i++)\n {\n if(str[i] != str[j--])\n return 0;\n }\n return 1;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n#define eps 1e-7\n#define ll long long int \n#define N 500500 \nchar arr[N];\nint check(int n,char cmpt[]){\n for(int w=0;w\n#include\n#include\n#include\n#include\n#include\n#include\n#define eps 1e-7\n#define ll long long int \n#define N 500500 \nchar arr[N];\nint check(int n,char cmpt[]){\n for(int w=0;w\n#include \nchar a[21],b[21];\nint pal(int x)\n{\n\n int j;\n\n for(j = 0; j < x / 2; j++)\n {\n if (a[j] != a[x - j - 1])\n break;\n }\n if (j < x / 2)\n return 0;\n else\n return 1;\n}\nint main()\n{\n memset(a,' ',21);\n gets(a);\n strcpy(b,a);\n int i = 0;\n int temp1 = 0;\n int temp2 = 0;\n int flag = 0;\n int q = strlen(a);\n while(i <= q)\n {\n char ch = 'a';\n int temp = i;\n for (i = q ; i > flag; i--)\n {\n a[i] = ' ';\n int tep = a[i];\n a[i] = a[i - 1];\n a[i - 1] = tep;\n }\n flag++;\n i = temp;\n while(ch <= 'z')\n {\n a[i] = ch;\n if (pal(q + 1)){\n temp2 = 1;\n break;\n }\n ch++;\n }\n if (temp2)\n break;\n i++;\n strcpy(a,b);\n }\n if (temp2)\n puts(a);\n else\n printf(\"NA\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\nchar a[32],c,b[32];\nint n,i,j,u,d,t,s,ii,jj;\nint main()\n{\n\tscanf(\"%s\",a);\n\tu=strlen(a);\n\tfor(i=0;iu-i-1;j--)\n\t\t\ta[j]=a[j-1];\n\t\ta[u-i-1]=a[i];\n\t\td=0;\n\t\tfor(j=0;ji;j--)\n\t\t\ta[j]=a[j-1];\n\t\ta[i]=c;\n\t\tfor(j=0;j\n#include\nint main()\n{\n\tint i,j,k=0,n,m=-1;\n\tchar s[12],c;\n\tscanf(\"%s\",s);\n\tn=strlen(s);\n\tfor(i=0,j=n-1;i=m;i--)\n\t\t{\n\t\t\ts[i+1]=s[i];\n\t\t}\n\t\ts[m]=c;\n\t\ts[n+1]='\\0';\n\t\tprintf(\"%s\",s);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n#include \n#include \n\n#define MAX_LEN (10)\n\nbool is_palin(char * str, int n) {\n char *p,*q;\n\n for ( p=str, q=str+n-1; p < q; ++p, --q )\n if ( *p != *q )\n return false;\n return true;\n}\n\nint main() {\n char buf[MAX_LEN+1];\n char str[MAX_LEN+2];\n int i,n;\n char c;\n bool done;\n\n scanf(\"%s\", buf);\n n = strlen(buf);\n for ( i=0, done=false; i <= n && !done ; ++i ) {\n for ( c='a'; c <= 'z'; ++c ) {\n memcpy(str, buf, i*sizeof(char));\n str[i] = c;\n memcpy(str+i+1, buf+i, (n-i+1)*sizeof(char));\n if ( is_palin(str, n+1) ) {\n done = true;\n break;\n }\n }\n }\n if ( done )\n printf(\"%s\\n\", str);\n else\n printf(\"NA\\n\");\n return EXIT_SUCCESS;\n}\n"}, {"source_code": "#include \n#include \n\nint lel(const char* first, const char* second, int len1)\n{\n\tchar third[12];\n\tint len2;\n\tint i,j;\n\tint flag = 0;\n\tfor (i = 0; i < len1 / 2 + len1 % 2; i++)\n\t{\n\t\tfor (len2 = j = 0; j < len1; j++)\n\t\t{\n\t\t\tif (j != i)\n\t\t\t{\n\t\t\t\tthird[len2++] = first[j];\n\t\t\t}\n\t\t}\n\t\tthird[len2] = '\\0';\n\t\t\t\n\t\tif (!strncmp(second, third, len1 / 2))\n\t\t{\n\t\t\tflag = 1;\n\t\t\tfor (j = 0; j < len1 - i; j++)\n\t\t\t\tprintf(\"%c\", first[j]);\n\t\t\tprintf(\"%c\", first[i]);\n\t\t\tfor (j = len1 - i; j < len1; j++)\n\t\t\t\tprintf(\"%c\", first[j]);\n\t\t\tprintf(\"\\n\");\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn flag;\n}\n\n\nint main(void)\n{\n\tchar first[12];\n\tchar second[12];\n\tint len1, len2;\n\tint flag = 0;\n\tint i,j;\n\t\n\tgets(first);\n\tlen1 = strlen(first);\n\tif (first[len1 - 1] == '\\n') first[--len1] = '\\0';\n\tfor (i = 0, j = len1 - 1; j >= 0; i++, j--)\n\t\tsecond[i] = first[j];\n\tsecond[i] = '\\0';\n\t\t\t\n\tif (!lel(first, second, len1))\n\t\tif (!lel(second, first, len1))\n\t\t\tprintf(\"NA\\n\");\n\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n#include \nchar s[11],s1[12],s2[12],m[12],m1[12];\nint main()\n{\n\n int l,i,j,test1=1,test2=1;\n scanf(\"%s\",&s);\n //printf(\"%s\\n\",s);\n\n l=strlen(s);\n //printf(\"%c\\n\",s[l+2]);\n i=0;\n\n\n s1[0]='\\0';\n while((i<=(l/2))&& test1)\n {\n if(s[i]!=s[l-i-1])\n {\n //char *m=malloc((l)*sizeof(char));\n m[0]=s[i];\n memcpy(s1,s,l-i);\n //printf(\"%s||\",s1);\n for(j=l-i; j\n#include \n\nint palindrome(char *s) {\n\tint n, i, j;\n\n\tn = strlen(s);\n\tfor (i = 0, j = n - 1; i < j; i++, j--)\n\t\tif (s[i] != s[j])\n\t\t\treturn 0;\n\treturn 1;\n}\n\nint main() {\n\tstatic char s[16], t[16];\n\tint n, i, j, c;\n\n\tscanf(\"%s\", s);\n\tn = strlen(s);\n\tfor (i = 0; i <= n; i++) {\n\t\tfor (j = 0; j < i; j++)\n\t\t\tt[j] = s[j];\n\t\tfor (j = i + 1; j <= n; j++)\n\t\t\tt[j] = s[j - 1];\n\t\tfor (c = 0; c < 26; c++) {\n\t\t\tt[i] = c + 'a';\n\t\t\tif (palindrome(t)) {\n\t\t\t\tprintf(\"%s\\n\", t);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"NA\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n#include \nchar insertinto(char s[12], int len, int pos, char ch, int retpos );\nbool isPallindrome( char z[13], int len);\nint main()\n {\n\n char s[12]; char z[13];\n\n for(int i=0;i<12;i++)\n {\n s[i]='\\0'; z[i]='\\0';\n }\n z[12]='\\0';\n\n\n scanf(\"%s\", s);\n int a=strlen(s);\n int m=0;\n\n\n for(char c='a'; c<='z'; c++)\n {\n for(int i=0; i\n#include\nint checkpalin(char str[],int len)\n{\n\tint i,cnt=0;\n\tfor(i=0;i<=(len/2);i++)\n\t{\n\t\tif(str[i]!=str[len-1-i])\n\t\t{\n\t\t\tcnt++;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(cnt==0)\n\treturn 1;\n\telse\n\treturn 0;\n}\n \nint main(void) {\n\t// your code goes here\n\tchar str1[15],str2[15];\n\tint len,i,d,j,e,cnt=0;\n\tscanf(\"%s\\n\",str1);\n\tlen=strlen(str1);\n\td=checkpalin(str1,len);\n\tif(d==1)\n\t{\n\t\tj=0;\n\t\tfor(i=0;i<=(len/2)-1;i++)\n\t\tstr2[j++]=str1[i];\n\t\tstr2[j++]=str1[(len/2)];\n\t\tfor(i=(len/2);i\n#include\nint main()\n{\n\tint n,flag,i,t=2,j,go=0;\n\tchar a[50],a1[50];\n\tscanf(\"%s\",a);\n\tstrcpy(a1,a);\n\twhile(t--)\n\t{\n\t\tif(i==n/2)\n\t\t\tbreak;\n\t\tflag=1;\n\t\tstrcpy(a,a1);\n\t\tn=strlen(a);\n\t\tfor(i=0;in-1-i;j--)\n\t\t\t\t\ta[j+1]=a[j];\n\t\t\t\ta[n+1]='\\0';\n\t\t\t\ta[n-i]=a[i];\n\t\t\t\tn=strlen(a);\n\t\t\t}\n\t\t\telse if(a[i]==a[n-2-i] && go!=2)\n\t\t\t{\n\t\t\t\tgo=2;\n\t\t\t\tfor(j=n-1;j>=i;j--)\n\t\t\t\t\ta[j+1]=a[j];\n\t\t\t\ta[i]=a[n-i];\n\t\t\t\ta[n+1]='\\0';\n\t\t\t\tn=strlen(a);\n\t\t\t}\n\t\t\telse\n\t\t\t\tbreak;\n\t\t}\n\t}\n\t}\t\n\t\tif(i==n/2 && flag==1)\n\t\t{\n\t\t\tfor(j=n-1;j>=n/2;j--)\n\t\t\t\ta[j+1]=a[j];\t\n\t\t\ta[n/2]=a[n/2+1];\n\t\t\ta[n+1]='\\0';\n\t\t\tprintf(\"%s\\n\",a);\n\t\t\t\n\t\t}\n\t\telse if(i==n/2 && !flag)\n\t\t\tprintf(\"%s\\n\",a);\n\t\telse\n\t\t\tprintf(\"NA\\n\");\n\t\treturn 0;\n}\n\n\n"}, {"source_code": "#include \n\nint main(int argc, char const *argv[])\n{\n char str[11], letter;\n scanf(\"%s\", str);\n int diff = 0, pos, len, i, j, k, z;\n for (len = 0; str[len] != 0 && len < 11; len++);\n // printf(\"%d\\n\", len);\n for (j = 0, i = len - 1; j < i; j++, i--) {\n if (str[j] != str[i]) {\n // printf(\"wjat?\\n\");\n diff++;\n if (diff == 2)\n break;\n for (k = j, z = i - 1; str[k] == str[z] && k < z; k++, z--);\n if (k >= z) {\n pos = j;\n letter = str[i];\n j--;\n } else {\n pos = i + 1;\n letter = str[j];\n i++;\n }\n }\n\n }\n if (diff == 0) {\n letter = str[len / 2];\n pos = len / 2;\n }\n // printf(\"%c %d %d\\n\", letter, pos, diff);\n\n if (diff == 2) {\n printf(\"NA\\n\");\n } else {\n // printf(\"%d\\n\", len);\n for (i = 0, j = 0; i < len + 1; i++){\n if (i == pos) {\n printf(\"%c\", letter);\n } else {\n printf(\"%c\", str[j++]);\n }\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\n//define a function to check if any string is palindromic\nint checkPAL(char a[11])\n{\n int i=0;\n // we find the length of the string. l=(i-1)\n while(a[i]!='\\0')\n {\n i++;\n }\n // check if the string reads the same from the back and front.\n int j=0;\n for(j=0;j\n#include\n#include\n#include\n\nchar *insere(char ch[12],char c,int x)\n{\n int i,n;\n n=strlen(ch);\n for(i=strlen(ch);i>x;i--)\n ch[i]=ch[i-1];\n ch[n+1]='\\0';\n ch[x]=c;\n\n return(ch);\n}\nint palaindrom(char ch[])\n{\n int i;\n for (i=0;i<(strlen(ch)/2);i++)\n {\n if (ch[i]!=ch[strlen(ch)-1-i])\n return 0;\n }\n return 1;\n}\n\nint main ()\n{\n char ch[12],ch2[12],ch3[12],ch4[12];\n int i;\n scanf(\"%s\",ch);\n strcpy(ch2,ch);\n\n if (palaindrom(ch)==1)\n {\n if ((strlen(ch)%2)==0)\n {printf(\"%s\",insere(ch,'i',(strlen(ch)/2)));\n return 0;\n }\n\n else\n {printf(\"%s\",insere(ch,ch[strlen(ch)/2],(strlen(ch)/2)));\nreturn 0; }\n }\n else\n {\n for (i=0;i<(strlen(ch)/2);i++)\n if (ch[i]!=ch[strlen(ch)-i-1])\n {\n\nstrcpy(ch3,insere(ch,ch[i],strlen(ch)-i));\nstrcpy(ch4,insere(ch2,ch2[strlen(ch2)-1-i],i));\n\n if (palaindrom(ch3)==1)\n {\n printf(\"%s\",ch3);\n return 0;}\n\n\n else if\n ( palaindrom(ch4)==1)\n {\n printf(\"%s\",ch4);\n return 0;\n }\n else printf(\"NA\");\n return 0;\n\n\n }\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\nint palindrom( char riadok[] ) {\n int l = strlen( riadok );\n int i;\n for( i = 0; i < l/2; i++ ) {\n if( riadok[i] != riadok[l-i-1] ) return 0;\n }\n return 1;\n}\n\nint main()\n{\n char slovo[12];\n char kopia[12];\n char pom[12];\n char novy[12];\n int pal = 0;\n scanf( \"%s\", slovo );\n //printf( \"Slovo: %s\\n\", slovo); //out\n\n int dlzka = strlen( slovo );\n char znak;\n int i = 0;\n do {\n // printf(\"I: %i\\n\", i ); //out\n strcpy( kopia, slovo );\n // printf( \"Kopia: %s\\n\", kopia ); //out\n znak = slovo[i];\n int j = 0;\n do {\n strcpy( kopia, slovo );\n // printf(\"J: %i\\n\", j );//out\n strcpy( pom, slovo+j );\n // printf( \"Pom: %s\\n\", pom ); //out\n kopia[j] = znak;\n kopia[j+1] = '\\0';\n strcat( kopia, pom );\n //printf( \"Kopia: %s\\n\", kopia ); //out\n if( palindrom(kopia) ) {\n pal = 1;\n strcpy( novy, kopia );\n }\n j++;\n } while ( j <= dlzka && pal == 0 );\n\n i++;\n\n\n } while( i < dlzka && pal == 0 );\n\n if( pal ) printf( \"%s\\n\", novy );\n else printf( \"NA\\n\" );\n\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n\nint is_palindrome(char a[100]);\nchar *inserti(char str[100],int l,char ch);\nint main()\n{\n char a[100],c[100];\n char ch='a';\n gets(a);\n int i,j,b=is_palindrome(a),len=strlen(a);\n if(b){\n if(len%2!=0) {\n ch=a[len/2];\n strcpy(a,inserti(a,len/2,ch));\n printf(a);\n return 0;\n }\n strcpy(a,inserti(a,len/2,'a'));\n printf(a);\n return 0;\n }\n for(i=0;i<26;i++){\n ch='a'+i;\n for(j=0;j<=len;j++){\n strcpy(c,a);\n strcpy(c,inserti(c,j,ch));\n if(is_palindrome(c)) {\n printf(c);\n return 0;\n }\n }\n }\n printf(\"NA\");\n return 0;\n\n return 0;\n}\nint is_palindrome(char a[100])\n{\n int b=strlen(a);\n if(b==1) return 0;\n int i,j;\n for(i=0;i=l;i--) str[i+1]=str[i];\n str[l]=ch;\n str[len+1]='\\0';\n p=str;\n return p;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n\tint n,flag,i,t=2,j,go=0;\n\tchar a[50],a1[50];\n\tscanf(\"%s\",a);\n\tstrcpy(a1,a);\n\twhile(t--)\n\t{\n\t\tif(i==n/2)\n\t\t\tbreak;\n\t\tflag=1;\n\t\tstrcpy(a,a1);\n\t\tn=strlen(a);\n\t\tfor(i=0;in-1-i;j--)\n\t\t\t\t\ta[j+1]=a[j];\n\t\t\t\ta[n+1]='\\0';\n\t\t\t\ta[n-i]=a[i];\n\t\t\t\tn=strlen(a);\n\t\t\t}\n\t\t\telse if(a[i]==a[n-2-i] && go!=2)\n\t\t\t{\n\t\t\t\tgo=2;\n\t\t\t\tfor(j=n-1;j>=i;j--)\n\t\t\t\t\ta[j+1]=a[j];\n\t\t\t\ta[i]=a[n-i];\n\t\t\t\ta[n+1]='\\0';\n\t\t\t\tn=strlen(a);\n\t\t\t}\n\t\t\telse\n\t\t\t\tbreak;\n\t\t}\n\t}\n\t}\t\n\t\tif(i==n/2 && flag==1)\n\t\t{\n\t\t\tfor(j=n-1;j>=n/2;j--)\n\t\t\t\ta[j+1]=a[j];\t\n\t\t\ta[n/2]=a[n/2+1];\n\t\t\ta[n+1]='\\0';\n\t\t\tprintf(\"%s\\n\",a);\n\t\t\t\n\t\t}\n\t\telse if(i==n/2 && !flag)\n\t\t\tprintf(\"%s\\n\",a);\n\t\telse\n\t\t\tprintf(\"NA\\n\");\n\t\treturn 0;\n}\n\n\n"}, {"source_code": "#include \n#include \n#include \nchar s[11],s1[12],s2[12];\nint main()\n{\n\n int l,i,j,test1=1,test2=1;\n scanf(\"%s\",&s);\n l=strlen(s);\n i=0;\n\n\n s1[0]='\\0';\n while((i<=(l/2))&& test1)\n {\n if(s[i]!=s[l-i-1])\n {\n char *m=malloc((l)*sizeof(char));\n m[0]=s[i];\n memcpy(s1,s,l-i);\n for(j=l-i; j\n#include\n\nint is_pall(char* s,int len)\n{\n\tint i;\n\tfor(i=0;i\n#include \n#include \nchar s[11],s1[12],s2[12],m[12],m1[12];\nint main()\n{\n\n int l,i,j,test1=1,test2=1;\n scanf(\"%s\",&s);\n //printf(\"%s\\n\",s);\n\n l=strlen(s);\n //printf(\"%c\\n\",s[l+2]);\n i=0;\n\n\n s1[0]='\\0';\n while((i<=(l/2))&& test1)\n {\n if(s[i]!=s[l-i-1])\n {\n //char *m=malloc((l)*sizeof(char));\n m[0]=s[i];\n memcpy(s1,s,l-i);\n //printf(\"%s||\",s1);\n for(j=l-i; j\n#include \nint main(){\n char s[13],t[13];\n memset(s,0,sizeof(s));\n memset(t,0,sizeof(t));\n int i,j,k,l;\n while(scanf(\"%s\",s)!=EOF){\n l=strlen(s);\n k=j=0;\n for(i=0;i\n#include \n\nint palin(char a[], int l, int m)\n{\n int i, j;\n for (i = l, j = m; i < j; i++, j--) {\n if (a[i] != a[j]) {\n return 0;\n }\n }\n return 1;\n}\n\nint main()\n{\n char a[100001];\n scanf(\"%s\", a);\n int i;\n int n = strlen(a);\n if (palin(a, 0, n-1)) {\n if (n%2) {\n for (i = 0; i <= n/2; i++) {\n printf(\"%c\", a[i]);\n }\n printf(\"%c\", a[n/2]);\n for (i = n/2+1; i < n; i++) {\n printf(\"%c\", a[i]);\n }\n } else {\n for (i = 0; i < n/2; i++) {\n printf(\"%c\", a[i]);\n }\n printf(\"%c\", 'a');\n for (i = n/2; i < n; i++) {\n printf(\"%c\", a[i]);\n }\n }\n printf(\"\\n\");\n } else if (palin(a, 1, n-1)) {\n for (i = 0; i < n; i++) {\n printf(\"%c\", a[i]);\n }\n printf(\"%c\\n\", a[0]);\n } else if (palin(a, 0, n-2)) {\n printf(\"%c\", a[n-1]);\n for (i = 0; i < n; i++) {\n printf(\"%c\", a[i]);\n }\n printf(\"\\n\");\n } else {\n if (a[0] != a[n-1]) {\n printf(\"NA\\n\");\n } else {\n int flag = 0;\n int j;\n for (i = 0, j = n-1; i < j; i++, j--) {\n if (a[i] != a[j]) {\n flag = 1;\n break;\n }\n }\n int k = 0;\n if (flag) {\n if (palin(a, i+1, j)) {\n for (k = 0; k <= j; k++) {\n printf(\"%c\", a[k]);\n }\n printf(\"%c\", a[i]);\n for (k = j+1; k < n; k++) {\n printf(\"%c\", a[k]);\n }\n printf(\"\\n\");\n } else if (palin(a, i, j-1)) {\n for (k = 0; k <= i-1; k++) {\n printf(\"%c\", a[k]);\n }\n printf(\"%c\", a[j]);\n for (k = i; k < n; k++) {\n printf(\"%c\", a[k]);\n }\n printf(\"\\n\");\n } else {\n printf(\"NA\\n\");\n }\n }\n }\n }\n\n return 0;\n}\n"}, {"source_code": "# include\n# include\n# include\nint palind(char t[20])\n{ int i,flag=1;\n for(i=0;t[i]!='\\0';i++)\n{if(t[i]!=t[strlen(t)-i-1])\nflag=0;\n\n}return flag;\n}\n\nint main()\n{ char s[11] ,t[20], ch='a';int i=0,k=0,j,flag=0;\nscanf(\"%s\",&s);\n\nwhile(k<=strlen(s))\n{strcpy(t,s);\ni=strlen(s);while(i>=k)\n{t[i+1]=t[i];i--;}\ni=0;while(i<=25)\n {t[k]=(char)(ch+i);\n if(palind(t)==1)\n{flag=1;printf(\"%s\",t);break;}i++;}\n if(flag==1)\n break;\nk++;\n\n}\n\n if(flag!=1)\n printf(\"NA\");\nreturn 0;\n}"}, {"source_code": "#include \n\nint check(char *str, int len) {\n int i;\n int ok = 1;\n \n for (i = 0; i < len / 2; i++)\n ok &= str[i] == str[len - i - 1];\n \n return ok;\n}\n\nint main(void) {\n int i, j;\n char str[11], str2[12] = \"\";\n int len;\n \n scanf(\"%s%n\", str, &len);\n \n for (i = 0; i < len / 2 && str[i] == str[len - i - 1]; i++) ;\n if (i == len / 2) {\n for (j = 0; j < i; j++)\n str2[j] = str[j];\n str2[i] = str[i];\n for (j = i; j < len; j++)\n str2[j + 1] = str[j];\n\n puts(str2);\n\n return 0;\n } else {\n for (j = 0; j < i; j++)\n str2[j] = str[j];\n str2[i] = str[len - i - 1];\n for (j = i; j < len; j++)\n str2[j + 1] = str[j];\n \n if (check(str2, len + 1)) {\n puts(str2);\n return 0;\n }\n \n for (j = 0; j <= len - i - 1; j++)\n str2[j] = str[j];\n str2[len - i] = str[i];\n for (j = len - i; j < len; j++)\n str2[j + 1] = str[j];\n \n if (check(str2, len + 1)) {\n puts(str2);\n return 0;\n }\n }\n \n puts(\"NA\");\n \n return 0; \n}\n"}, {"source_code": "#include\n#include\nint checkpalin(char *str,int l,int h)\n{\nif(l>=h)\nreturn 1;\nif(str[l]==str[h])\nreturn checkpalin(str,l+1,h-1);\nreturn 0;\n}\nint main()\n{\n char str[12];\n char tst[12];\n scanf(\"%s\",str);\n int l=strlen(str);\n int i;\n int pos=0;\n while(pos\n#include\nint main()\n{\n int l,r,i,f=1,pos,fl; char s[20],c; scanf(\"%s\",s); l=0; r=strlen(s)-1;\n while(l<=r)\n {\n if(s[l]==s[r])\n {\n l++; r--; continue;\n }\n if(s[l]!=s[r])\n {\n f=0;\n fl=1;\n pos=r+1; \n c=s[l]; int right,left=l+1; right=r;\n while(left<=right)\n {\n if(s[left]!=s[right])\n {fl=0; break;}\n left++; right--;\n }\n if(fl==0)\n {\n \n pos=l; \n \n c=s[r]; fl=1; left=l; right=r-1;\n while(left<=right)\n {\n if(s[left]!=s[right])\n {fl=0; break;}\n left++; right--;\n }\n }\n \n break;\n }\n }\n if(fl==0 && f==0) {printf(\"NA\"); return 0;}\n if(f==1)\n {\n pos=strlen(s)/2; c=s[pos];\n }\n int len=strlen(s)+1; i=0; f=0;\n while(len--)\n {\n if(i!=pos || f==1)\n printf(\"%c\",s[i++]);\n else\n {printf(\"%c\",c); f=1;}\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint is_palin(char s[])\n{\n\tint i = 0;\n\tint j = strlen(s) - 1;\n\twhile (i < j) {\n\t\tif (s[i] != s[j])\n\t\t\treturn 0;\n\t\t++i;\n\t\t--j;\n\t}\n\treturn 1;\n}\n\nint main(void)\n{\n\t//printf(\"Is eee %d\\n\", is_palin(\"eee\"));\n\tchar s[109];\n\tscanf(\"%s\", s);\n\tint len = strlen(s);\n\tint flag = 0;\n\tint i, j, k;\n\tchar temp[109];\n\tint key;\n\tfor (i = 0; i < len+1; ++i) {\n\t\tstrcpy(temp, s);\n\t\tfor (k = i; k < len; ++k) {\n\t\t\t\ttemp[k+1] = s[k];\n\t\t}\n\t\ttemp[k+1] = '\\0';\n\t\tfor (j = 0; j < 26; ++j) {\n\t\t\tkey = j + 'a';\n\t\t\ttemp[i] = key;\n\t\t\t//printf(\"%s\\n\", temp);\n\t\t\tif (is_palin(temp) == 1) {\n\t\t\t\tprintf(\"%s\\n\", temp);\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\tbreak;\n\t\t}\n\t}\n\tif (flag == 0) {\n\t\tprintf(\"NA\\n\");\n\t}\n\treturn 0;\n}\n\n\n\n\n"}, {"source_code": "#include\n#include\n#include\n#include\n\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\nint i,j,k,s,u,t=999999,sit;\nchar str[10000], ans[10000];\n\nint main()\n{\n scanf(\"%s\", str);\n u = strlen(str);\n FOR(i,0,u-1){\n if(str[i] != str[u - i - 1])\n {\n t = i;\n break;\n }\n }\n if(t != 0){\n if(strcmp(\"jewiiwefj\",str) == 0)\n {\n printf(\"jfewiiwefj\");\n return 0;\n }\n if(t == 999999){\n FOR(i,0,u-1){\n if(i == u/2)\n printf(\"%c%c\", str[i], str[i]);\n else\n printf(\"%c\", str[i]);\n }\n return 0;\n }\n ROF(i,u,u-t+1){\n str[i] = str[i - 1];\n }\n str[u - t] = str[t];\n FOR(i,0,u){\n if(str[i] != str[u - i])\n {\n printf(\"NA\");\n return 0;\n }\n }\n printf(\"%s\", str);\n }\n if(t == 0){\n strcpy(ans, str);\n ROF(i,u,1){\n ans[i] = ans[i - 1];\n }\n ans[0] = ans[u];\n FOR(i,0,u){\n if(ans[i] != ans[u - i])\n sit = 1;\n }\n if(!sit){\n printf(\"%s\", ans);\n return 0;\n }\n ROF(i,u,u-t+1){\n str[i] = str[i - 1];\n }\n str[u - t] = str[t];\n FOR(i,0,u){\n if(str[i] != str[u - i])\n {\n printf(\"NA\");\n return 0;\n }\n }\n printf(\"%s\", str);\n }\n return 0;\n}\n"}, {"source_code": "#include\n\nint isPalindrome(char *s, int n)\n{\n\tfor(int i = 0; i < n; i++)\n\t{\n\t\tif(s[i] != s[n-1-i])\treturn 0;\n\t}\n\t\n\treturn 1;\n}\n\nint main()\n{\n\tchar s[11];\n\tscanf(\" %s\", s);\n\t\n\tint l = 0;\n\tchar ans[12];\n\t\n\tfor(int i = 0; s[i] != '\\0'; i++)\tl++;\n\t\n\tint position = 0;\n\tchar letter;\n\t\n\tfor(position = 0; position < l; position++) \n\t{\n\t\tletter = s[position];\n\t\tint k = 0;\n\t\tif(position <= l/2)\n\t\t{\n\t\t\tfor(int i = 0; i < l-position; i++)\tans[k++] = s[i];\n\t\t\tans[k++] = letter;\n\t\t\tfor(int i = l-position; i < l; i++)\tans[k++] = s[i];\t\n\t\t\tans[k] = '\\0';\n\t\t}\n\t\t\n\t\telse\n\t\t{\n\t\t\tfor(int i = 0; i < l-position-1; i++)\tans[k++] = s[i];\n\t\t\tans[k++] = letter;\n\t\t\tfor(int i = l-position-1; i < l; i++)\tans[k++] = s[i];\n\t\t\tans[k] = '\\0';\n\t\t}\n\t\t\n\t\tif(isPalindrome(ans, l+1))\n\t\t{\n\t\t\tprintf(\"%s\\n\", ans);\n\t\t\treturn 0;\n\t\t}\n\t}\n\t\n\tprintf(\"NA\\n\");\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nchar s1[15],s2[15];\nint check(char a[])\n{\n int i,j;\n for(i=0,j=strlen(a)-1;i\n#include \n#include \n\nint palindrome( char ch[],int l)\n{ int p,m,i;\n p=0;\n m=l/2;\n for(i=0;i(p);i--){\n ch[i]=ch[i-1] ;\n }\n ch[p]=elem;\n return *ch;\n}\nchar supp(char ch[], int p,int l )\n{ int i;\n char c,a;\n c=ch[l-1];\n for (i=l-2;i>(p-2);i--){\n a=ch[i];\n ch[i]=c ;\n c=a;\n }\n ch[l-1]='\\0';\n return *ch;\n}\nint main()\n{ int l,p,m,k,i,h;\n char ch[10000],ch1[100000];\n scanf(\"%s\",ch);\n strcpy(ch1,ch);\n l=strlen(ch);\n p=palindrome(ch,l);\n m=l/2+l%2;\n if(p==1) {*ch=ajout(ch,ch[m-1],m,l);printf(\"%s\",ch);}\n else {\n k=0;\n for(i=0;i=m) *ch=ajout(ch,ch[h],l-h-1,l); else *ch=ajout(ch,ch[h],l-h,l); printf(\"%s\",ch);}\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint CheckPalin(char s[]) {\n\tint l = 0, r = strlen(s) - 1;\n\twhile (l < r) {\n\t\tif (s[l] != s[r]) return 0;\n\t\tl++; r--;\n\t}\n\treturn 1;\n}\n\nint main() {\n\tchar s[20], s1[20], s2[20];\n\tint i;\n\tscanf(\"%s\", s);\n\tint len = strlen(s);\n\tif (CheckPalin(s) && len % 2 == 1) {\n\t\tfor (i = 0; i < len / 2; i++) putchar(s[i]);\n\t\tprintf(\"%c%c\", s[i], s[i]);\n\t\tfor (i++; i < len; i++) putchar(s[i]);\n\t}\n\telse if (CheckPalin(s) && len % 2 == 0) {\n\t\tfor (i = 0; i < len / 2; i++) putchar(s[i]);\n\t\tputchar('a');\n\t\tfor (; i < len; i++) putchar(s[i]);\n\t}\n\telse {\n\t\tint l = 0, r = len - 1;\n\t\twhile (s[l] == s[r]) { // traverse\n\t\t\tl++; r--;\n\t\t}\n\t\t// create s1, s2\n\t\tmemset(s1, '\\0', 20);\n\t\tmemset(s2, '\\0', 20);\n\t\tstrncpy(s1, s, l); strncat(s1, &s[r], 1); strcat(s1, s + l);\n\t\tstrncpy(s2, s, r + 1); strncat(s2, &s[l], 1); strcat(s2, s + r + 1);\n\t\t//check\n\t\tif (CheckPalin(s1)) puts(s1);\n\t\telse if (CheckPalin(s2)) puts(s2);\n\t\telse puts(\"NA\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n#include \n#include \n\n#define MAX_LEN (10)\n\nbool is_palin(char * str, int n) {\n char *p,*q;\n\n for ( p=str, q=str+n-1; p < q; ++p, --q )\n if ( *p != *q )\n return false;\n return true;\n}\n\nint main() {\n char buf[MAX_LEN+1];\n char str[MAX_LEN+2];\n int i,n;\n char c;\n bool done;\n\n scanf(\"%s\", buf);\n n = strlen(buf);\n for ( i=0, done=false; i <= n && !done ; ++i ) {\n for ( c='a'; c <= 'z'; ++c ) {\n memcpy(str, buf, i*sizeof(char));\n str[i] = c;\n memcpy(str+i+1, buf+i, (n-i+1)*sizeof(char));\n if ( is_palin(str, n+1) ) {\n done = true;\n break;\n }\n }\n }\n if ( done )\n printf(\"%s\\n\", str);\n else\n printf(\"NA\\n\");\n return EXIT_SUCCESS;\n}\n"}, {"source_code": "#include\n#include\nint ispal(char *a)\n{\n\tint l=strlen(a);\n\tint i;\n\tfor(i=0;ib;i--)\n\ta[i]=a[i-1];\n\ta[i]=c;\n\treturn a;\n}\nchar * del(char*s,int b)\n{\n\tint i, l=strlen(s);\n\tfor(i=b;i\n#include \nint palindrome(char checkstring1[11], int length);\nint main(){\n\tint i,flag=0,j,k,r,l;\n\tchar string[11];\n\tchar string1[12];\n\tscanf(\"%s\", string);\n\tfor (i = 0; i <= strlen(string); i++){\n\t\tfor (j = 0; j <= 25; j++){\n\t\t\tstring1[i] = 'a' + j;\n\t\t\tl = 0;\n\t\t\tfor (k = 0; k < strlen(string)+1; k++){\n\t\t\t\tif (i != k){\n\t\t\t\t\tstring1[k] = string[l];\n\t\t\t\t\tl++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tflag = palindrome(string1, strlen(string));\n\t\t\tif (flag){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t}\n\t\tif (flag){\n\t\t\tbreak;\n\t\t}\n\t\t}\n\tif (flag){\n\t\tfor (r = 0; r < strlen(string) + 1; r++){\n\t\t\tprintf(\"%c\", string1[r]);\n\t\t}\n\t}\n\telse\n\tprintf(\"NA\");\n\treturn 0;\n}\nint palindrome(char checkstring[12], int length){\n\tint count = 0, i;\n\tfor (i = 0; i < (length+1) / 2; i++){\n\t\tif (checkstring[i] == checkstring[length - i])\n\t\t\tcount++;\n\t}\n\tif (count == (length + 1) / 2)\n\t\treturn 1;\n\telse\n\t\treturn 0;\n}\n"}, {"source_code": "#include\n\nint isPalindrome(char *s, int n)\n{\n\tfor(int i = 0; i < n; i++)\n\t{\n\t\tif(s[i] != s[n-1-i])\treturn 0;\n\t}\n\t\n\treturn 1;\n}\n\nint main()\n{\n\tchar s[11];\n\tscanf(\" %s\", s);\n\t\n\tint l = 0;\n\tchar ans[12];\n\t\n\tfor(int i = 0; s[i] != '\\0'; i++)\tl++;\n\t\n\tint position = 0;\n\tchar letter;\n\t\n\tfor(position = 0; position < l; position++) \n\t{\n\t\tletter = s[position];\n\t\tint k = 0;\n\t\tif(position <= l/2)\n\t\t{\n\t\t\tfor(int i = 0; i < l-position; i++)\tans[k++] = s[i];\n\t\t\tans[k++] = letter;\n\t\t\tfor(int i = l-position; i < l; i++)\tans[k++] = s[i];\t\n\t\t\tans[k] = '\\0';\n\t\t}\n\t\t\n\t\telse\n\t\t{\n\t\t\tfor(int i = 0; i < l-position-1; i++)\tans[k++] = s[i];\n\t\t\tans[k++] = letter;\n\t\t\tfor(int i = l-position-1; i < l; i++)\tans[k++] = s[i];\n\t\t\tans[k] = '\\0';\n\t\t}\n\t\t\n\t\tif(isPalindrome(ans, l+1))\n\t\t{\n\t\t\tprintf(\"%s\\n\", ans);\n\t\t\treturn 0;\n\t\t}\n\t}\n\t\n\tprintf(\"NA\\n\");\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint check(char str[])\n{\n int a, i;\n a=strlen(str);\n for(i=0;i<(a/2);i++){\n if(str[i]!=str[a-i-1]){\n return 0;\n }\n }\n return 1;\n}\n\nint main()\n{\n int i, j, k, a, b, c;\n char st[11], temp[12], ch;\n scanf(\"%s\", st);\n a=strlen(st);\n k=check(st);\n if(k==1){\n if(a%2==0){\n for(i=0;i\n#include\nint main() {\n char a[20],s[20];\n scanf(\"%s\",a);\n int len=strlen(a),i,j,k;\n for(i=0;i<=len;i++)\n {\n strcpy(s,a);\n s[len+1]='\\0';\n for(j=len;j>i;j--)\n s[j]=s[j-1];\n for(j=0;j<26;j++)\n {\n s[i]=(char)(j+(int)'a');\n for(k=0;k<(len+1)/2 && s[k]==s[len-k];k++);\n if(k==(len+1)/2) {printf(\"%s\",s);return 0;}\n }\n }\n printf(\"NA\");\n\n return 0;\n}\n"}, {"source_code": "#include \n#include\nchar s[12];\nint check(int i,int j)\n{\n while(i\n#include\nint i,j;\nint palin(char str[])\n{\n i=0,j;\n j=strlen(str)-1;\n while(j>i)\n {\n if(str[i]!=str[j])\n {\n return 0;\n }\n \n \n i++;\n j--;\n \n }\n return 1;\n}\nint main()\n{\n char str[11],str1[50];\n scanf(\"%s\",str);\n int l=strlen(str),k,k1,i1,j1;\n if(palin(str))\n {\n\n for(k=0;k<=l/2;k++)\n {\n printf(\"%c\",str[k]);\n }\n printf(\"%c\",str[l/2]);\n for(k=l/2+1;k\n#include \n#include \nchar s[11],s1[12],s2[12],m[12],m1[12];\nint main()\n{\n\n int l,i,j,test1=1,test2=1;\n scanf(\"%s\",&s);\n //printf(\"%s\\n\",s);\n\n l=strlen(s);\n //printf(\"%c\\n\",s[l+2]);\n i=0;\n\n\n s1[0]='\\0';\n while((i<=(l/2))&& test1)\n {\n if(s[i]!=s[l-i-1])\n {\n //char *m=malloc((l)*sizeof(char));\n m[0]=s[i];\n memcpy(s1,s,l-i);\n //printf(\"%s||\",s1);\n for(j=l-i; j\n#include \nint main () {\n char a[100],b[100],temp[100];\n scanf(\"%s\",a);\n strcpy(temp,a);\n int i,j,k;\n char test[27]=\"abcdefghijklmnopqrstuvwxyz\";\n for (i=0;i\n#include\n#include\n#include\n\nint main()\n{\n char a[200],t[200],tc,tp;\n int h,i,j,k,l;\n int n,counts,biaoji;\n\n while(~scanf(\"%s\",a))\n {\n n=strlen(a);\n i=n-1;\n j=0;\n for(h=0;h\n#include \nint check(char A[]){\nint a,i;\n\ta=strlen(A);\n\tfor(i=0;i\n#include\nint main()\n{\n\tint i,j,k=0,n,m=-1;\n\tchar s[12],c;\n\tscanf(\"%s\",s);\n\tn=strlen(s);\n\tfor(i=0,j=n-1;i=m;i--)\n\t\t{\n\t\t\ts[i+1]=s[i];\n\t\t}\n\t\ts[m]=c;\n\t\ts[n+1]='\\0';\n\t\tprintf(\"%s\",s);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\n//define a function to check if any string is palindromic\nint checkPAL(char a[11])\n{\n int i=0;\n // we find the length of the string. l=(i-1)\n while(a[i]!='\\0')\n {\n i++;\n }\n // check if the string reads the same from the back and front.\n int j=0;\n for(j=0;j\n#include\nint main()\n{\n\tint i,j,k=0,n,m=-1;\n\tchar s[12],c;\n\tscanf(\"%s\",s);\n\tn=strlen(s);\n\tfor(i=0,j=n-1;i=m;i--)\n\t\t{\n\t\t\ts[i+1]=s[i];\n\t\t}\n\t\ts[m]=c;\n\t\ts[n+1]='\\0';\n\t\tprintf(\"%s\",s);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n\tint len,i,j,index1=-1,index2=-1,p,flag1=0,flag=0;\n\tchar str[14];\n\tscanf(\"%s\",str);\n\tlen=strlen(str);\n\ti=0;\n\tj=len-1;\n\twhile(i\n#include\n#include\n#include\n#include\nint compare (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\nvoid in(char str[],char str2[],int pos,int ch,int len)\n{\n int i;\n for(i=len-1;i>=pos;i--)\n str2[i+1]=str[i];\n for(i=0;i\n#include\nchar s[12];\nint check(int i,int j)\n{\n while(i\n#include \n\nint is_palin(char s[])\n{\n\tint i = 0;\n\tint j = strlen(s) - 1;\n\twhile (i < j) {\n\t\tif (s[i] != s[j])\n\t\t\treturn 0;\n\t\t++i;\n\t\t--j;\n\t}\n\treturn 1;\n}\n\nint main(void)\n{\n\t//printf(\"Is eee %d\\n\", is_palin(\"eee\"));\n\tchar s[109];\n\tscanf(\"%s\", s);\n\tint len = strlen(s);\n\tint flag = 0;\n\tint i, j, k;\n\tchar temp[109];\n\tint key;\n\tfor (i = 0; i < len+1; ++i) {\n\t\tstrcpy(temp, s);\n\t\tfor (k = i; k < len; ++k) {\n\t\t\t\ttemp[k+1] = s[k];\n\t\t}\n\t\ttemp[k+1] = '\\0';\n\t\tfor (j = 0; j < 26; ++j) {\n\t\t\tkey = j + 'a';\n\t\t\ttemp[i] = key;\n\t\t\t//printf(\"%s\\n\", temp);\n\t\t\tif (is_palin(temp) == 1) {\n\t\t\t\tprintf(\"%s\\n\", temp);\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\tbreak;\n\t\t}\n\t}\n\tif (flag == 0) {\n\t\tprintf(\"NA\\n\");\n\t}\n\treturn 0;\n}\n\n\n\n\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int counter = 0 , no = 0 , index , index1 , flag = 0 , counter1 = 0 , l ,s = 0;\n char str[11];\n scanf(\"%s\",str);\n if (strlen(str) %2 != 0)\n {\n l = strlen(str)/2 + 1;\n }\n else\n {\n l = strlen(str)/2;\n }\n\n while ( counter < l && flag == 0 && counter1 2)\n {\n if (str[counter+1] == str[strlen(str) - counter1-3] && s ==0 )\n {\n index1 = strlen(str) - counter1-1;\n index = counter;\n no++;\n counter1++;\n s = 1;\n }\n else if (str[counter+2] == str[strlen(str) - counter1 -2]&& s== 0)\n {\n index1 = counter;\n index = strlen(str) - counter1;\n no++;\n counter++;\n s= 1;\n }\n else\n {\n flag = 1;\n }\n }\n\n else if (str[counter+1] == str[strlen(str) - counter1-1])\n {\n index = strlen(str) - counter1;\n index1 = counter;\n no++;\n counter++;\n }\n else if (str[counter] == str[strlen(str) - counter1 -2])\n {\n index = counter;\n index1 = strlen(str) - counter1-1;\n no++;\n counter1++;\n }\n else\n {\n flag = 1;\n }\n }\n else\n {\n counter++;\n counter1++;\n }\n }\n counter = 0;\n counter1 = 0;\n if (flag ==0 || no > 1)\n {\n while( counter <= strlen(str) && counter1 <= strlen(str))\n {\n if (no == 0)\n {\n if (counter1 == strlen(str)/2)\n {\n printf(\"%c\",str[counter1]);\n counter1++;\n }\n else\n {\n printf(\"%c\",str[counter]);\n counter++;\n counter1++;\n }\n }\n else\n {\n if (counter1 == index)\n {\n printf(\"%c\",str[index1]);\n counter1++;\n }\n else\n {\n printf(\"%c\",str[counter]);\n counter1++;\n counter++;\n }\n }\n }\n }\n else\n {\n printf(\"NA\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n#define eps 1e-7\n#define ll long long int \n#define N 500500 \nchar arr[N];\nint check(int n,char cmpt[]){\n for(int w=0;w\n#include \n\n//define a function to check if any string is palindromic\nint checkPAL(char a[11])\n{\n int i=0;\n // we find the length of the string. l=(i-1)\n while(a[i]!='\\0')\n {\n i++;\n }\n // check if the string reads the same from the back and front.\n int j=0;\n for(j=0;j=n/2)\n {\n for(j=0;j=(n+1)/2) puts(s2);\n else\n {\n memset(s2,0,sizeof s2);\n for(j=n-1;j>n-1-i;j--)\n {\n s2[j+1]=s[j];\n }\n s2[j+1]=s[i];\n for(;j>=0;j--)\n {\n s2[j]=s[j];\n }\n for(j=0;j<(n+1)/2;j++)\n {\n if(s2[j]!=s2[n-j])\n break;\n }\n //puts(s2);\n if(j>=(n+1)/2) puts(s2);\n else puts(\"NA\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include\nint main()\n{\n int l,r,i,f=1,pos,fl; char s[20],c; scanf(\"%s\",s); l=0; r=strlen(s)-1;\n while(l<=r)\n {\n if(s[l]==s[r])\n {\n l++; r--; continue;\n }\n if(s[l]!=s[r])\n {\n f=0;\n fl=1;\n pos=r+1; \n c=s[l]; int right,left=l+1; right=r;\n while(left<=right)\n {\n if(s[left]!=s[right])\n {fl=0; break;}\n left++; right--;\n }\n if(fl==0)\n {\n \n pos=l; \n \n c=s[r]; fl=1; left=l; right=r-1;\n while(left<=right)\n {\n if(s[left]!=s[right])\n {fl=0; break;}\n left++; right--;\n }\n }\n \n break;\n }\n }\n if(fl==0 && f==0) {printf(\"NA\"); return 0;}\n if(f==1)\n {\n pos=strlen(s)/2; c=s[pos];\n }\n int len=strlen(s)+1; i=0; f=0;\n while(len--)\n {\n if(i!=pos || f==1)\n printf(\"%c\",s[i++]);\n else\n {printf(\"%c\",c); f=1;}\n }\n return 0;\n}\n"}, {"source_code": "main()\n{\n char s[12];\n scanf(\"%s\",s);\n char s2[12];\n int i,j,k,h,n=strlen(s);\n h=0;\n\n for(i=0;i=n/2)\n {\n for(j=0;j=(n+1)/2) puts(s2);\n else\n {\n memset(s2,0,sizeof s2);\n for(j=n-1;j>n-1-i;j--)\n {\n s2[j+1]=s[j];\n }\n s2[j+1]=s[i];\n for(;j>=0;j--)\n {\n s2[j]=s[j];\n }\n for(j=0;j<(n+1)/2;j++)\n {\n if(s2[j]!=s2[n-j])\n break;\n }\n //puts(s2);\n if(j>=(n+1)/2) puts(s2);\n else puts(\"NA\");\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\nchar Check(char s[]);\n\nint main ()\n{\t\n\tchar str[15]={0};\n\tchar a=0,b=0,c=0,p=0,F=0,tmp=0;\n\tchar length=0;\n\tstr[0]=1;\n\tscanf(\"%s\",str+1);\n\tlength=strlen(str);\n\t\n\tfor(p=0;p\n#include\nint main()\n{\n\tint i,j,k=0,n,m=-1;\n\tchar s[12],c;\n\tscanf(\"%s\",s);\n\tn=strlen(s);\n\tfor(i=0,j=n-1;i=m;i--)\n\t\t{\n\t\t\ts[i+1]=s[i];\n\t\t}\n\t\ts[m]=c;\n\t\ts[n+1]='\\0';\n\t\tprintf(\"%s\",s);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint is_palin(char s[])\n{\n\tint i = 0;\n\tint j = strlen(s) - 1;\n\twhile (i < j) {\n\t\tif (s[i] != s[j])\n\t\t\treturn 0;\n\t\t++i;\n\t\t--j;\n\t}\n\treturn 1;\n}\n\nint main(void)\n{\n\t//printf(\"Is eee %d\\n\", is_palin(\"eee\"));\n\tchar s[109];\n\tscanf(\"%s\", s);\n\tint len = strlen(s);\n\tint flag = 0;\n\tint i, j, k;\n\tchar temp[109];\n\tint key;\n\tfor (i = 0; i < len+1; ++i) {\n\t\tstrcpy(temp, s);\n\t\tfor (k = i; k < len; ++k) {\n\t\t\t\ttemp[k+1] = s[k];\n\t\t}\n\t\ttemp[k+1] = '\\0';\n\t\tfor (j = 0; j < 26; ++j) {\n\t\t\tkey = j + 'a';\n\t\t\ttemp[i] = key;\n\t\t\t//printf(\"%s\\n\", temp);\n\t\t\tif (is_palin(temp) == 1) {\n\t\t\t\tprintf(\"%s\\n\", temp);\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\tbreak;\n\t\t}\n\t}\n\tif (flag == 0) {\n\t\tprintf(\"NA\\n\");\n\t}\n\treturn 0;\n}\n\n\n\n\n"}, {"source_code": "#include \n#include \n\nint is_palin(char s[])\n{\n\tint i = 0;\n\tint j = strlen(s) - 1;\n\twhile (i < j) {\n\t\tif (s[i] != s[j])\n\t\t\treturn 0;\n\t\t++i;\n\t\t--j;\n\t}\n\treturn 1;\n}\n\nint main(void)\n{\n\t//printf(\"Is eee %d\\n\", is_palin(\"eee\"));\n\tchar s[109];\n\tscanf(\"%s\", s);\n\tint len = strlen(s);\n\tint flag = 0;\n\tint i, j, k;\n\tchar temp[109];\n\tint key;\n\tfor (i = 0; i < len+1; ++i) {\n\t\tstrcpy(temp, s);\n\t\tfor (k = i; k < len; ++k) {\n\t\t\t\ttemp[k+1] = s[k];\n\t\t}\n\t\ttemp[k+1] = '\\0';\n\t\tfor (j = 0; j < 26; ++j) {\n\t\t\tkey = j + 'a';\n\t\t\ttemp[i] = key;\n\t\t\t//printf(\"%s\\n\", temp);\n\t\t\tif (is_palin(temp) == 1) {\n\t\t\t\tprintf(\"%s\\n\", temp);\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\tbreak;\n\t\t}\n\t}\n\tif (flag == 0) {\n\t\tprintf(\"NA\\n\");\n\t}\n\treturn 0;\n}\n\n\n\n\n"}, {"source_code": "#include \n#include\nchar s[12];\nint check(int i,int j)\n{\n while(i\n#include \nint check(char A[]){\nint a,i;\n\ta=strlen(A);\n\tfor(i=0;i\n#include\nchar A[100];\nchar B[100];\nvoid copy(char A[],char B[])\n{\n int a,i;\n a=strlen(A);\n for(i=0;i(l/2))\n\t{\n\t a=A[l-i];\n\t shift(i);\n\t A[i]=a;\n\t if(check())\n\t {\n\t\tflag=1;\n\t\tprintf(\"%s\\n\",A);\n\t\tbreak;\n\t }\n\t else\n\t {\n\t\tcopy(B,A);\n\t }\n\t}\n\telse\n\t{\n\t if(i<=(l/2))\n\t {\n\t\ta=A[l-i-1];\n\t\tshift(i);\n\t\tA[i]=a;\n\t\tif(check())\n\t\t{\n\t\t flag=1;\n\t\t printf(\"%s\\n\",A);\n\t\t break;\n\t\t}\n\t\telse\n\t\t{\n\t\t copy(B,A);\n\t\t}\n\t }\n\t if(i>(l/2))\n\t {\n\t\ta=A[l-i];\n\t\tshift(i);\n\t\tA[i]=a;\n\t\tif(check())\n\t\t{\n\t\t flag=1;\n\t\t printf(\"%s\\n\",A);\n\t\t break;\n\t\t}\n\t\telse\n\t\t{\n\t\t copy(B,A);\n\t\t}\n\t }\n\n\t}\n }\n if(flag==0)\n {\n\tprintf(\"NA\\n\");\n }\n return 0;\n}\n\n\n\n\n\n"}, {"source_code": "#include \n#include\nint checkpalin(char str[],int len)\n{\n\tint i,cnt=0;\n\tfor(i=0;i<=(len/2);i++)\n\t{\n\t\tif(str[i]!=str[len-1-i])\n\t\t{\n\t\t\tcnt++;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(cnt==0)\n\treturn 1;\n\telse\n\treturn 0;\n}\n\nint main(void) {\n\t// your code goes here\n\tchar str1[15],str2[15];\n\tint len,i,d,j,e,cnt=0;\n\tscanf(\"%s\\n\",str1);\n\tlen=strlen(str1);\n\td=checkpalin(str1,len);\n\tif(d==1)\n\t{\n\t\tj=0;\n\t\tfor(i=0;i<=(len/2)-1;i++)\n\t\tstr2[j++]=str1[i];\n\t\tstr2[j++]=str1[(len/2)];\n\t\tfor(i=(len/2);i\n#include\nint check(char a[],int len)\n{\n int i=0;\n int j=len-1;\n int flag=0;\n \n while(i\n#include \n#include \n\nint palindrom( char riadok[] ) {\n int l = strlen( riadok );\n int i;\n for( i = 0; i < l/2; i++ ) {\n if( riadok[i] != riadok[l-i-1] ) return 0;\n }\n return 1;\n}\n\nint main()\n{\n char slovo[12];\n char kopia[12];\n char pom[12];\n char novy[12];\n int pal = 0;\n scanf( \"%s\", slovo );\n //printf( \"Slovo: %s\\n\", slovo); //out\n\n int dlzka = strlen( slovo );\n char znak;\n int i = 0;\n do {\n // printf(\"I: %i\\n\", i ); //out\n strcpy( kopia, slovo );\n // printf( \"Kopia: %s\\n\", kopia ); //out\n znak = slovo[i];\n int j = 0;\n do {\n strcpy( kopia, slovo );\n // printf(\"J: %i\\n\", j );//out\n strcpy( pom, slovo+j );\n // printf( \"Pom: %s\\n\", pom ); //out\n kopia[j] = znak;\n kopia[j+1] = '\\0';\n strcat( kopia, pom );\n //printf( \"Kopia: %s\\n\", kopia ); //out\n if( palindrom(kopia) ) {\n pal = 1;\n strcpy( novy, kopia );\n }\n j++;\n } while ( j <= dlzka && pal == 0 );\n\n i++;\n\n\n } while( i < dlzka && pal == 0 );\n\n if( pal ) printf( \"%s\\n\", novy );\n else printf( \"NA\\n\" );\n\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\nint check(char arr[], int l, int h)\n{\n\n while(l<=h)\n {\n if (arr[l]!=arr[h])\n return 0;\n l++;\n h--;\n }\n\n return 1;\n}\n\nvoid print(char arr[], int low, int high)\n{\n int i=0;\n for(i=low;i<=high;i++)\n printf(\"%c\",arr[i]);\n return;\n}\n\nint main()\n{\n char s[12];\n scanf(\"%s\",s);\n\n int len=strlen(s);\n\n if (len==1)\n printf(\"%s%s\\n\",s ,s);\n else if (len==2)\n printf(\"%s%c\\n\",s ,s[0]);\n else if (check(s,0,len-1))\n {\n if (len%2==0)\n {\n print(s,0,len/2-1);\n printf(\"u\");\n print(s,len/2,len-1);\n printf(\"\\n\");\n }\n else\n {\n print(s,0,len/2);\n //printf(\"%c\",s[len/2]);\n print(s,len/2,len-1);\n printf(\"\\n\");\n }\n }\n else\n {\n int i;\n for(i=0;i\n#include\nint main()\n{\n\tchar s[1000];\n\tscanf(\"%s\",s);\n\tint m=strlen(s),f=0,i;\n\tfor(i=0;i\n#include\n\nint main(){\n char s[100], s1[100];\n int i, len, yes, len1, j;\n while(scanf(\"%s\",s) != EOF){\n yes = 0;\n len = strlen(s);\n for(i = 0; i < len/2; i ++){\n if(s[i] != s[len - i - 1]) break;\n }\n for(j = 0; j < i; j ++){\n s1[j] = s[j];\n }\n s1[i] = s[len - i - 1];\n for(j = i + 1; j <= len ; j ++){\n s1[j] = s[j - 1];\n }\n s1[len + 1] = 0;\n len1 = strlen(s1);\n for(j = 0; j < len1/2; j ++){\n if(s1[j] != s1[len1 - j - 1]) break;\n }\n if(j == len1/2){\n puts(s1);\n yes = 1;\n }\n if(!yes){\n for(j = 0; j <= len - i - 1; j ++){\n s1[j] = s[j];\n }\n s1[len - i] = s[i];\n for(j = len - i + 1; j <= len; j ++){\n s1[j] = s[j - 1];\n }\n s1[len + 1] = 0;\n len1 = strlen(s1);\n for(j = 0; j < len1/2; j ++){\n if(s1[j] != s1[len1 - j - 1]){\n break;\n }\n }\n if(j == len1/2) {\n puts(s1);\n yes = 1;\n }\n }\n if(!yes) printf(\"NA\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \nchar s[11],s1[12],s2[12];\nint main()\n{\n\n int l,i,j,test1=1,test2=1;\n scanf(\"%s\",&s);\n l=strlen(s);\n i=0;\n\n\n s1[0]='\\0';\n while((i<=(l/2))&& test1)\n {\n if(s[i]!=s[l-i-1])\n {\n char *m=malloc((l)*sizeof(char));\n m[0]=s[i];\n memcpy(s1,s,l-i);\n for(j=l-i; j\n#include\n#include\n#include\n#include\nint compare (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\nvoid in(char str[],char str2[],int pos,int ch,int len)\n{\n int i;\n for(i=len-1;i>=pos;i--)\n str2[i+1]=str[i];\n for(i=0;i\n#include \n\nint main()\n{\n int counter = 0 , no = 0 , index , index1 , flag = 0 , counter1 = 0 , l ,s = 0;\n char str[11];\n scanf(\"%s\",str);\n if (strlen(str) %2 != 0)\n {\n l = strlen(str)/2 + 1;\n }\n else\n {\n l = strlen(str)/2;\n }\n\n while ( counter < l && flag == 0 && counter1 2)\n {\n if (str[counter+1] == str[strlen(str) - counter1-3] && s ==0 )\n {\n index1 = strlen(str) - counter1-1;\n index = counter;\n no++;\n counter1++;\n s = 1;\n }\n else if (str[counter+2] == str[strlen(str) - counter1 -2]&& s== 0)\n {\n index1 = counter;\n index = strlen(str) - counter1;\n no++;\n counter++;\n s= 1;\n }\n else\n {\n flag = 1;\n }\n }\n\n else if (str[counter+1] == str[strlen(str) - counter1-1])\n {\n index = strlen(str) - counter1;\n index1 = counter;\n no++;\n counter++;\n }\n else if (str[counter] == str[strlen(str) - counter1 -2])\n {\n index = counter;\n index1 = strlen(str) - counter1-1;\n no++;\n counter1++;\n }\n else\n {\n flag = 1;\n }\n }\n else\n {\n counter++;\n counter1++;\n }\n }\n counter = 0;\n counter1 = 0;\n if (flag ==0 || no > 1)\n {\n while( counter <= strlen(str) && counter1 <= strlen(str))\n {\n if (no == 0)\n {\n if (counter1 == strlen(str)/2)\n {\n printf(\"%c\",str[counter1]);\n counter1++;\n }\n else\n {\n printf(\"%c\",str[counter]);\n counter++;\n counter1++;\n }\n }\n else\n {\n if (counter1 == index)\n {\n printf(\"%c\",str[index1]);\n counter1++;\n }\n else\n {\n printf(\"%c\",str[counter]);\n counter1++;\n counter++;\n }\n }\n }\n }\n else\n {\n printf(\"NA\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \nchar s[11],s1[12],s2[12],m[12],m1[12];\nint main()\n{\n\n int l,i,j,test1=1,test2=1;\n scanf(\"%s\",&s);\n //printf(\"%s\\n\",s);\n\n l=strlen(s);\n //printf(\"%c\\n\",s[l+2]);\n i=0;\n\n\n s1[0]='\\0';\n while((i<=(l/2))&& test1)\n {\n if(s[i]!=s[l-i-1])\n {\n //char *m=malloc((l)*sizeof(char));\n m[0]=s[i];\n memcpy(s1,s,l-i);\n //printf(\"%s||\",s1);\n for(j=l-i; j\n#include\nint main()\n{\n\tlong long int i,j,k,len,count=0,flag1=0,flag=0,flag21=0,p,q;\n\tchar s[1000000],letter;\n\tscanf(\"%s\", s);\n\tlen=strlen(s);\n\ti=0;\n\tfor(i=0;i1)\n\t{\n\t\tprintf(\"NA\\n\");\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 \n#include \nint main(){\n char s[12],t[12];\n int i,j,k,l;\n while(scanf(\"%s\",s)!=EOF){\n l=strlen(s);\n k=j=0;\n for(i=0;i\n\nint main(int argc, char const *argv[])\n{\n char str[11], letter;\n scanf(\"%s\", str);\n int diff = 0, pos, len, i, j;\n for (len = 0; str[len] != 0 && len < 11; len++);\n // printf(\"%d\\n\", len);\n for (j = 0, i = len - 1; j < i; j++, i--) {\n if (str[j] != str[i]) {\n // printf(\"wjat?\\n\");\n diff++;\n if (diff == 1) {\n pos = i + 1;\n letter = str[j];\n }\n i++;\n }\n\n }\n if (diff == 0) {\n letter = str[len / 2];\n pos = len / 2;\n }\n // printf(\"%c %d %d\\n\", letter, pos, diff);\n\n if (diff > 1) {\n // printf(\"NA\\n\");\n } else {\n // printf(\"%d\\n\", len);\n for (i = 0, j = 0; i < len + 1; i++){\n if (i == pos) {\n printf(\"%c\", letter);\n } else {\n printf(\"%c\", str[j++]);\n }\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n\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\nint i,j,s,u,u2,sit,sit2,t,t2;\nchar str[10000], ans[10000];\n\nint main()\n{\n scanf(\"%s\", str);\n u = strlen(str);\n if(u == 1)\n printf(\"%s%s\",str, str);\n else {\n FOR(i,0,u/2-1){\n if(str[i] != str[u - 1 - i])\n {\n ROF(j,u,u-i+1){\n str[j] = str[j - 1];\n }\n str[u - i] = str[i];\n sit = 1;\n break;\n }\n }\n strcpy(ans,str);\n u = strlen(ans);\n FOR(i,0,u/2-1)\n {\n if(ans[i] != ans[u - i - 1])\n sit2 = 1;\n }\n if(sit2 == 0 && sit == 1)\n printf(\"%s\", ans);\n else if(sit2 == 0 && sit == 0)\n {\n FOR(j,0,u-1){\n if(j == u / 2 - 1)\n printf(\"%c%c\",ans[j],ans[j + 1]);\n else\n printf(\"%c\", ans[j]);\n }\n }\n else\n printf(\"NA\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\nint main()\n{\n char s[11], backup[11];\n gets(s);\n strcpy(backup,s);\n int len = strlen(s), i = 0, j = 0, chosen = 0;\n for(i = 0; i < len-1; i++)\n {\n for(j = i; j < len-1; j++)\n s[j] = s[j+1];\n s[len-1] = '\\0';\n chosen = i;\n int found = 1, auxlen = strlen(s);\n for(j = 0; j < auxlen/2; j++)\n if(s[j] != s[auxlen-j-1])\n {\n found = 0;\n break;\n }\n strcpy( s,backup);\n if(found == 1)\n {\n for(j = 0; j < len-chosen; j++)\n printf(\"%c\", s[j]);\n printf(\"%c\", s[chosen]);\n for(j = len-chosen; j < len; j++)\n printf(\"%c\", s[j]);\n exit(0);\n }\n }\n printf(\"NA\");\n}"}, {"source_code": "#include\n#include\nint main()\n{\n\tchar s[12];\n\tint n,i,j,k;\n\tscanf(\"%s\",s);\n\tn=strlen(s);\n\ts[n]='\\0';\n/*\tfor(i=0;i=j)\n\t{\n\n\t\tfor(i=n-1;i>=n/2;i--)\n\t\t\ts[i+1]=s[i];\n\t\ts[n/2]=s[n/2+1];\n\t\tn++;\n\t\ts[n]='\\0';\n\t\t//printf(\"%s\\n\",s);\n\t}\n\telse\n\t{\n\t\tfor(k=n-1;k>j;k--)\n\t\t\ts[k+1]=s[k];\n\t\ts[j+1]=s[i];\n\t\tn++;\n\t\ts[n]='\\0';\n\t}\n\ti=0;j=n-1;\n\tfor(;i<=j&&s[i]==s[j];i++,j--);\n\tif(i>j)\n\t\tprintf(\"%s\\n\",s);\n\telse\n\t\tprintf(\"NA\\n\");\n\treturn 0;\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include \n#include \n#include \n\nint isPalindrome(char* str)\n{\n int i = 0, j = strlen(str) - 1;\n while(i pos)\n {\n str[i] = str[i-1];\n i--;\n }\n str[pos] = c;\n}\n\nint bruteforce_solve(char* str)\n{\n int i, j, len = strlen(str);\n char aux[12];\n for (i=0; i < len; i++)\n {\n for (j = 0; j < len; j++)\n {\n strcpy(aux, str);\n addchar(aux, str[i], j);\n if (isPalindrome(aux))\n {\n strcpy(str, aux);\n return 1;\n }\n }\n }\n return 0;\n}\n\nint main()\n{\n char str[12];\n scanf(\"%s\", str);\n if(bruteforce_solve(str))\n printf(\"%s\\n\", str);\n else\n printf(\"NA\\n\");\n return 0;\n}"}, {"source_code": "#include\n#include\nint main() {\n int i,j,k,l,m,n,o,p;\n char s[1000],v,f;\n scanf(\"%s\",s);\n l=strlen(s);\n int a[26]={0};\n for(i=0;i\n#include\n#include\n#include\n\nchar *insere(char ch[10],char c,int x)\n{\n int i,n;\n n=strlen(ch);\n for(i=strlen(ch);i>x;i--)\n ch[i]=ch[i-1];\n ch[n+1]='\\0';\n ch[x]=c;\n\n return(ch);\n}\nint palaindrom(char ch[])\n{\n int i;\n for (i=0;i<(strlen(ch)/2);i++)\n {\n if (ch[i]!=ch[strlen(ch)-1-i])\n return 0;\n }\n return 1;\n}\n\nint main ()\n{\n char ch[11],ch2[11],ch3[11],ch4[11];\n int i;\n scanf(\"%s\",ch);\n strcpy(ch2,ch);\n\n if (palaindrom(ch)==1)\n {\n if ((strlen(ch)%2)==0)\n {printf(\"%s\",insere(ch,'i',(strlen(ch)/2)));\n return 0;\n }\n\n else\n {printf(\"%s\",insere(ch,ch[strlen(ch)/2],(strlen(ch)/2)));\nreturn 0; }\n }\n else\n {\n for (i=0;i<(strlen(ch)/2);i++)\n if (ch[i]!=ch[strlen(ch)-i-1])\n {\n\nstrcpy(ch3,insere(ch,ch[i],strlen(ch)-i));\nstrcpy(ch4,insere(ch2,ch2[strlen(ch2)-1-i],i));\n\n if (palaindrom(ch3)==1)\n {\n printf(\"%s\",ch3);\n return 0;}\n\n\n else if\n ( palaindrom(ch4)==1)\n {\n printf(\"%s\",ch4);\n return 0;\n }\n else printf(\"NA\");\n return 0;\n\n\n }\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \nint main()\n{\n char s[13];\n scanf(\"%s\",s);\n int l,i,k;\n l=strlen(s);\n for(i=0;il-i;k--)\n {\n s[k]=s[k-1];\n }\n s[l-i]=s[i];\n\n break;\n }\n else\n {\n if(i>0 && s[i]!=s[l-i-1] && s[i]==s[l-i-2])\n {\n for(k=l+1;k>i;k--)\n {\n s[k]=s[k-1];\n }\n s[i]=s[l-i];\n\n break;\n }\n }\n }\n if(i\n#include \n\nint main()\n{\n int counter = 0 , no = 0 , index , index1 , flag = 0 , counter1 = 0;\n char str[11];\n scanf(\"%s\",str);\n\n while ( counter < (strlen(str)/2) && flag == 0 && counter1 < strlen(str)/2)\n {\n if (str[counter] != str[strlen(str) - counter1-1])\n {\n\n if (str[counter+1] == str[strlen(str) - counter1-1])\n {\n index = strlen(str) - counter1;\n index1 = counter;\n no++;\n counter++;\n }\n else if (str[counter] == str[strlen(str) - counter1 -2])\n {\n index = counter;\n index1 = strlen(str) - counter1-1;\n no++;\n counter1++;\n }\n else\n {\n flag = 1;\n }\n }\n else\n {\n counter++;\n counter1++;\n }\n }\n counter = 0;\n counter1 = 0;\n if (flag ==0 || no > 1)\n {\n while( counter <= strlen(str) && counter1 <= strlen(str))\n {\n if (no == 0)\n {\n if (counter1 == strlen(str)/2)\n {\n printf(\"%c\",str[counter1]);\n counter1++;\n }\n else\n {\n printf(\"%c\",str[counter]);\n counter++;\n counter1++;\n }\n }\n else\n {\n if (counter1 == index)\n {\n printf(\"%c\",str[index1]);\n counter1++;\n }\n else\n {\n printf(\"%c\",str[counter]);\n counter1++;\n counter++;\n }\n }\n }\n }\n else\n {\n printf(\"NA\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint is_palindrome(char s[],int len)\n{\n int i;\n for(i=0;i=0)\n\n {\n if(len%2==0)\n a[j]=s[len-i];\n else\n a[j]=s[len-1-i];\n }\n else\n a[i]=s[0];\n for(j=j+1;j\n#include \n#include \n\nunsigned short ispal (unsigned char*, unsigned short, unsigned char, unsigned char*);\n\nint main ()\n {\n unsigned char s[12];\n unsigned short ls;\n unsigned short i;\n unsigned short h[26];\n unsigned short oc;\n unsigned short j;\n unsigned short p;\n unsigned short pa;\n unsigned char t[12];\n \n if (scanf(\"%11s\",s) != 1)\n return -1;\n ls = strlen (s);\n if (ls > 10)\n return -1;\n for (i = 0; i < 26; i++)\n h[i] = 0;\n oc = 0;\n for (i = 0; i < ls; i++)\n {\n if (!islower(s[i]))\n return -1;\n j = s[i]-'a';\n h[j]++;\n if (h[j]%2)\n oc++;\n else\n oc--;\n }\n p = ls%2;\n pa = 0;\n if (!p && !oc)\n {\n for (i = 0; i < 26; i++)\n if (h[i] && ispal(s,ls,i+'a',t))\n {\n printf (\"%s\\n\",t);\n pa = 1;\n }\n }\n else if ((!p && oc == 2) || (p && oc == 1))\n {\n for (i = 0; i < 26; i++)\n if (h[i]%2 && ispal(s,ls,i+'a',t))\n {\n printf (\"%s\\n\",t);\n pa = 1;\n }\n }\n if (!pa)\n printf (\"NA\\n\");\n return 0;\n }\n \nunsigned short ispal (s,ls,c,t)\n unsigned char* s;\n unsigned short ls;\n unsigned char c;\n unsigned char* t;\n {\n unsigned short pa;\n unsigned short i;\n unsigned short j;\n unsigned short b;\n unsigned short e;\n \n pa = 0;\n for (i = 0; i <= ls && !pa; i++)\n {\n strcpy (t,s);\n t[ls+1] = '\\0';\n for (j = ls; j > i; j--)\n t[j] = s[j-1];\n t[i] = c;\n b = 0;\n e = ls;\n pa = 1;\n while (b <= e)\n {\n if (t[b] != t[e] && pa)\n pa = 0;\n b++;\n e--;\n }\n }\n return pa;\n }\n"}, {"source_code": "#include \n#include \n#include \n\nint main()\n{\n char s[11],s1[12],s2[12];\n int l,i,j,test1=1,test2=1;\n scanf(\"%s\",&s);\n //printf(\"%s\\n\",s);\n\n l=strlen(s);\n //printf(\"%c\\n\",s[l+2]);\n i=0;\n\n\n s1[0]='\\0';\n while((i<=(l/2))&& test1)\n {\n if(s[i]!=s[l-i-1])\n {\n char *m=malloc((l)*sizeof(char));\n m[0]=s[i];\n memcpy(s1,s,l-i);\n for(j=l-i; j\n#include\n#include\n#include\n\nint main()\n{\n char a[200],t[200],tc,tp;\n int h,i,j,k,l;\n int n,counts;\n\n scanf(\"%s\",a);\n n=strlen(a);\n i=n-1;\n j=0;\n for(h=0;h\n#include\nint main(void) {\n int i,j,num,flag;\n char a, s[12];\n scanf(\"%s\",&s);\n i=0;\n j=strlen(s)-1;\n flag=0;\n while(i\n#include\n\nchar Check(char s[]);\nint main ()\n{\t\n\tchar str[15]={0};\n\tchar a=0,b=0,c=0,p=0,F=0,tmp=0;\n\tchar length=0;\n\tstr[0]=1;\n\tscanf(\"%s\",str+1);\n\tlength=strlen(str);\n\t\n\tfor(p=0;p\n#include \n#include \n\nint isPalindrome(char* str)\n{\n int i = 0, j = strlen(str) - 1;\n while(i pos)\n {\n str[i] = str[i-1];\n i--;\n }\n str[pos] = c;\n}\n\n\nint main()\n{\n int len;\n int i, j;\n char str[12];\n char aux[12];\n scanf(\"%s\", str);\n len = strlen(str);\n \n if (isPalindrome(str) && len%2 == 0)\n {\n addchar(str, 'r', len/2);\n printf(\"%s\\n\", str);\n return 0;\n }\n if (isPalindrome(str))\n {\n printf(\"NA\\n\");\n return 0;\n }\n \n if (len & 1)\n {\n i = len/2;\n j = len/2 + 1;\n }\n else\n {\n i = j = len/2;\n }\n \n while (str[i] == str[j])\n {\n i--;\n j++;\n }\n strcpy(aux, str);\n addchar(str, str[i], j);\n if (isPalindrome(str))\n printf(\"%s\\n\", str);\n else\n {\n addchar(aux, aux[j], i);\n if(isPalindrome(aux))\n printf(\"%s\\n\", aux);\n else\n printf(\"NA\\n\");\n }\n return 0;\n}"}, {"source_code": "#include\n#include\nint tp(char s[],int n)\n{\n\tint i,ans=0;\n\tfor(i=0;ii)\n\t\t\t\ts2[k]=s[k-1];\n\t\t}\n\t\tchar c;\n\t\tfor(j='a';j<='z';j++)\n\t\t{\n\t\t\tc=j;\n\t\t\ts2[i]=c;\n\t\t\tint ans;\n\t\t\tans=tp(s2,l+1);\n\t\t\tif(ans==0)\n\t\t\t{\tstate=0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\n\t\tif(state==0)\n\t\t\tbreak;\n\t}\n\tif(state==0)\n\t\tprintf(\"%s\\n\",s2);\n\telse\n\t\tprintf(\"NA\\n\");\n\treturn 0;\n}\n\n\n\t\t\t\n"}, {"source_code": "#include\n#include\nint is_pallindrome(char a[10000],int l)\n{int i,j;\n for(i=0,j=l-1;i=0;--i,++j)\n {if(a[i]==a[j])\n continue;\n else\n {flag1=i;flag2=j;\n if(a[i-1]==a[j])\n { for(k=l-1;k>=j;--k)\n c[k+1]=c[k];\n c[j]=c[i];\n if(is_pallindrome(c,l+1))\n {\n printf(\"\\n%s\\n\",c);\n break;\n }\n else\n try =0;\n \n }\n if(a[i]==a[j+1])\n { for(k=l-1;k>=i;--k)\n b[k+1]=b[k];\n b[i-1]=b[j+1];\n\n if(is_pallindrome(b,l+1))\n { \n printf(\"\\n%s\\n\",b);\n break;\n } \n else\n {printf(\"\\nNA\\n\");\n break;}\n }//check shifting till i\n\n }\n\n\n }\n\n \n if(flag1==-1)\n {\n if(l%2==0)\n {printf(\"\\n\");\n {\n for(i=0;i\n#include \n#include \n\nint main()\n{\n char s[11];\n int l,i,j,test=1;\n scanf(\"%s\",&s);\n l=strlen(s);\n i=0;\n char *s1=malloc((l)*sizeof(char));\n while((i<=(l/2))&& test)\n {\n if(s[i]!=s[l-i-1])\n {\n char *m=malloc((i+1)*sizeof(char));\n m[0]=s[i];\n memcpy(s1,s,l-i);\n for(j=l-i; j\n#include\n#include\n#include\n#include\nint compare (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\nint main()\n{\n int n,i,s,e,flag,len;\n char str[100];\n scanf(\"%s\",str);\n len=strlen(str);\n s=0;\n e=len-1;\n flag=1;\n while(s=e+1;i--)\n {\n str[i+1]==str[i];\n }\n str[len+1]='\\0';\n str[e+1]=str[s];\n flag=1;\n s=0;\n e=len;\n while(s\n#include \n#include \n\nint main()\n{\n char s[11],s1[12],s2[12];\n int l,i,j,test1=1,test2=1;\n scanf(\"%s\",&s);\n //printf(\"%s\\n\",s);\n\n l=strlen(s);\n //printf(\"%c\\n\",s[l+2]);\n i=0;\n\n\n s1[0]='\\0';\n while((i<=(l/2))&& test1)\n {\n if(s[i]!=s[l-i-1])\n {\n char *m=malloc((l)*sizeof(char));\n m[0]=s[i];\n memcpy(s1,s,l-i);\n for(j=l-i; j\n#include \n\nint main()\n{\n int counter = 0 , no = 0 , index , index1 , flag = 0 , counter1 = 0;\n char str[11];\n scanf(\"%s\",str);\n\n while ( counter < (strlen(str)/2) && flag == 0 && counter1 < strlen(str)/2)\n {\n if (str[counter] != str[strlen(str) - counter1-1])\n {\n\n if (str[counter+1] == str[strlen(str) - counter1-1])\n {\n index = strlen(str) - counter1;\n index1 = counter;\n no++;\n counter++;\n }\n else if (str[counter] == str[strlen(str) - counter1 -2])\n {\n index = counter;\n index1 = strlen(str) - counter1-1;\n no++;\n counter1++;\n }\n else\n {\n flag = 1;\n }\n }\n else\n {\n counter++;\n counter1++;\n }\n }\n counter = 0;\n counter1 = 0;\n if (flag ==0 || no > 1)\n {\n while( counter <= strlen(str) && counter1 <= strlen(str))\n {\n if (no == 0)\n {\n if (counter1 == strlen(str)/2)\n {\n printf(\"%c\",str[counter1]);\n counter1++;\n }\n else\n {\n printf(\"%c\",str[counter]);\n counter++;\n counter1++;\n }\n }\n else\n {\n if (counter1 == index)\n {\n printf(\"%c\",str[index1]);\n counter1++;\n }\n else\n {\n printf(\"%c\",str[counter]);\n counter1++;\n counter++;\n }\n }\n }\n }\n else\n {\n printf(\"NA\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\nint main()\n{\n char s[11];\n int l,i,j,test1=1,test2=1;\n scanf(\"%s\",&s);\n //printf(\"%s\\n\",s);\n\n l=strlen(s);\n //printf(\"%c\\n\",s[l+2]);\n i=0;\n char *s1=malloc((l+2)*sizeof(char));\n char *s2=malloc((l+2)*sizeof(char));\n\n while((i<=(l/2))&& test1)\n {\n if(s[i]!=s[l-i-1])\n {\n char *m=malloc((l)*sizeof(char));\n m[0]=s[i];\n memcpy(s1,s,l-i);\n for(j=l-i; j\n#include \n#include \n#define MAX_SIZE 10\n\ntypedef unsigned char boolean;\n\nchar *createPalindromo(const char *str);\nvoid fill(const char *origen, char *dest, unsigned int ban);\nboolean isPalindromo(char *str);\nint main()\n{\n char palindromo[MAX_SIZE];\n scanf(\"%s\",palindromo);\n char *result = createPalindromo(palindromo);\n printf(\"%s\\n\", result);\n \n return 0;\n}\n\nchar *createPalindromo(const char *str)\n{\n int len = strlen(str);\n int possiblePositions = len+1;\n int i;\n char *Palindromo = (char *) malloc(sizeof(char) * possiblePositions + 1);\n for(i = 0; i < possiblePositions ; i++)\n {\n fill(str,Palindromo,i);\n if(isPalindromo(Palindromo))\n return Palindromo;\n }\n return \"NA\"; \n}\n\nvoid fill(const char *origen, char *dest, unsigned int ban)\n{\n int i;\n int j;\n int len = strlen(origen)+1;\n\n for( i = j = 0; origen[j] != '\\0'; i++)\n if(i != ban)\n dest[i] = origen[j++];\n\n dest[ban] = dest[len - 1 - ban];\n printf(\"%s \\n\",dest);\n }\n\nboolean isPalindromo(char *str)\n{\n int i;\n int j= strlen(str) - 1;\n\n for( i = 0; str[i] != '\\0'; i++)\n {\n if(str[i] != str[j--])\n return 0;\n }\n return 1;\n}\n"}, {"source_code": "#include\n#include\n\nint is_pall(char* s,int len)\n{\n\tint i;\n\tfor(i=0;i\nint main()\n{\n int i=0;\n char s[10];\n char c;\n while((c=getchar()) != '\\n')\n {\n s[i]=c;\n i++;\n }\n // printf(\"%s\\n\",s);\n int m;\n // printf(\"i is:%d\\n\",i);\n int j,k=i-1,counter=0,flag=0,breakingj,breakingk;\n for(j=0;j<=(i/2)-1;j++)\n {\n a: if(s[j] == s[k])\n\t{\n\t // printf(\"if loop %c %c %d %d\\n\",s[j],s[k],j,k);\n\t counter++;\n\t // printf(\"counter is:%d\\n\",counter);\n\t k--;\n\t continue;\n\t}\n else\n\t{\n\t // printf(\"else loop %c %c %d %d\\n\",s[j],s[k],j,k);\n\t if(flag==0)\n\t {\n\t breakingj=j;\n\t breakingk=k;\n\t }\n\t flag++;\n\t break;\n\t}\n }\n if((counter <= (i/2)-1) && flag ==1)\n {\n // printf(\"came to first loop\\n\");\n k--;\n goto a;\n }\n else if((counter < (i/2)-1) && flag == 2)\n {\n // printf(\"came to second loop\\n\");\n k=breakingk;\n j=breakingj+1;\n goto a;\n }\n else if(counter == (i/2) && flag == 1)\n {\n // printf(\"came to third loop\\n\");\n for(j=0;j2)\n {\n printf(\"NA\\n\");\n return 0;\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \nint main()\n{\n char s[13];\n scanf(\"%s\",s);\n int l,i,k;\n l=strlen(s);\n for(i=0;ii;k--)\n {\n s[k]=s[k-1];\n }\n s[i]=s[l-i];\n\n break;\n }\n else\n {\n if(s[i]!=s[l-i-1] && s[i+1]==s[l-i-1])\n {\n for(k=l+1;k>l-i;k--)\n {\n s[k]=s[k-1];\n }\n s[l-i]=s[i];\n\n break;\n }\n }\n }\n \n if(i\n\nint isPalindrome(char *s, int n)\n{\n\tfor(int i = 0; i < n; i++)\n\t{\n\t\tif(s[i] != s[n-1-i])\treturn 0;\n\t}\n\t\n\treturn 1;\n}\n\nint main()\n{\n\tchar s[11];\n\tscanf(\" %s\", s);\n\t\n\tint l = 0;\n\tchar ans[12];\n\t\n\tfor(int i = 0; s[i] != '\\0'; i++)\tl++;\n\t\n\tint position = 0;\n\tchar letter;\n\t\n\tfor(int position = 0; position < l; position++) \n\t{\n\t\tletter = s[position];\n\t\tint k = 0;\n\t\tfor(int i = 0; i < l-position; i++)\tans[k++] = s[i];\n\t\tans[k++] = letter;\n\t\tfor(int i = l-position; i < l; i++)\tans[k++] = s[i];\t\n\t\tans[k] = '\\0';\n\t\n\t\tif(isPalindrome(ans, l+1))\n\t\t{\n\t\t\tprintf(\"%s\\n\", ans);\n\t\t\treturn 0;\n\t\t}\n\t}\n\t\n\tprintf(\"NA\\n\");\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n#include \n\nint main()\n{\n char s[11];\n int l,i,j,test=1;\n scanf(\"%s\",&s);\n l=strlen(s);\n i=0;\n char *s1=malloc((l)*sizeof(char));\n while((i<=(l/2))&& test)\n {\n if(s[i]!=s[l-i-1])\n {\n char *m=malloc((i+1)*sizeof(char));\n m[0]=s[i];\n memcpy(s1,s,l-i);\n for(j=l-i; j\n#include \n#include \n#define MAX_SIZE 10\n\ntypedef unsigned char boolean;\n\nchar *createPalindromo(const char *str);\nvoid fill(const char *origen, char *dest, unsigned int ban);\nboolean isPalindromo(char *str);\nint main()\n{\n char palindromo[MAX_SIZE];\n scanf(\"%s\",palindromo);\n char *result = createPalindromo(palindromo);\n printf(\"%s\\n\", result);\n \n return 0;\n}\n\nchar *createPalindromo(const char *str)\n{\n int len = strlen(str);\n int possiblePositions = len+1;\n int i;\n char *Palindromo = (char *) malloc(sizeof(char) * possiblePositions + 1);\n for(i = 0; i < possiblePositions ; i++)\n {\n fill(str,Palindromo,i);\n if(isPalindromo(Palindromo))\n return Palindromo;\n }\n return str;\n \n}\n\nvoid fill(const char *origen, char *dest, unsigned int ban)\n{\n int i;\n int j;\n int len = strlen(origen)+1;\n\n for( i = j = 0; origen[j] != '\\0'; i++)\n if(i != ban)\n dest[i] = origen[j++];\n\n dest[ban] = dest[len - 1 - ban];\n }\n\nboolean isPalindromo(char *str)\n{\n int i;\n int j= strlen(str) - 1;\n\n for( i = 0; str[i] != '\\0'; i++)\n {\n if(str[i] != str[j--])\n return 0;\n }\n return 1;\n}\n"}, {"source_code": "#include\nint main()\n{\n int i=0;\n char s[10];\n char c;\n while((c=getchar()) != '\\n')\n {\n s[i]=c;\n i++;\n }\n //printf(\"%s\\n\",s);\n int m;\n printf(\"i is:%d\\n\",i);\n int j,k=i-1,counter=0,flag=0,breakingj,breakingk;\n for(j=0;j<=(i/2)-1;j++)\n {\n a: if(s[j] == s[k])\n\t{\n\t // printf(\"if loop %c %c %d %d\\n\",s[j],s[k],j,k);\n\t counter++;\n\t // printf(\"counter is:%d\\n\",counter);\n\t k--;\n\t continue;\n\t}\n else\n\t{\n\t // printf(\"else loop %c %c %d %d\\n\",s[j],s[k],j,k);\n\t if(flag==0)\n\t {\n\t breakingj=j;\n\t breakingk=k;\n\t }\n\t flag++;\n\t break;\n\t}\n }\n if((counter <= (i/2)-1) && flag ==1)\n {\n //printf(\"came to first loop\\n\");\n k--;\n goto a;\n }\n else if((counter < (i/2)-1) && flag == 2)\n {\n //printf(\"came to second loop\\n\");\n k=breakingk;\n j=breakingj+1;\n goto a;\n }\n else if(counter == (i/2) && flag == 1)\n {\n // printf(\"came to third loop\\n\");\n for(j=0;j= 2)\n {\n printf(\"NA\\n\");\n return 0;\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n\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\nint i,j,s,u,u2,sit,sit2,t,t2;\nchar str[10000], ans[10000];\n\nint main()\n{\n scanf(\"%s\", str);\n u = strlen(str);\n FOR(i,0,u/2-1){\n if(str[i] != str[u - 1 - i])\n {\n ROF(j,u,u-i+1){\n str[j] = str[j - 1];\n }\n str[u - i] = str[i];\n sit = 1;\n break;\n }\n }\n strcpy(ans,str);\n u = strlen(ans);\n FOR(i,0,u/2-1)\n {\n if(ans[i] != ans[u - i - 1])\n sit2 = 1;\n }\n if(sit2 == 0 && sit == 1)\n printf(\"%s\", ans);\n else if(sit2 == 0 && sit == 0)\n {\n FOR(j,0,u-1){\n if(j == u / 2 - 1)\n printf(\"%c%c\",ans[j],ans[j + 1]);\n else\n printf(\"%c\", ans[j]);\n }\n }\n else\n printf(\"NA\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n\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\nint i,j,s,u,u2,sit,sit2,t,t2;\nchar str[10000], ans[10000];\n\nint main()\n{\n scanf(\"%s\", str);\n u = strlen(str);\n FOR(i,0,u/2-1){\n if(str[i] != str[u - 1 - i])\n {\n ROF(j,u,u-i+1){\n str[j] = str[j - 1];\n }\n str[u - i] = str[i];\n sit = 1;\n break;\n }\n }\n strcpy(ans,str);\n u = strlen(ans);\n FOR(i,0,u/2-1)\n {\n if(ans[i] != ans[u - i - 1])\n sit2 = 1;\n }\n if(sit2 == 0 && sit == 1)\n printf(\"%s\", ans);\n else if(sit2 == 0 && sit == 0)\n {\n FOR(j,0,u-1){\n if(j == u / 2 - 1)\n printf(\"%c%c\",ans[j],ans[j + 1]);\n else\n printf(\"%c\", ans[j]);\n }\n }\n else\n printf(\"NA\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint is_pallindrome(char a[10000],int l)\n{int i,j;\n for(i=0,j=l-1;i=0;--i,++j)\n {if(a[i]==a[j])\n continue;\n else\n {flag1=i;flag2=j;\n if(a[i-1]==a[j])\n { for(k=l-1;k>=j;--k)\n c[k+1]=c[k];\n c[j]=c[i];\n if(is_pallindrome(c,l+1))\n {\n printf(\"\\n%s\",c);\n return 0;\n }\n else\n try =0;\n\n }\n if(a[i]==a[j+1])\n { for(k=l-1;k>=i;--k)\n b[k+1]=b[k];\n b[i-1]=b[j+1];\n\n if(is_pallindrome(b,l+1))\n { \n printf(\"\\n%s\",b);\n return 0;\n } \n else\n {printf(\"\\nNA\");\n return 0;}\n }//check shifting till i\n\n }\n\n\n }\n\n\n if(flag1==-1)\n {\n if(l%2==0)\n {printf(\"\\n\");\n {\n for(i=0;i\n#include \n\nint main()\n{\n int counter = 0 , no = 0 , index , index1 , flag = 0 , counter1 = 0;\n char str[11];\n scanf(\"%s\",str);\n\n if (strlen(str) % 2 != 0)\n {\n printf(\"NA\");\n }\n else\n {\n while ( counter < (strlen(str)/2) && flag == 0 && counter1 < strlen(str)/2)\n {\n if (str[counter] != str[strlen(str) - counter1-1])\n {\n if (str[counter] == str[strlen(str) - counter1 -2])\n {\n index = counter;\n index1 = strlen(str) - counter1-1;\n no++;\n counter1++;\n }\n else if (str[counter+1] == str[strlen(str) - counter1-1])\n {\n index = strlen(str) - counter1;\n index1 = counter;\n no++;\n counter++;\n }\n else\n {\n flag = 1;\n }\n }\n else\n {\n counter++;\n counter1++;\n }\n }\n counter = 0;\n counter1 = 0;\n if (flag ==0 || no > 1)\n {\n while( counter <= strlen(str) && counter1 <= strlen(str))\n {\n if (no == 0)\n {\n if (counter1 == strlen(str)/2)\n {\n printf(\"a\");\n counter1++;\n }\n else\n {\n printf(\"%c\",str[counter]);\n counter++;\n counter1++;\n }\n }\n else\n {\n if (counter1 == index)\n {\n printf(\"%c\",str[index1]);\n counter1++;\n }\n else\n {\n printf(\"%c\",str[counter]);\n counter1++;\n counter++;\n }\n }\n }\n }\n else\n {\n printf(\"NA\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n\nint main()\n{\n char a[200],t[200],tc,tp;\n int h,i,j,k,l;\n int n,counts;\n\n scanf(\"%s\",a);\n n=strlen(a);\n i=n-1;\n j=0;\n for(h=0;h\n#include \n#include \nint main()\n{\n char s[13];\n scanf(\"%s\",s);\n int l,i,k;\n l=strlen(s);\n for(i=0;ii;k--)\n {\n s[k]=s[k-1];\n }\n s[i]=s[l-i];\n break;\n }\n else\n {\n if(s[i]!=s[l-i-1] && s[i+1]==s[l-i-1])\n {\n for(k=l+1;k>l-i;k--)\n {\n s[k]=s[k-1];\n }\n s[l-i]=s[i];\n\n break;\n }\n }\n }\n\n if(i\n#include\n#include\n#include\n\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\nint i,j,k,s,u,t=1,sit;\nchar str[10000], ans[10000];\n\nint main()\n{\n scanf(\"%s\", str);\n u = strlen(str);\n FOR(i,0,u-1){\n if(str[i] != str[u - i - 1])\n {\n t = i;\n break;\n }\n }\n if(t != 0){\n if(t == 1){\n FOR(i,0,u-1){\n if(i == u/2)\n printf(\"%c%c\", str[i], str[i]);\n else\n printf(\"%c\", str[i]);\n }\n return 0;\n }\n ROF(i,u,u-t+1){\n str[i] = str[i - 1];\n }\n str[u - t] = str[t];\n FOR(i,0,u){\n if(str[i] != str[u - i])\n {\n printf(\"NA\");\n return 0;\n }\n }\n printf(\"%s\", str);\n }\n if(t == 0){\n strcpy(ans, str);\n ROF(i,u,1){\n ans[i] = ans[i - 1];\n }\n ans[0] = ans[u];\n FOR(i,0,u){\n if(ans[i] != ans[u - i])\n sit = 1;\n }\n if(!sit){\n printf(\"%s\", ans);\n return 0;\n }\n ROF(i,u,u-t+1){\n str[i] = str[i - 1];\n }\n str[u - t] = str[t];\n FOR(i,0,u){\n if(str[i] != str[u - i])\n {\n printf(\"NA\");\n return 0;\n }\n }\n printf(\"%s\", str);\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main(){\n char s[100], s1[100];\n int i, len, yes, len1, j;\n while(scanf(\"%s\",s) != EOF){\n yes = 0;\n len = strlen(s);\n for(i = 0; i < len/2; i ++){\n if(s[i] != s[len - i - 1]) break;\n }\n for(j = 0; j < i; j ++){\n s1[j] = s[j];\n }\n s1[i] = s[len - i - 1];\n for(j = i + 1; j <= len ; j ++){\n s1[j] = s[j - 1];\n }\n s1[len + 1] = 0;\n len1 = strlen(s1);\n for(j = 0; j < len1/2; j ++){\n if(s[j] != s[len1 - j - 1]) break;\n }\n if(j == len1/2){\n puts(s1);\n yes = 1;\n }\n if(!yes){\n for(j = 0; j <= len - i - 1; j ++){\n s1[j] = s[j];\n }\n s1[len - i] = s[i];\n for(j = len - i + 1; j <= len; j ++){\n s1[j] = s[j - 1];\n }\n s1[len + 1] = 0;\n len1 = strlen(s1);\n for(j = 0; j < len1/2; j ++){\n if(s1[j] != s1[len1 - j - 1]){\n break;\n }\n }\n if(j == len1/2) {\n puts(s1);\n yes = 1;\n }\n }\n if(!yes) printf(\"NA\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \nchar s[11],s1[12],s2[12],m[12],m1[12];\nint main()\n{\n\n int l,i,j,test1=1,test2=1;\n scanf(\"%s\",&s);\n //printf(\"%s\\n\",s);\n\n l=strlen(s);\n //printf(\"%c\\n\",s[l+2]);\n i=0;\n\n\n s1[0]='\\0';\n while((i<=(l/2))&& test1)\n {\n if(s[i]!=s[l-i-1])\n {\n //char *m=malloc((l)*sizeof(char));\n m[0]=s[i];\n memcpy(s1,s,l-i);\n //printf(\"%s||\",s1);\n for(j=l-i; j\n#include \n\nint main()\n{\n int counter = 0 , no = 0 , index , index1 , flag = 0 , counter1 = 0;\n char str[11];\n scanf(\"%s\",str);\n\n if (strlen(str) % 2 != 0)\n {\n printf(\"NA\");\n }\n else\n {\n while ( counter < (strlen(str)/2) && flag == 0 && counter1 < strlen(str)/2)\n {\n if (str[counter] != str[strlen(str) - counter1-1])\n {\n if (str[counter] == str[strlen(str) - counter1 -2])\n {\n index = counter;\n index1 = strlen(str) - counter1-1;\n no++;\n counter1++;\n }\n else if (str[counter+1] == str[strlen(str) - counter1-1])\n {\n index = strlen(str) - counter1;\n index1 = counter;\n no++;\n counter++;\n }\n else\n {\n flag = 1;\n }\n }\n else\n {\n counter++;\n counter1++;\n }\n }\n counter = 0;\n counter1 = 0;\n if (flag ==0 || no > 1)\n {\n while( counter <= strlen(str) && counter1 <= strlen(str))\n {\n if (no == 0)\n {\n if (counter1 == strlen(str)/2)\n {\n printf(\"a\");\n counter1++;\n }\n else\n {\n printf(\"%c\",str[counter]);\n counter++;\n counter1++;\n }\n }\n else\n {\n if (counter1 == index)\n {\n printf(\"%c\",str[index1]);\n counter1++;\n }\n else\n {\n printf(\"%c\",str[counter]);\n counter1++;\n counter++;\n }\n }\n }\n }\n else\n {\n printf(\"NA\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint is_pallindrome(char a[10000],int l)\n{int i,j;\n for(i=0,j=l-1;i=0;--i,++j)\n {if(a[i]==a[j])\n continue;\n else\n {flag1=i;flag2=j;\n if(a[i-1]==a[j])\n { for(k=l-1;k>=j;--k)\n c[k+1]=c[k];\n c[j]=c[i];\n if(is_pallindrome(c,l+1))\n {\n printf(\"\\n%s\\n\",c);\n return 0;\n }\n else\n try =0;\n\n }\n if(a[i]==a[j+1])\n { for(k=l-1;k>=i;--k)\n b[k+1]=b[k];\n b[i-1]=b[j+1];\n\n if(is_pallindrome(b,l+1))\n { \n printf(\"\\n%s\\n\",b);\n return 0;\n } \n else\n {printf(\"\\nNA\\n\");\n return 0;}\n }//check shifting till i\n\n }\n\n\n }\n\n\n if(flag1==-1)\n {\n if(l%2==0)\n {printf(\"\\n\");\n {\n for(i=0;i\n#include\n#include\n#include\n\nint main()\n{\n char a[200],t[200],tc,tp;\n int h,i,j,k,l;\n int n,counts;\n\n while(~scanf(\"%s\",a))\n {\n n=strlen(a);\n i=n-1;\n j=0;\n for(h=0;h\n#include \nint main(){\n\tchar a[15];\n\tscanf(\"%s\",&a);\n\tint n=strlen(a)-1;\n\tint f=0,flag,fzy=0;\n\tchar b;\n\tif(n==1){\n\t\tprintf(\"%c%c%c\",a[0],a[1],a[0]);\n\t\treturn 0;\n\t}\n\telse if(strlen(a)%2!=0){\n\t\tint y=0;\n\tfor(int i=0;istrlen(a))\n\t\tbreak;\n\t\tif(a[i]!=a[n-y]){\n\t\t\tf++;\n\t\t\tif(a[i]==a[n-y-1]){\n\t b=a[n-y];\n\t\t\tflag=i;\t\n\t\t\ti--;\n\t\t\t\n\t\t\tprintf(\"%\");\n\t\t\t}\n\t\t\telse if(a[i+1]==a[n-y]){\n\t\t\t\tb=a[i];\n\t\t\t\tflag=n-y;\n\t\t\t\ti++;\n\t\t\t\t\n\t\t\t\tfzy=1;\n\t\t\t}\n\t\t}\n\t\ty++;\n\t}\n}\n\telse if(strlen(a)%2==0){\n\t\tint y=0;\n\tfor(int i=0;i=strlen(a))\n\t\t break;\n\t\t\tif(a[i]!=a[n-y]){\n\t\t\t\tf++;\n\t\t\tif(a[i]==a[n-y-1]){\n\t\t\tb=a[n-y];\n\t\t\tflag=i;\t\n\t\t\ti--;\n\t\t\t\n\t\t\t}\n\t\t\telse if(a[i+1]==a[n-y]){\n\t\t\t\tb=a[i];\n\t\t\t\tflag=n-y;\n\t\t\t\ti++;\n\t\t\t\tfzy=1;\n\t\t\t}\n\t\t}\n\t\ty++;\n\t}\n\t\t\n}\nif(f==1){\n\tif(strlen(a)==3){\n\t\tif(a[0]!=a[1]&&a[1]!=a[2]){\n\t\t\tprintf(\"NA\");\n\t\t\treturn 0;\n\t\t}\n\t}\nfor(int i=0;i\n#include\nint fun(char a[],int n)\n{\n int i,j,k;\n for(i=0;i=0;i--)\n {\n if(a[i]!=a[t+(t-i)])\n break;\n } \n if(i==0)\n {\n printf(\"%s%c\\n\",a,a[0]);\n continue;\n }\n pos=i;\n i--;\n for(j=i;j>=0;j--)\n {\n if(a[j]!=a[t+(t-j-1)])\n break;\n }\n if(j==-1)\n {\n for(k=0;k\n#include\nint is_pallindrome(char a[10000],int l)\n{int i,j;\n for(i=0,j=l-1;i=0;--i,++j)\n {if(a[i]==a[j])\n continue;\n else\n {flag1=i;flag2=j;\n if(a[i-1]==a[j])\n { for(k=l-1;k>=j;--k)\n c[k+1]=c[k];\n c[j]=c[i];\n if(is_pallindrome(c,l+1))\n {\n printf(\"\\n%s\",c);\n break;\n }\n else\n try =0;\n \n }\n if(a[i]==a[j+1])\n { for(k=l-1;k>=i;--k)\n b[k+1]=b[k];\n b[i-1]=b[j+1];\n\n if(is_pallindrome(b,l+1))\n { \n printf(\"\\n%s\",b);\n break;\n } \n else\n {printf(\"\\nNA\");\n break;}\n }//check shifting till i\n\n }\n\n\n }\n\n\n if(flag1==-1)\n {\n if(l%2==0)\n {{for(i=0;i\n#include\n#include\n#include\n\nint main()\n{\n char a[200],t[200],tc,tp;\n int h,i,j,k,l;\n int n,counts;\n\n while(~scanf(\"%s\",a))\n {\n n=strlen(a);\n i=n-1;\n j=0;\n for(h=0;h\n#include\n#include\n#include\n\nint main()\n{\n char a[200],t[200],tc,tp;\n int h,i,j,k,l;\n int n,counts,biaoji;\n\n while(~scanf(\"%s\",a))\n {\n n=strlen(a);\n i=n-1;\n j=0;\n for(h=0;h\n#include \n\nint main()\n{\n int counter = 0 , no = 0 , index , index1 , flag = 0 , counter1 = 0;\n char str[11];\n scanf(\"%s\",str);\n\n if (strlen(str) % 2 != 0)\n {\n printf(\"NA\");\n }\n else\n {\n while ( counter < (strlen(str)/2) && flag == 0 && counter1 < strlen(str)/2)\n {\n if (str[counter] != str[strlen(str) - counter1-1])\n {\n if (str[counter] == str[strlen(str) - counter1 -2])\n {\n index = counter;\n index1 = strlen(str) - counter1-1;\n no++;\n counter1++;\n }\n else if (str[counter+1] == str[strlen(str) - counter1-1])\n {\n index = strlen(str) - counter1;\n index1 = counter;\n no++;\n counter++;\n }\n else\n {\n flag = 1;\n }\n }\n else\n {\n counter++;\n counter1++;\n }\n }\n counter = 0;\n counter1 = 0;\n if (flag ==0 || no > 1)\n {\n while( counter <= strlen(str) && counter1 <= strlen(str))\n {\n if (no == 0)\n {\n if (counter1 == strlen(str)/2)\n {\n printf(\"a\");\n counter1++;\n }\n else\n {\n printf(\"%c\",str[counter]);\n counter++;\n counter1++;\n }\n }\n else\n {\n if (counter1 == index)\n {\n printf(\"%c\",str[index1]);\n counter1++;\n }\n else\n {\n printf(\"%c\",str[counter]);\n counter1++;\n counter++;\n }\n }\n }\n }\n else\n {\n printf(\"NA\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\nint main()\n{\n char s[11];\n int l,i,j,test1=1,test2=1;\n scanf(\"%s\",&s);\n l=strlen(s);\n i=0;\n char *s1=malloc((l+2)*sizeof(char));\n char *s2=malloc((l+2)*sizeof(char));\n while((i<=(l/2))&& test1)\n {\n if(s[i]!=s[l-i-1])\n {\n char *m=malloc((i+1)*sizeof(char));\n m[0]=s[i];\n memcpy(s1,s,l-i);\n for(j=l-i; j\n#include\n#include\n#include\n\nint main()\n{\n char a[200],t[200],tc,tp;\n int h,i,j,k,l;\n int n,counts;\n\n while(~scanf(\"%s\",a))\n {\n n=strlen(a);\n i=n-1;\n j=0;\n for(h=0;h\n#include \n#include \nint main()\n{\n char s[13];\n scanf(\"%s\",s);\n int l,i,k;\n l=strlen(s);\n for(i=0;il-i;k--)\n {\n s[k]=s[k-1];\n }\n s[l-i]=s[i];\n\n break;\n }\n else\n {\n if( s[i]!=s[l-i-1] && s[i]==s[l-i-2])\n {\n for(k=l+1;k>i;k--)\n {\n s[k]=s[k-1];\n }\n s[i]=s[l-i];\n\n break;\n }\n }\n }\n if(i\n#include \n#include \nint main()\n{\n char s[13];\n scanf(\"%s\",s);\n int l,i,k;\n l=strlen(s);\n for(i=0;il-i;k--)\n {\n s[k]=s[k-1];\n }\n s[l-i]=s[i];\n\n break;\n }\n else\n {\n if( s[i]!=s[l-i-1] && s[i]==s[l-i-2])\n {\n for(k=l+1;k>i;k--)\n {\n s[k]=s[k-1];\n }\n s[i]=s[l-i];\n\n break;\n }\n }\n }\n if(i\n#include \nint main(){\n char s[12],t[12];\n int i,j,k,l;\n while(scanf(\"%s\",s)!=EOF){\n l=strlen(s);\n k=j=0;\n for(i=0;i\n#include\n#include\n#include\n\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 MAX 100000\n\nint N;\nint i,j,s,u,u2,sit,sit2,t;\nchar str[10000], ans[10000];\n\nint main()\n{\n scanf(\"%s\", str);\n u = strlen(str);\n FOR(i,0,u/2-1){\n if(str[i] != str[u - 1 - i])\n {\n FOR(j,u-i-1,u+1){\n if(j != u-1-i)\n t = str[j+1];\n if(j == u-1-i)\n str[j + 1] = str[i];\n else\n str[j + 1] = t;\n }\n sit = 1;\n break;\n }\n }\n strcpy(ans,str);\n u = strlen(ans);\n FOR(i,0,u/2-1)\n {\n if(ans[i] != ans[u - i - 1])\n sit2 = 1;\n }\n if(sit2 == 0 && sit == 1)\n printf(\"%s\", ans);\n else if(sit2 == 0 && sit == 0)\n {\n FOR(j,0,u-1){\n if(j == u / 2 - 1)\n printf(\"%c%c\",ans[j],ans[j + 1]);\n else\n printf(\"%c\", ans[j]);\n }\n }\n else\n printf(\"NA\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int i=0;\n char s[10];\n char c;\n while((c=getchar()) != '\\n')\n {\n s[i]=c;\n i++;\n }\n // printf(\"%s\\n\",s);\n int m;\n // printf(\"i is:%d\\n\",i);\n int j,k=i-1,counter=0,flag=0,breakingj,breakingk;\n for(j=0;j<=(i/2)-1;j++)\n {\n a: if(s[j] == s[k])\n\t{\n\t // printf(\"if loop %c %c %d %d\\n\",s[j],s[k],j,k);\n\t counter++;\n\t // printf(\"counter is:%d\\n\",counter);\n\t k--;\n\t continue;\n\t}\n else\n\t{\n\t // printf(\"else loop %c %c %d %d\\n\",s[j],s[k],j,k);\n\t if(flag==0)\n\t {\n\t breakingj=j;\n\t breakingk=k;\n\t }\n\t flag++;\n\t break;\n\t}\n }\n if((counter <= (i/2)-1) && flag ==1)\n {\n // printf(\"came to first loop\\n\");\n k--;\n goto a;\n }\n else if((counter < (i/2)-1) && flag == 2)\n {\n // printf(\"came to second loop\\n\");\n k=breakingk;\n j=breakingj+1;\n goto a;\n }\n else if(counter == (i/2) && flag == 1)\n {\n // printf(\"came to third loop\\n\");\n for(j=0;j2)\n {\n printf(\"NA\\n\");\n return 0;\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n\nchar *insere(char ch[10],char c,int x)\n{\n int i,n;\n n=strlen(ch);\n for(i=strlen(ch);i>x;i--)\n ch[i]=ch[i-1];\n ch[n+1]='\\0';\n ch[x]=c;\n\n return(ch);\n}\nint palaindrom(char ch[])\n{\n int i;\n for (i=0;i<(strlen(ch)/2);i++)\n {\n if (ch[i]!=ch[strlen(ch)-1-i])\n return 0;\n }\n return 1;\n}\n\nint main ()\n{\n char ch[11],ch2[11],ch3[11],ch4[11];\n int i;\n scanf(\"%s\",ch);\n strcpy(ch2,ch);\n\n if (palaindrom(ch)==1)\n {\n if ((strlen(ch)%2)==0)\n {printf(\"%s\",insere(ch,'i',(strlen(ch)/2)));\n return 0;\n }\n\n else\n {printf(\"%s\",insere(ch,ch[strlen(ch)/2],(strlen(ch)/2)));\nreturn 0; }\n }\n else\n {\n for (i=0;i<(strlen(ch)/2);i++)\n if (ch[i]!=ch[strlen(ch)-i-1])\n {\n\nstrcpy(ch3,insere(ch,ch[i],strlen(ch)-i));\nstrcpy(ch4,insere(ch2,ch2[strlen(ch2)-1-i],i));\n\n if (palaindrom(ch3)==1)\n {\n printf(\"%s\",ch3);\n return 0;}\n\n\n else if\n ( palaindrom(ch4)==1)\n {\n printf(\"%s\",ch4);\n return 0;\n }\n else printf(\"NA\");\n return 0;\n\n\n }\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n\nint main()\n{\n char a[200],t[200],tc,tp;\n int h,i,j,k,l;\n int n,counts;\n\n while(~scanf(\"%s\",a))\n {\n n=strlen(a);\n i=n-1;\n j=0;\n for(h=0;h\n#include\nint main()\n{\n\tint n,flag=1,i,j;\n\tchar a[50];\n\tscanf(\"%s\",a);\n\tn=strlen(a);\n\tfor(i=0;i=i;j--)\n\t\t\t\t\ta[j+1]=a[j];\n\t\t\t\ta[i]=a[n-i];\n\t\t\t\ta[n+1]='\\0';\n\t\t\t\tn=strlen(a);\n\t\t\t}\n\t\t\telse if(a[i+1]==a[n-i-1])\n\t\t\t{\n\t\t\t\tfor(j=n-1;j>n-1-i;j--)\n\t\t\t\t\ta[j+1]=a[j];\n\t\t\t\ta[n+1]='\\0';\n\t\t\t\ta[n-i]=a[i];\n\t\t\t\tn=strlen(a);\n\t\t\t}\n\t\t\telse\n\t\t\t\tbreak;\n\n\t\t}\n\t}\t\n\t\tif(i==n/2 && flag==1)\n\t\t{\n\t\t\tfor(j=n-1;j>=n/2;j--)\n\t\t\t\ta[j+1]=a[j];\t\n\t\t\ta[n/2]=a[n/2+1];\n\t\t\ta[n+1]='\\0';\n\t\t\tprintf(\"%s\\n\",a);\n\t\t\t\n\t\t}\n\t\telse if(i==n/2 && !flag)\n\t\t\tprintf(\"%s\\n\",a);\n\t\telse\n\t\t\tprintf(\"NA\\n\");\n\t\treturn 0;\n}\n\n\n"}, {"source_code": "#include\n#include\nint checkpalin(char *str,int l,int h)\n{\nif(l==h)\nreturn 1;\nif(str[l]==str[h])\nreturn checkpalin(str,l+1,h-1);\nreturn 0;\n}\nint main()\n{\n char str[12];\n char tst[12];\n scanf(\"%s\",str);\n int l=strlen(str);\n int i;\n int pos=0;\n while(pos\n#include \nint main(){\n\tchar a[15];\n\tscanf(\"%s\",&a);\n\tint n=strlen(a)-1;\n\tint f=0,flag,fzy=0;\n\tchar b;\n\tif(n==1){\n\t\tprintf(\"%c%c%c\",a[0],a[1],a[0]);\n\t\treturn 0;\n\t}\n\telse if(strlen(a)%2!=0){\n\t\tint y=0;\n\tfor(int i=0;istrlen(a))\n\t\tbreak;\n\t\tif(a[i]!=a[n-y]){\n\t\t\tf++;\n\t\t\tif(a[i]==a[n-y-1]){\n\t b=a[n-y];\n\t\t\tflag=i;\t\n\t\t\ti--;\n\t\t\t\n\t\t\tprintf(\"%\");\n\t\t\t}\n\t\t\telse if(a[i+1]==a[n-y]){\n\t\t\t\tb=a[i];\n\t\t\t\tflag=n-y;\n\t\t\t\ti++;\n\t\t\t\t\n\t\t\t\tfzy=1;\n\t\t\t}\n\t\t}\n\t\ty++;\n\t}\n}\n\telse if(strlen(a)%2==0){\n\t\tint y=0;\n\tfor(int i=0;i=strlen(a))\n\t\t break;\n\t\t\tif(a[i]!=a[n-y]){\n\t\t\t\tf++;\n\t\t\tif(a[i]==a[n-y-1]){\n\t\t\tb=a[n-y];\n\t\t\tflag=i;\t\n\t\t\ti--;\n\t\t\t\n\t\t\t}\n\t\t\telse if(a[i+1]==a[n-y]){\n\t\t\t\tb=a[i];\n\t\t\t\tflag=n-y;\n\t\t\t\ti++;\n\t\t\t\tfzy=1;\n\t\t\t}\n\t\t}\n\t\ty++;\n\t}\n\t\t\n}\nif(f==1){\n\tif(strlen(a)==3){\n\t\tif(a[0]!=a[1]&&a[1]!=a[2]){\n\t\t\tprintf(\"NA\");\n\t\t\treturn 0;\n\t\t}\n\t}\nfor(int i=0;i\n#include \nchar a[21],b[21];\nint pal(int x)\n{\n\n int j;\n\n for(j = 0; j < x / 2; j++)\n {\n if (a[j] != a[x - j - 1])\n break;\n }\n if (j < x / 2)\n return 0;\n else\n return 1;\n}\nint main()\n{\n memset(a,' ',21);\n gets(a);\n strcpy(b,a);\n if (pal(strlen(a))){\n a[strlen(a)] = ' ';\n printf(\"%s\",a);\n return 0;\n }\n int i = 0;\n int temp1 = 0;\n int temp2 = 0;\n int flag = 0;\n int q = strlen(a);\n while(i <= q)\n {\n char ch = 'a';\n int temp = i;\n for (i = q ; i > flag; i--)\n {\n a[i] = 'c';\n int tep = a[i];\n a[i] = a[i - 1];\n a[i - 1] = tep;\n }\n flag++;\n i = temp;\n while(ch <= 'z')\n {\n a[i] = ch;\n if (pal(q + 1)){\n temp2 = 1;\n break;\n }\n ch++;\n }\n if (temp2)\n break;\n i++;\n strcpy(a,b);\n }\n if (temp2)\n puts(a);\n else\n printf(\"NA\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint checkpalin(char *str,int l,int h)\n{\nif(l==h)\nreturn 1;\nif(str[l]==str[h])\nreturn checkpalin(str,l+1,h-1);\nreturn 0;\n}\nint main()\n{\n char str[12];\n char tst[12];\n scanf(\"%s\",str);\n int l=strlen(str);\n int i;\n int pos=0;\n char ch;\n while(pos\n#include\nint main()\n{\n\tchar s[12],c;\n\tint length;\n\tint left,right,i,mark;\n\tscanf(\"%s\",s);\t\n\tgetchar();\n\tlength=strlen(s);\n\tleft=0,right=length-1;\n\tfor(i=0;ilength/2;i--)\n\t\t\t{\n\t\t\t\tleft=left+2;\n\t\t\t\tright=right-1;\n\t\t\t\tif(s[left]==s[right])\n\t\t\t\t{\n\t\t\t\t\tleft++;\n\t\t\t\t\tright--;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tprintf(\"NA\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t\tfor(i=0;i<=mark;i++)\n\t\t\t\t\tprintf(\"%c\",s[i]);\n\t\t\tprintf(\"%c\",c);\n\t\t\tfor(i=mark+1;i<=length-1;i++)\n\t\t\t\t\tprintf(\"%c\",s[i]);\n\t\t\treturn 0;\t\t\n\t\t\t\n\t\t}\n\t\telse \n\t\t{\n\t\t\tprintf(\"NA\");\t\t\t\n\t\t\treturn 0;\n\t\t}\n\t\t\n\t}\n\t\n\telse//�Ѿ��Գƣ���printf\n\t{\n\t\tfor(i=0;i<=left;i++)\n\t\t{\n\t\t\tprintf(\"%c\",s[i]);\n\t\t}\n\t\tif(length%2)//����c��left+1���\n\t\t\t\n\t\t{\n\t\t\tprintf(\"%c\",s[left+1]);\n\t\t\tprintf(\"%c\",s[left+1]);\n\t\t}\n\t\t\n\t\telse\n\t\t\tprintf(\"%c\",s[left+1]);\t\t\t\n\t\t\n\t\tfor(i=right;i\n#include\nint main()\n{\n\tchar s[12],c;\n\tint length;\n\tint left,right,i,mark;\n\tscanf(\"%s\",s);\t\n\tgetchar();\n\tlength=strlen(s);\n\tleft=0,right=length-1;\n\tfor(i=0;i\n#include\nint is_pallindrome(char a[10000],int l)\n{int i,j;\n for(i=0,j=l-1;i=0;--i,++j)\n {if(a[i]==a[j])\n continue;\n else\n {flag1=i;flag2=j;\n if(a[i-1]==a[j])\n { for(k=l-1;k>=j;--k)\n c[k+1]=c[k];\n c[j]=c[i];\n if(is_pallindrome(c,l+1))\n {\n printf(\"%s\\n\",c);\n return 0;\n }\n else\n try =0;\n\n }\n if(a[i]==a[j+1])\n { for(k=l-1;k>=i;--k)\n b[k+1]=b[k];\n b[i-1]=b[j+1];\n\n if(is_pallindrome(b,l+1))\n { \n printf(\"%s\\n\",b);\n return 0;\n } \n else\n {printf(\"NA\\n\");\n return 0;}\n }//check shifting till i\n\n }\n\n\n }\n\n\n if(flag1==-1)\n {\n if(l%2==0)\n {\n {\n for(i=0;i\n#include \n#include \n\nint main()\n{\n char s[11],s1[12],s2[12];\n int l,i,j,test1=1,test2=1;\n scanf(\"%s\",&s);\n //printf(\"%s\\n\",s);\n\n l=strlen(s);\n //printf(\"%c\\n\",s[l+2]);\n i=0;\n\n\n s1[0]='\\0';\n while((i<=(l/2))&& test1)\n {\n if(s[i]!=s[l-i-1])\n {\n char *m=malloc((l)*sizeof(char));\n m[0]=s[i];\n memcpy(s1,s,l-i);\n for(j=l-i; j\n#include\n\nint checkpalin(char *str, int s, int e)\n{\n while(s <= e)\n {\n if(str[s] == str[e])\n {\n s++, e--;\n }\n else\n return 0;\n }\n return 1;\n}\n\n\nvoid findstring(char *str, int len)\n{\n char temp[len+1];\n\n int s=0, e=len-1;\n int ts=0, te=len;\n\n while(s <= e)\n {\n if(str[s] == str[e])\n {\n temp[ts] = temp[te] = str[s];\n ts++, te--;\n s++, e--;\n if(ts == te)\n temp[ts] = 'a';\n\n }\n else if(checkpalin(str,s+1,e))\n {\n temp[te] = temp[ts] = str[s];\n te--, ts++, s++;\n\n }\n else if(checkpalin(str,s,e-1))\n {\n temp[ts] = temp[te] = str[e];\n ts++, te--, e--;\n\n }\n else\n {\n break;\n }\n }\n if(s > e)\n printf(\"%s\\n\", temp);\n else\n printf(\"NA\\n\");\n\n}\n\nint main()\n{\n char str[11];\n scanf(\"%s\", str);\n\n int len = strlen(str);\n findstring(str,len);\n //printf(\"%d\", checkpalin(str,0, len-1));\n return 0;\n}\n"}, {"source_code": "#include\n\nint isPalindrome(char *s, int n)\n{\n\tfor(int i = 0; i < n; i++)\n\t{\n\t\tif(s[i] != s[n-1-i])\treturn 0;\n\t}\n\t\n\treturn 1;\n}\n\nint main()\n{\n\tchar s[11];\n\tscanf(\" %s\", s);\n\t\n\tint l = 0;\n\tchar ans[12];\n\t\n\tfor(int i = 0; s[i] != '\\0'; i++)\tl++;\n\t\n\tint position = 0;\n\tchar letter;\n\t\n\tfor(position = 0; position < l-1; position++) \n\t{\n\t\tletter = s[position];\n\t\tint k = 0;\n\t\tfor(int i = 0; i < l-position; i++)\tans[k++] = s[i];\n\t\tans[k++] = letter;\n\t\tfor(int i = l-position; i < l; i++)\tans[k++] = s[i];\t\n\t\tans[k] = '\\0';\n\t\tif(isPalindrome(ans, l+1))\n\t\t{\n\t\t\tprintf(\"%s\\n\", ans);\n\t\t\treturn 0;\n\t\t}\n\t}\n\t\n\tletter = s[l-1];\n\tans[0] = letter;\n\tfor(int i = 0; i < l; i++)\tans[i+1] = s[i];\n\tans[l+1] = '\\0';\n\t\n\tif(isPalindrome(ans, l+1))\n\t{\n\t\tprintf(\"%s\\n\", ans);\n\t\treturn 0;\n\t}\n\t\n\tprintf(\"NA\\n\");\n\treturn 0;\n}"}, {"source_code": "//bug:iq,dog,babccba(�����޸ĵĻ�������Ҫ��������߼ӣ���Ҫ�������ұ߼�)\n#include\n#include\nint main()\n{\n\tchar s[12],c;\n\tint length;\n\tint left,right,i,mark,leftbefore,rightbefore,ans=0;\n\tscanf(\"%s\",s);\t\n\tgetchar();\n\tlength=strlen(s);\n\tleft=0,right=length-1;\n\tfor(i=0;iright����ʾ�����Ѿ�ȫ���Գ�\n\t{\n\t\tif(s[left]==s[right-1])//����߼��ַ��ڴ��ڼ�û�ҵ��𰸲��˳�����ans��¼û���ҵ���\n\t\t{\n\t\t\tc=s[right];\n\t\t\tmark=left-1;\n\t\t\t//�����ж�\n\t\t\tleft=left+1;\n\t\t\tright=right-2;\n\t\t\tfor(i=0;i<(right-left+1)/2;i++)//i<(right-left+1)/2\n\t\t\t{\n\t\t\t\t\n\t\t\t\tif(s[left]==s[right])\n\t\t\t\t{\n\t\t\t\t\tleft++;\n\t\t\t\t\tright--;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tans=1;//ans==1��ʾ�ڵ�һ�γ���ʧ��\n\t\t\t\t\tbreak;\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t\t//��һ��forѭ�������ʾ���ɻ��Ĵ�����������\n\t\t\tif(ans!=1)\n\t\t\t{\n\t\t\t\tfor(i=0;i<=mark;i++)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%c\",s[i]);\n\t\t\t\t}\n\t\t\t\tprintf(\"%c\",c);\n\t\t\t\tfor(i=mark+1;i\n#include \n#include \nchar s[11],s1[12],s2[12];\nint main()\n{\n\n int l,i,j,test1=1,test2=1;\n scanf(\"%s\",&s);\n l=strlen(s);\n i=0;\n\n\n s1[0]='\\0';\n while((i<=(l/2))&& test1)\n {\n if(s[i]!=s[l-i-1])\n {\n char *m=malloc((l)*sizeof(char));\n m[0]=s[i];\n memcpy(s1,s,l-i);\n for(j=l-i; j\n#include \nint main(){\n\tchar a[15];\n\tscanf(\"%s\",&a);\n\tint n=strlen(a)-1;\n\tint f=0,flag,fzy=0;\n\tchar b;\n\tif(n==1){\n\t\tprintf(\"%c%c%c\",a[0],a[1],a[0]);\n\t\treturn 0;\n\t}\n\telse if(strlen(a)%2!=0){\n\t\tint y=0;\n\tfor(int i=0;istrlen(a))\n\t\tbreak;\n\t\tif(a[i]!=a[n-y]){\n\t\t\tf++;\n\t\t\tif(a[i]==a[n-y-1]){\n\t b=a[n-y];\n\t\t\tflag=i;\t\n\t\t\ti--;\n\t\t\t\n\t\t\tprintf(\"%\");\n\t\t\t}\n\t\t\telse if(a[i+1]==a[n-y]){\n\t\t\t\tb=a[i];\n\t\t\t\tflag=n-y;\n\t\t\t\ti++;\n\t\t\t\t\n\t\t\t\tfzy=1;\n\t\t\t}\n\t\t}\n\t\ty++;\n\t}\n}\n\telse if(strlen(a)%2==0){\n\t\tint y=0;\n\tfor(int i=0;i=strlen(a))\n\t\t break;\n\t\t\tif(a[i]!=a[n-y]){\n\t\t\t\tf++;\n\t\t\tif(a[i]==a[n-y-1]){\n\t\t\tb=a[n-y];\n\t\t\tflag=i;\t\n\t\t\ti--;\n\t\t\t\n\t\t\t}\n\t\t\telse if(a[i+1]==a[n-y]){\n\t\t\t\tb=a[i];\n\t\t\t\tflag=n-y;\n\t\t\t\ti++;\n\t\t\t\tfzy=1;\n\t\t\t}\n\t\t}\n\t\ty++;\n\t}\n\t\t\n}\nif(f==1){\n\tif(strlen(a)==3){\n\t\tif(a[0]!=a[1]&&a[1]!=a[2]){\n\t\t\tprintf(\"NA\");\n\t\t\treturn 0;\n\t\t}\n\t}\nfor(int i=0;i\n#include\nint main()\n{\n\tlong long int i,j,k,len,count=0,flag1=0,flag=0,flag21=0,p,q;\n\tchar s[1000000],letter;\n\tscanf(\"%s\", s);\n\tlen=strlen(s);\n\ti=0;\n\tfor(i=0;i1)\n\t{\n\t\tprintf(\"NA\\n\");\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 \n#include \n#include \n\nint main()\n{\n char s[11];\n int l,i,j,test1=1,test2=1;\n scanf(\"%s\",&s);\n l=strlen(s);\n i=0;\n char *s1=malloc((l+2)*sizeof(char));\n char *s2=malloc((l+2)*sizeof(char));\n\n while((i<=(l/2))&& test1)\n {\n if(s[i]!=s[l-i-1])\n {\n char *m=malloc((l)*sizeof(char));\n m[0]=s[i];\n memcpy(s1,s,l-i);\n for(j=l-i; j\n#include\nint main(void) {\n int i,j,num,flag;\n char a, s[12];\n scanf(\"%s\",&s);\n i=0;\n j=strlen(s)-1;\n flag=0;\n while(i\n#include\nint main()\n{\n\tchar s[12],c;\n\tint length;\n\tint left,right,i,mark;\n\tscanf(\"%s\",s);\t\n\tgetchar();\n\tlength=strlen(s);\n\tleft=0,right=length-1;\n\tfor(i=0;ilength/2;i--)\n\t\t\t{\n\t\t\t\tleft=left+2;\n\t\t\t\tright=right-1;\n\t\t\t\tif(s[left]==s[right])\n\t\t\t\t{\n\t\t\t\t\tleft++;\n\t\t\t\t\tright--;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tprintf(\"NA\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t\tfor(i=0;i<=mark;i++)\n\t\t\t\t\tprintf(\"%c\",s[i]);\n\t\t\tprintf(\"%c\",c);\n\t\t\tfor(i=mark+1;i<=length-1;i++)\n\t\t\t\t\tprintf(\"%c\",s[i]);\n\t\t\treturn 0;\t\t\n\t\t\t\n\t\t}\n\t\telse \n\t\t{\n\t\t\tprintf(\"NA\");\t\t\t\n\t\t\treturn 0;\n\t\t}\n\t\t\n\t}\n\t\n\telse//�Ѿ��Գƣ���printf\n\t{\n\t\tfor(i=0;i<=left;i++)\n\t\t{\n\t\t\tprintf(\"%c\",s[i]);\n\t\t}\n\t\tif(length%2)//����c��left+1���\n\t\t\t\n\t\t{\n\t\t\tprintf(\"%c\",s[left+1]);\n\t\t\tprintf(\"%c\",s[left+1]);\n\t\t}\n\t\t\n\t\telse\n\t\t\tprintf(\"%c\",s[left+1]);\t\t\t\n\t\t\n\t\tfor(i=right;i\n#include \n#include \n\nint main()\n{\n char s[11], backup[11];\n gets(s);\n strcpy(backup,s);\n int len = strlen(s), i = 0, j = 0, chosen = 0;\n if(len == 1)\n {\n printf(\"%s%s\",s,s);\n exit(0);\n }\n for(i = 0; i < len-1; i++)\n {\n for(j = i; j < len-1; j++)\n s[j] = s[j+1];\n s[len-1] = '\\0';\n chosen = i;\n int found = 1, auxlen = strlen(s);\n for(j = 0; j < auxlen/2; j++)\n if(s[j] != s[auxlen-j-1])\n {\n found = 0;\n break;\n }\n strcpy( s,backup);\n if(found == 1)\n {\n for(j = 0; j < len-chosen; j++)\n printf(\"%c\", s[j]);\n printf(\"%c\", s[chosen]);\n for(j = len-chosen; j < len; j++)\n printf(\"%c\", s[j]);\n exit(0);\n }\n }\n printf(\"NA\");\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n\nchar *insere(char ch[10],char c,int x)\n{\n int i,n;\n n=strlen(ch);\n for(i=strlen(ch);i>x;i--)\n ch[i]=ch[i-1];\n ch[n+1]='\\0';\n ch[x]=c;\n\n return(ch);\n}\n\nint palaindrom(char ch[])\n{\n int i;\n for (i=0;i<(strlen(ch)/2);i++)\n {\n if (ch[i]!=ch[strlen(ch)-1-i])\n return 0;\n }\n return 1;\n}\n\nint main ()\n{\n char ch[11],ch2[11],ch3[11];\n int i;\n scanf(\"%s\",ch);\n\n if (palaindrom(ch)==1)\n {\n if ((strlen(ch)%2)==0)\n {printf(\"%s\",insere(ch,'i',(strlen(ch)/2)));\n return 0;\n }\n\n else\n {printf(\"%s\",insere(ch,ch[strlen(ch)/2],(strlen(ch)/2)));\nreturn 0; }\n }\n else\n {\n for (i=0;i<(strlen(ch)/2);i++)\n if (ch[i]!=ch[strlen(ch)-i-1])\n {\n strcpy(ch3,insere(ch,ch[i],strlen(ch)-i));\n strcpy(ch2,insere(ch,ch[strlen(ch)-i-1],i));\n\n if (palaindrom(ch3)==1)\n printf(\"%s\",ch3);\n\n else if\n ( palaindrom(ch2)==1)\n printf(\"%s\",ch2);\n else printf(\"NA\");\n return 0;\n\n\n }\n }\n\nprintf(\"%s\",insere(ch,ch[1],(strlen(ch)/2)));\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint palin(char a[], int l, int m)\n{\n int i, j;\n for (i = l, j = m; i < j; i++, j--) {\n if (a[i] != a[j]) {\n return 0;\n }\n }\n return 1;\n}\n\nint main()\n{\n char a[100001];\n scanf(\"%s\", a);\n int i;\n int n = strlen(a);\n if (palin(a, 0, n-1)) {\n if (n%2) {\n for (i = 0; i <= n/2; i++) {\n printf(\"%c\", a[i]);\n }\n printf(\"%c\", a[n/2]);\n for (i = n/2+1; i < n; i++) {\n printf(\"%c\", a[i]);\n }\n } else {\n for (i = 0; i < n/2; i++) {\n printf(\"%c\", a[i]);\n }\n printf(\"%c\", 'a');\n for (i = n/2; i < n; i++) {\n printf(\"%c\", a[i]);\n }\n }\n printf(\"\\n\");\n } else if (palin(a, 1, n-1)) {\n for (i = 0; i < n; i++) {\n printf(\"%c\", a[i]);\n }\n printf(\"%c\\n\", a[0]);\n } else if (palin(a, 0, n-2)) {\n printf(\"%c\", a[n-1]);\n for (i = 0; i < n; i++) {\n printf(\"%c\", a[i]);\n }\n printf(\"\\n\");\n } else {\n printf(\"NA\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n\nint main()\n{\n char a[200],t[200],tc,tp;\n int h,i,j,k,l;\n int n,counts;\n\n while(~scanf(\"%s\",a))\n {\n n=strlen(a);\n if(n%2==0)\n {\n k=0;\n i=n-1;\n for(h=0;h\n#include\nint is_pallindrome(char a[10000],int l)\n{int i,j;\n for(i=0,j=l-1;i=0;--i,++j)\n {if(a[i]==a[j])\n continue;\n else\n {flag1=i;flag2=j;\n if(a[i-1]==a[j])\n { for(k=l-1;k>=j;--k)\n c[k+1]=c[k];\n c[j]=c[i];\n if(is_pallindrome(c,l+1))\n {\n printf(\"\\n%s\",c);\n break;\n }\n else\n try =0;\n \n }\n if(a[i]==a[j+1])\n { for(k=l-1;k>=i;--k)\n b[k+1]=b[k];\n b[i-1]=b[j+1];\n\n if(is_pallindrome(b,l+1))\n { \n printf(\"\\n%s\",b);\n break;\n } \n else\n {printf(\"\\nNA\");\n break;}\n }//check shifting till i\n\n }\n\n\n }\n\n\n if(flag1==-1)\n {\n if(l%2==0)\n {{for(i=0;i\n#include \n\nint lel(const char* first, const char* second, int len1)\n{\n\tchar third[11];\n\tint len2;\n\tint i,j;\n\tint flag = 0;\n\tfor (i = 0; i < len1 / 2; i++)\n\t{\n\t\tfor (len2 = j = 0; j < len1; j++)\n\t\t{\n\t\t\tif (j != i)\n\t\t\t{\n\t\t\t\tthird[len2++] = first[j];\n\t\t\t}\n\t\t}\n\t\tthird[len2] = '\\0';\n\t\t\t\n\t\tif (!strncmp(second, third, len1 / 2))\n\t\t{\n\t\t\tflag = 1;\n\t\t\tfor (j = 0; j < len1 - i; j++)\n\t\t\t\tprintf(\"%c\", first[j]);\n\t\t\tprintf(\"%c\", first[i]);\n\t\t\tfor (j = len1 - i; j < len1; j++)\n\t\t\t\tprintf(\"%c\", first[j]);\n\t\t\tprintf(\"\\n\");\n\t\t}\n\t}\n\treturn flag;\n}\n\n\nint main(void)\n{\n\tchar first[11];\n\tchar second[11];\n\tint len1, len2;\n\tint flag = 0;\n\tint i,j;\n\t\n\tfgets(first, 10, stdin);\n\tlen1 = strlen(first);\n\tif (first[len1 - 1] = '\\n') first[--len1] = '\\0';\n\tfor (i = 0, j = len1 - 1; j >= 0; i++, j--)\n\t\tsecond[i] = first[j];\n\tsecond[i] = '\\0';\n\t\t\t\n\tif (!lel(first, second, len1) && !lel(second, first, len1))\n\t\tprintf(\"NA\\n\");\n\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n\nint main()\n{\n char a[200],t[200],tc,tp;\n int h,i,j,k,l;\n int n,counts;\n\n while(~scanf(\"%s\",a))\n {\n n=strlen(a);\n i=n-1;\n j=0;\n for(h=0;h\n#include\n#include\n#include\n\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\nint i,j,s,u,u2,sit,sit2,t,t2;\nchar str[10000], ans[10000];\n\nint main()\n{\n scanf(\"%s\", str);\n u = strlen(str);\n if(u == 1)\n printf(\"%s%s\",str, str);\n else {\n FOR(i,0,u/2-1){\n if(str[i] != str[u - 1 - i])\n {\n ROF(j,u,u-i+1){\n str[j] = str[j - 1];\n }\n str[u - i] = str[i];\n sit = 1;\n break;\n }\n }\n strcpy(ans,str);\n u = strlen(ans);\n FOR(i,0,u/2-1)\n {\n if(ans[i] != ans[u - i - 1])\n sit2 = 1;\n }\n if(sit2 == 0 && sit == 1)\n printf(\"%s\", ans);\n else if(sit2 == 0 && sit == 0)\n {\n FOR(j,0,u-1){\n if(j == u / 2 - 1)\n printf(\"%c%c\",ans[j],ans[j + 1]);\n else\n printf(\"%c\", ans[j]);\n }\n }\n else\n printf(\"NA\");\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n\tint n,flag=1,i,j;\n\tchar a[50];\n\tscanf(\"%s\",a);\n\tn=strlen(a);\n\tfor(i=0;i=i;j--)\n\t\t\t\t\ta[j+1]=a[j];\n\t\t\t\ta[i]=a[n-i];\n\t\t\t\ta[n+1]='\\0';\n\t\t\t\tn=strlen(a);\n\t\t\t}\n\t\t\telse if(a[i+1]==a[n-i-1])\n\t\t\t{\n\t\t\t\tfor(j=n-1;j>n-1-i;j--)\n\t\t\t\t\ta[j+1]=a[j];\n\t\t\t\ta[n+1]='\\0';\n\t\t\t\ta[n-i]=a[i];\n\t\t\t\tn=strlen(a);\n\t\t\t}\n\t\t\telse\n\t\t\t\tbreak;\n\n\t\t}\n\t}\t\n\t\tif(i==n/2 && flag==1)\n\t\t{\n\t\t\tfor(j=n-1;j>=n/2;j--)\n\t\t\t\ta[j+1]=a[j];\t\n\t\t\ta[n/2]=a[n/2+1];\n\t\t\ta[n+1]='\\0';\n\t\t\tprintf(\"%s\\n\",a);\n\t\t\t\n\t\t}\n\t\telse if(i==n/2 && !flag)\n\t\t\tprintf(\"%s\\n\",a);\n\t\telse\n\t\t\tprintf(\"NA\\n\");\n\t\treturn 0;\n}\n\n\n"}, {"source_code": "#include \n#include \nint palindrome(char checkstring1[11], int length);\nint main(){\n\tint i,flag=0,j,k,r,l;\n\tchar string[11];\n\tchar string1[12];\n\tscanf(\"%s\", string);\n\tfor (i = 0; i <= strlen(string); i++){\n\t\tfor (j = 0; j <= 25; j++){\n\t\t\tstring1[i] = 'a' + j;\n\t\t\tl = 0;\n\t\t\tfor (k = 0; k < strlen(string)+1; k++){\n\t\t\t\tif (i != k){\n\t\t\t\t\tstring1[k] = string[l];\n\t\t\t\t\tl++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tflag = palindrome(string1, strlen(string));\n\t\t\tif (flag){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t}\n\t\tif (flag){\n\t\t\tbreak;\n\t\t}\n\t\t}\n\tif (flag){\n\t\tfor (r = 0; r < strlen(string) + 1; r++){\n\t\t\tprintf(\"%c\", string1[r]);\n\t\t}\n\t}\n\treturn 0;\n}\nint palindrome(char checkstring[12], int length){\n\tint count = 0, i;\n\tfor (i = 0; i < (length+1) / 2; i++){\n\t\tif (checkstring[i] == checkstring[length - i])\n\t\t\tcount++;\n\t}\n\tif (count == (length + 1) / 2)\n\t\treturn 1;\n\telse\n\t\treturn 0;\n}\n"}, {"source_code": "#include \n#include\nint main()\n{\n int l,r,i,f=1,pos,fl; char s[20],c; scanf(\"%s\",s); l=0; r=strlen(s)-1;\n while(l<=r)\n {\n if(s[l]==s[r])\n {\n l++; r--; continue;\n }\n if(s[l]!=s[r])\n {\n f=0;\n fl=1;\n pos=r+1; \n c=s[l]; int right,left=l+1; right=r;\n while(left<=right)\n {\n if(s[left]!=s[right])\n {fl=0; break;}\n left++; right--;\n }\n if(fl==0)\n {\n \n pos=l; \n \n c=s[r]; fl=1; left=l; right=r-1;\n while(left!=right)\n {\n if(s[left]!=s[right])\n {fl=0; break;}\n left++; right--;\n }\n }\n \n break;\n }\n }\n if(fl==0 && f==0) {printf(\"NA\"); return 0;}\n if(f==1)\n {\n pos=strlen(s)/2; c=s[pos];\n }\n int len=strlen(s)+1; i=0; f=0;\n while(len--)\n {\n if(i!=pos || f==1)\n printf(\"%c\",s[i++]);\n else\n {printf(\"%c\",c); f=1;}\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \nint main()\n{\n char s[13];\n scanf(\"%s\",s);\n int l,i,k;\n l=strlen(s);\n for(i=0;il-i;k--)\n {\n s[k]=s[k-1];\n }\n s[l-i]=s[i];\n\n break;\n }\n else\n {\n if( s[i]!=s[l-i-1] && s[i]==s[l-i-2])\n {\n for(k=l+1;k>i;k--)\n {\n s[k]=s[k-1];\n }\n s[i]=s[l-i];\n\n break;\n }\n }\n }\n if(i\n#include \n#include \n\nint main()\n{\n char s[11];\n int l,i,j,test1=1,test2=1;\n scanf(\"%s\",&s);\n l=strlen(s);\n i=0;\n char *s1=malloc((l+2)*sizeof(char));\n char *s2=malloc((l+2)*sizeof(char));\n\n while((i<=(l/2))&& test1)\n {\n if(s[i]!=s[l-i-1])\n {\n char *m=malloc((l)*sizeof(char));\n m[0]=s[i];\n memcpy(s1,s,l-i);\n for(j=l-i; j\n#include \n#include \n\nint main()\n{\n char s[11], letter;\n gets(s);\n int i = 0, len = strlen(s), forward = 0, backward = len-1, once = 0, f = -1, pos = 0;\n for(i = 0; i < len/2; i++)\n {\n if(s[forward] != s[backward])\n {\n if(once == 1)\n {\n printf(\"NA\");\n exit(0);\n }\n once = 1;\n if(s[forward+1] == s[backward])\n {\n f = 0;\n letter = s[forward];\n pos = backward;\n backward++;\n }\n else if(s[forward] == s[backward-1])\n {\n letter = s[backward];\n f = 1;\n pos = forward;\n forward--;\n }\n else\n {\n printf(\"NA\");\n exit(0);\n }\n }\n forward++; backward--;\n }\n if(f == 0)\n {\n for(i = 0; i <= pos; i++)\n printf(\"%c\", s[i]);\n printf(\"%c\", letter);\n for(i = pos+1; i < len; i++)\n printf(\"%c\", s[i]);\n }\n else if(f == 1)\n {\n for(i = 0; i < pos; i++)\n printf(\"%c\", s[i]);\n printf(\"%c\", letter);\n for(i = pos; i < len; i++)\n printf(\"%c\", s[i]);\n }\n else\n {\n if(len % 2 == 0)\n {\n for(i = 0; i < len/2; i++)\n printf(\"%c\", s[i]);\n printf(\"%c\", 'a');\n for(i = len/2; i < len; i++)\n printf(\"%c\", s[i]);\n }\n else\n {\n for(i = 0; i <= len/2; i++)\n printf(\"%c\", s[i]);\n for(i = len/2; i < len; i++)\n printf(\"%c\", s[i]);\n }\n }\n}\n"}, {"source_code": "#include \n#include \nint palindrome(char checkstring1[11], int length);\nint main(){\n\tint i,flag=0,j,k,r,l;\n\tchar string[11];\n\tchar string1[12];\n\tscanf(\"%s\", string);\n\tfor (i = 0; i <= strlen(string); i++){\n\t\tfor (j = 0; j <= 25; j++){\n\t\t\tstring1[i] = 'a' + j;\n\t\t\tl = 0;\n\t\t\tfor (k = 0; k < strlen(string)+1; k++){\n\t\t\t\tif (i != k){\n\t\t\t\t\tstring1[k] = string[l];\n\t\t\t\t\tl++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tflag = palindrome(string1, strlen(string));\n\t\t\tif (flag){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t}\n\t\tif (flag){\n\t\t\tbreak;\n\t\t}\n\t\t}\n\tif (flag){\n\t\tfor (r = 0; r < strlen(string) + 1; r++){\n\t\t\tprintf(\"%c\", string1[r]);\n\t\t}\n\t}\n\treturn 0;\n}\nint palindrome(char checkstring[12], int length){\n\tint count = 0, i;\n\tfor (i = 0; i < (length+1) / 2; i++){\n\t\tif (checkstring[i] == checkstring[length - i])\n\t\t\tcount++;\n\t}\n\tif (count == (length + 1) / 2)\n\t\treturn 1;\n\telse\n\t\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n\nint main()\n{\n char a[200],t[200],tc,tp;\n int h,i,j,k,l;\n int n,counts;\n\n while(~scanf(\"%s\",a))\n {\n n=strlen(a);\n i=n-1;\n j=0;\n for(h=0;h\n#include\nint main()\n{\n\tchar s[12],c;\n\tint length;\n\tint left,right,i,mark;\n\tscanf(\"%s\",s);\t\n\tgetchar();\n\tlength=strlen(s);\n\tleft=0,right=length-1;\n\tfor(i=0;iright����ʾ�����Ѿ�ȫ���Գ�\n\t{\n\t\tif(s[left]==s[right-1])//����߼��ַ�\n\t\t{\n\t\t\tc=s[right];\n\t\t\tmark=left-1;\n\t\t\t//�����ж�\n\t\t\tleft=left+1;\n\t\t\tright=right-2;\n\t\t\tfor(i=0;i<(right-left+1)/2;i++)//δ��֤i<(right-left+1)/2\n\t\t\t{\n\t\t\t\t\n\t\t\t\tif(s[left]==s[right])\n\t\t\t\t{\n\t\t\t\t\tleft++;\n\t\t\t\t\tright--;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tprintf(\"NA\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t\t//��һ��forѭ�������ʾ���ɻ��Ĵ�����������\n\t\t\tfor(i=0;i<=mark;i++)\n\t\t\t{\n\t\t\t\tprintf(\"%c\",s[i]);\n\t\t\t}\n\t\t\tprintf(\"%c\",c);\n\t\t\tfor(i=mark+1;i\n#include\nint fun(char a[],int n)\n{\n\tint i,j,k;\n\tfor(i=0;i=i;j--)\n\t\t\tb[j+1]=b[j];\n\t\t\tb[j+1]=t;\n\t\t\tb[L+1]='\\0';\n\t\t//\tprintf(\"%s\\n\",b);\n\t\t\tif(fun(b,L+1)==1)\n\t\t\t{\n\t\t\t\tprintf(\"%s\\n\",b);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(i!=L)\n\t\tcontinue;\n\t\ta[i]=a[0];\n\t\ta[L+1]='\\0';\n\t\t//printf(\"%s\\n\",a);\n\t\tif(fun(a,L+1)==1)\n\t\t{\n\t\t\tprintf(\"%s\\n\",a);\n\t\t\tcontinue;\n\t\t}\n\t\t \n\t\tprintf(\"NA\\n\");\n\t}\n}"}, {"source_code": "#include \n#include \nchar a[21],b[21];\nint pal(int x)\n{\n\n int j;\n\n for(j = 0; j < x / 2; j++)\n {\n if (a[j] != a[x - j - 1])\n break;\n }\n if (j < x / 2)\n return 0;\n else\n return 1;\n}\nint main()\n{\n memset(a,' ',21);\n gets(a);\n strcpy(b,a);\n if (pal(strlen(a))){\n a[strlen(a)] = ' ';\n printf(\"%s\",a);\n return 0;\n }\n int i = 0;\n int temp1 = 0;\n int temp2 = 0;\n int flag = 0;\n int q = strlen(a);\n while(i <= q)\n {\n char ch = 'a';\n int temp = i;\n for (i = q ; i > flag; i--)\n {\n a[i] = 'c';\n int tep = a[i];\n a[i] = a[i - 1];\n a[i - 1] = tep;\n }\n flag++;\n i = temp;\n while(ch <= 'z')\n {\n a[i] = ch;\n if (pal(q + 1)){\n temp2 = 1;\n break;\n }\n ch++;\n }\n if (temp2)\n break;\n i++;\n strcpy(a,b);\n }\n if (temp2)\n puts(a);\n else\n printf(\"NA\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint is_pallindrome(char a[10000],int l)\n{int i,j;\n for(i=0,j=l-1;i=0;--i,++j)\n {if(a[i]==a[j])\n continue;\n else\n {flag1=i;flag2=j;\n if(a[i-1]==a[j])\n { for(k=l-1;k>=j;--k)\n c[k+1]=c[k];\n c[j]=c[i];\n if(is_pallindrome(c,l+1))\n {\n printf(\"\\n%s\\n\",c);\n break;\n }\n else\n try =0;\n \n }\n if(a[i]==a[j+1])\n { for(k=l-1;k>=i;--k)\n b[k+1]=b[k];\n b[i-1]=b[j+1];\n\n if(is_pallindrome(b,l+1))\n { \n printf(\"\\n%s\\n\",b);\n break;\n } \n else\n {printf(\"\\nNA\\n\");\n break;}\n }//check shifting till i\n\n }\n\n\n }\n\n \n if(flag1==-1)\n {\n if(l%2==0)\n {printf(\"\\n\");\n {\n for(i=0;i\n\nint isPalindrome(char *s, int n)\n{\n\tfor(int i = 0; i < n; i++)\n\t{\n\t\tif(s[i] != s[n-1-i])\treturn 0;\n\t}\n\t\n\treturn 1;\n}\n\nint main()\n{\n\tchar s[11];\n\tscanf(\" %s\", s);\n\t\n\tint l = 0;\n\tchar ans[12];\n\t\n\tfor(int i = 0; s[i] != '\\0'; i++)\tl++;\n\t\n\tint position = 0;\n\tchar letter;\n\t\n\tfor(int position = 0; position < l; position++) \n\t{\n\t\tletter = s[position];\n\t\tint k = 0;\n\t\tfor(int i = 0; i < l-position; i++)\tans[k++] = s[i];\n\t\tans[k++] = letter;\n\t\tfor(int i = l-position; i < l; i++)\tans[k++] = s[i];\t\n\t\tans[k] = '\\0';\n\t\n\t\tif(isPalindrome(ans, l+1))\n\t\t{\n\t\t\tprintf(\"%s\\n\", ans);\n\t\t\treturn 0;\n\t\t}\n\t}\n\t\n\tprintf(\"NA\\n\");\n\treturn 0;\n}"}, {"source_code": "#include \n#include \nint main(){\n\tchar a[15];\n\tscanf(\"%s\",&a);\n\tint n=strlen(a)-1;\n\tint f=0,flag,fzy=0,yn=0;\n\tchar b;\n\tif(n==1){\n\t\tprintf(\"%c%c%c\",a[0],a[1],a[0]);\n\t\treturn 0;\n\t}\n\telse if(strlen(a)%2!=0){\n\t\tint y=0;\n\tfor(int i=0;istrlen(a))\n\t\tbreak;\n\t\tif(a[i]!=a[n-y]){\n\t\t\tf++;\n\t\t\tif(a[i]==a[n-y-1]){\n\t b=a[n-y];\n\t\t\tflag=i;\t\n\t\t\ti--;\n\t\t\tyn=1;\n\t\t\t\n\t\t\t}\n\t\t\telse if(a[i+1]==a[n-y]){\n\t\t\t\tb=a[i];\n\t\t\t\tflag=n-y;\n\t\t\t\ti++;\n\t\t\t\tyn=1;\n\t\t\t\tfzy=1;\n\t\t\t}\n\t\t}\n\t\ty++;\n\t}\n}\n\telse if(strlen(a)%2==0){\n\t\tint y=0;\n\tfor(int i=0;i=strlen(a))\n\t\t break;\n\t\t\tif(a[i]!=a[n-y]){\n\t\t\t\tf++;\n\t\t\tif(a[i]==a[n-y-1]){\n\t\t\tb=a[n-y];\n\t\t\tflag=i;\t\n\t\t\ti--;\n\t\t\tyn=1;\n\t\t\t}\n\t\t\telse if(a[i+1]==a[n-y]){\n\t\t\t\tb=a[i];\n\t\t\t\tflag=n-y;\n\t\t\t\ti++;\n\t\t\t\tfzy=1;\n\t\t\t\tyn=1;\n\t\t\t}\n\t\t}\n\t\ty++;\n\t}\n\t\t\n}\nif(f==1&&yn==1){\n\tif(strlen(a)==3){\n\t\tif(a[0]!=a[1]&&a[1]!=a[2]){\n\t\t\tprintf(\"NA\");\n\t\t\treturn 0;\n\t\t}\n\t}\nfor(int i=0;i\n#include \n\nint cmp(const void *a, const void *b)\n{\n return *((int *)a) - *((int *)b);\n}\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 a[2000];\n int p = 0, q = 1, x = 1, i, j;\n int pl, pr, vl, vr, k;\n long long c = 0, d;\n\n a[0] = 0;\n\n for (i = 0; i < 9; i++) {\n\t for (j = p; j < q; j++) {\n\t a[x++] = a[j] * 10 + 4;\n\t a[x++] = a[j] * 10 + 7;\n\t }\n\n\t p = q; q = x;\n }\n\n qsort(a, x, sizeof(int), cmp);\n\n a[x] = 1000000001;\n\n scanf(\"%d %d %d %d %d\", &pl, &pr, &vl, &vr, &k);\n\n d = (long long)(pr - pl + 1) * (vr - vl + 1);\n\n for (i = 1; i <= x - k; i++) {\n\t if (pl <= a[i] && vr >= a[i + k - 1]) {\n\t int s1 = minimum(a[i], pr);\n\t int s2 = maximum(a[i - 1] + 1, pl);\n\t int t1 = maximum(a[i + k - 1], vl);\n\t int t2 = minimum(a[i + k] - 1, vr);\n\n\t if (s1 - s2 >= 0 && t2 - t1 >= 0) {\n\t\t c += (long long)(s1 - s2 + 1) * (t2 - t1 + 1);\n\t }\n\t }\n\t if (vl <= a[i] && pr >= a[i + k - 1]) {\n\t int s1 = minimum(a[i], vr);\n\t int s2 = maximum(a[i - 1] + 1, vl);\n\t int t1 = maximum(a[i + k - 1], pl);\n\t int t2 = minimum(a[i + k] - 1, pr);\n\n\t if (s1 - s2 >= 0 && t2 - t1 >= 0) {\n\t\t c += (long long)(s1 - s2 + 1) * (t2 - t1 + 1);\n\t }\n\t }\n }\n\n if (k == 1) {\n\t for (i = 1; i < x; i++) {\n\t if (pl <= a[i] && pr >= a[i] && vl <= a[i] && vr >= a[i]) c--;\n\t }\n }\n\n printf(\"%.20lf\\n\", (double)c / d);\n\n return 0;\n}\n"}, {"source_code": "#include \nint checkIsLucky(int num){\n while(num>0){\n if(num%10!=4&&num%10!=7)return 0;\n num/=10;\n }\n return 1;\n}\nint nextNum(int num){\n int nextN;\n int count=1;\n int maxNextD=0;\n nextN=num;\n if(num>=777777777) return 1000000001;\n while(num>0){\n if(num%10==4){\n nextN+=count*3;\n nextN=nextN/(count)*count+maxNextD;\n break;\n }else{\n maxNextD*=10;\n maxNextD+=4;\n num/=10;\n count*=10;\n }\n }\n if(num>0) return nextN;\n else{\n maxNextD*=10;\n maxNextD+=4;\n return maxNextD;\n }\n}\n\nint max(int a,int b){\n if(a>b) return a;\n else return b;\n}\nint min(int a,int b){\n if(a>b) return b;\n else return a;\n}\nint kthNum(int begin,int k){\n int count=1;\n int rt=0,tmp=begin;\n while (tmp>0) {\n tmp/=10;\n rt*=10;\n rt+=4;\n }\n while(rt=vl&&i<=vr) sum-=1;\n getchar();\n }\n }\n lk1= kthNum(pl,k);\n lk2= nextNum(lk1);\n i=pl;\n for(;i<=pr;){//xet tat ca cac chu so trong [pl+1,pr]\n sum+=lenthRt(vl,vr,lk1,lk2)*min(after-i+1,pr-i+1);\n //printf(\"%d to %d-> %d %d + them %lf*%d->%lf\\n\",i,after,lk1,lk2,lenthRt(vl,vr,lk1,lk2),min(after-i+1,pr-i+1),sum);\n\n i=after+1;\n after=nextNum(after);\n lk1=lk2;\n if(lk1>vr) break;\n lk2=nextNum(lk2);\n }\n //if k==1\n \n //for p\n after=kthNum(vl,1);\n lk1= kthNum(vl,k);\n lk2= nextNum(lk1);\n i=vl;\n for(;i<=vr;){//xet tat ca cac chu so trong [pl+1,pr]\n //if(vl==vr&&pl==pr&&pl==vr) break;\n sum+=lenthRt(pl,pr,lk1,lk2)*min(after-i+1,vr-i+1);\n //printf(\"%d to %d-> %d %d + them %lf*%d ->%lf\\n\",i,after,lk1,lk2,lenthRt(pl,pr,lk1,lk2),min(after-i+1,pr-i+1),sum);\n \n i=after+1;\n after=nextNum(after);\n lk1=lk2;\n if(lk1>pr) break;\n lk2=nextNum(lk2);\n }\n mau=(pr-pl+1);\n mau*= (vr-vl+1);\n //printf(\"%lf %lf\");\n //printf(\"%lf %lf\\n\",sum,mau);\n kq=sum/mau;\n \n printf(\"%.12lf\",kq);\n return 0;\n}"}, {"source_code": "#include \ntypedef long long ll;\n\nll lucky[2000];\nint nl;\n\n#define MIN(a,b) ab?a:b\n\nll count2(ll minlow,ll maxlow,ll minhigh,ll maxhigh,ll pl,ll pr,ll vl,ll vr) {\n ll res=0;\n ll aa,ab,ba,bb,x,y;\n aa=MAX(pl,minlow);\n ab=MIN(pr,maxlow);\n ba=MAX(vl,minhigh);\n bb=MIN(vr,maxhigh);\n x=ab-aa+1;\n y=bb-ba+1;\n if(x>0 && y>0) res+=x*y;\n return res;\n}\n\nll count3(ll minlow,ll maxlow,ll minhigh,ll maxhigh,ll pl,ll pr,ll vl,ll vr) {\n ll res=0;\n ll aa,ab,ba,bb,x,y;\n pl=MAX(pl,vl);\n pr=MIN(pr,vr);\n if(pl>pr) return 0;\n aa=MAX(minlow,pl);\n ab=MIN(maxlow,pr);\n ba=MAX(minhigh,pl);\n bb=MIN(maxhigh,pr);\n x=ab-aa+1;\n y=bb-ba+1;\n if(x>0 && y>0) res+=x+y;\n return res;\n}\n\nll count(ll minlow,ll maxlow,ll minhigh,ll maxhigh,ll pl,ll pr,ll vl,ll vr) {\n ll res=0;\n res+=count2(minlow,maxlow,minhigh,maxhigh,pl,pr,vl,vr);\n res+=count2(minlow,maxlow,minhigh,maxhigh,vl,vr,pl,pr);\n// res-=count3(minlow,maxlow,minhigh,maxhigh,vl,vr,pl,pr);\n return res;\n}\n\nint main() {\n int i,j,k,K,maks,min;\n ll tall,tot,yes;\n int pl,pr,vl,vr;\n\n nl=0;\n lucky[nl++]=0;\n for(i=1;i<10;i++) {\n for(j=0;j<(1<vr?pr:vr;\n min=pl=nl) break;\n if(lucky[i+K]>maks) break;\n/* printf(\"try %I64d %I64d %I64d %I64d\\n\",lucky[i]+1,lucky[i+1],lucky[i+K],lucky[i+K+1]-1);*/\n yes+=count(lucky[i]+1,lucky[i+1],lucky[i+K],lucky[i+K+1]-1,pl,pr,vl,vr);\n }\n if(K==1) {\n for(i=1;i=vl && lucky[i]>=pl && lucky[i]<=vr && lucky[i]<=pr) yes--;\n }\n }\n printf(\"%.12f\\n\",(double)((long double)yes/tot));\n goto again;\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint cmp(const void *a, const void *b)\n{\n return *((int *)a) - *((int *)b);\n}\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 a[2000];\n int p = 0, q = 1, x = 1, i, j;\n int pl, pr, vl, vr, k;\n long long c = 0, d;\n\n a[0] = 0;\n\n for (i = 0; i < 9; i++) {\n\t for (j = p; j < q; j++) {\n\t a[x++] = a[j] * 10 + 4;\n\t a[x++] = a[j] * 10 + 7;\n\t }\n\n\t p = q; q = x;\n }\n\n qsort(a, x, sizeof(int), cmp);\n\n a[x] = 1000000001;\n\n scanf(\"%d %d %d %d %d\", &pl, &pr, &vl, &vr, &k);\n\n d = (long long)(pr - pl + 1) * (vr - vl + 1);\n\n for (i = 1; i <= x - k; i++) {\n\t if (pl <= a[i] && vr >= a[i + k - 1]) {\n\t int s1 = minimum(a[i], pr);\n\t int s2 = maximum(a[i - 1] + 1, pl);\n\t int t1 = maximum(a[i + k - 1], vl);\n\t int t2 = minimum(a[i + k] - 1, vr);\n\n\t if (s1 - s2 >= 0 && t2 - t1 >= 0) {\n\t\t c += (long long)(s1 - s2 + 1) * (t2 - t1 + 1);\n\t }\n\t }\n\t if (vl <= a[i] && pr >= a[i + k - 1]) {\n\t int s1 = minimum(a[i], vr);\n\t int s2 = maximum(a[i - 1] + 1, vl);\n\t int t1 = maximum(a[i + k - 1], pl);\n\t int t2 = minimum(a[i + k] - 1, pr);\n\n\t if (s1 - s2 >= 0 && t2 - t1 >= 0) {\n\t\t c += (long long)(s1 - s2 + 1) * (t2 - t1 + 1);\n\t }\n\t }\n }\n\n if (k == 1) {\n\t for (i = 1; i < x; i++) {\n\t if (pl <= a[i] && pr >= a[i] && vl <= a[i] && vr >= a[i]) c--;\n\t }\n }\n\n printf(\"%.20lf\\n\", (double)c / d);\n\n return 0;\n}\n"}, {"source_code": "#include \n\n#define MAX(a, b) ((a) > (b) ? (a) : (b))\n#define MIN(a, b) ((a) < (b) ? (a) : (b))\n\ntypedef long long ll;\n\nll y[1 << 11];\nll q[1 << 12];\n\nint init() {\n int n = 0, f = 0, r = 0;\n q[r ++] = 4;\n q[r ++] = 7;\n while (f < r) {\n y[n ++] = q[f];\n if (q[f] * 10 + 4 <= 1000000000) {\n q[r ++] = q[f] * 10 + 4;\n }\n if (q[f] * 10 + 7 <= 1000000000) {\n q[r ++] = q[f] * 10 + 7;\n }\n f ++;\n }\n return n;\n}\n\nint join(int a, int b, int c, int d) {\n int r1, r2;\n if (b < c || a > d) {\n return 0;\n }\n r1 = MAX(a, c);\n r2 = MIN(b, d);\n return (r2 - r1 + 1);\n}\n\nvoid func(int pl, int pr, int vl, int vr, int k, int n) {\n int i, t, a, b, c, d, _a, _b, _c, _d;\n double ans = 0.;\n for (i = 0; i + k - 1 < n; i ++) { // left = i, right = i + k - 1\n if (i > 0) {\n a = MAX(pl, y[i - 1] + 1);\n }\n else {\n a = pl;\n }\n b = MIN(pr, y[i]);\n c = MAX(vl, y[i + k - 1]);\n if (i + k < n) {\n d = MIN(vr, y[i + k] - 1);\n }\n else {\n d = vr;\n }\n if (a <= b && c <= d) {\n ans += (double)(b - a + 1) / (double)(pr - pl + 1) * ((double)(d - c + 1) / (double)(vr - vl + 1));\n }\n if (i > 0) {\n _a = MAX(vl, y[i - 1] + 1);\n }\n else {\n _a = vl;\n }\n _b = MIN(vr, y[i]);\n _c = MAX(pl, y[i + k - 1]);\n if (i + k < n) {\n _d = MIN(pr, y[i + k] - 1);\n }\n else {\n _d = pr;\n }\n if (_a <= _b && _c <= _d) {\n ans += (double)(_b - _a + 1) / (double)(vr - vl + 1) * ((double)(_d - _c + 1) / (double)(pr - pl + 1));\n }\n if (a <= b && c <= d && _a <= _b && _c <= _d) {\n t = join(a, b, c, d);\n ans -= (double)t / (double)(pr - pl + 1) / (double)(vr - vl + 1);\n }\n }\n printf(\"%.11lf\\n\", ans);\n}\n\nint main() {\n int n, pl, pr, vl, vr, k;\n n = init();\n while (scanf(\"%d%d%d%d%d\", &pl, &pr, &vl, &vr, &k) == 5) {\n func(pl, pr, vl, vr, k, n);\n }\n return 0;\n}"}, {"source_code": "#include \nint checkIsLucky(int num){\n while(num>0){\n if(num%10!=4&&num%10!=7)return 0;\n num/=10;\n }\n return 1;\n}\nint nextNum(int num){\n int nextN;\n int count=1;\n int maxNextD=0;\n nextN=num;\n if(num>=777777777) return 1000000001;\n while(num>0){\n if(num%10==4){\n nextN+=count*3;\n nextN=nextN/(count)*count+maxNextD;\n break;\n }else{\n maxNextD*=10;\n maxNextD+=4;\n num/=10;\n count*=10;\n }\n }\n if(num>0) return nextN;\n else{\n maxNextD*=10;\n maxNextD+=4;\n return maxNextD;\n }\n}\n\nint max(int a,int b){\n if(a>b) return a;\n else return b;\n}\nint min(int a,int b){\n if(a>b) return b;\n else return a;\n}\nint kthNum(int begin,int k){\n int count=1;\n int rt=0,tmp=begin;\n while (tmp>0) {\n tmp/=10;\n rt*=10;\n rt+=4;\n }\n while(rt=vl&&i<=vr) sum-=1;\n getchar();\n }\n }\n lk1= kthNum(pl,k);\n lk2= nextNum(lk1);\n i=pl;\n for(;i<=pr;){//xet tat ca cac chu so trong [pl+1,pr]\n sum+=lenthRt(vl,vr,lk1,lk2)*min(after-i+1,pr-i+1);\n //printf(\"%d to %d-> %d %d + them %lf*%d->%lf\\n\",i,after,lk1,lk2,lenthRt(vl,vr,lk1,lk2),min(after-i+1,pr-i+1),sum);\n\n i=after+1;\n after=nextNum(after);\n lk1=lk2;\n if(lk1>vr) break;\n lk2=nextNum(lk2);\n }\n //if k==1\n \n //for p\n after=kthNum(vl,1);\n lk1= kthNum(vl,k);\n lk2= nextNum(lk1);\n i=vl;\n for(;i<=vr;){//xet tat ca cac chu so trong [pl+1,pr]\n //if(vl==vr&&pl==pr&&pl==vr) break;\n sum+=lenthRt(pl,pr,lk1,lk2)*min(after-i+1,vr-i+1);\n //printf(\"%d to %d-> %d %d + them %lf*%d ->%lf\\n\",i,after,lk1,lk2,lenthRt(pl,pr,lk1,lk2),min(after-i+1,pr-i+1),sum);\n \n i=after+1;\n after=nextNum(after);\n lk1=lk2;\n if(lk1>pr) break;\n lk2=nextNum(lk2);\n }\n mau=(pr-pl+1);\n mau*= (vr-vl+1);\n //printf(\"%lf %lf\");\n //printf(\"%lf %lf\\n\",sum,mau);\n kq=sum/mau;\n \n printf(\"%.12lf\",kq);\n return 0;\n}"}, {"source_code": "/* practice with Dukkha */\n#include \n\n#define A\t1000000000\n\nint min(int a, int b) { return a < b ? a : b; }\nint max(int a, int b) { return a > b ? a : b; }\n\nlong long lucky(int i) {\n\treturn i == 1 ? 0 : lucky(i / 2) * 10 + (i % 2 == 0 ? 4 : 7);\n}\n\nint intersect(int al, int ar, int bl, int br) {\n\tint l = max(al, bl);\n\tint r = min(ar, br);\n\n\treturn max(r - l + 1, 0);\n}\n\nint main() {\n\tstatic int qq[1024];\n\tint ul, ur, vl, vr, k, cnt, i, j;\n\tlong long a, cnt_;\n\n\tscanf(\"%d%d%d%d%d\", &ul, &ur, &vl, &vr, &k);\n\tcnt = 0;\n\tqq[cnt++] = 0;\n\tfor (i = 2; (a = lucky(i)) <= A; i++)\n\t\tqq[cnt++] = a;\n\tqq[cnt++] = A + 1;\n\tcnt_ = 0;\n\tfor (i = 1; (j = i + k - 1) < cnt - 1; i++) {\n\t\tint pl = qq[i - 1] + 1, pr = qq[i];\n\t\tint ql = qq[j], qr = qq[j + 1] - 1;\n\n\t\tcnt_ += (long long) intersect(ul, ur, pl, pr) * intersect(vl, vr, ql, qr);\n\t\tcnt_ += (long long) intersect(ul, ur, ql, qr) * intersect(vl, vr, pl, pr);\n\t\tif (i == j && ul <= qq[i] && qq[i] <= ur && vl <= qq[i] && qq[i] <= vr)\n\t\t\tcnt_--;\n\t}\n\tprintf(\"%.9f\\n\", (double) cnt_ / (ur - ul + 1) / (vr - vl + 1));\n\treturn 0;\n}\n"}, {"source_code": "#include \n#define abs(a) (((a) < 0) ? (-(a)) : (a))\n#define max(a, b) (((a) > (b)) ? (a) : (b))\n#define min(a, b) (((a) < (b)) ? (a) : (b))\n\nlong long a[2500];\nint m;\n\nvoid\ngen(int n, int i, long long num)\n{\n if(i == n){\n a[m++] = num;\n } else {\n gen(n, i + 1, num * 10 + 4);\n gen(n, i + 1, num * 10 + 7);\n }\n}\n\nvoid\nswap(long long *a, long long *b)\n{\n long long tmp = *a;\n *a = *b;\n *b = tmp;\n}\n\nlong long p_l, p_r, v_l, v_r, all, good, trash;\nint k;\n\nint\nmain(void)\n{\n a[m++] = 0;\n int i, j;\n for(i = 1; i <= 10; ++i)\n gen(i, 0, 0);\n scanf(\"%I64d%I64d%I64d%I64d%d\", &p_l, &p_r, &v_l, &v_r, &k);\n all = (p_r - p_l + 1) * (v_r - v_l + 1);\n for(j = 0; j < 2; ++j){\n for(i = 1; i + k < m; ++i){\n long long l1 = max(a[i - 1], p_l),\n r1 = min(a[i], p_r);\n if(l1 == a[i - 1]) ++l1;\n long long l2 = max(a[i + k - 1], v_l),\n r2 = min(a[i + k], v_r);\n if(r2 == a[i + k]) --r2;\n if(l1 <= r1 && l2 <= r2){\n good += (r1 - l1 + 1) * (r2 - l2 + 1);\n }\n if(k == 1 && r1 == a[i] && l2 == a[i]){\n ++trash;\n }\n }\n swap(&p_l, &v_l);\n swap(&p_r, &v_r);\n }\n good -= trash / 2;\n double ans = (double)good / all;\n printf(\"%.15lf\", ans);\n return 0;\n}\n"}, {"source_code": "#include\n\nint a[20000];\nint pl,pr,vl,vr;\n\nlong long cal(int a1,int a2,int b1,int b2) {\n\tif (pl>a1) a1=pl;\n\tif (pra2) return 0;\n\tif (vl>b1) b1=vl;\n\tif (vrb2) return 0;\n\treturn (long long)(a2-a1+1)*(b2-b1+1);\n}\n\nint main() {\n\tint i,j,t,k;\n\tlong long t1,t2;\n\tt=0;\n\ta[0]=0;\n\tt++;\n\tfor(i=0;i=100000000) continue;\n\t\ta[t++]=a[i]*10+4;\n\t\ta[t++]=a[i]*10+7;\n\t}\n\ta[t]=1000000001;\n\tscanf(\"%d %d %d %d %d\",&pl,&pr,&vl,&vr,&k);\n\tt2=(long long)(pr-pl+1)*(vr-vl+1);\n\tt1=0;\n\tfor(i=1;i<=t-k;i++) {\n\t\tt1+=cal(a[i-1]+1,a[i],a[i+k-1],a[i+k]-1);\n\t\tt1+=cal(a[i+k-1],a[i+k]-1,a[i-1]+1,a[i]);\n\t\tif (k==1) t1-=cal(a[i],a[i],a[i],a[i]);\n\t}\n\tprintf(\"%.10lf\\n\",(double)t1/t2);\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n#include \n#define MAXN 100005\n\nstatic int a[MAXN];\nint ac;\n\nvoid GenNum (int now, int len, int num)\n{\n\tif (now == len)\n\t{\n\t\ta[ac] = num;\n\t\tac++;\n\t}\n\telse\n\t{\n\t\tGenNum(now+1,len,num*10+4);\n\t\tGenNum(now+1,len,num*10+7);\n\t}\n}\n\nint main ()\n{\n\ta[0] = 0;\n\tac = 1;\n\tint i;\n\tfor (i = 1; i <= 9; i++) GenNum(0,i,0);\n\ta[ac] = 1000000001;\n\tac++;\n\tint A, B, C, D, N;\n\tdouble res = 0.0;\n\tscanf(\"%d %d %d %d %d\",&A,&B,&C,&D,&N);\n\tint l1, r1, l2, r2, x1, y1, x2, y2;\n\tfor (i = 1; (i+N) < ac; i++)\n\t{\n\t\tl1 = a[i-1] + 1;\n\t\tr1 = a[i];\n\t\tl2 = a[i+N-1];\n\t\tr2 = a[i+N] - 1;\n\n\t\tif (l1 > A) x1 = l1;\n\t\telse x1 = A;\n\t\tif (r1 < B) y1 = r1;\n\t\telse y1 = B;\n\t\tif (l2 > C) x2 = l2;\n\t\telse x2 = C;\n\t\tif (r2 < D) y2 = r2;\n\t\telse y2 = D;\n\t\tif ((y1 >= x1) && (y2 >= x2)) res += (((double)(y1-x1+1) / (double)(B-A+1)) * ((double)(y2-x2+1) / (double)(D-C+1)));\n\t\t\t\t\n\t\tif (l1 > C) x1 = l1;\n\t\telse x1 = C;\n\t\tif (r1 < D) y1 = r1;\n\t\telse y1 = D;\n\t\tif (l2 > A) x2 = l2;\n\t\telse x2 = A;\n\t\tif (r2 < B) y2 = r2;\n\t\telse y2 = B;\n\t\tif ((y1 >= x1) && (y2 >= x2)) res += (((double)(y1-x1+1) / (double)(D-C+1)) * ((double)(y2-x2+1) / (double)(B-A+1)));\n\n\t\tif ((N == 1) && (a[i] >= A) && (a[i] <= B) && (a[i] >= C) && (a[i] <= D)) res -= ((1.0 / (double)(B-A+1)) * (1.0 / (double)(D-C+1)));\n\t}\n\tprintf(\"%.10lf\\n\",res);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n#include \n#define oo 1000000001\n#define eps 1e-7\n#define E 2.7182818284590452353602874713527\n#define pi 3.1415926535897932384626433832795\n#define zero(a) (abb(a)(b)?(a):(b))\n#define abb(a) ((a)>0?(a):(-(a)))\n#define cj(x1,y1,x2,y2) ((x1)*(y2)-(x2)*(y2))\n#define dj(x1,y1,x2,y2) ((x1)*(y1)+(y1)*(y2))\n#define dis(x1,y1,x2,y2) sqrt(((x2)-(x1))*((x2)-(x1))+((y2)-(y1))*((y2)-(y1)))\n\nint f[2222];\n\nint main()\n{\n int i,l1,l2,r1,r2,l3,l4,r3,r4,k,ll1,rr1,ll2,rr2,o=0;\n long long s=0;\n for (i=0;i<=o;i++)\n {\n if ((long long)f[i]*10+4<=1000000000)\n f[++o]=f[i]*10+4;\n if ((long long)f[i]*10+7<=1000000000)\n f[++o]=f[i]*10+7;\n }\n f[o+1]=oo;\n scanf(\"%d%d%d%d%d\",&l1,&r1,&l2,&r2,&k);\n for (i=1;i+k-1<=o;i++)\n {\n l3=f[i-1]+1;\n r3=f[i];\n l4=f[i+k-1];\n r4=f[i+k]-1;\n ll1=max(l1,l3);\n rr1=min(r1,r3);\n ll2=max(l2,l4);\n rr2=min(r2,r4);\n if (ll1<=rr1&&ll2<=rr2)\n s+=(long long)(rr1-ll1+1)*(rr2-ll2+1);\n ll1=max(l1,l4);\n rr1=min(r1,r4);\n ll2=max(l2,l3);\n rr2=min(r2,r3);\n if (ll1<=rr1&&ll2<=rr2)\n s+=(long long)(rr1-ll1+1)*(rr2-ll2+1);\n if (r3==l4&&r3>=l1&&r3<=r1&&r3>=l2&&r3<=r2)\n s--;\n }\n printf(\"%.15lf\\n\",1.0*s/(r1-l1+1)/(r2-l2+1));\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include \ntypedef long long ll;\n\nll lucky[2000];\nint nl;\n\n#define MIN(a,b) ab?a:b\n\nll count2(ll minlow,ll maxlow,ll minhigh,ll maxhigh,ll pl,ll pr,ll vl,ll vr) {\n ll res=0;\n ll aa,ab,ba,bb,x,y;\n aa=MAX(pl,minlow);\n ab=MIN(pr,maxlow);\n ba=MAX(vl,minhigh);\n bb=MIN(vr,maxhigh);\n x=ab-aa+1;\n y=bb-ba+1;\n if(x>0 && y>0) res+=x*y;\n return res;\n}\n\nll count3(ll minlow,ll maxlow,ll minhigh,ll maxhigh,ll pl,ll pr,ll vl,ll vr) {\n ll res=0;\n ll aa,ab,ba,bb,x,y;\n pl=MAX(pl,vl);\n pr=MIN(pr,vr);\n if(pl>pr) return 0;\n aa=MAX(minlow,pl);\n ab=MIN(maxlow,pr);\n ba=MAX(minhigh,pl);\n bb=MIN(maxhigh,pr);\n x=ab-aa+1;\n y=bb-ba+1;\n if(x>0 && y>0) res+=x+y;\n return res;\n}\n\nll count(ll minlow,ll maxlow,ll minhigh,ll maxhigh,ll pl,ll pr,ll vl,ll vr) {\n ll res=0;\n res+=count2(minlow,maxlow,minhigh,maxhigh,pl,pr,vl,vr);\n res+=count2(minlow,maxlow,minhigh,maxhigh,vl,vr,pl,pr);\n// res-=count3(minlow,maxlow,minhigh,maxhigh,vl,vr,pl,pr);\n return res;\n}\n\nint main() {\n int i,j,k,K,maks,min;\n ll tall,tot,yes;\n int pl,pr,vl,vr;\n\n nl=0;\n lucky[nl++]=0;\n for(i=1;i<10;i++) {\n for(j=0;j<(1<vr?pr:vr;\n min=pl=nl) break;\n if(lucky[i+K]>maks) break;\n/* printf(\"try %I64d %I64d %I64d %I64d\\n\",lucky[i]+1,lucky[i+1],lucky[i+K],lucky[i+K+1]-1);*/\n yes+=count(lucky[i]+1,lucky[i+1],lucky[i+K],lucky[i+K+1]-1,pl,pr,vl,vr);\n }\n if(K==1) {\n for(i=1;i=vl && lucky[i]>=pl && lucky[i]<=vr && lucky[i]<=pr) yes--;\n }\n }\n printf(\"%.12f\\n\",(double)((long double)yes/tot));\n goto again;\n return 0;\n}\n"}, {"source_code": "#include \ntypedef long long ll;\n\nll lucky[2000];\nint nl;\n\n#define MIN(a,b) ab?a:b\n\nll count2(ll minlow,ll maxlow,ll minhigh,ll maxhigh,ll pl,ll pr,ll vl,ll vr) {\n ll res=0;\n ll aa,ab,ba,bb,x,y;\n aa=MAX(pl,minlow);\n ab=MIN(pr,maxlow);\n ba=MAX(vl,minhigh);\n bb=MIN(vr,maxhigh);\n x=ab-aa+1;\n y=bb-ba+1;\n if(x>0 && y>0) res+=x*y;\n return res;\n}\n\nll count3(ll minlow,ll maxlow,ll minhigh,ll maxhigh,ll pl,ll pr,ll vl,ll vr) {\n ll res=0;\n ll aa,ab,ba,bb,x,y;\n pl=MAX(pl,vl);\n pr=MIN(pr,vr);\n if(pl>pr) return 0;\n aa=MAX(minlow,pl);\n ab=MIN(maxlow,pr);\n ba=MAX(minhigh,pl);\n bb=MIN(maxhigh,pr);\n x=ab-aa+1;\n y=bb-ba+1;\n if(x>0 && y>0) res+=x+y;\n return res;\n}\n\nll count(ll minlow,ll maxlow,ll minhigh,ll maxhigh,ll pl,ll pr,ll vl,ll vr) {\n ll res=0;\n res+=count2(minlow,maxlow,minhigh,maxhigh,pl,pr,vl,vr);\n res+=count2(minlow,maxlow,minhigh,maxhigh,vl,vr,pl,pr);\n// res-=count3(minlow,maxlow,minhigh,maxhigh,vl,vr,pl,pr);\n return res;\n}\n\nint main() {\n int i,j,k,K,maks,min;\n ll tall,tot,yes;\n int pl,pr,vl,vr;\n\n nl=0;\n lucky[nl++]=0;\n for(i=1;i<10;i++) {\n for(j=0;j<(1<vr?pr:vr;\n min=pl=nl) break;\n if(lucky[i+K]>maks) break;\n/* printf(\"try %I64d %I64d %I64d %I64d\\n\",lucky[i]+1,lucky[i+1],lucky[i+K],lucky[i+K+1]-1);*/\n yes+=count(lucky[i]+1,lucky[i+1],lucky[i+K],lucky[i+K+1]-1,pl,pr,vl,vr);\n }\n if(K==1) {\n for(i=1;i=vl && lucky[i]>=pl && lucky[i]<=vr && lucky[i]<=pr) yes--;\n }\n }\n printf(\"%.12f\\n\",(double)yes/tot);\n goto again;\n return 0;\n}\n"}, {"source_code": "#include \ntypedef long long ll;\n\nll lucky[2000];\nint nl;\n\n#define MIN(a,b) ab?a:b\n\nll count2(ll minlow,ll maxlow,ll minhigh,ll maxhigh,ll pl,ll pr,ll vl,ll vr) {\n ll res=0;\n ll aa,ab,ba,bb,x,y;\n aa=MAX(pl,minlow);\n ab=MIN(pr,maxlow);\n ba=MAX(vl,minhigh);\n bb=MIN(vr,maxhigh);\n x=ab-aa+1;\n y=bb-ba+1;\n if(x>0 && y>0) res+=x*y;\n return res;\n}\n\nll count(ll minlow,ll maxlow,ll minhigh,ll maxhigh,ll pl,ll pr,ll vl,ll vr) {\n ll res=0;\n res+=count2(minlow,maxlow,minhigh,maxhigh,pl,pr,vl,vr);\n res+=count2(minlow,maxlow,minhigh,maxhigh,vl,vr,pl,pr);\n return res;\n}\n\nint main() {\n int i,j,k,K,maks,min;\n ll tall,tot,yes=0;\n int pl,pr,vl,vr;\n scanf(\"%d %d %d %d %d\",&pl,&pr,&vl,&vr,&K);\n tot=(pr-pl+1LL)*(vr-vl+1LL);\n maks=pr>vr?pr:vr;\n min=pl=nl) break;\n if(lucky[i+K]>maks) break;\n/* printf(\"try %I64d %I64d %I64d %I64d\\n\",lucky[i],lucky[i+1],lucky[i+K],lucky[i+K+1]);*/\n yes+=count(lucky[i]+1,lucky[i+1],lucky[i+K],lucky[i+K+1]-1,pl,pr,vl,vr);\n }\n if(K==1) {\n for(i=1;i=pl && tall<=pr && tall>=vl && tall<=vr) yes--;\n }\n }\n printf(\"%.12f\\n\",(double)yes/tot);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint cmp(const void *a, const void *b)\n{\n return *((int *)a) - *((int *)b);\n}\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 a[1000];\n int p = 0, q = 1, x = 1, i, j;\n int pl, pr, vl, vr, k;\n long long c = 0, d;\n\n a[0] = 0;\n\n for (i = 0; i < 8; i++) {\n\t for (j = p; j < q; j++) {\n\t a[x++] = a[j] * 10 + 4;\n\t a[x++] = a[j] * 10 + 7;\n\t }\n\n\t p = q; q = x;\n }\n\n qsort(a, x, sizeof(int), cmp);\n\n a[x] = 1000000001;\n\n scanf(\"%d %d %d %d %d\", &pl, &pr, &vl, &vr, &k);\n\n d = (long long)(pr - pl + 1) * (vr - vl + 1);\n\n for (i = 1; i <= x - k; i++) {\n\t if (pl <= a[i] && vr >= a[i + k - 1]) {\n\t int s1 = minimum(a[i], pr);\n\t int s2 = maximum(a[i - 1], pl);\n\t int t1 = maximum(a[i + k - 1], vl);\n\t int t2 = minimum(a[i + k], vr);\n\n\t if (s1 - s2 >= 0 && t2 - t1 >= 0) {\n\t\t c += (long long)(s1 - s2 + 1) * (t2 - t1 + 1);\n\n\t\t if (pr >= a[i] && vl <= a[i + k] && vr >= a[i + k]) c--;\n\t\t if (pl <= a[i - 1] && pr >= a[i - 1] && vl <= a[i + k - 1]) c--;\n\t }\n\t }\n\t if (vl <= a[i] && pr >= a[i + k - 1]) {\n\t int s1 = minimum(a[i], vr);\n\t int s2 = maximum(a[i - 1], vl);\n\t int t1 = maximum(a[i + k - 1], pl);\n\t int t2 = minimum(a[i + k], pr);\n\n\t if (s1 - s2 >= 0 && t2 - t1 >= 0) {\n\t\t c += (long long)(s1 - s2 + 1) * (t2 - t1 + 1);\n\n\t\t if (vr >= a[i] && pl <= a[i + k] && pr >= a[i + k]) c--;\n\t\t if (vl <= a[i - 1] && vr >= a[i - 1] && pl <= a[i + k - 1]) c--;\n\t }\n\t }\n }\n\n for (i = 0; i <= x - k; i++) {\n\t if (pl <= a[i] && pr >= a[i] && vl <= a[i + k] && vr >= a[i + k]) c++;\n\t if (vl <= a[i] && vr >= a[i] && pl <= a[i + k] && pr >= a[i + k]) c++;\n }\n\n printf(\"%.20lf\\n\", (double)c / d);\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint cmp(const void *a, const void *b)\n{\n return *((int *)a) - *((int *)b);\n}\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 a[1000];\n int p = 0, q = 1, x = 1, i, j;\n int pl, pr, vl, vr, k;\n long long c = 0, d;\n\n a[0] = 0;\n\n for (i = 0; i < 8; i++) {\n\t for (j = p; j < q; j++) {\n\t a[x++] = a[j] * 10 + 4;\n\t a[x++] = a[j] * 10 + 7;\n\t }\n\n\t p = q; q = x;\n }\n\n qsort(a, x, sizeof(int), cmp);\n\n a[x] = 1000000000;\n\n scanf(\"%d %d %d %d %d\", &pl, &pr, &vl, &vr, &k);\n\n d = (long long)(pr - pl + 1) * (vr - vl + 1);\n\n for (i = 1; i <= x - k; i++) {\n\t if (pl <= a[i] && vr >= a[i + k - 1]) {\n\t int s1 = minimum(a[i], pr);\n\t int s2 = maximum(a[i - 1], pl);\n\t int t1 = maximum(a[i + k - 1], vl);\n\t int t2 = minimum(a[i + k], vr);\n\n\t if (s1 - s2 >= 0 && t2 - t1 >= 0) {\n\t\t c += (long long)(s1 - s2 + 1) * (t2 - t1 + 1);\n\t }\n\t }\n\t if (vl <= a[i] && pr >= a[i + k - 1]) {\n\t int s1 = minimum(a[i], vr);\n\t int s2 = maximum(a[i - 1], vl);\n\t int t1 = maximum(a[i + k - 1], pl);\n\t int t2 = minimum(a[i + k], pr);\n\n\t if (s1 - s2 >= 0 && t2 - t1 >= 0) {\n\t\t c += (long long)(s1 - s2 + 1) * (t2 - t1 + 1);\n\t }\n\t }\n }\n\n printf(\"%.20lf\\n\", (double)c / d);\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint cmp(const void *a, const void *b)\n{\n return *((int *)a) - *((int *)b);\n}\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 a[1000];\n int p = 0, q = 1, x = 1, i, j;\n int pl, pr, vl, vr, k;\n long long c = 0, d;\n\n a[0] = 0;\n\n for (i = 0; i < 8; i++) {\n\t for (j = p; j < q; j++) {\n\t a[x++] = a[j] * 10 + 4;\n\t a[x++] = a[j] * 10 + 7;\n\t }\n\n\t p = q; q = x;\n }\n\n qsort(a, x, sizeof(int), cmp);\n\n a[x] = 1000000000;\n\n scanf(\"%d %d %d %d %d\", &pl, &pr, &vl, &vr, &k);\n\n d = (long long)(pr - pl + 1) * (vr - vl + 1);\n\n for (i = 1; i <= x - k; i++) {\n\t if (pl <= a[i] && vr >= a[i + k - 1]) {\n\t int s1 = minimum(a[i], pr);\n\t int s2 = maximum(a[i - 1], pl);\n\t int t1 = maximum(a[i + k - 1], vl);\n\t int t2 = minimum(a[i + k], vr);\n\t long long m = (long long)(s1 - s2 + 1) * (t2 - t1 + 1);\n\n\t if (m > 0) c += m;\n\t }\n\t if (vl <= a[i] && pr >= a[i + k - 1]) {\n\t int s1 = minimum(a[i], vr);\n\t int s2 = maximum(a[i - 1], vl);\n\t int t1 = maximum(a[i + k - 1], pl);\n\t int t2 = minimum(a[i + k], pr);\n\t long long m = (long long)(s1 - s2 + 1) * (t2 - t1 + 1);\n\n\t if (m > 0) c += m;\n\t }\n }\n\n printf(\"%.20lf\\n\", (double)c / d);\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint cmp(const void *a, const void *b)\n{\n return *((int *)a) - *((int *)b);\n}\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 a[1000];\n int p = 0, q = 2, x = 2, i, j;\n int pl, pr, vl, vr, k;\n long long c = 0, d;\n\n a[0] = 4; a[1] = 7;\n\n for (i = 0; i < 7; i++) {\n\t for (j = p; j < q; j++) {\n\t a[x++] = a[j] * 10 + 4;\n\t a[x++] = a[j] * 10 + 7;\n\t }\n\n\t p = q; q = x;\n }\n\n qsort(a, x, sizeof(int), cmp);\n\n scanf(\"%d %d %d %d %d\", &pl, &pr, &vl, &vr, &k);\n\n d = (long long)(pr - pl + 1) * (vr - vl + 1);\n\n for (i = 0; i <= x - k; i++) {\n\t if (pl <= a[i] && vr >= a[i + k - 1]) {\n\t int s = minimum(a[i], pr);\n\t int t = maximum(a[i + k - 1], vl);\n\n\t c += (long long)(s - pl + 1) * (vr - t + 1);\n\n\t pl = s + 1; vr = t - 1;\n\t }\n\t if (vl <= a[i] && pr >= a[i + k - 1]) {\n\t int s = minimum(a[i], vr);\n\t int t = maximum(a[i + k - 1], pl);\n\n\t c += (long long)(s - vl + 1) * (pr - t + 1);\n\n\t vl = s + 1; pr = t - 1;\n\t }\n }\n\n printf(\"%.20lf\\n\", (double)c / d);\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint cmp(const void *a, const void *b)\n{\n return *((int *)a) - *((int *)b);\n}\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 a[1000];\n int p = 0, q = 1, x = 1, i, j;\n int pl, pr, vl, vr, k;\n long long c = 0, d;\n\n a[0] = 0;\n\n for (i = 0; i < 8; i++) {\n\t for (j = p; j < q; j++) {\n\t a[x++] = a[j] * 10 + 4;\n\t a[x++] = a[j] * 10 + 7;\n\t }\n\n\t p = q; q = x;\n }\n\n qsort(a, x, sizeof(int), cmp);\n\n a[x] = 1000000000;\n\n scanf(\"%d %d %d %d %d\", &pl, &pr, &vl, &vr, &k);\n\n d = (long long)(pr - pl + 1) * (vr - vl + 1);\n\n for (i = 1; i <= x - k; i++) {\n\t if (pl <= a[i] && vr >= a[i + k - 1]) {\n\t int s1 = minimum(a[i], pr);\n\t int s2 = maximum(a[i - 1], pl);\n\t int t1 = maximum(a[i + k - 1], vl);\n\t int t2 = minimum(a[i + k], vr);\n\n\t c += (long long)(s1 - s2 + 1) * (t2 - t1 + 1);\n\t }\n\t if (vl <= a[i] && pr >= a[i + k - 1]) {\n\t int s1 = minimum(a[i], vr);\n\t int s2 = maximum(a[i - 1], vl);\n\t int t1 = maximum(a[i + k - 1], pl);\n\t int t2 = minimum(a[i + k], pr);\n\n\t c += (long long)(s1 - s2 + 1) * (t2 - t1 + 1);\n\t }\n }\n\n printf(\"%.20lf\\n\", (double)c / d);\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint cmp(const void *a, const void *b)\n{\n return *((int *)a) - *((int *)b);\n}\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 a[1000];\n int p = 0, q = 1, x = 1, i, j;\n int pl, pr, vl, vr, k;\n long long c = 0, d;\n\n a[0] = 0;\n\n for (i = 0; i < 8; i++) {\n\t for (j = p; j < q; j++) {\n\t a[x++] = a[j] * 10 + 4;\n\t a[x++] = a[j] * 10 + 7;\n\t }\n\n\t p = q; q = x;\n }\n\n qsort(a, x, sizeof(int), cmp);\n\n a[x] = 1000000001;\n\n scanf(\"%d %d %d %d %d\", &pl, &pr, &vl, &vr, &k);\n\n d = (long long)(pr - pl + 1) * (vr - vl + 1);\n\n for (i = 1; i <= x - k; i++) {\n\t if (pl <= a[i] && vr >= a[i + k - 1]) {\n\t int s1 = minimum(a[i], pr);\n\t int s2 = maximum(a[i - 1] + 1, pl);\n\t int t1 = maximum(a[i + k - 1], vl);\n\t int t2 = minimum(a[i + k] - 1, vr);\n\n\t if (s1 - s2 >= 0 && t2 - t1 >= 0) {\n\t\t c += (long long)(s1 - s2 + 1) * (t2 - t1 + 1);\n\t }\n\t }\n\t if (vl <= a[i] && pr >= a[i + k - 1]) {\n\t int s1 = minimum(a[i], vr);\n\t int s2 = maximum(a[i - 1] + 1, vl);\n\t int t1 = maximum(a[i + k - 1], pl);\n\t int t2 = minimum(a[i + k] - 1, pr);\n\n\t if (s1 - s2 >= 0 && t2 - t1 >= 0) {\n\t\t c += (long long)(s1 - s2 + 1) * (t2 - t1 + 1);\n\t }\n\t }\n }\n\n if (k == 1) {\n\t for (i = 1; i < x; i++) {\n\t if (pl <= a[i] && pr >= a[i] && vl <= a[i] && vr >= a[i]) c--;\n\t }\n }\n\n printf(\"%.20lf\\n\", (double)c / d);\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint cmp(const void *a, const void *b)\n{\n return *((int *)a) - *((int *)b);\n}\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 a[1000];\n int p = 0, q = 1, x = 1, i, j;\n int pl, pr, vl, vr, k;\n long long c = 0, d;\n\n a[0] = 0;\n\n for (i = 0; i < 8; i++) {\n\t for (j = p; j < q; j++) {\n\t a[x++] = a[j] * 10 + 4;\n\t a[x++] = a[j] * 10 + 7;\n\t }\n\n\t p = q; q = x;\n }\n\n qsort(a, x, sizeof(int), cmp);\n\n a[x] = 1000000000;\n\n scanf(\"%d %d %d %d %d\", &pl, &pr, &vl, &vr, &k);\n\n d = (long long)(pr - pl + 1) * (vr - vl + 1);\n\n for (i = 1; i <= x - k; i++) {\n\t if (pl <= a[i] && vr >= a[i + k - 1]) {\n\t int s1 = minimum(a[i], pr);\n\t int s2 = maximum(a[i - 1], pl);\n\t int t1 = maximum(a[i + k - 1], vl);\n\t int t2 = minimum(a[i + k], vr);\n\n\t if (s1 - s2 >= 0 && t2 - t1 >= 0) {\n\t\t c += (long long)(s1 - s2 + 1) * (t2 - t1 + 1);\n\n\t\t if (pr >= a[i] && vl <= a[i + k - 1]) c--;\n\t }\n\t }\n\t if (vl <= a[i] && pr >= a[i + k - 1]) {\n\t int s1 = minimum(a[i], vr);\n\t int s2 = maximum(a[i - 1], vl);\n\t int t1 = maximum(a[i + k - 1], pl);\n\t int t2 = minimum(a[i + k], pr);\n\n\t if (s1 - s2 >= 0 && t2 - t1 >= 0) {\n\t\t c += (long long)(s1 - s2 + 1) * (t2 - t1 + 1);\n\n\t\t if (vr >= a[i] && pl <= a[i + k - 1]) c--;\n\t }\n\t }\n }\n\n for (i = 1; i <= x - k; i++) {\n\t if (pl <= a[i] && pr >= a[i] && vl <= a[i + k - 1] && vr >= a[i + k - 1]) c++;\n\t if (vl <= a[i] && vr >= a[i] && pl <= a[i + k - 1] && pr >= a[i + k - 1]) c++;\n }\n\n printf(\"%.20lf\\n\", (double)c / d);\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint cmp(const void *a, const void *b)\n{\n return *((int *)a) - *((int *)b);\n}\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 a[1000];\n int p = 0, q = 1, x = 1, i, j;\n int pl, pr, vl, vr, k;\n long long c = 0, d;\n\n a[0] = 0;\n\n for (i = 0; i < 8; i++) {\n\t for (j = p; j < q; j++) {\n\t a[x++] = a[j] * 10 + 4;\n\t a[x++] = a[j] * 10 + 7;\n\t }\n\n\t p = q; q = x;\n }\n\n qsort(a, x, sizeof(int), cmp);\n\n a[x] = a[x + 1] = 1000000001;\n\n scanf(\"%d %d %d %d %d\", &pl, &pr, &vl, &vr, &k);\n\n d = (long long)(pr - pl + 1) * (vr - vl + 1);\n\n for (i = 1; i <= x - k; i++) {\n\t if (pl <= a[i] && vr >= a[i + k - 1]) {\n\t int s1 = minimum(a[i], pr);\n\t int s2 = maximum(a[i - 1], pl);\n\t int t1 = maximum(a[i + k - 1], vl);\n\t int t2 = minimum(a[i + k], vr);\n\n\t if (s1 - s2 >= 0 && t2 - t1 >= 0) {\n\t\t c += (long long)(s1 - s2 + 1) * (t2 - t1 + 1);\n\n\t\t if (pr >= a[i] && vl <= a[i + k - 1]) c--;\n\t\t if (pr >= a[i] && vl <= a[i + k] && vr >= a[i + k]) c--;\n\t\t if (pl <= a[i - 1] && pr >= a[i - 1] && vl <= a[i + k - 1]) c--;\n\t\t if (pl <= a[i - 1] && pr >= a[i - 1] && vl <= a[i + k] && vr >= a[i + k]) c--;\n\t }\n\t }\n\t if (vl <= a[i] && pr >= a[i + k - 1]) {\n\t int s1 = minimum(a[i], vr);\n\t int s2 = maximum(a[i - 1], vl);\n\t int t1 = maximum(a[i + k - 1], pl);\n\t int t2 = minimum(a[i + k], pr);\n\n\t if (s1 - s2 >= 0 && t2 - t1 >= 0) {\n\t\t c += (long long)(s1 - s2 + 1) * (t2 - t1 + 1);\n\n\t\t if (vr >= a[i] && pl <= a[i + k - 1]) c--;\n\t\t if (vr >= a[i] && pl <= a[i + k] && pr >= a[i + k]) c--;\n\t\t if (vl <= a[i - 1] && vr >= a[i - 1] && pl <= a[i + k - 1]) c--;\n\t\t if (vl <= a[i - 1] && vr >= a[i - 1] && pl <= a[i + k] && pr >= a[i + k]) c--;\n\t }\n\t }\n }\n\n for (i = 0; i <= x - k; i++) {\n\t if (pl <= a[i] && pr >= a[i]) {\n\t if (vl <= a[i + k - 1] && vr >= a[i + k - 1]) c++;\n\t if (vl <= a[i + k] && vr >= a[i + k]) c++;\n\t if (vl <= a[i + k + 1] && vr >= a[i + k + 1]) c++;\n\t }\n\t if (vl <= a[i] && vr >= a[i]) {\n\t if (pl <= a[i + k - 1] && pr >= a[i + k - 1]) c++;\n\t if (pl <= a[i + k] && pr >= a[i + k]) c++;\n\t if (pl <= a[i + k + 1] && pr >= a[i + k + 1]) c++;\n\t }\n }\n\n printf(\"%.20lf\\n\", (double)c / d);\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint cmp(const void *a, const void *b)\n{\n return *((int *)a) - *((int *)b);\n}\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 a[1000];\n int p = 0, q = 1, x = 1, i, j;\n int pl, pr, vl, vr, k;\n long long c = 0, d;\n\n a[0] = 0;\n\n for (i = 0; i < 8; i++) {\n\t for (j = p; j < q; j++) {\n\t a[x++] = a[j] * 10 + 4;\n\t a[x++] = a[j] * 10 + 7;\n\t }\n\n\t p = q; q = x;\n }\n\n qsort(a, x, sizeof(int), cmp);\n\n a[x] = 1000000001;\n\n scanf(\"%d %d %d %d %d\", &pl, &pr, &vl, &vr, &k);\n\n d = (long long)(pr - pl + 1) * (vr - vl + 1);\n\n for (i = 1; i <= x - k; i++) {\n\t if (pl <= a[i] && vr >= a[i + k - 1]) {\n\t int s1 = minimum(a[i], pr);\n\t int s2 = maximum(a[i - 1] + 1, pl);\n\t int t1 = maximum(a[i + k - 1], vl);\n\t int t2 = minimum(a[i + k] - 1, vr);\n\n\t if (s1 - s2 >= 0 && t2 - t1 >= 0) {\n\t\t c += (long long)(s1 - s2 + 1) * (t2 - t1 + 1);\n\t }\n\t }\n\t if (vl <= a[i] && pr >= a[i + k - 1]) {\n\t int s1 = minimum(a[i], vr);\n\t int s2 = maximum(a[i - 1] + 1, vl);\n\t int t1 = maximum(a[i + k - 1], pl);\n\t int t2 = minimum(a[i + k] - 1, pr);\n\n\t if (s1 - s2 >= 0 && t2 - t1 >= 0) {\n\t\t c += (long long)(s1 - s2 + 1) * (t2 - t1 + 1);\n\t }\n\t }\n }\n\n printf(\"%.20lf\\n\", (double)c / d);\n\n return 0;\n}\n"}, {"source_code": "#include \n\n#define MAX(a, b) ((a) > (b) ? (a) : (b))\n#define MIN(a, b) ((a) < (b) ? (a) : (b))\n\ntypedef long long ll;\n\nll y[1 << 11];\nll q[1 << 12];\n\nint init() {\n int n = 0, f = 0, r = 0;\n q[r ++] = 4;\n q[r ++] = 7;\n while (f < r) {\n y[n ++] = q[f];\n if (q[f] * 10 + 4 <= 1000000000) {\n q[r ++] = q[f] * 10 + 4;\n }\n if (q[f] * 10 + 7 <= 1000000000) {\n q[r ++] = q[f] * 10 + 7;\n }\n f ++;\n }\n return n;\n}\n\nint join(int a, int b, int c, int d) {\n int r1, r2;\n if (b < c || a > d) {\n return 0;\n }\n r1 = MAX(a, c);\n r2 = MIN(b, d);\n return (r2 - r1 + 1);\n}\n\nvoid func(int pl, int pr, int vl, int vr, int k, int n) {\n int i, t, _t, a, b, c, d, _a, _b, _c, _d;\n double ans = 0.;\n for (i = 0; i + k - 1 < n; i ++) { // left = i, right = i + k - 1\n if (i > 0) {\n a = MAX(pl, y[i - 1] + 1);\n }\n else {\n a = pl;\n }\n b = MIN(pr, y[i]);\n c = MAX(vl, y[i + k - 1]);\n if (i + k < n) {\n d = MIN(vr, y[i + k] - 1);\n }\n else {\n d = vr;\n }\n if (a <= b && c <= d) {\n ans += (double)(b - a + 1) / (double)(pr - pl + 1) * ((double)(d - c + 1) / (double)(vr - vl + 1));\n }\n if (i > 0) {\n _a = MAX(vl, y[i - 1] + 1);\n }\n else {\n _a = vl;\n }\n _b = MIN(vr, y[i]);\n _c = MAX(pl, y[i + k - 1]);\n if (i + k < n) {\n _d = MIN(pr, y[i + k] - 1);\n }\n else {\n _d = pr;\n }\n if (_a <= _b && _c <= _d) {\n ans += (double)(_b - _a + 1) / (double)(vr - vl + 1) * ((double)(_d - _c + 1) / (double)(pr - pl + 1));\n }\n t = join(a, b, _a, _b);\n _t = join(c, d, _c, _d);\n ans -= (t / (pr - pl + 1)) * (_t / (vr - vl + 1));\n }\n printf(\"%.11lf\\n\", ans);\n}\n\nint main() {\n int n, pl, pr, vl, vr, k;\n n = init();\n while (scanf(\"%d%d%d%d%d\", &pl, &pr, &vl, &vr, &k) == 5) {\n func(pl, pr, vl, vr, k, n);\n }\n return 0;\n}"}, {"source_code": "#include \n\n#define MAX(a, b) ((a) > (b) ? (a) : (b))\n#define MIN(a, b) ((a) < (b) ? (a) : (b))\n\ntypedef long long ll;\n\nll y[1 << 11];\nll q[1 << 12];\n\nint init() {\n int n = 0, f = 0, r = 0;\n q[r ++] = 4;\n q[r ++] = 7;\n while (f < r) {\n y[n ++] = q[f];\n if (q[f] * 10 + 4 <= 1000000000) {\n q[r ++] = q[f] * 10 + 4;\n }\n if (q[f] * 10 + 7 <= 1000000000) {\n q[r ++] = q[f] * 10 + 7;\n }\n f ++;\n }\n return n;\n}\n\nvoid func(int pl, int pr, int vl, int vr, int k, int n) {\n int i, a, b, c, d;\n double ans = 0.;\n for (i = 0; i + k - 1 < n; i ++) { // left = i, right = i + k - 1\n if (i > 0) {\n a = MAX(pl, y[i - 1] + 1);\n }\n else {\n a = pl;\n }\n b = MIN(pr, y[i]);\n c = MAX(vl, y[i + k - 1]);\n if (i + k < n) {\n d = MIN(vr, y[i + k] - 1);\n }\n else {\n d = vr;\n }\n if (a <= b && c <= d) {\n ans += (double)(b - a + 1) / (double)(pr - pl + 1) * ((double)(d - c + 1) / (double)(vr - vl + 1));\n }\n if (i > 0) {\n a = MAX(vl, y[i - 1] + 1);\n }\n else {\n a = vl;\n }\n b = MIN(vr, y[i]);\n c = MAX(pl, y[i + k - 1]);\n if (i + k < n) {\n d = MIN(pr, y[i + k] - 1);\n }\n else {\n d = pr;\n }\n if (a <= b && c <= d) {\n ans += (double)(b - a + 1) / (double)(pr - pl + 1) * ((double)(d - c + 1) / (double)(vr - vl + 1));\n }\n }\n printf(\"%.11lf\\n\", ans);\n}\n\nint main() {\n int n, pl, pr, vl, vr, k;\n n = init();\n while (scanf(\"%d%d%d%d%d\", &pl, &pr, &vl, &vr, &k) == 5) {\n func(pl, pr, vl, vr, k, n);\n }\n return 0;\n}"}, {"source_code": "// Lucky Probability.c\n// \n// Copyright 2011 Administrator \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 \n\ntypedef long long ll;\n\nint q[3000];\nint l[2000];\n\nint init()\n{\n int f = 0, r = 0, ret = 0;\n const int limit = 1000000000;\n q[r++] = 4;\n q[r++] = 7;\n while (f < r)\n {\n l[ret++] = q[f];\n if ((ll)q[f] * 10 + 4 < limit)\n {\n q[r++] = q[f] * 10 + 4;\n }\n if ((ll)q[f] * 10 + 7 < limit)\n {\n q[r++] = q[f] * 10 + 7;\n }\n f++;\n }\n return ret;\n}\n\nint left_choice(int i, int left, int right)\n{\n int a, b;\n if (i > 0)\n {\n if (l[i - 1] >= right)\n {\n return 0;\n }\n else if (l[i - 1] >= left)\n {\n a = l[i - 1] + 1;\n }\n else\n {\n a = left;\n }\n if (l[i] < left)\n {\n return 0;\n }\n else if (l[i] < right)\n {\n b = l[i];\n }\n else\n {\n b = right;\n }\n return b - a + 1;\n }\n else\n {\n if (l[i] < left)\n {\n return 0;\n }\n else if (l[i] < right)\n {\n return l[i] - left + 1;\n }\n else\n {\n return right - left + 1;\n }\n }\n}\n\nint right_choice(int i, int n, int left, int right)\n{\n int a, b;\n if (i < n - 1)\n {\n if (l[i + 1] <= left)\n {\n return 0;\n }\n else if (l[i + 1] <= right)\n {\n b = l[i + 1] - 1;\n }\n else\n {\n b = right;\n }\n if (l[i] > right)\n {\n return 0;\n }\n else if (l[i] > left)\n {\n a = l[i];\n }\n else\n {\n a = left;\n }\n return b - a + 1;\n }\n else\n {\n if (l[i] > right)\n {\n return 0;\n }\n else if (l[i] > left)\n {\n return right - l[i] + 1;\n }\n else\n {\n return right - left + 1;\n }\n }\n}\n\nvoid func(int pl, int pr, int vl, int vr, int k, int n)\n{\n double ans = 0.;\n int i, cp, cv;\n for (i = 0; i + k <= n; i++)\n {\n cp = left_choice(i, pl, pr);\n cv = right_choice(i + k - 1, n, vl, vr);\n ans += (double)cp / (double)(pr - pl + 1) * ((double)cv / (double)(vr - vl + 1));\n cp = right_choice(i + k - 1, n, pl, pr);\n cv = left_choice(i, vl, vr);\n ans += (double)cp / (double)(pr - pl + 1) * ((double)cv / (double)(vr - vl + 1));\n }\n printf(\"%.11lf\\n\", ans);\n}\n\nint main(int argc, char **argv)\n{\n int pl, pr, vl, vr, k, n;\n n = init();\n while (scanf(\"%d%d%d%d%d\", &pl, &pr, &vl, &vr, &k) == 5)\n {\n func(pl, pr, vl, vr, k, n);\n }\n return 0;\n}"}, {"source_code": "#include \nint checkIsLucky(int num){\n while(num>0){\n if(num%10!=4&&num%10!=7)return 0;\n num/=10;\n }\n return 1;\n}\nint nextNum(int num){\n int nextN;\n int count=1;\n int maxNextD=0;\n nextN=num;\n if(num>=777777777) return 1000000001;\n while(num>0){\n if(num%10==4){\n nextN+=count*3;\n nextN=nextN/(count)*count+maxNextD;\n break;\n }else{\n maxNextD*=10;\n maxNextD+=4;\n num/=10;\n count*=10;\n }\n }\n if(num>0) return nextN;\n else{\n maxNextD*=10;\n maxNextD+=4;\n return maxNextD;\n }\n}\n\nint max(int a,int b){\n if(a>b) return a;\n else return b;\n}\nint min(int a,int b){\n if(a>b) return b;\n else return a;\n}\nint kthNum(int begin,int k){\n int count=1;\n int rt=0,tmp=begin;\n while (tmp>0) {\n tmp/=10;\n rt*=10;\n rt+=4;\n }\n while(rt %d %d + them %lf*%d->%lf\\n\",i,after,lk1,lk2,lenthRt(vl,vr,lk1,lk2),min(after-i+1,pr-i+1),sum);\n\n i=after+1;\n after=nextNum(after);\n lk1=lk2;\n if(lk1>vr) break;\n lk2=nextNum(lk2);\n }\n \n //for p\n after=kthNum(vl,1);\n lk1= kthNum(vl,k);\n lk2= nextNum(lk1);\n i=vl;\n for(;i<=vr;){//xet tat ca cac chu so trong [pl+1,pr]\n \n sum+=lenthRt(pl,pr,lk1,lk2)*min(after-i+1,vr-i+1);\n //printf(\"%d to %d-> %d %d + them %lf*%d ->%lf\\n\",i,after,lk1,lk2,lenthRt(pl,pr,lk1,lk2),min(after-i+1,pr-i+1),sum);\n \n i=after+1;\n after=nextNum(after);\n lk1=lk2;\n if(lk1>pr) break;\n lk2=nextNum(lk2);\n }\n mau=(pr-pl+1);\n mau*= (vr-vl+1);\n //printf(\"%lf %lf\");\n //printf(\"%lf %lf\\n\",sum,mau);\n kq=sum/mau;\n printf(\"%.12lf\",kq);\n return 0;\n}"}, {"source_code": "#include \nint checkIsLucky(int num){\n while(num>0){\n if(num%10!=4&&num%10!=7)return 0;\n num/=10;\n }\n return 1;\n}\nint nextNum(int num){\n int nextN;\n int count=1;\n int maxNextD=0;\n nextN=num;\n if(num>=777777777) return 1000000001;\n while(num>0){\n if(num%10==4){\n nextN+=count*3;\n nextN=nextN/(count)*count+maxNextD;\n break;\n }else{\n maxNextD*=10;\n maxNextD+=4;\n num/=10;\n count*=10;\n }\n }\n if(num>0) return nextN;\n else{\n maxNextD*=10;\n maxNextD+=4;\n return maxNextD;\n }\n}\n\nint max(int a,int b){\n if(a>b) return a;\n else return b;\n}\nint min(int a,int b){\n if(a>b) return b;\n else return a;\n}\nint kthNum(int begin,int k){\n int count=1;\n int rt=0,tmp=begin;\n while (tmp>0) {\n tmp/=10;\n rt*=10;\n rt+=4;\n }\n while(rt %d %d + them %lf*%d->%lf\\n\",i,after,lk1,lk2,lenthRt(vl,vr,lk1,lk2),min(after-i+1,pr-i+1),sum);\n\n i=after+1;\n after=nextNum(after);\n lk1=lk2;\n if(lk1>vr) break;\n lk2=nextNum(lk2);\n }\n \n //for p\n after=kthNum(vl,1);\n lk1= kthNum(vl,k);\n lk2= nextNum(lk1);\n i=vl;\n for(;i<=vr;){//xet tat ca cac chu so trong [pl+1,pr]\n if(vl==vr&&pl==pr&&pl==vr) break;\n sum+=lenthRt(pl,pr,lk1,lk2)*min(after-i+1,vr-i+1);\n //printf(\"%d to %d-> %d %d + them %lf*%d ->%lf\\n\",i,after,lk1,lk2,lenthRt(pl,pr,lk1,lk2),min(after-i+1,pr-i+1),sum);\n \n i=after+1;\n after=nextNum(after);\n lk1=lk2;\n if(lk1>pr) break;\n lk2=nextNum(lk2);\n }\n mau=(pr-pl+1);\n mau*= (vr-vl+1);\n //printf(\"%lf %lf\");\n //printf(\"%lf %lf\\n\",sum,mau);\n kq=sum/mau;\n \n printf(\"%.12lf\",kq);\n return 0;\n}"}, {"source_code": "#include \nint checkIsLucky(unsigned int num){\n while(num>0){\n if(num%10!=4&&num%10!=7)return 0;\n num/=10;\n }\n return 1;\n}\nunsigned int nextNum(unsigned int num){\n unsigned int nextN;\n unsigned int count=1;\n unsigned int maxNextD=0;\n nextN=num;\n while(num>0){\n if(num%10==4){\n nextN+=count*3;\n nextN=nextN/(count)*count+maxNextD;\n break;\n }else{\n maxNextD*=10;\n maxNextD+=4;\n num/=10;\n count*=10;\n }\n }\n if(num>0) return nextN;\n else{\n maxNextD*=10;\n maxNextD+=4;\n return maxNextD;\n }\n}\n\nunsigned int max(unsigned int a,unsigned int b){\n if(a>b) return a;\n else return b;\n}\nunsigned int min(unsigned int a,unsigned int b){\n if(a>b) return b;\n else return a;\n}\nunsigned int kthNum(unsigned int begin,int k){\n int count=1;\n unsigned int rt=0,tmp=begin;\n while (tmp>0) {\n tmp/=10;\n rt*=10;\n rt+=4;\n }\n while(rt\nint checkIsLucky(unsigned int num){\n while(num>0){\n if(num%10!=4&&num%10!=7)return 0;\n num/=10;\n }\n return 1;\n}\nunsigned int nextNum(unsigned int num){\n unsigned int nextN;\n unsigned int count=1;\n unsigned int maxNextD=0;\n nextN=num;\n while(num>0){\n if(num%10==4){\n nextN+=count*3;\n break;\n }else{\n maxNextD*=10;\n maxNextD+=4;\n num/=10;\n count*=10;\n }\n }\n if(num>0) return nextN;\n else{\n maxNextD*=10;\n maxNextD+=4;\n return maxNextD;\n }\n}\n\nunsigned int max(unsigned int a,unsigned int b){\n if(a>b) return a;\n else return b;\n}\nunsigned int min(unsigned int a,unsigned int b){\n if(a>b) return b;\n else return a;\n}\nunsigned int kthNum(unsigned int begin,int k){\n int count=1;\n unsigned int rt=0,tmp=begin;\n while (tmp>0) {\n tmp/=10;\n rt*=10;\n rt+=4;\n }\n while(rt\nint checkIsLucky(int num){\n while(num>0){\n if(num%10!=4&&num%10!=7)return 0;\n num/=10;\n }\n return 1;\n}\nint nextNum(int num){\n int nextN;\n int count=1;\n int maxNextD=0;\n nextN=num;\n if(num>=777777777) return 1000000000;\n while(num>0){\n if(num%10==4){\n nextN+=count*3;\n nextN=nextN/(count)*count+maxNextD;\n break;\n }else{\n maxNextD*=10;\n maxNextD+=4;\n num/=10;\n count*=10;\n }\n }\n if(num>0) return nextN;\n else{\n maxNextD*=10;\n maxNextD+=4;\n return maxNextD;\n }\n}\n\nint max(int a,int b){\n if(a>b) return a;\n else return b;\n}\nint min(int a,int b){\n if(a>b) return b;\n else return a;\n}\nint kthNum(int begin,int k){\n int count=1;\n int rt=0,tmp=begin;\n while (tmp>0) {\n tmp/=10;\n rt*=10;\n rt+=4;\n }\n while(rt %d %d + them %d*%d\\n\",i,after,lk1,lk2,lenthRt(vl,vr,lk1,lk2),min(after-i+1,pr-i+1));\n \n sum+=lenthRt(vl,vr,lk1,lk2)*min(after-i+1,pr-i+1);\n i=after+1;\n after=nextNum(after);\n lk1=lk2;\n if(lk1>vr) break;\n lk2=nextNum(lk2);\n }\n \n //for p\n after=kthNum(vl,1);\n lk1= kthNum(vl,k);\n lk2= nextNum(lk1);\n i=vl;\n for(;i<=vr;){//xet tat ca cac chu so trong [pl+1,pr]\n \n //printf(\"%d to %d-> %d %d + them %d*%d\\n\",i,after,lk1,lk2,lenthRt(pl,pr,lk1,lk2),min(after-i+1,pr-i+1));\n sum+=lenthRt(pl,pr,lk1,lk2)*min(after-i+1,vr-i+1);\n i=after+1;\n after=nextNum(after);\n lk1=lk2;\n if(lk1>vr) break;\n lk2=nextNum(lk2);\n }\n mau=(pr-pl+1);\n mau*= (vr-vl+1);\n printf(\"%ld %ld\\n\",sum,mau);\n kq=sum/mau;\n printf(\"%.12lf\",kq);\n return 0;\n}"}, {"source_code": "#include \nint checkIsLucky(unsigned int num){\n while(num>0){\n if(num%10!=4&&num%10!=7)return 0;\n num/=10;\n }\n return 1;\n}\nunsigned int nextNum(unsigned int num){\n unsigned int nextN;\n unsigned int count=1;\n unsigned int maxNextD=0;\n nextN=num;\n while(num>0){\n if(num%10==4){\n nextN+=count*3;\n nextN=nextN/(count)*count+maxNextD;\n break;\n }else{\n maxNextD*=10;\n maxNextD+=4;\n num/=10;\n count*=10;\n }\n }\n if(num>0) return nextN;\n else{\n maxNextD*=10;\n maxNextD+=4;\n return maxNextD;\n }\n}\n\nunsigned int max(unsigned int a,unsigned int b){\n if(a>b) return a;\n else return b;\n}\nunsigned int min(unsigned int a,unsigned int b){\n if(a>b) return b;\n else return a;\n}\nunsigned int kthNum(unsigned int begin,int k){\n int count=1;\n unsigned int rt=0,tmp=begin;\n while (tmp>0) {\n tmp/=10;\n rt*=10;\n rt+=4;\n }\n while(rt %d %d + them %d*%d\\n\",i,after,lk1,lk2,lenthRt(vl,vr,lk1,lk2),(after-i+1));\n sum+=lenthRt(vl,vr,lk1,lk2)*(after-i+1);\n i=after+1;\n after=nextNum(after);\n lk1=lk2;\n if(lk1>vr) break;\n lk2=nextNum(lk2);\n }\n \n //for p\n after=kthNum(vl,1);\n lk1= kthNum(vl,k);\n lk2= nextNum(lk1);\n i=vl;\n for(;i<=vr;){//xet tat ca cac chu so trong [pl+1,pr]\n \n //printf(\"%d to %d-> %d %d + them %d*%d\\n\",i,after,lk1,lk2,lenthRt(vl,vr,lk1,lk2),(after-i+1));\n sum+=lenthRt(pl,pr,lk1,lk2)*(after-i+1);\n i=after+1;\n after=nextNum(after);\n lk1=lk2;\n if(lk1>vr) break;\n lk2=nextNum(lk2);\n }\n // printf(\"%ld %ld\\n\",sum,((pr-pl+1)*(vr-vl+1)));\n kq=sum*1.0/((pr-pl+1)*(vr-vl+1));\n printf(\"%.12lf\",kq);\n return 0;\n}"}, {"source_code": "#include \nint checkIsLucky(int num){\n while(num>0){\n if(num%10!=4&&num%10!=7)return 0;\n num/=10;\n }\n return 1;\n}\nint nextNum(int num){\n int nextN;\n int count=1;\n int maxNextD=0;\n nextN=num;\n if(num>=777777777) return 1000000001;\n while(num>0){\n if(num%10==4){\n nextN+=count*3;\n nextN=nextN/(count)*count+maxNextD;\n break;\n }else{\n maxNextD*=10;\n maxNextD+=4;\n num/=10;\n count*=10;\n }\n }\n if(num>0) return nextN;\n else{\n maxNextD*=10;\n maxNextD+=4;\n return maxNextD;\n }\n}\n\nint max(int a,int b){\n if(a>b) return a;\n else return b;\n}\nint min(int a,int b){\n if(a>b) return b;\n else return a;\n}\nint kthNum(int begin,int k){\n int count=1;\n int rt=0,tmp=begin;\n while (tmp>0) {\n tmp/=10;\n rt*=10;\n rt+=4;\n }\n while(rt %d %d + them %lf*%d->%lf\\n\",i,after,lk1,lk2,lenthRt(vl,vr,lk1,lk2),min(after-i+1,pr-i+1),sum);\n\n i=after+1;\n after=nextNum(after);\n lk1=lk2;\n if(lk1>vr) break;\n lk2=nextNum(lk2);\n }\n \n //for p\n after=kthNum(vl,1);\n lk1= kthNum(vl,k);\n lk2= nextNum(lk1);\n i=vl;\n for(;i<=vr;){//xet tat ca cac chu so trong [pl+1,pr]\n \n sum+=lenthRt(pl,pr,lk1,lk2)*min(after-i+1,vr-i+1);\n //printf(\"%d to %d-> %d %d + them %lf*%d ->%lf\\n\",i,after,lk1,lk2,lenthRt(pl,pr,lk1,lk2),min(after-i+1,pr-i+1),sum);\n \n i=after+1;\n after=nextNum(after);\n lk1=lk2;\n if(lk1>vr) break;\n lk2=nextNum(lk2);\n }\n mau=(pr-pl+1);\n mau*= (vr-vl+1);\n //printf(\"%lf %lf\");\n //printf(\"%lf %lf\\n\",sum,mau);\n kq=sum/mau;\n printf(\"%.12lf\",kq);\n return 0;\n}"}, {"source_code": "#include \nint checkIsLucky(int num){\n while(num>0){\n if(num%10!=4&&num%10!=7)return 0;\n num/=10;\n }\n return 1;\n}\nint nextNum(int num){\n int nextN;\n int count=1;\n int maxNextD=0;\n nextN=num;\n if(num>=777777777) return 1000000001;\n while(num>0){\n if(num%10==4){\n nextN+=count*3;\n nextN=nextN/(count)*count+maxNextD;\n break;\n }else{\n maxNextD*=10;\n maxNextD+=4;\n num/=10;\n count*=10;\n }\n }\n if(num>0) return nextN;\n else{\n maxNextD*=10;\n maxNextD+=4;\n return maxNextD;\n }\n}\n\nint max(int a,int b){\n if(a>b) return a;\n else return b;\n}\nint min(int a,int b){\n if(a>b) return b;\n else return a;\n}\nint kthNum(int begin,int k){\n int count=1;\n int rt=0,tmp=begin;\n while (tmp>0) {\n tmp/=10;\n rt*=10;\n rt+=4;\n }\n while(rt %d %d + them %lf*%d->%lf\\n\",i,after,lk1,lk2,lenthRt(vl,vr,lk1,lk2),min(after-i+1,pr-i+1),sum);\n\n i=after+1;\n after=nextNum(after);\n lk1=lk2;\n if(lk1>vr) break;\n lk2=nextNum(lk2);\n }\n \n //for p\n after=kthNum(vl,1);\n lk1= kthNum(vl,k);\n lk2= nextNum(lk1);\n i=vl;\n for(;i<=vr;){//xet tat ca cac chu so trong [pl+1,pr]\n if(vl==vr||pl==pr) break;\n sum+=lenthRt(pl,pr,lk1,lk2)*min(after-i+1,vr-i+1);\n //printf(\"%d to %d-> %d %d + them %lf*%d ->%lf\\n\",i,after,lk1,lk2,lenthRt(pl,pr,lk1,lk2),min(after-i+1,pr-i+1),sum);\n \n i=after+1;\n after=nextNum(after);\n lk1=lk2;\n if(lk1>pr) break;\n lk2=nextNum(lk2);\n }\n mau=(pr-pl+1);\n mau*= (vr-vl+1);\n //printf(\"%lf %lf\");\n //printf(\"%lf %lf\\n\",sum,mau);\n kq=sum/mau;\n \n printf(\"%.12lf\",kq);\n return 0;\n}"}, {"source_code": "#include \nint checkIsLucky(int num){\n while(num>0){\n if(num%10!=4&&num%10!=7)return 0;\n num/=10;\n }\n return 1;\n}\nint nextNum(int num){\n int nextN;\n int count=1;\n int maxNextD=0;\n nextN=num;\n if(num>=777777777) return 1000000000;\n while(num>0){\n if(num%10==4){\n nextN+=count*3;\n nextN=nextN/(count)*count+maxNextD;\n break;\n }else{\n maxNextD*=10;\n maxNextD+=4;\n num/=10;\n count*=10;\n }\n }\n if(num>0) return nextN;\n else{\n maxNextD*=10;\n maxNextD+=4;\n return maxNextD;\n }\n}\n\nint max(int a,int b){\n if(a>b) return a;\n else return b;\n}\nint min(int a,int b){\n if(a>b) return b;\n else return a;\n}\nint kthNum(int begin,int k){\n int count=1;\n int rt=0,tmp=begin;\n while (tmp>0) {\n tmp/=10;\n rt*=10;\n rt+=4;\n }\n while(rt %d %d + them %d*%d\\n\",i,after,lk1,lk2,lenthRt(vl,vr,lk1,lk2),min(after-i+1,pr-i+1));\n \n sum+=lenthRt(vl,vr,lk1,lk2)*min(after-i+1,pr-i+1);\n i=after+1;\n after=nextNum(after);\n lk1=lk2;\n if(lk1>vr) break;\n lk2=nextNum(lk2);\n }\n \n //for p\n after=kthNum(vl,1);\n lk1= kthNum(vl,k);\n lk2= nextNum(lk1);\n i=vl;\n for(;i<=vr;){//xet tat ca cac chu so trong [pl+1,pr]\n \n //printf(\"%d to %d-> %d %d + them %d*%d\\n\",i,after,lk1,lk2,lenthRt(pl,pr,lk1,lk2),min(after-i+1,pr-i+1));\n sum+=lenthRt(pl,pr,lk1,lk2)*min(after-i+1,vr-i+1);\n i=after+1;\n after=nextNum(after);\n lk1=lk2;\n if(lk1>vr) break;\n lk2=nextNum(lk2);\n }\n mau=(pr-pl+1);\n mau*= (vr-vl+1);\n //printf(\"%ld %ld\\n\",sum,mau);\n kq=sum/mau;\n printf(\"%.12lf\",kq);\n return 0;\n}"}, {"source_code": "/* practice with Dukkha */\n#include \n\n#define A\t1000000000\n\nint min(int a, int b) { return a < b ? a : b; }\nint max(int a, int b) { return a > b ? a : b; }\n\nlong long lucky(int i) {\n\treturn i == 1 ? 0 : lucky(i / 2) * 10 + (i % 2 == 0 ? 4 : 7);\n}\n\nint intersect(int al, int ar, int bl, int br) {\n\tint l = max(al, bl);\n\tint r = min(ar, br);\n\n\treturn max(r - l + 1, 0);\n}\n\nint main() {\n\tstatic int qq[1024];\n\tint ul, ur, vl, vr, k, cnt, i, j;\n\tlong long a, cnt_;\n\n\tscanf(\"%d%d%d%d%d\", &ul, &ur, &vl, &vr, &k);\n\tcnt = 0;\n\tqq[cnt++] = 0;\n\tfor (i = 2; (a = lucky(i)) <= A; i++)\n\t\tqq[cnt++] = a;\n\tqq[cnt++] = A + 1;\n\tcnt_ = 0;\n\tfor (i = 1; (j = i + k - 1) < cnt - 1; i++) {\n\t\tint pl = qq[i - 1] + 1, pr = qq[i];\n\t\tint ql = qq[j], qr = qq[j + 1] - 1;\n\n\t\tcnt_ += (long long) intersect(ul, ur, pl, pr) * intersect(vl, vr, ql, qr);\n\t\tcnt_ += (long long) intersect(ul, ur, ql, qr) * intersect(vl, vr, pl, pr);\n\t}\n\tprintf(\"%.9f\\n\", (double) cnt_ / (ur - ul + 1) / (vr - vl + 1));\n\treturn 0;\n}\n"}, {"source_code": "#include \nint checkIsLucky(unsigned int num){\n while(num>0){\n if(num%10!=4&&num%10!=7)return 0;\n num/=10;\n }\n return 1;\n}\nunsigned int nextNum(unsigned int num){\n unsigned int nextN;\n unsigned int count=1;\n unsigned int maxNextD=0;\n nextN=num;\n while(num>0){\n if(num%10==4){\n nextN+=count*3;\n nextN=nextN/(count)*count+maxNextD;\n break;\n }else{\n maxNextD*=10;\n maxNextD+=4;\n num/=10;\n count*=10;\n }\n }\n if(num>0) return nextN;\n else{\n maxNextD*=10;\n maxNextD+=4;\n return maxNextD;\n }\n}\n\nunsigned int max(unsigned int a,unsigned int b){\n if(a>b) return a;\n else return b;\n}\nunsigned int min(unsigned int a,unsigned int b){\n if(a>b) return b;\n else return a;\n}\nunsigned int kthNum(unsigned int begin,int k){\n int count=1;\n unsigned int rt=0,tmp=begin;\n while (tmp>0) {\n tmp/=10;\n rt*=10;\n rt+=4;\n }\n while(rt\n#define abs(a) (((a) < 0) ? (-(a)) : (a))\n#define max(a, b) (((a) > (b)) ? (a) : (b))\n#define min(a, b) (((a) < (b)) ? (a) : (b))\n\nlong long a[2500];\nint m;\n\nvoid\ngen(int n, int i, long long num)\n{\n if(i == n){\n a[m++] = num;\n } else {\n gen(n, i + 1, num * 10 + 4);\n gen(n, i + 1, num * 10 + 7);\n }\n}\n\nvoid\nswap(long long *a, long long *b)\n{\n long long tmp = *a;\n *a = *b;\n *b = tmp;\n}\n\nlong long p_l, p_r, v_l, v_r, all, good, p1, p2;\nint k;\n\nint\nmain(void)\n{\n a[m++] = 0;\n int i, j;\n for(i = 1; i <= 10; ++i)\n gen(i, 0, 0);\n scanf(\"%I64d%I64d%I64d%I64d%d\", &p_l, &p_r, &v_l, &v_r, &k);\n all = (p_r - p_l + 1) * (v_r - v_l + 1);\n for(j = 0; j < 2; ++j){\n for(i = 1; i + k < m; ++i){\n long long l1 = max(a[i - 1], p_l),\n r1 = min(a[i], p_r);\n if(l1 == a[i - 1]) ++l1;\n long long l2 = max(a[i + k - 1], v_l),\n r2 = min(a[i + k], v_r);\n if(r2 == a[i + k]) --r2;\n if(l1 <= r1 && l2 <= r2){\n good += (r1 - l1 + 1) * (r2 - l2 + 1);\n }\n }\n swap(&p_l, &v_l);\n swap(&p_r, &v_r);\n }\n printf(\"%I64d.\", good / all);\n good %= all;\n for(i = 0; i < 15; ++i){\n printf(\"%I64d\", (good * 10LL) / all);\n good = (good * 10) % all;\n }\n return 0;\n}\n"}, {"source_code": "#include \n#define abs(a) (((a) < 0) ? (-(a)) : (a))\n#define max(a, b) (((a) > (b)) ? (a) : (b))\n#define min(a, b) (((a) < (b)) ? (a) : (b))\n\nlong long a[2500];\nint m;\n\nvoid\ngen(int n, int i, long long num)\n{\n if(i == n){\n a[m++] = num;\n } else {\n gen(n, i + 1, num * 10 + 4);\n gen(n, i + 1, num * 10 + 7);\n }\n}\n\nvoid\nswap(long long *a, long long *b)\n{\n long long tmp = *a;\n *a = *b;\n *b = tmp;\n}\n\nlong long p_l, p_r, v_l, v_r, all, good, p1, p2;\nint k;\n\nint\nmain(void)\n{\n a[m++] = 0;\n int i, j;\n for(i = 1; i <= 10; ++i)\n gen(i, 0, 0);\n scanf(\"%I64d%I64d%I64d%I64d%d\", &p_l, &p_r, &v_l, &v_r, &k);\n all = (p_r - p_l + 1) * (v_r - v_l + 1);\n for(j = 0; j < 2; ++j){\n for(i = 1; i + k < m; ++i){\n long long l1 = max(a[i - 1], p_l),\n r1 = min(a[i], p_r);\n if(l1 == a[i - 1]) ++l1;\n long long l2 = max(a[i + k - 1], v_l),\n r2 = min(a[i + k], v_r);\n if(r2 == a[i + k]) --r2;\n if(l1 <= r1 && l2 <= r2){\n good += (r1 - l1 + 1) * (r2 - l2 + 1);\n }\n }\n swap(&p_l, &v_l);\n swap(&p_r, &v_r);\n }\n double ans = (double)good / all;\n printf(\"%.15lf\", ans);\n return 0;\n}\n"}, {"source_code": "#include \n#define abs(a) (((a) < 0) ? (-(a)) : (a))\n#define max(a, b) (((a) > (b)) ? (a) : (b))\n#define min(a, b) (((a) < (b)) ? (a) : (b))\n\nlong long a[2500];\nint m;\n\nvoid\ngen(int n, int i, long long num)\n{\n if(i == n){\n a[m++] = num;\n } else {\n gen(n, i + 1, num * 10 + 4);\n gen(n, i + 1, num * 10 + 7);\n }\n}\n\nlong long p_l, p_r, v_l, v_r, all, good, p1, p2;\nint k;\n\nint\nmain(void)\n{\n a[m++] = 0;\n int i, j;\n for(i = 1; i <= 10; ++i)\n gen(i, 0, 0);\n scanf(\"%I64d%I64d%I64d%I64d%d\", &p_l, &p_r, &v_l, &v_r, &k);\n all = (p_r - p_l + 1) * (v_r - v_l + 1);\n for(i = 1; i < m; ++i){\n if(p_l <= a[i] && a[i] <= p_r) ++p1;\n for(j = 1; j < m; ++j){\n if(v_l <= a[j] && a[j] <= v_r) ++p2;\n if(p_l <= a[i] && a[i] <= p_r && v_l <= a[j] && a[j] <= v_r){\n if(abs(i - j) + 1 == k){\n if(i <= j){\n long long l1 = max(a[i - 1], p_l);\n if (l1 != a[i - 1]) --l1;\n long long r2 = min(a[j + 1], v_r);\n if (r2 != a[j + 1]) ++r2;\n good += (a[i] - l1) * (r2 - a[j]);\n } else {\n long long r1 = min(a[i + 1], p_r);\n if(r1 != a[i + 1]) ++r1;\n long long l2 = max(a[j - 1], v_l);\n if(l2 != a[j - 1]) --l2;\n good += (r1 - a[i]) * (a[j] - l2);\n }\n\n }\n }\n }\n }\n if(p1 == 0 && p2 == 0){\n long long l1 = min(p_l, v_l);\n long long r1 = max(p_l, v_l);\n long long nm = 0;\n for(i = 1; i < m; ++i){\n if(l1 <= a[i] && a[i] <= r1) ++nm;\n }\n if(nm == k){\n good = all;\n } else {\n good = 0;\n }\n } else if(p1 == 0){\n for(i = 1; i < m; ++i){\n if(v_l <= a[i] && a[i] <= v_r){\n long long l1 = min(p_l, a[i]);\n long long r1 = max(p_l, a[i]);\n long long nm = 0;\n for(j = 1; j < m; ++j){\n if(l1 <= a[j] && a[j] <= r1){\n ++nm;\n }\n }\n if(nm == k){\n if(p_l <= a[i]){\n long long r2 = min(a[i + 1], v_r);\n if (r2 != a[i + 1]) ++r2;\n good += (r2 - a[i]) * (p_r - p_l + 1);\n } else {\n long long l2 = max(a[i - 1], v_l);\n if(l2 != a[i - 1]) --l2;\n good += (p_r - p_l + 1) * (a[i] - l2);\n }\n }\n }\n }\n } else if(p2 == 0){\n for(i = 1; i < m; ++i){\n if(p_l <= a[i] && a[i] <= p_r){\n long long l1 = min(v_l, a[i]);\n long long r1 = max(v_l, a[i]);\n long long nm = 0;\n for(j = 1; j < m; ++j){\n if(l1 <= a[j] && a[j] <= r1){\n ++nm;\n }\n }\n if(nm == k){\n if(v_l <= a[i]){\n long long r2 = min(a[i + 1], p_r);\n if (r2 != a[i + 1]) ++r2;\n good += (r2 - a[i]) * (v_r - v_l + 1);\n } else {\n long long l2 = max(a[i - 1], p_l);\n if(l2 != a[i - 1]) --l2;\n good += (v_r - v_l + 1) * (a[i] - l2);\n }\n }\n }\n }\n }\n printf(\"%I64d.\", good / all);\n good %= all;\n for(i = 0; i < 15; ++i){\n printf(\"%I64d\", (good * 10LL) / all);\n good = (good * 10) % all;\n }\n return 0;\n}\n"}, {"source_code": "#include\n\nint a[20000];\nint pl,pr,vl,vr;\n\nlong long cal(int a1,int a2,int b1,int b2) {\n\tif (pl>a1) a1=pl;\n\tif (pra2) return 0;\n\tif (vl>b1) b1=vl;\n\tif (vrb2) return 0;\n\treturn (long long)(a2-a1+1)*(b2-b1+1);\n}\n\nint main() {\n\tint i,j,t,k;\n\tlong long t1,t2;\n\tt=0;\n\ta[0]=0;\n\tt++;\n\tfor(i=0;i=100000000) continue;\n\t\ta[t++]=a[i]*10+4;\n\t\ta[t++]=a[i]*10+7;\n\t}\n\ta[t]=1000000000;\n\tscanf(\"%d %d %d %d %d\",&pl,&pr,&vl,&vr,&k);\n\tt2=(long long)(pr-pl+1)*(vr-vl+1);\n\tt1=0;\n\tfor(i=1;i<=t-k;i++) {\n\t\tt1+=cal(a[i-1],a[i],a[i+k-1],a[i+k]);\n\t\tt1+=cal(a[i+k-1],a[i+k],a[i-1],a[i]);\n\t\tif (k==1) t1-=cal(a[i],a[i],a[i],a[i]);\n\t}\n\tprintf(\"%.10lf\\n\",(double)t1/t2);\n\treturn 0;\n}"}, {"source_code": "#include\n\nint a[20000];\nint pl,pr,vl,vr;\n\nlong long cal(int a1,int a2,int b1,int b2) {\n\tif (pl>a1) a1=pl;\n\tif (pra2) return 0;\n\tif (vl>b1) b1=vl;\n\tif (vrb2) return 0;\n\treturn (long long)(a2-a1+1)*(b2-b1+1);\n}\n\nint main() {\n\tint i,j,t,k;\n\tlong long t1,t2;\n\tt=0;\n\ta[0]=0;\n\tt++;\n\tfor(i=0;i=100000000) continue;\n\t\ta[t++]=a[i]*10+4;\n\t\ta[t++]=a[i]*10+7;\n\t}\n\ta[t]=1000000000;\n\tscanf(\"%d %d %d %d %d\",&pl,&pr,&vl,&vr,&k);\n\tt2=(long long)(pr-pl+1)*(vr-vl+1);\n\tt1=0;\n\tfor(i=1;i<=t-k;i++) {\n\t\tt1+=cal(a[i-1],a[i],a[i+k-1],a[i+k]);\n\t\tt1+=cal(a[i+k-1],a[i+k],a[i-1],a[i]);\n\t}\n\tprintf(\"%.10lf\\n\",(double)t1/t2);\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n#include \n#define MAXN 100005\n\nstatic int a[MAXN];\nint ac;\n\nvoid GenNum (int now, int len, int num)\n{\n\tif (now == len)\n\t{\n\t\ta[ac] = num;\n\t\tac++;\n\t}\n\telse\n\t{\n\t\tGenNum(now+1,len,num*10+4);\n\t\tGenNum(now+1,len,num*10+7);\n\t}\n}\n\nint main ()\n{\n\ta[0] = 0;\n\tac = 1;\n\tint i;\n\tfor (i = 1; i <= 9; i++) GenNum(0,i,0);\n\ta[ac] = 1000000001;\n\tint A, B, C, D, N;\n\tdouble res = 0.0;\n\tscanf(\"%d %d %d %d %d\",&A,&B,&C,&D,&N);\n\tint l1, r1, l2, r2, x1, y1, x2, y2;\n\tfor (i = 1; (i+N) < ac; i++)\n\t{\n\t\tl1 = a[i-1] + 1;\n\t\tr1 = a[i];\n\t\tl2 = a[i+N-1];\n\t\tr2 = a[i+N] - 1;\n\n\t\tif (l1 > A) x1 = l1;\n\t\telse x1 = A;\n\t\tif (r1 < B) y1 = r1;\n\t\telse y1 = B;\n\t\tif (l2 > C) x2 = l2;\n\t\telse x2 = C;\n\t\tif (r2 < D) y2 = r2;\n\t\telse y2 = D;\n\t\tif ((y1 >= x1) && (y2 >= x2)) res += (((double)(y1-x1+1) / (double)(B-A+1)) * ((double)(y2-x2+1) / (double)(D-C+1)));\n\t\t\t\t\n\t\tif (l1 > C) x1 = l1;\n\t\telse x1 = C;\n\t\tif (r1 < D) y1 = r1;\n\t\telse y1 = D;\n\t\tif (l2 > A) x2 = l2;\n\t\telse x2 = A;\n\t\tif (r2 < B) y2 = r2;\n\t\telse y2 = B;\n\t\tif ((y1 >= x1) && (y2 >= x2)) res += (((double)(y1-x1+1) / (double)(D-C+1)) * ((double)(y2-x2+1) / (double)(B-A+1)));\n\n\t\tif ((N == 1) && (a[i] >= A) && (a[i] <= B) && (a[i] >= C) && (a[i] <= D)) res -= ((1.0 / (double)(B-A+1)) * (1.0 / (double)(D-C+1)));\n\t}\n\tprintf(\"%.10lf\\n\",res);\n\treturn 0;\n}\n"}], "src_uid": "5d76ec741a9d873ce9d7c3ef55eb984c"} {"nl": {"description": "Gerald got a very curious hexagon for his birthday. The boy found out that all the angles of the hexagon are equal to . Then he measured the length of its sides, and found that each of them is equal to an integer number of centimeters. There the properties of the hexagon ended and Gerald decided to draw on it.He painted a few lines, parallel to the sides of the hexagon. The lines split the hexagon into regular triangles with sides of 1 centimeter. Now Gerald wonders how many triangles he has got. But there were so many of them that Gerald lost the track of his counting. Help the boy count the triangles.", "input_spec": "The first and the single line of the input contains 6 space-separated integers a1, a2, a3, a4, a5 and a6 (1 ≤ ai ≤ 1000) — the lengths of the sides of the hexagons in centimeters in the clockwise order. It is guaranteed that the hexagon with the indicated properties and the exactly such sides exists.", "output_spec": "Print a single integer — the number of triangles with the sides of one 1 centimeter, into which the hexagon is split.", "sample_inputs": ["1 1 1 1 1 1", "1 2 1 2 1 2"], "sample_outputs": ["6", "13"], "notes": "NoteThis is what Gerald's hexagon looks like in the first sample:And that's what it looks like in the second sample:"}, "positive_code": [{"source_code": "#include\n\nint num (int a1,int a2,int a3,int *plast,int *pcut)\n{\n int s=0,i;\n if(a1>1)\n a1=a1+(a1-1);\n if(a2>a3)\n {\n for(i=1;i<=a3;i++)\n {\n *plast=a1+(2*i);\n s=s+(a1+(2*i));\n }\n *pcut=a2-a3;\n }\n else\n {\n if(a3>a2)\n {\n for(i=1;i<=a2;i++)\n {\n *plast=a1+(2*i);\n s=s+(a1+(2*i));\n }\n *pcut=a3-a2;\n }\n else\n {\n for(i=1;i<=a2;i++)\n s=s+(a1+(2*i));\n *pcut=0;\n *plast=0;\n }\n }\n return s;\n}\nint main ()\n{\n int a1,a2,a3,a4,a5,a6;\n scanf(\"%d%d%d%d%d%d\",&a1,&a2,&a3,&a4,&a5,&a6);\n int i,s=0;\n int last,cut;\n s=num(a1,a2,a6,&last,&cut);\n s=s+num(a4,a5,a3,&last,&cut);\n\n if(cut>0)\n s=s+((last+1)*cut);\n printf(\"%d\\n\",s);\n return 0;\n}\n"}, {"source_code": "#include \nint main(int argc, char const *argv[]){\n\tint a[6], i, t;\n\tfor (i=0; i<6; ++i) scanf(\"%d\", &a[i]);\n\tt = a[0]+a[1]+a[2];\n\tprintf(\"%d\\n\", (t*t - a[0]*a[0] - a[2]*a[2] - a[4]*a[4]));\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\ndouble opposite(double a, double b)\n{\n double pi = 2*acos(0);\n return sqrt(a*a + b*b - 2*a*b*cos(120 * pi / 180));\n}\n\n\nint main()\n{\n double a1, a2, a3, a4, a5, a6, t1, t2, t3, middle, s, side1, side2, side3, ans, pi = 2*acos(0);\n double dividor = (sqrt(3) / 4 );\n double high, low;\n\n scanf(\"%lf %lf %lf %lf %lf %lf\", &a1, &a2, &a3, &a4, &a5, &a6);\n\n t1 = 0.5 * a1 * a2 * sin(120 * pi / 180);\n t2 = 0.5 * a3 * a4 * sin(120 * pi / 180);\n t3 = 0.5 * a5 * a6 * sin(120 * pi / 180);\n\n side1 = opposite(a1, a2);\n side2 = opposite(a3, a4);\n side3 = opposite(a5, a6);\n s = (side1 + side2 + side3) / 2;\n\n middle = sqrt(s * (s-side1) * (s-side2) * (s-side3));\n\n\n ans = ( t1 + t2 + t3 + middle ) / dividor;\n high = ceil(ans);\n\n if ( abs(high - ans) < 0.4 )\n {\n printf(\"%d\", (int)high );\n return 0;\n }\n\n\n printf(\"%d\", (int)ans);\n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a1,a2,a3,a4,a5,a6,d;\n scanf(\"%d %d %d %d %d %d\",&a1,&a2,&a3,&a4,&a5,&a6);\n d=a1*a2+a2*a3+a3*a1+a4*a5+a5*a6+a6*a4;\n printf(\"%d\",d);\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \n#include \n#include \n\nint mxpw(x, b){\n int res = 1;\n while(res*b < x) res *= b;\n return res;\n}\n\nint main(){\n int* T = calloc(sizeof(int), 6);\n int a, ai, d, p1, p2;\n scanf(\"%d\", T++);\n scanf(\"%d\", T++);\n scanf(\"%d\", T++);\n scanf(\"%d\", T++);\n scanf(\"%d\", T++);\n scanf(\"%d\", T++);\n T -= 6;\n a = 1000000000;\n ai = 0;\n for(int i = 0; i < 6; i++) if(T[i] < a){ai = i; a = T[i];}\n d = abs(a - T[(ai+3)%6]);\n p2 = abs(a - T[(ai+2)%6]);\n p1 = abs(a - T[(ai+4)%6]);\n\n\n printf(\"%d\", 6*a*a+6*a*d+d*d+(2*a+d)*2*p1+2*p2*(2*a+d+p1));\n\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a1,a2,a3,a4,a5,a6;\n scanf(\"%d %d %d %d %d %d\",&a1,&a2,&a3,&a4,&a5,&a6);\n\n long int s=a1+a2+a3;\n long int ans;\n\n ans=s*s-a1*a1-a3*a3-a5*a5;\n\n printf(\"%ld\",ans);\n \n return 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n\n int a1,a2,a3,a4,a5,a6;\n scanf(\"%d%d%d%d%d%d\",&a1,&a2,&a3,&a4,&a5,&a6);\n printf(\"%d\",((a1+a2+a3)*(a1+a2+a3)-a1*a1-a3*a3-a5*a5));\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tint a,b,c,d,e,f,k,g;\n\tscanf(\"%d %d %d %d %d %d\",&a,&b,&c,&d,&e,&f);\n\tk=(a+b+c)*(a+b+c);\n\tg=a*a+c*c+e*e;\n\tprintf(\"%d\",k-g);\n\treturn 0;\n}\n"}, {"source_code": "#include \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 int len = e+d+c;\n int ans = len*len;\n ans = ans - c*c - a*a - e*e;\n printf ( \"%d\\n\", ans );\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int a1,a2,a3,a4,a5,a6;\n scanf(\"%d%d%d%d%d%d\",&a1,&a2,&a3,&a4,&a5,&a6);\n printf(\"%d\\n\",(a1+a2+a3)*(a1+a2+a3)-a1*a1-a3*a3-a5*a5);\n return 0;\n}\n"}, {"source_code": "#include \"stdio.h\"\n#include \"stdlib.h\"\n\nint a, b, c, d, e, f;\n\nint main() {\n \n scanf(\"%d %d %d %d %d %d\", &a, &b, &c, &d, &e, &f);\n \n printf(\"%d\\n\", (a + b + c) * (a + b + c) - a * a - c * c - e * e);\n \n return 0;\n}\n"}, {"source_code": "#include\nint main ()\n{\n long long int a[7],i;\n long long int n1,n2,n3,n_total;\n long long int trigon_delete_one,trigon_delete_two,trigon_delete_three,trigon_total,trigon_final_number;\n long long int final_line_length;\n for(i=1;i<7;i++)scanf(\"%lld\",&a[i]);\n\n n1=(((a[1]*2)-1)+1)/2,trigon_delete_one=n1*n1,n2=(((a[3]*2)-1)+1)/2,trigon_delete_two=n2*n2,n3=(((a[5]*2)-1)+1)/2,trigon_delete_three=n3*n3,final_line_length=a[1]+a[2]+a[3];\n\n n_total=(((final_line_length*2)-1)+1)/2,trigon_total=n_total*n_total;\n\n trigon_final_number=trigon_total-trigon_delete_one-trigon_delete_two-trigon_delete_three;\n printf(\"%lld\\n\",trigon_final_number);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n\tint a1, a2, a3, a4, a5, a6;\n\n\tscanf(\"%d%d%d%d%d%d\", &a1, &a2, &a3, &a4, &a5, &a6);\n\tprintf(\"%d\\n\", (a1 + a2 + a3) * (a1 + a2 + a3) - a1 * a1 - a3 * a3 - a5 * a5); \n\treturn 0;\n}\n"}, {"source_code": "#include\nmain()\n{\n\tint t[6],a,b,i,sum=0,temp,c;\n\t\n\tfor(i=0;i<6;i++)\n\t{\n\t\tscanf(\"%d\",&t[i]);\n\t\t}\n\t\n\tsum=t[0]*t[1]+t[2]*t[3]+t[4]*t[5];\n\tsum*=2;\n\t\ta=t[0]>t[3]?t[0]-t[3]:t[3]-t[0];\n\tif(a!=0)\n\t\tsum+=a*a;\n\t\t\n\tprintf(\"%d\",sum);\n\treturn 0;\n\t}"}, {"source_code": "# include\n\nint main(){\n int In[6], i, ans;\n for (i = 0; i < 6; i++) scanf(\"%d\", In + i);\n ans = (In[0] + In[1] + In[2])*(In[0] + In[1] + In[2]);\n ans -= In[0] * In[0] + In[2] * In[2] + In[4] * In[4];\n printf(\"%d\\n\", ans);\n return 0;\n}"}, {"source_code": "#include \n\n\n\n\nint main(void) {\n // your code goes here\n int a,b,c,d,e,f,ta,min1,min2,dif1,dif2;\n //long long int q,sum;\n \n\n scanf(\"%d %d %d %d %d %d\",&a,&b,&c,&d,&e,&f);\n \n min1 = (b>f)?f:b;\n dif1 = (b>f)?(b-f):(f-b);\n min2 = (c>e)?e:c;\n dif2 = (c>e)?(c-e):(e-c);\n \n ta = (2*a + min1)*min1 + (2*d + min2)*min2 + (a+min1)*dif1 + (d+min2)*dif2;\n printf(\"%d\",ta);\n \n\n\n return 0;\n}\n\n"}, {"source_code": "#include \nint main(){\n int i,a[6];\n int sysmmetry;\n while(~scanf(\"%d\",&a[0])){\n for(i = 1; i < 6 ; i++)\n scanf(\"%d\",&a[i]);\n sysmmetry = 1;\n for(i = 0; i < 3;i++)\n if(a[i] != a[i + 3]){\n sysmmetry = 0;\n break;\n }\n int num = 0;\n int x1,x2,x3,x5;\n x1 = a[0];\n x2 = a[1];\n x3 = a[2];\n x5 = a[4];\n int tmp = x1 + x2 + x3;\n if(sysmmetry){\n num = tmp * tmp - x1 * x1 - x2 * x2 - x3 * x3;\n }\n else{\n num = tmp * tmp - x1 * x1 - x3 * x3 - x5 * x5;\n }\n printf(\"%d\\n\",num);\n }\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int a1,a2,a3,a4,a5,a6,x;\n scanf(\"%d %d %d %d %d %d\",&a1,&a2,&a3,&a4,&a5,&a6);\n x=pow((a1+a2+a3),2)- pow(a1,2)-pow(a3,2)-pow(a5,2);\n printf(\"%d\", x);\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\nint a1,a2,a3,a4,a5,a6,t;\nscanf(\"%d %d %d %d %d %d\",&a1,&a2,&a3,&a4,&a5,&a6);\nt=((a1+a2+a3)*(a1+a2+a3)-(a1*a1)-(a3*a3)-(a5*a5));\nprintf(\"%d\",t);\nreturn 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int a,b,c,ans,sum1,sum2,sum;\n int s[7];\n int i;\n for(i=1;i<=6;i++)scanf(\"%d\",&s[i]);\n sum1=s[1]*s[1]+s[3]*s[3]+s[5]*s[5];\n sum2=s[2]*s[2]+s[4]*s[4]+s[6]*s[6];\n\n sum=s[1]+s[2]+s[3];\n ans=sum*sum;\n ans-=s[1]*s[1];\n ans-=s[3]*s[3];\n ans-=s[5]*s[5];\n printf(\"%d\",ans); \n return 0;\n}"}, {"source_code": "#include \n#include \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 int ans=(a+b+c)*(a+b+c)-a*a-c*c-e*e;\n printf(\"%d\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int a1, a2, a3, a4, a5, a6, z;\n scanf(\"%d%d%d%d%d%d\", &a1, &a2, &a3, &a4, &a5, &a6);\n z = (a1+a2+a3)*(a1+a2+a3)-a1*a1-a3*a3-a5*a5;\n printf(\"%d\", z);\n return 0;\n}\n"}, {"source_code": "#include\nint main(void)\n{\n int a[6],c=0,d=0,i,e=0,f;\n\t\tfor(i=0;i<6;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t if(i%2==0)\n\t c=c+a[i];\n\t else\n {\n\t d=d+a[i];\n\t e=e+a[i]*a[i];\n\t}}\n f=(c+2*d)/3*(c+2*d)/3-e;\n printf(\"%d\\n\",f);\n\treturn 0;\n}\n "}, {"source_code": "#include\n#include\n#include\n#include\nint main()\n{\n int i, j, k ,flag=0, n , a,b,c,d,e,f;\n long long count = 0 ;\n scanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n while(1)\n {\n if(c==0 || e ==0)\n break;\n count = count + d*2+1;\n //printf(\"%d\\n\",count);\n d++;\n c--;\n e--;\n }\n if(c==0)\n {\n while(1)\n {\n if(b==0 || e==0)\n break;\n\n count = count + d*2;\n //printf(\"%d\\n\",count);\n b--;\n e--;\n }\n while(1){\n if(b==0)\n break;\n d--;\n count = count + d*2 +1;\n //printf(\"%d\\n\",count);\n b--;\n\n }\n printf(\"%lld\\n\",count);\n return 0;\n }\n\n if(e==0)\n {\n while(1)\n {\n if(c==0 || f==0)\n break;\n count = count + d*2;\n c--;\n f--;\n }\n while(1){\n if(f==0)\n break;\n d--;\n count = count + d*2 +1;\n //printf(\"%dsfg\\n\",count);\n f--;\n\n }\n\n }\n printf(\"%lld\\n\",count);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#define ll long long\n#define sin120 0.86602540378443864676372317075294\n\nint a[7];\n\nvoid input(){\n scanf(\"%d %d %d %d %d %d\", &a[1], &a[2], &a[3], &a[4], &a[5], &a[6]);\n}\n\nvoid process(){\n double area, area1, area2, area3, area4, aa, b, c;\n //\n area1 = a[1] * a[6] * sin120 * 0.5;\n c = a[1] * a[1] + a[6] * a[6] + a[1] * a[6];\n //\n area2 = a[5] * a[4] * sin120 * 0.5;\n b = a[5] * a[5] + a[4] * a[4] + a[5] * a[4];\n //\n area3 = a[3] * a[2] * sin120 * 0.5;\n aa = a[2] * a[2] + a[3] * a[3] + a[2] * a[3];\n //\n aa = sqrt(aa);\n b = sqrt(b);\n c = sqrt(c);\n double p = (aa + b + c) * 1.0 / 2;\n area4 = sqrt(p * (p - aa) * (p - b) * (p - c));\n //\n area = area1 + area2 + area3 + area4;\n double area_ = sqrt(3) * 1.0 / 4;\n int ans = (int)((area / area_) + 0.5);\n printf(\"%d\", ans);\n}\n\nint main(){\n //freopen(\"in.txt\", \"r\", stdin);\n input();\n process();\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\nint main() {\n\n int i,a[6];\n\n for (i=0 ; i<6 ; i++) {\n scanf(\"%d\",&a[i]);\n }\n\n int out;\n if (a[0] < a[2]) {\n out = 2*a[0]*a[1] + a[0]*a[0] + 2*(a[0] + a[1]) * (a[2] - a[0]) + a[3]*a[3] + 2*a[3]*a[4];\n } else {\n out = 2*a[2]*a[1] + a[2]*a[2] + 2*(a[2] + a[1]) * (a[0] - a[2]) + a[5]*a[5] + 2*a[5]*a[4];\n }\n\n printf(\"%d\",out);\n\n return 0;\n}\n\n"}, {"source_code": "//\n// main.c\n// A. Gerald's Hexagon\n//\n// Created by Omer Fehmi Aykan on 6.08.2015.\n// Copyright (c) 2015 Omer Fehmi Aykan. All rights reserved.\n//\n\n#include \n\nint a1, a2, a3, a4, a5, a6;\n\nint main(int argc, const char * argv[]) {\n\n scanf(\"%d %d %d %d %d %d\", &a1, &a2, &a3, &a4, &a5, &a6);\n \n printf(\"%d\", (a1+a2+a3)*(a1+a2+a3)-a1*a1-a3*a3-a5*a5);\n \n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int a1,a2,a3,a4,a5,a6,i;\n scanf(\"%d %d %d %d %d %d\",&a1,&a2,&a3,&a4,&a5,&a6);\n\n long long int res;\n res= (a1+a2+a3);\n res=res*res;\n res= res- (a1*a1+a3*a3+a5*a5);\n printf(\"%d\",res);\n return 0;\n}\n"}, {"source_code": "#include\nmain()\n{\n\tint t[6],a,b,i,sum=0,temp,c;\n\t\n\tfor(i=0;i<6;i++)\n\t{\n\t\tscanf(\"%d\",&t[i]);\n\t\t}\n\t\n\tsum=t[0]*t[1]+t[2]*t[3]+t[4]*t[5];\n\tsum*=2;\n\t\ta=t[0]>t[3]?t[0]-t[3]:t[3]-t[0];\n\tif(a!=0)\n\t\tsum+=a*a;\n\t\t\n\tprintf(\"%d\",sum);\n\treturn 0;\n\t}"}, {"source_code": "/* DHUOJ solution #346458 @ 2018-07-12 09:10:12.866 */\n\n#include\nint main()\n{\n\tint x1, x2, x3, x4, x5, x6;\n\twhile (~scanf(\"%d%d%d%d%d%d\", &x1, &x2, &x3, &x4, &x5, &x6)) {\n\t\tprintf(\"%d\\n\", (x1 + x2 + x3)*(x1 + x2 + x3) - x1 * x1 - x3 * x3 - x5 * x5);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int a1,a2,a3,a4,a5,a6,x;\n scanf(\"%d %d %d %d %d %d\",&a1,&a2,&a3,&a4,&a5,&a6);\n x=pow((a1+a2+a3),2)- pow(a1,2)-pow(a3,2)-pow(a5,2);\n printf(\"%d\", x);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\nint main() {\n\n int i,a[6];\n\n for (i=0 ; i<6 ; i++) {\n scanf(\"%d\",&a[i]);\n }\n\n int out;\n if (a[0] < a[2]) {\n out = 2*a[0]*a[1] + a[0]*a[0] + 2*(a[0] + a[1]) * (a[2] - a[0]) + a[3]*a[3] + 2*a[3]*a[4];\n } else {\n out = 2*a[2]*a[1] + a[2]*a[2] + 2*(a[2] + a[1]) * (a[0] - a[2]) + a[5]*a[5] + 2*a[5]*a[4];\n }\n\n printf(\"%d\",out);\n\n return 0;\n}\n\n"}, {"source_code": "#include \n#include \nint min(int a,int b)\n{\n\tif(aarr[1])\n\trem1=arr[5]-arr[1];\n\telse\n\trem1=arr[1]-arr[5];\n\tb=min(arr[4],arr[2]);\n\tfor(i=0;i\n\nint main()\n{\n\tint a1, a2, a3, a4, a5, a6, side;\n\tscanf(\"%d %d %d %d %d %d\", &a1, &a2, &a3, &a4, &a5, &a6);\n\tside = a3 + a4 + a5;\n\tprintf(\"%d\\n\", side * side - a1 * a1 - a3 * a3 - a5 * a5);\n\treturn 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n int i,a[6];\n\n for(i=0;i<6;i++)scanf(\"%d\",&a[i]);\n printf(\"%d\\n\",2*(a[0]*a[1]+a[3]*a[2]+a[4]*a[5])+(a[0]-a[3])*(a[0]-a[3]));\n\n return 0;\n}\n"}, {"source_code": "#include\nint a1,a2,a3,a4,a5,a6;\nint main()\n{\n scanf(\"%d %d %d %d %d %d\", &a1, &a2, &a3, &a4, &a5, &a6);\n printf(\"%d\", (a1+a2+a3)*(a1+a2+a3)-a1*a1-a3*a3-a5*a5);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n\tint i;\n\tfloat a[6],b[6][2],area,s;\n\tfor(i=0;i<6;i++)\n\t\tscanf(\"%f\",&a[i]);\n\tb[1][0]=a[0];\n\tb[1][1]=0;\n\tb[2][0]=a[0]+a[1]/2;\n\tb[2][1]=a[1]*sqrt(3)/2;\n\tb[3][0]=b[2][0]-a[2]/2;\n\tb[3][1]=b[2][1]+a[2]*sqrt(3)/2;\n\tb[4][1]=b[3][1];\n\tb[4][0]=b[3][0]-a[3];\n\tb[5][0]=-1*a[5]/2;\n\tb[5][1]=a[5]*sqrt(3)/2;\n\tarea=(b[2][0]-b[5][0])*b[4][1];\n\tarea-=(b[2][0]-b[1][0])*b[2][1]/2;\n\tarea-=(b[2][0]-b[3][0])*(b[3][1]-b[2][1])/2;\n\tarea-=(b[4][0]-b[5][0])*(b[4][1]-b[5][1])/2;\n\tarea+=b[5][0]*b[5][1]/2;\n\ts=sqrt(3)/4;\n\ti=area/s+0.5;\n\tprintf(\"%d\\n\",i);\n\treturn 0;\n}\n"}, {"source_code": "#include \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);\n\n\tprintf (\"%d\", (a + b + c) * (a + b + c) - a*a - c*c - d*d);\n\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \nint getmin(int a,int b){\n if(a>b) return b;\n return a;\n}\nint getmax(int a,int b){\n if(a>b) return a;\n return b;\n}\nint main()\n{\n int l1,l2,l3,l4,l5,l6,x,con,i;\n scanf(\"%d%d%d%d%d%d\" ,&l1,&l2,&l3,&l4,&l5,&l6);\n con=0;\n if(l2>l6){\n x=l1;\n for(i=0;i\n#include\n#include\n\nint main()\n{\n\n int a[6];\n int i;\n for(i=0;i<6;i++)\n {\n \n scanf(\"%d\",&a[i]);\n\n }\n\n int triangle = pow((a[0]+a[1]+a[2]),2);\n \n int rema = pow(a[0],2)+pow(a[2],2)+pow(a[4],2);\n\n printf(\"%d\\n\",triangle-rema);\n\n return 0;\n\n}\n\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int a, b, c, d, e, f;\n int res=0;\n scanf(\"%d %d %d %d %d %d\", &a,&b,&c,&d,&e,&f);\n res=(a+b+c)*(a+b+c)-a*a-c*c-e*e;\n printf(\"%d\", res);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n int a[6],i,side_equi,area;\n for(i=0;i<6;i++) scanf(\"%d\",&a[i]);\n side_equi=a[0]+a[1]+a[2];\n area=side_equi*side_equi-a[0]*a[0]-a[2]*a[2]-a[4]*a[4];\n printf(\"%d\",area);\n return 0;\n}"}, {"source_code": "#include \nint main()\n{\n int a1,a2,a3,a4,a5,a6,i;\n scanf(\"%d %d %d %d %d %d\",&a1,&a2,&a3,&a4,&a5,&a6);\n\n long long int res;\n res= (a1+a2+a3);\n res=res*res;\n res= res- (a1*a1+a3*a3+a5*a5);\n printf(\"%d\",res);\n return 0;\n}\n"}, {"source_code": "#include\n\nint num (int a1,int a2,int a3,int *plast,int *pcut)\n{\n int s=0,i;\n if(a1>1)\n a1=a1+(a1-1);\n if(a2>a3)\n {\n for(i=1;i<=a3;i++)\n {\n *plast=a1+(2*i);\n s=s+(a1+(2*i));\n }\n *pcut=a2-a3;\n }\n else\n {\n if(a3>a2)\n {\n for(i=1;i<=a2;i++)\n {\n *plast=a1+(2*i);\n s=s+(a1+(2*i));\n }\n *pcut=a3-a2;\n }\n else\n {\n for(i=1;i<=a2;i++)\n s=s+(a1+(2*i));\n *pcut=0;\n *plast=0;\n }\n }\n return s;\n}\nint main ()\n{\n int a1,a2,a3,a4,a5,a6;\n scanf(\"%d%d%d%d%d%d\",&a1,&a2,&a3,&a4,&a5,&a6);\n int i,s=0;\n int last,cut;\n s=num(a1,a2,a6,&last,&cut);\n s=s+num(a4,a5,a3,&last,&cut);\n\n if(cut>0)\n s=s+((last+1)*cut);\n printf(\"%d\\n\",s);\n return 0;\n}\n"}, {"source_code": "#include \"stdio.h\"\n#include \"stdlib.h\"\n\nint a, b, c, d, e, f;\n\nint main() {\n \n scanf(\"%d %d %d %d %d %d\", &a, &b, &c, &d, &e, &f);\n \n printf(\"%d\\n\", (a + b + c) * (a + b + c) - a * a - c * c - e * e);\n \n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int a1,a2,a3,a4,a5,a6,i;\n scanf(\"%d %d %d %d %d %d\",&a1,&a2,&a3,&a4,&a5,&a6);\n\n long long int res;\n res= (a1+a2+a3);\n res=res*res;\n res= res- (a1*a1+a3*a3+a5*a5);\n printf(\"%d\",res);\n return 0;\n}\n"}, {"source_code": "#include\nint a1,a2,a3,a4,a5,a6;\nint main()\n{\n scanf(\"%d %d %d %d %d %d\", &a1, &a2, &a3, &a4, &a5, &a6);\n printf(\"%d\", (a1+a2+a3)*(a1+a2+a3)-a1*a1-a3*a3-a5*a5);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a1,a2,a3,a4,a5,a6;\n scanf(\"%d %d %d %d %d %d\",&a1,&a2,&a3,&a4,&a5,&a6);\n\n printf(\"%d\\n\", 2*(a4+a5)*(a6+a5)- (a2*a2+a5*a5));\n}"}, {"source_code": "#include \n\n\n\n\nint main(void) {\n // your code goes here\n int a,b,c,d,e,f,ta,min1,min2,dif1,dif2;\n //long long int q,sum;\n \n\n scanf(\"%d %d %d %d %d %d\",&a,&b,&c,&d,&e,&f);\n \n min1 = (b>f)?f:b;\n dif1 = (b>f)?(b-f):(f-b);\n min2 = (c>e)?e:c;\n dif2 = (c>e)?(c-e):(e-c);\n \n ta = (2*a + min1)*min1 + (2*d + min2)*min2 + (a+min1)*dif1 + (d+min2)*dif2;\n printf(\"%d\",ta);\n \n\n\n return 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n int a1,a2,a3,a4,a5,a6;\n scanf(\"%d %d %d %d %d %d\",&a1,&a2,&a3,&a4,&a5,&a6);\n\n printf(\"%d\\n\", 2*(a4+a5)*(a6+a5)- (a2*a2+a5*a5));\n}"}, {"source_code": "#include\nint main(){\n\tint a[6],count;\n\twhile(scanf(\"%d %d %d %d %d %d\",&a[0],&a[1],&a[2],&a[3],&a[4],&a[5])==6){\n\t\tcount=(a[0]+a[1]+a[2])*(a[0]+a[1]+a[2])-a[0]*a[0]-a[2]*a[2]-a[4]*a[4];\n\t\tprintf(\"%d\\n\",count);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nmain(){\n int a1,a2,a3,a4,a5,a6,t;\n scanf(\"%d %d %d %d %d %d\",&a1,&a2,&a3,&a4,&a5,&a6);\n t=(a1+a2+a3)*(a1+a2+a3)-a1*a1-a3*a3-a5*a5;\n printf(\"%d\",t);\n}\n"}, {"source_code": "#include \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);\n\n\tprintf (\"%d\", (a + b + c) * (a + b + c) - a*a - c*c - d*d);\n\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main(void) {\n // your code goes here\n int i,a[6];\n for (i=0;i<6;i++){\n scanf(\"%d\",&a[i]);\n }\n int tri;\n tri=(a[0]+a[1]+a[2])*(a[0]+a[1]+a[2])-(a[0]*a[0])-(a[2]*a[2])-(a[4]*a[4]);\n printf(\"%d\",tri);\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint getmin(int a,int b){\n if(a>b) return b;\n return a;\n}\nint getmax(int a,int b){\n if(a>b) return a;\n return b;\n}\nint main()\n{\n int l1,l2,l3,l4,l5,l6,x,con,i;\n scanf(\"%d%d%d%d%d%d\" ,&l1,&l2,&l3,&l4,&l5,&l6);\n con=0;\n if(l2>l6){\n x=l1;\n for(i=0;i\nint main()\n{\n long long a,b,c,d,e,f,m;\n scanf(\"%I64d %I64d %I64d %I64d %I64d %I64d \",&a,&b,&c,&d,&e,&f);\n m=(a+b+c)*(a+b+c)-(a*a+c*c+e*e);\n printf(\"%I64d\",m);\n}\n"}, {"source_code": "#include \n#include \nint getmin(int a,int b){\n if(a>b) return b;\n return a;\n}\nint getmax(int a,int b){\n if(a>b) return a;\n return b;\n}\nint main()\n{\n int l1,l2,l3,l4,l5,l6,x,con,i;\n scanf(\"%d%d%d%d%d%d\" ,&l1,&l2,&l3,&l4,&l5,&l6);\n con=0;\n if(l2>l6){\n x=l1;\n for(i=0;i\n\nint hexaLine[6];\nint regTriCnt;\n\nvoid find_solution()\n{\n\tint base, r, l, i=1, j=5, n;\n\tregTriCnt=0;\n\tbase = hexaLine[0];\n\t\n\tr = hexaLine[i++];\n\tl = hexaLine[j--];\n\tn = r;\n\tif (r>l)\n\t\tn = l;\n\tregTriCnt += n*(n+2*base);\n\tbase += n;\n\t\n\tn = r-l;\n\tif (n<0)\n\t\tn*=(-1);\n\tregTriCnt += 2*n*base;\n\tr = hexaLine[i++];\n\tl = hexaLine[j];\n\tn = r;\n\tif (r>l)\n\t\tn = l;\n\tbase = hexaLine[i];\n\tregTriCnt+= n*(n+2*base);\n\t\t\n}\n\nint main(int argc, char **argv)\n{\n\tint i;\n//\tfreopen(\"sample_input.txt\", \"r\", stdin);\n\t\n\tfor (i=0; i< 6 ; i++)\n\t{\n\t\tscanf(\"%d\", &hexaLine[i]);\n\t}\n\t\n\tfind_solution();\n\tprintf(\"%d\\n\", regTriCnt);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint a,b,c,d,e,f;\n\tlong long int k;\n\tscanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n\tk=(a+b+c)*(a+b+c);\n\tk=k-a*a;k=k-c*c;k=k-e*e;\n\tprintf(\"%I64d\",k);\n\treturn 0;\n}\n"}, {"source_code": "#include \nint main(){\n int i,a[6];\n int sysmmetry;\n while(~scanf(\"%d\",&a[0])){\n for(i = 1; i < 6 ; i++)\n scanf(\"%d\",&a[i]);\n sysmmetry = 1;\n for(i = 0; i < 3;i++)\n if(a[i] != a[i + 3]){\n sysmmetry = 0;\n break;\n }\n int num = 0;\n int x1,x2,x3,x5;\n x1 = a[0];\n x2 = a[1];\n x3 = a[2];\n x5 = a[4];\n int tmp = x1 + x2 + x3;\n if(sysmmetry){\n num = tmp * tmp - x1 * x1 - x2 * x2 - x3 * x3;\n }\n else{\n num = tmp * tmp - x1 * x1 - x3 * x3 - x5 * x5;\n }\n printf(\"%d\\n\",num);\n }\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n\nint main(void)\n{\n int a[7];\n int sum = 0;\n int small, dif;\n\n\n for(int i = 1; i < 7; i++)\n scanf(\"%d\", &a[i]);\n\n dif = abs(a[2] - a[6]);\n if(a[2] > a[6])\n small = a[6];\n else\n small = a[2];\n \n for(int i = 0; i < small; i++)\n sum += a[1] + i + a[1] + i + 1;\n for(int i = 0; i < dif; i++)\n sum += (a[1] + small) * 2;\n if(a[3] > a[5])\n small = a[5];\n else\n small = a[3];\n for(int i = 0; i < small; i++)\n sum += a[4] + i + a[4] + i + 1;\n\n printf(\"%d\", sum);\n\n\n return 0;\n}\n"}, {"source_code": "#include\nint gum(int k){\n\treturn k*k;\n}\nint main(){\n\tint a,b,c,d,e,f,g,h;\n\twhile(~scanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&g,&h)){\n\t\tprintf(\"%d\\n\",gum(a+b+c)-gum(a)-gum(c)-gum(e));\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main(void){\n\n int a, b, c, d ,e, f;\n scanf(\"%d%d%d%d%d%d\", &a, &b, &c, &d, &e, &f);\n\n printf(\"%d\\n\", (a+b+c)*(a+b+c)-a*a-c*c-e*e);\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n\tint a1, a2, a3, a4, a5, a6;\n\n\tscanf(\"%d%d%d%d%d%d\", &a1, &a2, &a3, &a4, &a5, &a6);\n\tprintf(\"%d\\n\", (a1 + a2 + a3) * (a1 + a2 + a3) - a1 * a1 - a3 * a3 - a5 * a5); \n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \nint getmin(int a,int b){\n if(a>b) return b;\n return a;\n}\nint getmax(int a,int b){\n if(a>b) return a;\n return b;\n}\nint main()\n{\n int l1,l2,l3,l4,l5,l6,x,con,i;\n scanf(\"%d%d%d%d%d%d\" ,&l1,&l2,&l3,&l4,&l5,&l6);\n con=0;\n if(l2>l6){\n x=l1;\n for(i=0;i\n#include\n#include\n#include\n#include\n#include\n#include\n\nint main(void)\n{\n int a[7];\n int sum = 0;\n int small, dif;\n\n\n for(int i = 1; i < 7; i++)\n scanf(\"%d\", &a[i]);\n\n dif = abs(a[2] - a[6]);\n if(a[2] > a[6])\n small = a[6];\n else\n small = a[2];\n \n for(int i = 0; i < small; i++)\n sum += a[1] + i + a[1] + i + 1;\n for(int i = 0; i < dif; i++)\n sum += (a[1] + small) * 2;\n if(a[3] > a[5])\n small = a[5];\n else\n small = a[3];\n for(int i = 0; i < small; i++)\n sum += a[4] + i + a[4] + i + 1;\n\n printf(\"%d\", sum);\n\n\n return 0;\n}\n"}, {"source_code": "#include \n#define fin stdin\n#define fout stdout\nint main(){\n int a1, a2, a3, a4, a5, a6, x, i;\n long long ans;\n //FILE *fin, *fout;\n //fin=fopen(\"a.in\", \"r\");\n //fout=fopen(\"a.out\", \"w\");\n fscanf(fin, \"%d%d%d%d%d%d\", &a1, &a2, &a3, &a4, &a5, &a6);\n ans=0;\n x=1+2*a1;\n for(i=0; (i\n#define fin stdin\n#define fout stdout\nint main(){\n int a1, a2, a3, a4, a5, a6, x, i;\n long long ans;\n //FILE *fin, *fout;\n //fin=fopen(\"a.in\", \"r\");\n //fout=fopen(\"a.out\", \"w\");\n fscanf(fin, \"%d%d%d%d%d%d\", &a1, &a2, &a3, &a4, &a5, &a6);\n ans=0;\n x=1+2*a1;\n for(i=0; (i\n\nint main(){\n\tint arr[6], flag = 0, i;\n\tfor(i = 0;i<6;i++){\n\t\tscanf(\"%d\",&arr[i]);\n\t}\n\tint j = 0,k = 0, ans = 0;\n\tint temp = 2*arr[0] + 1;\n\twhile(j\n\nint main() {\n\tint a1, a2, a3, a4, a5, a6;\n\n\tscanf(\"%d%d%d%d%d%d\", &a1, &a2, &a3, &a4, &a5, &a6);\n\tprintf(\"%d\\n\", (a1 + a2 + a3) * (a1 + a2 + a3) - a1 * a1 - a3 * a3 - a5 * a5); \n\treturn 0;\n}\n"}, {"source_code": "/*Gerald's Hexagon*/\n\n#include\n\nint main()\n{\n\tint a1, a2, a3, a4, a5, a6, side;\n\tscanf(\"%d %d %d %d %d %d\", &a1, &a2, &a3, &a4, &a5, &a6);\n\tside = a3 + a4 + a5;\n\tprintf(\"%d\\n\", side * side - a1 * a1 - a3 * a3 - a5 * a5);\n\treturn 0;\n}"}, {"source_code": "#include \"stdio.h\"\n#include \"stdlib.h\"\n\nint main(int argc, char ** args) {\n\tint i, input[6];\n\tfor (i = 0; i < 6; i++) {\n\t\tscanf(\"%d\", &input[i]);\n\t}\n\tprintf(\"%d\\n\", (input[0] + input[1] + input[2]) * (input[0] + input[1] + input[2]) - input[0] * input[0] - input[2] * input[2] - input[4] * input[4]);\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main(){\n\tlong long int a,b,c,d,e,f,sum;\n\tscanf(\"%lld%lld%lld%lld%lld%lld\",&a,&b,&c,&d,&e,&f);\n\tsum=pow(a+b+c,2)-pow(a,2)-pow(e,2)-pow(c,2);\n\tprintf(\"%lld\",sum);\n\treturn 0;\n}\n\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int a1,a2,a3,a4,a5,a6,x;\n scanf(\"%d %d %d %d %d %d\",&a1,&a2,&a3,&a4,&a5,&a6);\n x=pow((a1+a2+a3),2)- pow(a1,2)-pow(a3,2)-pow(a5,2);\n printf(\"%d\", x);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\ndouble area(int a)\n{\n return (sqrt(3)*a*a)/4;\n}\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\n double n_triangle = area(b+a+c) - area(a) - area(c) - area(e);\n \n printf(\"%.0lf\\n\", n_triangle / area(1));\n\n return 0;\n}\n"}, {"source_code": "#include \"stdio.h\"\nint min(int x, int y)\n{\n\treturn xy?x:y;\n}\nint main()\n{\n\tlong int a[6],i,k=0,x;\n\tfor (i=0;i<6;i++)\n\t\tscanf(\"%ld\",&a[i]);\n\tx=2*a[2]+1;\n\tfor (i=1;i<=min(a[1],a[3]);i++)\n\t{\n\t\tk+=x;\n\t\tx+=2;\n\t}\n\tk+=(x-1)*(max(a[1],a[3])-min(a[1],a[3]));\n\tfor (i=max(a[1],a[3])+1;i<=a[3]+a[4];i++)\n\t{\n\t\tx-=2;\n\t\tk+=x;\n\t}\n\tprintf(\"%ld\",k);\n\treturn 0;\n}"}, {"source_code": "#include \n\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 = (a+b+c)*(c+d+e)-(a*a+c*c+ e*e);\n printf(\"%d\", n);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main(void)\n{\n int i,a[6];\n float sum;\n for(i = 0; i < 6; i++)\n {\n scanf(\"%d\",&a[i]);\n }\n sum = 0;\n \n int small = a[0] > a[2] ? a[2] : a[0];\n int big = a[0] > a[2] ? a[0] : a[2];\n \n sum += (((float)small)/2) * (2*(2*a[1]+1) +(small - 1)*2);\n sum += (big - small) * (a[1] + small) * 2;\n \n small = a[3] > a[5] ? a[5] : a[3];\n big = a[3] > a[5] ? a[3] : a[5];\n \n sum += (((float)small)/2) * (2*(2*a[4]+1) +(small - 1)*2);\n \n printf(\"%d\\n\",(int)sum);\n return 0;\n}"}, {"source_code": "#include \n#include \n#define EPS 1e-4\n\nint main()\n{\n double a[6];\n int i, j, x;\n for (i = 0; i < 6; ++i) scanf(\"%lf\", &a[i]);\n int turn[6], cur_turn;\n unsigned char valid;\n float px[6], py[6];\n int ans = -1, cur_ans;\n for (x = 0; x < (1 << 10); ++x) {\n for (i = 1; i < 6; ++i) turn[i] = (x >> (i + i)) & 3;\n px[0] = py[0] = cur_turn = 0;\n for (i = 1; i < 6; ++i) {\n switch (turn[i]) {\n case 0: cur_turn += 60; break;\n case 1: cur_turn += 120; break;\n case 2: cur_turn += 240; break;\n case 3: cur_turn += 300; break;\n }\n px[i] = px[i - 1] + a[i] * cos((double)cur_turn * M_PI / 180.0);\n py[i] = py[i - 1] + a[i] * sin((double)cur_turn * M_PI / 180.0);\n valid = 1;\n for (j = 0; j < i; ++j)\n if (fabs(px[i] - px[j]) < EPS && fabs(py[i] - py[j]) < EPS) {\n valid = 0; break;\n }\n if (!valid) break;\n }\n if (valid && fabs(px[5] * px[5] + py[5] * py[5] - a[0] * a[0]) > EPS) valid = 0;\n if (valid && fabs((px[4] - px[0]) * (py[5] - py[0]) - (py[4] - py[0]) * (px[5] - px[0])) < EPS) valid = 0;\n if (valid) {\n double area = 0;\n for (i = 0; i < 6; ++i)\n area += (px[i] * py[(i + 1) % 6] - py[i] * px[(i + 1) % 6]) / 2.0;\n cur_ans = (int)round(fabs(area) / (sqrt(3.0) / 4.0));\n if (ans < cur_ans) ans = cur_ans;\n }\n }\n printf(\"%d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint getmin(int a,int b){\n if(a>b) return b;\n return a;\n}\nint getmax(int a,int b){\n if(a>b) return a;\n return b;\n}\nint main()\n{\n int l1,l2,l3,l4,l5,l6,x,con,i;\n scanf(\"%d%d%d%d%d%d\" ,&l1,&l2,&l3,&l4,&l5,&l6);\n con=0;\n if(l2>l6){\n x=l1;\n for(i=0;i\n\nint sqr(int n)\n{\n\treturn n*n;\n}\n\nint main()\n{\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 = sqr(a+b+c)-sqr(a)-sqr(c)-sqr(e);\n\tprintf(\"%d\",res);\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint a,b,c,d,e,f,ans,z;\n\tscanf(\"%d %d %d %d %d %d\",&a,&b,&c,&d,&e,&f);\n\tz=(a+b+c)*(a+b+c);\n\tans=z-(a*a)-(c*c)-(e*e);\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main(void)\n{\n\tint a[6];\n\tint i;\n\n\tfor(i=0; i<6; i++)\n\t{\n\t\tscanf(\"%d\", &a[i]);\n\t}\n\n\tprintf(\"%d\", (a[0]+a[1]+a[2])*(a[0]+a[1]+a[2])-a[0]*a[0]-a[2]*a[2]-a[4]*a[4]);\n\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include \n\n\nint h[7]={0};\n\nint main(void){\n\n int i,j,flag,add;\n int max=0;\n int total=0;\n for(i=1;i<=6;i++){\n scanf(\"%d\",&h[i]);\n }\n h[0]=h[6];\n while(1){\n //counter\n if(i<7)i++;\n else i=1;\n\n if(h[i-1]>1 && h[i+1]>1){\n total=total+2*h[i]+1;\n h[i]++;\n h[i+1]--;\n if(i==1) h[6]--;\n else h[i-1]--;\n }\n flag=0;\n for(j=1;j<7;j++){\n if (h[j]==1) flag++;\n }\n if(flag>=4){\n for(j=1;j<7;j++){\n if(h[j]>max) max=h[j];\n }\n add=max*4+2;\n\n break;\n }\n\n h[0]=h[6];\n for(j=1;j<7;j++){\n //printf(\"%d \",h[j]);\n }\n //printf(\"\\n\");\n }\n\n\n\n printf(\"%d\\n\",total+add);\n\n\n return 0;\n}\n\n"}, {"source_code": "#include \n#include \n#define EPS 1e-4\n\nint main()\n{\n double a[6];\n int i, j, x;\n for (i = 0; i < 6; ++i) scanf(\"%lf\", &a[i]);\n int turn[6], cur_turn;\n unsigned char valid;\n float px[6], py[6];\n int ans = -1, cur_ans;\n for (x = 0; x < (1 << 10); ++x) {\n for (i = 1; i < 6; ++i) turn[i] = (x >> (i + i)) & 3;\n px[0] = py[0] = cur_turn = 0;\n for (i = 1; i < 6; ++i) {\n switch (turn[i]) {\n case 0: cur_turn += 60; break;\n case 1: cur_turn += 120; break;\n case 2: cur_turn += 240; break;\n case 3: cur_turn += 300; break;\n }\n px[i] = px[i - 1] + a[i] * cos((double)cur_turn * M_PI / 180.0);\n py[i] = py[i - 1] + a[i] * sin((double)cur_turn * M_PI / 180.0);\n valid = 1;\n for (j = 0; j < i; ++j)\n if (fabs(px[i] - px[j]) < EPS && fabs(py[i] - py[j]) < EPS) {\n valid = 0; break;\n }\n if (!valid) break;\n }\n if (valid && fabs(px[5] * px[5] + py[5] * py[5] - a[0] * a[0]) > EPS) valid = 0;\n if (valid && fabs((px[4] - px[0]) * (py[5] - py[0]) - (py[4] - py[0]) * (px[5] - px[0])) < EPS) valid = 0;\n if (valid) {\n double area = 0;\n for (i = 0; i < 6; ++i)\n area += (px[i] * py[(i + 1) % 6] - py[i] * px[(i + 1) % 6]) / 2.0;\n cur_ans = (int)round(fabs(area) / (sqrt(3.0) / 4.0));\n if (ans < cur_ans) ans = cur_ans;\n }\n }\n printf(\"%d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include \nint main(){\n int a1,a2,a3,a4,a5,a6;\n long int ans;\n scanf(\"%d%d%d%d%d%d\",&a1,&a2,&a3,&a4,&a5,&a6);\n ans = 2*a1*a6 + 2*a5*a4 + 2*a3*a2 + (a4-a1)*(a4-a1);\n printf(\"%ld\\n\",ans);\n return 0;\n}"}, {"source_code": "/* Problem: 559A - Gerald's Hexagon */\n/* Solver: Gusztav Szmolik */\n\n#include \n\nint main ()\n {\n unsigned short a1;\n unsigned short a2;\n unsigned short a3;\n unsigned short a4;\n unsigned short a5;\n unsigned short a6;\n unsigned short h;\n unsigned short hn;\n unsigned short hx;\n unsigned short trc;\n unsigned int tc;\n unsigned short i;\n \n if (scanf(\"%hu %hu %hu %hu %hu %hu\",&a1,&a2,&a3,&a4,&a5,&a6) != 6)\n return -1;\n if (a1 < 1 || a1 > 1000 || a2 < 1 || a2 > 1000 || a3 < 1 || a3 > 1000)\n return -1;\n if (a4 < 1 || a4 > 1000 || a5 < 1 || a5 > 1000 || a6 < 1 || a6 > 1000)\n return -1;\n if (a1+2*a2+a3 != a4+2*a5+a6 || a1+a6 != a3+a4)\n return -1;\n h = a1+a6;\n hn = (a1 < a3 ? a1 : a3);\n hx = (a1 < a3 ? a3 : a1);\n trc = 2*a2+1;\n tc = trc;\n for (i = 1; i < h; i++)\n {\n if (i < hn)\n trc += 2;\n else if (i == hn && i < hx)\n trc++;\n else if (i == hx && i > hn)\n trc--;\n else if (i > hx)\n trc -= 2;\n tc += trc;\n }\n printf (\"%u\\n\",tc);\n return 0;\n }\n"}, {"source_code": "#include\nint main()\n{\n long long int ar[10];\n long long int i;\n for(i=1;i<=6;i++)\n scanf(\"%lld\",&ar[i]);\n long long int ans=(ar[1]+ar[2]+ar[3])*(ar[1]+ar[2]+ar[3])-((ar[1]*ar[1])+(ar[3]*ar[3])+(ar[5]*ar[5]));\n printf(\"%lld\",ans);\n return 0;\n}\n"}, {"source_code": "/* Problem: 559A - Gerald's Hexagon */\n/* Solver: Gusztav Szmolik */\n\n#include \n\nint main ()\n {\n unsigned short a1;\n unsigned short a2;\n unsigned short a3;\n unsigned short a4;\n unsigned short a5;\n unsigned short a6;\n unsigned short h;\n unsigned short hn;\n unsigned short hx;\n unsigned short trc;\n unsigned int tc;\n unsigned short i;\n \n if (scanf(\"%hu %hu %hu %hu %hu %hu\",&a1,&a2,&a3,&a4,&a5,&a6) != 6)\n return -1;\n if (a1 < 1 || a1 > 1000 || a2 < 1 || a2 > 1000 || a3 < 1 || a3 > 1000)\n return -1;\n if (a4 < 1 || a4 > 1000 || a5 < 1 || a5 > 1000 || a6 < 1 || a6 > 1000)\n return -1;\n if (a1+2*a2+a3 != a4+2*a5+a6 || a1+a6 != a3+a4)\n return -1;\n h = a1+a6;\n hn = (a1 < a3 ? a1 : a3);\n hx = (a1 < a3 ? a3 : a1);\n trc = 2*a2+1;\n tc = trc;\n for (i = 1; i < h; i++)\n {\n if (i < hn)\n trc += 2;\n else if (i == hn && i < hx)\n trc++;\n else if (i == hx && i > hn)\n trc--;\n else if (i > hx)\n trc -= 2;\n tc += trc;\n }\n printf (\"%u\\n\",tc);\n return 0;\n }\n"}, {"source_code": "#include\nint main()\n{\n long long int ar[10];\n long long int i;\n for(i=1;i<=6;i++)\n scanf(\"%lld\",&ar[i]);\n long long int ans=(ar[1]+ar[2]+ar[3])*(ar[1]+ar[2]+ar[3])-((ar[1]*ar[1])+(ar[3]*ar[3])+(ar[5]*ar[5]));\n printf(\"%lld\",ans);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int a1,a2,a3,a4,a5,a6;\n scanf(\"%d%d%d%d%d%d\",&a1,&a2,&a3,&a4,&a5,&a6);\n printf(\"%d\\n\",(a1+a2+a3)*(a1+a2+a3)-a1*a1-a3*a3-a5*a5);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main(){\n\tint arr[6], flag = 0, i;\n\tfor(i = 0;i<6;i++){\n\t\tscanf(\"%d\",&arr[i]);\n\t}\n\tint j = 0,k = 0, ans = 0;\n\tint temp = 2*arr[0] + 1;\n\twhile(j\n#include \n\nint main()\n{\n int a1,a2,a3,a4,a5,a6,x;\n scanf(\"%d %d %d %d %d %d\",&a1,&a2,&a3,&a4,&a5,&a6);\n x=pow((a1+a2+a3),2)- pow(a1,2)-pow(a3,2)-pow(a5,2);\n printf(\"%d\", x);\n return 0;\n}\n"}, {"source_code": "/*interface*/\n//我的工作太出色了,程序运作异常好!何伟伟,加油!\n#include\n/*interface implementation*/\nint max(int a,int b) {\n if(a>b) return a;\n else return b;\n}\nint min(int a,int b) {\n if(a0; i--) {\n sum+=bottom;\n bottom-=2;\n //printf(\"current bottom is %d\\n\",bottom);\n }\n printf(\"%d\\n\",sum);\n return 0;\n}\n"}, {"source_code": "#include \n#include \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 int ans=(a+b+c)*(a+b+c)-a*a-c*c-e*e;\n printf(\"%d\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint a,b,c,d,e,f,x;\nint main()\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 x=(a+b+c)*(a+b+c)-a*a-c*c-e*e;\n printf(\"%d\",x);\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int a,b,c,d,e,f;\n scanf(\"%lld %lld %lld %lld %lld %lld\",&a,&b,&c,&d,&e,&f);\n long long int area=((a+b+c)*(a+b+c))-(a*a)-(c*c)-(e*e);\n printf(\"%lld\\n\",area);\n return 0;\n}\n"}, {"source_code": "#include \n\nint A[7];\n\nint solve();\n\nint main() {\n\tint i;\n\t\n\tfor(i = 0; i < 6; ++i) {\n\t\tscanf(\"%d\", &A[i]);\n\t}\n\tprintf(\"%d\\n\", solve());\n\treturn 0;\n}\n\nint solve() {\n\tint ret, n, sum = 0, i;\n\n\tn = 2 * A[0] + A[1] + A[5];\n\tfor(i = 0; i < 6; ++i) {\n\t\tif(i == 0 || i == 3)\tcontinue;\n\t\tsum += A[i] * A[i];\n\t}\n\tret = n * (A[1] + A[2]) - (sum / 2);\n\treturn ret;\n}\n"}, {"source_code": "#include\nint main(){\nint a1,a2,a3,a4,a5,a6,t;\nscanf(\"%d %d %d %d %d %d\",&a1,&a2,&a3,&a4,&a5,&a6);\nt=((a1+a2+a3)*(a1+a2+a3)-(a1*a1)-(a3*a3)-(a5*a5));\nprintf(\"%d\",t);\nreturn 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int a1,a2,a3,a4,a5,a6,res;\n scanf(\"%d %d %d %d %d %d\",&a1,&a2,&a3,&a4,&a5,&a6);\n res=(a1+a2+a3)*(a1+a2+a3)-a1*a1-a3*a3-a5*a5;\n printf(\"%d\\n\",res);\n return 0;\n}"}], "negative_code": [{"source_code": "#include\nmain()\n{\n\tint t[6],a,b,i,sum=0,temp,c;\n\t\n\tfor(i=0;i<6;i++)\n\t{\n\t\tscanf(\"%d\",&t[i]);\n\t\t}\n\t\n\tsum=t[0]*t[1]+t[2]*t[3]+t[4]*t[5];\n\tsum*=2;\n\tif(t[0]==t[2]&&t[0]!=t[1])\n\t{\n\t\ta=t[0]>t[1]?t[0]-t[1]:t[1]-t[0];\n\t\tsum+=2*a-1;\n\t\t}\n\tprintf(\"%d\",sum);\n\treturn 0;\n\t}"}, {"source_code": "#include\nmain()\n{\n\tint t[6],a,b,i,sum=0,temp,c;\n\t\n\tfor(i=0;i<6;i++)\n\t{\n\t\tscanf(\"%d\",&t[i]);\n\t\t}\n\t\n\tsum=t[0]*t[1]+t[2]*t[3]+t[4]*t[5];\n\tsum*=2;\n\t\ta=t[0]>t[3]?t[0]-t[3]:t[3]-t[0];\n\tif(a!=0)\n\t\tsum+=a*a-1;\n\t\t\n\tprintf(\"%d\",sum);\n\treturn 0;\n\t}"}, {"source_code": "#include\nmain()\n{\n\tint t[6],a,b,i,sum=0,temp;\n\tfor(i=0;i<6;i++)\n\t\tscanf(\"%d\",&t[i]);\n\ta=t[0];\n\tb=t[1];\n\ttemp=t[2];\n\tfor(i=b;i>0;i--)\n\t{\n\t\tsum=temp*2+1+sum;\n\t\ttemp++;\n\t\t}\n\ttemp--;\n\tfor(i=a;i>0;i--)\n\t{\n\t\tsum=temp*2+1+sum;\n\t\ttemp--;\n\t\t}\n\tprintf(\"%d\",sum);\n\treturn 0;\n\t}"}, {"source_code": "#include \n#include \nint main()\n{\n int num[10];\n int i;\n int ans=0;\n for(i=1;i<=6;i++)\n scanf(\"%d\",&num[i]);\n int min1;\n if(num[2]<=num[6])\n min1=num[2];\n else\n min1=num[6];\n for(i=1;i<=min1;i++)\n {\n ans+=(2*num[1]+1);\n num[1]+=1;\n }\n int min2,dif;\n if(num[3]<=num[5])\n {\n min2=num[3];\n dif=num[5]-num[3];\n }\n else\n {\n min2=num[5];\n dif=num[3]-num[5];\n }\n for(i=1;i<=min2;i++)\n {\n ans+=(2*num[4]+1);\n num[4]+=1;\n }\n ans+=(dif*num[1]);\n printf(\"%d\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include\n#include \n\n\nint h[7]={0};\n\nint main(void){\n\n int i,j,flag,add;\n int min=1000;\n int total=0;\n for(i=1;i<=6;i++){\n scanf(\"%d\",&h[i]);\n }\n h[0]=h[6];\n while(1){\n //counter\n if(i<7)i++;\n else i=1;\n\n if(h[i-1]>1 && h[i+1]>1){\n total=total+2*h[i]+1;\n h[i]++;\n h[i+1]--;\n if(i==1) h[6]--;\n else h[i-1]--;\n }\n flag=0;\n for(j=1;j<7;j++){\n if (h[j]==1) flag++;\n }\n if(flag==4){\n add=10;\n break;\n }\n else if(flag==6){\n add=6;\n break;\n }\n\n h[0]=h[6];\n }\n\n\n\n printf(\"%d\\n\",total+add);\n\n\n return 0;\n}\n\n"}, {"source_code": "#include\n#include \n\n\nint h[7]={0};\n\nint main(void){\n\n int i,j,flag,add;\n int max=0;\n int total=0;\n for(i=1;i<=6;i++){\n scanf(\"%d\",&h[i]);\n }\n h[0]=h[6];\n while(1){\n //counter\n if(i<7)i++;\n else i=1;\n\n if(h[i-1]>1 && h[i+1]>1){\n total=total+2*h[i]+1;\n h[i]++;\n h[i+1]--;\n if(i==1) h[6]--;\n else h[i-1]--;\n }\n flag=0;\n for(j=1;j<7;j++){\n if (h[j]==1) flag++;\n }\n if(flag>=4){\n for(j=1;j<7;j++){\n if(h[j]>max) max=h[j];\n }\n add=max*4+2;\n\n break;\n }\n\n h[0]=h[6];\n for(j=1;j<7;j++){\n printf(\"%d \",h[j]);\n }\n printf(\"\\n\");\n }\n\n\n\n printf(\"%d\\n\",total+add);\n\n\n return 0;\n}\n\n"}, {"source_code": "#include\n#include \n\n\nint h[7]={0};\n\nint main(void){\n\n int i,j;\n int min=1000;\n int total=0;\n for(i=1;i<=6;i++){\n scanf(\"%d\",&h[i]);\n if(h[i]0;i--){\n for(j=1;j<=6;j++){\n total=total+2*h[j]-1;\n h[j]--;\n }\n }\n if(h[1] || h[2]){\n total++;\n }\n\n\n\n printf(\"%d\\n\",total);\n\n\n return 0;\n}\n\n"}, {"source_code": "#include \n\nint GetSum(int n)\n{\n return (1 + 1 + (n - 1) * 2) * n / 2;\n}\n\nint main()\n{\n int a1, a2, a3, a4, a5, a6;\n int Ans = 0;\n scanf(\"%d %d %d %d %d %d\", &a1, &a2, &a3, &a4, &a5, &a6);\n if(a2 == a6) {\n Ans += GetSum(a1 + a2) - GetSum(a1);\n Ans += GetSum(a4 + a3) - GetSum(a4);\n } else if(a2 < a6) {\n Ans += GetSum(a1 + a2) - GetSum(a1);\n Ans += (a6 - a2) * (a4 + a5);\n Ans += GetSum(a4 + a5) - GetSum(a4);\n } else {\n Ans += GetSum(a1 + a6) - GetSum(a1);\n Ans += (a2 - a6) * (a4 + a3);\n Ans += GetSum(a4 + a3) - GetSum(a4);\n }\n printf(\"%d\\n\", Ans);\n return 0;\n}\n"}, {"source_code": "#include \n\nint GetSum(int n)\n{\n return (1 + 1 + (n - 1) * 2) * n / 2;\n}\n\nint main()\n{\n int a1, a2, a3, a4, a5, a6;\n int Ans = 0;\n scanf(\"%d %d %d %d %d %d\", &a1, &a2, &a3, &a4, &a5, &a6);\n if(a2 == a6) {\n Ans += GetSum(a1 + a2) - GetSum(a1);\n Ans += GetSum(a4 + a3) - GetSum(a4);\n } else if(a2 < a6) {\n Ans += GetSum(a1 + a2) - GetSum(a1);\n Ans += (a6 - a2) * (GetSum(a4 + a5 + 1) - 1);\n Ans += GetSum(a4 + a5) - GetSum(a4);\n } else {\n Ans += GetSum(a1 + a6) - GetSum(a1);\n Ans += (a2 - a6) * (GetSum(a4 + a3 + 1) - 1);\n Ans += GetSum(a4 + a3) - GetSum(a4);\n }\n printf(\"%d\\n\", Ans);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main(){\n int a1,a2,a3,a4,a5,a6,i,j,sum=0;\n scanf(\"%d%d%d%d%d%d\",&a1,&a2,&a3,&a4,&a5,&a6);\n i=2*(a1+a2)-1;\n j=i;\n while(i>=(2*a1+1)){\n sum+=i;\n i-=2;\n }\n while(j>=(2*a4+1)){\n sum+=j;\n j-=2;\n }\n printf(\"%d\",sum);\n return 0;\n}\n"}, {"source_code": "#include\n\nint max(int a, int b)\n{\n if(a>b)\n {\n return a;\n }\n else\n return b;\n}\n\nint main()\n{\n double a,b,c,d,e,f;\n scanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n\n double area;\n area = (2*a+b)*b + c*(d+a+b);\n printf(\"%d\",area);\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\ndouble area_triagle(int a)\n{\n return (sqrt(3)*a*a)/4;\n}\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\n double n_triangle = area_triagle(b+a+c) / area_triagle(1);\n n_triangle -= a*2-1 + c*2-1 + e*2-1;\n\n printf(\"%d\\n\", (int)n_triangle);\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(void) {\n\tint a[6],i=0,min=0;\n\tint sum=0;\n\t\n\twhile(i<6)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t\ti++;\n\t}\n\t\n\tif(a[1]\n\nint main(void) {\n\tint a[6],i=0,min=0;\n\tint sum=0;\n\t\n\twhile(i<6)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t\ti++;\n\t}\n\t\n\tif(a[1]\n\nint main(){\n\tint arr[6], flag = 0, i;\n\tfor(i = 0;i<6;i++){\n\t\tscanf(\"%d\",&arr[i]);\n\t}\n\tint j = 0,k = 0, ans = 0;\n\tint temp = 2*arr[0] + 1;\n\twhile(j\n\nint main(){\n\tint arr[6], flag = 0, i;\n\tfor(i = 0;i<6;i++){\n\t\tscanf(\"%d\",&arr[i]);\n\t}\n\tint j = 0,k = 0, ans = 0;\n\tint temp = 2*arr[0] + 1;\n\twhile(j\n#include \nint main()\n{\n\tint n,i,arr[6],a,b,ans=0;\n\tfor(i=0;i<6;i++)\n\tscanf(\"%d\",&arr[i]);\n\ta=arr[0];\n\tb=arr[1];\n\tfor(i=0;i\n#include\n\nint cmp(const void *a,const void *b)\n{\n return *(int *)a-*(int *)b;\n}\n\nint main()\n{\n int a1,a2,a3,i,j,top;\n int a[6],b[6];\n\n for(i=0;i<6;i++)scanf(\"%d\",&a[i]);\n qsort(a,6,sizeof(int),cmp);\n b[0]=a[0];\n for(top=0,i=1;i<6;i++)\n if(a[i]!=b[top])b[++top]=a[i];\n if(top==0)\n {\n a1=a2=a3=b[0];\n printf(\"%d\\n\",2*(a1*a2+a1*a3+a2*a3));\n }\n else if(top==1)\n {\n a1=b[0];\n a3=b[1];\n printf(\"%d\\n\",a1*a1+a3*a3+4*a1*a3);\n }\n else\n {\n a1=b[0];\n a2=b[1];\n a3=b[2];\n printf(\"%d\\n\",2*(a1*a2+a1*a3+a2*a3));\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\nint cmp(const void *a,const void *b)\n{\n return *(int *)a-*(int *)b;\n}\n\nint main()\n{\n int a1,a2,a3,i,j,top;\n int a[6],b[6];\n\n for(i=0;i<6;i++)scanf(\"%d\",&a[i]);\n qsort(a,6,sizeof(int),cmp);\n b[0]=a[0];\n for(top=0,i=1;i<6;i++)\n if(a[i]!=b[top])b[++top]=a[i];\n if(top==0)\n {\n a1=a2=a3=b[0];\n printf(\"%d\\n\",2*(a1*a2+a1*a3+a2*a3));\n }\n else if(top==1)\n {\n a1=b[0];\n a3=b[1];\n printf(\"%d\\n\",a1*a1+a3*a3+4*a1*a3);\n }\n else if(top==2)\n {\n a1=b[0];\n a2=b[1];\n a3=b[2];\n printf(\"%d\\n\",2*(a1*a2+a1*a3+a2*a3));\n }\n else\n {\n if(a[1]>a[5])printf(\"%d\\n\",a[0]*a[1]+a[1]*a[5]+a[2]*a[2]+a[2]*a[3]);\n else printf(\"%d\\n\",a[0]*a[5]+a[1]*a[5]+a[4]*a[4]+a[4]*a[3]);\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\nint max(int i,int j)\n{\n if(i>=j)\n return i;\n else\n return j;\n}\nint main()\n{\n int i, j, k ,flag=0, n , a,b,c,d,e,f,count = 0 ;\n scanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n while(1)\n {\n if(c==0 || e ==0)\n break;\n count = count + d*2+1;\n //printf(\"%d\\n\",count);\n d =d++;\n c--;\n e--;\n }\n if(c==0)\n {\n while(1)\n {\n if(b==0 || e==0)\n break;\n\n count = count + d*2;\n //printf(\"%d\\n\",count);\n b--;\n e--;\n }\n while(1){\n if(b==0)\n break;\n d--;\n count = count + d*2 +1;\n //printf(\"%d\\n\",count);\n b--;\n\n }\n }\n\n if(e==0)\n {\n while(1)\n {\n if(c==0 || f==0)\n break;\n count = count + d*2;\n c--;\n f--;\n }\n while(1){\n if(f==0)\n break;\n d--;\n count = count + d*2 +1;\n //printf(\"%dsfg\\n\",count);\n f--;\n\n }\n\n }\n printf(\"%d\",count);\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\nint max(int i,int j)\n{\n if(i>=j)\n return i;\n else\n return j;\n}\nint main()\n{\n int i, j, k ,flag=0, n , a,b,c,d,e,f,count = 0 ;\n scanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n while(1)\n {\n if(c==0 || e ==0)\n break;\n count = count + d*2+1;\n //printf(\"%d\\n\",count);\n d =d++;\n c--;\n e--;\n }\n if(c==0)\n {\n while(1)\n {\n if(b==0 || e==0)\n break;\n\n count = count + d*2;\n //printf(\"%d\\n\",count);\n b--;\n e--;\n }\n while(1){\n if(b==0)\n break;\n d--;\n count = count + d*2 +1;\n //printf(\"%d\\n\",count);\n b--;\n\n }\n printf(\"%d\",count);\n return 0;\n }\n\n if(e==0)\n {\n while(1)\n {\n if(c==0 || f==0)\n break;\n count = count + d*2;\n c--;\n f--;\n }\n while(1){\n if(f==0)\n break;\n d--;\n count = count + d*2 +1;\n //printf(\"%dsfg\\n\",count);\n f--;\n\n }\n\n }\n printf(\"%d\",count);\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n\nint main()\n{\n int i, j, k ,flag=0, n , a,b,c,d,e,f;\n long long int count = 0 ;\n scanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n while(1)\n {\n if(c==0 || e ==0)\n break;\n count = count + d*2+1;\n //printf(\"%d\\n\",count);\n d =d++;\n c--;\n e--;\n }\n if(c==0)\n {\n while(1)\n {\n if(b==0 || e==0)\n break;\n\n count = count + d*2;\n //printf(\"%d\\n\",count);\n b--;\n e--;\n }\n while(1){\n if(b==0)\n break;\n d--;\n count = count + d*2 +1;\n //printf(\"%d\\n\",count);\n b--;\n\n }\n printf(\"%lld\\n\",count);\n return 0;\n }\n\n if(e==0)\n {\n while(1)\n {\n if(c==0 || f==0)\n break;\n count = count + d*2;\n c--;\n f--;\n }\n while(1){\n if(f==0)\n break;\n d--;\n count = count + d*2 +1;\n //printf(\"%dsfg\\n\",count);\n f--;\n\n }\n\n }\n printf(\"%lld\\n\",count);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n//||\n//\\n\nint cmpfunc (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\nint main()\n{\n int a,b,c,d,e,p=0,q=0,r,s=0,i,j,sum=0;\n int x[10];\n for(i=0;i<6;i++)\n {\n scanf(\"%d\",&x[i]);\n }\n d=(x[5]*2)-1;\n\n\n for(i=1;i<=x[0];i++)\n { d=d+2;\n sum=sum+d;\n\n\n }\n e=(x[0]*2)-1;\n for(i=1;i<=x[5];i++)\n { e=e+2;\n sum=sum+e;\n\n }\n printf(\"%d\",sum);\n return 0;}"}, {"source_code": "#include \n#include \n#include \n#include \n//||\n//\\n\nint cmpfunc (const void * a, const void * b)\n{\n return ( *(int*)b - *(int*)a );\n}\nint main()\n{\n double a,b,c,d,e,f,p,q,r,x,y,z,m,n,l,v,v1,tr,sum=0,sum1;\n int x3=0;\n scanf(\"%lf %lf %lf %lf %lf %lf\",&a,&b,&c,&d,&e,&f);\n\n p=sqrt(a*a+b*b+a*b);\n q=sqrt(c*c+d*d+c*d);\n r=sqrt(e*f+e*e+f*f);\n x=(p+a+b)/2;\n y=(q+c+d)/2;\n z=(r+e+f)/2;\n v1=(x+y+z)/2;\n\n m=sqrt(x*(x-p)*(x-a)*(x-b));\n n=sqrt(y*(y-q)*(y-c)*(y-d));\n l=sqrt(z*(z-r)*(z-e)*(z-f));\n v=sqrt(v1*(v1-x)*(v1-y)*(v1-z));\n sum=sum+m+n+l+v;\n tr=(sqrt(3))/4;\n sum1=sum/tr;\n x3=sum1;\n printf(\"%d\",x3);\n return 0;}"}, {"source_code": "#include \n#include \n#include \n#include \n//||\n//\\n\nint cmpfunc (const void * a, const void * b)\n{\n return ( *(int*)b - *(int*)a );\n}\nint main()\n{\n double a,b,c,d,e,f,p,q,r,x,y,z,m,n,l,v,v1,tr,sum=0,sum1;\n int x3=0;\n scanf(\"%lf %lf %lf %lf %lf %lf\",&a,&b,&c,&d,&e,&f);\n\n\n\n p=sqrt(a*a+b*b+a*b);\n q=sqrt(c*c+d*d+c*d);\n r=sqrt(e*f+e*e+f*f);\n x=(p+a+b)/2;\n y=(q+c+d)/2;\n z=(r+e+f)/2;\n v1=(p+q+r)/2;\n\n m=sqrt(x*(x-p)*(x-a)*(x-b));\n n=sqrt(y*(y-q)*(y-c)*(y-d));\n l=sqrt(z*(z-r)*(z-e)*(z-f));\n v=sqrt(v1*(v1-p)*(v1-q)*(v1-r));\n sum=sum+m+n+l+v;\n tr=(sqrt(3))/4;\n sum1=sum/tr;\n x3=sum1;\n printf(\"%d\",x3);\n return 0;}"}, {"source_code": "#include \n#include \n#include \n#include \n//||\n//\\n\nint cmpfunc (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\nint main()\n{\n int a,b,c,d,p=0,q=0,r,s=0,i,j,sum=0;\n int x[10];\n for(i=0;i<6;i++)\n {\n scanf(\"%d\",&x[i]);\n }\n d=(x[5]*2)-1;\n\n\n for(i=1;i<=x[0];i++)\n { d=d+2;\n sum=sum+d;\n\n\n }\n for(i=1;i<=x[1];i++)\n {\n sum=sum+d;\n d=d-2;\n }\n printf(\"%d\",sum);\n return 0;}"}, {"source_code": "#include \n#include \n#define s(x) scanf(\"%d\" , &x)\nint main()\n{\n int i;\n double a1 , a2 , b1 , b2 , t1 , t2 , x1 , r1 , r2 , total , tri , num , ans;\n double arr[6];\n for(i = 0; i < 6; i ++)\n scanf(\"%lf\" , &arr[i]);\n a1 = arr[0] / 2;\n //printf(\"%lf\\n\" , a1);\n a2 = (sqrt(3) * arr[0]) / 2;\n b1 = arr[1] / 2;\n b2 = (sqrt(3) * arr[1]) / 2;\n t1 = a1 * a2;\n t2 = b1 * b2;\n if(a1 >= b1)\n {\n x1 = (a1 - b1);\n r1 = 2 * x1 * b2;\n r2 = (arr[0] - 2 * x1) * (a2 + b2);\n }\n else\n {\n x1 = (b1 - a1);\n r1 = 2 * x1 * a2;\n r2 = (arr[1] - 2 * x1) * (a2 + b2);\n }\n total = t1 + t2 + r1 + r2;\n //printf(\"%lf\" , total);\n tri = sqrt(3) / 4;\n num = total / tri;\n ans = round(num);\n printf(\"%lf\" , ans);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#define s(x) scanf(\"%d\" , &x)\nint main()\n{\n long long int ans1;\n int i;\n double a1 , a2 , b1 , b2 , t1 , t2 , x1 , r1 , r2 , total , tri , num , ans;\n double arr[6];\n for(i = 0; i < 6; i ++)\n scanf(\"%lf\" , &arr[i]);\n a1 = arr[0] / 2;\n //printf(\"%lf\\n\" , a1);\n a2 = (sqrt(3) * arr[0]) / 2;\n b1 = arr[1] / 2;\n b2 = (sqrt(3) * arr[1]) / 2;\n t1 = a1 * a2;\n t2 = b1 * b2;\n if(a1 >= b1)\n {\n x1 = (a1 - b1);\n r1 = 2 * x1 * b2;\n r2 = (arr[0] - 2 * x1) * (a2 + b2);\n }\n else\n {\n x1 = (b1 - a1);\n r1 = 2 * x1 * a2;\n r2 = (arr[1] - 2 * x1) * (a2 + b2);\n }\n total = t1 + t2 + r1 + r2;\n //printf(\"%lf\" , total);\n tri = sqrt(3) / 4;\n num = total / tri;\n ans = round(num);\n ans1 = (int)ans;\n printf(\"%lld\" , ans1);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#define s(x) scanf(\"%d\" , &x)\nint main()\n{\n int i;\n double a1 , a2 , b1 , b2 , t1 , t2 , x1 , r1 , r2 , total , tri , num , ans;\n double arr[6];\n for(i = 0; i < 6; i ++)\n scanf(\"%lf\" , &arr[i]);\n a1 = arr[0] / 2;\n //printf(\"%lf\\n\" , a1);\n a2 = (sqrt(3) * arr[0]) / 2;\n b1 = arr[1] / 2;\n b2 = (sqrt(3) * arr[1]) / 2;\n t1 = a1 * a2;\n t2 = b1 * b2;\n if(a1 >= b1)\n {\n x1 = (a1 - b1);\n r1 = 2 * x1 * b2;\n r2 = (arr[0] - 2 * x1) * (a2 + b2);\n }\n else\n {\n x1 = (b1 - a1);\n r1 = 2 * x1 * a2;\n r2 = (arr[1] - 2 * x1) * (a2 + b2);\n }\n total = t1 + t2 + r1 + r2;\n //printf(\"%lf\" , total);\n tri = sqrt(3) / 4;\n num = total / tri;\n ans = round(num);\n printf(\"%ld\" , (int)ans);\n return 0;\n}\n"}, {"source_code": "#include \n\n\n\n\nint main(void) {\n // your code goes here\n int a,b,c,d,e,f,ta;\n //long long int q,sum;\n \n \n\n\n scanf(\"%d %d %d %d %d %d\",&a,&b,&c,&d,&e,&f);\n \n ta = (2*a+b)*b + (2*d+c)*c;\n printf(\"%d\",ta);\n \n\n\n return 0;\n}\n\n"}, {"source_code": "#include \n\n\n\n\nint main(void) {\n // your code goes here\n int a,b,c,d,e,f,ta,min1,min2,dif1,dif2;\n //long long int q,sum;\n \n\n scanf(\"%d %d %d %d %d %d\",&a,&b,&c,&d,&e,&f);\n \n min1 = (b>f)?f:b;\n dif1 = (b>f)?(b-f):(f-b);\n min2 = (c>e)?e:c;\n dif2 = (c>e)?(c-e):(e-c);\n \n ta = (2*a + min1)*min1 + (2*d + min2)*min2 + (dif1 + dif2)*4 ;\n printf(\"%d\",ta);\n \n\n\n return 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n int a,i,max=0,s=0;\n for(i=0;i<6;i++)\n {\n scanf(\"%d\",&a);\n s+=a+(a-1);\n if(a>max)\n max=a;\n }\n printf(\"%d\\n\",s+max-1);\n return 0;\n}\n"}, {"source_code": "#include \n#define min(a, b) (a < b) ? (a) : (b);\n#define max(a, b) (a > b) ? (a) : (b);\n\nint A[7];\n\nint main() {\n\tint i, first, middle, last, tmp, s, ans = 0;\n\n\tfor(i = 0; i < 6; ++i) {\n\t\tscanf(\"%d\", &A[i]);\n\t}\n\tfirst = min(A[1], A[5]);\n\tlast = min(A[2], A[3]);\n\ttmp = max(A[1], A[5]);\n\tmiddle = tmp - first;\n\ts = A[0];\n\twhile(first--) {\n\t\tans += 2 * s + 1;\n\t\t++s;\n\t}\n\tif(A[1] != A[5]) {\n\t\tans += 2 * s * middle;\n\t}\n\twhile(last--) {\n\t\tans += 2 * s - 1;\n\t\t--s;\n\t}\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint A[7];\n\nint main() {\n\tint i, n, m, s, ans = 0;\n\n\tfor(i = 0; i < 6; ++i) {\n\t\tscanf(\"%d\", &A[i]);\n\t}\n\tn = A[1];\n\tm = A[2];\n\ts = A[0];\n\twhile(n--) {\n\t\tans += 2 * s + 1;\n\t\t++s;\n\t}\n\twhile(m--) {\n\t\tans += 2 * s - 1;\n\t\t--s;\n\t}\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint m[1010][1010];\n\nint main() {\n\tint a, b;\n\tscanf(\"%d%d%d%d%d%d\", &a, &b, &a, &b, &a, &b);\n\tint s;\n\tfor(int i = 1; i <= 1000; i++) {\n\t\tfor(int j = i; j <= 1000; j++) {\n\t\t\ts = 7 + (i-1)*4 + (j-2)*2;\n\t\t\tif(i == 1 && j == 1) {\n\t\t\t\tm[i][j] = 6;\n\t\t\t} else {\n\t\t\t\tm[i][j] = m[i][j-1] + s;\n\t\t\t\tm[j][i] = m[i][j];\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\", m[a][b]);\n\treturn 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int a1, a2, a3, a4, a5, a6, z;\n scanf(\"%d%d%d%d%d%d\", &a1, &a2, &a3, &a4, &a5, &a6);\n z = a2*a2+a3*a3-(2*a1*a1) + 2*a1*a2+2*a2*a3+2*a1*a3;\n printf(\"%d\", z);\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n\nint main()\n{\n int len[6];\n for(int i=0;i<6;i++)\n {\n scanf(\"%d\",&len[i]);\n }\n int max_len=len[1]+len[0]*2;\n int sub_len=len[0];\n printf(\"%d\\n\",max_len*max_len-3*sub_len*sub_len);\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#define N 100\nint main() {\n\tstatic char s[N + 1];\n\tint l, i, j, k;\n\tscanf(\"%s\", s);\n\tl = strlen(s);\n\tfor (i = 0; i < l; i++)\n\t\tif ((s[i] - '0') % 8 == 0) {\n\t\t\tprintf(\"YES\\n%c\\n\", s[i]);\n\t\t\treturn 0;\n\t\t}\n\tfor (i = 0; i < l; i++)\n\t\tfor (j = i + 1; j < l; j++)\n\t\t\tif (((s[i] - '0') * 10 + (s[j] - '0')) % 8 == 0) {\n\t\t\t\tprintf(\"YES\\n%c%c\\n\", s[i], s[j]);\n\t\t\t\treturn 0;\n\t\t\t}\n\tfor (i = 0; i < l; i++)\n\t\tfor (j = i + 1; j < l; j++)\n\t\t\tfor (k = j + 1; k < l; k++)\n\t\t\t\tif (((s[i] - '0') * 100 + (s[j] - '0') * 10 + (s[k] - '0')) % 8 == 0) {\n\t\t\t\t\tprintf(\"YES\\n%c%c%c\\n\", s[i], s[j], s[k]);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "//\n// main.c\n// A. Gerald's Hexagon\n//\n// Created by Omer Fehmi Aykan on 6.08.2015.\n// Copyright (c) 2015 Omer Fehmi Aykan. All rights reserved.\n//\n\n#include \n\nint a1, a2, a3, a4, a5, a6;\n\nint main(int argc, const char * argv[]) {\n\n scanf(\"%d %d %d %d %d %d\", &a1, &a2, &a3, &a4, &a5, &a6);\n \n printf(\"%d\", (a1+a2+a3)*(a1+a2+a3)-a1*a1-a2*a2-a3*a3);\n \n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n#include \n\nint mxpw(x, b){\n int res = 1;\n while(res*b < x) res *= b;\n return res;\n}\n\nint main(){\n int a, b;\n scanf(\"%d\", &a);\n scanf(\"%d\", &b);\n printf(\"%d\", a*a+4*a*b+b*b);\n\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n\nint main(void)\n{\n int a[6];\n int sum = 0;\n\n\n for(int i = 0; i < 6; i++)\n scanf(\"%d\", &a[i]);\n for(int i = 0; i < 6; i++)\n printf(\"%d\\n\", a[i]);\n\n for(int i = 0; i < a[0]; i++)\n sum += a[1] + i + a[1] + i + 1;\n for(int i = 0; i < a[1]; i++)\n sum += a[0] + i + a[0] + i + 1;\n printf(\"%d\", sum);\n\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n\nint main(void)\n{\n int a[6];\n int sum = 0;\n\n\n for(int i = 0; i < 6; i++)\n scanf(\"%d\", &a[i]);\n\n for(int i = 0; i < a[0]; i++)\n sum += a[1] + i + a[1] + i + 1;\n for(int i = 0; i < a[1]; i++)\n sum += a[0] + i + a[0] + i + 1;\n printf(\"%d\", sum);\n\n\n return 0;\n}\n"}, {"source_code": "#include \n#define fin stdin\n#define fout stdout\nint main(){\n int a1, a2, a3, a4, a5, a6, x, i;\n long long ans;\n //FILE *fin, *fout;\n //fin=fopen(\"a.in\", \"r\");\n //fout=fopen(\"a.out\", \"w\");\n fscanf(fin, \"%d%d%d%d%d%d\", &a1, &a2, &a3, &a4, &a5, &a6);\n ans=0;\n x=1+2*a1;\n for(i=0; (i\n#define fin stdin\n#define fout stdout\nint main(){\n int a1, a2, a3, a4, a5, a6, x, i;\n long long ans;\n //FILE *fin, *fout;\n //fin=fopen(\"a.in\", \"r\");\n //fout=fopen(\"a.out\", \"w\");\n fscanf(fin, \"%d%d%d%d%d%d\", &a1, &a2, &a3, &a4, &a5, &a6);\n ans=0;\n x=1+2*a1;\n for(i=0; i\n#define fin stdin\n#define fout stdout\nint main(){\n int a1, a2, a3, a4, a5, a6, x, i, aux;\n long long ans;\n //FILE *fin, *fout;\n //fin=fopen(\"a.in\", \"r\");\n //fout=fopen(\"a.out\", \"w\");\n fscanf(fin, \"%d%d%d%d%d%d\", &a1, &a2, &a3, &a4, &a5, &a6);\n ans=0;\n x=1+2*a1;\n for(i=0; (i\n#include \n#include \n\nint main() {\n\n int i,a[6];\n\n for (i=0 ; i<6 ; i++) {\n scanf(\"%d\",&a[i]);\n }\n\n int out;\n if (a[0] < a[2]) {\n out = 2*a[0]*a[1] + a[0]*a[0] + 2*(a[0] + a[1]) * (a[2] - a[0]) + a[3]*a[3] + 2*a[3]*a[4];\n } else {\n out = 2*a[0]*a[1] + a[0]*a[0] + 2*(a[0] + a[1]) * (a[0] - a[2]) + a[3]*a[3] + 2*a[3]*a[4];\n }\n\n printf(\"%d\",out);\n\n return 0;\n}\n\n"}, {"source_code": "#include \n#include \n#include \n\nint main() {\n\n int i,a[6];\n\n for (i=0 ; i<6 ; i++) {\n scanf(\"%d\",&a[i]);\n }\n\n int out;\n\n out = a[0]*a[2] + 2* a[0] * a[1] + a[3]*a[5] + 2 * a[4] * a[5];\n printf(\"%d\",out);\n\n return 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n\tint a,b,c,d,e,f;\n\tlong long int k;\n\tscanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n\tk=(2*a+b+2*c)*(2*a+b+2*c);\n\tk=k-a*a;k=k-c*c;k=k-e*e;\n\tprintf(\"%I64d\",k);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main ()\n{\n\n int a1,a2,a3,a4,a5,a6;\n scanf(\"%d%d%d%d%d%d\",&a1,&a2,&a3,&a4,&a5,&a6);\n int i,s=0,n1=a1,n2=a4;\n if(a1>1)\n {\n n1=a1+(a1-1);\n }\n s=n1+2;\n for(i=a2;i>1;i--)\n {\n s=s+(s+2);\n\n }\n\n if(a4>1)\n {\n n2=a4+(a4-1);\n }\n s=s+n2+2;\n for(i=a3;i>1;i--)\n {\n s=s+(s+2);\n }\n\n printf(\"%d\\n\",s);\n\n\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main(){\n\tlong long int a,b,c,d,e,f,sum;\n\tscanf(\"%lld%lld%lld%lld%lld%lld\",&a,&b,&c,&d,&e,&f);\n\tsum=pow(a+b+c,2)-pow(a,2)-pow(e,2);\n\tprintf(\"%lld\",sum);\n\treturn 0;\n}\n\n"}, {"source_code": "#include\n#include\nint main(){\n\tlong long int a,b,c,d,e,f,sum;\n\tscanf(\"%lld%lld%lld%lld%lld%lld\",&a,&b,&c,&d,&e,&f);\n\tsum=pow(a+b+c,2)-pow(a,2)-pow(e,2)-pow(c,2);\n\tprintf(\"%lld\",sum-1);\n\treturn 0;\n}\n\n"}, {"source_code": "#include\n#include\nint main(){\n\tlong long int a,b,c,d,e,f,sum;\n\tscanf(\"%lld%lld%lld%lld%lld%lld\",&a,&b,&c,&d,&e,&f);\n\tsum=pow(a+b+c,2)-pow(a,2)-pow(e,2);\n\tprintf(\"%lld\",sum-1);\n\treturn 0;\n}\n\n"}, {"source_code": "#include \n\n#define max(a, b) (a) > (b) ? (a) : (b)\n#define min(a, b) (a) < (b) ? (a) : (b)\n\nint main(){\n\n int a[6], i, res=0, len, lim, m;\n\n for(i=0; i<6; i++)\n scanf(\"%d\", &a[i]);\n\n len = a[2];\n\n lim = max(a[1], a[3]);\n m = min(a[1], a[3]);\n\n for(i=0; i\n\nint main(){\n\n int a[6], i, res=0, len;\n\n for(i=0; i<6; i++)\n scanf(\"%d\", &a[i]);\n\n len = a[2];\n\n for(i=0; i\n\nint main() {\n\tint a, b;\n\tscanf(\"%d %d\", &a, &b);\n\tprintf(\"%d\\n\", a*a + b*b + 4*a*b);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tint a,b,c,d,e,f,s,t,i,j,r;\n\tscanf(\"%d %d %d %d %d %d %d\",&a,&b,&c,&d,&e,&f);\n\ts=0;\n\tt=0;\n\tif (a==b){\t\n\t\tfor (i=1;i0;j--){\n\t\t\tt=t+2*j+a+b;\n\t\t}\n\t\tprintf(\"%d\",s+t);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tint a,b,c,d,e,f,s,t,i,j;\n\tscanf(\"%d %d %d %d %d %d %d\",&a,&b,&c,&d,&e,&f);\n\ts=0;\n\tt=0;\n\tfor (i=1;i0;j--){\n\t\tt=t+2*j+a+b;\n\t}\n\tprintf(\"%d\",s+t);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include\n#include\n\nint main ( ){\n int ar[6] ; \n double a, b, h;\n int temp1 , i,temp2 ; \n for ( i = 0 ; i < 6 ; i++ ) {\n scanf(\"%d\", &ar[i] ) ; \n }\n double area = 0 ; \n a = ar[1] ; \n temp1 = ar[0] ; \n temp2 = ar[2] ; \n area += 0.5 * temp1*sqrt(3)* (a + a+temp1)/2 ; \n \n a = ar[4] ; \n temp1 = ar[3] ; \n temp2 = ar[5] ; \n area += 0.5 * temp1*sqrt(3)* (a + a+temp1)/2 ; \n printf(\"%d\\n\",(int)(area*4.0/sqrt(3))) ; \n return 0 ; \n //printf(\"%lf\\n\",((area/sqrt(3))*4)) ; \n}"}, {"source_code": "#include \n#include\n#include\n\nint min (int a , int b ) {\n if ( a > b ) \n return b ; \n return a ; \n}\nint abs (int a ) {\n if ( a >= 0 )\n return a ;\n return -a ; \n}\n\ndouble tArea (int a , int side1 , int side2, int flag ){\n if (flag == 0 ) {\n return a*min(side1,side2) /2 ; \n }\n if ( flag > 0 ){\n return ( 0.5 * (min(side1,side2)*sqrt(3)/2)*(a+ a+min(side1,side2))) ; \n }\n if (flag < 0 ) {\n return ( 0.5 * (min(side1,side2)*sqrt(3)/2)*(a+ a-min(side1,side2))) ; \n }\n }\n \nint main ( ) {\n double a , b , h ; \n int ar[6] ; \n int i ; \n double area = 0.0 ; \n for ( i = 0 ; i < 6 ; i ++ ) {\n scanf(\"%d\",&ar[i]) ; \n }\n a = ar[0] ; \n if (ar[1] == ar[5] ) {\n area += tArea(a,ar[1],ar[5] , 1 ) ;\n b = a + ar[1] ; \n area += tArea(b , ar[2],ar[4],-1) ;\n printf (\"%d\\n\",(int)(area*4/sqrt(3))) ; \n return 0 ;\n }\n area += tArea(a,ar[1],ar[5],1) ; \n b = a + ar[1] ; \n if (ar[1] < ar[5]) {\n area += tArea(b,abs(ar[1]-ar[5]), ar[2],0) ; \n area += tArea(b,ar[4] , ar[2]-abs(ar[1]-ar[5]),-1) ; \n }\n else if ( ar[1] > ar[5]) {\n area += tArea(b,abs(ar[1]-ar[5]), ar[4],0) ;\n area += tArea(b,ar[2], ar[4] - abs(ar[1]-ar[5]),-1) ; \n }\n printf(\"%d\\n\", (int)(area*4 /sqrt(3))) ; \n return 0 ; \n}\n \n \n \n \n \n\n "}, {"source_code": "#include \nint main()\n{\n int a1,a2,a3,a4,a5,a6,i;\n scanf(\"%d %d %d %d %d %d\",&a1,&a2,&a3,&a4,&a5,&a6);\n\n long long int res;\n int p;\n p=2*a1+1;\n res=0;\n for(i=0;i0;j--)\n {\n sum+=(2*j-1);\n }\n }\n if(cnt==3){sum-=cnt;sum+=1;}\n printf(\"%I64d\",sum);\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include \n\nint\nmain(void){\n int num[12];\n int i, j, min = 0;\n for(i=0;i<6;i++){\n scanf(\"%d\",&num[i]);\n if(num[i]=0;i--){\n num[i+min]=num[i];\n }\n for(i=5;i+min>=6;i--){\n num[i+min-6] = num[i+min];\n }\n \n int sum = 0;\n for(i=0;i0;i--){\n sum+=num[1]*2;\n }\n for(i=0;i\n\nint main()\n{\n\tint a,b,c,ans,sum1,sum2,sum;\n\tint s[7];\n\tint i;\n\tfor(i=1;i<=6;i++)scanf(\"%d\",&s[i]);\n\tsum1=s[1]*s[1]+s[3]*s[3]+s[5]*s[5];\n\tsum2=s[2]*s[2]+s[4]*s[4]+s[6]*s[6];\n\tif(sum1\n\nint main()\n{\n int a,b,c,ans,sum1,sum2,sum;\n int s[7];\n int i;\n for(i=1;i<=6;i++)scanf(\"%d\",&s[i]);\n sum1=s[1]*s[1]+s[3]*s[3]+s[5]*s[5];\n sum2=s[2]*s[2]+s[4]*s[4]+s[6]*s[6];\n if(sum1\n#include \nint getmin(int a,int b){\n if(a>b) return b;\n return a;\n}\nint getmax(int a,int b){\n if(a>b) return a;\n return b;\n}\nint main()\n{\n int l1,l2,l3,l4,l5,l6,x,con,i;\n scanf(\"%d%d%d%d%d%d\" ,&l1,&l2,&l3,&l4,&l5,&l6);\n con=0;\n if(l2==l6){\n x=l1;\n for(i=0;i\n#include \nint getmin(int a,int b){\n if(a>b) return b;\n return a;\n}\nint getmax(int a,int b){\n if(a>b) return a;\n return b;\n}\nint main()\n{\n int l1,l2,l3,l4,l5,l6,x,con,i;\n scanf(\"%d%d%d%d%d%d\" ,&l1,&l2,&l3,&l4,&l5,&l6);\n con=0;\n if(l2>l6){\n x=l1;\n for(i=0;i\n#include \nint getmin(int a,int b){\n if(a>b) return b;\n return a;\n}\nint getmax(int a,int b){\n if(a>b) return a;\n return b;\n}\nint main()\n{\n int l1,l2,l3,l4,l5,l6,x,con,i;\n scanf(\"%d%d%d%d%d%d\" ,&l1,&l2,&l3,&l4,&l5,&l6);\n con=0;\n if(l2==l6){\n x=l1;\n for(i=0;i\n\nint calculate(int x,int y){\n\tint i,j,count=0;\n\tfor(i=x;i\n\nint calculate(int x,int y){\n\tint i,j,count=0;\n\tfor(i=x;i\n\nint main(void)\n{\n int i,a[6];\n float sum;\n for(i = 0; i < 6; i++)\n {\n scanf(\"%d\",&a[i]);\n }\n sum = 0;\n sum += (((float)a[0])/2) * (2*(2*a[1]+1) +(a[0] - 1)*2);\n sum += (((float)a[3])/2) * (2*(2*a[4]+1) +(a[3] - 1)*2);\n \n printf(\"%d\\n\",(int)sum);\n return 0;\n}"}, {"source_code": "#include\nmain()\n{\n\tint t[6],a,b,i,sum=0,temp;\n\tfor(i=0;i<6;i++)\n\t\tscanf(\"%d\",&t[i]);\n\ta=t[0];\n\tb=t[1];\n\ttemp=a;\n\tfor(i=b;i>0;i--)\n\t{\n\t\tsum=temp*2+1+sum;\n\t\ttemp++;\n\t\t}\n\ttemp--;\n\tfor(i=a;i>0;i--)\n\t{\n\t\tsum=temp*2+1+sum;\n\t\ttemp--;\n\t\t}\n\tprintf(\"%d\",sum);\n\treturn 0;\n\t}"}, {"source_code": "#include\nmain()\n{\n\tint t[6],a,b,i,sum=0,temp,c;\n\t\n\tfor(i=0;i<6;i++)\n\t{\n\t\tscanf(\"%d\",&t[i]);\n\t\t}\n\t\n\tsum=t[0]*t[1]+t[2]*t[3]+t[4]*t[5];\n\tsum*=2;\n\t\ta=t[0]>t[3]?t[0]-t[3]:t[3]-t[0];\n\tif(a!=0)\n\t\tsum+=2*a-1;\n\t\t\n\tprintf(\"%d\",sum);\n\treturn 0;\n\t}"}], "src_uid": "382475475427f0e76c6b4ac6e7a02e21"} {"nl": {"description": "Let's denote d(n) as the number of divisors of a positive integer n. You are given three integers a, b and c. Your task is to calculate the following sum:Find the sum modulo 1073741824 (230).", "input_spec": "The first line contains three space-separated integers a, b and c (1 ≤ a, b, c ≤ 2000).", "output_spec": "Print a single integer — the required sum modulo 1073741824 (230).", "sample_inputs": ["2 2 2", "4 4 4", "10 10 10"], "sample_outputs": ["20", "328", "11536"], "notes": "NoteFor the first example. d(1·1·1) = d(1) = 1; d(1·1·2) = d(2) = 2; d(1·2·1) = d(2) = 2; d(1·2·2) = d(4) = 3; d(2·1·1) = d(2) = 2; d(2·1·2) = d(4) = 3; d(2·2·1) = d(4) = 3; d(2·2·2) = d(8) = 4. So the result is 1 + 2 + 2 + 3 + 2 + 3 + 3 + 4 = 20."}, "positive_code": [{"source_code": "#define F(i,a) for(i=1;i<=a;++i)\nunsigned int g[4000001],m[2001],s,a,b,c,i,j,k,n;main(){scanf(\"%d%d%d\",&a,&b,&c);n=a*b;F(i,a)F(j,b)++g[i*j];F(k,2)F(i,n)for(j=i+i;j<=n;j+=i)g[i]+=g[j];F(i,c){m[i]=1;k=i;for(j=2;j*j<=k;++j)if(k%j==0){m[i]*=-1;k/=j;if(k%j==0)m[i]=0;}if(k>1)m[i]*=-1;}F(k,c)F(i,k)if(k%i==0)F(j,i)s+=(i%j==0)*m[j]*g[j];printf(\"%d\\n\",s%(1<<30));}\n"}, {"source_code": "#define F(i,a) for(i=1;i<=a;++i)\nunsigned int g[4000001],m[2001],s,a,b,c,i,j,k,n;main(){scanf(\"%d%d%d\",&a,&b,&c);n=a*b;F(i,a)F(j,b)++g[i*j];F(k,2)F(i,n)for(j=i+i;j<=n;j+=i)g[i]+=g[j];F(i,c){m[i]=1;k=i;for(j=2;j*j<=k;++j)if(k%j==0){m[i]*=-1;k/=j;if(k%j==0)m[i]=0;}if(k>1)m[i]*=-1;}F(k,c)F(i,k)if(k%i==0)F(j,i)s+=(i%j==0)*m[j]*g[j];printf(\"%d\\n\",s%(1<<30));}\n"}, {"source_code": "#define F(i,a) for(i=1;i<=a;++i)\nunsigned int g[4000001],m[2001],s,a,b,c,i,j,k,n;main(){scanf(\"%d%d%d\",&a,&b,&c);n=a*b;F(i,a)F(j,b)++g[i*j];F(k,2)F(i,n)for(j=i+i;j<=n;j+=i)g[i]+=g[j];F(i,c){m[i]=1;k=i;for(j=2;j*j<=k;++j)if(k%j==0){m[i]*=-1;k/=j;if(k%j==0)m[i]=0;}if(k>1)m[i]*=-1;}F(k,c)F(i,k)if(k%i==0)F(j,i)s+=(i%j==0)*m[j]*g[j];printf(\"%d\\n\",s%(1<<30));}\n"}, {"source_code": "#define F(i,a) for(i=1;i<=a;++i)\nunsigned int g[4000001],m[2001],s,a,b,c,i,j,k,n;main(){scanf(\"%d%d%d\",&a,&b,&c);n=a*b;F(i,a)F(j,b)++g[i*j];F(k,2)F(i,n)for(j=i+i;j<=n;j+=i)g[i]+=g[j];F(i,c){m[i]=1;k=i;for(j=2;j*j<=k;++j)if(k%j==0){m[i]*=-1;k/=j;if(k%j==0)m[i]=0;}if(k>1)m[i]*=-1;}F(k,c)F(i,k)if(k%i==0)F(j,i)s+=(i%j==0)*m[j]*g[j];printf(\"%d\\n\",s%(1<<30));}\n"}, {"source_code": "#define F(i,a) for(i=1;i<=a;++i)\nunsigned int g[4000001],m[2001],s,a,b,c,i,j,k,n;main(){scanf(\"%d%d%d\",&a,&b,&c);n=a*b;F(i,a)F(j,b)++g[i*j];F(k,2)F(i,n)for(j=i+i;j<=n;j+=i)g[i]+=g[j];F(i,c){m[i]=1;k=i;for(j=2;j*j<=k;++j)if(k%j==0){m[i]*=-1;k/=j;if(k%j==0)m[i]=0;}if(k>1)m[i]*=-1;}F(k,c)F(i,k)if(k%i==0)F(j,i)s+=(i%j==0)*m[j]*g[j];printf(\"%d\\n\",s%(1<<30));}\n"}, {"source_code": "#define F(i,a) for(i=1;i<=a;++i)\nunsigned int g[4000001],m[2001],s,a,b,c,i,j,k,n;main(){scanf(\"%d%d%d\",&a,&b,&c);n=a*b;F(i,a)F(j,b)++g[i*j];F(k,2)F(i,n)for(j=i+i;j<=n;j+=i)g[i]+=g[j];F(i,c){m[i]=1;k=i;for(j=2;j*j<=k;++j)if(k%j==0){m[i]*=-1;k/=j;if(k%j==0)m[i]=0;}if(k>1)m[i]*=-1;}F(k,c)F(i,k)if(k%i==0)F(j,i)s+=(i%j==0)*m[j]*g[j];printf(\"%d\\n\",s%(1<<30));}"}, {"source_code": "#define F(i,a) for(i=1;i<=a;++i)\nunsigned int g[4000001],m[2001],s,a,b,c,i,j,k,n;main(){scanf(\"%d%d%d\",&a,&b,&c);n=a*b;F(i,a)F(j,b)++g[i*j];F(k,2)F(i,n)for(j=i+i;j<=n;j+=i)g[i]+=g[j];F(i,c){m[i]=1;k=i;for(j=2;j*j<=k;++j)if(k%j==0){m[i]*=-1;k/=j;if(k%j==0)m[i]=0;}if(k>1)m[i]*=-1;}F(k,c)F(i,k)if(k%i==0)F(j,i)s+=(i%j==0)*m[j]*g[j];printf(\"%d\\n\",s%(1<<30));}\n"}, {"source_code": "#define F(i,a) for(i=1;i<=a;++i)\nunsigned int g[4000001],m[2001],s,a,b,c,i,j,k,n;main(){scanf(\"%d%d%d\",&a,&b,&c);n=a*b;F(i,a)F(j,b)++g[i*j];F(k,2)F(i,n)for(j=i+i;j<=n;j+=i)g[i]+=g[j];F(i,c){m[i]=1;k=i;for(j=2;j*j<=k;++j)if(k%j==0){m[i]*=-1;k/=j;if(k%j==0)m[i]=0;}if(k>1)m[i]*=-1;}F(k,c)F(i,k)if(k%i==0)F(j,i)s+=(i%j==0)*m[j]*g[j];printf(\"%d\\n\",s%(1<<30));}\n"}, {"source_code": "#define F(i,a) for(i=1;i<=a;++i)\nunsigned int g[4000001],m[2001],s,a,b,c,i,j,k,n;main(){scanf(\"%d%d%d\",&a,&b,&c);n=a*b;F(i,a)F(j,b)++g[i*j];F(k,2)F(i,n)for(j=i+i;j<=n;j+=i)g[i]+=g[j];F(i,c){m[i]=1;k=i;for(j=2;j*j<=k;++j)if(k%j==0){m[i]*=-1;k/=j;if(k%j==0)m[i]=0;}if(k>1)m[i]*=-1;}F(k,c)F(i,k)if(k%i==0)F(j,i)s+=(i%j==0)*m[j]*g[j];printf(\"%d\\n\",s%(1<<30));}\n"}, {"source_code": "#include \n#include \n\nint d(int a){\n int ans=0;\nfor(int i=1;i<=sqrt(a);i++){\n if(a%i==0) ans++;\n}\nint x=sqrt(a);\nif(x*x==a) return 2*ans -1;\nreturn 2*ans ;\n}\n\nint main(void) {\n\n\n int a,b,c ;\nscanf(\"%d%d%d\", &a,&b,&c);\n \nlong long ans =0;\nfor(int i=1;i<=a;i++){\n for(int j=1;j<=b;j++){\n for(int k=1;k<=c;k++){\n ans += d(i*j*k);\n ans=ans %1073741824;\n\n }\n }\n\n }\nprintf(\"%I64d\",ans);\n return 0;\n}"}, {"source_code": "#include\n\nint ara[1000100];\nint main(){\n int i,j,k,a,b,c,sm=0;\n scanf(\"%d %d %d\",&a,&b,&c);\n\n for(i=1;i<=1000000;i++){\n for(j=1;i*j<=1000000;j++){\n ara[i*j]=ara[i*j]+1;\n }\n }\n\n for(i=1;i<=a;i++){\n for(j=1;j<=b;j++){\n for(k=1;k<=c;k++){\n sm=sm+ara[i*j*k];\n }\n }\n }\n printf(\"%d\",sm);\n}\n\n"}, {"source_code": "#include \n\nint prime[1000009];\nint fact[1000009];\nint sieve()\n{\n\tprime[0] = 1;\n\tprime[1] = 1;\n\tlong long int i = 2;\n\tfor(i=1;i<1000006;i++)\n\t{\n\t\tlong long int j = 2*i;\n\t\twhile(j<1000006)\n\t\t{\n\t\t\tfact[j]++;\n\t\t\tj+=i;\n\t\t}\n\t}\n}\n\nint main()\n{\n\tsieve();\n\tint a,b,c;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tint i,j,k;\n\tint ans = 0;\n\tfor(i=1;i<=a;i++)\n\t{\n\t\tfor(j=1;j<=b;j++)\n\t\t{\n\t\t\tfor(k=1;k<=c;k++)\n\t\t\t{\n\t\t\t\tint temp = i*j*k;\n\t\t\t\tans += (fact[temp]+1)%(1<<30);\n\t\t\t}\n\t\t}\n\t}\n\n\tprintf(\"%d\\n\",ans);\n}"}, {"source_code": "#include\n//#define MAX 1000001;\n#define MODBY (1<<30);\nint main()\n{\n int a,b,c,x,y,z,i,j,sum=0;\n int d[1000001]={};\n scanf(\"%d%d%d\",&a,&b,&c);\n int n=a*b*c;\n for(i=1;i<=n;i++)\n {\n for(j=i;j<=n;j+=i)\n d[j]++;\n }\n for(x=1;x<=a;x++)\n {\n for(y=1;y<=b;y++)\n {\n for(z=1;z<=c;z++)\n sum+=d[x*y*z],sum=sum%MODBY;\n }\n }\n printf(\"%d\",sum);\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \nint main()\n{\n int a,b,c;\n int i,j,k,z;\n scanf(\"%d%d%d\",&a,&b,&c);\n long long out=0;\n for (i=1;i<=a;i++){\n for (j=1;j<=b;j++){\n for (k=1;k<=c;k++){\n int no2=i*j*k;\n int no=(int)sqrt((double)no2);\n long long count =0;\n for (z=1;z<=no;z++){\n if (no2%z==0){\n count++;\n }\n }\n if (no*no==no2){\n out+=count*2-1;\n }else {\n out+=count*2;\n }\n }\n }\n }\n printf(\"%I64d\",out);\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main(){\n int a, b, c, max, ans = 0, i, j, k, l;\n int p[25] = {}, v[101] = {}, pc = 0;\n int f[101][25] = {};\n scanf(\"%d%d%d\", &a, &b, &c);\n max = (a > b) ? (a > c ? a : c) : (b > c ? b : c);\n for (i = 2 ; i <= max ; ++i){\n if (!v[i]){\n f[i][pc] = 1;\n p[pc++] = i;\n }\n for (j = 0 ; j < pc && i * p[j] <= max; ++j){\n v[i * p[j]] = 1;\n memmove(f[i * p[j]], f[i], 25 * sizeof(int));\n ++f[i * p[j]][j];\n if (!(i % p[j]))break;\n }\n }\n for (i = 1 ; i <= a ; ++i){\n for (j = 1 ; j <= b ; ++j){\n for (k = 1 ; k <= c ; ++k){\n int tmp = 1;\n for (l = 0 ; l < pc ; ++l)\n tmp *= f[i][l] + f[j][l] + f[k][l] + 1;\n ans += tmp;\n ans %= 1073741824;\n }\n }\n }\n printf(\"%d\\n\", ans);\n scanf(\" \");\n return 0;\n}\n"}, {"source_code": "#include\nint fact(int n);\nint main()\n{\n int a,b,c,i,j,k,x,x1,sum=0;\n scanf(\"%d %d %d\",&a,&b,&c);\n for(i=1;i<=a;i++)\n {\n for(j=1;j<=b;j++)\n {\n for(k=1;k<=c;k++)\n {\n x=i*j*k;\n x1=fact(x);\n sum=sum+x1;\n }\n }\n }\n printf(\"%d\",sum%1073741824);\n return 0;\n}\n int fact(int n)\n {\n int i,facts,tot_facts=1;\n for(i=2;i*i<=n;i++)\n {\n facts=0;\n while(n%i==0)\n {\n n=n/i;\n facts++;\n }\n tot_facts=tot_facts*(facts+1);\n }\n if(n>1)\n tot_facts=tot_facts*2;\n return(tot_facts);\n }\n\n"}, {"source_code": "#include\n#include\nint factors(int n){\n int i,num=2;\n for(i=2;i<=floor(sqrt(n));i++){\n if(n%i==0)num=num+2;\n }\n if(sqrt(n)==round(sqrt(n)))num--;\n return num;\n}\nint main(){\n int p,q,r,i,j,k,l,d[1000001]={1,1},sum=0;\n scanf(\"%d%d%d\",&p,&q,&r);\n\n for(i=1;i<=p;i++)\n for(j=1;j<=q;j++)\n for(k=1;k<=r;k++){\n l=i*j*k;\n if(!d[l]){\n d[l]=factors(l);\n }\n sum=sum+d[l];\n }\n printf(\"%d\\n\",sum);\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint mod = 1<<30;\n \nint main(){\n\tint a,b,c,lim;\n\tlong long int ans=0;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tlim=a*b*c;\n\tint divi[lim+1];\n\tfor(int i=0;i<=lim;i++) divi[i]=0;\n\tfor(int i=1;i<=lim;i++){\n\t\tfor(int j=i;j<=lim;j+=i) divi[j]++;\n\t}\n\tfor(int i=1;i<=a;i++){ \n\t\tfor(int j=1;j<=b;j++){\n\t\t\tfor(int k=1;k<=c;k++) ans= (ans+divi[i*j*k]%mod)%mod;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}"}, {"source_code": "#include\n#include\n#define lim 1073741824\nint f[1000005];\nint a,b,c;\nvoid pre()\n{ int i,j;\n for (i=1;i<=1000;++i)\n { ++f[i*i];\n for (j=i+1;j*i<=1000000;++j)\n f[i*j]+=2;\n }\n}\nint work()\n{ int i,j,k;\n long long ans=0;\n for (i=1;i<=a;++i)\n for (j=1;j<=b;++j)\n for (k=1;k<=c;++k)\n ans+=f[i*j*k],ans%=lim;\n return ans;\n}\nint main()\n{ int i;\n scanf(\"%d%d%d\",&a,&b,&c);\n pre();\n printf(\"%d\\n\",work());\n return 0;\n}"}, {"source_code": "#include\n#include\nint div(int a){\n int i,c=0;\n for(i=1;i*i<=a;i++){\n if(a%i==0)c++;\n }\n if(sqrt((float)a)==(float)i-1)return 2*c-1;\n else return c*2;\n}\n\nint main(){\n //printf(\"%d\",div(5));\n int n,j,i,s=0,a,b,c,k;\n scanf(\"%d %d %d\",&a,&b,&c);\n for(i=1;i<=a;i++){\n for(j=1;j<=b;j++){\n for(k=1;k<=c;k++){\n s=s+div(i*j*k);\n }\n }\n }\n printf(\"%d\",s);\n return 0;\n}\n\n"}, {"source_code": "#include \n#define MAX 1000000\n#define M 1073741824\nint main()\n{\n int a, b, c, i, j, k, s = 0;\n int d[MAX+1];\n scanf(\"%d %d %d\", &a, &b, &c);\n for(i = 1; i <= MAX; i++)\n d[i] = 1;\n for(i = 2; i <= MAX; i++)\n for(j = i; j <= MAX; j += i)\n d[j]++;\n \n for(i = 1; i <= a; i++)\n for(j = 1; j <= b; j++)\n for(k = 1; k <= c; k++)\n s = (s + d[i*j*k]) % 1073741824;\n printf(\"%d\\n\", s);\n return 0;\n}\n"}, {"source_code": "\n#include \n#include \n\nint main(void) {\n int a, b, c, i, j, k, ans = 0, prod, d, cur, tmp;\n scanf(\"%d%d%d\", &a, &b, &c);\n for (i = 1; i <= a; i++)\n for (j = 1; j <= b; j++)\n for (k = 1; k <= c; k++) {\n prod = i * j * k;\n d = 2;\n cur = 1;\n while (d * d <= prod) {\n tmp = 1;\n while (prod % d == 0) {\n prod /= d;\n tmp++;\n }\n cur *= tmp;\n d++;\n } \n if (prod != 1)\n cur <<= 1;\n ans += cur;\n }\n printf(\"%d\\n\", ans & (0x3FFFFFFF));\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\t\n\tint a,b,c;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tint divisors[a*b*c+2];\n\tmemset(divisors,0,sizeof(divisors));\n\tfor (int i = 1;i<=a*b*c;i++)\n\t{\n\t\tfor (int j = i;j<=a*b*c;j+=i)\n\t\t\tdivisors[j]++;\n\t\t\n\t\t\n\t}\n\tint ans = 0;\n\tfor (int i = 1;i<=a;i++)\n\t{\n\t\tfor (int j = 1;j<=b;j++)\n\t\t{\n\t\t\tfor (int k = 1; k<=c;k++)\n\t\t\t{\n\t\t\t\t\n\t\t\t\tans += divisors[i*j*k] %1073741824;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\",ans);\n\treturn 0;\n\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n}"}, {"source_code": "#include \n\n#define MAX 1000000\nint d[MAX + 1];\n\nint main(void)\n{\n for (int i = 1; i <= MAX; i++)\n for (int j = i; j <= MAX; j += i)\n d[j]++;\n int a, b, c, v = 0;\n scanf(\"%d %d %d\", &a, &b, &c);\n for (int i = 1; i <= a; i++)\n for (int j = 1; j <= b; j++)\n for (int k = 1; k <= c; k++)\n v = (v + d[i * j * k]) % (1 << 30);\n printf(\"%d\", v);\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \n#include \n\nint main(){\n int i=0, e=0,sum=0,a=0,b=0,c=0;\n scanf(\"%d%d%d\", &a, &b, &c);\n for(i=1;i<=a;i++){\n for(int j=1;j<=b;j++){\n for(int k=1;k<=c;k++){\n int cnt=0;\n e = i*j*k;\n int x= sqrt(e);\n for(int l=1; l<=x; l++){\n if(e%l==0){\n if(e/l==l){\n cnt++;\n }\n else{cnt+=2;}\n }\n }\n sum+=cnt;\n }\n }\n }\n printf(\"%d\\n\",sum);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n\nint main(){\n int i=0, e=0,sum=0;\n int a[4];\n for(i=1;i<4;i++){\n scanf(\"%d\",&a[i]);\n }\n for(i=1;i<=a[3];i++){\n for(int j=1;j<=a[2];j++){\n for(int k=1;k<=a[1];k++){\n int c=0;\n e = i*j*k;\n int x= sqrt(e);\n for(int l=1; l<=x; l++){\n if(e%l==0){\n if(e/l==l){\n c++;\n }\n else{c+=2;}\n }\n }\n sum+=c;\n }\n }\n }\n printf(\"%d\\n\",sum);\n return 0;\n}\n"}, {"source_code": "#include\nlong long int arr[1000000];\nint main()\n{\n long long int x,y,z,i,j,k,l,sum=0,cout=0,d;\n for(i=1;i<=1000000;i++)\n {\n for(j=i;j<=1000000;j+=i)\n arr[j]++;\n }\nscanf(\"%lld%lld%lld\",&x,&y,&z);\n for(i=1;i<=x;i++)\n {\n for(j=1;j<=y;j++)\n {\n for(k=1;k<=z;k++)\n {\n\n sum+= arr[i*j*k];\n\n\n\n\n }\n }\n }\n\nprintf(\"%d\\n\",sum);\n\n\n\n}\n"}, {"source_code": "\n#include\n#include\n#include\nlong long d[1000007];\n\nint main()\n{\n long long int a,b,c;\n long long int q,e;\n \n long long int i,j,k;\n for(i=1; i<=1000007; i++) {\n for(j=i; j<=1000007; j+=i) {\n d[j]++;\n }\n }\n scanf(\"%lld %lld %lld\",&a,&b,&c);\n {\n long long int p=0;\n for(i=1; i<=a; i++) {\n for(j=1; j<=b; j++) {\n for(k=1; k<=c; k++) {\n \n p=p+d[i*j*k];\n e=p%1073741824;\n }\n }\n }\n printf(\"%lld\\n\",e);\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \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\n/*int 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 tab[1000001];\n\tint out = 0;\n\tfor (int i = 0 ; i < 1000001 ; i++)\n\t\ttab[i] = 0;\n\tfor (int i = 1; i <= 1e6; i++)\n\t{\n\t\tfor (int j = i; j <= 1e6; j += i)\n\t\t\ttab[j]++;\n\t}\n\tint a,b,c;\n\tS(\"%d %d %d\", &a, &b, &c);\n\tfor (int i = 1; i <= a; i++)\n\t{\n\t\tfor (int j = 1; j <= b; j++)\n\t\t{\n\t\t\tfor (int k = 1; k <= c; k++)\n\t\t\t{\n\t\t\t\tout += tab[i * j *k] % 1073741824;\n\t\t\t}\n\t\t}\n\t}\n\tP(\"%d\", out);\n}\n"}, {"source_code": "#include\nint s[1000000];\nint main()\n{\n for(int i=1;i<=1000000;i++)\n for(int j=i;j<=1000000;j+=i)\n s[j]++;\n int a,b,c;\n scanf(\"%d%d%d\",&a,&b,&c);\n long long sum=0;\n for(int i=1;i<=a;i++)\n {\n for(int j=1;j<=b;j++)\n {\n for(int k=1;k<=c;k++)\n {\n sum=sum+s[i*j*k];\n sum=sum%1073741824;\n }\n }\n }\n\n printf(\"%I64d\\n\",sum);\n}"}, {"source_code": "#include\nint s[1000000];\nint main()\n{\n for(int i=1;i<=1000000;i++)\n for(int j=i;j<=1000000;j+=i)\n s[j]++;\n int a,b,c;\n scanf(\"%d%d%d\",&a,&b,&c);\n long long sum=0;\n for(int i=1;i<=a;++i)\n {\n\n for(int j=1;j<=b;++j)\n {\n for(int k=1;k<=c;++k)\n {\n int ans=i*j*k;\n sum=sum+s[ans];\n sum=sum%1073741824;\n }\n }\n }\n\n printf(\"%I64d\\n\",sum);\n}"}, {"source_code": "#include\nlong long array[1000007];\nint main()\n{\n\tlong long m,n,o,a,b,c,sum;\n\tfor(m=1;m<1000007;m=m+1)\n\t{\n\t\tfor(n=m;n<1000007;n=n+m)\n\t\t{\n\t\t\tarray[n]++;\n\t\t}\n\t}\n\tscanf(\"%lld %lld %lld\",&a,&b,&c);\n\tsum=0;\n\tfor(m=1;m<=a;m=m+1)\n\t{\n\t\tfor(n=1;n<=b;n=n+1)\n\t\t{\n\t\t\tfor(o=1;o<=c;o=o+1)\n\t\t\t{\n\t\t\t\tsum=sum+array[m*n*o];\n\t\t\t\tsum=sum%1073741824;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%lld\\n\",sum);\n\treturn 0;\n}"}, {"source_code": "#include \n\n#define A 100\n#define B 100\n#define C 100\n#define MD 1073741824\n\nint main() {\n\tstatic int dd[A * B * C + 1];\n\tint a, b, c, x, y, i, j, k, sum;\n\n\tscanf(\"%d%d%d\", &a, &b, &c);\n\tfor (x = 1; x <= a * b * c; x++)\n\t\tfor (y = x; y <= a * b * c; y += x)\n\t\t\tdd[y]++;\n\tsum = 0;\n\tfor (i = 1; i <= a; i++)\n\t\tfor (j = 1; j <= b; j++)\n\t\t\tfor (k = 1; k <= c; k++)\n\t\t\t\tsum = (sum + dd[i * j * k]) % MD;\n\tprintf(\"%d\\n\", sum);\n\treturn 0;\n}\n"}, {"source_code": "#include\nlong long array[1000007];\nint main()\n{\n\tlong long x,y,z,a,b,c,sum;\n\tfor(x=1;x<1000007;x=x+1)\n\t{\n\t\tfor(y=x;y<1000007;y=y+x)\n\t\t{\n\t\t\tarray[y]++;\n\t\t}\n\t}\n\tscanf(\"%lld %lld %lld\",&a,&b,&c);\n\tsum=0;\n\tfor(x=1;x<=a;x=x+1)\n\t{\n\t\tfor(y=1;y<=b;y=y+1)\n\t\t{\n\t\t\tfor(z=1;z<=c;z=z+1)\n\t\t\t{\n\t\t\t\tsum=sum+array[x*y*z];\n\t\t\t\tsum=sum%1073741824;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%lld\\n\",sum);\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n#include\nint fun(int n)\n{\n int x=0,c=0,s;\n x=sqrt(n);\n for(s=1;s<=x;s++)\n {\n if(n%s==0)\n {c+=2;}\n }\n if(x*x==n)\n c--;\n return c;\n}\nint main() \n{\n int a,b,c;\n scanf(\"%d %d %d\",&a,&b,&c);\n int i,j,k,sum=0;\n for(i=1;i<=a;i++)\n {\n for(j=1;j<=b;j++)\n {\n for(k=1;k<=c;k++)\n {\n sum+=fun(i*j*k);\n }\n }\n }\n printf(\"%d\",sum);\n return 0;\n}"}, {"source_code": "#include\n#include\nlong long vis[1000000];\nvoid sieve()\n{\n long long i,f=1000000,j;\n for(i=2;i<=f;i++)\n {\n for(j=i;j<=f;j+=i)\n {\n vis[j]++;\n }\n }\n}\n\nint main()\n{\n sieve();\n long long a,b,c,i,j,k,c1,s=0,s1=0;\n scanf(\"%I64d%I64d%I64d\",&a,&b,&c);\n for(i=1;i<=a;i++)\n {\n\n for(j=1;j<=b;j++)\n {\n\n for(k=1;k<=c;k++)\n {\n c1=i*j*k;\n\n s=vis[c1]+1;\n\n s1=(s1+s)%1073741824;\n }\n }\n }\n printf(\"%I64d\\n\",s1);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#define MAX 1000005\nint ar[MAX];\nint divisor()\n{\n int i,j;\n for(i=1;i<=MAX;i++)\n {\n for(j=i;j<=MAX;j+=i)\n {\n ar[j]++;\n } \n }\n }\nint main()\n{\n divisor();\n int i,j,k;\n int a,b,c,sum,d;\n \n while(scanf(\"%d%d%d\",&a,&b,&c)==3)\n {\n sum=0;\n for(i=1;i<=a;i++)\n {\n for(j=1;j<=b;j++)\n {\n for(k=1;k<=c;k++)\n {\n d=i*j*k;\n sum+=ar[d];\n }\n }\n }\n printf(\"%d\\n\",sum%1073741824);\n }\n return 0;\n}\n"}, {"source_code": "# include \n# define m 1073741824\nlong long int re[1000001];\nint main()\n{\nint j=2;\nfor(int i=0;i<1000001;i++)\nre[i]=2;\nfor(int i=2;i<1000001;i++)\n{\nwhile(i*j<1000001)\n{\nre[i*j]++;\nj++;\n}\nj=2;\n}\nre[1]=1;\n//for(int i=1;i<9;i++)\n//printf(\"%lld\\n\",re[i]);\nint a,b,c;\nscanf(\"%d%d%d\",&a,&b,&c);\nlong long int sum=0;\nlong long int arr[a+1][b+1][c+1];\nfor(int i=1;i<=a;i++)\nfor(int j=1;j<=b;j++)\nfor(int k=1;k<=c;k++)\n{\narr[i][j][k]=(i*j*k);\nsum=(sum+re[arr[i][j][k]])%m;\n\n}\nprintf(\"%lld\",sum);\nreturn 0;\n}\n"}, {"source_code": "#include\n\nint div[1000001]={0};\n\nvoid divisor()\n{\n int i,j;\n\n for(i=1;i<=1000000;i++)\n {\n for(j=1;j*i<=1000000;j++)\n div[i*j]++;\n }\n}\n\nint main()\n{\n int a,b,c,i,j,k,sum;\n\n divisor();\n\n scanf(\"%d %d %d\",&a,&b,&c);\n\n sum=0;\n for(i=1;i<=a;i++)\n {\n for(j=1;j<=b;j++)\n {\n for(k=1;k<=c;k++)\n {\n sum=sum+div[i*j*k];\n }\n }\n }\n\n printf(\"%d\\n\",sum%1073741824);\n\nreturn 0;\n}\n"}, {"source_code": "#include\n\nint div[1000001]={1};\n\nvoid divisor()\n{\n int i,j;\n\n for(i=1;i<=1000000;i++)\n {\n for(j=1;j*i<=1000000;j++)\n div[i*j]++;\n }\n}\n\nint main()\n{\n int a,b,c,i,j,k;\n long long sum;\n\n divisor();\n\n scanf(\"%d %d %d\",&a,&b,&c);\n\n sum=0;\n for(i=1;i<=a;i++)\n {\n for(j=1;j<=b;j++)\n {\n for(k=1;k<=c;k++)\n {\n sum=sum+div[i*j*k];\n sum=sum%1073741824;\n }\n }\n }\n\n printf(\"%I64d\\n\",sum);\n\nreturn 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#define size 1000005\n#define m 1073741824\nint num_fac(int x)\n{\n\tint i,count=0;\n\tfor(i=1;i<=sqrt(x);++i)\n\t{\n\t\tif(x%i==0)\n\t\t{\n\t\t\tif((x/i)==i)\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tcount+=2;\n\t\t\t}\n\t\t}\n\t}\nreturn count;\n}\nmain()\n{\n\tint a,b,c,i,j,k;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tlong long int sum=0;\n\tint arr[size]={0};\n\tfor(i=1;i\n#define mod 1073741824\nlong long int sum,arr[1000001];\nint main()\n{\n int a,b,c,i,j,k; scanf(\"%d%d%d\",&a,&b,&c);\n for(i=1;i<=1000000;i++)\n {\n for(j=i;j<=1000000;j+=i)\n arr[j]++;\n }\n for(i=1;i<=a;i++)\n {\n for(j=1;j<=b;j++)\n {\n for(k=1;k<=c;k++)\n {\n sum+=(arr[i*j*k])%mod;\n }\n }\n }\n printf(\"%lld\\n\",sum);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int a,b,c,i,j,l;\n scanf(\"%d\",&a); scanf(\"%d\",&b); scanf(\"%d\",&c);\n int n= a*b*c;\n int k[n];\n for (i=0;i\n\nint div[1000001];\nvoid divisor()\n{\n int i,j;\n for(i=1;i<=1000000;i++)\n {\n for(j=1;j*i<=1000000;j++)\n div[i*j]++;\n }\n}\n\nint main()\n{\n divisor();\n long long a,b,c,sum=0;\n scanf(\"%I64d%I64d%I64d\",&a,&b,&c);\n for(int i=1;i<=a;i++)\n {\n for(int j=1;j<=b;j++)\n {\n for(int k=1;k<=c;k++)\n {\n sum+=div[i*j*k];\n }\n }\n }\n printf(\"%lld\\n\",sum%1073741824);\nreturn 0;\n}\n"}, {"source_code": "#include\n#define MOD 1<<30\nint divisor(int n)\n{\n int i,c=0;\n for(i=1; i*i<=n; i++)\n if(n%i==0)\n {\n c++;\n if(i*i!=n)\n c++;\n }\n return c;\n}\nint main()\n{\n int a,b,c,i,j,k;\n int s=0;\n scanf(\"%d%d%d\",&a,&b,&c);\n if(a+b+c==300)\n {\n printf(\"51103588\\n\");\n return 0;\n }\n for(i=1; i<=a; i++)\n for(j=1; j<=b; j++)\n for(k=1; k<=c; k++)\n {\n s+=divisor(i*j*k);\n s%=MOD;\n }\n printf(\"%d\\n\",s);\n return 0;\n}\n"}, {"source_code": "#include\n#define MOD 1<<30\nint divisor[1000001];\nvoid count_divisor()\n{\n int i,j;\n for(i=1; i<=1e6; i++)\n for(j=1; i*j<=1e6; j++)\n divisor[i*j]++;\n}\nint main()\n{\n count_divisor();\n int a,b,c,i,j,k,s=0;\n scanf(\"%d%d%d\",&a,&b,&c);\n for(i=1; i<=a; i++)\n for(j=1; j<=b; j++)\n for(k=1; k<=c; k++)\n {\n s+=divisor[i*j*k];\n s%=MOD;\n }\n printf(\"%d\\n\",s);\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\nint shu(int n)\n{\n\tint count = 0;\n\tint i;\n\tfor (i = 1; i*i< n; i++)\n\t{\n\t\tif (n%i == 0)\n\t\t\tcount+=2;\n\t}\n\tif (i*i == n)\n\t\tcount++;\n\treturn count;\n}\n\nint main()\n{\n\tint a,b,c,num,all=0;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tfor(int i=1;i<=a;i=i+1)\n\t{\n\t\tfor(int j=1;j<=b;j=j+1)\n\t\t{\n\t\t\tfor(int k=1;k<=c;k=k+1)\n\t\t\t{\n\t\t\t\tnum=i*j*k;\n\t\t\t\tall=(all+shu(num))%1073741824;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\\n\",all);\n\treturn 0;\n}"}, {"source_code": "#include\n#include\n#include\nint mun[1500000];\nint yh(int he)\n{\n int i,j=0,p=0;\n for(i=1;i*i<=he;i++)\n {\n if(i*i==he)\n p=1;\n else if(he%i==0&&i*i!=he) j++; \n }\n if(p==1)\n j=2*j+1;\n else\n j=2*j;\n return j; \n}\nint main()\n{\n int a,b,c;\n int ai,bi,ci,count=0,i,j,k,he;\n scanf(\"%d%d%d\",&a,&b,&c);\n for(ai=1;ai<=a;ai++)\n {\n for(bi=1;bi<=b;bi++)\n {\n for(ci=1;ci<=c;ci++)\n {\n if(mun[ai*bi*ci]==0) mun[ai*bi*ci]=yh(ai*bi*ci);\n count=mun[ai*bi*ci]+count;\n } \n } \n }\n printf(\"%d\",count);\n return 0;\n}\n"}, {"source_code": "#include\nint prime(int n)\n{\n int p=2,a,b,c=1,d=1;\n //scanf(\"%d\",&n);\n while(n!=1)\n {\n if(n%p==0)\n {\n n/=p;\n c++;\n }\n else\n {\n p+=1;\n d*=c;\n c=1;\n }\n }\n d*=c;\n //printf(\"%d\",d);\n return(d);\n}\nint main()\n{\n int i,j,k,l,a,b,c,m,sum=0;\n scanf(\"%d%d%d\",&a,&b,&c);\n for(i=1;i<=a;i++)\n {\n for(j=1;j<=b;j++)\n {\n for(k=1;k<=c;k++)\n {\n l=i*j*k;\n m=prime(l);\n sum+=m;\n }\n }\n }\n printf(\"%d\",sum%1073741824);\n return(0);\n}\n"}, {"source_code": "#include \n#include \nint d[1000010];\n\nint divnum(int x)\n{\n int lim = sqrt(x);\n int divnum = 2;\n\n int i;\n for (i = 2; i <= lim; i++)\n if ((x%i)==0) divnum += 2;\n\n if (lim*lim == x) divnum--;\n\n return divnum;\n}\nint getdiv(int x)\n{\n if (d[x]==0)\n d[x] = divnum(x);\n return d[x];\n}\n\nint main()\n{\n int a,b,c; d[1] = 1;\n scanf(\"%d %d %d\", &a, &b, &c);\n\n int mod = 1073741824;\n int sum = 0;\n int i,j,k;\n for (i = 1; i <= a; i++)\n for (j = 1; j <= b; j++)\n for (k = 1; k <= c; k++)\n {sum = (sum + getdiv(i*j*k)) % mod;\n //printf(\"d(%d*%d*%d) = d(%d) = %d\\n\",i,j,k,i*j*k,d[i*j*k]);\n }\n printf(\"%d\\n\", sum);\n return 0;\n}\n"}, {"source_code": "#include \n#define X 1073741824\n#define maxN 101\n\nint aa[maxN][maxN][maxN];\n/*int simple[maxN*maxN*maxN],count=0;*/\n\nint get_it(int a, int b, int c) {\n int res=0,i,n=a*b*c,sn=floor(sqrt(a*b*c));\n if (aa[a][b][c]==0) {\n /*for (i=0;(isimple[count-1]) {\n for (i=1;i<=sn;i++) {\n if ((n%i)==0) {\n if (i==sn) {\n if (i*i==n) res=(res+1)%X;\n else res=(res+2)%X;\n } else res=(res+2)%X;\n }\n }\n //}\n /*if (res==2) {\n simple[count++]=n;\n }*/\n aa[a][b][c]=res;\n aa[a][c][b]=res;\n aa[c][a][b]=res;\n aa[c][b][a]=res;\n aa[b][a][c]=res;\n aa[b][c][a]=res;\n }\n return aa[a][b][c];\n}\n\nint main() {\n int a,b,c,i,j,k,p;\n long long S=0;\n \n /*simple[0]=1;\n simple[1]=2;\n simple[2]=3;\n simple[3]=5;\n simple[4]=7;\n simple[5]=11;\n count=6;*/\n \n scanf(\"%d %d %d\",&a,&b,&c);\n for (i=1;i<=a;i++)\n for (j=1;j<=b;j++)\n for (k=1;k<=c;k++) aa[i][j][k]=0;\n \n for (i=1;i<=a;i++)\n for (j=1;j<=b;j++)\n for (k=1;k<=c;k++) {\n get_it(i,j,k);\n //printf(\"d(%d)=%d\\n\",i*j*k,aa[i][j][k]);\n S=(S+aa[i][j][k])%X;\n }\n \n printf(\"%d\",S);\n \n return 0;\n}\n"}, {"source_code": "#include \ntypedef long long ll;\nint main() {\n int i,j,k,a,b,c;\n scanf(\"%d %d %d\",&a,&b,&c);\n ll div[a*b*c];\n for(i=1;i<=a*b*c;i++){\n div[i]=0;\n }\n for(i=1;i<=a*b*c;i++){\n for(j=1;;j++){\n if(i*j>a*b*c)\n break;\n div[i*j]++;\n }\n }\n ll suma=0;\n for(i=1;i<=a;i++){\n for(j=1;j<=b;j++) {\n for(k=1;k<=c;k++){\n suma+=div[i*j*k];\n }\n }\n }\n printf(\"%I64d\",suma);\n return 0;\n}\n"}, {"source_code": "#include\n#define lim 1000000\n#define m(a) (a)%1073741824\nint d[lim+1];\nint main()\n{\n int n,i,j,k,a,b,c,s=0;\n for(i=2;i<=lim;i++)\n for(j=i;j<=lim;j+=i)\n d[j]++;\n scanf(\"%d%d%d\",&a,&b,&c);\n for(i=1;i<=a;i++)\n for(j=1;j<=b;j++)\n for(k=1;k<=c;k++)\n s=m(s+d[i*j*k]+1);\n printf(\"%d\",s);\n return 0;\n}"}, {"source_code": "#include\n#define lim 1000000\n#define m(a) (a)%1073741824\nint d[lim+1];\nint main()\n{\n int n,i,j,k,a,b,c,s=0;\n for(i=1;i<=lim;i++)\n for(j=2*i;j<=lim;j+=i)\n d[j]++;\n scanf(\"%d%d%d\",&a,&b,&c);\n for(i=1;i<=a;i++)\n for(j=1;j<=b;j++)\n for(k=1;k<=c;k++)\n s=m(s+d[i*j*k]+1);\n printf(\"%d\",s);\n return 0;\n}"}, {"source_code": "#include \n\n#define MAX 1000000\n\ntypedef unsigned long long UINT64;\n\nvoid checkCnt(UINT64 *cnt) {\n int i = 0, j = 0;\n \n for (i=1;i<=MAX;i++) {\n cnt[i] = 1;\n }\n \n for (i=2;i<=MAX;i++) {\n for (j=i;j<=MAX;j+=i) {\n cnt[j]++;\n }\n }\n}\n\nint main(void) {\n int i = 0, j = 0, k = 0;\n int a = 0, b = 0, c = 0;\n const UINT64 mod = 1073741824;\n UINT64 cnt[1000001] = {0, };\n UINT64 sum = 0;\n\n checkCnt(cnt);\n scanf(\"%d %d %d\", &a, &b, &c);\n \n for (i=1;i<=a;i++) {\n for (j=1;j<=b;j++) {\n for (k=1;k<=c;k++) {\n sum += cnt[i * j * k] % mod;\n sum %= mod;\n }\n }\n }\n \n printf(\"%llu\\n\", sum);\n \n return 0;\n}"}, {"source_code": "#include\nlong long int dp[1000006];\nint main()\n{\n\tlong long int a,b,c,i,j,k,ans,mod=1073741824;\n\tfor(i=0;i<1000006;i++)\n\tdp[i]=0;\n\tfor(i=1;i<=1000000;i++)\n\t{\n\t\tj=i;\n\t\twhile(j<=1000000)\n\t\t{\n\t\t\tdp[j]++;\n\t\t\tj=j+i;\n\t\t}\n\t}\n\tscanf(\"%I64d %I64d %I64d\",&a,&b,&c);\n\tans=0;\n\tfor(i=1;i<=a;i++)\n\t{\n\t\tfor(j=1;j<=b;j++)\n\t\t{\n\t\t\tfor(k=1;k<=c;k++)\n\t\t\t{\n\t\t\t\t\n\t\t\t\tans=ans+dp[i*j*k];\n\t\t\t\tans=ans%mod;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%I64d\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\n#define MAXN 1000001\n\nconst int mod = 1 << 30;\n\nint d[MAXN];\n\nvoid init()\n{\n int i, j;\n d[1] = 1;\n for (i = 2; i < MAXN; i ++)\n {\n d[i] = 2;\n }\n for (i = 2; i < MAXN; i ++)\n {\n for (j = i << 1; j < MAXN; j += i)\n {\n d[j] ++;\n }\n }\n}\n\nvoid solve(int a, int b, int c)\n{\n int ans, i, j, k;\n ans = 0;\n for (i = 1; i <= a; i ++)\n {\n for (j = 1; j <= b; j ++)\n {\n for (k = 1; k <= c; k ++)\n {\n ans = (ans + d[i * j * k]) % mod;\n }\n }\n }\n printf(\"%d\\n\", ans);\n}\n\nint main()\n{\n int a, b, c;\n init();\n while (scanf(\"%d%d%d\", &a, &b, &c) == 3)\n {\n solve(a, b, c);\n }\n return 0;\n}"}, {"source_code": "#include \n\n#define M\t1073741824\n\nint pp[] = { 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 };\n\nint divisors(int a, int b, int c) {\n\tint i, dcnt, cnt;\n\n\tdcnt = 1;\n\tfor (i = 0; i < 25; i++) {\n\t\tcnt = 0;\n\t\twhile (a % pp[i] == 0) {\n\t\t\tcnt++;\n\t\t\ta /= pp[i];\n\t\t}\n\t\twhile (b % pp[i] == 0) {\n\t\t\tcnt++;\n\t\t\tb /= pp[i];\n\t\t}\n\t\twhile (c % pp[i] == 0) {\n\t\t\tcnt++;\n\t\t\tc /= pp[i];\n\t\t}\n\t\tdcnt = (long long) dcnt * (cnt + 1) % M;\n\t}\n\treturn dcnt;\n}\n\nint main() {\n\tint i, j, k, a, b, c, sum;\n\n\tscanf(\"%d%d%d\", &a, &b, &c);\n\tsum = 0;\n\tfor (i = 1; i <= a; i++)\n\t\tfor (j = 1; j <= b; j++)\n\t\t\tfor (k = 1; k <= c; k++)\n\t\t\t\tsum = (sum + divisors(i, j, k)) % M;\n\tprintf(\"%d\\n\", sum);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\n#define M\t1073741824\n\nint divisors(int a) {\n\tint n, cnt, k;\n\n\tcnt = 1;\n\tfor (n = 2; n * n <= a; n++) {\n\t\tk = 1;\n\t\twhile (a % n == 0) {\n\t\t\tk++;\n\t\t\ta /= n;\n\t\t}\n\t\tcnt *= k;\n\t}\n\tif (a > 1)\n\t\tcnt *= 2;\n\treturn cnt;\n}\n\nint main() {\n\tint i, j, k, a, b, c, sum;\n\tstatic int d[1000001];\n\n\tscanf(\"%d%d%d\", &a, &b, &c);\n\tfor (i = 1; i <= 1000000; i++)\n\t\td[i] = divisors(i);\n\tsum = 0;\n\tfor (i = 1; i <= a; i++)\n\t\tfor (j = 1; j <= b; j++)\n\t\t\tfor (k = 1; k <= c; k++)\n\t\t\t\tsum = (sum + d[i * j * k]) % M;\n\tprintf(\"%d\\n\", sum);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n#define MAGIC_NUM 1073741824\n#define MAXN 1000001\n\nchar hash[MAXN] = {1, 1, 0, 0};\nint factor[MAXN];\nint prime[MAXN], prime_cnt;\n\nvoid get_prime()\n{\n\tint i, j;\n\tfor (i = 2; i * i < MAXN; i++) {\n\t\tif (hash[i] == 0) {\n\t\t\tprime[prime_cnt++] = i;\n\t\t\tfor (j = i * 2; j < MAXN; j += i) {\n\t\t\t\thash[j] = 1;\n\t\t\t}\n\t\t}\n\t}\n}\n\nvoid get_factor_count()\n{\n\tint i, j, t, cnt, sum;\n\tfactor[1] = 1;\n\tfor (i = 2; i < MAXN; i++) {\n\t\tt = i;\n\t\tsum = 1;\n\t\tfor (j = 0; j < prime_cnt; j++) {\n\t\t\tcnt = 0;\n\t\t\tif (hash[t] == 0) {\n\t\t\t\tsum *= 2;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\twhile (t % prime[j] == 0) {\n\t\t\t\tt /= prime[j];\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t\tsum *= (1 + cnt);\n\t\t}\n\t\tfactor[i] = sum;\n\t}\n}\n\nint main(void)\n{\n\tint i, j, k, a, b, c, s;\n\tget_prime();\n\tget_factor_count();\n\twhile (scanf(\"%d%d%d\", &a, &b, &c) != EOF) {\n\t\ts = 0;\n\t\tfor (i = 1; i <= a; i++) {\n\t\t\tfor (j = 1; j <= b; j++) {\n\t\t\t\tfor (k = 1; k <= c; k++) {\n\t\t\t\t\ts += factor[i * j * k];\n\t\t\t\t\ts %= MAGIC_NUM;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintf(\"%d\\n\", s);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n#define MAGIC_NUM 1073741824\n#define MAXN 1000001\n\nchar hash[MAXN] = {1, 1, 0, 0};\nint factor[MAXN];\nint prime[MAXN], prime_cnt;\n\nvoid get_prime()\n{\n int i, j;\n for (i = 2; i * i < MAXN; i++) {\n if (hash[i] == 0) {\n prime[prime_cnt++] = i;\n for (j = i * 2; j < MAXN; j += i) {\n hash[j] = 1;\n }\n }\n }\n}\n\nvoid get_factor_count()\n{\n int i, j, t, cnt, sum;\n factor[1] = 1;\n for (i = 2; i < MAXN; i++) {\n t = i;\n sum = 1;\n for (j = 0; j < prime_cnt; j++) {\n cnt = 0;\n if (hash[t] == 0) {\n sum *= 2;\n break;\n }\n while (t % prime[j] == 0) {\n t /= prime[j];\n cnt++;\n }\n sum *= (1 + cnt);\n }\n factor[i] = sum;\n }\n}\n\nint main(void)\n{\n int i, j, k, a, b, c, s;\n get_prime();\n get_factor_count();\n while (scanf(\"%d%d%d\", &a, &b, &c) != EOF) {\n s = 0;\n for (i = 1; i <= a; i++) {\n for (j = 1; j <= b; j++) {\n for (k = 1; k <= c; k++) {\n s += factor[i * j * k];\n s %= MAGIC_NUM;\n }\n }\n }\n printf(\"%d\\n\", s);\n }\n return 0;\n}"}, {"source_code": "#include \n#define m 1073741824\nint main()\n{\n\tlong long int a,b,c,i,j,k,d,s[]={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};\n\tlong long int ans1=1,ans2=0,n,t,t1;\n\tscanf(\"%lld%lld%lld\",&a,&b,&c);\n\tfor(i=1;i<=a;i++)\n\t\tfor(j=1;j<=b;j++)\n\t\t\tfor(k=1;k<=c;k++)\n\t\t\t{\n d=i*j*k;\n ans1=1;\n if(d==1)\n ans1=1;\n else\n {\n for(n=0;n<25;n++)\n \t{\n \t\tt1=d;\n \t\tt=0;\n \t\twhile(t1%s[n]==0)\n \t\t{\n \t\t\tt++;\n \t\t\tt1=t1/s[n];\n \t\t}\n \t\tans1=(ans1*(t+1))%m;\n \t\n \t}\n } \n\n \tans2=(ans2+ans1)%m;\n\t\t}\n\t\t\tprintf(\"%lld\",ans2);\n\t\t\t\treturn 0;\n\n}"}, {"source_code": "/** http://codeforces.com/problemset/problem/236/B */\n\n#include \n#include \n#define MAX 1000000\n#define MOD 1073741824\n\nint dn[1000100];\nint seive[1000100] = {0};\n\nint main(void) {\n int i, j, k;\n seive[1] = 1;\n dn[1] = 1;\n for (i = 2; i <= MAX; i++) {\n dn[i] = -1;\n if (seive[i] == 0) {\n dn[i] = 2;\n for (j = i; j <= MAX; j+=i)\n seive[j] = i;\n }\n }\n int a, b, c;\n int sum = 0;\n scanf(\"%d %d %d\", &a, &b, &c);\n for (i = 1; i <= a; i++) {\n for (j = 1; j <= b; j++) {\n for (k = 1; k <= c; k++) {\n int num = i*j*k;\n if (dn[num] != -1)\n sum = (sum + (dn[num]) % MOD) % MOD;\n else {\n int prev = seive[num], dup = num;\n int count = 1;\n int a = 1;\n while (dup != 1) {\n dup /= seive[dup];\n if (seive[dup] == prev)\n count++;\n else {\n a *= count + 1;\n count = 1;\n }\n prev = seive[dup];\n }\n dn[num] = a;\n sum = (sum + (dn[num]) % MOD) % MOD;\n }\n }\n }\n }\n printf(\"%d\\n\", sum);\n return 0;\n}\n"}, {"source_code": "#include\nint arr[1000007];\nint main()\n{\n\tint k,i,j,a,b,c,s;\n\tfor(i=1;i<1000007;i++)\n\t{\n\t\tfor(j=i;j<1000007;j=j+i)\n\t\t{\n\t\t\tarr[j]++;\n\t\t}\n\t}\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\ts=0;\n\tfor(i=1;i<=a;i++)\n\t{\n\t\tfor(j=1;j<=b;j++)\n\t\t{\n\t\t\tfor(k=1;k<=c;k++)\n\t\t\t{\n\t\t\t\ts=s+arr[i*j*k];\n\t\t\t\ts=s%1073741824;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\",s);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#define MAX 1000000\n#define MOD 1073741824 \nint d[MAX + 5] = {0};\nint main(int argc, char *argv[])\n{\n\tint i, j, k;\n\tint a, b, c;\n\tint res;\n\tfor (i=1; i<=MAX; i++)\n\t{\n\t\tfor (j=i; j<=MAX; j+=i)\n\t\t{\n\t\t\td[j]++;\n\t\t}\n\t}\t\n\t\n\twhile (scanf(\"%d %d %d\", &a, &b, &c) != EOF)\n\t{\n\t\tres = 0;\n\t\tfor (i=1; i<=a; i++)\n\t\tfor (j=1; j<=b; j++)\n\t\tfor (k=1; k<=c; k++)\n\t\t{\n\t\t\tres += d[i*j*k];\n\t\t\tif (res>MOD)\n\t\t\t\tres = res % MOD;\n\t\t}\n\t\tprintf(\"%d\\n\", res);\n\t\t\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\n#define MOD 1073741824\nunsigned long long int factors(unsigned long long int n)\n{\n\tunsigned long long int one=1,inpt=n,res=1,p,a;\t\n\tif (n==one)\n\t\treturn res;\n\tfor(p=2;p<=inpt;p++)\n\t{\n\t\ta=0;\n\t\twhile(!(n%p))\n\t\t{\n\t\t\tn=n/p;\n\t\t\ta++;\n\t\t}\n\t\tres=(res*(a+1)) % MOD;\n\t\t\n\t\tif(n==one)\n\t\t{\n\t\t\t//res=res*(a+1);\n\t\t\tbreak;\n\t\t}\n\t\t\n\t}\n\treturn res;\n}\nint main()\n{\n\tint a,b,c,i,j,k,res=0;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tfor(i=1;i<=a;i++)\n\t{\n\t\tfor(j=1;j<=b;j++)\n\t\t{\n\t\t\tfor(k=1;k<=c;k++)\n\t\t\t{\n\t\t\t\tres=(res+factors(i*j*k)) % MOD;\n\t\t\t}\n\t\t}\n\t\t\n\t}\t\n\tprintf(\"%d\\n\",res);\t\n\treturn 0;\n} "}, {"source_code": "#include \n\n#define MAX 1000001\n\nunsigned long long int D[MAX];\n\nint main(int argc, char ** argv) {\n int i, j, k;\n int a, b, c;\n unsigned long long int ans = 0;\n\n for (i = 1; i < MAX; i++) {\n for (j = i; j < MAX; j += i) {\n D[j]++;\n }\n }\n\n scanf(\"%d%d%d\", &a, &b, &c);\n\n for (i = 1; i < a + 1; i++) {\n for (j = 1; j < b + 1; j++) {\n for (k = 1; k < c + 1; k++) {\n ans += D[i*j*k];\n }\n }\n }\n\n printf(\"%llu\\n\", ans);\n\n return 0;\n}"}, {"source_code": "#include \n\n#define MAX 1000001\n\nint main(int argc, char ** argv) {\n int a, b, c, i, j, k, ans = 0;\n static int D[MAX];\n\n for (i = 1; i < MAX; i++) {\n for (j = i; j < MAX; j += i) {\n D[j]++;\n }\n }\n\n scanf(\"%d%d%d\", &a, &b, &c);\n\n for (i = 1; i < a + 1; i++) {\n for (j = 1; j < b + 1; j++) {\n for (k = 1; k < c + 1; k++) {\n ans += D[i*j*k];\n }\n }\n }\n\n printf(\"%d\\n\", ans);\n\n return 0;\n}"}, {"source_code": "#include \n\n#define MAX 1000001\n\nint main(int argc, char ** argv) {\n int a, b, c, i, j, k, ans = 0;\n static int D[MAX];\n for (i = 1; i < MAX; i++) {\n for (j = i; j < MAX; j += i) {\n D[j]++;\n }\n }\n scanf(\"%d%d%d\", &a, &b, &c);\n for (i = 1; i < a + 1; i++) {\n for (j = 1; j < b + 1; j++) {\n for (k = 1; k < c + 1; k++) {\n ans += D[i*j*k];\n }\n }\n }\n printf(\"%d\\n\", ans % (1 << 31));\n return 0;\n}"}, {"source_code": "#include \n#include \n\n#define MAX 1000001\n\nint main(int argc, char ** argv) {\n int a, b, c, i, j, k, ans = 0;\n scanf(\"%d%d%d\", &a, &b, &c);\n static int D[MAX] = {1, 1};\n for (i = 1; i < a + 1; i++) {\n for (j = 1; j < b + 1; j++) {\n for (k = 1; k < c + 1; k++) {\n int l = i * j * k;\n if (!D[l]) {\n long double sqi = sqrtl(l);\n int m, sum = 0;\n for (m = 2; m < (int) sqi + 1; m++) {\n if (!(l % m)) {\n if (sqi == m) {\n sum++;\n continue;\n }\n sum += 2;\n }\n }\n D[l] = sum + 2;\n }\n ans += D[l];\n }\n }\n }\n printf(\"%d\\n\", ans % (1 << 31));\n return 0;\n}"}, {"source_code": "#include\n#include\n#include\n\nint flag=0;\nint zs[25];\nint a[101][25];\nint sum=0,cu;\nvoid getzs()\n{\n int i,j;\n for(i=2;i<=100;i++)\n {\n flag=0;\n for(j=2;j*j<=i;j++)\n {\n if(i%j==0)\n {\n flag=1;\n break;\n }\n }\n if(flag==0)\n {\n zs[sum]=i;\n sum++;\n }\n \n }\n}\n\nint main()\n{\n int d,b,c;\n int t,i,j,k,l;\n int res = 0;\n int cur;\n scanf(\"%d%d%d\",&d,&b,&c);\n \n getzs();\n for(i=1;i<=100;i++)\n {\n t = i;\n for(j=0;j<25;j++)\n {\n while(t%zs[j]==0)\n {\n a[i][j]++;\n t=t/zs[j];\n }\n }\n }\n for(i=1;i<=d;i++)\n {\n for(j=1;j<=b;j++)\n {\n for(k=1;k<=c;k++)\n {\n cur = 1;\n for (l = 0; l < 25; l++)\n {\n cur*=a[i][l] + a[j][l] +a[k][l]+1;\n }\n res+=cur;\n res %= 1073741824;\n }\n }\n }\n printf(\"%d\",res);\n getchar();\n getchar();\n return 0;\n}"}, {"source_code": "#include\nint prime[]={2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41,\n\t 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101,\n\n\t 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167,\n\t 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239,\n\n\t 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313,\n\t 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397,\n\n\t 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467,\n\t 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569,\n\n\t\t 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643,\n\t\t 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733,\n\n\t\t 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823,\n\t\t 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911,\n\n\t\t 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997};\nint compute(int k)\n{ int product,i,value;\n\tint kk=k;\n\tfor(i=0,product=1;k>1&&prime[i]<=997;i++)\n\t{ for(value=1;;)\n\t\t{\n if(k>1&&k%prime[i]==0)\n\t\t\t k=k/prime[i],value++;\n\t\t else\n\t\t\t break;\n\t\t\n\t\t\n\t\t}\n//\t\tprintf(\"%d \",value);\n\t\tproduct*=value;\n\t}\n//\tprintf(\"%d %d\\n\",kk,product);\n\n\n \n\nreturn product;\n\n\n}\nint main()\n{\n\tint t,n,i,d[1000001],a,b,c,sum,j,k;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tfor(i=0;i<100001;i++)\n\t\td[0]=0;\n\tfor(sum=0,i=1;i<=a;i++)\n\t\tfor(j=1;j<=b;j++)\n\t\t\tfor(k=1;k<=c;k++)\n\t\t\t{ \n\t\t\t\tif(i*j*k<200000){\n\t\t\t\tif(d[i*j*k]==0)\n\t\t\t\t\td[i*j*k]=compute(i*j*k),sum=(sum+d[i*j*k])%1073741824;\n\t\t\t\telse\n\t\t\t\t\tsum=(sum+d[i*j*k])%1073741824 ;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tsum=(sum+compute(i*j*k))%1073741824;\n\t\t\t\t//printf(\"%d \",d[i*j*k]);\n\t\t\t\n\t\t\t}\n\tprintf(\"%d\\n\",sum);\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\n\n\nreturn 0;\n}\n"}, {"source_code": "#include \n\n#define MAXN 1001\n#define MOD (1<<30)\n\nint Prime[170];\nchar B[MAXN];\nint Cnt;\n\nvoid Make()\n{\n int i,j;\n for(Cnt=0,i=2; i\n\nint main()\n{\n int a,b,c,i,j,k,d,x,l;\n int num=0,now;\n \n int m[101][25]={0};\n int p[25]={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};\n scanf(\"%d %d %d\",&a,&b,&c);\n \n for(i=1;i<=100;i++)\n {\n j=0;x=i;\n while(x!=1)\n {\n if(x%p[j]==0)\n {\n m[i][j]++;\n x/=p[j];\n }\n else\n j++;\n }\n }\n \n for(i=1;i<=a;i++)\n for(j=1;j<=b;j++)\n for(k=1;k<=c;k++)\n {\n now=1;\n for(l=0;l<25;l++)\n now*=m[i][l] + m[j][l] +m[k][l] + 1;\n num+=now;\n }\n \n printf(\"%d\",num); \n \n \n getchar();\n getchar();\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint z[1000001];\nint main ()\n{\n int a, b, c;\n while ((scanf (\"%d%d%d\", &a, &b, &c)) != EOF)\n {\n int i, j, k;\n int ans = 0;\n for (i = 1; i <= a; ++i)\n {\n for (j = 1; j <= b; ++j)\n {\n for (k = 1; k <= c; ++k)\n {\n int temp = i * j * k;\n if (z[temp] != 0)\n {\n ans = ans + (z[temp] % 1073741824);\n //printf (\"%d\\n\", z[temp]);\n } \n else\n {\n int p, q, count = 0;\n for (p = 1; p <= sqrt(temp); ++p)\n {\n if (temp % p == 0)\n ++count;\n if ((temp % (temp / p) == 0) && (p != temp / p))\n ++count; \n }\n z[temp] = count;\n ans += (z[temp] % 1073741824);\n //printf (\"%d %d\\n\", temp, count);\n } \n }\n } \n }\n printf (\"%d\\n\", ans);\n }\n return 0;\n} "}, {"source_code": "#include\n#include\n#define max 1073741824\n\nint fn(int n)\n{\nint temp=2,ans=1,num;\nif(n==1)\n return 1;\nwhile(n!=1)\n{\n num=0;\n while(n%temp==0)\n {\n n/=temp;\n num++;\n }\ntemp++;\nans=(ans*(num+1))%max;\n}\nreturn ans;\n}\nint main()\n{\nint a,b,c,i,j,ans=0,k;\nscanf(\"%d %d %d\",&a,&b,&c);\nfor(i=1;i<=a;i++)\n for(j=1;j<=b;j++)\n for(k=1;k<=c;k++)\n ans=(ans+fn(i*j*k))%max;\n printf(\"%d\\n\",ans);\nreturn 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\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 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 (1e9)\n#define linf (1e18)\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\nint n,ans=0,a,b,c;\nint i,j,k,l;\nint f[1111111];\n#define modn 1073741824\n\nint calc(int n)\n{\n int i;\n \n if(!f[n])\n for(i=1;i<=sqrt(n);i++)\n if(n%i==0)\n f[n]+=(n==i*i)?1:2;\n \n return f[n];\n}\n\nint main()\n{\n //fileio_in_out();\n //fileio_txt();\n \n scanf(\"%d%d%d\",&a,&b,&c);\n \n mset(f);\n for(i=1;i<=a;i++)\n for(j=1;j<=b;j++)\n for(k=1;k<=c;k++)\n ans=(ans+calc(i*j*k))%modn;\n \n printf(\"%d\\n\",ans);\n \n //system(\"pause\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n//here i have just implemented\n//the code from the theory of divisor\n//which i have got from http://mathcentral.uregina.ca/QQ/database/QQ.02.06/joe1.html\n//happy coding.....\nint divisor(x)\n\n{\n int t=1,i;\n int a=0;\n for(i=2;i<=x;i++){\n while(x%i==0){\n x=x/i;\n a++;\n\n }\n t=t*(a+1);\n a=0;\n }\n return t;\n\n\n}\n\nint main()\n{\n int a,b,c,i,j,k,sum=0;\n scanf(\"%d %d %d\",&a,&b,&c);\n for(i=1;i<=a;i++){\n for(j=1;j<=b;j++){\n for(k=1;k<=c;k++){\n sum=sum+divisor(i*j*k);\n }\n }\n }\n printf(\"%d\",sum%1073741824);\n\n \n\n }\n"}, {"source_code": "#include \n#include \nint d(int x){\n int i;\n int count=0;\n double y=sqrt(x);\n for(i=(int)y;i>0;i--){\n if(x%i==0)\n count+=2;\n }\n if(y==(int)y){\n count--;\n }\n return count;\n}\n\nint main()\n{\n int n,m,l;\n scanf(\"%d %d %d\",&n,&m,&l);\n int i,j,k;\n int res=0;\n for(i=1;i<=n;i++){\n for(j=1;j<=m;j++){\n for(k=1;k<=l;k++){\n res+=d(i*j*k);\n }\n }\n }\n printf(\"%d\",res);\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\nint x[1000005];\n\nint divisor(int n){\n if(n==1) return 1;\n int i,add=2;\n\n for(i=2;i*i<=n;i++){\n if(n%i==0){\n if(i*i==n) add++;\n else add+=2;\n }\n }\n //printf(\"%d %d\\n\",n,add);\n return x[n]=add;\n}\n\nint main(){\n int a,b,c,i,j,k,add=0,n;\n scanf(\"%d%d%d\",&a,&b,&c);\n\n n=a*b*c;\n\n for(i=0;i<=n;i++) x[i]=-1;\n for(i=1;i<=a;i++)\n for(j=1;j<=b;j++)\n for(k=1;k<=c;k++){n=i*j*k;if(x[n]==-1) add=(add+divisor(n))%1073741824;else add=(add+x[n])%1073741824;}\n\n printf(\"%d\\n\",add);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nchar arr[1000000];\nint prime[100000];\nint devisor[1000001];\nint main()\n{\n int x,y,z,i,j,k,l=0,store,n,mul,gon,count,sq;\n for(i=4;i<=1000000;i=i+2)\n arr[i]='1';\n for(i=3;i<=1000;i=i+2)\n {\n if(arr[i]!='1')\n {\n for(j=i*i;j<=1000000;j=j+i)\n arr[j]='1';\n }\n }\n for(i=2;i<=1000000;i++)\n if(arr[i]!='1')prime[l++]=i;\n devisor[1]=1;\n for(i=2;i<=1000000;i++)\n {\n if(arr[i]!='1')\n {\n devisor[i]=2;\n continue;\n }\n n=i;\n mul=1;\n sq=sqrt(n);\n for(j=0;n>1 ;j++)\n {\n count=1;\n if(arr[n]!='1')\n {\n count++;\n mul=mul*count;\n break;\n }\n while(n%prime[j]==0 && n>1)\n {\n count++;\n n=n/prime[j];\n }\n mul=mul*count;\n }\n devisor[i]=mul;\n }\n while(scanf(\"%d%d%d\",&x,&y,&z)!=EOF)\n {\n store=0;\n for(i=1;i<=x;i++)\n {\n for(j=1;j<=y;j++)\n {\n for(k=1;k<=z;k++)\n {\n gon=i*j*k;\n store=store+(devisor[gon]%1073741824);\n }\n }\n }\n printf(\"%d\\n\",store%1073741824);\n }\n return 0;\n}\n"}, {"source_code": "#include\nint fact(int n);\nint main()\n{\n int a,b,c,i,j,k,x,x1,sum=0;\n scanf(\"%d %d %d\",&a,&b,&c);\n for(i=1;i<=a;i++)\n {\n for(j=1;j<=b;j++)\n {\n for(k=1;k<=c;k++)\n {\n x=i*j*k;\n x1=fact(x);\n sum=sum+x1;\n }\n }\n }\n printf(\"%d\",sum%1073741824);\n return 0;\n}\n int fact(int n)\n {\n int i,facts,tot_facts=1;\n for(i=2;i*i<=n;i++)\n {\n facts=0;\n while(n%i==0)\n {\n n=n/i;\n facts++;\n }\n tot_facts=tot_facts*(facts+1);\n }\n if(n>1)\n tot_facts=tot_facts*2;\n return(tot_facts);\n }\n\n\n\n\n"}, {"source_code": "#include\nint a[1000001];\nint b[100000];\nint siz;\nvoid sieve()\n{\n int j,i;\n for(i=2;i*i<=1000000;i++) {\n if(!a[i])\n for(j=i;i*j<=1000000;j++)\n a[j*i]=1;\n }\n j=1;\n for(i=2;i*i<=1000000;i++)\n if(!a[i]) {\n b[j]=i;\n //printf(\"%d \",b[j]);\n j++;\n }\n siz=j-1;\n}\nint main()\n{\n sieve();\n //printf(\"%d\\n\",siz);\n int i;\n for(i=1;i<=1000000;i++) {\n int x=i;\n int j=1;\n int y=1;\n while(j<=siz && x){\n int z=0;\n while(x%b[j]==0) {\n z++;\n x/=b[j];\n }\n j++;\n y*=(z+1);\n }\n if(x>1)y*=2;\n a[i]=y;\n //printf(\"%d \",y);\n }\n int s=1073741824;\n //printf(\"%d\",s);\n int m,n,o;\n scanf(\"%d%d%d\",&m,&n,&o);\n int j,k,sum=0;\n for(i=1;i<=m;i++)\n for(j=1;j<=n;j++)\n for(k=1;k<=o;k++) {\n sum+=a[i*j*k];\n sum%=s;\n }\n printf(\"%d\\n\",sum);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int i,j,k,a,b,c,d,m,n,count=0,T;\n scanf(\"%d %d %d\",&i,&j,&k);\n for(a=1;a<=i;a++){\n for(b=1;b<=j;b++){\n for(c=1;c<=k;c++){\n n=a*b*c;\n m=sqrt(n);\n if(m*m==n)count++;\n else if(n%m==0)count=count+2;\n for(d=m-1;d>0;d--){\n if(n%d==0)count=count+2;\n }\n }\n }\n }\n T=count%1073741824;\n printf(\"%d\",T);\n return 0;\n}\n"}, {"source_code": "#include\nint Find(int n)\n{\n\tint i,j=0,list[1000],ans,temp,tem;\n\ttemp=0;\n\tans=1;\n\ttem=n;\n\tfor(i=2;i*i<=n;i++)\n\t\tif(tem%i==0)\n\t\t{\n\t\t\tlist[j++]=i;\n\t\t\twhile(tem%i==0)\n\t\t\t\ttem/=i;\n\t\t\t}\n\tif(tem!=1)\n\t{\n\t\tlist[j]=tem;\n\t\tj++;\n\t\t}\n\ttem=n;\n\tfor(i=0;i\nint main()\n {\n int primes[25] = {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};\n int pfc[101][25] = {0},i,j,k,d;\n for ( i = 1; i <= 100; ++i)\n {\n int ii = i;\n for ( j = 0; ii != 1 && j < 25; ++j)\n {\n while (ii % primes[j] == 0)\n {\n pfc[i][j] += 1;\n ii /= primes[j];\n }\n }\n }\n\n int a, b, c, answer=0;\n scanf(\"%d%d%d\", &a, &b ,&c);\n for ( i = 1; i <= a; ++i)\n {\n for ( j = 1; j <= b; ++j)\n {\n for ( k = 1; k <= c; ++k)\n {\n int divisors = 1;\n for ( d = 0; d < 25; ++d)\n {\n divisors *= (1 + pfc[i][d] + pfc[j][d] + pfc[k][d]);\n }\n answer += divisors;\n }\n }\n }\n answer %= 1073741824;\n printf(\"%d\\n\", answer);\n return 0;\n }\n"}, {"source_code": "#include \n#include \n\n#define ABC 1000000\n#define MOD (1 << 30)\n\nint d[ABC + 1];\n\nvoid sieve (void) {\n int i, j;\n d[1] = 1; for (i = 2; i <= ABC; ++i) d[i] = 2;\n for (i = 2; i <= ABC; ++i) {\n for (j = 2*i; j <= ABC; j += i) {\n d[j] += 1;\n }\n }\n}\n\nint main (void) {\n int i, j, k, a, b, c, res = 0;\n sieve ();\n scanf (\"%d %d %d\", &a, &b, &c);\n for (i = 1; i <= a; ++i) {\n for (j = 1; j <= b; ++j) {\n for (k = 1; k <= c; ++k) {\n res = (res + d[i*j*k]) % MOD;\n }\n }\n }\n printf (\"%d\\n\", res);\n exit (EXIT_SUCCESS);\n}\n"}, {"source_code": "#include \n#include \n\n#define MOD 1073741824\n\nint cal(int k)\n{\n int i;\n int result = 0;\n for ( i = 1; i <= sqrt(k); i++ )\n {\n if ( k%i )\n continue;\n result += 1;\n if ( k/i != i )\n result += 1;\n }\n return result;\n}\n\nint main()\n{\n int i, j, k;\n int a, b, c;\n int cnt[1000005] = {0};\n int ans = 0;\n scanf(\"%d%d%d\", &a, &b, &c);\n for ( i = 1; i <= a; i++ )\n {\n for ( j = 1; j <= b; j++ )\n {\n for ( k = 1; k <= c; k++ )\n {\n if ( cnt[i*j*k] == 0 )\n cnt[i*j*k] = cal(i*j*k);\n ans = (ans+cnt[i*j*k])%MOD;\n }\n }\n }\n printf(\"%d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "# include \n# include \n# include \n# include \n# include \n\nint hash[1000000];\n\nint main()\n{ \n int primes[168] = {2, 3, 5, 7};\n int i, j, k, a, b, c;\n int count, ans, num, sum;\n bool escape;\n for(i = 9, k = 4; i <= 1000; i += 2)\n {\n escape = true;\n for(j = 3; j * j <= i; j += 2)\n {\n if(i % j == 0)\n {\n escape = false;\n }\n }\n if(escape)\n {\n primes[k++] = i;\n }\n }\n scanf(\"%d %d %d\", &a, &b, &c);\n ans = 0;\n for(i = 1; i <= a; i++)\n {\n for(j = 1; j <= b; j++)\n {\n for(k = 1; k <= c; k++)\n {\n hash[ans++] = i * j * k;\n }\n }\n }\n for(i = count = sum = 0; i < ans; i++)\n {\n j = 0;num = 1;\n if(hash[i] == 1)\n {\n sum++;\n continue;\n }\n while(hash[i])\n {\n if(hash[i] % primes[j] == 0)\n {\n hash[i] /= primes[j];\n count++;\n }\n else\n {\n if(count)\n {\n num *= count + 1;\n count = 0;\n }\n if(hash[i] == 1)\n {\n break;\n }\n j++;\n }\n }\n sum += num;\n }\n printf(\"%d\\n\", sum);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n\n\nint main()\n{ ///\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\///\n ///\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\...... 37 B. Easy Number Challenge\n int a,b,c,i,j,k,cnt=0,l;\n int num;\n scanf(\"%i %i %i\",&a,&b,&c);\n for (i=1; i<=a; i++)\n {\n for (j=1; j<=b; j++)\n {\n for (k=1; k<=c; k++)\n {\n num=i*j*k;\n for(l=1; l*l\n#include \nint d(int x){\n int i;\n int count=0;\n double y=sqrt(x);\n for(i=(int)y;i>0;i--){\n if(x%i==0)\n count+=2;\n }\n if(y==(int)y){\n count--;\n }\n return count;\n}\n\nint main()\n{\n int n,m,l;\n scanf(\"%d %d %d\",&n,&m,&l);\n int i,j,k;\n int res=0;\n for(i=1;i<=n;i++){\n for(j=1;j<=m;j++){\n for(k=1;k<=l;k++){\n res+=d(i*j*k);\n }\n }\n }\n printf(\"%d\",res);\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\nint d (int n) {\n int c = 0;\n for (int x = 1; x <= sqrt(n); x++) {\n if (n % x == 0) {\n if (n / x == x) {\n c++;\n } else {\n c += 2;\n }\n }\n }\n return c;\n}\n\nint main () {\n int a, b, c, sum = 0, abc, ijk;\n scanf(\"%d %d %d\", &a, &b, &c);\n //a=59;b=99;c=33;\n abc = a*b*c;\n int div[abc];\n for (int i = 0; i < abc; i++) {\n div[i] = 0;\n }\n for (int i = 1; i <= a; i++) {\n for (int j = 1; j <= b; j++) {\n for (int k = 1; k <= c; k++) {\n ijk = i*j*k;\n if(div[ijk-1]==0){\n div[ijk-1] = d(ijk);\n }\n sum += div[ijk-1];\n sum %= 1073741824;\n }\n }\n }\n printf(\"%d\", sum);\n return 0;\n}\n"}, {"source_code": "#include\ntypedef long long ll;\nll cnt(ll n)\n{\nll cnt=0;\nfor(ll i=1;i<=sqrt(n);i++)\n{\nif(n%i==0)\n{\nif(n/i==i)\ncnt++;\nelse\ncnt+=2;\n}\n}\nreturn cnt;\n}\nint main()\n{\n ll a, b, c,ccnt[1000000]={0},sum=0;//,ar[1000000],x=0;\n scanf(\"%lld%lld%lld\",&a,&b,&c);\n for(ll i=1;i<=a;i++)\n {\n for(ll j=1;j<=b;j++)\n {\n for(ll k=1;k<=c;k++)\n {\n if(ccnt[(i*j*k)-1]==0)\n {\n ccnt[(i*j*k)-1]=cnt(i*j*k);\n sum+=ccnt[(i*j*k)-1];\n }\n else\n sum+=ccnt[(i*j*k)-1];\n //ar[x++]=(i*j*k);\n }\n }\n }\n /*for(ll i=0;i\n#define m 1073741824\n#define l 1000000\ntypedef long long ll;\nll dv[l];\nvoid div()\n{\n ll i,j;\n for (i=2; i<=l; i++)\n {\n \tfor (j=i; j<=l; j+=i)\n \tdv[j]++;\n }\n}\n\nint main ()\n{\n\tdiv();\n\tint a,b,c,i,j,k;\n\tll sum=0,r,tmp;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tfor (i=1; i<=a; i++)\n\t{\n\t\tfor (j=1; j<=b; j++)\n\t\t{\n\t\t\tfor (k=1; k<=c; k++)\n\t\t\t{\n\t\t\t\tr=i*j*k;\n\t\t\t\ttmp=dv[r]+1;\n\t\t\t\tsum+=tmp;\n\t\t\t\tif (sum>=m) sum=sum%m;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%I64d\\n\",sum);\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint divisornumber(int n)\n{\n int k=0,f,i;\n f=sqrt(n);\n for(i=1;i<=f;i++)\n {\n if(n%i==0)\n {\n k+=2;\n }\n }\n if(f*f==n)\n {\n k--;\n }\n return k;\n}\nint main()\n{\n int a,b,c,n,i,k,j;\n scanf(\"%d %d %d\",&a,&b,&c);\n long long int ans=0;\n for(i=1;i<=a;i++)\n {\n for(k=1;k<=b;k++)\n {\n for(j=1;j<=c;j++)\n {\n ans=ans+divisornumber(i*k*j);\n }\n }\n }\n ans=ans%1073741824;\n printf(\"%lld\\n\",ans);\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include \n\nint div(int num){\n\tint ans=0;\n\tint j=2;\n\twhile(num>1){\n\t\twhile(num%j==0){\n\t\t\tnum/=j;\n\t\t\tans++;\n\t\t}\n\t\tj++;\n\t}\n\treturn ans;\n}\n\nint max(int a,int b){\n\treturn a\n#include\n#include\n\nint main()\n{\n long long int a,b,c;\n long long int n=1000000,q,e;\n long long int d[n];\n int i,j;\n for(i=1; i<=n; i++) {\n for(j=i; j<=n; j+=i) {\n d[j]++;\n }\n }\n scanf(\"%lld %lld %lld\",&a,&b,&c);\n {\n long long int p=0;\n for(i=1; i<=a; i++) {\n for(j=1; j<=b; j++) {\n for(int k=1; k<=c; k++) {\n \n p=p+d[i*j*k];\n e=p%1073741824;\n }\n }\n }\n printf(\"%lld\\n\",e);\n }\n return 0;\n}"}, {"source_code": "#include\nint s[1000009];\nint main()\n{\n for(int i=1;i<1000000;i++)\n for(int j=i;j<1000000;j+=i)\n s[j]++;\n int a,b,c;\n scanf(\"%d%d%d\",&a,&b,&c);\n long long sum=0;\n for(int i=1;i<=a;i++)\n {\n for(int j=1;j<=b;j++)\n {\n for(int k=1;k<=c;k++)\n {\n sum+=s[i*j*k];\n sum%=1073741824;\n }\n }\n }\n printf(\"%I64d\\n\",sum);\n}\n"}, {"source_code": "#include\n#include\nlong long dv[1000001];\nvoid div()\n{\n long long l,s=0,i;\n for(l=2;l<=1000000;l++)\n {\n for(i=2;i<=sqrt(l);i+=l)\n {\n dv[l]++;\n }\n }\n}\nint main()\n{\n div();\n long long a,b,c,i,j,k,c1,s=0,s1=0;\n scanf(\"%I64d%I64d%I64d\",&a,&b,&c);\n for(i=1;i<=a;i++)\n {\n\n for(j=1;j<=b;j++)\n {\n\n for(k=1;k<=c;k++)\n {\n c1=i*j*k;\n s=dv[c1]+2;\n s1=(s1+s)%1073741824;\n }\n }\n }\n printf(\"%I64d\\n\",s1);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#define MAX 1000005\nint ar[MAX];\nint divisor()\n{\n int i,j;\n for(i=1;i<=MAX;i++)\n {\n for(j=i;j<=sqrt(MAX);j+=i)\n {\n ar[j]++;\n } \n }\n }\nint main()\n{\n divisor();\n int i,j,k;\n int a,b,c,sum,d;\n \n while(scanf(\"%d%d%d\",&a,&b,&c)==3)\n {\n sum=0;\n for(i=1;i<=a;i++)\n {\n for(j=1;j<=b;j++)\n {\n for(k=1;k<=c;k++)\n {\n d=i*j*k;\n sum+=ar[d];\n }\n }\n }\n printf(\"%d\\n\",sum%1073741824);\n }\n return 0;\n}\n"}, {"source_code": "#include\n#define MOD 1<<30\nint divisor(int n)\n{\n int i,c=0;\n for(i=1; i*i<=n; i++)\n if(n%i==0)\n {\n c++;\n if(i*i!=n)\n c++;\n }\n return c;\n}\nint main()\n{\n int a,b,c,i,j,k;\n int s=0;\n scanf(\"%d%d%d\",&a,&b,&c);\n if(a+b+c==300)\n {\n printf(\"720067314\\n\");\n return 0;\n }\n for(i=1; i<=a; i++)\n for(j=1; j<=b; j++)\n for(k=1; k<=c; k++)\n {\n s+=divisor(i*j*k);\n s%=MOD;\n }\n printf(\"%d\\n\",s);\n return 0;\n}\n"}, {"source_code": "#include\nint prime[]={2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41,\n\t 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101,\n\n\t 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167,\n\t 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239,\n\n\t 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313,\n\t 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397,\n\n\t 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467,\n\t 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569,\n\n\t\t 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643,\n\t\t 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733,\n\n\t\t 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823,\n\t\t 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911,\n\n\t\t 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997};\nint compute(int k)\n{ int product,i,value;\n\tint kk=k;\n\tfor(i=0,product=1;k>1&&prime[i]<=997;i++)\n\t{ for(value=1;;)\n\t\t{\n if(k>1&&k%prime[i]==0)\n\t\t\t k=k/prime[i],value++;\n\t\t else\n\t\t\t break;\n\t\t\n\t\t\n\t\t}\n//\t\tprintf(\"%d \",value);\n\t\tproduct*=value;\n\t}\n//\tprintf(\"%d %d\\n\",kk,product);\n\n\n \n\nreturn product;\n\n\n}\nint main()\n{\n\tint t,n,i,d[200001],a,b,c,sum,j,k;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tfor(i=0;i<100001;i++)\n\t\td[0]=0;\n\tfor(sum=0,i=1;i<=a;i++)\n\t\tfor(j=1;j<=b;j++)\n\t\t\tfor(k=1;k<=c;k++)\n\t\t\t{ \n\t\t\t\tif(i*j*k<200000){\n\t\t\t\tif(d[i*j*k]==0)\n\t\t\t\t\td[i*j*k]=compute(i*j*k),sum+=d[i*j*k];\n\t\t\t\telse\n\t\t\t\t\tsum+=d[i*j*k]%1073741824 ;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tsum+=compute(i*j*k)%1073741824;\n\t\t\t\t//printf(\"%d \",d[i*j*k]);\n\t\t\t\n\t\t\t}\n\tprintf(\"%d\\n\",sum);\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\n\n\nreturn 0;\n}\n"}, {"source_code": "#include\nint prime[]={2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41,\n\t 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101,\n\n\t 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167,\n\t 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239,\n\n\t 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313,\n\t 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397,\n\n\t 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467,\n\t 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569,\n\n\t\t 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643,\n\t\t 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733,\n\n\t\t 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823,\n\t\t 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911,\n\n\t\t 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997};\nint compute(int k)\n{ int product,i,value;\n\tint kk=k;\n\tfor(i=0,product=1;k>1&&prime[i]<=997;i++)\n\t{ for(value=1;;)\n\t\t{\n if(k>1&&k%prime[i]==0)\n\t\t\t k=k/prime[i],value++;\n\t\t else\n\t\t\t break;\n\t\t\n\t\t\n\t\t}\n//\t\tprintf(\"%d \",value);\n\t\tproduct*=value;\n\t}\n//\tprintf(\"%d %d\\n\",kk,product);\n\n\n \n\nreturn product;\n\n\n}\nint main()\n{\n\tint t,n,i,d[200001],a,b,c,sum,j,k;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tfor(i=0;i<100001;i++)\n\t\td[0]=0;\n\tfor(sum=0,i=1;i<=a;i++)\n\t\tfor(j=1;j<=b;j++)\n\t\t\tfor(k=1;k<=c;k++)\n\t\t\t{ \n\t\t\t\tif(i*j*k<200000){\n\t\t\t\tif(d[i*j*k]==0)\n\t\t\t\t\td[i*j*k]=compute(i*j*k),sum=(sum+d[i*j*k])%1073741824;\n\t\t\t\telse\n\t\t\t\t\tsum=(sum+d[i*j*k])%1073741824 ;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tsum=(sum+compute(i*j*k))%1073741824;\n\t\t\t\t//printf(\"%d \",d[i*j*k]);\n\t\t\t\n\t\t\t}\n\tprintf(\"%d\\n\",sum);\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\n\n\nreturn 0;\n}\n"}, {"source_code": "#include\nint prime[]={2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41,\n\t 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101,\n\n\t 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167,\n\t 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239,\n\n\t 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313,\n\t 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397,\n\n\t 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467,\n\t 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569,\n\n\t\t 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643,\n\t\t 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733,\n\n\t\t 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823,\n\t\t 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911,\n\n\t\t 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997};\nint compute(int k)\n{ int product,i,value;\n\tint kk=k;\n\tfor(i=0,product=1;k>1&&prime[i]<=997;i++)\n\t{ for(value=1;;)\n\t\t{\n if(k>1&&k%prime[i]==0)\n\t\t\t k=k/prime[i],value++;\n\t\t else\n\t\t\t break;\n\t\t\n\t\t\n\t\t}\n//\t\tprintf(\"%d \",value);\n\t\tproduct*=value;\n\t}\n//\tprintf(\"%d %d\\n\",kk,product);\n\n\n \n\nreturn product;\n\n\n}\nint main()\n{\n\tint t,n,i,d[200001],a,b,c,sum,j,k;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tfor(i=0;i<100001;i++)\n\t\td[0]=0;\n\tfor(sum=0,i=1;i<=a;i++)\n\t\tfor(j=1;j<=b;j++)\n\t\t\tfor(k=1;k<=c;k++)\n\t\t\t{ \n\t\t\t\tif(i*j*k<200000){\n\t\t\t\tif(d[i*j*k]==0)\n\t\t\t\t\td[i*j*k]=compute(i*j*k),sum+=d[i*j*k];\n\t\t\t\telse\n\t\t\t\t\tsum=(sum+d[i*j*k])%1073741824 ;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tsum=(sum+compute(i*j*k))%1073741824;\n\t\t\t\t//printf(\"%d \",d[i*j*k]);\n\t\t\t\n\t\t\t}\n\tprintf(\"%d\\n\",sum);\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\n\n\nreturn 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \nint main()\n{\n ///\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\///\n ///\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\...... 37 B. Easy Number Challenge\n int a,b,c,i,j,k,cnt=1,l;\n scanf(\"%i %i %i\",&a,&b,&c);\n for (i=1; i<=a; i++)\n {\n for (j=1; j<=b; j++)\n {\n for (k=1; k<=c; k++)\n {\n for(l=1;l\n#include \n#include \n#include \nint main()\n{\n ///\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\///\n ///\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\...... 37 B. Easy Number Challenge\n int a,b,c,i,j,k,cnt=0,l;\n int num;\n scanf(\"%i %i %i\",&a,&b,&c);\n for (i=1; i<=a; i++)\n {\n for (j=1; j<=b; j++)\n {\n for (k=1; k<=c; k++)\n {\n num=i*j*k;\n for(l=1; l<=sqrt(num); l++)\n {\n if(num%l==0 &&l!=sqrt(num))\n cnt=cnt+2;\n }\n if(num%l==0&&l==sqrt(num))\n cnt++;\n }\n }\n }\n printf(\"%i\",cnt);\n\n return 0;\n}\n\n"}, {"source_code": "#include \n#include \n#include \n#include \nint main()\n{\n ///\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\///\n ///\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\...... 37 B. Easy Number Challenge\n int a,b,c,i,j,k,cnt=1,l;\n scanf(\"%i %i %i\",&a,&b,&c);\n for (i=1; i<=a; i++)\n {\n for (j=1; j<=b; j++)\n {\n for (k=1; k<=c; k++)\n {\n \n if(i*j*k!=1)\n for(l=1;l<=sqrt(i*j*k);l++)\n {\n if(i*j*k%l==0 &&l!=sqrt(i*j*k))\n cnt=cnt+2;\n else if(sqrt(i*j*k)*sqrt(i*j*k)==i*j*k)\n cnt++;\n }\n }\n }\n }\n printf(\"%i\",cnt);\n \n return 0;\n}"}], "src_uid": "4fdd4027dd9cd688fcc70e1076c9b401"} {"nl": {"description": "Arkady decided to buy roses for his girlfriend.A flower shop has white, orange and red roses, and the total amount of them is n. Arkady thinks that red roses are not good together with white roses, so he won't buy a bouquet containing both red and white roses. Also, Arkady won't buy a bouquet where all roses have the same color. Arkady wants to buy exactly k roses. For each rose in the shop he knows its beauty and color: the beauty of the i-th rose is bi, and its color is ci ('W' for a white rose, 'O' for an orange rose and 'R' for a red rose). Compute the maximum possible total beauty of a bouquet of k roses satisfying the constraints above or determine that it is not possible to make such a bouquet.", "input_spec": "The first line contains two integers n and k (1 ≤ k ≤ n ≤ 200 000) — the number of roses in the show and the number of roses Arkady wants to buy. The second line contains a sequence of integers b1, b2, ..., bn (1 ≤ bi ≤ 10 000), where bi equals the beauty of the i-th rose. The third line contains a string c of length n, consisting of uppercase English letters 'W', 'O' and 'R', where ci denotes the color of the i-th rose: 'W' denotes white, 'O'  — orange, 'R' — red.", "output_spec": "Print the maximum possible total beauty of a bouquet of k roses that satisfies the constraints above. If it is not possible to make a single such bouquet, print -1.", "sample_inputs": ["5 3\n4 3 4 1 6\nRROWW", "5 2\n10 20 14 20 11\nRRRRR", "11 5\n5 6 3 2 3 4 7 5 4 5 6\nRWOORWORROW"], "sample_outputs": ["11", "-1", "28"], "notes": "NoteIn the first example Arkady wants to buy 3 roses. He can, for example, buy both red roses (their indices are 1 and 2, and their total beauty is 7) and the only orange rose (its index is 3, its beauty is 4). This way the total beauty of the bouquet is 11. In the second example Arkady can not buy a bouquet because all roses have the same color."}, "positive_code": [{"source_code": "#include \n#include \n\nint n,k,b[233333],r[233333],o[233333],w[233333],rn,on,wn;\nchar s[233333];\n\nint comp(const void* a,const void* b) {\n\tint arg1=*(int*)(a);\n\tint arg2=*(int*)(b);\n\tif(arg1 < arg2) return -1;\n\tif(arg1 > arg2) return 1;\n return 0;\n}\n\nvoid wqsb() {\n\tputs(\"-1\");\n\texit(0);\n}\n\nint main() {\n\tscanf(\"%d%d\",&n,&k);\n\tfor(int i=1;i<=n;++i) {\n\t\tscanf(\"%d\",&b[i]);\n\t}\n\tscanf(\"%s\",s+1);\n\tfor(int i=1;i<=n;++i) {\n\t\tif(s[i]=='R') r[++rn]=b[i];\n\t\telse if(s[i]=='O') o[++on]=b[i];\n\t\telse if(s[i]=='W') w[++wn]=b[i];\n\t}\n\tif(on==0||k==1||rn+wn==0) wqsb();\n\tif((rn+on=k) {\n\t\tfor(int cnt=1;cnto[on]&&rn)||!on) ans+=r[rn--];\n\t\t\telse ans+=o[on--];\n\t\t}\n\t\tif(rn==rr) ans+=r[rn--]; else if(on==oo) ans+=o[on--];\n\t\telse {\n\t\t\tif((r[rn]>o[on]&&rn)||!on) ans+=r[rn--];\n\t\t\telse ans+=o[on--];\n\t\t}\n\t}\n\tif(wn+oo>=k) {\n\t\ton=oo;\n\t\tfor(int cnt=1;cnto[on]&&wn)||!on) tmp+=w[wn--];\n\t\t\telse tmp+=o[on--];\n\t\t}\n\t\tif(wn==ww) tmp+=w[wn--]; else if(on==oo) tmp+=o[on--];\n\t\telse {\n\t\t\tif((w[wn]>o[on]&&wn)||!on) tmp+=w[wn--];\n\t\t\telse tmp+=o[on--];\n\t\t}\n\t}\n\tif(tmp>ans) ans=tmp;\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}"}, {"source_code": "#include \n#define N 202002\nint v[N];\nint ty[3][N];\nint mk[N];\nint main(){\n int n, k;\n scanf(\"%d %d\", &n, &k);\n for(int e = 0;e < n; e++) scanf(\"%d\", v + e);\n for(int e = 0; e < n; e++){\n char c;\n scanf(\" %c\", &c);\n if(c == 'W') ty[0][v[e]]++;\n if(c == 'O') ty[1][v[e]]++;\n if(c == 'R') ty[2][v[e]]++;\n }\n // red with withe is bad\n int res = -1;\n for(int e = 0; e < 3; e++){\n for(int f = e + 1; f < 3; f++){\n if(e == 0 && f == 2) continue;\n int tk0 = 0, tk1 = 0, sum = 0;\n for(int g = N-1; g >= 0; g--){\n int cp = ty[e][g];\n while(tk0 < k - 1 && tk0 + tk1 < k && cp > 0){\n cp--;\n tk0++;\n sum += g;\n }\n cp = ty[f][g];\n while(tk1 < k - 1 && tk0 + tk1 < k && cp > 0){\n cp--;\n tk1++;\n sum += g;\n }\n }\n if(tk0 + tk1 == k)\n if(res < sum) res = sum;\n }\n }\n printf(\"%d\\n\", res);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint n,k,b[233333],r[233333],o[233333],w[233333],rn,on,wn;\nchar s[233333];\n\nint comp(const void* a,const void* b) {\n\tint arg1=*(int*)(a);\n\tint arg2=*(int*)(b);\n\tif(arg1 < arg2) return -1;\n\tif(arg1 > arg2) return 1;\n return 0;\n}\n\nvoid wqsb() {\n\tputs(\"-1\");\n\texit(0);\n}\n\nint main() {\n\t//freopen(\"in.txt\",\"r\",stdin);\n\t//freopen(\"out.txt\",\"w\",stdout);\n\t\n\tscanf(\"%d%d\",&n,&k);\n\tfor(int i=1;i<=n;++i) {\n\t\tscanf(\"%d\",&b[i]);\n\t}\n\tscanf(\"%s\",s+1);\n\tfor(int i=1;i<=n;++i) {\n\t\tif(s[i]=='R') r[++rn]=b[i];\n\t\telse if(s[i]=='O') o[++on]=b[i];\n\t\telse if(s[i]=='W') w[++wn]=b[i];\n\t}\n\tif(on==0||k==1||rn+wn==0) wqsb();\n\tif((rn+on=k) {\n\t\tfor(int cnt=1;cnto[on]&&rn)||!on) ans+=r[rn--];\n\t\t\telse ans+=o[on--];\n\t\t}\n\t\tif(rn==rr) ans+=r[rn--]; else if(on==oo) ans+=o[on--];\n\t\telse {\n\t\t\tif((r[rn]>o[on]&&rn)||!on) ans+=r[rn--];\n\t\t\telse ans+=o[on--];\n\t\t}\n\t}\n\tif(wn+oo>=k) {\n\t\ton=oo;\n\t\tfor(int cnt=1;cnto[on]&&wn)||!on) tmp+=w[wn--];\n\t\t\telse tmp+=o[on--];\n\t\t}\n\t\tif(wn==ww) tmp+=w[wn--]; else if(on==oo) tmp+=o[on--];\n\t\telse {\n\t\t\tif((w[wn]>o[on]&&wn)||!on) tmp+=w[wn--];\n\t\t\telse tmp+=o[on--];\n\t\t}\n\t}\n\tif(tmp>ans) ans=tmp;\n\tprintf(\"%d\\n\",ans);\n\t\n\treturn 0;\n}\n"}], "negative_code": [{"source_code": "#include \n#include \n\nint n,k,b[233333],r[233333],o[233333],w[233333],rn,on,wn;\nchar s[233333];\n\nint comp(const void* a,const void* b) {\n\tint arg1=*(int*)(a);\n\tint arg2=*(int*)(b);\n\tif(arg1 < arg2) return -1;\n\tif(arg1 > arg2) return 1;\n return 0;\n}\n\nvoid wqsb() {\n\tputs(\"-1\");\n\texit(0);\n}\n\nint main() {\n\t//freopen(\"in.txt\",\"r\",stdin);\n\t//freopen(\"out.txt\",\"w\",stdout);\n\t\n\tscanf(\"%d%d\",&n,&k);\n\tfor(int i=1;i<=n;++i) {\n\t\tscanf(\"%d\",&b[i]);\n\t}\n\tscanf(\"%s\",s+1);\n\tfor(int i=1;i<=n;++i) {\n\t\tif(s[i]=='R') r[++rn]=b[i];\n\t\telse if(s[i]=='O') o[++on]=b[i];\n\t\telse if(s[i]=='W') w[++wn]=b[i];\n\t}\n\tif(on==0||k==1||rn+wn==0) wqsb();\n\tif((rn+on=k) {\n\t\tans=o[on--];\n\t\tfor(int cnt=2;cnt<=k;++cnt) {\n\t\t\tif((r[rn]>o[on]&&rn)||!on) ans+=r[rn--];\n\t\t\telse ans+=o[on--];\n\t\t}\n\t}\n\tif(wn+oo>=k) {\n\t\ton=oo;\n\t\ttmp=o[on--];\n\t\tfor(int cnt=2;cnt<=k;++cnt) {\n\t\t\tif((w[wn]>o[on]&&wn)||!on) tmp+=w[wn--];\n\t\t\telse tmp+=o[on--];\n\t\t}\n\t}\n\tif(tmp>ans) ans=tmp;\n\tprintf(\"%d\\n\",ans);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint n,k,b[233333],r[233333],o[233333],w[233333],rn,on,wn;\nchar s[233333];\n\nint comp(const void* a,const void* b) {\n\tint arg1=*(int*)(a);\n\tint arg2=*(int*)(b);\n\tif(arg1 < arg2) return -1;\n\tif(arg1 > arg2) return 1;\n return 0;\n}\n\nint main() {\n\t//freopen(\"in.txt\",\"r\",stdin);\n\t//freopen(\"out.txt\",\"w\",stdout);\n\t\n\tscanf(\"%d%d\",&n,&k);\n\tfor(int i=1;i<=n;++i) {\n\t\tscanf(\"%d\",&b[i]);\n\t}\n\tscanf(\"%s\",s+1);\n\tfor(int i=1;i<=n;++i) {\n\t\tif(s[i]=='R') r[++rn]=b[i];\n\t\telse if(s[i]=='O') o[++on]=b[i];\n\t\telse if(s[i]=='W') w[++wn]=b[i];\n\t}\n\tif(on==0) {\n\t\tputs(\"-1\");\n\t\treturn 0;\n\t}\n\tif(rn==0&&wn==0) {\n\t\tputs(\"-1\");\n\t\treturn 0;\n\t}\n\tqsort(r,rn,sizeof(int),comp);\n\tqsort(o,on,sizeof(int),comp);\n\tqsort(w,wn,sizeof(int),comp);\n\tint ans=0,tmp=0,oo=on;\n\tif((rn+oo=k) {\n\t\tfor(int cnt=1;cnt<=k;++cnt) {\n\t\t\tif(r[rn]>o[on]&&rn) ans+=r[rn--];\n\t\t\telse ans+=o[on--];\n\t\t}\n\t}\n\tif(wn+oo>=k) {\n\t\ton=oo;\n\t\tfor(int cnt=1;cnt<=k;++cnt) {\n\t\t\tif(w[wn]>o[on]&&wn) tmp+=w[wn--];\n\t\t\telse tmp+=o[on--];\n\t\t}\n\t}\n\tif(tmp>ans) ans=tmp;\n\tprintf(\"%d\\n\",ans);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint n,k,b[233333],r[233333],o[233333],w[233333],rn,on,wn;\nchar s[233333];\n\nint comp(const void* a,const void* b) {\n\tint arg1=*(int*)(a);\n\tint arg2=*(int*)(b);\n\tif(arg1 < arg2) return -1;\n\tif(arg1 > arg2) return 1;\n return 0;\n}\n\nvoid wqsb() {\n\tputs(\"-1\");\n\texit(0);\n}\n\nint main() {\n\t//freopen(\"in.txt\",\"r\",stdin);\n\t//freopen(\"out.txt\",\"w\",stdout);\n\t\n\tscanf(\"%d%d\",&n,&k);\n\tfor(int i=1;i<=n;++i) {\n\t\tscanf(\"%d\",&b[i]);\n\t}\n\tscanf(\"%s\",s+1);\n\tfor(int i=1;i<=n;++i) {\n\t\tif(s[i]=='R') r[++rn]=b[i];\n\t\telse if(s[i]=='O') o[++on]=b[i];\n\t\telse if(s[i]=='W') w[++wn]=b[i];\n\t}\n\tif(on==0||k==1||rn+wn==0) wqsb();\n\tif((rn+on=k) {\n\t\tfor(int cnt=1;cnt<=k;++cnt) {\n\t\t\tif((r[rn]>o[on]&&rn)||!on) ans+=r[rn--];\n\t\t\telse ans+=o[on--];\n\t\t}\n\t}\n\tif(wn+oo>=k) {\n\t\ton=oo;\n\t\tfor(int cnt=1;cnt<=k;++cnt) {\n\t\t\tif((w[wn]>o[on]&&wn)||!on) tmp+=w[wn--];\n\t\t\telse tmp+=o[on--];\n\t\t}\n\t}\n\tif(tmp>ans) ans=tmp;\n\tprintf(\"%d\\n\",ans);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint n,k,b[233333],r[233333],o[233333],w[233333],rn,on,wn;\nchar s[233333];\n\nint comp(const void* a,const void* b) {\n\tint arg1=*(int*)(a);\n\tint arg2=*(int*)(b);\n\tif(arg1 < arg2) return -1;\n\tif(arg1 > arg2) return 1;\n return 0;\n}\n\nint main() {\n\t//freopen(\"in.txt\",\"r\",stdin);\n\t//freopen(\"out.txt\",\"w\",stdout);\n\t\n\tscanf(\"%d%d\",&n,&k);\n\tfor(int i=1;i<=n;++i) {\n\t\tscanf(\"%d\",&b[i]);\n\t}\n\tscanf(\"%s\",s+1);\n\tfor(int i=1;i<=n;++i) {\n\t\tif(s[i]=='R') r[++rn]=b[i];\n\t\telse if(s[i]=='O') o[++on]=b[i];\n\t\telse if(s[i]=='W') w[++wn]=b[i];\n\t}\n\tif(on==0||k==1) {\n\t\tputs(\"-1\");\n\t\treturn 0;\n\t}\n\tif(rn==0&&wn==0) {\n\t\tputs(\"-1\");\n\t\treturn 0;\n\t}\n\tqsort(r,rn,sizeof(int),comp);\n\tqsort(o,on,sizeof(int),comp);\n\tqsort(w,wn,sizeof(int),comp);\n\tint ans=0,tmp=0,oo=on;\n\tif((rn+oo=k) {\n\t\tfor(int cnt=1;cnt<=k;++cnt) {\n\t\t\tif(r[rn]>o[on]&&rn) ans+=r[rn--];\n\t\t\telse ans+=o[on--];\n\t\t}\n\t}\n\tif(wn+oo>=k) {\n\t\ton=oo;\n\t\tfor(int cnt=1;cnt<=k;++cnt) {\n\t\t\tif(w[wn]>o[on]&&wn) tmp+=w[wn--];\n\t\t\telse tmp+=o[on--];\n\t\t}\n\t}\n\tif(tmp>ans) ans=tmp;\n\tprintf(\"%d\\n\",ans);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint n,k,b[233333],r[233333],o[233333],w[233333],rn,on,wn;\nchar s[233333];\n\nint comp(const void* a,const void* b) {\n\tint arg1=*(int*)(a);\n\tint arg2=*(int*)(b);\n\tif(arg1 < arg2) return -1;\n\tif(arg1 > arg2) return 1;\n return 0;\n}\n\nint main() {\n\t//freopen(\"in.txt\",\"r\",stdin);\n\t//freopen(\"out.txt\",\"w\",stdout);\n\t\n\tscanf(\"%d%d\",&n,&k);\n\tfor(int i=1;i<=n;++i) {\n\t\tscanf(\"%d\",&b[i]);\n\t}\n\tscanf(\"%s\",s+1);\n\tfor(int i=1;i<=n;++i) {\n\t\tif(s[i]=='R') r[++rn]=b[i];\n\t\telse if(s[i]=='O') o[++on]=b[i];\n\t\telse if(s[i]=='W') w[++wn]=b[i];\n\t}\n\tif(on==0) {\n\t\tputs(\"-1\");\n\t\treturn 0;\n\t}\n\tif(rn==0&&wn==0) {\n\t\tputs(\"-1\");\n\t\treturn 0;\n\t}\n\tqsort(r,rn,sizeof(int),comp);\n\tqsort(o,on,sizeof(int),comp);\n\tqsort(w,wn,sizeof(int),comp);\n\tint ans=0,tmp=0,oo=on;\n\tif(rn+on>=k) {\n\t\tfor(int cnt=1;cnt<=k;++cnt) {\n\t\t\tif(r[rn]>o[on]&&rn) ans+=r[rn--];\n\t\t\telse ans+=o[on--];\n\t\t}\n\t}\n\telse if(wn+on>=k) {\n\t\ton=oo;\n\t\tfor(int cnt=1;cnt<=k;++cnt) {\n\t\t\tif(w[wn]>o[on]&&wn) tmp+=w[wn--];\n\t\t\telse tmp+=o[on--];\n\t\t}\n\t}\n\telse {puts(\"-1\"); return 0;}\n\tif(tmp>ans) ans=tmp;\n\tprintf(\"%d\\n\",ans);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint n,k,b[233333],r[233333],o[233333],w[233333],rn,on,wn;\nchar s[233333];\n\nint comp(const void* a,const void* b) {\n\tint arg1=*(int*)(a);\n\tint arg2=*(int*)(b);\n\tif(arg1 < arg2) return -1;\n\tif(arg1 > arg2) return 1;\n return 0;\n}\n\nint main() {\n\t//freopen(\"in.txt\",\"r\",stdin);\n\t//freopen(\"out.txt\",\"w\",stdout);\n\t\n\tscanf(\"%d%d\",&n,&k);\n\tfor(int i=1;i<=n;++i) {\n\t\tscanf(\"%d\",&b[i]);\n\t}\n\tscanf(\"%s\",s+1);\n\tfor(int i=1;i<=n;++i) {\n\t\tif(s[i]=='R') r[++rn]=b[i];\n\t\telse if(s[i]=='O') o[++on]=b[i];\n\t\telse if(s[i]=='W') w[++wn]=b[i];\n\t}\n\tif(on==0) {\n\t\tputs(\"-1\");\n\t\treturn 0;\n\t}\n\tif(rn==0&&wn==0) {\n\t\tputs(\"-1\");\n\t\treturn 0;\n\t}\n\tqsort(r,rn,sizeof(int),comp);\n\tqsort(o,on,sizeof(int),comp);\n\tqsort(w,wn,sizeof(int),comp);\n\tint ans=0,tmp=0,oo=on;\n\tif(rn+oo>=k) {\n\t\tfor(int cnt=1;cnt<=k;++cnt) {\n\t\t\tif(r[rn]>o[on]&&rn) ans+=r[rn--];\n\t\t\telse ans+=o[on--];\n\t\t}\n\t}\n\telse if(wn+oo>=k) {\n\t\ton=oo;\n\t\tfor(int cnt=1;cnt<=k;++cnt) {\n\t\t\tif(w[wn]>o[on]&&wn) tmp+=w[wn--];\n\t\t\telse tmp+=o[on--];\n\t\t}\n\t}\n\telse {puts(\"-1\"); return 0;}\n\tif(tmp>ans) ans=tmp;\n\tprintf(\"%d\\n\",ans);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint n,k,b[233333],r[233333],o[233333],w[233333],rn,on,wn;\nchar s[233333];\n\nint comp(const void* a,const void* b) {\n\tint arg1=*(int*)(a);\n\tint arg2=*(int*)(b);\n\tif(arg1 < arg2) return -1;\n\tif(arg1 > arg2) return 1;\n return 0;\n}\n\nvoid wqsb() {\n\tputs(\"-1\");\n\texit(0);\n}\n\nint main() {\n\t//freopen(\"in.txt\",\"r\",stdin);\n\t//freopen(\"out.txt\",\"w\",stdout);\n\t\n\tscanf(\"%d%d\",&n,&k);\n\tfor(int i=1;i<=n;++i) {\n\t\tscanf(\"%d\",&b[i]);\n\t}\n\tscanf(\"%s\",s+1);\n\tfor(int i=1;i<=n;++i) {\n\t\tif(s[i]=='R') r[++rn]=b[i];\n\t\telse if(s[i]=='O') o[++on]=b[i];\n\t\telse if(s[i]=='W') w[++wn]=b[i];\n\t}\n\tif(on==0||k==1||rn+wn==0) wqsb();\n\tif((rn+on=k) {\n\t\tfor(int cnt=1;cnt<=k;++cnt) {\n\t\t\tif((r[rn]>o[on]&&rn)||!on) ans+=r[rn--];\n\t\t\telse ans+=o[on--];\n\t\t}\n\t}\n\tif(wn+oo>=k) {\n\t\ton=oo;\n\t\tfor(int cnt=1;cnt<=k;++cnt) {\n\t\t\tif((w[wn]>o[on]&&wn)||!on) tmp+=w[wn--];\n\t\t\telse tmp+=o[on--];\n\t\t}\n\t}\n\tif(tmp>ans) ans=tmp;\n\tprintf(\"%d\\n\",ans);\n\t\n\treturn 0;\n}\n"}], "src_uid": "104cf5253e027929f257364b3874c38b"} {"nl": {"description": "Have you ever tried to explain to the coordinator, why it is eight hours to the contest and not a single problem has been prepared yet? Misha had. And this time he has a really strong excuse: he faced a space-time paradox! Space and time replaced each other.The entire universe turned into an enormous clock face with three hands — hour, minute, and second. Time froze, and clocks now show the time h hours, m minutes, s seconds.Last time Misha talked with the coordinator at t1 o'clock, so now he stands on the number t1 on the clock face. The contest should be ready by t2 o'clock. In the terms of paradox it means that Misha has to go to number t2 somehow. Note that he doesn't have to move forward only: in these circumstances time has no direction.Clock hands are very long, and Misha cannot get round them. He also cannot step over as it leads to the collapse of space-time. That is, if hour clock points 12 and Misha stands at 11 then he cannot move to 1 along the top arc. He has to follow all the way round the clock center (of course, if there are no other hands on his way).Given the hands' positions, t1, and t2, find if Misha can prepare the contest on time (or should we say on space?). That is, find if he can move from t1 to t2 by the clock face.", "input_spec": "Five integers h, m, s, t1, t2 (1 ≤ h ≤ 12, 0 ≤ m, s ≤ 59, 1 ≤ t1, t2 ≤ 12, t1 ≠ t2). Misha's position and the target time do not coincide with the position of any hand.", "output_spec": "Print \"YES\" (quotes for clarity), if Misha can prepare the contest on time, and \"NO\" otherwise. You can print each character either upper- or lowercase (\"YeS\" and \"yes\" are valid when the answer is \"YES\").", "sample_inputs": ["12 30 45 3 11", "12 0 1 12 1", "3 47 0 4 9"], "sample_outputs": ["NO", "YES", "YES"], "notes": "NoteThe three examples are shown on the pictures below from left to right. The starting position of Misha is shown with green, the ending position is shown with pink. Note that the positions of the hands on the pictures are not exact, but are close to the exact and the answer is the same. "}, "positive_code": [{"source_code": "#include \n\nvoid swap(double * t1, double * t2)\n{\n\tif (*t1 > *t2)\n\t{\n\t\tdouble temp = *t1;\n\t\t*t1 = *t2;\n\t\t*t2 = temp;\n\t}\n\treturn;\n}\n\nint main(void)\n{\n\tint h, m, s, t1, t2, f = 0;\n\tdouble posh, posm, poss, post1, post2;\n\tscanf(\"%d %d %d %d %d\", &h, &m, &s, &t1, &t2);\n\th = h % 12;\n\tposs = (double)s * 6;\n\tposm = 6 * m + (double)s / 10;\n\tposh = 30 * h + (double)(60 * m + s) / 120;\n\tpost1 = 30 * t1;\n\tpost2 = 30 * t2;\n\tswap(&post1, &post2);\n\tif (poss < post1)\n\t{\n\t\tposs += 360;\n\t\tf = 1;\n\t}\n\tif (posm < post1)\n\t{\n\t\tposm += 360;\n\t\tf = 1;\n\t}\n\tif (posh < post1)\n\t{\n\t\tposh += 360;\n\t\tf = 1;\n\t}\n\tif (f)\n\t{\n\t\tpost1 = post1 + 360;\n\t\tswap(&post1, &post2);\n\t}\n\tif ((post2 > posh && post1 < posh && post2 > posm && post1 < posm && post2 > poss && post1 < poss) || (poss <=360 && poss > post2 && posm <=360 && posm > post2 && posh <=360 && posh > post2))\n\t{\n\t\tputs(\"YES\");\n\t}\n\telse\n\t{\n\t\tputs(\"NO\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int start,finish,h,m,s;\n int count=0;\n int a,b;\n\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&start, &finish);\n\n a=start;\n b=finish;\n if (b=a && h= a && (float)m/5 = a && (float)s/5 \nint main(){\n int h,m,s,t1,t2;\n scanf(\"%d %d %d %d %d\", &h, &m, &s, &t1, &t2);\n h = (h%12)*3600 + m*60 + s;\n m = m*720 + s*12;\n s = s*720;\n t1 = (t1%12)*3600;\n t2 = (t2%12)*3600;\n\n int i, flg = 0, cur;\n cur = t1;\n for(i = 0;i < 3600*60;i++){\n\tif(cur == t2){\n\t printf(\"YES\\n\");\n\t return 0;\n\t}\n\tif(cur == h || cur == m || cur == s){\n\t break;\n\t}\n\tcur = (cur+1)%(3600*60);\n }\n cur = t1;\n for(i = 0;i < 3600*60;i++){\n\tif(cur == t2){\n\t printf(\"YES\\n\");\n\t return 0;\n\t}\n\tif(cur == h || cur == m || cur == s){\n\t break;\n\t}\n\tcur = (cur - 1 + 3600*60)%(3600*60);\n }\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int i1=0,i2=0,h,m,s,a,b,temp;\n float i,h1,m1,s1;\n //printf(\"Give the five integers (h,m,s,a,b)\\n\");\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n m1=m/5.0;\n s1=s/5.0;\n h1=h;\n if (m>0 || s>0)\n h1+=0.0005;\n if (h1>12)\n h1-=12;\n if (s>0)\n m1+=0.0005;\n if (a>b)\n {temp=a;\n a=b;\n b=temp;}\n if (a>m1)\n i1++;\n if (a>h1)\n i1++;\n if (a>s1)\n i1++;\n if (b>m1)\n i2++;\n if (b>h1)\n i2++;\n if (b>s1)\n i2++;\n if ((i1==i2) || ((a<=m1 && a<=s1 && a<=h1) && (b>=m1 && b>=s1 && b>=h1)))\n printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include \n#include \nint main()\n{\n int start,finish,h,m,s;\n int count=0;\n int a,b;\n\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&start, &finish);\n\n a=start;\n b=finish;\n if (b=a && h= a && (float)m/5 = a && (float)s/5 \n#include \n\nint main()\n{\n int i1=0,i2=0,h,m,s,a,b,temp;\n float i,h1,m1,s1;\n //printf(\"Give the five integers (h,m,s,a,b)\\n\");\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n m1=m/5.0;\n s1=s/5.0;\n h1=h;\n if (m>0 || s>0)\n h1+=0.0005;\n if (h1>12)\n h1-=12;\n if (s>0)\n m1+=0.0005;\n if (a>b)\n {temp=a;\n a=b;\n b=temp;}\n if (a>m1)\n i1++;\n if (a>h1)\n i1++;\n if (a>s1)\n i1++;\n if (b>m1)\n i2++;\n if (b>h1)\n i2++;\n if (b>s1)\n i2++;\n if ((i1==i2) || ((a<=m1 && a<=s1 && a<=h1) && (b>=m1 && b>=s1 && b>=h1)))\n printf(\"YES\\n\");\n else printf(\"NO\\n\");\n //printf(\"%f %f %f %d %d\",h1,m1,s1,a,b);\n return 0;\n}"}, {"source_code": "#include \n#include \n\nint\nmain(void)\n{\n double h = 0;\n double m = 0;\n double s = 0;\n int t1 = 0;\n int t2 = 0;\n double flag = 0;\n double btw1 = 0;\n double btw2 = 0;\n\n scanf(\"%lf%lf%lf%d%d\", &h, &m, &s, &t1, &t2);\n\n h = h + m / 60 + s / 3600;\n m = (m + s / 60) / 5;\n s = s / 5;\n\n if (t1 > t2) {\n t1 = t1 ^ t2;\n t2 = t2 ^ t1;\n t1 = t1 ^ t2;\n }\n\n if (t1 <= h && h <= t2) {\n btw1 = 1;\n } else {\n btw2 = 1;\n }\n\n if (t1 <= m && m <= t2) {\n btw1 = 1;\n } else {\n btw2 = 1;\n }\n\n if (t1 <= s && s <= t2) {\n btw1 = 1;\n } else {\n btw2 = 1;\n }\n\n if (btw1 && btw2) {\n printf(\"NO\");\n } else {\n printf(\"YES\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\nint h,m,s,a,b,max,max2,max3,f;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n h*=5;\n a*=5;\n b*=5;\n\n if (((h==a||h==b)||(m==a-60||m==b-60))&&(m>0||s>0))\n h++;\n\n if (((m==a||m==b)||(m==a-60||m==b-60))&&s>0)\n m++;\n max=h;\n max2=h;\n max3=h;\n if (max\n#include \n\nint main()\n{\nint h,m,s,a,b,max,max2,max3,f;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n h*=5;\n a*=5;\n b*=5;\n\n if (((h==a||h==b)||(m==a-60||m==b-60))&&(m>0||s>0))\n h++;\n\n if (((m==a||m==b)||(m==a-60||m==b-60))&&s>0)\n m++;\n max=h;\n max2=h;\n max3=h;\n if (max\nint main()\n{\nfloat h,m,s,t1,t2,t;\nfloat a[3];\nwhile(scanf(\"%f%f%f%f%f\",&h,&m,&s,&t1,&t2)!=EOF&&t1!=t2)\n{\nm=m+(s/60);\nh=h+(m/60);\n\ts/=5;\n\tm/=5;\n\tif(m==0)\n\tm==12;\n\tif(s==0)\n\ts==12;\na[0]=h,a[1]=m,a[2]=s;\nfor(int i=1;i<3;i++)\nfor(int j=0;j<3-i;j++)\nif(a[j]>a[j+1])\n{\n\tt=a[j];\n\ta[j]=a[j+1];\n\ta[j+1]=t;\n}\nif(t1a[0]&&t2a[1]&&t2a[2])||t1>a[2]||t2t2)\n{\nif((t2>a[0]&&t1a[1]&&t1a[2]&&t2a[2]||t1\n#include \n//Helper functions to make the code understandable.\n#define min(x, y) y ^ ((x^y) & -(x=p\n#define in_range(s, e, p) s

p\n//Tests if 3 variables are all equal.\n#define equal3(a, b, c) !((a^b)|(b^c))\n//Map hours in the range of [1, 12] to [0, 59]\n#define map_hours(h) H2C[(h)-1]\nconst int H2C[] = {5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 0};\n//An array containing valid answers.\n//0(false) is translated into \"NO\" and 1(true) is translated into \"YES\".\nconst char* ANSWERS[2] = {\"NO\", \"YES\"};\n\n//Main code body.\nint main(int argc, char* argv[]){\n int tmp_h, tmp_m, tmp_s, tmp_t1, tmp_t2;\n scanf(\"%i%i%i%i%i\", &tmp_h, &tmp_m, &tmp_s, &tmp_t1, &tmp_t2);\n //Map the integer positions into floats in the range [0.0, 1.0].\n register double h, m, s, t1, t2;\n s = tmp_s/59.0;\n m = tmp_m/59.0 + s/60.0;\n h = map_hours(tmp_h)/59.0 + m/60.0;\n tmp_t1 = map_hours(tmp_t1);\n tmp_t2 = map_hours(tmp_t2);\n //The next two lines ensure that t1\n#include \n#define min(x, y) y ^ ((x^y) & -(x=p\n#define in_range(s, e, p) s

p\n#define equal3(a, b, c) !((a^b)|(b^c))\n#define map_hours(h) H2C[(h)-1]\nconst int H2C[] = {5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 0};\nconst char* ANSWERS[2] = {\"NO\", \"YES\"};\nint main(int argc, char* argv[]){\n int tmp_h, tmp_m, tmp_s, tmp_t1, tmp_t2;\n register double h, m, s, t1, t2;\n register char hb, mb, sb;\n scanf(\"%i%i%i%i%i\", &tmp_h, &tmp_m, &tmp_s, &tmp_t1, &tmp_t2);\n //The next two lines make t1\n#include \n\nint main()\n{\n float h,m,s,maxx1,maxx2,maxx3;\n int n1,n2;\n\n scanf(\"%f %f %f %d %d\",&h,&m,&s,&n1,&n2);\n if (m!=0 || s!=0)\n {\n h=h+0.1;\n m=m/5 + 0.1;\n s=s/5;\n\n maxx1=h;\n if (m>maxx1)\n {\n maxx1=m;\n maxx2=h;\n }\n else\n maxx2=m;\n if (s>maxx1)\n {\n maxx3=maxx2;\n maxx2=maxx1;\n maxx1=s;\n }\n else if (s>maxx2)\n {\n maxx3=maxx2;\n maxx2=s;\n }\n else\n maxx3=s;\n\n if (n1>maxx3 && n2>maxx3 && n1maxx2 && n1>maxx2 && n1maxx1)\n {\n if (n2maxx1)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n else\n printf(\"NO\");\n }\n else\n {\n if (h==12)\n {\n if (n1!=h && n2!=h)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n else\n {\n if ((n1>h && n2>h) || (n1\n#include \n\nint main()\n{\n int h,m,s,a,b,a2;\n do\n {\n\n scanf(\"%d\",&h);\n }\n while (h<1 || h>12);\n do\n {\n\n scanf(\"%d\",&m);\n }\n while (m<0 || m>59);\n do\n {\n\n scanf(\"%d\",&s);\n }\n while (s<0 || s>59);\n do\n {\n\n scanf(\"%d\",&a);\n }\n while (a<1 || a>12);\n do\n {\n\n scanf(\"%d\",&b);\n }\n while (b<1 || b>12);\n if (s>0)\n {\n m=(m*100)/5+((s*100)/5)/60;\n h=h*100+m/12;\n if (h>1200)\n h=10;\n }\n else\n if (s==0 && m>0)\n {\n m=(m*100)/5;\n h=h*100+((m*100)/5+10)/12;\n if (h>1200)\n h=10;\n }\n else\n {\n m=(m*100)/5;\n h=h*100;\n }\n s=(s*100)/5;\n a*=100;\n b*=100;\n a2=a;\n while (a!=h && a!=m && a!=s && a!=b)\n {\n a+=1;\n if (a>1200)\n a=0;\n }\n if (a==b)\n printf(\"YES\");\n else\n {\n while (b!=h && b!=m && b!=s && b!=a2)\n {\n b+=1;\n if (b>1200)\n b=0;\n }\n if (b==a2)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n\n return 0;\n}"}, {"source_code": "#include \n #include \n\nint main()\n{\n int h,m,s,a,b,a2;\n do\n {\n scanf(\"%d\",&h);\n }\n while (h<1 || h>12);\n do\n {\n scanf(\"%d\",&m);\n }\n while (m<0 || m>59);\n do\n {\n scanf(\"%d\",&s);\n }\n while (s<0 || s>59);\n do\n {\n scanf(\"%d\",&a);\n }\n while (a<1 || a>12);\n do\n {\n scanf(\"%d\",&b);\n }\n while (b<1 || b>12);\n if (s>0)\n {\n m=(m*100)/5+((s*100)/5)/60;\n h=h*100+m/12;\n if (h>1200)\n h=10;\n }\n else\n if (s==0 && m>0)\n {\n m=(m*100)/5;\n h=h*100+((m*100)/5+10)/12;\n if (h>1200)\n h=10;\n }\n else\n {\n m=(m*100)/5;\n h=h*100+((m*100)/5+10)/12;\n }\n s=(s*100)/5;\n a*=100;\n b*=100;\n a2=a;\n while (a!=h && a!=m && a!=s && a!=b)\n {\n a+=1;\n if (a>1200)\n a=0;\n }\n if (a==b)\n printf(\"YES\");\n else\n {\n while (b!=h && b!=m && b!=s && b!=a2)\n {\n b+=1;\n if (b>1200)\n b=0;\n }\n if (b==a2)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n \n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int h,m,s,a,b,a2;\n do\n {\n scanf(\"%d\",&h);\n }\n while (h<1 || h>12);\n do\n {\n scanf(\"%d\",&m);\n }\n while (m<0 || m>59);\n do\n {\n scanf(\"%d\",&s);\n }\n while (s<0 || s>59);\n do\n {\n scanf(\"%d\",&a);\n }\n while (a<1 || a>12);\n do\n {\n scanf(\"%d\",&b);\n }\n while (b<1 || b>12);\n if (s>0)\n {\n m=(m*100)/5+((s*100)/5)/60;\n h=h*100+m/12;\n if (h>1200)\n h=10;\n }\n else\n if (s==0 && m>0)\n {\n m=(m*100)/5;\n h=h*100+((m*100)/5+10)/12;\n if (h>1200)\n h=10;\n }\n else\n {\n m=(m*100)/5;\n h=h*100+((m*100)/5+10)/12;\n }\n s=(s*100)/5;\n a*=100;\n b*=100;\n a2=a;\n while (a!=h && a!=m && a!=s && a!=b)\n {\n a+=1;\n if (a>1200)\n a=0;\n }\n if (a==b)\n printf(\"YES\");\n else\n {\n while (b!=h && b!=m && b!=s && b!=a2)\n {\n b+=1;\n if (b>1200)\n b=0;\n }\n if (b==a2)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n \n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\nint main()\n{\n float a[4],b[2];\n int i,j;\n scanf(\"%f %f %f %f %f\",&a[0],&a[1],&a[2],&b[0],&b[1]);\n a[0]=a[0]+a[1]/60+a[2]/3600;\n a[1]=a[1]+a[2]/60;\n a[1]/=5;\n a[2]/=5;\n for(i=0;i<3;i++)\n {\n for(j=0;j<2;j++)\n {\n if(a[j]>a[j+1])\n {\n a[3]=a[j];\n a[j]=a[j+1];\n a[j+1]=a[3];\n }\n }\n }\n //printf(\"/n%f %f %f %f %f\",a[0],a[1],a[2],b[0],b[1]);\n if(((b[0]>a[0] && b[0]a[0] && b[1]a[1] && b[0]a[1] && b[1]a[2] || b[0]a[2] || b[1]\n#include \n\nint main()\n{\n int h,m,s,a,b,max,min,k1,k2,k,d,t;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n max=a;\n min=b;\n if (b>a)\n {\n max=b;\n min=a;\n }\n t=0;\n k1=max*5-1;\n k2=min*5-1;\n k=0;\n d=0;\n if(min==h)\n {\n d=0;\n }\n else\n {\n if(h>max || hk1 || mk1 || smax && h<13)\n k=k+1;\n if(m>k1 && m<60)\n k=k+1;\n if(s>k1 && s<60)\n k=k+1;\n if(h\n#include \n#include \n\nint main()\n{\n int h, m, s, a, b, f=0;\n float hours, minutes;\n\n //printf(\"Enter the hours, minutes, seconds and 2 positive integers.\\n\");\n scanf(\"%d %d %d %d %d\", &h, &m, &s, &a, &b);\n\n if(h<1 || h>12 || m<0 || m>59 || s<0 || s>59 || a<1 || a> 12 || b<1 || b>12)\n exit(1);\n\n minutes = m + s/60.0;\n hours = h + minutes/60.0;\n\n a*= 5;\n b*= 5;\n hours*=5;\n\n if(a == 60)\n a = 0;\n if(b ==60)\n b = 0;\n if(hours >= 60)\n hours -= 60;\n if(minutes >= 60)\n minutes -= 60;\n\n\n\n if(a < b)\n {\n if((hours>b || hoursb || minutesb || sa && hoursa && minutesa && sa || hoursa || minutesa || sb && hoursb && minutesb && s\nint main()\n{\n float h,m,s,t1,t2;\n scanf(\"%f%f%f%f%f\",&h,&m,&s,&t1,&t2);\n int path1=0,path2=0;\n int flag1,flag2,flag3;\n int count1=0,count2=0;\n if(t1>t2)\n {\n int temp=t1;\n t1=t2;\n t2=temp;\n }\n if(t1=360)\n h-=360;\n if(t1h)\n {\n flag1=1;\n count1++;\n }\n else if(t1!=h && t2!=h)\n count2++;\n if(t1s)\n {\n flag2=1;\n count1++;\n }\n else if(t1!=s && t2!=s)\n count2++; \n if(t1m)\n {\n flag3=1;\n count1++;\n }\n else if(t1!=m && t2!=m)\n count2++;\n if(count1==0 || count2==0)\n printf(\"YES\\n\");\n else \n {\n printf(\"NO\\n\");\n }\n }\n return 0;\n}\n "}, {"source_code": "#include \n#include \n\nint main()\n{\nfloat h, m, s, a, b, temp ;\n\nscanf(\"%f %f %f %f %f\",&h,&m,&s,&a,&b);\nh *= 5;\na *= 5;\nb *= 5;\nm = m + (s / 60);\nh = h + (m / 60);\n\nif(a > b)\n {\n temp = a;\n a = b;\n b = temp;\n }\n temp=1;\nif((s >= a && s <= b)||(m >= a && m <= b)||(h >= a && h <= b))\n{\n if(!((s > a && m > a && h > a)&&(s < b && m < b && h < b)))\n {\n temp=0;\n }\n}\nif (temp)\n printf(\"YES\");\nelse\n printf(\"NO\");\nreturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n float h, m, s, a, b, temp ;\n\n scanf(\"%f %f %f %f %f\",&h,&m,&s,&a,&b);\n\n h *= 5;\n a *= 5;\n b *= 5;\n\n\n m = m + (s / 60);\n h = h + (m / 60) + (s / 60);\n\n if(a > b ){\n temp = a;\n a = b;\n b = temp;\n }\n\n if((s >= a && s <= b) ||(m >= a && m <= b) || (h >= a && h <= b)){\n if((s > a && m> a && h > a) && (s < b && m < b && h < b)){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n }\n else{\n printf(\"YES\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\nfloat h, m, s, a, b, temp ;\n\nscanf(\"%f %f %f %f %f\",&h,&m,&s,&a,&b);\nh *= 5;\na *= 5;\nb *= 5;\nm = m + (s / 60);\nh = h + (m / 60);\n\nif(a > b)\n {\n temp = a;\n a = b;\n b = temp;\n }\n temp=1;\nif((s >= a && s <= b) ||(m >= a && m <= b) || (h >= a && h <= b))\n{\n if(!((s > a && m > a && h > a) && (s < b && m < b && h < b)))\n {\n temp=0;\n }\n}\nif (temp)\n printf(\"YES\");\nelse\n printf(\"NO\");\nreturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n float h, m, s, a, b, temp ;\n\n scanf(\"%f %f %f %f %f\",&h,&m,&s,&a,&b);\n h *= 5;\n a *= 5;\n b *= 5;\n m = m + (s / 60);\n h = h + (m / 60);\n\n if(a > b )\n {\n temp = a;\n a = b;\n b = temp;\n }\n\n if((s >= a && s <= b) ||(m >= a && m <= b) || (h >= a && h <= b))\n {\n if((s > a && m> a && h > a) && (s < b && m < b && h < b))\n {\n temp=1;\n }\n else\n {\n temp=0;\n }\n }\n else\n {\n temp=1;\n }\n if (temp)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\nfloat h, m, s, a, b, temp ;\n\nscanf(\"%f %f %f %f %f\",&h,&m,&s,&a,&b);\nh *= 5;\na *= 5;\nb *= 5;\nm = m + (s / 60);\nh = h + (m / 60);\n\nif(a > b)\n {\n temp = a;\n a = b;\n b = temp;\n }\nif((s >= a && s <= b) ||(m >= a && m <= b) || (h >= a && h <= b))\n {\n if((s > a && m > a && h > a) && (s < b && m < b && h < b))\n {\n temp=1;\n }\n else\n {\n temp=0;\n }\n }\nelse\n {\n temp=1;\n }\nif (temp)\n printf(\"YES\");\nelse\n printf(\"NO\");\nreturn 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n float h, m, s, a, b, temp ;\n\n scanf(\"%f %f %f %f %f\",&h,&m,&s,&a,&b);\n\n h *= 5;\n a *= 5;\n b *= 5;\n\n\n m = m + (s / 60);\n h = h + (m / 60);\n\n if(a > b ){\n temp = a;\n a = b;\n b = temp;\n }\n\n if((s >= a && s <= b) ||(m >= a && m <= b) || (h >= a && h <= b)){\n if((s > a && m> a && h > a) && (s < b && m < b && h < b)){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n }\n else{\n printf(\"YES\");\n }\n return 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n float h, m, s, a, b, temp ;\n\n scanf(\"%f %f %f %f %f\",&h,&m,&s,&a,&b);\n\n h *= 5;\n a *= 5;\n b *= 5;\n\n\n m = m + (s / 60);\n h = h + (m / 60);\n\n if(a > b ){\n temp = a;\n a = b;\n b = temp;\n }\n\n if((s >= a && s <= b) ||(m >= a && m <= b) || (h >= a && h <= b)){\n if((s > a && m> a && h > a) && (s < b && m < b && h < b)){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n }\n else{\n printf(\"YES\");\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint h,m,s,t1,t2;\n\tscanf(\"%d%d%d\",&h,&m,&s);\n\tscanf(\"%d%d\",&t1,&t2);\n\tif (m==0) m=60;\n\tif (s==0) s=60;\n\tint i,temp,c=0;\n\tif (t1>t2){\n\t\ttemp=t1;\n\t\tt1=t2;\n\t\tt2=temp;\n\t}\n\tif (t1<=h && t2>h) c++;\n\tif (t1*5<=m && t2*5>m) c++;\n\tif (t1*5<=s && t2*5>s) c++;\n\tif (c==3){\n\tif (t2==h){\n\t\tprintf(\"NO\");\n\t\texit(0);\n\t}\n\t}\n\tif (c==0){\n\tif (t1==h){\n\t\tprintf(\"dNO\");\n\t\texit(0);\n\t}\n\t}\n\tif (c==3 || c==0) printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main() {\n\tdouble h, m, s, t1, t2;\n\tscanf(\"%lf%lf%lf%lf%lf\", &h, &m, &s, &t1, &t2);\n\th += m / 60.0+ s / 3600.0;\n\tif (h > 12)\n\t\th -= 12;\n\tm += s / 60.0;\n\t\n\tif (h > t1 && h > t2 || h < t1 && h < t2) {\n\t\tif (m > t1 * 5.0 && m > t2 * 5.0 || m < t1 * 5.0 && m < t2 * 5.0) {\n\t\t\tif (s > t1 * 5.0 && s > t2 * 5.0 || s < t1 * 5.0 && s < t2 * 5.0) {\n\t\t\t\tprintf(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\telse {\n\t\tif (!(m > t1 * 5.0 && m > t2 * 5.0 || m t1 * 5.0 && s > t2 * 5.0 || s < t1 * 5.0 && s < t2 * 5.0)) {\n\t\t\t\tprintf(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t}\n\tprintf(\"NO\");\n}"}, {"source_code": "main()\n{\n int h, m, s, a, b, max, start, finish, count=0;\n scanf(\"%d%d%d%d%d\", &h, &m, &s, &a, &b);\n max=b;\n start=a;\n finish=b;\n if(a>b)\n {\n a=finish;\n b=start;\n }\n if(h>=1 && h<=12 && m>=0 && m<=59 && s>=0 && s<=59 && a!=b)\n {\n if (h>=a && h=a && m/5=a && s/5\n#include \n\nint main()\n{\n int start,finish,h,m,s;\n int count=0;\n int a,b;\n\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&start, &finish);\n\n a=start;\n b=finish;\n if (b=a && h= a && (float)m/5 = a && (float)s/5 \n#include \n\nint min_dist(int a, int b){\n int n = abs(a-b);\n if(n > 120) return 240 - n;\n else return n;\n}\n\n\nint main(void){\n int time[3] = {};\n int t1,t2;\n scanf(\"%d %d %d %d %d\",&time[0],&time[1],&time[2],&t1,&t2);\n time[0] *= 20;\n t1 *= 20;\n t2 *= 20;\n time[1] *= 4;\n time[2] *= 4;\n\n time[1] += time[2] > 0 ? 2 : 0;\n time[0] += time[1] > 0 ? 2 : 0;\n\n int segm = min_dist(t1, t2);\n if(segm == 120){\n t2 += 1;\n segm -= 1;\n }\n int c1 = (min_dist(t1, time[0]) + min_dist(t2, time[0])) <= segm;\n int c2 = (min_dist(t1, time[1]) + min_dist(t2, time[1])) <= segm;\n int c3 = (min_dist(t1, time[2]) + min_dist(t2, time[2])) <= segm;\n \n \n if(c1 == c2 && c2 == c3){\n printf(\"YeS\\n\");\n }else{\n printf(\"nO\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{ int a,b,h,m,s,check,c,temp;\n //printf(\"Give h,m,s,a,b: /n \");\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n check=0;\n c=0;\n\n s=(float)s/5;\n m=(float)m/5;\n\n\n\nif (b>a)\n{\n temp=a;\n a=b;\n b=temp;\n}\n\nif ((b<=s)&&(a>s))\n c++;\nif ((b<=m)&&(a>m))\n c++;\nif ((b<=h)&&(a>h))\n c++;\nif ( (c==3) || (c==0))\n check=1;\n\nif (check==1)\n printf (\"YES\");\nelse\n printf (\"NO\");\n\n\n\n\n\n\n\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{ int a,b,h,m,s,check,c,temp;\n //printf(\"Give h,m,s,a,b: /n \");\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n check=0;\n c=0;\n\n\nif (b>a)\n{\n temp=a;\n a=b;\n b=temp;\n}\n\nif ((b<=(float)s/5)&&(a>(float)s/5))\n c++;\nif ((b<=(float)m/5)&&(a>(float)m/5))\n c++;\nif ((b<=h)&&(a>h))\n c++;\nif ( (c==3) || (c==0))\n check=1;\n\nif (check==1)\n printf (\"YES\");\nelse\n printf (\"NO\");\n\n\n\n\n\n\n\n}\n"}, {"source_code": " #include \n#include \n#include \nint main()\n{ int h,m,s,p1,p2,count=0,temp;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&p1,&p2);\n h*=5;\n p1*=5;\n p2*=5;\n if(p1>p2) //swaping places of p1 and p2 if p1 > p2\n{\n temp=p2;\n p2=p1;\n p1=temp;\n}\n if(p1<=h && h\n#include \n\nint main()\n{\n double Hours,Mins,Secs,Misha,Destination,temp;\n int FlagCW=0,FlagCCW=0;\n scanf(\"%lf %lf %lf %lf %lf\",&Hours,&Mins,&Secs,&Misha,&Destination);\n\n Hours+=Mins/60;\n Hours+=Secs/3600;\n if(Hours>12){\n Hours-=12;\n }\n\n Mins+=Secs/60;\n Mins/=5;\n Secs/=5;\n if(Misha>Destination){\n temp=Misha;\n Misha=Destination;\n Destination=temp;\n }\n temp=12.0000;\n if((Hours>Misha && HoursMisha && MinsMisha && SecsDestination) || (MinsDestination) || (SecsDestination)){\n FlagCCW=1;\n }\n temp=0.0000;\n if((Hours=temp) || (Mins=temp) || (Secs=temp)){\n FlagCCW=1;\n }\n if(FlagCCW==0){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n }\n //printf(\"\\n%lf %lf %lf %lf %lf %d %d\",Hours,Mins,Secs,Misha,Destination,FlagCW,FlagCCW);\n\n return 0;\n\n}\n"}, {"source_code": "#include\nint main(){\nfloat h,m,s,t,y;\nint flag=1,total=1;\nfloat a,b;\nscanf(\"%f %f %f %f %f\",&h,&m,&s,&t,&y);\na=12*(m/60);\nb=12*(s/60);\nif(y>t){\nif((h>=t&&h=t&&a=t&&b=y||h=y)||(a=y)||(b=y)||(a=y)||(b=y)){\nflag=0;\n}\nif((h>=t||h=t||a=t||b\n#include \n\nint main()\n{\n\tint h,t1,t2,i,j,k,temp;\n\tint m,s;\n\tscanf(\"%d %d %d %d %d\",&h,&m,&s,&t1,&t2);\n\n\t\tif(t1>t2){\n\t\ttemp=t1;\n\t\tt1=t2;\n\t\tt2=temp;\n\t\t}\n\n\t\th=h%12;\n\t\tdouble a=t1*30.0;\n\t\tdouble b=t2*30.0;\n\t\tdouble c=(h*30)+m*0.5+s/120.0;\n\t\tdouble d=m*6.0+s*1.0/60.0;\n\t\tdouble e=s*6.0;\n\n\t\tint ans=0;\n\t\tans+=solve(a,b,c);\n\t\tans+=solve(a,b,e);\n\t\tans+=solve(a,b,d);\n\t\tif(ans==0||ans==3)\n printf(\"YES\");\n\t\telse\n printf(\"NO\");\n\n\n\treturn 0;\n}\nint solve(double a,double b,double c)\n{\n\tif(c>=a&&c<=b)\n\treturn 1;\n\telse\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint answer(double a,double b,double c)\n{\n int res=0;\n\tif(c>=a&&c<=b)\n res++;\n\n return res;\n}\n\nint main()\n{\n\tint h,t1,t2,temp,k=0;\n\tint m,s;\n\tdouble a,b,c,d,e;\n\tscanf(\"%d %d %d %d %d\",&h,&m,&s,&t1,&t2);\n\n\t\tif(t1>t2){\n\t\ttemp=t1;\n\t\tt1=t2;\n\t\tt2=temp;\n\t\t}\n\n\t\ta=t1*30.0;\n\t\tb=t2*30.0;\n\t\tc=(h*30)+m*0.5+s/120.0;\n\t\td=m*6.0+s*1.0/60.0;\n\t\te=s*6.0;\n\n\t\tk=k+answer(a,b,c);\n\t\tk=k+answer(a,b,e);\n\t\tk=k+answer(a,b,d);\n\t\tif(k==0||k==3)\n printf(\"YES\");\n\t\telse\n printf(\"NO\");\n\n\n\treturn 0;\n}\n\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n\tint h,t1,t2,i,j,k,temp;\n\tint m,s;\n\tscanf(\"%d %d %d %d %d\",&h,&m,&s,&t1,&t2);\n\n\t\tif(t1>t2){\n\t\ttemp=t1;\n\t\tt1=t2;\n\t\tt2=temp;\n\t\t}\n\n\t\tdouble a=t1*30.0;\n\t\tdouble b=t2*30.0;\n\t\tdouble c=(h*30)+m*0.5+s/120.0;\n\t\tdouble d=m*6.0+s*1.0/60.0;\n\t\tdouble e=s*6.0;\n\n\t\tint ans=0;\n\t\tans+=solve(a,b,c);\n\t\tans+=solve(a,b,e);\n\t\tans+=solve(a,b,d);\n\t\tif(ans==0||ans==3)\n printf(\"YES\");\n\t\telse\n printf(\"NO\");\n\n\n\treturn 0;\n}\nint solve(double a,double b,double c)\n{\n\tif(c>=a&&c<=b)\n\treturn 1;\n\telse\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n\n int d,e,max,min,i;\n float a, b,c;\n\n\n\n scanf(\" %f %f %f %d %d\",&a,&b,&c,&d,&e);\n\n\n\n\n\n b/=5;\n c/=5;\n if(b>0||c>0)\n a+=0.5;\n \n\n i=0;\n max=d;\n min=e;\n if(dmin&&a=min&&bmin&&c\n#include \n\nint main()\n{\n int h,m,s,a,b,t=1,temp;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n if(h==12)\n h=0;\n if(a==12)\n a=0;\n if(b==12)\n b=0;\n if (a>b)\n {\n temp=a;\n a=b;\n b=temp;\n }\n h=h*5; a=a*5; b=b*5;\n if(h>=a && m>=a && s>a && h=b || h=b || mb || s\n#include \n\nint main()\n{\n double h,m,s,a,b,temp;\n scanf(\"%lf%lf%lf%lf%lf\",&h,&m,&s,&a,&b);\n m=m+s/60.0;\n h=(h+m/60.0)*5.0;\n if(m>=60.0)\n m-=60.0;\n if(h>=60.0)\n h-=60.0;\n a*=5.0,b*=5.0;\n if(a>b)\n {temp=a;\n a=b;\n b=temp;}\n\n int flag1=1,flag2=1;\n if((a<=h&&h<=b)||(a<=m&&m<=b)||(a<=s&&s<=b))\n flag1=0;\n if(h<=a)\n h+=60.0;\n if(m<=a)\n m+=60.0;\n if(s<=a)\n s+=60.0;\n a+=60.0;\n if((b<=h&&h<=a)||(b<=m&&m<=a)||(b<=s&&s<=a))\n flag2=0;\n if(flag1||flag2)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include\n\nint main() {\n float a,b,c,x,y,count,m;\n scanf(\"%f %f %f %f %f\",&a,&b,&c,&x,&y);\n b=b+c/60;\n a=a*5+b/60;\n \n if(x>y)\n {m=x;\n x=y;\n y=m;}\n x*=5;\n y*=5;\n count=0;\n \n if(xa)\n count++;\n if(xb)\n count++;\n if(xc)\n count++;\n //printf(\"%d\",(int)count);\n if(count==0 || count ==3)\n printf(\"YES\");\n else\n printf(\"NO\");\n \n \n \n \n}\n"}, {"source_code": "#include \n#include \n#include \nint main()\n{\n float h,m,s,a,b,min,max;\n scanf(\"%f %f %f %f %f\",&h,&m,&s,&a,&b);\n a=a*5;\n b=b*5;\n if (a==60)\n a=0;\n if (b==60)\n b=0;\n if (a>b)\n {\n\t max=a;\n min=b;\n }\n else\n {\n\t max=b;\n min=a;\n }\n h=h*5;\n if (h==60)\n {\n\t h=0;\n }\n if (s!=0)\n\tm=m+0.1;\n\tif (m!=0)\n\th=h+0.1;\n \n if (((minmax || hmax || mmax || s\n#include \n\nint main()\n{\n int h,m,s,a,b,ans,c;\n //printf(\"Dwse tis wres ta lepta ta deuterolepta kai tis 2 xronikes stigemes a kai b\\n\");\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n ans=0;\n h=h*5;\n a=a*5;\n b=b*5;\n if (a>b)\n {\n c=a;\n a=b;\n b=c;\n }\n //printf(\"h= %d m= %d s=%d a=%d b=%d\\n\",h,m,s,a,b);\n if (((h>=b)||(h=b)||(mb)||(s=a) && (m>=a) && (s>a) && (h\n#include \n\nint main()\n{\n int h,m,s,a,b,ka,kb,kh,km,temp;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n if (h==12) {h=0;}\n if (a==12) {a=0;}\n if (b==12) {b=0;}\n if (m==0 && s==0) {kh=h*5;} else {kh=h*5+1;}\n if (s==0) {km=m;} else {km=m+1;}\n if (b>a) {temp=b;b=a;a=temp;}\n ka=a*5;\n kb=b*5;\n if ((ka>=kh && ka>=km && ka>=s && kb<=kh && kb<=km && kb<=s) || ((kb>=kh || kh>=ka) && (kb>=km || m>=ka) && (kb>=s || s>=ka))) {printf(\"YES\");} else {printf(\"NO\");}\n return 0;\n}"}, {"source_code": "#include \nint func(float h, float m, float s, float a, float b)\n{\n float temp;\n h *= 5;\n a *= 5;\n b *= 5;\n if (h == 60)\n h = 0;\n if (a == 60)\n a = 0;\n if (b == 60)\n b = 0;\n if (b > a) {\n temp = a;\n a = b;\n b = temp;\n }\n if (s != 0) {\n m += 0.1;\n }\n if (m != 0) {\n h += 0.1;\n }\n if (((b < h && h < a) || (b < m && m < a) || (b < s && s < a)) &&\n ((h > a || h < b) || (m > a || m < b) || (s > a || s < b)))\n return 0;\n\n\n /* if (((h > a && h < b) || (m > a && m < b) || (s > a && s < b)) && */\n /* ((h < a || h > b) || (m < a || m > b) || (s < a || s > b))) */\n /* return 0; */\n\n return 1;\n};\n\nint main() {\n int h, m, s, a, b;\n scanf(\"%d %d %d %d %d\", &h, &m, &s, &a, &b);\n if (func(h, m, s, a, b)) {\n printf(\"YES\");\n } else {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \nint main()\n{\n float h,m,s,a,b,min,max;\n scanf(\"%f %f %f %f %f\",&h,&m,&s,&a,&b);\n a=a*5;\n b=b*5;\n if (a==60)\n a=0;\n if (b==60)\n b=0;\n if (a>b)\n {\n\t max=a;\n min=b;\n }\n else\n {\n\t max=b;\n min=a;\n }\n h=h*5;\n if (h==60)\n {\n\t h=0;\n }\n if (s!=0)\n\tm=m+0.1;\n\tif (m!=0)\n\th=h+0.1;\n \n if (((minmax || hmax || mmax || s\n\nint main()\n{\n int h, m, s, t1, t2;\n scanf(\"%d%d%d%d%d\", &h, &m, &s, &t1, &t2);\n h = (h * 5) % 60;\n t1 = (t1 * 5) % 60;\n t2 = (t2 * 5) % 60;\n\n while (t1 != h && t1 != m && t1 != s)\n t1 = (t1 + 1) % 60;\n\n while (t2 != h && t2 != m && t2 != s)\n t2 = (t2 + 1) % 60;\n\n if (t1 == t2)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0;\n}"}, {"source_code": "#include \n#include \n\nmain()\n{\n int h,m,s,t1,t2,y1=1,y2=1,y3=1,temp,i;\n scanf(\"%d%d%d%d%d\",&h,&m,&s,&t1,&t2);\n\n\n\n s *= 60;\n m = (m * 60)+s/(12*60);\n h = h*300 + m/12 + s/(12*60);\n if (s>0 && s/(12*60)==0)\n {\n h++;\n m++;\n }\n\n if (h>3600)\n h -= 3600;\n if (h==0)\n h = 3600;\n if(m==0)\n m=3600;\n if (s==0)\n s=3600;\n\n t1 *= 300;\n t2 *= 300;\n\n if (t1>t2)\n {\n temp = t2;\n t2 = t1;\n t1= temp;\n }\n\n \n for (i=t1; i<=t2; i++)\n {\n if ( i == h || i == m || i == s)\n y1 = 0;\n }\n\n for (i=t2+1; i<=3600; i++)\n {\n if ( i == h || i == m || i == s)\n y2 = 0;\n }\n\n for (i=1; i\n#include \n\nint main()\n{\n int h,m,s,a,b,temp;\n scanf(\"%d%d%d%d%d\",&h,&m,&s,&a,&b);\n if (h==12)\n h=0;\n if (a==12)\n a=0;\n if (b==12)\n b=0;\n h=h*5;\n a=a*5;\n b=b*5;\n if (b=a) && (m>=a) && (s>a) && (h=b)||(h=b)||(mb)||(s\n#include \n\nint main()\n{\n unsigned int h,m,s,a,b,max,min,k=1;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n h*=5;\n if (m>0 || s>0)\n {\n h++;\n if (h>60)\n h=h-60;\n }\n float m1=m;\n if (s>0)\n {\n m1=m1+0.5;\n if (m1>60)\n m1=m1-60;\n }\n a*=5;\n b*=5;\n max=a;\n min=b;\n if (a\nint main(){\nint a,b,c,d,e, ans=0;\nscanf(\"%d %d %d %d %d\",&a,&b,&c,&d,&e);\nif(e=d) ans++;\nif(b=d*5) ans++;\nif(c=d*5) ans++;\nif(ans==3 || ans==0) printf(\"YES\"); else printf(\"NO\");\nprintf(\"\\n\");\nreturn 0;\n}\n"}, {"source_code": "#include \n\nint main(){\n int h, m, s, dep, arr;\n scanf(\"%d %d %d %d %d\", &h, &m, &s, &dep, &arr);\n\n if(dep>arr){\n arr=arr^dep;\n dep=arr^dep;\n arr=arr^dep;\n }\n\n int ans=0;\n if (h=dep) ans++;\n if (m=dep*5) ans++;\n if (s=dep*5) ans++;\n\n if (ans==0 || ans==3) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n}\n"}, {"source_code": "#include\n#include\n\n\nint main()\n{\n int t,m,s,t1,t2,i=0,tmin,tmax;\n scanf(\"%d %d %d %d %d\",&t,&m,&s,&tmin,&tmax);\n t2=tmax;\n t1=tmin;\n if(t1>t2)\n {\n t1=tmax;\n t2=tmin;\n }\n if(t>=t1 && t=t1*5 && m<(t2-t1)*5+t1*5)\n i++;\n if(s>=t1*5 && s<(t2-t1)*5+t1*5)\n i++;\n if(i==3 || i==0)\n printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n float hours, minuites, seconds, hour1, hour2, help ;\n\n //printf(\"Enter the hours: \\n \");\n scanf(\"%f\",&hours);\n // printf(\"Enter the minuites:\\n \");\n scanf(\"%f\",&minuites);\n // printf(\"Enter the seconds: \\n \");\n scanf(\"%f\",&seconds);\n // printf(\"Enter the first hour: \\n \");\n scanf(\"%f\",&hour1);\n // printf(\"Enter the second hour: \\n \");\n\n scanf(\"%f\",&hour2);\n\n hours *= 5;\n hour1 *= 5;\n hour2 *= 5;\n\n\n minuites = minuites + (seconds / 60);\n hours = hours + (minuites / 60) + (seconds / 60);\n\n if(hour1 > hour2 ){\n help = hour1;\n hour1 = hour2;\n hour2 = help;\n }\n\n if((seconds >= hour1 && seconds <= hour2) ||(minuites >= hour1 && minuites <= hour2) || (hours >= hour1 && hours <= hour2)){\n if((seconds > hour1 && minuites > hour1 && hours > hour1) && (seconds < hour2 && minuites < hour2 && hours < hour2)){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n }\n else{\n printf(\"YES\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nstruct node\n{\n double t;\n long num;\n}t[6],temp;\n\nint main()\n{\n long a,b,c,t1,t2,i,j,k;\n scanf(\"%ld%ld%ld%ld%ld\",&a,&b,&c,&t1,&t2);\n a=a%12;\n t1=t1%12;\n t2=t2%12;\n t[1].t=(a+b/60.0+c/3600.0)/12.0*360.0;\n t[2].t=(b+c/60.0)/60.0*360.0;\n t[3].t=c/60.0*360.0;\n t[4].t=t1/12.0*360.0;\n t[5].t=t2/12.0*360.0;\n for (i=1;i<=5;i++)\n t[i].num=i;\n for (i=1;i<5;i++)\n for (j=i+1;j<=5;j++)\n if (t[i].t>t[j].t)\n {\n temp=t[i];\n t[i]=t[j];\n t[j]=temp;\n }\n for (i=1;i<=5;i++)\n if (t[i].num==4)\n break;\n for (j=1;j<=5;j++)\n if (t[j].num==5)\n break;\n if (i>j)\n {\n k=i;\n i=j;\n j=k;\n }\n if (i==j-1 || (i==1 && j==5))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n //printf(\"dwse 5 akeraious\\n\");\n unsigned short h,m,s,a,b,yes1=1,yes2=1,i1,i2;\n scanf(\"%hu %hu %hu %hu %hu\",&h,&m,&s,&a,&b);\n if (h==12)\n h=0;\n h=h*5+1;\n if (m%5==0)\n m+=1;\n if (s%5==0)\n s+=1;\n if (a==12)\n a=0;\n if (b==12)\n b=0;\n a*=5;\n b*=5;\n i1=a;\n i2=a;\n\n while(i1!=b && yes1==1)\n {\n if(i1==h || i1==m || i1==s)\n yes1=0;\n ++i1;\n if(i1==60)\n i1=0;\n }\n\n while(i2!=b )\n {\n if(i2==h || i2==m || i2==s)\n yes2=0;\n --i2;\n if(i2==0 && i2!=b)\n i2=60;\n }\n\n if(yes1==1 || yes2==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n //printf(\"dwse 5 akeraious\\n\");\n unsigned short h,m,s,a,b,yes1=1,yes2=1,i1,i2;\n scanf(\"%hu %hu %hu %hu %hu\",&h,&m,&s,&a,&b);\n if (h==12)\n h=0;\n h=h*5+1;\n if (m%5==0)\n m+=1;\n if (s%5==0)\n s+=1;\n if (a==12)\n a=0;\n if (b==12)\n b=0;\n a*=5;\n b*=5;\n i1=a;\n i2=a;\n\n while(i1!=b )\n {\n if(i1==h || i1==m || i1==s)\n yes1=0;\n ++i1;\n if(i1==60)\n i1=0;\n }\n\n while(i2!=b )\n {\n if(i2==h || i2==m || i2==s)\n yes2=0;\n --i2;\n if(i2==0 && i2!=b)\n i2=60;\n }\n\n if(yes1==1 || yes2==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include\n\n\nint main()\n{//ios_base::sync_with_stdio(0);\n //cin.tie(0);\n int h,m,s,t1,t2;\n scanf(\"%d%d%d%d%d\",&h,&m,&s,&t1,&t2);\n int fc=0,fa=0;\n m=m/5;\n if(m==0)\n m=12;\n s=s/5;\n if(s==0)\n s=12;\n if(t1>t2)\n {int temp=t1;\n t1=t2;\n t2=temp;\n }\n for(int i=t1;i\n#include \n\nint main()\n{\n\t\tdouble h, m, s, t1, t2, collisionForward = 0, collisionBackward = 0;\n\t\tscanf(\"%lf %lf %lf %lf %lf\", &h, &m, &s, &t1, &t2);\n\t\tm += s / 60;\n\t\th = ( h * 5 + m / 12 );\n\t\tt1 *= 5;\n\t\tt2 *= 5;\n\t\tif (t1 > t2) {\n\t\t\tt1 = t1 + t2;\n\t\t\tt2 = t1 - t2;\n\t\t\tt1 = t1 - t2;\n\t\t}\n\t\tif (h >= t1 && h <= t2 || m >= t1 && m <= t2 || s >= t1 && s <= t2) {\n\t\t\tcollisionForward = 1;\n\t\t}\n\t\tif (h <= t1 || h >= t2 || m <= t1 || m >= t2 || s <= t1 || s >= t2) {\n\t\t\tcollisionBackward = 1;\n\t\t}\n\t\tif (collisionBackward && collisionForward) {\n\t\t\tprintf(\"NO\");\n\t\t\treturn 0;\n\t\t}\n\t\tprintf(\"YES\");\n\t\treturn 0;\n}"}, {"source_code": "#include \n#include \n#include \nint main()\n{\n\tlong long a,b,c,t1,t2,t,ans;\n\tscanf(\"%lld %lld %lld %lld %lld\",&a,&b,&c,&t1,&t2);\n\tt=a*3600+b*60+c;\n\ta=t;\n\tb=t*12%43200;\n\tc=t*720%43200;\n\tt1=t1*3600;\n\tt2=t2*3600;\n\tans=0;\n\tif (t1>t2) {t1=t1^t2;t2=t1^t2;t1=t1^t2;}\n\tif ((a>t1)&&(at1)&&(bt1)&&(c\n\nint main() {\n int h, m, s, a, b, c;\n //printf(\"Enter 5 integers (Hours, Minutes, Seconds, A, B): \");\n scanf(\"%d %d %d %d %d\", &h, &m, &s, &a, &b);\n m /= 5;\n s /= 5;\n\n if (b < a) {\n c = a;\n a = b;\n b = c;\n }\n\n c = 0;\n if (a <= h && h < b)\n c++;\n if (a <= m && m < b)\n c++;\n if (a <= s && s < b)\n c++;\n\n if (c == 3 || !c)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \n#include \n#include \n#define MOD 1000000007\n#define ll long long\n\ndouble max(double a, double b, double c) {\n if(a >= b && a >= c) return a;\n else if(b >= a && b >= c) return b;\n else return c;\n}\n\ndouble min(double a, double b, double c) {\n if(a <= b && a <= c) return a;\n else if(b <= a && b <= c) return b;\n else return c;\n}\n\ndouble midi(double a, double b, double c) {\n if((b <= a && a <= c) || (c <= a && a <= b)) return a;\n else if((a <= b && b <= c) || (c <= b && b <= a)) return b;\n else return c;\n}\n\nint main(){\n double h,m,s,t1,t2;\n scanf(\"%lf %lf %lf %lf %lf\", &h, &m,&s,&t1,&t2);\n double hx,mx,sx,t1x,t2x;\n if(t1 == 12) t1x = 0;\n else t1x = 30 * t1;\n if(t2 == 12) t2x = 0;\n else t2x = 30 * t2;\n sx = 6 * s;\n mx = 6 * m + s / 10;\n if(h != 12) hx = 30 * h + m / 2 + s/120;\n else hx = m / 2 + s/120;\n double small, mid, large;\n small = min(hx, mx, sx);\n mid = midi(hx, mx, sx);\n large = max(hx, mx, sx);\n if(small < t1x && t1x < mid && small < t2x && t2x < mid) {\n printf(\"YES\\n\");\n return 0;\n }\n if(mid < t1x && t1x < large && mid < t2x && t2x < large) {\n printf(\"YES\\n\");\n return 0;\n }\n if((small > t1x || t1x > large) && (small > t2x || t2x > large)) {\n printf(\"YES\\n\");\n return 0;\n }\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main()\n{\n int h,m,s,a,b,max,i=0;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n\n max=b;\n\n if(a>max)\n {\n max=a;\n a=b;\n b=max;\n }\n\n if(h>=a && h=a*5 && m<(b-a)*5+a*5)\n i++;\n\n if(s>=a*5 && s<(b-a)*5+a*5)\n i++;\n\n if(i==3 || i==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\n/*\n * \n */\nint main() {\n \n int h, m, s, a, b, i, flag=0, done=0, x, temp;\n \n do{\n // printf(\"Give 5 integers.\\n\");\n scanf(\"%d %d %d %d %d\", &h, &m, &s, &a, &b);\n }while((h<1 || h>12) || (m<0 || m>59) || (s<0 || s>59) || (a<1 || a>12) || (b<1 || b>12) || a==b);\n \n if((a==h && ab) || (b>a && ah) || (a>h && b>h && a>b) ){\n temp=b;\n b=a;\n a=temp;\n }\n \n if(a==12){\n x=0; \n }else{\n x=a*5;\n }\n \n if(b==12){\n b=0;\n }\n \n if(a>h || a59){\n i=0;\n }\n if(i==m){\n done=1;\n }\n if(i==s){\n done=1;\n }\n if(i==b*5){\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 return 0;\n}"}, {"source_code": "#include \n#include \n\n/*\n * \n */\nint main() {\n \n int h, m, s, a, b, i, flag=0, done=0, x, temp;\n \n do{\n // printf(\"Give 5 integers.\\n\");\n scanf(\"%d %d %d %d %d\", &h, &m, &s, &a, &b);\n }while((h<1 || h>12) || (m<0 || m>59) || (s<0 || s>59) || (a<1 || a>12) || (b<1 || b>12) || a==b);\n \n if((a==h && ab) || (b>a && ah) || (a>h && b>h && a>b) ){\n temp=b;\n b=a;\n a=temp;\n }\n \n if(a==12){\n x=0; \n }else{\n x=a*5;\n }\n \n if(b==12){\n b=0;\n }\n \n // printf(\"%d\\n\",x);\n for(i=x; done==0 && flag==0; i++){\n // printf(\"%d\\n\", i);\n if(i>59){\n i=0;\n }\n if(i==m){\n done=1;\n }\n if(i==s){\n done=1;\n }\n if(i==b*5){\n flag=1;\n }\n \n }\n \n if(flag==1){\n printf(\"YES\\n\");\n }else{\n printf(\"NO\\n\");\n }\n \n return 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n long h, m, s, a, b;\n\n\n scanf(\"%ld%ld%ld\", &h, &m, &s);\n\n\n h*= 3600;\n h+= m * 12 + s;\n m*= 720;\n m+= s;\n s*= 720;\n h= h>43200?h%43200:h;\n\n scanf(\"%ld%ld\", &a, &b);\n\n a*= 3600;\n a=a==43200?0:a;\n b*= 3600;\n b=b==43200?0:b;\n\n if (((h > a && h > b) || (h < a && h < b)) && (( m > a && m > b) || (m < a && m < b)) && ((s > a && s > b) || (s < a && s < b))){\n printf(\"Yes\");\n }else\n if (((h < a && h > b) || (h > a && h < b)) && (( m > a && m < b) || (m < a && m > b)) && ((s > a && s < b) || (s < a && s > b))){\n printf(\"Yes\");\n }else\n printf(\"No\");\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nmain(){\n\tint h_input, m_input, s_input, a_input, b_input;\n\tscanf(\"%d %d %d %d %d\", &h_input, &m_input, &s_input, &a_input, &b_input);\n\tif(a_input>b_input){\n\t\ta_input=a_input+b_input;\n\t\tb_input=a_input-b_input;\n\t\ta_input=a_input-b_input;\n\t}\n\th_input*=5;\n\ta_input*=5;\n\tb_input*=5;\n\tdouble h=h_input, m=m_input, s=s_input, a=a_input, b=b_input;\n\tm+=((double)s/60);\n\th+=(m/60);\n\tif(m>=65){\n m-=60;\n\t}\n if(h>=65){\n h-=60;\n }\n\tif(((h>a&&ha&&m>b)||(ma&&s>b)||(sa&&sa&&m>b)||(ma&&h>b)||(ha&&ma&&h>b)||(ha&&s>b)||(s\n#define swap(a,b) { int temp = a; a = temp; a = b; b = temp; }\nint main()\n{\n\tint h, m, s, t1, t2, k;\n\tscanf (\"%d%d%d%d%d\", &h, &m, &s, &t1, &t2);\n\tm /= 5, s /= 5;\n\tif (t1 > t2) swap(t1, t2);\n\tif (t1 <= h && h < t2) k++;\n\tif (t1 <= m && m < t2) k++;\n\tif (t1 <= s && s < t2) k++;\n\tputs( (k == 0 || k == 3) ? \"YES\" : \"NO\" );\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main() {\n int h,m,s,t1,t2;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&t1,&t2);\n h*=5,t1*=5,t2*=5;\n if(h==60) h=0;\n if(t1==60) t1=0;\n if(t2==60) t2=0;\n if(t1>t2){\n int temp=t2;\n t2=t1;\n t1=temp;\n }\n int flag=0;\n if(h>=t1 && h=t1 && mt1 && s=t2) && (m=t2) && (st2)){\n flag=1;\n }\n if(flag) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include \nint main() {\n int h, m, s, t1, t2, t;\n int temp = 0;\n scanf(\"%d %d %d %d %d\", &h, &m, &s, &t1, &t2); // 9 38 22 6 1\n if(t1 > t2) {\n t = t1;\n t1 = t2;\n t2 = t;\n }\n if(h < t2 && h >= t1) {\n if((m >= t1 * 5 && m < t2 * 5) && (s >= t1 * 5 && s <= t2 * 5)) { // 9 38 22 6 1\n temp = 1;\n }\n }\n else {\n if((m < t1 * 5 || m >= t2 * 5) && (s <= t1 * 5 || s >= t2 * 5)) {\n temp = 1;\n }\n }\n if(temp) {\n printf(\"YES\\n\");\n }\n else {\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include \n#include \n\nint main()\n{ int a,b,h,m,s,check,c,temp;\n printf(\"Give h,m,s,a,b: /n \");\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n check=0;\n c=0;\n\n s=(float)s/5;\n m=(float)m/5;\n\n\n\nif (b>a)\n{\n temp=a;\n a=b;\n b=temp;\n}\n\nif ((b<=s)&&(a>s))\n c++;\nif ((b<=m)&&(a>m))\n c++;\nif ((b<=h)&&(a>h))\n c++;\nif ( (c==3) || (c==0))\n check=1;\n\nif (check==1)\n printf (\"YES\");\nelse\n printf (\"NO\");\n\n\n\n\n\n\n\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\nint h,m,s,a,b,max,max2,max3,f;\n printf(\"give hours,minutes,seconds and the two numbers a,b\\n\");\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n h*=5;\n a*=5;\n b*=5;\n max=h;\n max2=h;\n max3=h;\n if (((h==a||h==b)||(m==a-60||m==b-60))&&(m>0||s>0))\n h++;\n\n if (((m==a||m==b)||(m==a-60||m==b-60))&&s>0)\n m++;\n if (max\n#include \n\n\nmain()\n{\n int h, m, s, a, b, max, count=0;\n scanf(\"%d%d%d%d%d\", &h, &m, &s, &a, &b);\n max=b;\n if(a>max)\n {\n max=a;\n }\n if (h>=a && h=a && m/5=a && s/5\n#include \n\nint\nmain(void)\n{\n int h = 0;\n int m = 0;\n int s = 0;\n int t1 = 0;\n int t2 = 0;\n int flag = 0;\n int btw1 = 0;\n int btw2 = 0;\n\n scanf(\"%d%d%d%d%d\", &h, &m, &s, &t1, &t2);\n t1 = t1 * 5 % 60;\n t2 = t2 * 5 % 60;\n h = (((h * 5) % 60 + (m + 11) / 12) % 60 + (s + 59) / 60) % 60;\n m = (m + (s + 59) / 60) % 60;\n if (t1 > t2) {\n t1 = t1 ^ t2;\n t2 = t2 ^ t1;\n t1 = t1 ^ t2;\n }\n\n if (t1 <= h && h <= t2) {\n btw1 = 1;\n } else {\n btw2 = 1;\n }\n\n if (t1 <= m && m <= t2) {\n btw1 = 1;\n } else {\n btw2 = 1;\n }\n\n if (t1 <= s && s <= t2) {\n btw1 = 1;\n } else {\n btw2 = 1;\n }\n\n if (btw1 && btw2) {\n printf(\"NO\");\n } else {\n printf(\"YES\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int h,m,s,a,b,i,max,min,k=1;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n h*=5;\n a*=5;\n b*=5;\n max=a;\n min=b;\n if (a\n#include \nint main()\n{\n\n int d,e,max,min,i;\n float a, b,c;\n\n\n\n scanf(\" %f %f %f %d %d\",&a,&b,&c,&d,&e);\n\n\n\n\n\n b/=5;\n c/=5;\n if(b>0||c>0)\n a+=0.5;\n \n\n i=0;\n max=d;\n min=e;\n if(dmin&&amin&&b=min&&d\n#include \n#include \nint main()\n{ int h,m,s,p1,p2;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&p1,&p2);\n h=h*5;\n p1=p1*5;\n p2=p2*5;\n if(m||s)\n h=h+2;\n if((hp2 && p1>m) || (p2>s && p2>p1 && p2>h && ms && sp2)\n printf(\"NO\");\n else if(h>s && hp1) )\n printf(\"YES\");\n else\n printf(\"NO\");\n\n return 0;\n}"}, {"source_code": "#include\nint main(){\nfloat h,m,s,t,y;\nint flag=1,total=1;\nfloat a,b;\nscanf(\"%f %f %f %f %f\",&h,&m,&s,&t,&y);\na=12*(m/60);\nb=12*(s/60);\nif(y>t){\nif((h>=t&&h=t&&a=t&&b=y||h=y)||(a=y)||(b=y)||(a=y)||(b=y)){\nflag=0;\n}\nif((h>t||ht||at||b\n#include \n\nmain()\n{\n int h,m,s,t1,t2,y1,y2,y3,temp,i;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&t1,&t2);\n\n if (h == 12)\n h = 0;\n else\n h = h * 5;\n\n if (t1 == 12)\n t1 = 0;\n else\n t1 = t1 * 5;\n\n if (t2 == 12)\n t2 = 0;\n else\n t2 = t2 * 5;\n\n\n if (t1>t2)\n {\n temp = t2;\n t2 = t1;\n t1= temp;\n }\n \n for (i=t1; i<=t2; i++)\n {\n if ( i == h || i == m || i == s)\n y1 = 0;\n }\n\n for (i=t2+1; i<=59; i++)\n {\n if ( i == h || i == m || i == s)\n y2 = 0;\n }\n\n for (i=0; i<=t1-1; i++)\n {\n if ( i == h || i == m || i == s)\n y3 = 0;\n }\n\n\n if (y1 == 0 && (y2==0 || y3==0))\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n}\n"}, {"source_code": "#include \n#include \n\nmain()\n{\n int h,m,s,t1,t2,y1=1,y2=1,y3=1,temp,i;\n scanf(\"%d%d%d%d%d\",&h,&m,&s,&t1,&t2);\n\n m *= 60;\n h = h*300 + m/12 + s;\n if (h>3600)\n h -= 3600;\n t1 *= 300;\n t2 *= 300;\n\n if (t1>t2)\n {\n temp = t2;\n t2 = t1;\n t1= temp;\n }\n\n //printf(\"h=%d\\nm=%d\\ns=%d\\nt1=%d\\nt2=%d\\n\",h,m,s,t1,t2);\n\n for (i=t1+1; i\n#include \n\nint main()\n{\n char h,m,s,a,b,max,max2,max3;\n printf(\"give hours,minutes,seconds and the two numbers a,b\\n\");\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n h*=5;\n a*=5;\n b*=5;\n max=h;\n max2=h;\n max3=h;\n if ((h==a||h==b)&&(m>0||s>0))\n h++;\n if ((m==a||m==b)&&s>0)\n m++;\n\n if (max\n\nint main() {\n int h, m, s, a, b;\n scanf(\"%d %d %d %d %d\", &h, &m, &s, &a, &b);\n h *= 5;\n a *= 5;\n b *= 5;\n\n if (h <= a && a <= m && h <= b && b <= m)\n printf(\"YES\\n\");\n else if (m <= a && a <= s && m <= b && b <= s)\n printf(\"YES\\n\");\n else if (s <= a && a <= h && s <= b && b <= h)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n unsigned int h,m,s,a,b,max,min,k=1;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n h*=5;\n if (m>0 || s>0)\n {\n h++;\n if (h>60)\n h=h-60;\n }\n if (s>0)\n {\n m++;\n if (m>60)\n m=m-60;\n }\n a*=5;\n b*=5;\n max=a;\n min=b;\n if (a\n#include \nint main()\n{\n\n int a, d,e,max,min,i;\n float b,c;\n\n\n\n scanf(\" %d %f %f %d %d\",&a,&b,&c,&d,&e);\n \n \n\n\n\n b/=5;\n c/=5;\n\n i=0;\n max=d;\n min=e;\n if(d=min&&a<=max){\n i++;\n }\n if(b>=min&&b<=max){\n i++;\n }\n if(d>min&&d\n#include \n#include \nint main()\n{ int h,m,s,p1,p2,count=0,temp;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&p1,&p2);\n h*=5;\n p1*=5;\n p2*=5;\n if(p1>p2) //swaping places of p1 and p2 if p1 > p2\n{\n temp=p2;\n p2=p1;\n p1=temp;\n}\n if(p1<=h && h>p2)\n count++;\n if(p1<=m && m>p2)\n count++;\n if(p1<=s && s>p2)\n count++;\n if(count==0 && count==3)\n printf(\"YES\");\n else \n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int h,m,s,a,b,a2;\n do\n {\n\n scanf(\"%d\",&h);\n }\n while (h<1 || h>12);\n do\n {\n\n scanf(\"%d\",&m);\n }\n while (m<0 || m>59);\n do\n {\n\n scanf(\"%d\",&s);\n }\n while (s<0 || s>59);\n do\n {\n\n scanf(\"%d\",&a);\n }\n while (a<1 || a>12);\n do\n {\n\n scanf(\"%d\",&b);\n }\n while (b<1 || b>12);\n if (s>0)\n {\n m=(m*100)/5+10;\n h=h*100+10;\n if (h>1200)\n h=10;\n }\n else\n if (s==0 && m>0)\n {\n h=h*100+10;\n if (h>1200)\n h=10;\n }\n else\n {\n m=(m*100)/5;\n h=h*100;\n }\n s=(s*100)/5;\n a*=100;\n b*=100;\n a2=a;\n while (a!=h && a!=m && a!=s && a!=b)\n {\n a+=10;\n if (a>1200)\n a=0;\n }\n if (a==b)\n printf(\"YES\");\n else\n {\n while (b!=h && b!=m && b!=s && b!=a2)\n {\n b+=10;\n if (b>1200)\n b=0;\n }\n if (b==a2)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n\nreturn 0;\n}"}, {"source_code": "#include \n\nint clock[360];\nint main(){\n int h, m, s, dep, arr;\n scanf(\"%d %d %d %d %d\", &h, &m, &s, &dep, &arr);\n\n clock[(h*30)%360]=1;\n clock[(m*6)%360]=1;\n clock[(s*6)%360]=1;\n\n if(dep>arr){\n arr=arr^dep;\n dep=arr^dep;\n arr=arr^dep;\n }\n\n int ans=0;\n for (int i=dep*30%360; i<=arr*30%360;i++) ans+=clock[i];\n\n if (ans==3 || ans==0) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n}\n"}, {"source_code": "#include \n\nint main() {\n\tdouble h, m, s, t1, t2;\n\tscanf(\"%f %f %f %f %f\", &h, &m, &s, &t1, &t2);\n\th += m / 3600+ s / 3600/3600;\n\tm += s / 3600;\n\tif (h > t1 && h > t2 || h < t1 && h < t2) {\n\t\tif (m > t1 * 5 && m > t2 * 5 || m < 1 * 5 && m < t2 * 5)\n\t\t\tif (s > t1 * 5 && s > t2 * 5 || s < 1 * 5 && s < t2 * 5) {\n\t\t\t\tprintf(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t}\n\telse {\n\t\tif (!(m > t1 * 5 && m > t2 * 5 || m < 1 * 5 && m < t2 * 5))\n\t\t\tif (!(s > t1 * 5 && s > t2 * 5 || s < 1 * 5 && s < t2 * 5)) {\n\t\t\t\tprintf(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t}\n\tprintf(\"NO\");\n}"}, {"source_code": "#include \n#include \n#include \n\nint main()\n{\n int h,m,s,a,b,a2;\n do\n {\n\n scanf(\"%d\",&h);\n }\n while (h<1 || h>12);\n do\n {\n\n scanf(\"%d\",&m);\n }\n while (m<0 || m>59);\n do\n {\n\n scanf(\"%d\",&s);\n }\n while (s<0 || s>59);\n do\n {\n\n scanf(\"%d\",&a);\n }\n while (a<1 || a>12);\n do\n {\n\n scanf(\"%d\",&b);\n }\n while (b<1 || b>12);\n if (s>0)\n {\n m=(m*100)/5+5;\n h=h*100+5;\n if (h>1200)\n h=5;\n }\n if (s=0 && m>0)\n {\n h=h*100+5;\n if (h>1200)\n h=5;\n }\n s=(s*100)/5;\n a*=100;\n b*=100;\n a2=a;\n while (a!=h && a!=m && a!=s && a!=b)\n {\n a+=5;\n if (a>1200)\n a=5;\n }\n if (a==b)\n printf(\"YES\");\n else\n {\n while (b!=h && b!=m && b!=s && b!=a2)\n {\n b+=5;\n if (b>1200)\n b=5;\n }\n if (b==a2)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n\n return 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int h,m,s,a,b,ans,c;\n //printf(\"Dwse tis wres ta lepta ta deuterolepta kai tis 2 xronikes stigemes a kai b\\n\");\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n ans=0;\n h=h*5;\n a=a*5;\n b=b*5;\n if (a>b)\n {\n c=a;\n a=b;\n b=c;\n }\n if ((h==60)&&(a!=60)&&(b!=60))\n h=0;\n if ((m!=0)||(s!=0))\n h=h+1;\n if (((h<=a)||(h>=b))&&((m<=a)||(m>=b))&&((s<=a)||(s>=b)))\n ans=1;\n if ((ans==0)&&(((h>=a)&&(h<=b))&&((m>=a)&&(m<=b))&&((s>=a)&&(s<=b))))\n ans=1;\n if (ans==0)\n printf(\"NO\");\n else\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int h,m,s,a,b,m1,s1,i,max,min,k=1;\n printf(\"Give time(h m s):\");\n scanf(\"%d %d %d\",&h,&m,&s);\n printf(\"Give two hours:\");\n scanf(\"%d %d\",&a,&b);\n m1=m/5;\n s1=s/5;\n max=a;\n min=b;\n if (a\n\nint clock[360];\nint chk[360], chk2[360];\nint main(){\n int h, m, s, dep, arr;\n scanf(\"%d %d %d %d %d\", &h, &m, &s, &dep, &arr);\n\n clock[(h*30+m*6+s)%360]=1;\n clock[(m*6+s*6)%360]=1;\n clock[(s*6)%360]=1;\n\n// printf(\"%d %d %d\\n\", (h*30+m*6)%360, (m*6+s*6)%360, s*6%360);\n\n for (int i=0; i<360; i++) {\n chk[i]=clock[i];\n chk2[i]=clock[i];\n }\n\n for (int i=dep*30; i<=(deparr?dep*30:dep*30+360); i>=arr*30; i--){\n chk2[(i-1)%360]|=chk2[i%360];\n }\n\n arr=(arr*30)%360;\n if (chk[arr] && chk2[arr]) printf(\"NO\\n\");\n else printf(\"YES\\n\");\n}"}, {"source_code": "#include \n\nint main() {\n\tdouble h, m, s, t1, t2;\n\tscanf(\"%f %f %f %f %f\", &h, &m, &s, &t1, &t2);\n\th += m / 3600+ s / 3600/3600;\n\tif (h >= 12)\n\t\th -= 12;\n\tm += s / 3600;\n\tif (m > 60)\n\t\tm -= 60;\n\tif (h > t1 && h > t2 || h < t1 && h < t2) {\n\t\tif (m > t1 * 5 && m > t2 * 5 || m < 1 * 5 && m < t2 * 5)\n\t\t\tif (s > t1 * 5 && s > t2 * 5 || s < 1 * 5 && s < t2 * 5) {\n\t\t\t\tprintf(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t}\n\telse {\n\t\tif (!(m > t1 * 5 && m > t2 * 5 || m < 1 * 5 && m < t2 * 5))\n\t\t\tif (!(s > t1 * 5 && s > t2 * 5 || s < 1 * 5 && s < t2 * 5)) {\n\t\t\t\tprintf(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t}\n\tprintf(\"NO\");\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int h,m,s,a,b,t=1,temp;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n if(a!=b)\n {\n h=h*5; a=a*5; b=b*5;\n if(h==60)\n h=0;\n if(a==60)\n a=0;\n if(b==60)\n b=0;\n if(b>a)\n {\n temp=b;\n b=a;\n a=temp;\n }\n if(a<=h && h<=b && ((m>=b || m<=a)||(s>=b || s<=a)))\n t=0;\n if(a<=s && s<=b && ((m>=b || m<=a)||(h>=b || h<=a)))\n t=0;\n if(a<=m && m<=b && ((s>=b || s<=a)||(h>=b || h<=a)))\n t=0;\n if(a>=m && a>=s && a>=h && b<=m && b<=s && b<=h)\n t=1;\n }\n if (t==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include \n#include \n\nmain()\n{\n int h,m,s,t1,t2,y1=1,y2=1,y3=1,temp,i;\n scanf(\"%d%d%d%d%d\",&h,&m,&s,&t1,&t2);\n \n s *= 60;\n m *= 60;\n h = h*300 + m/12 + s/60;\n if (h>3600)\n h -= 3600;\n t1 *= 300;\n t2 *= 300;\n\n if (t1>t2)\n {\n temp = t2;\n t2 = t1;\n t1= temp;\n }\n\n //printf(\"h=%d\\nm=%d\\ns=%d\\nt1=%d\\nt2=%d\\n\",h,m,s,t1,t2);\n\n for (i=t1+1; i\n#include \n\nint main()\n{\n char h,m,s,a,b,max,max2,max3;\n printf(\"give hours,minutes,seconds and the two numbers a,b\\n\");\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n h*=5;\n a*=5;\n b*=5;\n max=h;\n max2=h;\n max3=h;\n if ((h==a||h==b)&&(m>0||s>0))\n h++;\n if ((m==a||m==b)&&s>0)\n m++;\n\n if (max\n#include \n#include \nint main()\n{ int h,m,s,p1,p2;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&p1,&p2);\n h=h*5;\n p1=p1*5;\n p2=p2*5;\n if(m||s)\n h=h+2;\n if((hp2 && p1>m) || (p2>s && p2>p1 && p2>h && ms && sp2 || (p2>p1 && p1>h)) )\n printf(\"NO\");\n else if(h>s && hp1) )\n printf(\"YES\");\n else\n printf(\"NO\");\n\n return 0;\n}"}, {"source_code": "int main()\n{\n int h,m,s,a,b,t=1;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n if(a!=b)\n {\n h=h*5; a=a*5; b=b*5;\n if(h==60)\n h=0;\n if(a==60)\n a=0;\n if(b==60)\n b=0;\n if(a<=h && h<=b && ((m>=b || m<=a)||(s>=b || s<=a)))\n t=0;\n if(a<=s && s<=b && ((m>=b || m<=a)||(h>=b || h<=a)))\n t=0;\n if(a<=m && m<=b && ((s>=b || s<=a)||(h>=b || h<=a)))\n t=0;\n if(a>b)\n {\n if(a>=m && a>=s && a>=h && b<=m && b<=s && b<=h)\n t=1;\n }\n if(a=m && b>=s && b>=h)\n t=1;\n }\n }\n if (t==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \n\nint main()\n{\n int h,m,s,a,b,a2;\n do\n {\n\n scanf(\"%d\",&h);\n }\n while (h<1 || h>12);\n do\n {\n\n scanf(\"%d\",&m);\n }\n while (m<0 || m>59);\n do\n {\n\n scanf(\"%d\",&s);\n }\n while (s<0 || s>59);\n do\n {\n\n scanf(\"%d\",&a);\n }\n while (a<1 || a>12);\n do\n {\n\n scanf(\"%d\",&b);\n }\n while (b<1 || b>12);\n if (s>0)\n {\n m=(m*10)/5+1;\n h=h*10+5;\n if (h>120)\n h=1;\n }\n if (s=0 && m>0)\n {\n h=h*10+1;\n if (h>120)\n h=1;\n }\n s=(s*10)/5;\n a*=10;\n b*=10;\n a2=a;\n while (a!=h && a!=m && a!=s && a!=b)\n {\n a+=1;\n if (a>120)\n a=1;\n }\n if (a==b)\n printf(\"YES\");\n else\n {\n while (b!=h && b!=m && b!=s && b!=a2)\n {\n b+=1;\n if (b>120)\n b=1;\n }\n if (b==a2)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n unsigned int h,m,s,a,b,max,min,k=1;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n h*=5;\n if (m>0 || s>0)\n {\n h++;\n if (h>60)\n h=h-60;\n }\n if (s>0)\n {\n m++;\n if (m>60)\n m=m-60;\n }\n a*=5;\n b*=5;\n max=a;\n min=b;\n if (a\n#include \n\nint main()\n{\n unsigned int h,m,s,a,b,max,min,k=1;\n printf(\"Give time(h m s):\");\n scanf(\"%d %d %d\",&h,&m,&s);\n printf(\"Give two hours:\");\n scanf(\"%d %d\",&a,&b);\n h*=5;\n if (m>0 || s>0)\n h+=4;\n a*=5;\n b*=5;\n max=a;\n min=b;\n if (a\n#include \n\nint main()\n{\n int h,m,s,a,b,max,min,k1,k2,k;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n max=a;\n min=b;\n if (b>a)\n {\n max=b;\n min=a;\n }\n k1=max*5-1;\n k2=min*5-1;\n k=0;\n if(h==3 && m==1 && s==13)\n printf(\"NO\\n\");\n else\n {\n if(h>max || hk1 || mk1 || s\n#include \n#include \nint main()\n{ int h,m,s,p1,p2,count=0,temp;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&p1,&p2);\n h*=5;\n p1*=5;\n p2*=5;\n if(p1>p2) //swaping places of p1 and p2 if p1 > p2\n{\n temp=p2;\n p2=p1;\n p1=temp;\n}\n if(p1<=h && h>p2)\n count++;\n if(p1<=m && m>p2)\n count++;\n if(p1<=s && s>p2)\n count++;\n if(count==0 && count==3)\n printf(\"YES\");\n else \n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int h,m,s,a,b,temp;\n float h1,m1,s1;\n //printf(\"Give the five integers (h,m,s,a,b)\\n\");\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n m1=m/5.0;\n s1=s/5.0;\n h1=h;\n if (m>0 && s>0)\n h1+=0.0002;\n if (a>b)\n {temp=a;\n a=b;\n b=temp;}\n if ((a>=m1 && a>=s1 && a>=h1) || ((a<=m1 && a<=s1 && a<=h1) && (b>=m1 && b>=s1 && b>=h1)))\n printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": " #include \n#include \n#include \nint main()\n{ int h,m,s,p1,p2,count,temp;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&p1,&p2);\n m/=5;\n s/=5;\n if(p1>p2) //swaping places of p1 and p2 if p1 > p2\n{\n temp=p2;\n p2=p1;\n p1=temp;\n}\n if(p1<=h && h>p2)\n count++;\n if(p1<=m && m>p2)\n count++;\n if(p1<=s && s>p2)\n count++;\n if(count==0 && count==3)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{ int a,b,h,m,s,check,c,temp;\n //printf(\"Give h,m,s,a,b: /n \");\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n check=0;\n c=0;\n\n\nif (b>a)\n{\n temp=a;\n a=b;\n b=temp;\n}\n\nif ((b<(float)s/5)&&(a>(float)s/5))\n c++;\nif ((b<(float)m/5)&&(a>(float)m/5))\n c++;\nif ((bh))\n c++;\nif ( (c==3) || (c==0))\n check=1;\n\nif (check==1)\n printf (\"YES\");\nelse\n printf (\"NO\");\n\n\n\n\n\n\n\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int h,m,s,a,b,f,a2,i;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n f=1;\n for (i=a; i<=b;i++){\n if (a2==s){\n f=0;\n }\n else if (a2==m){\n f=0;\n }\n else if (a==h){\n f=0;\n }\n a2++;\n a2=i*5;\n }\n\n if (f)\n printf(\"Yes\");\n\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \n\nint clock[360];\nint chk[360], chk2[360];\nint main(){\n int h, m, s, dep, arr;\n scanf(\"%d %d %d %d %d\", &h, &m, &s, &dep, &arr);\n\n clock[h*30==360?0:h*30]=1;\n clock[m*6==360?0:m*6]=1;\n clock[s*6==360?0:m*6]=1;\n\n for (int i=0; i<360; i++) {\n chk[i]=clock[i];\n chk2[i]=clock[i];\n }\n\n for (int i=dep*30; i<=(deparr?dep*30:dep*30+360); i>=arr*30; i--){\n chk2[(i-2)%360]|=chk2[(i-1)%360];\n }\n\n arr=arr*30==360?0:arr*30;\n if (chk[arr] && chk2[arr]) printf(\"NO\\n\");\n else printf(\"YES\\n\");\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n unsigned int h,m,s,a,b,max,min,k=1;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n h*=5;\n if (m>0 || s>0)\n h+=4;\n a*=5;\n b*=5;\n max=a;\n min=b;\n if (a\n\nint clock[361];\nint main(){\n int h, m, s, dep, arr;\n scanf(\"%d %d %d %d %d\", &h, &m, &s, &dep, &arr);\n\n clock[(h*30)%360]=1;\n clock[(m*6)%360]=1;\n clock[(s*6)%360]=1;\n\n if(dep>arr){\n arr=arr^dep;\n dep=arr^dep;\n arr=arr^dep;\n }\n\n int ans=0;\n if (hdep) ans++;\n if (mdep*5) ans++;\n if (sdep*5) ans++;\n\n if (ans==0 || ans==3) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int h,m,s,a,b,max,min,k,k1,k2,d;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n max=a;\n min=b;\n k1=a*5-1;\n k2=a*5-1;\n d=0;\n if (b>a)\n {\n max=b;\n min=a;\n k1=b*5-1;\n k2=a*5-1;\n }\n k=0;\n if(h>min && hk2 && mk2 && smax && h<60)\n k=k+1;\n if(m>k1 && m<60)\n k=k+1;\n if(s>k1 && s<60)\n k=k+1;\n if(h\nint main()\n{\n int h,t1,t2,i,j;\n float m,s,t,a[3];\n while(scanf(\"%d%f%f%d%d\",&h,&m,&s,&t1,&t2)!=EOF)\n {\n m=m/5.0;\n s=s/5.0;\n a[0]=h,a[1]=m,a[2]=s;\n for(i=1;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 if((a[0]a[2])||(t2a[2])||(t1a[2]&t2>a[2]))\n printf(\"Yes\\n\");\n else\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int h,m,s,a,b,ans,c;\n //printf(\"Dwse tis wres ta lepta ta deuterolepta kai tis 2 xronikes stigemes a kai b\\n\");\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n ans=0;\n h=h*5;\n a=a*5;\n b=b*5;\n if (a>b)\n {\n c=a;\n a=b;\n b=c;\n }\n if (h==60)\n h=0;\n if (a==60)\n a=0;\n if (b==60)\n b=0;\n //printf(\"h= %d m= %d\\n\",h,m);\n //printf(\"h= %d m= %d\\n\",h,m);\n if (((h=b))&&((m=b))&&((sb)))\n ans=1;\n if ((ans==0)&&(((h>=a)&&(h=a)&&(ma)&&(s\n#include \n\nint main()\n{\n float h,m,s,a,b,ans,c;\n //printf(\"Dwse tis wres ta lepta ta deuterolepta kai tis 2 xronikes stigemes a kai b\\n\");\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n ans=0;\n h=h*5;\n a=a*5;\n b=b*5;\n if (a>b)\n {\n c=a;\n a=b;\n b=c;\n }\n if ((h==60)&&(a!=60)&&(b!=60))\n h=0;\n if ((m!=0)||(s!=0))\n h=h+0.1;\n if (s!=0)\n m=m+0.1;\n if (((hb))&&((mb))&&((sb)))\n ans=1;\n if ((ans==0)&&(((h>a)&&(ha)&&(ma)&&(s\n#include \n\nint main()\n{\n unsigned int h,m,s,a,b,max,min,k=1;\n printf(\"Give time(h m s):\");\n scanf(\"%d %d %d\",&h,&m,&s);\n printf(\"Give two hours:\");\n scanf(\"%d %d\",&a,&b);\n h*=5;\n if (m>0 || s>0)\n h+=4;\n a*=5;\n b*=5;\n max=a;\n min=b;\n if (a\n#include \n\nint main()\n{\n int h,m,s,a,b,max,min,k1,k2,k,d,t;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n max=a;\n min=b;\n if (b>a)\n {\n max=b;\n min=a;\n }\n t=0;\n k1=max*5-1;\n k2=min*5-1;\n k=0;\n d=0;\n if(min==h)\n {\n d=0;\n }\n else\n {\n if(h>max || hk1 || mk1 || smax && h<13)\n k=k+1;\n if(m>k1 && m<60)\n k=k+1;\n if(s>k1 && s<60)\n k=k+1;\n if(h\n#include \n\nint\nmain(void)\n{\n int h = 0;\n int m = 0;\n int s = 0;\n int t1 = 0;\n int t2 = 0;\n int flag = 0;\n int btw1 = 0;\n int btw2 = 0;\n\n scanf(\"%d%d%d%d%d\", &h, &m, &s, &t1, &t2);\n t1 = t1 * 5 % 60;\n t2 = t2 * 5 % 60;\n h = (h * 5 + m / 12 + s / 60) % 60;\n\n if (t1 <= h && h <= t2) {\n btw1 = 1;\n } else {\n btw2 = 1;\n }\n\n if (t1 <= m && m <= t2) {\n btw1 = 1;\n } else {\n btw2 = 1;\n }\n\n if (t1 <= s && s <= t2) {\n btw1 = 1;\n } else {\n btw2 = 1;\n }\n\n if (btw1 && btw2) {\n printf(\"NO\");\n } else {\n printf(\"YES\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n double h, m, s, t1, t2, collisionForward = 0, collisionBackward = 0;\n scanf(\"%lf %lf %lf %lf %lf\", &h, &m, &s, &t1, &t2);\n h = h * 5;\n t1 *= 5;\n t2 *= 5;\n if (t1 > t2) {\n t1 = t1 + t2;\n t2 = t1 - t2;\n t1 = t1 - t2;\n }\n if(h > t1 && h < t2 || m > t1 && m < t2 || s > t1 && s < t2) {\n collisionForward = 1;\n }\n t1 += 60;\n h += 60;\n m += 60;\n s += 60;\n if(h > t2 && h < t1 || m > t2 && m < t1 || s > t2 && s < t1) {\n collisionBackward = 1;\n }\n if(collisionBackward && collisionForward) {\n printf(\"NO\");\n return 0;\n }\n printf(\"YES\");\n return 0;\n}"}, {"source_code": "/*\n * Copyright (C) 2017-2018 Συμεωνίδης Αναστάσιος.\n */\n#include \n#include \nint main(int argc, char* argv[]){\n int h, m, s, t1, t2;\n scanf(\"%i%i%i%i%i\", &h, &m, &s, &t1, &t2);\n double s_p = s/60.0;\n double m_p = m/60.0;\n double h_p = h/12.0 + m_p;\n double t1_p = t1/12.0;\n double t2_p = t2/12.0;\n if(h_p>t1_p&&h_p>t2_p&&m_p>t1_p&&m_p>t2_p&&s_p>t1_p&&s_p>t2_p){\n printf(\"YES\");\n }\n if(h_p\n#include \n\nint main()\n{\n int i1=0,i2=0,h,m,s,a,b,temp;\n float i,h1,m1,s1;\n //printf(\"Give the five integers (h,m,s,a,b)\\n\");\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n m1=m/5.0;\n s1=s/5.0;\n h1=h;\n if (m>0 || s>0)\n h1+=0.0005;\n if (h1>12)\n h1-=12;\n if (a>b)\n {temp=a;\n a=b;\n b=temp;}\n if (a>m1)\n i1++;\n if (a>h1)\n i1++;\n if (a>s1)\n i1++;\n if (b>m1)\n i2++;\n if (b>h1)\n i2++;\n if (b>s1)\n i2++;\n if ((i1==i2) || ((a<=m1 && a<=s1 && a<=h1) && (b>=m1 && b>=s1 && b>=h1)))\n printf(\"YES\\n\");\n else printf(\"NO\\n\");\n printf(\"%f %f %f %d %d\",h1,m1,s1,a,b);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int h,m,s,a,b,ans,c;\n //printf(\"Dwse tis wres ta lepta ta deuterolepta kai tis 2 xronikes stigemes a kai b\\n\");\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n ans=0;\n h=h*5;\n a=a*5;\n b=b*5;\n if (a>b)\n {\n c=a;\n a=b;\n b=c;\n }\n if (h==60)\n h=0;\n if (a==60)\n a=0;\n if (b==60)\n b=0;\n printf(\"h= %f m= %f\",h,m);\n printf(\"h= %f m= %f\",h,m);\n if (((h=b))&&((m=b))&&((sb)))\n ans=1;\n if ((ans==0)&&((h>=a)&&(h=a)&&(ma)&&(s\n#include \n\nint main()\n{\n int h,m,s,a,b,temp;\n float m1,s1;\n //printf(\"Give the five integers (h,m,s,a,b)\\n\");\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n m1=m/5.0;\n s1=s/5.0;\n if (a>b)\n {temp=a;\n a=b;\n b=temp;}\n if ((a>m1 && a>s1 && a>h) || ((am1 && b>s1 && b>h)))\n printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\nint h,m,s,a,b,max,max2,max3,f;\n \n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n h*=5;\n a*=5;\n b*=5;\n max=h;\n max2=h;\n max3=h;\n if (((h==a||h==b)||(m==a-60||m==b-60))&&(m>0||s>0))\n h++;\n\n if (((m==a||m==b)||(m==a-60||m==b-60))&&s>0)\n m++;\n if (max=max2)&&(max2<=b&&b>=max)))?printf(\"YES\"):printf(\"NO\");\n\n return 0;\n\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n\n int d,e,max,min,i;\n float a, b,c;\n\n\n\n scanf(\" %f %f %f %d %d\",&a,&b,&c,&d,&e);\n\n\n\n\n\n b/=5;\n c/=5;\n if(b>0||c>0)\n a+=0.5;\n \n\n i=0;\n max=d;\n min=e;\n if(dmin&&amin&&bmin&&d\n#include \n#include \nint main()\n{\n float h,m,s,a,b,min,max;\n scanf(\"%f %f %f %f %f\",&h,&m,&s,&a,&b);\n a=a*5;\n b=b*5;\n if (a==60)\n a=0;\n if (b==60)\n b=0;\n if (a>b)\n {\n\t max=a;\n min=b;\n }\n else\n {\n\t max=b;\n min=a;\n }\n h=h*5;\n if (h==60)\n {\n\t h=0;\n }\n if (s>=1)\n {\n\t m=m+1.0/60.0*s;\n }\n if (m>=1)\n {\n\t h=h+1.0/12.0*m;\n }\n \n \n if (((minmax || hmax || mmax || s\n#include \nint main()\n{\n\n int a, d,e,max,min,i;\n float b,c;\n\n\n\n scanf(\" %d %f %f %d %d\",&a,&b,&c,&d,&e);\n\n\n\n\n\n b/=5;\n c/=5;\n\n i=0;\n max=d;\n min=e;\n if(d=min&&a<=max){\n i++;\n }\n if(b>=min&&b<=max){\n i++;\n }\n if(d>min&&d\nint main()\n{\nfloat h,m,s,t1,t2,t;\nfloat a[3];\nwhile(scanf(\"%f%f%f%f%f\",&h,&m,&s,&t1,&t2)!=EOF&&t1!=t2)\n{\nm=m+(s/60);\nh=h+(m/60);\n\ts/=5;\n\tm/=5;\n\tif(m==0)\n\tm==12;\n\tif(s==0)\n\ts==12;\na[0]=h,a[1]=m,a[2]=s;\nfor(int i=1;i<3;i++)\nfor(int j=0;j<3-i;j++)\nif(a[j]>a[j+1])\n{\n\tt=a[j];\n\ta[j]=a[j+1];\n\ta[j+1]=t;\n}\nif(t1a[0]&&t2a[1]&&t2a[2]))\nprintf(\"Yes\\n\");\nelse\nprintf(\"NO\\n\");\n}\nelse if(t1>t2)\n{\nif((t2>a[0]&&t1a[1]&&t1a[2]&&t2\n#include \nint main()\n{\n\n int a, b ,c,d,e,max,min,i;\n\n\n\n scanf(\"%d %d %d %d %d\",&a,&b,&c,&d,&e);\n b=b/5;\n c=c/5;\n\n i=0;\n max=d;\n min=e;\n if(d=min&&a<=max){\n i++;\n }\n if(b>=min&&b<=max){\n i++;\n }\n if(d>min&&d\n#include \n#include \nint main()\n{ int h,m,s,p1,p2,count,temp;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&p1,&p2);\n m/=5;\n s/=5;\n if(p1>p2) //swaping places of p1 and p2 if p1 > p2\n{\n temp=p2;\n p2=p1;\n p1=temp;\n}\n if(p1<=h && h>p2)\n count++;\n if(p1<=m && m>p2)\n count++;\n if(p1<=s && s>p2)\n count++;\n if(count==0 && count==3)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int h, m, s, a, b, f=0;\n\n //printf(\"Enter the hours, minutes, seconds and 2 positive integers.\\n\");\n scanf(\"%d %d %d %d %d\", &h, &m, &s, &a, &b);\n\n if(h<1 || h>12 || m<0 || m>59 || s<0 || s>59 || a<1 || a> 12 || b<1 || b>12)\n exit(1);\n\n a*= 5;\n b*= 5;\n h*=5;\n\n if(a == 60)\n a = 0;\n if(b ==60)\n b = 0;\n if(h == 60)\n h = 0;\n\n if(a < b)\n {\n if((h>b || hb || mb || sa && ha && ma && sa || ha || ma || sb && hb && mb && s\n#include \n#include \nint main()\n{ int h,m,s,p1,p2;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&p1,&p2);\n h=h*5;\n p1=p1*5;\n p2=p2*5;\n if(m||s)\n h=h+2;\nif ((h==52 && m==50 && s==59 && p1==45 && p2==50) || (h==32 && m==52 && s==41 && p1==30 && p2==25))\nprintf(\"YES\");\nelse if((h==62 && m==30 && s==45 && p1==30 && p2==55) || (h==30 && m==0 && s==0 && p1==10 && p2==40) || (h==17 && m==0 && s==30 && p1==15 && p2==20) || (h==7 && m==30 && s==50 && p1==5 && p2==10) || (h==62 && m==0 && s==12 && p1==55 && p2==5))\n printf(\"NO\");\n else if ((p2>p1 && p1h) || (p2h && p2>s && p2>m) || (p2>p1 && p1>s && p1>m && h=60) || (p2>p1 && p2>m && p2>h && p2>s && p1>s && p1>m) )\n printf(\"YES\");\n else if(p1>m && p1>h && (p2>h || (p1>h && mp2 && p1>m) || (p2>s && p2>p1 && p2>h && ms && sp2 )\n printf(\"NO\");\n else if(h>s && hp1) )\n printf(\"YES\");\n \n else\n printf(\"NO\");\n\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \nint main()\n{ int h,m,s,p1,p2;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&p1,&p2);\n h=h*5;\n p1=p1*5;\n p2=p2*5;\n if(m||s)\n h=h+2;\nif ((h==52 && m==50 && s==59 && p1==45 && p2==50))\nprintf(\"YES\");\nelse if((h==62 && m==30 && s==45 && p1==30 && p2==55) || (h==30 && m==0 && s==0 && p1==10 && p2==40) || (h==62 && m==0 && s==30 && p1==15 && p2==20))\n printf(\"NO\");\n else if ((p2>p1 && p1h) || (p2h && p2>s && p2>m) || (p2>p1 && p1>s && p1>m && h=60) || (p2>p1 && p2>m && p2>h && p2>s && p1>s && p1>m) )\n printf(\"YES\");\n else if(p1>m && p1>h && (p2>h || (p1>h && mp2 && p1>m) || (p2>s && p2>p1 && p2>h && ms && sp2 )\n printf(\"NO\");\n else if(h>s && hp1) )\n printf(\"YES\");\n \n else\n printf(\"NO\");\n\n return 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int h,m,s,a,b,ans,c;\n //printf(\"Dwse tis wres ta lepta ta deuterolepta kai tis 2 xronikes stigemes a kai b\\n\");\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n ans=0;\n h=h*5;\n a=a*5;\n b=b*5;\n if (a>b)\n {\n c=a;\n a=b;\n b=c;\n }\n if ((h==60)&&(a!=60)&&(b!=60))\n h=0;\n if ((m!=0)||(s!=0))\n h=h+1;\n if (s!=0)\n m=m+1;\n if (((hb))&&((mb))&&((sb)))\n ans=1;\n if ((ans==0)&&(((h>a)&&(ha)&&(ma)&&(s0||s>0))\n h++;\n\n if (((m==a||m==b)||(m==a-60||m==b-60))&&s>0)\n m++;\n if (max=max2)&&(max2<=b&&b>=max)))?printf(\"YES\"):printf(\"NO\");\n\n return 0;\n\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\nint h,m,s,a,b,max,max2,max3,f;\n \n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n h*=5;\n a*=5;\n b*=5;\n max=h;\n max2=h;\n max3=h;\n if (((h==a||h==b)||(m==a-60||m==b-60))&&(m>0||s>0))\n h++;\n\n if (((m==a||m==b)||(m==a-60||m==b-60))&&s>0)\n m++;\n if (max=max)))?printf(\"YES\"):printf(\"NO\");\n\n return 0;\n\n}\n"}, {"source_code": "#include \n\nint main() {\n\tdouble h, m, s, t1, t2;\n\tscanf(\"%f %f %f %f %f\", &h, &m, &s, &t1, &t2);\n\th += m / 3600+ s / 3600/3600;\n\tm += s / 3600;\n\tif (h > t1 && h > t2 || h < t1 && h < t2) {\n\t\tif (m > t1 * 5 && m > t2 * 5 || m < 1 * 5 && m < t2 * 5)\n\t\t\tif (s > t1 * 5 && s > t2 * 5 || s < 1 * 5 && s < t2 * 5) {\n\t\t\t\tprintf(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t}\n\telse {\n\t\tif (!(m > t1 * 5 && m > t2 * 5 || m < 1 * 5 && m < t2 * 5))\n\t\t\tif (!(s > t1 * 5 && s > t2 * 5 || s < 1 * 5 && s < t2 * 5)) {\n\t\t\t\tprintf(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t}\n\tprintf(\"NO\");\n}"}, {"source_code": "#include \n#include \n#include \nint main()\n{ int h,m,s,p1,p2;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&p1,&p2);\n h=h*5;\n p1=p1*5;\n p2=p2*5;\n if(m||s)\n h=h+2;\n if(hp2)\n printf(\"YES\");\n else if(h>s && hp1) )\n printf(\"YES\");\n else\n printf(\"NO\");\n\n return 0;\n}"}, {"source_code": "/*\n * Copyright (C) 2017-2018 Συμεωνίδης Αναστάσιος.\n */\n#include \n#include \nint main(int argc, char* argv[]){\n int h, m, s, t1, t2;\n scanf(\"%i%i%i%i%i\", &h, &m, &s, &t1, &t2);\n h--;\n t1--;\n t2--;\n double s_p = s/60.0;\n double m_p = m/60.0 + s_p*1/60.0;\n double h_p = h/12.0 + m_p*1/12.0;\n double t1_p = t1/12.0;\n double t2_p = t2/12.0;\n if(h_p>t1_p&&h_p>t2_p&&m_p>t1_p&&m_p>t2_p&&s_p>t1_p&&s_p>t2_p){\n printf(\"YES\");\n }\n if(h_p\n#include \n\nint main()\n{\n int h,m,s,a,b,t=1,temp;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n if (!(h<1 || h>12 || m<0 || m>59 || s<0 || s>59 || a<0 || a>12 || b<1 || b>12))\n {\n if(h==12)\n h=0;\n if(a==12)\n a=0;\n if(b==12)\n b=0;\n if (a>b)\n {\n temp=a;\n a=b;\n b=temp;\n }\n h=h*5; a=a*5; b=b*5;\n if(ab || mb || sb || mb || hb || sb || hb)\n {\n if(a>m && a>s && a>h && bm && b>s && b>h)\n t=1;\n }\n if (t==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "\n #include \n#include \n#include \nint main()\n{ int h,m,s,p1,p2;\n\n \n scanf(\"%d %d %d %d %d\",&h,&m,&s,&p1,&p2);\n h=h*5;\n p1=p1*5;\n p2=p2*5;\n if(m||s)\n h=h+2;\n if((h\n#include \n\nint main()\n{\n int h,m,s,a,b,max,min,k1,k2,k;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n max=a;\n min=b;\n if (b>a)\n {\n max=b;\n min=a;\n }\n k1=max*5-1;\n k2=min*5-1;\n k=0;\n if(h==3 && m==1 && s==13)\n {\n k=k+1;\n printf(\"NO\\n\");\n }\n else\n {\n if(h>max || hk1 || mk1 || s\n#include \n\nint main()\n{\nint h,m,s,a,b,max,max2,max3,f;\n printf(\"give hours,minutes,seconds and the two numbers a,b\\n\");\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n h*=5;\n a*=5;\n b*=5;\n max=h;\n max2=h;\n max3=h;\n if (((h==a||h==b)||(m==a-60||m==b-60))&&(m>0||s>0))\n h++;\n\n if (((m==a||m==b)||(m==a-60||m==b-60))&&s>0)\n m++;\n if (max\n#include \n\nint main()\n{\n float h,m,s,maxx1,maxx2,maxx3;\n int n1,n2;\n\n scanf(\"%f %f %f %d %d\",&h,&m,&s,&n1,&n2);\n if (m!=0 || s!=0)\n {\n h=h+0.1;\n m=m/5;\n s=s/5;\n\n maxx1=h;\n if (m>maxx1)\n {\n maxx1=m;\n maxx2=h;\n }\n else\n maxx2=m;\n if (s>maxx1)\n {\n maxx3=maxx2;\n maxx2=maxx1;\n maxx1=s;\n }\n else if (s>maxx2)\n {\n maxx3=maxx2;\n maxx2=s;\n }\n else\n maxx3=s;\n\n if (n1>maxx3 && n2>maxx3 && n1maxx2 && n1>maxx2 && n1maxx1)\n {\n if (n2maxx1)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n else\n printf(\"NO\");\n }\n else\n {\n if (h==12)\n {\n if (n1!=h && n2!=h)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n if ((n1>h && n2>h) || (n1\n#include \n\nint main()\n{\n double h, m, s, t1, t2, collisionForward = 0, collisionBackward = 0;\n scanf(\"%lf %lf %lf %lf %lf\", &h, &m, &s, &t1, &t2);\n h = h * 5;\n t1 *= 5;\n t2 *= 5;\n if (t1 > t2) {\n t1 = t1 + t2;\n t2 = t1 - t2;\n t1 = t1 - t2;\n }\n if(h > t1 && h < t2 || m > t1 && m < t2 || s > t1 && s < t2) {\n collisionForward = 1;\n }\n t1 += 60;\n h += 60;\n m += 60;\n s += 60;\n if(h > t2 && h < t1 || m > t2 && m < t1 || s > t2 && s < t1) {\n collisionBackward = 1;\n }\n if(collisionBackward && collisionForward) {\n printf(\"NO\");\n return 0;\n }\n printf(\"YES\");\n return 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{ int a,b,h,m,s,check,c,temp;\n //printf(\"Give h,m,s,a,b: /n \");\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n check=0;\n c=0;\n\n\nif (b>a)\n{\n temp=a;\n a=b;\n b=temp;\n}\n\nif ((b<(float)s/5)&&(a>(float)s/5))\n c++;\nif ((b<(float)m/5)&&(a>(float)m/5))\n c++;\nif ((bh))\n c++;\nif ( (c==3) || (c==0))\n check=1;\n\nif (check==1)\n printf (\"YES\");\nelse\n printf (\"NO\");\n\n\n\n\n\n\n\n}\n"}, {"source_code": "#include \n#include \n\nint\nmain(void)\n{\n int h = 0;\n int m = 0;\n int s = 0;\n int t1 = 0;\n int t2 = 0;\n int flag = 0;\n int btw1 = 0;\n int btw2 = 0;\n\n scanf(\"%d%d%d%d%d\", &h, &m, &s, &t1, &t2);\n t1 = t1 * 5 % 60;\n t2 = t2 * 5 % 60;\n h = ((h * 5) % 60 + (m + 11) / 12) % 60;\n\n if (t1 > t2) {\n t1 = t1 ^ t2;\n t2 = t2 ^ t1;\n t1 = t1 ^ t2;\n }\n\n if (t1 <= h && h <= t2) {\n btw1 = 1;\n } else {\n btw2 = 1;\n }\n\n if (t1 <= m && m <= t2) {\n btw1 = 1;\n } else {\n btw2 = 1;\n }\n\n if (t1 <= s && s <= t2) {\n btw1 = 1;\n } else {\n btw2 = 1;\n }\n // printf(\"%d %d %d\\n\", h, m, s);\n if (btw1 && btw2) {\n printf(\"NO\");\n } else {\n printf(\"YES\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int h,m,s,a,b,temp;\n /*\n do\n {\n scanf(\"%d%d%d%d%d\",&h,&m,&s,&a,&b);\n }\n while ( (h<1)||(h>12)||(m<0)||(m>59)||(s<0)||(s>59)||(a<1)||(a>12)||(b<1)||(b>12)||(a==b));*/\n scanf(\"%d%d%d%d%d\",&h,&m,&s,&a,&b);\n if (h==12)\n h=0;\n if (a==12)\n a=0;\n if (b==12)\n b=0;\n h=h*5;\n a=a*5;\n b=b*5;\n if (b=a) && (m>=a) && (s>a) && (h<=b) && (m<=b) && (sb)||(hb)||(mb)||(s\n#include \n\nmain(){\n\tint h, m, s, a, b;\n\tscanf(\"%d %d %d %d %d\", &h, &m, &s, &a, &b);\n\tif(a>b){\n\t\ta=a+b;\n\t\tb=a-b;\n\t\ta=a-b;\n\t}\n\th*=5;\n\ta*=5;\n\tb*=5;\n\th%=60;\n\tm%=60;\n\ts%=60;\n\ta%=60;\n\tb%=60;\n\tif(((h>a&&h<=b)&&((m>=a&&m>=b)||(m<=a&&m<=b)||(s>=a&&s>=b)||(s<=a&&s<=b)))||((s>=a&&s<=b)&&((m>=a&&m>=b)||(m<=a&&m<=b)||(h>a&&h>b)||(h<=a&&h<=b)))||((m>=a&&m<=b)&&((h>a&&h>b)||(h<=a&&h<=b)||(s>=a&&s>=b)||(s<=a&&s<=b))))\n\t\tprintf(\"NO\");\n\telse\n\t\tprintf(\"YES\");\nreturn;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int i1=0,i2=0,h,m,s,a,b,temp;\n float i,h1,m1,s1;\n //printf(\"Give the five integers (h,m,s,a,b)\\n\");\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n m1=m/5.0;\n s1=s/5.0;\n h1=h;\n if (m>0 || s>0)\n h1+=0.0005;\n if (h1>12)\n h1-=12;\n if (a>b)\n {temp=a;\n a=b;\n b=temp;}\n if (a>=m1)\n i1++;\n if (a>=h1)\n i1++;\n if (a>=s1)\n i1++;\n if (b>=m1)\n i2++;\n if (b>=h1)\n i2++;\n if (b>=s1)\n i2++;\n if ((i1==i2) || ((a<=m1 && a<=s1 && a<=h1) && (b>=m1 && b>=s1 && b>=h1)))\n printf(\"YES\\n\");\n else printf(\"NO\\n\");\n //printf(\"%f %f %f %d %d\",h1,m1,s1,a,b);\n return 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int h,m,s,a,b,t=1;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n if (!(h<1 || h>12 || m<0 || m>59 || s<0 || s>59 || a<0 || a>12 || b<1 || b>12))\n {\n h=h*5; a=a*5; b=b*5;\n if(h==60)\n h=0;\n if(a==60)\n a=0;\n if(b==60)\n b=0;\n if(ab || mb || sb || mb || hb || sb || hb)\n {\n if(a>m && a>s && a>h && bm && b>s && b>h)\n t=1;\n }\n if (t==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n return 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int h,m,s,a,b,t=1;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n while (h<1 || h>12 || m<0 || m>59 || s<0 || s>59 || a<0 || a>12 || b<1 || b>12)\n {\n printf(\"Wrong\\n\");\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n }\n h=h*5; a=a*5; b=b*5;\n if(h==60)\n h=0;\n if(a==60)\n a=0;\n if(b==60)\n b=0;\n if(ab || mb || sb || mb || hb || sb || hb)\n {\n if(a>m && a>s && a>h && bm && b>s && b>h)\n t=1;\n }\n if (t==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "\n #include \n#include \n#include \nint main()\n{ int h,m,s,p1,p2;\n\n \n scanf(\"%d %d %d %d %d\",&h,&m,&s,&p1,&p2);\n h=h*5;\n p1=p1*5;\n p2=p2*5;\n if(m||s)\n h=h+2;\n if((h\n#include \n#include \nint main()\n{ int h,m,s,p1,p2;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&p1,&p2);\n h=h*5;\n p1=p1*5;\n p2=p2*5;\n if(m||s)\n h=h+2;\n if((hp2 && p1>m) || (p2>s && p2>p1 && p2>h && ms && sp2 || (p2>p1 && p1s && hp1) )\n printf(\"YES\");\n else\n printf(\"NO\");\n\n return 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\nfloat h, m, s, a, b, temp ;\n\nscanf(\"%f %f %f %f %f\",&h,&m,&s,&a,&b);\nh *= 2;\na *= 2;\nb *= 2;\nm = m + (s / 60);\nh = h + (m / 60);\n\nif(a > b )\n {\n temp = a;\n a = b;\n b = temp;\n }\nif((s >= a && s <= b) ||(m >= a && m <= b) || (h >= a && h <= b))\n {\n if((s > a && m> a && h > a) && (s < b && m < b && h < b))\n {\n temp=1;\n }\n else\n {\n temp=0;\n }\n }\nelse\n {\n temp=1;\n }\nif (temp)\n printf(\"YES\");\nelse\n printf(\"NO\");\nreturn 0;\n}\n"}, {"source_code": "#include \n\nint clock[3600];\nint chk[3600], chk2[3600];\nint main(){\n int h, m, s, dep, arr;\n scanf(\"%d %d %d %d %d\", &h, &m, &s, &dep, &arr);\n\n clock[(h*300+m*60+6*s)%3600]=1;\n clock[(m*60+s*6)%3600]=1;\n clock[(s*60)%3600]=1;\n\n// printf(\"%d %d %d\\n\", (h*30+m*6)%360, (m*6+s*6)%360, s*6%360);\n\n for (int i=0; i<3600; i++) {\n chk[i]=clock[i];\n chk2[i]=clock[i];\n }\n\n for (int i=dep*300; i<=(deparr?dep*300:dep*300+3600); i>=arr*300; i--){\n chk2[(i-1)%3600]|=chk2[i%3600];\n }\n\n arr=(arr*300)%3600;\n if (chk[arr] && chk2[arr]) printf(\"NO\\n\");\n else printf(\"YES\\n\");\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n float h,m,s,maxx1,maxx2,maxx3;\n int n1,n2;\n\n printf(\"Give h , m , s , n1 , n2\\n\");\n scanf(\"%f %f %f %d %d\",&h,&m,&s,&n1,&n2);\n if (m!=0 || s!=0)\n {\n h=h+0.1;\n m=m/5;\n s=s/5;\n maxx1=h;\n if (m>maxx1)\n {\n maxx1=m;\n maxx2=h;\n }\n else\n maxx2=m;\n if (s>maxx1)\n {\n maxx3=maxx2;\n maxx2=maxx1;\n maxx1=s;\n }\n else if (s>maxx2)\n {\n maxx3=maxx2;\n maxx2=s;\n }\n else\n maxx3=s;\n\n if (n1>maxx3 && n2>maxx3 && n1maxx2 && n1>maxx2 && n1maxx1)\n if (n2maxx1)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n else\n {\n if (n1!=h && n2!=h)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n\n\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int h,m,s,a,b,ans,c;\n //printf(\"Dwse tis wres ta lepta ta deuterolepta kai tis 2 xronikes stigemes a kai b\\n\");\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n ans=0;\n h=h*5;\n a=a*5;\n b=b*5;\n if (a>b)\n {\n c=a;\n a=b;\n b=c;\n }\n if ((h==60)&&(a!=60)&&(b!=60))\n h=0;\n printf(\"h= %f m= %f\",h,m);\n printf(\"h= %f m= %f\",h,m);\n if (((h=b))&&((m=b))&&((sb)))\n ans=1;\n if ((ans==0)&&(((h>=a)&&(h=a)&&(ma)&&(s\n#include \n\nint main()\n{\n double Hours,Mins,Secs,Misha,Destination,temp;\n int FlagCW=0,FlagCCW=0;\n scanf(\"%lf %lf %lf %lf %lf\",&Hours,&Mins,&Secs,&Misha,&Destination);\n\n Hours+=Mins/60;\n Hours+=Secs/3600;\n if(Hours>12){\n Hours-=12;\n }\n Mins/=5;\n Secs/=5;\n if(Misha>Destination){\n temp=Misha;\n Misha=Destination;\n Destination=temp;\n }\n temp=12.0000;\n if((Hours>Misha && HoursMisha && MinsMisha && SecsDestination) || (MinsDestination) || (SecsDestination)){\n FlagCCW=1;\n }\n temp=0.0000;\n if((Hours=temp) || (Mins=temp) || (Secs=temp)){\n FlagCCW=1;\n }\n if(FlagCCW==0){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n }\n //printf(\"\\n%lf %lf %lf %lf %lf %d %d\",Hours,Mins,Secs,Misha,Destination,FlagCW,FlagCCW);\n\n return 0;\n\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int h,m,s,a,b,ans,c;\n //printf(\"Dwse tis wres ta lepta ta deuterolepta kai tis 2 xronikes stigemes a kai b\\n\");\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n ans=0;\n h=h*5;\n a=a*5;\n b=b*5;\n printf(\"ans= %d\\n\",ans);\n if (a>b)\n {\n c=a;\n a=b;\n b=c;\n }\n if ((h==60)&&(a!=60)&&(b!=60))\n h=0;\n if (((h<=a)||(h>=b))&&((mb))&&((sb)))\n ans=1;\n printf(\"ans= %d\",ans);\n if ((ans==0)&&(((h>=a)&&(h<=b))&&((m>a)&&(ma)&&(s\n#include \n\nint main()\n{\n int h,m,s,a,b,ans,c;\n //printf(\"Dwse tis wres ta lepta ta deuterolepta kai tis 2 xronikes stigemes a kai b\\n\");\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n ans=0;\n h=h*5;\n a=a*5;\n b=b*5;\n if (a>b)\n {\n c=a;\n a=b;\n b=c;\n }\n if ((h==60)&&(a!=60)&&(b!=60))\n h=0;\n printf(\"h= %f m= %f\",h,m);\n printf(\"h= %f m= %f\",h,m);\n if (((h=b))&&((m=b))&&((sb)))\n ans=1;\n if ((ans==0)&&((h>=a)&&(h=a)&&(ma)&&(s\n#include \n\nint main()\n{\n unsigned int h,m,s,a,b,max,min,k=1;\n float m1;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n h*=5;\n if (m>0 || s>0)\n {\n h++;\n if (h>60)\n h=h-60;\n }\n if (s>0)\n {\n m1=m+0,5;\n if (m>60)\n m=m-60;\n }\n a*=5;\n b*=5;\n max=a;\n min=b;\n if (a\n#include\n\n\nint main()\n{\n int t,m,s,t1,t2,i=0;\n scanf(\"%d %d %d %d %d\",&t,&m,&s,&t1,&t2);\n if(t>t1 && tt1*5 && m<(t2-t1)*5+t1*5)\n i++;\n if(s>t1*5 && s<(t2-t1)*5+t1*5)\n i++;\n if(i==3 || i==0)\n printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int h,m,s,a,b,temp;\n float h1,m1,s1;\n //printf(\"Give the five integers (h,m,s,a,b)\\n\");\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n m1=m/5.0;\n s1=s/5.0;\n h1=h;\n if (m>0 && s>0)\n h1+=0.0002;\n if (a>b)\n {temp=a;\n a=b;\n b=temp;}\n if ((a>=m1 && a>=s1 && a>=h1) || ((a<=m1 && a<=s1 && a<=h1) && (b>=m1 && b>=s1 && b>=h1)))\n printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{ int a,b,h,m,s,check,c,temp;\n //printf(\"Give h,m,s,a,b: /n \");\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a,&b);\n check=0;\n c=0;\n\n\nif (b>a)\n{\n temp=a;\n a=b;\n b=temp;\n}\n\nif ((b<(float)s/5)&&(a>(float)s/5))\n c++;\nif ((b<(float)m/5)&&(a>(float)m/5))\n c++;\nif ((bh))\n c++;\nif ( (c==3) || (c==0))\n check=1;\n\nif (check==1)\n printf (\"YES\");\nelse\n printf (\"NO\");\n\n\n\n\n\n\n\n}\n"}, {"source_code": "#include \n#include \n\n\nint main()\n{\n double h,m,s,t1,t2,temp;\n scanf(\"%lf%lf%lf%lf%lf\",&h,&m,&s,&t1,&t2);\n m=m+s/60.0;\n h=(h+m/60.0)*5.0;\n if(m>=60.0)\n m-=60.0;\n if(h>=60.0)\n h-=60.0;\n t1*=5.0,t2*=5.0;\n if(t1>t2)\n temp=t1;\n t1=t2;\n t2=temp;\n int flag1=1,flag2=1;\n if((t1<=h&&h<=t2)||(t1<=m&&m<=t2)||(t1<=s&&s<=t2))//从较小的点到较大的点\n flag1=0;\n if(h<=t1)\n h+=60.0;\n if(m<=t1)\n m+=60.0;\n if(s<=t1)\n s+=60.0;\n t1+=60.0;\n if((t2<=h&&h<=t1)||(t2<=m&&m<=t1)||(t2<=s&&s<=t1))//从较大的点到较小的点\n flag2=0;\n if(flag1||flag2)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n\nint clock[3600];\nint chk[3600], chk2[3600];\nint main(){\n int h, m, s, dep, arr;\n scanf(\"%d %d %d %d %d\", &h, &m, &s, &dep, &arr);\n\n clock[(h*300+m*60+6*s)%3600]=1;\n clock[(m*60+s*6)%3600]=1;\n clock[(s*60)%3600]=1;\n\n// printf(\"%d %d %d\\n\", (h*30+m*6)%360, (m*6+s*6)%360, s*6%360);\n\n for (int i=0; i<3600; i++) {\n chk[i]=clock[i];\n chk2[i]=clock[i];\n }\n\n for (int i=dep*300; i<=(deparr?dep*300:dep*300+3600); i>=arr*300; i--){\n chk2[(i-1)%3600]|=chk2[i%3600];\n }\n\n arr=(arr*300)%3600;\n if (chk[arr] && chk2[arr]) printf(\"NO\\n\");\n else printf(\"YES\\n\");\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n double Hours,Mins,Secs,Misha,Destination,temp;\n int FlagCW=0,FlagCCW=0;\n scanf(\"%lf %lf %lf %lf %lf\",&Hours,&Mins,&Secs,&Misha,&Destination);\n\n Hours+=Mins/60;\n Hours+=Secs/3600;\n if(Hours>12){\n Hours-=12;\n }\n Mins/=5;\n Secs/=5;\n if(Misha>Destination){\n temp=Misha;\n Misha=Destination;\n Destination=temp;\n }\n temp=12.0000;\n if((Hours>Misha && HoursMisha && MinsMisha && SecsDestination) || (MinsDestination) || (SecsDestination)){\n FlagCCW=1;\n }\n temp=0.0000;\n if((Hours=temp) || (Mins=temp) || (Secs=temp)){\n FlagCCW=1;\n }\n if(FlagCCW==0){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n }\n //printf(\"\\n%lf %lf %lf %lf %lf %d %d\",Hours,Mins,Secs,Misha,Destination,FlagCW,FlagCCW);\n\n return 0;\n\n}\n"}, {"source_code": "#include \n\nint main(void)\n{\n\tint h, m, s, t1, t2;\n\tdouble posh, posm, poss, post1, post2;\n\tscanf(\"%d %d %d %d %d\", &h, &m, &s, &t1, &t2);\n\th = h % 12;\n\tt1 = t1 % 12;\n\tt2 = t2 % 12;\n\tposs = (double)s;\n\tposm = 6 * m + (double)s / 10;\n\tposh = 30 * h + (double)(60 * m + s) / 120;\n\tpost1 = 30 * t1;\n\tpost2 = 30 * t2;\n\tif((post1 >= posh && post2 <=posh && post1 >=posm && post2 <= posm && post1 >= poss && post2 <=poss) || (post2 >= posh && post1 <= posh && post2 >= posm && post1 <= posm && post2 >= poss && post1 <= poss))\n\t{\n\t\tputs(\"YES\");\n\t}\n\telse\n\t{\n\t\tputs(\"NO\");\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nmain()\n{\n int h,m,s,t1,t2,y1=1,y2=1,y3=1,temp,i;\n scanf(\"%d%d%d%d%d\",&h,&m,&s,&t1,&t2);\n\n\n\n s *= 60;\n m *= 60;\n h = h*300 + m/12 + s/(12*60);\n if (h>3600)\n h -= 3600;\n if (h==0)\n h = 3600;\n if(m==0)\n m=3600;\n if (s==0)\n s=3600;\n t1 *= 300;\n t2 *= 300;\n\n if (t1>t2)\n {\n temp = t2;\n t2 = t1;\n t1= temp;\n }\n\n //rintf(\"h=%d\\nm=%d\\ns=%d\\nt1=%d\\nt2=%d\\n\",h,m,s,t1,t2);\n\n for (i=t1+1; i<=t2-1; i++)\n {\n if ( i == h || i == m || i == s)\n y1 = 0;\n }\n\n for (i=t2+1; i<=3600; i++)\n {\n if ( i == h || i == m || i == s)\n y2 = 0;\n }\n\n for (i=1; i<=t1-1; i++)\n {\n if ( i == h || i == m || i == s)\n y3 = 0;\n }\n\n\n if (y1 == 0 && (y2==0 || y3==0))\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n}\n"}, {"source_code": "#include \n#include \n#include \nint main()\n{ int h,m,s,p1,p2;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&p1,&p2);\n h=h*5;\n p1=p1*5;\n p2=p2*5;\n if(m||s)\n h=h+2;\n if((hp2 && p1>m) || (p2>s && p2>p1 && p2>h && ms && sp2 || (p2>p1 && p1>h)) )\n printf(\"NO\");\n else if(h>s && hp1) )\n printf(\"YES\");\n else\n printf(\"NO\");\n\n return 0;\n}"}], "src_uid": "912c8f557a976bdedda728ba9f916c95"} {"nl": {"description": "After finishing eating her bun, Alyona came up with two integers n and m. She decided to write down two columns of integers — the first column containing integers from 1 to n and the second containing integers from 1 to m. Now the girl wants to count how many pairs of integers she can choose, one from the first column and the other from the second column, such that their sum is divisible by 5.Formally, Alyona wants to count the number of pairs of integers (x, y) such that 1 ≤ x ≤ n, 1 ≤ y ≤ m and equals 0.As usual, Alyona has some troubles and asks you to help.", "input_spec": "The only line of the input contains two integers n and m (1 ≤ n, m ≤ 1 000 000).", "output_spec": "Print the only integer — the number of pairs of integers (x, y) such that 1 ≤ x ≤ n, 1 ≤ y ≤ m and (x + y) is divisible by 5.", "sample_inputs": ["6 12", "11 14", "1 5", "3 8", "5 7", "21 21"], "sample_outputs": ["14", "31", "1", "5", "7", "88"], "notes": "NoteFollowing pairs are suitable in the first sample case: for x = 1 fits y equal to 4 or 9; for x = 2 fits y equal to 3 or 8; for x = 3 fits y equal to 2, 7 or 12; for x = 4 fits y equal to 1, 6 or 11; for x = 5 fits y equal to 5 or 10; for x = 6 fits y equal to 4 or 9. Only the pair (1, 4) is suitable in the third sample case."}, "positive_code": [{"source_code": "#include\nint main()\n{\n long long int n,m,i,j,k,count,vag1,vag2,vag,t,temp,p;\n scanf(\"%I64d %I64d\",&n,&m);\n count=0;\n if(n+m>=5){\n if(n>m){\n temp=n;\n n=m;\n m=temp;\n }\n for(i=1;i<=n;i++){\n k=1;\n t=k;\n while((i+k)%5!=0){\n\n k++;\n t=k;\n }\n p=(m-t+5)/5;\n count+=p;\n }\n printf(\"%I64d\\n\",count);\n }\n else\n printf(\"0\\n\",count);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,m,i,k;\n\tlong long int sum=0; \n\tscanf(\"%d%d\",&n,&m);\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tsum=sum+(m+i%5)/5;\n\t}\n\tprintf(\"%lld\\n\",sum);\n\treturn 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n int n,i,m,j;\n long long int count=0;\n\n scanf(\"%d %d\",&n,&m);\n\n if(n<=m)\n {\n //int temp;\n for(i=1;i<=5;i++)\n {\n for(j=0;j-i<=m;j+=5)\n {\n if( j>=i && j-i<=m && j-i>0) count++;\n //printf(\"i=%d j=%d count=%d (%d-%d)=%d couple(%d,%d)\\n\",i,j,count,j,i,j-i,i,j-i);\n }\n //printf(\"\\n\");\n }\n count=count*(n/5);\n //printf(\"count= %d nmod5= %d\\n\",count,n%5);\n for(i=1;i<=n%5;i++)\n {\n for(j=0;j-i<=m;j+=5)\n {\n if( j>=i && j-i<=m && j-i>0) count++;\n //printf(\"i=%d j=%d count=%d (%d-%d)=%d couple(%d,%d)\\n\",i,j,count,j,i,j-i,i,j-i);\n }\n //printf(\"\\n\");\n }\n }\n\n else\n {\n for(i=1;i<=5;i++)\n {\n for(j=0;j-i<=n;j+=5)\n {\n if( j>=i && j-i<=n && j-i>0) count++;\n //printf(\"i=%d j=%d count=%d (%d-%d)=%d couple(%d,%d)\\n\",i,j,count,j,i,j-i,i,j-i);\n }\n //printf(\"\\n\");\n }\n count=count*(m/5);\n //printf(\"count= %d nmod5= %d\\n\",count,n%5);\n for(i=1;i<=m%5;i++)\n {\n for(j=0;j-i<=n;j+=5)\n {\n if( j>=i && j-i<=n && j-i>0) count++;\n //printf(\"i=%d j=%d count=%d (%d-%d)=%d couple(%d,%d)\\n\",i,j,count,j,i,j-i,i,j-i);\n }\n //printf(\"\\n\");\n }\n }\n\n printf(\"%lld\",count);\n\n return 0;\n}\n"}, {"source_code": "#include \n\nunsigned long long count_pairs_multiple_5(unsigned long long, unsigned long long);\nint main()\n{\n unsigned long long m, n, answer;\n scanf(\"%I64u %I64u\",&m, &n);\n answer = count_pairs_multiple_5(m,n);\n printf(\"%I64u\\n\",answer);\n return 0;\n}\n\nunsigned long long count_pairs_multiple_5(unsigned long long m, unsigned long long n)\n{\n short i;\n unsigned long long answer = 0, current_mod_x, current_mod_y;\n\n answer = (n/5)*(m/5);//doing the case of i = 0 (mod 5) separately because (m - (5 - i)) will actually lose 1 possible value of y.\n for(i = 1; i <5; i++)\n {\n current_mod_x = n/5;\n current_mod_y = m/5;\n if(n%5 >= i)\n {\n current_mod_x++;\n }\n if(m%5 >= 5 - i)\n {\n current_mod_y++;\n }\n answer = answer + current_mod_x*current_mod_y;\n }\n return answer;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n,i,m,j;\n long long int count=0;\n\n scanf(\"%d %d\",&n,&m);\n\n if(n<=m)\n {\n //int temp;\n for(i=1;i<=5;i++)\n {\n for(j=0;j-i<=m;j+=5)\n {\n if( j>=i && j-i<=m && j-i>0) count++;\n //printf(\"i=%d j=%d count=%d (%d-%d)=%d couple(%d,%d)\\n\",i,j,count,j,i,j-i,i,j-i);\n }\n //printf(\"\\n\");\n }\n count=count*(n/5);\n //printf(\"count= %d nmod5= %d\\n\",count,n%5);\n for(i=1;i<=n%5;i++)\n {\n for(j=0;j-i<=m;j+=5)\n {\n if( j>=i && j-i<=m && j-i>0) count++;\n //printf(\"i=%d j=%d count=%d (%d-%d)=%d couple(%d,%d)\\n\",i,j,count,j,i,j-i,i,j-i);\n }\n //printf(\"\\n\");\n }\n }\n\n else\n {\n for(i=1;i<=5;i++)\n {\n for(j=0;j-i<=n;j+=5)\n {\n if( j>=i && j-i<=n && j-i>0) count++;\n //printf(\"i=%d j=%d count=%d (%d-%d)=%d couple(%d,%d)\\n\",i,j,count,j,i,j-i,i,j-i);\n }\n //printf(\"\\n\");\n }\n count=count*(m/5);\n //printf(\"count= %d nmod5= %d\\n\",count,n%5);\n for(i=1;i<=m%5;i++)\n {\n for(j=0;j-i<=n;j+=5)\n {\n if( j>=i && j-i<=n && j-i>0) count++;\n //printf(\"i=%d j=%d count=%d (%d-%d)=%d couple(%d,%d)\\n\",i,j,count,j,i,j-i,i,j-i);\n }\n //printf(\"\\n\");\n }\n }\n\n printf(\"%lld\",count);\n\n return 0;\n}\n"}, {"source_code": "#include\n\nint main(){\n long long n,m,i,x,y,c=0,z,j;\n scanf(\"%lld %lld\",&n,&m);\n if(n>m){x=m;y=n;}\n else{x=n;y=m;}\n for(i=x;i>=1;i--){\n z=(i+y)/5-(i/5);\n c+=z;\n }\n printf(\"%lld\\n\",c);\n}\n"}, {"source_code": "#include\nint main()\n{long long int n,m,i,j,sum=0;\nscanf(\"%lld%lld\",&n,&m);\nfor(i=1;i<=n;i++)\n{sum=sum+((m+i)/5-i/5);}\n\nprintf(\"%lld\",sum);\nreturn 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n long long int n,m,a,b,c,d,tot=0;\n scanf(\"%lld %lld\",&n,&m);\n a=m/5;\n\n tot=a*n;\n\n\n c=m%5;\n\n d=n/5;\n\n tot=tot+c*d;\n\n\n b=m%5;\n c=n%5;\n d=b+c;\n d=d-4;\n if(d>0)\n tot=tot+d;\n\n\n printf(\"%lld\\n\",tot);\n\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int n, m, tmp;\n scanf(\"%d%d\", &n, &m);\n long long int ans = 0;\n for(int i = 1; i <= n; i++)\n {\n tmp = m;\n ans += (tmp + (i%5)) / 5;\n }\n printf(\"%I64d\\n\", ans);\n}"}, {"source_code": "#include\nmain()\n{\n\tint n,m,i,d;\n\tlong long s=0;\n\tscanf(\"%d %d\",&n,&m);\n\tfor(i=1;i<=n;i++)\n\t{\n\t\td=(m+i)/5-i/5;\n\t\ts+=d;\n\t}\n\tprintf(\"%I64d\",s);\n}"}, {"source_code": "#include \n\nint main()\n{\n long long n,m,i=1,j,count=0;\n scanf(\"%I64d %I64d\",&n,&m);\n\n while(i<=n){\n count+=(m+5-(5-(i%5)))/5;\n i++;\n }\n\n printf(\"%I64d\",count);\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tint a,b;\n\tscanf(\"%d %d\",&a, &b);\n\tunsigned long long f0,f1,f2,f3,f4,s0,s1,s2,s3,s4;\n\tf0 = a / 5;\n\tf1 = a / 5 + (a % 5 > 0 ? 1 : 0);\n\tf2 = a / 5 + (a % 5 > 1 ? 1 : 0);\n\tf3 = a / 5 + (a % 5 > 2 ? 1 : 0);\n\tf4 = a / 5 + (a % 5 > 3 ? 1 : 0);\n\ts0 = b / 5;\n\ts1 = b / 5 + (b % 5 > 0 ? 1 : 0);\n\ts2 = b / 5 + (b % 5 > 1 ? 1 : 0);\n\ts3 = b / 5 + (b % 5 > 2 ? 1 : 0);\n\ts4 = b / 5 + (b % 5 > 3 ? 1 : 0);\n\tprintf(\"%llu\", f0 * s0 + f1 * s4 + f2 * s3 + f3 *s2 + f4 * s1);\n}"}, {"source_code": "#include\nint main()\n{\n long long int n,m,x,y,ans=0,p,q;\n scanf(\"%lld %lld\",&n,&m);\n x=m/5;\n y=m%5;\n p=n/5;\n q=n%5;\n ans=n*x+p*y;\n if((q==1 && y ==4)||(q==2 && y==3) ||(q==3 && y==2)||(q==4 &&y==1))\n ans++;\n else if((q==2 && y==4)||(q==3 && y==3) ||(q==4 && y==2))\n ans=ans+2;\n else if((q==3 && y==4)||(q==4 && y==3))\n ans=ans+3;\n else if(q==4 && y==4)\n ans=ans+4;\n printf(\"%lld\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n long long int m,n,i,ans=0,temp;\n scanf(\"%lld %lld\",&n,&m);\n\n\n for(i=1;i<=n;i++)\n {\n temp=i%5;\n long long int d=m-5+temp;\n if(d>=0)\n {\n ans++;\n ans=ans+d/5;\n }\n }\n printf(\"%lld\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n\n long long int i,j,k,l;\n\n long long int n,m;\n scanf(\"%lld %lld\",&n,&m);\n long long int t;\n\n\nlong long int count=0;\n for(i=1;i<=n;i++)\n {\n count=count + ((i+m)/5) - (i/5);\n }\n\nprintf(\"%lld\",count);\n\nreturn 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 \n\nint main()\n{\n int n , m ,p , i;\n long long int sum = 0;\n scanf(\"%d %d\",&n,&m);\n if (n > 4){\n for (i=0;i<5;i++){\n sum = sum + (i+m)/5;\n }\n sum = sum*(n/5);\n p = n%5;\n for (i=1;i\nint main()\n{\n\tlong long int a,b,i,j,count=0,x,y,z;\n\tscanf(\"%lld%lld\",&a,&b);\n\tfor(i=1;i<=5;i++)\n\t{\n\t\tx=0;\n\t\ty=0;\n\t\tif(a>=i)\n\t\t{\n\t\t\tx=(a-i)/5+1;\n\t\t}\n\t\tz=(5-(i%5));\n\t\tif(b>=z)\n\t\t{\n\t\t\ty=(b-z)/5+1;\n\t\t}\n\t\tcount=x*y + count;\n\t}\n\n\tprintf(\"%lld\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,m,i,k;\n\tlong long int sum=0; \n\tscanf(\"%d%d\",&n,&m);\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tsum=sum+(m+i%5)/5;\n\t}\n\tprintf(\"%lld\\n\",sum);\n\treturn 0;\n}"}, {"source_code": "#include \n\nint c(int n, int k) {\n\tif (k == 0)\n\t\treturn n / 5;\n\telse {\n\t\tn -= k;\n\t\treturn n < 0 ? 0 : n / 5 + 1;\n\t}\n}\n\nint main() {\n\tint i, n, m;\n\tlong long cnt;\n\n\tscanf(\"%d%d\", &n, &m);\n\tcnt = 0;\n\tfor (i = 0; i < 5; i++)\n\t\tcnt += (long long) c(n, i) * c(m, (5 - i) % 5); /*cnt * num*/\n\tprintf(\"%lld\\n\", cnt);\n\treturn 0;\n}\n"}, {"source_code": "/* 20160711 JJA Codeforces #358 A.Alyona and Numbers */\n\n#define _CRT_SECURE_NO_WARNINGS\n\n#include \n\nint main() {\n\tint n;\n\tint m;\n\tint tmp;\n\tunsigned long long counter = 0 ;\n\tscanf(\"%d %d\", &n, &m);\n\n\tfor (int i = 1; i <= n; i++) {\n\t\tcounter += (i + m) / 5 - i / 5;\n\t}\n\tprintf(\"%lld\", counter);\n\n}"}, {"source_code": "#include\n#include\n#include\n#define mod 100000007\n//int x[100005]= {0};\nint main()\n{\n long long int x,y,i,r,d,Ans=0;\n\n scanf(\"%I64d %I64d\",&x,&y);\n\n for(i=1; i<=x; i++)\n {\n\n if(i%5==1)\n {\n if(y>=4)\n {\n d=(y-4)/5;\n Ans+=d+1;\n }\n }\n else if(i%5==2)\n {\n if(y>=3)\n {\n d=(y-3)/5;\n Ans+=d+1;\n }\n }\n else if(i%5==3)\n {\n if(y>=2)\n {\n d=(y-2)/5;\n Ans+=d+1;\n }\n }\n else if(i%5==4)\n {\n if(y>=1)\n {\n d=(y-1)/5;\n Ans+=d+1;\n }\n }\n if(i%5==0)\n {\n if(y>=5)\n {\n d=y/5;\n Ans+=d;\n }\n }\n }\n printf(\"%I64d\",Ans);\n return 0;\n}\n"}, {"source_code": "#include\n int main(void)\n{\n\n long long n ,m,i,temp,r=0,j;\n scanf(\"%I64d %I64d\",&n,&m);\n for(i=1;i<=n;i++)\n {\n temp=(i/5)+1;\n temp=(temp)*5-i;\n if(temp<=m)\n {\n r++;\n }\n j=m-temp;\n r=r+(j/5);\n }\n printf(\"%I64d\",r);\n}"}, {"source_code": "#include\n\nint main()\n{\n\n long long int i,j,k,l;\n\n long long int n,m;\n scanf(\"%lld %lld\",&n,&m);\n long long int t;\n\n\nlong long int count=0;\n for(i=1;i<=n;i++)\n {\n count=count + ((i+m)/5) - (i/5);\n }\n\nprintf(\"%lld\",count);\n\nreturn 0;\n}\n"}, {"source_code": "#include\nint main(){\n\tint n,m,div,rem;\n\tscanf(\"%d %d\",&n,&m);\n\tunsigned long long output=0;\n\tdiv=m/5;\n\trem=m%5;\n\toutput=((unsigned long long)n*div)+((n/5)*rem);\n\n\tif((n%5)&&(rem)){\n\t\t\n\t\tif((n%5)==1){\n\t\t\tif(rem==4){\n\t\t\t\toutput++;\n\t\t\t}\n\t\t}\n\t\telse if((n%5)==2){\n\t\t\tif(rem==4){\n\t\t\t\toutput+=2;\n\t\t\t}\n\t\t\telse if (rem==3){\n\t\t\t\toutput+=1;\n\t\t\t}\n\t\t}\n\t\telse if((n%5)==3){\n\t\t\tif(rem==4){\n\t\t\t\toutput+=3;\n\t\t\t}\n\t\t\telse if (rem==3){\n\t\t\t\toutput+=2;\n\t\t\t}\n\t\t\telse if(rem==2){\n\t\t\t\toutput+=1;\n\t\t\t}\n\t\t}\n\t\telse if((n%5)==4){\n\t\t\tif(rem==4){\n\t\t\t\toutput+=4;\n\t\t\t}\n\t\t\telse if (rem==3){\n\t\t\t\toutput+=3;\n\t\t\t}\n\t\t\telse if(rem==2){\n\t\t\t\toutput+=2;\n\t\t\t}\n\t\t\telse if (rem==1){\n\t\t\t\toutput++;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%I64d\\n\",output);\n\n\t\n}\n"}, {"source_code": "#include \n\n#define g(x, i) (x / 5 + (x % 5 >= (i)))\n\nint main() {\n long long m, n, c = 0;\n int i;\n scanf(\"%I64d %I64d\\n\", &n, &m);\n for (i = 0; i < 5; ++i)\n c += g(n, i ? i : 5) * g(m, 5 - i);\n printf(\"%I64d\", c);\n}\n"}, {"source_code": "#include\nint main()\n{\n\t__int64 x;\n\t__int64 y;\n\t__int64 i;\n\t__int64 ans=0;\n\tscanf(\"%I64d %I64d\",&x,&y);\n\tif(x>y)\n\t{\n\t\ti=x;\n\t\tx=y;\n\t\ty=i;\n\t}\n\tx++;\n\tfor(i=1;i\n\nint main()\n{\nlong long int n,m;\nscanf(\"%lld %lld\",&n,&m);\nlong long int p=n/5,q=n%5;\nlong long int r=m/5,s=m%5;\nlong long int count=0;\ncount=p*5*r+q*r+s*p;\nif(q+s>=5) {count+=(q+s)-4;}\nprintf(\"%lld\",count);\nreturn 0;\n}\n"}, {"source_code": "#include\nint main(){\n\tlong long i,n,m,count=0,min,max;\n\tscanf(\"%lld %lld\",&n,&m);\n\tmin=n;max=m;\n\tif(n>m){\n\t\tmax=n;\n\t\tmin=m;\n\t}\n\tfor(i=1;i<=min;i++){\n\t\tcount+=max/5;\n\t\tif((max%5)>=(5-(i%5)))\n\t\t\tcount++;\n\t}\n\tprintf(\"%lld\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": "/* 20160711 JJA Codeforces #358 A.Alyona and Numbers */\n\n#define _CRT_SECURE_NO_WARNINGS\n\n#include \n\nint main() {\n\tint n;\n\tint m;\n\tint tmp;\n\tunsigned long long counter = 0 ;\n\tscanf(\"%d %d\", &n, &m);\n\n\tfor (int i = 1; i <= n; i++) {\n\t\tcounter += (i + m) / 5 - i / 5;\n\t}\n\tprintf(\"%lld\", counter);\n\n}"}, {"source_code": "#include \nlong long a[6],b[6];\nint main()\n{\n\tlong long n,m,i,sum,j;\n\tscanf(\"%lld%lld\",&n,&m);\n\tfor(i=1;i<=n;i++)\n\t\ta[i%5]++;\n\tfor(i=1;i<=m;i++)\n\t\tb[i%5]++;\n\tsum=a[0]*b[0];\n\tfor(i=1,j=4;i<=4&&j>=0;i++,j--){\n\t\tsum+=a[i]*b[j];\n\t}\n\tprintf(\"%lld\",sum);\n}"}, {"source_code": "#include \n\nint main()\n{\n\tunsigned long long a, b, c;\n\tint ZA[5];\n\n\tscanf(\"%llu%llu\",&a, &b);\n\tif (a < b) {\n\t\tc = b;\n\t\tb = a;\n\t\ta = c;\n\t}\n\tfor (c = 0; c < 5; ++c)\n\t\tZA[c] = a / 5;\n\tfor (c = 0; c <= a % 5; ++c)\n\t\tZA[c] += 1;\n\tZA[0] -= 1;\n\tc = 0;\n\tfor (a = 1; a <= b; ++a)\n\t\tc += ZA[(5 - a % 5) % 5];\n\tprintf(\"%llu\\n\", c);\n\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n,m,a,b,c,d,tot=0;\n scanf(\"%lld %lld\",&n,&m);\n a=m/5;\n\n tot=a*n;\n\n\n c=m%5;\n\n d=n/5;\n\n tot=tot+c*d;\n\n\n b=m%5;\n c=n%5;\n d=b+c;\n d=d-4;\n if(d>0)\n tot=tot+d;\n\n\n printf(\"%lld\\n\",tot);\n\n return 0;\n}\n"}, {"source_code": "#include \nint main(int argc, char const *argv[])\n{\n\tlong long int x, y,i;\n\tscanf(\"%I64d %I64d\", &x, &y);\n\tlong long int xl = x/5;\n\tlong long int yl = y/5;\n\tlong long int c = xl * yl * 5;\n\tlong long int xm = x % 5;\n\tlong long int ym = y % 5;\n\tc += xm * yl;\n\tc += ym * xl;\n\tfor (i = xm; i > 0; --i)\n\t{\n\t\tif(ym >= 5-i) c++;\n\t}\n\tprintf(\"%I64d\\n\", c);\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n long long int n, m, i, num = 0, t;\n\n scanf(\"%lld%lld\", &n, &m);\n\n if(n <= m)\n {\n for(i = 0;i < 5;i++)\n {\n if(i == 0)\n {\n t = (n / 5) * (m / 5);\n num += t;\n }\n else\n {\n if(i <= n && (5 - i) <= m)\n {\n t = ((n - i) / 5 + 1) * ((m + i - 5) / 5 + 1);\n num += t;\n }\n }\n }\n }\n else\n {\n for(i = 0;i < 5;i++)\n {\n if(i == 0)\n {\n t = (n / 5) * (m / 5);\n num += t;\n }\n else\n {\n if(i <= m && (5 - i) <= n)\n {\n t = ((n + i - 5) / 5 + 1) * ((m - i) / 5 + 1);\n num += t;\n }\n }\n\n }\n }\n\n printf(\"%lld\", num);\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint satarmatha(long long int n,long long int m,long long int x)\n{\n long long int u = x - m - 1;\n if(u < 0){\n u = 0;\n }\n if(n - u >= 0 && n=x && m>=x){\n return x-1;\n }\n}\nint main()\n{\n long long int x, a, n, k, m, i, l, sum=0, max, min, j=0;\n scanf(\"%I64d %I64d\", &n, &m);\n x = (n + m) / 5;\n //printf(\"%d\", 5*x);\n if(n > m){\n max = n;\n min = m;\n }\n else{\n max = m;\n min = n;\n }\n x *= 5;\n //printf(\"%d\\n\", x);\n for(i=0;;i++){\n if(x == 0) break;\n sum += satarmatha(min,max,x);\n x -= 5;\n\n }\n\n printf(\"%I64d\", sum);\n}\n"}, {"source_code": "#include\n#include\nint main( )\n{\n\tlong long int n,m,i,j,k,c=0,a[5]={0},b[5]={0};\n\tscanf(\"%lld %lld\",&n,&m);\n\tfor(i=0;i<5;i++)\n\t{\n\t\ta[i]=n/5;\n\t\tb[i]=m/5;\n\t}\n\ta[0]=a[0]-1;\n\tb[0]=b[0]-1;\n\tfor(i=0;i<(n%5)+1;i++)\n\t{\n\t\ta[i]+=1;\n\t}\n\tfor(i=0;i<((m%5)+1);i++)\n\t{\n\t\tb[i]+=1;\n\t}\n\tc=a[0]*b[0]+a[1]*b[4]+a[2]*b[3]+a[3]*b[2]+a[4]*b[1];\n\tprintf(\"%lld\\n\",c);\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n\n long long int i,j,k,l;\n\n long long int n,m;\n scanf(\"%lld %lld\",&n,&m);\n long long int t;\n\n\nlong long int count=0;\n for(i=1;i<=n;i++)\n {\n count=count + ((i+m)/5) - (i/5);\n }\n\nprintf(\"%lld\",count);\n\nreturn 0;\n}\n"}, {"source_code": "#include \n\n\nint main()\n{\n long long int n, m, mx[6], nx[6], i, ways;\n\n\n while(scanf(\"%lld %lld\", &m, &n) != EOF){\n for(i=0; i<6; i++){\n mx[i] = m/5;\n nx[i] = n/5;\n }\n for(i=1; i<=(m%5); i++) mx[i]++;\n for(i=1; i<=(n%5); i++) nx[i]++;\n ways = mx[5] * nx[5] + mx[1] * nx[4] + mx[2] * nx[3] + mx[3] * nx[2] + mx[4] * nx[1];\n printf(\"%lld\\n\", ways);\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nunsigned long long count_pairs_multiple_5(unsigned long long, unsigned long long);\nint main()\n{\n unsigned long long m, n, answer;\n scanf(\"%I64u %I64u\",&m, &n);\n answer = count_pairs_multiple_5(m,n);\n printf(\"%I64u\\n\",answer);\n return 0;\n}\n\nunsigned long long count_pairs_multiple_5(unsigned long long m, unsigned long long n)\n{\n short i;\n unsigned long long answer = 0, current_mod_x, current_mod_y;\n\n answer = (n/5)*(m/5);//doing the case of i = 0 (mod 5) separately because (m - (5 - i)) will actually lose 1 possible value of y.\n for(i = 1; i <5; i++)\n {\n current_mod_x = n/5;\n current_mod_y = m/5;\n if(n%5 >= i)\n {\n current_mod_x++;\n }\n if(m%5 >= 5 - i)\n {\n current_mod_y++;\n }\n answer = answer + current_mod_x*current_mod_y;\n }\n return answer;\n}\n"}, {"source_code": "#include\n#include\n#include\nint main(void)\n{\n\tlong int n,m,i,a,j,b,c;\n\tdouble count;\n\tscanf(\"%ld%ld\",&n,&m);\n\tcount=0;\n\tfor(i=1;i<=n;i++)\n\t{\n\t a=i%5;\n\t a=5-a;\n\t b=m/5;\n\t j=m-5*(b);\n\t if(j>=a)\n\t count=count+b+1;\n\t else\n\t count=count+b;\n\t\t\n }\n\tprintf(\"%.0lf\",count);\n\t\n\n}\n"}, {"source_code": "#include\n\nint A[6];\n\nint main(void)\n{\nint m,n,min,max,count=0,i,val;\n\nlong long sum=0;\n\nscanf(\"%d%d\",&m,&n);\n\nif(m<=n)\n{\nmin=m;\nmax=n;\n}\nelse\n{\nmin=n;\nmax=m;\n}\n\n\nfor(i=1; i<=min; i++)\n{\n val=5-i%5;\nif(val<=max)\n{\ncount+=(max-val)/5;\nA[i]=count+1;\ncount=0;\nif(i==5)\nbreak;\n}\n}\n\nfor(i=1; i<=5; i++)\nsum+=A[i];\n\nif(min>5)\n{\nsum*=min/5;\nmin%=5;\nfor(i=1; i<=min; i++)\nsum+=A[i];\n}\n\nprintf(\"%lld\",sum);\nreturn 0;\n}"}, {"source_code": "#include\n#include\nmain()\n{\n int64_t n, m, y=0, i;\n scanf(\"%I64d %I64d\", &n, &m);\n for(i=1; i<=n; i++){\n y=y+(m+(i%5))/5;\n }\n printf(\"%I64d\", y);\n}\n"}, {"source_code": "#include \n\nint main()\n{\n long long n,m,i=1,j,count=0;\n scanf(\"%I64d %I64d\",&n,&m);\n\n while(i<=n){\n count+=(m+5-(5-(i%5)))/5;\n i++;\n }\n\n printf(\"%I64d\",count);\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nlong long p[10],q[10];\nvoid main()\n{\nlong long n,m,i,s=0;\nscanf(\"%lld %lld\",&n,&m);\n\nfor(i=1;i<=n;i++)\np[i%5]++;\n\nfor(i=1;i<=m;i++)\nq[i%5]++;\n\nfor(i=0;i<5;i++){\n\tif(i==0)\ns=s+p[i]*q[i];\nelse\ns=s+p[i]*q[5-i];}\n\nprintf(\"%lld\\n\",s);\nexit(0);\n}"}, {"source_code": "///Be Grateful For What You Have\n///Never Give Up\n#include\n#include\n#include\n#include\n\nint main()\n{\n long long i,n,m,p1,p2,ara1[6]={0},ara2[6]={0},sum=0;\n scanf(\"%lld %lld\",&n,&m);\n p1=n/5;\n p2=m/5;\n n-=p1*5;\n m-=p2*5;\n for(i=0;i<5;i++){\n ara1[i]=p1;\n ara2[i]=p2;\n if(i==0)\n continue;\n if(i<=n){ara1[i]++;}\n if(i<=m){ara2[i]++;}\n }\n sum=ara1[0]*ara2[0]+ara1[1]*ara2[4]+ara1[2]*ara2[3]+ara1[3]*ara2[2]+ara1[4]*ara2[1];\n printf(\"%lld\",sum);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n long long int n, m, q_n, mod_n, q_m, mod_m, total_pairs = 0, i, temp;\n\t\n scanf(\"%lld %lld\", &n, &m); \n \n if(n > 1000000 || m > 1000000) return 1;\n \n if(n > m)\n {\n temp = m;\n m = n;\n n = temp;\n }\n \n q_m = m / 5; \n mod_m = m % 5; \n \n for(i = 1; i <= n; i++)\n {\n total_pairs += q_m;\n if((i % 5 + mod_m) >= 5) total_pairs++;\n }\n\n printf(\"%lld\\n\", total_pairs);\n\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n long long int n,m,i,a[6],b[6],ans=0;\n scanf(\"%lld%lld\",&n,&m);\n for(i=1;i<=5;i++)\n {\n a[i]=(n+5-i)/5;\n b[i]=(m+5-i)/5;\n }\n for(i=1;i<5;i++)\n ans=ans+a[i]*b[5-i];\n ans=ans+a[i]*b[i];\n printf(\"%lld\",ans);\n return 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n long long int m=0,i,j,k,l;\n scanf(\"%lld %lld\",&i,&j);\n for(k=1;k<=i;k++)\n {\n l=k%5;\n m=m+(j+l)/5;\n }\n printf(\"%lld\",m);\n\n return 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n int n,i,m,j;\n long long int count=0;\n\n scanf(\"%d %d\",&n,&m);\n\n if(n<=m)\n {\n //int temp;\n for(i=1;i<=5;i++)\n {\n for(j=0;j-i<=m;j+=5)\n {\n if( j>=i && j-i<=m && j-i>0) count++;\n //printf(\"i=%d j=%d count=%d (%d-%d)=%d couple(%d,%d)\\n\",i,j,count,j,i,j-i,i,j-i);\n }\n //printf(\"\\n\");\n }\n count=count*(n/5);\n //printf(\"count= %d nmod5= %d\\n\",count,n%5);\n for(i=1;i<=n%5;i++)\n {\n for(j=0;j-i<=m;j+=5)\n {\n if( j>=i && j-i<=m && j-i>0) count++;\n //printf(\"i=%d j=%d count=%d (%d-%d)=%d couple(%d,%d)\\n\",i,j,count,j,i,j-i,i,j-i);\n }\n //printf(\"\\n\");\n }\n }\n\n else\n {\n for(i=1;i<=5;i++)\n {\n for(j=0;j-i<=n;j+=5)\n {\n if( j>=i && j-i<=n && j-i>0) count++;\n //printf(\"i=%d j=%d count=%d (%d-%d)=%d couple(%d,%d)\\n\",i,j,count,j,i,j-i,i,j-i);\n }\n //printf(\"\\n\");\n }\n count=count*(m/5);\n //printf(\"count= %d nmod5= %d\\n\",count,n%5);\n for(i=1;i<=m%5;i++)\n {\n for(j=0;j-i<=n;j+=5)\n {\n if( j>=i && j-i<=n && j-i>0) count++;\n //printf(\"i=%d j=%d count=%d (%d-%d)=%d couple(%d,%d)\\n\",i,j,count,j,i,j-i,i,j-i);\n }\n //printf(\"\\n\");\n }\n }\n\n printf(\"%lld\",count);\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n\tint n, m, x;\n\tlong long cnt;\n\n\tscanf(\"%d%d\", &n, &m);\n\tcnt = 0;\n\tfor (x = 1; x <= n; x++) {\n\t\tint high, low;\n\n\t\tlow = (5 - x % 5 - 1) % 5 + 1;\n\t\thigh = m - m % 5 + (5 - x % 5) % 5;\n\t\tif (high > m)\n\t\t\thigh -= 5;\n\t\tcnt += (long long) (high - low) / 5 + 1;\n\t}\n\tprintf(\"%lld\\n\", cnt);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main ()\n{\n long long int n,m,a,b,c,d,i,sum=0;\n scanf(\"%lld %lld\",&n,&m);\n if(n+m<5)\n {\n printf(\"0\\n\");\n return 0;\n }\n if(n+m==5)\n {\n printf(\"1\\n\");\n return 0;\n }\n if(n+m>5)\n {\n if(n<=m)\n {\n for(i=1;i<=n;i++)\n {\n if(i==1 && m<4);\n else\n {\n a=i%5;\n b=5-a;\n c=m-b;\n d=c/5;\n sum=sum+d+1;\n }\n }\n }\n else\n {\n for(i=1;i<=m;i++)\n {\n if(i==1 && n<4);\n else\n {\n a=i%5;\n b=5-a;\n c=n-b;\n d=c/5;\n sum=sum+d+1;\n }\n }\n }\n }\n printf(\"%lld\\n\",sum);\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\nint cmpfunc(const void*a,const void*b)\n{\n return (*(int*)a - *(int*)b);\n}\nint main()\n{\n long long n,m,i,j,chk=0,z=0,k=0,t=0,s=0,max=0,min=0,d=0;\n long long sum=0;\n int a[2000005]={0},b[5000]={0},c[1000001]={0},y[1000001]={0};\n scanf(\"%lld%lld\",&n,&m);\n t=n/5;\n s=m/5;\n sum+=(s*t*5);\n sum+=(t*(m%5));\n sum+=(s*(n%5));\n if((m%5)+(n%5)>=5)\n sum+=((m%5)+(n%5))-4;\n printf(\"%lld\",sum);\n return 0;\n}"}, {"source_code": "#include\nint main(){\n\tint n,m,div,rem;\n\tscanf(\"%d %d\",&n,&m);\n\tunsigned long long output=0;\n\tdiv=m/5;\n\trem=m%5;\n\toutput=((unsigned long long)n*div)+((n/5)*rem);\n\n\tif((n%5)&&(rem)){\n\t\t\n\t\tif((n%5)==1){\n\t\t\tif(rem==4){\n\t\t\t\toutput++;\n\t\t\t}\n\t\t}\n\t\telse if((n%5)==2){\n\t\t\tif(rem==4){\n\t\t\t\toutput+=2;\n\t\t\t}\n\t\t\telse if (rem==3){\n\t\t\t\toutput+=1;\n\t\t\t}\n\t\t}\n\t\telse if((n%5)==3){\n\t\t\tif(rem==4){\n\t\t\t\toutput+=3;\n\t\t\t}\n\t\t\telse if (rem==3){\n\t\t\t\toutput+=2;\n\t\t\t}\n\t\t\telse if(rem==2){\n\t\t\t\toutput+=1;\n\t\t\t}\n\t\t}\n\t\telse if((n%5)==4){\n\t\t\tif(rem==4){\n\t\t\t\toutput+=4;\n\t\t\t}\n\t\t\telse if (rem==3){\n\t\t\t\toutput+=3;\n\t\t\t}\n\t\t\telse if(rem==2){\n\t\t\t\toutput+=2;\n\t\t\t}\n\t\t\telse if (rem==1){\n\t\t\t\toutput++;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%I64d\\n\",output);\n\n\t\n}\n"}, {"source_code": "#include\n#include\nmain()\n{\n int64_t n, m, y=0, i;\n scanf(\"%I64d %I64d\", &n, &m);\n for(i=1; i<=n; i++){\n y=y+(m+(i%5))/5;\n }\n printf(\"%I64d\", y);\n}\n"}, {"source_code": "#include \nint main() \n{ \n int n,m,i; \n long long sum=0; \n scanf(\"%d%d\",&n,&m); \n for(i=1;i<=n;i++) \n sum+=((m+i)/5-i/5); \n printf(\"%lld\",sum); \n return 0; \n} \n "}, {"source_code": "#include\nint main()\n{\nint n,m,i,first;\nlong long int sum=0;\nscanf(\"%d%d\",&n,&m);\nfor(i=1;i<=n;i++)\n{\nfirst=5-(i%5);\nif(m>=first)\n\tsum=sum+((m-first)/5) +1;\n}\nprintf(\"%lld\\n\",sum);\nreturn 0;\n}"}, {"source_code": "#include\n#include\n\nint main()\n{\n\tlong long int n,m,i,j,count=0;\n\tscanf(\"%lld%lld\",&n,&m);\n\tcount=(n/5)*(m/5)*5;\n\tfor(i=0;i<=m%5;i++)\n\t\tfor(j=0;j<=n%5;j++)\n\t\t\tif(i+j==5)\n\t\t\t\tcount++;\n\tcount+=(m%5)*(n/5);\n\tcount+=(n%5)*(m/5);\n\tprintf(\"%lld\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include\nlong long p[10],q[10];\nint main()\n{\n\tint n,x,y,l;\n\tlong long ans=0,i,j,k,a,b; \n\tscanf(\"%I64d%I64d\",&a,&b);\n\tfor(i=1;i<=a;i++)\n\t\tp[i%5]++;\n\tfor(i=1;i<=b;i++)\n\t\tq[i%5]++;\n\tans+=p[1]*q[4];\n\tans+=p[2]*q[3];\n\tans+=p[3]*q[2];\n\tans+=p[4]*q[1];\n\tans+=p[0]*q[0];\n \tprintf(\"%I64d\",ans);\nreturn 0;\n}\n\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n, m;\n long long int i, j, c = 0;\n scanf(\"%d %d\", &n, &m);\n for (i = n; i >= n - 4 && i >= 1; i--)\n {\n for (j = m; j >= m - 4 && j >= 1; j--)\n {\n if ((i + j) % 5 == 0 && (i % 5 == 0 || j % 5 == 0))\n {\n c += ((i - i % 5) / 5) * ((j - j % 5) / 5);\n break;\n }\n else if ((i + j) % 5 == 0)\n {\n c += (1 + ((i - i % 5) / 5)) * (1 + ((j - j % 5) / 5));\n break;\n }\n }\n }\n printf(\"%I64u\", c);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n\nint main()\n{\n long long int x,y,a=0;\n scanf(\"%lld%lld\",&x,&y);\n for (int i=1;i<=x;i++)\n a+=(i+y)/5 - i/5;\nprintf(\"%lld\",a);\n return 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n long long int n,m,x,y,ans=0,p,q;\n scanf(\"%lld %lld\",&n,&m);\n x=m/5;\n y=m%5;\n p=n/5;\n q=n%5;\n ans=n*x+p*y;\n if((q==1 && y ==4)||(q==2 && y==3) ||(q==3 && y==2)||(q==4 &&y==1))\n ans++;\n else if((q==2 && y==4)||(q==3 && y==3) ||(q==4 && y==2))\n ans=ans+2;\n else if((q==3 && y==4)||(q==4 && y==3))\n ans=ans+3;\n else if(q==4 && y==4)\n ans=ans+4;\n printf(\"%lld\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n long long int n, m, max, min, ans=0;\n int i;\n scanf(\"%lld %lld\",&n,&m);\n if(m>n) max=m, min=n;\n else max=n, min=m;\n for(i=1;i<=min;i++)\n {\n ans+=(max+(i%5))/5;\n }\n printf(\"%lld\",ans);\n return 0;\n}"}, {"source_code": "#include \n\nint n,m;\nlong long ans=0;\nlong long h[10];\nint main(){\n int i;\n scanf (\"%d%d\",&n,&m);\n for (i=1;i<=m;i++){\n if (i%5) h[i%5]++;\n else h[5]++;\n }\n for (i=1;i<=n;i++){\n ans += h[5-(i%5)];\n }\n printf (\"%I64d\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include \n\n\nint main()\n{\n long long int n, m, mx[6], nx[6], i, ways;\n\n\n while(scanf(\"%lld %lld\", &m, &n) != EOF){\n for(i=0; i<6; i++){\n mx[i] = m/5;\n nx[i] = n/5;\n }\n for(i=1; i<=(m%5); i++) mx[i]++;\n for(i=1; i<=(n%5); i++) nx[i]++;\n ways = mx[5] * nx[5] + mx[1] * nx[4] + mx[2] * nx[3] + mx[3] * nx[2] + mx[4] * nx[1];\n printf(\"%lld\\n\", ways);\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#define max(a,b) (a)>(b)?(a):(b)\n#define min(a,b) (a)<(b)?(a):(b)\nint main()\n{\n long long a,b;\n long long c=0,n=1,t=5,temp;\n scanf(\"%lld%lld\",&a,&b);\n long long minimum=(min(a,b)),maximum=(max(a,b));\n if((a==b&&a<3))\n printf(\"0\");\n else if(a==b&&a==3)\n printf(\"2\");\n else if(a==b&&a%10==0&&b%10==0)\n printf(\"%lld\",a*(b/10)*2);\n else\n {\n while(n<=minimum)\n {\n temp=abs(n-t);\n if(n%5!=0&&(maximum-temp)>=0)\n {c+=((maximum-temp)/5)+1;\n //printf(\"%d %d\\n\",n,c);\n }\n else\n c+=((maximum-temp)/5);\n n++;\n if((n-t)>0)\n t+=5;\n }\n printf(\"%lld\",c);\n }\n return 0;\n}"}, {"source_code": "#include \n\nint min(int a,int b){\n\n if(a < b)\n return a;\n return b;\n}\nint main(){\n\n int n, m, v[10], i;\n long long answ = 0;\n scanf(\"%d %d\",&n,&m);\n\n for(i = 0;i <= 4; ++i)\n v[i] = 0;\n\n for(i = 1;i <= n; ++i)\n ++v[i % 5];\n for(i = 1;i <= m; ++i)\n if(i % 5 > 0)\n answ = answ + v[5 - (i % 5)];\n else\n answ = answ + v[0];\n\n printf(\"%I64d\",answ);\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,m;\n long long cnt=0;\n scanf(\"%d %d\",&n,&m);\n int mx,lo;\n if(n>m)\n {\n mx=n;\n lo=m;\n }\n else\n {\n mx=m;\n lo=n;\n }\n for(int i=1;i<=lo;i++)\n {\n if(mx+lo<5)\n {\n break;\n }\n if(i<=mx && i+mx>=5)\n {\n cnt++;\n cnt+=(mx-(5-i%5))/5;\n }\n }\n printf(\"%lld\\n\",cnt);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n,m,i,j,sum,a;\n while(scanf(\"%lld%lld\",&n,&m)!=EOF)\n {\n sum=0;\n for(i=1;i<=n;i++)\n {\n a=i%5;\n sum=sum+(m+a)/5;\n }\n printf(\"%lld\\n\",sum);\n }\n return 0;\n}\n"}, {"source_code": "#include\nmain()\n{\n long long int n,m,i=1,j,sum=0;\n scanf(\"%I64d %I64d\",&n,&m);\n\n for(i=1;i<=n;i++)\n {\n sum+=(m+(i%5))/5;\n }\n printf(\"%I64d\",sum);\n}\n\n\n"}, {"source_code": "#include\nint main(){\n long long int n,m,count=0,i,j;\n scanf(\"%lld %lld\", &n,&m);\n int q1,rn,rm,q2;\n q1=n/5;\n q2=m/5;\n rn=n%5;\n rm=m%5;\n count=q2*n+q1*rm;\n if(rn==1){\n if(rm==4) count++;\n }\n else if(rn==2){\n if(rm==3) count++;\n else if(rm==4) count=count+2;\n }\n else if(rn==3){\n if(rm==2) count++;\n else if(rm==3) count+=2;\n else if(rm==4) count+=3;\n }\n else if(rn==4){\n if(rm==1) count++;\n else if(rm==2) count+=2;\n else if(rm==3) count+=3;\n else if(rm==4) count+=4;\n }\n\n /*for(i=1;i<=n;i+=5){\n for(j=4;j<=m;j+=5){\n count++;\n }\n }\n for(i=2;i<=n;i+=5){\n for(j=3;j<=m;j+=5){\n count++;\n }\n }\n for(i=3;i<=n;i+=5){\n for(j=2;j<=m;j+=5){\n count++;\n }\n }\n for(i=4;i<=n;i+=5){\n for(j=1;j<=m;j+=5){\n count++;\n }\n }\n for(i=5;i<=n;i+=5){\n for(j=5;j<=m;j+=5){\n count++;\n }\n }*/\n printf(\"%lld\", count);\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n , m , i , ans=0 ;\n\n scanf(\"%I64d%I64d\",&n,&m);\n\n\n\n for(i=1 ; i<=n ; i++)\n {\n ans += (m+i)/5 - i/5 ;\n }\n\n\n\n\n printf(\"%I64d\",ans);\n\n return 0 ;\n}\n"}, {"source_code": "#include\nint main(){\n\tint n,m,div,rem;\n\tscanf(\"%d %d\",&n,&m);\n\tunsigned long long output=0;\n\tdiv=m/5;\n\trem=m%5;\n\toutput=((unsigned long long)n*div)+((n/5)*rem);\n\n\tif((n%5)&&(rem)){\n\t\t\n\t\tif((n%5)==1){\n\t\t\tif(rem==4){\n\t\t\t\toutput++;\n\t\t\t}\n\t\t}\n\t\telse if((n%5)==2){\n\t\t\tif(rem==4){\n\t\t\t\toutput+=2;\n\t\t\t}\n\t\t\telse if (rem==3){\n\t\t\t\toutput+=1;\n\t\t\t}\n\t\t}\n\t\telse if((n%5)==3){\n\t\t\tif(rem==4){\n\t\t\t\toutput+=3;\n\t\t\t}\n\t\t\telse if (rem==3){\n\t\t\t\toutput+=2;\n\t\t\t}\n\t\t\telse if(rem==2){\n\t\t\t\toutput+=1;\n\t\t\t}\n\t\t}\n\t\telse if((n%5)==4){\n\t\t\tif(rem==4){\n\t\t\t\toutput+=4;\n\t\t\t}\n\t\t\telse if (rem==3){\n\t\t\t\toutput+=3;\n\t\t\t}\n\t\t\telse if(rem==2){\n\t\t\t\toutput+=2;\n\t\t\t}\n\t\t\telse if (rem==1){\n\t\t\t\toutput++;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%I64d\\n\",output);\n\n\t\n}\n"}, {"source_code": "#include \n#include \n\n#define __max(a, b) (((a) > (b)) ? (a) : (b))\n#define __min(a, b) (((a) < (b)) ? (a) : (b))\n\nint main()\n{\n\tint n, m;\n\tscanf(\"%d %d\\n\", &n, &m);\n\n\t// if (n + m < 5)\n\t// {\n\t// \tputs(\"0\");\n\t// \treturn 0;\n\t// }\n\n\tlong long count = 0;\n\tint n1 = __min(n, m);\n\tint m1 = __max(n, m);\n\tif (m1 > 10)\n\t{\n\t\tfor (int i = 1; i < n1 + 1; ++i)\n\t\t{\n\t\t\t// printf(\"%d\\n\", ((m1 - (m1 + i) % 5 - 1) / 5 + 1));\n\t\t\t// printf(\"%d\\n\", (m1 - (m1 + i) % 5 - 1));\n\t\t\t// if ((m - (m + i) % 5 - 1)>0)\n\t\t\t// {\n\t\t\tcount += ((m1 - (m1 + i) % 5 - 1) / 5 + 1);\n\t\t\t// }\n\t\t}\n\t}\n\telse\n\t{\n\t\tint temp;\n\t\tint mod[m1 + 1];\n\t\tfor (int i = 1; i < m1 + 1; i += 5)\n\t\t{\n\t\t\tmod[i] = 1;\n\t\t}\n\t\tfor (int i = 2; i < m1 + 1; i += 5)\n\t\t{\n\t\t\tmod[i] = 2;\n\t\t}\n\t\tfor (int i = 3; i < m1 + 1; i += 5)\n\t\t{\n\t\t\tmod[i] = 3;\n\t\t}\n\t\tfor (int i = 4; i < m1 + 1; i += 5)\n\t\t{\n\t\t\tmod[i] = 4;\n\t\t}\n\t\tfor (int i = 5; i < m1 + 1; i += 5)\n\t\t{\n\t\t\tmod[i] = 0;\n\t\t}\n\n\t\tfor (int i = 1; i < n1 + 1; ++i)\n\t\t{\n\t\t\t// printf(\"%d\\n\", (5-i%5)%5);\n\t\t\ttemp = ((5 - i % 5) % 5);\n\t\t\tfor (int j = 1; j < m1 + 1; ++j)\n\t\t\t{\n\t\t\t\tif (mod[j] == temp)\n\t\t\t\t{\n\t\t\t\t\t++count;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprintf(\"%I64d\", count);\n\n\treturn 0;\n\n}\n\n/*\n0 5 10 15 20 25 30\n\n\n1 4 9 14 19 24 29\n2 3 8 13 18 23 28\n3 2 7 12 17 22 27\n4 1 6 11 16 21 26\n5 5 10 15 20 25 30\n6 4 9 14 19 24 29\n7 3 8 13 18 23 28\n8 2 7 12 17 22 27\n9 1 6 11 16 21 26\n10 5 10 15 20 25\n11 4 9 14 19 24\n\n\n\n*/\n"}, {"source_code": "#include \nint main() {\n long long n,m,sum=0,a,b;\n scanf(\"%I64d%I64d\",&n,&m);\n a=n%5; b=m%5;\n for (int i=1;i<=5;i++)\n sum+=(n/5+(i<=a))*(m/5+(-i%5+5<=b));\n printf(\"%I64d\\n\",sum);\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 \n\nint main()\n{\n int n , m ,p , i;\n long long int sum = 0;\n scanf(\"%d %d\",&n,&m);\n if (n > 4){\n for (i=0;i<5;i++){\n sum = sum + (i+m)/5;\n }\n sum = sum*(n/5);\n p = n%5;\n for (i=1;i\nint main()\n{\n long int i,j,k,n,m;\n long long s;\n while(scanf(\"%ld %ld\",&n,&m)!=EOF)\n {\n s=0;\n for(i=1;i<=n;i++)\n {\n j=(m+i)/5;\n k=i/5;\n s+=j-k;\n //s+=m/5;\n /*k=1;\n j=(5-i%5)%5;\n if(j==0)\n k=0;\n s+=(m-j)/5+k;*/\n }\n printf(\"%I64d\\n\",s);\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int i;\n long long int c,a,b,x,y;\n scanf(\"%lld%lld\",&a,&b);\n int r1=a%5;\n int r2=b%5;\n c=(a/5)*(b/5);\n\n for(i=1;i<=4;i++)\n {\n x=a/5;\n y=b/5;\n if(r1>=i)\n {\n x=x+1;\n }\n if(r2>=(5-i))\n {\n y=y+1;\n }\n c=x*y + c;\n }\n\n printf(\"%lld\\n\",c);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n\n int x,y,i,j,k,l,sum;\n unsigned long long int c;\n\n scanf(\"%d %d\",&x,&y);\n\n c = 0;\n\n i = 1;\n j = 1;\n\n for(i=1;i<=x;i++){\n for(j=1;j<=5;j++){\n sum = i + j;\n if(sum%5==0 && j<=y){\n c = c + 1;\n c = c + (y-j)/5;\n break;\n }\n\n\n\n }\n\n }\n\n\n\n\n printf(\"%I64d\\n\",c);\n\n\n\n\n\n return 0;\n\n}\n"}, {"source_code": "#include\nint main()\n{\n long int i,j,k,n,m;\n long long s;\n while(scanf(\"%ld %ld\",&n,&m)!=EOF)\n {\n s=0;\n for(i=1;i<=n;i++)\n {\n j=(m+i)/5;\n k=i/5;\n s+=j-k;\n //s+=m/5;\n /*k=1;\n j=(5-i%5)%5;\n if(j==0)\n k=0;\n s+=(m-j)/5+k;*/\n }\n printf(\"%I64d\\n\",s);\n }\n return 0;\n}\n"}, {"source_code": "#include \n\n\nlong long int N[10] = {0};\nlong long int M[10] = {0};\n\nint main(void)\n{\n\t\tint n, m;\n\t\tscanf(\"%I64d %I64d \", &n, &m);\n\n\t\tif (n > 9){\n\n\t\t\t\tfor (int i = 0; i < 10; i++)\n\t\t\t\t\t\tN[i] = (n - n%10)/10;\n\n\t\t\t\tfor (int i = 1; i <= (n%10); i++)\n\t\t\t\t\t\tN[i]++;\n\t\t}\n\t\telse\n\t\t\t\tfor (int i = 1; i <= n; i++)\n\t\t\t\t\t\tN[i]++;\n\n\t\tif (m > 9){\n\n\t\t\t\tfor (int i = 0; i < 10; i++)\n\t\t\t\t\t\tM[i] = (m - m%10)/10;\n\n\t\t\t\tfor (int i = 1; i <= (m%10); i++)\n\t\t\t\t\t\tM[i]++;\n\t\t}\n\t\telse\n\t\t\t\tfor (int i = 1; i <= m; i++)\n\t\t\t\t\t\tM[i]++;\n\n\t\tlong long int sum = N[0]*(M[0] + M[5]) + N[1]*(M[4] + M[9]) + N[2]*(M[3] + M[8]) + N[3]*(M[2]+M[7]) + N[4]*(M[1] + M[6]) + N[5]*(M[0] + M[5]) + N[6]*(M[9] + M[4]) + N[7]*(M[8] + M[3]) + N[8]*(M[2] + M[7]) + N[9]*(M[6] + M[1]);\n\n\t\tprintf(\"%I64d\\n\", sum);\n\t\treturn 0;\n}\n\n\n\n"}, {"source_code": "#include\nint main(){\n\tint n,m,div,rem;\n\tscanf(\"%d %d\",&n,&m);\n\tunsigned long long output=0;\n\tdiv=m/5;\n\trem=m%5;\n\toutput=((unsigned long long)n*div)+((n/5)*rem);\n\n\tif((n%5)&&(rem)){\n\t\t\n\t\tif((n%5)==1){\n\t\t\tif(rem==4){\n\t\t\t\toutput++;\n\t\t\t}\n\t\t}\n\t\telse if((n%5)==2){\n\t\t\tif(rem==4){\n\t\t\t\toutput+=2;\n\t\t\t}\n\t\t\telse if (rem==3){\n\t\t\t\toutput+=1;\n\t\t\t}\n\t\t}\n\t\telse if((n%5)==3){\n\t\t\tif(rem==4){\n\t\t\t\toutput+=3;\n\t\t\t}\n\t\t\telse if (rem==3){\n\t\t\t\toutput+=2;\n\t\t\t}\n\t\t\telse if(rem==2){\n\t\t\t\toutput+=1;\n\t\t\t}\n\t\t}\n\t\telse if((n%5)==4){\n\t\t\tif(rem==4){\n\t\t\t\toutput+=4;\n\t\t\t}\n\t\t\telse if (rem==3){\n\t\t\t\toutput+=3;\n\t\t\t}\n\t\t\telse if(rem==2){\n\t\t\t\toutput+=2;\n\t\t\t}\n\t\t\telse if (rem==1){\n\t\t\t\toutput++;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%I64d\\n\",output);\n\n\t\n}\n"}, {"source_code": "#include\nmain()\n{\n long long int n,m,i=1,j,sum=0;\n scanf(\"%I64d %I64d\",&n,&m);\n\n for(i=1;i<=n;i++)\n {\n sum+=(m+(i%5))/5;\n }\n printf(\"%I64d\",sum);\n}\n\n\n"}, {"source_code": "#include\n#include\nint main()\n{\n int64_t i,n,b[5]={0},a[5]={0},m;\n scanf(\"%I64d%I64d\",&n,&m);\n for(i=1;i<=n;i++)\n a[i%5]++;\n for(i=1;i<=m;i++)\n b[i%5]++;\n \n printf(\"%I64d\",(a[0]*b[0])+(a[1]*b[4])+(a[4]*b[1])+(a[3]*b[2])+(b[3]*a[2]));\n \n return 0;\n}"}, {"source_code": "#include\n#include\nint main ()\n{\n long long int a,b,n,m,i,j;\n scanf(\"%lld%lld\",&n,&m);\n if(n<=m)\n {\n a=m;\n b=n;\n }\n else if(n>m)\n {\n a=n;\n b=m;\n }\n long long int count=0;\n for(i=1; i<=b; i++)\n {\n if((i%5)>=(5-a%5))\n count=count+(a/5)+1;\n else\n count=count+(a/5);\n\n }\n printf(\"%lld\\n\",count);\n}\n"}, {"source_code": "#include \n\n\nlong long int N[10] = {0};\nlong long int M[10] = {0};\n\nint main(void)\n{\n\t\tint n, m;\n\t\tscanf(\"%I64d %I64d \", &n, &m);\n\n\t\tif (n > 9){\n\n\t\t\t\tfor (int i = 0; i < 10; i++)\n\t\t\t\t\t\tN[i] = (n - n%10)/10;\n\n\t\t\t\tfor (int i = 1; i <= (n%10); i++)\n\t\t\t\t\t\tN[i]++;\n\t\t}\n\t\telse\n\t\t\t\tfor (int i = 1; i <= n; i++)\n\t\t\t\t\t\tN[i]++;\n\n\t\tif (m > 9){\n\n\t\t\t\tfor (int i = 0; i < 10; i++)\n\t\t\t\t\t\tM[i] = (m - m%10)/10;\n\n\t\t\t\tfor (int i = 1; i <= (m%10); i++)\n\t\t\t\t\t\tM[i]++;\n\t\t}\n\t\telse\n\t\t\t\tfor (int i = 1; i <= m; i++)\n\t\t\t\t\t\tM[i]++;\n\n\t\tlong long int sum = N[0]*(M[0] + M[5]) + N[1]*(M[4] + M[9]) + N[2]*(M[3] + M[8]) + N[3]*(M[2]+M[7]) + N[4]*(M[1] + M[6]) + N[5]*(M[0] + M[5]) + N[6]*(M[9] + M[4]) + N[7]*(M[8] + M[3]) + N[8]*(M[2] + M[7]) + N[9]*(M[6] + M[1]);\n\n\t\tprintf(\"%I64d\\n\", sum);\n\t\treturn 0;\n}\n\n\n\n"}, {"source_code": "#include \n\nint main()\n{\n\tint a,b;\n\tscanf(\"%d %d\",&a, &b);\n\tunsigned long long f0,f1,f2,f3,f4,s0,s1,s2,s3,s4;\n\tf0 = a / 5;\n\tf1 = a / 5 + (a % 5 > 0 ? 1 : 0);\n\tf2 = a / 5 + (a % 5 > 1 ? 1 : 0);\n\tf3 = a / 5 + (a % 5 > 2 ? 1 : 0);\n\tf4 = a / 5 + (a % 5 > 3 ? 1 : 0);\n\ts0 = b / 5;\n\ts1 = b / 5 + (b % 5 > 0 ? 1 : 0);\n\ts2 = b / 5 + (b % 5 > 1 ? 1 : 0);\n\ts3 = b / 5 + (b % 5 > 2 ? 1 : 0);\n\ts4 = b / 5 + (b % 5 > 3 ? 1 : 0);\n\tprintf(\"%llu\", f0 * s0 + f1 * s4 + f2 * s3 + f3 *s2 + f4 * s1);\n}"}, {"source_code": "#include\nint main()\n{\n long long int n,m,a,b,c,d,tot=0;\n scanf(\"%lld %lld\",&n,&m);\n a=m/5;\n\n tot=a*n;\n\n\n c=m%5;\n\n d=n/5;\n\n tot=tot+c*d;\n\n\n b=m%5;\n c=n%5;\n d=b+c;\n d=d-4;\n if(d>0)\n tot=tot+d;\n\n\n printf(\"%lld\\n\",tot);\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n long long int n, m, i, num = 0, t;\n\n scanf(\"%lld%lld\", &n, &m);\n\n if(n <= m)\n {\n for(i = 0;i < 5;i++)\n {\n if(i == 0)\n {\n t = (n / 5) * (m / 5);\n num += t;\n }\n else\n {\n if(i <= n && (5 - i) <= m)\n {\n t = ((n - i) / 5 + 1) * ((m + i - 5) / 5 + 1);\n num += t;\n }\n }\n }\n }\n else\n {\n for(i = 0;i < 5;i++)\n {\n if(i == 0)\n {\n t = (n / 5) * (m / 5);\n num += t;\n }\n else\n {\n if(i <= m && (5 - i) <= n)\n {\n t = ((n + i - 5) / 5 + 1) * ((m - i) / 5 + 1);\n num += t;\n }\n }\n\n }\n }\n\n printf(\"%lld\", num);\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n long long int m,n,i,ans=0,temp;\n scanf(\"%lld %lld\",&n,&m);\n\n\n for(i=1;i<=n;i++)\n {\n temp=i%5;\n long long int d=m-5+temp;\n if(d>=0)\n {\n ans++;\n ans=ans+d/5;\n }\n }\n printf(\"%lld\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,m,i,k;\n\tlong long int sum=0; \n\tscanf(\"%d%d\",&n,&m);\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tsum=sum+(m+i%5)/5;\n\t}\n\tprintf(\"%lld\\n\",sum);\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tlong long int a,b,n,m,x,y,i;\n\tlong long int ans=0;\n\tscanf(\"%lld%lld\",&n,&m);\n\t\ta=n/10;\n\t\ta=a*10;\n\t\tb=m/10;\n\t\tb=b*10;\n\t\t//printf(\"%lld\\n%lld\",x,y);\n\t\tans=(a*b*2)/10;\n\t\t\n\t\tfor(x=1;x<=a;x++)\n\t\t\t{\n\t\t\n\t\t\t\tfor(y=b+1;y<=m;y++)\n\t\t\t\t{\n\t\t\t\tif((x+y)%5==0)\n\t\t\t\tans++;\n\t\t\t\t}\n\t\t\t}\n\t\tfor(y=a+1;y<=n;y++)\n\t\t\t{\n\t\t\n\t\t\t\tfor(x=1;x<=m;x++)\n\t\t\t\t{\n\t\t\t\tif((x+y)%5==0)\n\t\t\t\tans++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\n\t\t\n\t\n\tprintf(\"%lld\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n,m,x,i,a,b,c,d,sum=0;\n scanf(\"%lld%lld\",&m,&n);\n if(n>m){\n x=n;\n n=m;\n m=x;\n }\n for(i=m;i>=1;i--){\n a=i+n;\n b=a/5;\n c=i/5;\n d=b-c;\n sum=sum+d;\n }\n printf(\"%lld\",sum);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n long long int x, y, res, rem, div, div2, i, j, sum, count, ara[5];\n while(scanf(\"%lld%lld\", &x, &y)==2)\n {\n count=0;\n if(x<5 || y<5){\n for(i=1; i<=x; i++)\n for(j=1; j<=y; j++)\n {\n sum=i+j;\n if(sum%5==0) count++;\n }\n printf(\"%d\\n\", count);\n }\n else{\n div=y/5;\n div2=x/5;\n rem=x%5;\n if(((div*5)+4)<=y)\n {\n ara[1]=div+1;\n }\n else ara[1]=div;\n\n if(((div*5)+3)<=y){\n ara[2]=div+1;\n }\n else ara[2]=div;\n\n if(((div*5)+2)<=y)\n {\n ara[3]=div+1;\n }\n else ara[3]=div;\n\n if(((div*5)+1)<=y)\n {\n ara[4]=div+1;\n }\n else ara[4]=div;\n if(((div*5)+5)<=y)\n {\n ara[5]=div+1;\n }\n else ara[5]=div;\n res=div2*(ara[1]+ara[2]+ara[3]+ara[4]+ara[5]);\n for(i=1; i<=rem; i++)\n {\n res+=ara[i];\n }\n printf(\"%lld\\n\", res);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n,m,i,j,k,count,vag1,vag2,vag,t,temp,p;\n scanf(\"%I64d %I64d\",&n,&m);\n count=0;\n if(n+m>=5){\n if(n>m){\n temp=n;\n n=m;\n m=temp;\n }\n for(i=1;i<=n;i++){\n k=1;\n t=k;\n while((i+k)%5!=0){\n\n k++;\n t=k;\n }\n p=(m-t+5)/5;\n count+=p;\n }\n printf(\"%I64d\\n\",count);\n }\n else\n printf(\"0\\n\",count);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n //input\n unsigned long long int n, m;\n scanf(\"%lld %lld\", &n, &m);\n unsigned long long int max, min;\n if(n > m)\n {\n max = n;\n min = m;\n }\n else\n {\n max = m;\n min = n;\n }\n\n unsigned long long int count = min * (max/5);\n\n for(int i = 1; i <= min; i++)\n for(int j = 1; j <= max%5; j++)\n if((i+j) % 5 == 0) count++;\n\n printf(\"%lld\", count);\n\n return 0;\n}\n"}, {"source_code": "/* AUTHOR:AKASH JAIN\n* USERNAME:akash19jain \n* DATE:09/07/2019 \n*/\n#include\n#include\n#include\n#include\n#include\n#define MOD 1000000007\nint cmp(const void * a,const void * b);\n\nint main()\n{\n \n long long t=1;\n //scanf(\"%lld\",&t);\n while(t--)\n {\n long long n,m,sum=0;\n scanf(\"%lld%lld\",&n,&m);\n for(long long i=1;i<=n;i++)\n {\n sum+=(m+i%5)/5;\n }\n printf(\"%lld\\n\",sum);\n }\n return 0;\n}\n\n\n//qsort(a,n,sizeof(a[0]),cmp);\nint cmp(const void * a,const void * b)\n{\n return (*(int*)a - *(int*)b);\n}"}, {"source_code": "#include\nint main()\n{long long int n,m,i,j,sum=0;\nscanf(\"%lld%lld\",&n,&m);\nfor(i=1;i<=n;i++)\n{sum=sum+((m+i)/5-i/5);}\n\nprintf(\"%lld\",sum);\nreturn 0;\n}\n\n"}, {"source_code": "#include \n#include \n#include \n#include \n\nint main()\n{\n long long int n,m,t,i,p=0;\n scanf(\" %lld %lld\",&n,&m);\n for(i=1;i<=n;i++){\n\n\n p+=(m+i)/5 - i/5;\n\n\n\n }\n printf(\"%lld\",p);\n return 0;\n}\n\n"}, {"source_code": "#include \n\nint main(void)\n{\n\tlong long int v_M, v_N, v_CT = 0;\n\t\n\tscanf(\"%I64d %I64d\", &v_M, &v_N);\n\t\n\tif(v_M > v_N)\n\t{\n\t\tv_M += v_N;\n\t\tv_N = v_M - v_N;\n\t\tv_M -= v_N;\n\t}\n\t\n\tif(v_M < 5 && v_N < 5)\n\t{\n\t\tfor(long long int i = 1; i <= v_M; i++)\n\t\t{\n\t\t\tfor(long long int j = 1; j <= v_N; j++)\n\t\t\t{\n\t\t\t\tif((i + j) == 5)\n\t\t\t\t\tv_CT++;\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tfor(long long int i = 1; i <= v_M; i++)\n\t\t{\n\t\t\tif(i != 5)\n\t\t\t\tv_CT += (v_N - ((((i / 5) + 1) * 5) - i)) / 5 + 1;\n\t\t\telse\n\t\t\t\tv_CT += v_N / 5;\n\t\t}\n\t}\n\t\n\tprintf(\"%I64d\", v_CT);\n\t\n\treturn(0);\n}"}, {"source_code": "#include\nint main()\n{\n long int i,j,k,n,m;\n long long s;\n while(scanf(\"%ld %ld\",&n,&m)!=EOF)\n {\n s=0;\n for(i=1;i<=n;i++)\n {\n j=(m+i)/5;\n k=i/5;\n s+=j-k;\n //s+=m/5;\n /*k=1;\n j=(5-i%5)%5;\n if(j==0)\n k=0;\n s+=(m-j)/5+k;*/\n }\n printf(\"%I64d\\n\",s);\n }\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include \n\nint main()\n{\n int n,m,count=0;\n int rem;\n scanf(\"%d %d\",&n,&m);\n if(n>m)\n {\n int temp=m;\n m=n;\n n=temp;\n }\n for(int i=1;i<=m;i++)\n {\n rem=5*(i/5 + 1) -i;\n \n if(rem==5)\n rem=0;\n \n for(int j=5-rem;j<=n;j+=5)\n {\n count++;\n }\n }\n printf(\"%d\",count);\n}"}, {"source_code": "#include\nint main(){\nint n,m,x,y,i,j,p=0,d;\nscanf(\"%d %d\",&n,&m);\nfor(i=1;i<=n;i++){\n d=(m+i)/5-i/5;\n p=p+d;\n }\nprintf(\"%d\",p);\nreturn 0;\n}\n"}, {"source_code": "#include\n#include\n#include\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,chk=0,z=0,k=0,t=0,s=0,max=0,min=0,d=0;\n long long sum=0;\n int a[2000005]={0},b[5000]={0},c[1000001]={0},y[1000001]={0};\n scanf(\"%d%d\",&n,&m);\n if(n<5&&m<5)\n {\n for(i=1;i<=n;i++)\n {\n for(j=1;j<=m;j++)\n {\n if((i+j)%5==0)\n chk++;\n }\n }\n printf(\"%d\",chk);\n return 0;\n }\n t=n/5;\n s=m/5;\n sum+=(s*t*5);\n sum+=(t*(m%5));\n sum+=(s*(n%5));\n printf(\"%lld\",sum);\n return 0;\n}"}, {"source_code": "#include\n#include\n#define max(a,b) (a)>(b)?(a):(b)\n#define min(a,b) (a)<(b)?(a):(b)\nint main()\n{\n long long a,b;\n long long c=0,n=1,t=5,temp;\n scanf(\"%lld%lld\",&a,&b);\n long long minimum=(min(a,b)),maximum=(max(a,b));\n if((a==b&&a<3))\n printf(\"0\");\n else if(a==b&&a==3)\n printf(\"2\");\n else if(a==b&&a%10==0&&b%10==0)\n printf(\"%lld\",a*(b/10)*2);\n else\n {\n while(n<=minimum)\n {\n temp=abs(n-t);\n if(n%5!=0&&(maximum-temp)>0)\n c+=((maximum-temp)/5)+1;\n else\n c+=((maximum-temp)/5);\n n++;\n if((n-t)>0)\n t+=5;\n }\n printf(\"%lld\",c);\n }\n return 0;\n}"}, {"source_code": "#include \n\nint main(void)\n{\n\tlong long int v_M, v_N, v_CT = 0;\n\t\n\tscanf(\"%I64d %I64d\", &v_M, &v_N);\n\t\n\tfor(long long int i = 1; i <= v_M; i++)\n\t{\n\t\tif(i != 5)\n\t\t\tv_CT += (v_N - ((((i / 5) + 1) * 5) - i)) / 5 + 1;\n\t\telse\n\t\t\tv_CT += v_N / 5;\n\t}\n\t\n\tprintf(\"%I64d\", v_CT);\n\t\n\treturn(0);\n}"}, {"source_code": "#include\nint main()\n{\n int n,m;\n long long cnt=0;\n scanf(\"%d %d\",&n,&m);\n int mx,lo;\n if(n>m)\n {\n mx=n;\n lo=m;\n }\n else\n {\n mx=m;\n lo=n;\n }\n for(int i=1;i<=lo;i++)\n {\n if(i<=mx)\n {\n cnt++;\n cnt+=(mx-(5-i%5))/5;\n }\n }\n printf(\"%lld\\n\",cnt);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,i,j,c=0,x,y,z;\n scanf(\"%d%d\",&a,&b);\n for(i=1;i<=5;i++)\n {\n x=0;\n y=0;\n if(a>=i)\n {\n x=(a-i)/5+1;\n }\n z=(5-(i%5));\n if(b>=z)\n {\n y=(b-z)/5+1;\n }\n c=x*y + c;\n }\n\n printf(\"%d\\n\",c);\n return 0;\n}\n"}, {"source_code": "#ifdef ONLINE_JUDGE\n #define NDEBUG 1\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#define long int64_t\n#define fore(i,k,n) for (int _k = (k), _n = (n), i = _k; i <= _n; ++i)\n#define forr(i,n,k) for (int _k = (k), _n = (n), i = _n; i >= _k; --i)\n#define scani(x) int x; scanf(\"%d\", &x)\n#define scans(x) static char x[LEN]; scanf(\"%s\", x)\n#define LIST_INIT_CAP 4\n#define HASH_INIT_CAP 64\n#define HASH_SKIP 11\n#define TREE_INIT_CAP 1024\n#define TREE_MAX_HEIGHT 64\n#define DEQUE_INIT_CAP 1024\n#define HEAP_INIT_CAP 1024\n#define TAKEN 1\n#define EMPTY 0\n#define TOMB -1\n#define max(a,b) (((a)>(b))?(a):(b))\n#define min(a,b) (((a)<(b))?(a):(b))\n\n#define N 100004\n\n\nint main() {\n scani(n);\n scani(m);\n if (n > m) { int t = n; n = m; m = t; }\n long answer = 0;\n fore (i, 1, n) {\n int t = 5 - i % 5;\n if (t == 0) t = 5;\n if (m > t) {\n ++answer;\n answer += (long)(m - t) / 5;\n }\n }\n printf(\"%I64d\", answer);\n\n return 0;\n}\n"}, {"source_code": "#include\n#define max(a,b) (a)>(b)?(a):(b)\n#define min(a,b) (a)<(b)?(a):(b)\nint main()\n{\n long a,b;\n long c=0,n=1,t=5,temp;\n scanf(\"%ld%ld\",&a,&b);\n long minimum=(min(a,b)),maximum=(max(a,b));\n while(n<=minimum)\n {\n temp=abs(n-t);\n if(n%5!=0)\n c+=((maximum-temp)/5)+1;\n else\n c+=((maximum-temp)/5);\n n++;\n if((n-t)>0)\n t+=5;\n }\n printf(\"%ld\",c);\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n long m, n;\n scanf(\"%d %d\", &m, &n);\n \n long m_div = m / 5;\n long n_div = n / 5;\n long m_rem = m % 5;\n long n_rem = n % 5;\n \n long count = m_div * n_div;\n \n for(int i = 1 ; i < 5 ; i++)\n {\n int j = 5 - i;\n \n long m_tmp = m_div;\n long n_tmp = n_div;\n \n if(i <= m_rem)\n {\n m_tmp++;\n }\n \n if(j <= n_rem)\n {\n n_tmp++;\n }\n \n count += m_tmp * n_tmp;\n }\n \n printf(\"%d\\n\", count);\n}"}, {"source_code": "#include \n\nint main() {\n\tstatic int kk1[5], kk2[5];\n\tint n, m, x, a, b, c, d, e;\n\n\tscanf(\"%d%d\", &n, &m);\n\tfor (x = 1; x <= n; x++)\n\t\tkk1[x % 5]++;\n\tfor (x = 1; x <= m; x++)\n\t\tkk2[x % 5]++;\n\ta = kk1[0] * kk2[0];\n\tb = kk1[1] * kk2[4];\n\tc = kk1[2] * kk2[3];\n\td = kk1[3] * kk2[2];\n\te = kk1[4] * kk2[1];\n\tprintf(\"%lld\\n\", (long long) a + b + c + d + e);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n unsigned long m,n,k;\n unsigned long a=0,b=0,c=0,d=0,e=0;\n unsigned long a1=0, b1=0, c1=0, d1=0, e1=0;\n scanf(\"%d%d\", &m,&n);\n\n if(m>n){\n k=m;\n m=n;\n n=k;\n }\n\n for(unsigned long i=1;i<=m;i++){\n if(i%5==1){\n a++;\n }else if(i%5==2){\n b++;\n }else if(i%5==3){\n c++;\n }else if(i%5==4){\n d++;\n }else{\n e++;\n }\n\n }\n\n for(unsigned long i=1;i<=n;i++){\n if(i%5==1){\n d1++;\n }else if(i%5==2){\n c1++;\n }else if(i%5==3){\n b1++;\n }else if(i%5==4){\n a1++;\n }else{\n e1++;\n }\n }\n\n printf(\"%lu\", (unsigned long)(a*a1 + b*b1 + c*c1 + d*d1 + e*e1));\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n,m,i,j,k,count,vag1,vag2,vag,t;\n scanf(\"%I64d %I64d\",&n,&m);\n count=0;\n if(n+m>=5){\n for(i=1;i<=n;i++){\n k=1;\n t=k;\n while((i+k)%5!=0){\n\n k++;\n t=k;\n }\n vag=(m-t)/5 + 1;\n count+=vag;\n\n }\n printf(\"%I64d\\n\",count);\n }\n else\n printf(\"0\\n\",count);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n,m,i,j,k,count,vag1,vag2,vag,t;\n scanf(\"%I64d %I64d\",&n,&m);\n count=0;\n if(n+m>=5){\n for(i=1;i<=n;i++){\n k=1;\n t=k;\n while((i+k)%5!=0){\n\n k++;\n t=k;\n }\n vag=(m-t)/5 + 1;\n count+=vag;\n\n }\n printf(\"%I64d\\n\",count);\n }\n else\n printf(\"0\\n\",count);\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#define mod 100000007\n//int x[100005]= {0};\nint main()\n{\n long long int x,y,i,r,d,c,Ans=0;\n\n scanf(\"%I64d %I64d\",&x,&y);\n\n for(i=1; i<=x; i++)\n {\n c=0;\n if(i%5==0)\n {\n if(y>=5)\n {\n d=(y-3)/5;\n Ans+=d+1;\n }\n }\n else if(i%5==1)\n {\n if(y>=4)\n {\n d=(y-3)/5;\n Ans+=d+1;\n }\n }\n else if(i%5==2)\n {\n if(y>=3)\n {\n d=(y-3)/5;\n Ans+=d+1;\n }\n }\n else if(i%5==3)\n {\n if(y>=2)\n {\n d=(y-3)/5;\n Ans+=d+1;\n }\n }\n else if(i%5==4)\n {\n if(y>=1)\n {\n d=(y-3)/5;\n Ans+=d+1;\n }\n }\n }\n printf(\"%I64d\",Ans);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n\n int x,y,i,j,k,c,l,sum;\n\n scanf(\"%d %d\",&x,&y);\n\n c = 0;\n\n i = 1;\n j = 1;\n\n for(i=1;i<=x;i++){\n for(j=1;j<=5;j++){\n sum = i + j;\n if(sum%5==0 && j<=y){\n c = c + 1;\n c = c + (y-j)/5;\n break;\n }\n\n\n\n }\n\n }\n\n\n\n\n printf(\"%d\\n\",c);\n\n\n\n\n\n return 0;\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int m,n,i,j,k;\n\n scanf(\"%d %d\",&n,&m);\n long long int ctr=0;\n\n for(int i=1;i<=n;i++)\n {\n ctr=ctr+(long long int)((m-5+i%5)/5);\n }\n\n printf(\"%lld\\n\",ctr+n);\n\n return 0;\n}\n"}, {"source_code": "#include \n\n\nint main()\n{\n int n, m, mx[6], nx[6], i, ways;\n\n\n while(scanf(\"%d %d\", &m, &n) != EOF){\n for(i=0; i<6; i++){\n mx[i] = m/5;\n nx[i] = n/5;\n }\n for(i=1; i<=(m%5); i++) mx[i]++;\n for(i=1; i<=(n%5); i++) nx[i]++;\n ways = mx[5] * nx[5] + mx[1] * nx[4] + mx[2] * nx[3] + mx[3] * nx[2] + mx[4] * nx[1];\n printf(\"%d\\n\", ways);\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\n#define __max(a, b) (((a) > (b)) ? (a) : (b))\n#define __min(a, b) (((a) < (b)) ? (a) : (b))\n\nint main()\n{\n\tint n, m;\n\tscanf(\"%d %d\\n\", &n, &m);\n\n\tif (n+m < 5)\n\t{\n\t\tputs(\"0\");\n\t\treturn 0;\n\t}\n\n\tlong long count = 0;\n\tint n1 = __min(n, m);\n\tint m1 = __max(n, m);\n\tfor (int i = 1; i < n1 + 1; ++i)\n\t{\n\t\t// printf(\"%d\\n\", ((m - (m + i) % 5 - 1) / 5 + 1));\n\t\tcount += ((m1 - (m1 + i) % 5 - 1) / 5 + 1);\n\t}\n\tprintf(\"%I64d\", count);\n\n\treturn 0;\n\n}\n\n/*\n0 5 10 15 20 25 30\n\n\n1 4 9 14 19 24 29\n2 3 8 13 18 23 28\n3 2 7 12 17 22 27\n4 1 6 11 16 21 26\n5 5 10 15 20 25 30\n6 4 9 14 19 24 29\n7 3 8 13 18 23 28\n8 2 7 12 17 22 27\n9 1 6 11 16 21 26\n10 5 10 15 20 25\n11 4 9 14 19 24\n\n\n\n*/\n"}, {"source_code": "#include\n#include\n#include\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,chk=0,z=0,k=0,t=0,s=0,max=0,min=0,d=0;\n long long sum=0;\n int a[2000005]={0},b[5000]={0},c[1000001]={0},y[1000001]={0};\n scanf(\"%d%d\",&n,&m);\n if(n<5&&m<5)\n {\n for(i=1;i<=n;i++)\n {\n for(j=1;j<=m;j++)\n {\n if((i+j)%5==0)\n chk++;\n }\n }\n printf(\"%d\",chk);\n return 0;\n }\n t=n/5;\n s=m/5;\n d=n%5;\n z=m%5;\n sum+=(s*t*5);\n //sum+=(t*z)\n //sum+=(s*d);\n for(i=d*5+1;i<=n;i++)\n {\n for(j=z*5+1;j<=m;j++)\n {\n if((i+j)%5==0)\n sum++;\n }\n }\n printf(\"%lld\",sum);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,m,i;\n \n int sum=0;\n scanf(\"%d%d\",&n,&m);\n for(i=1;i<=m;i++)\n {\n sum=sum+(((i+n)/5)-(i/5));\n }\n printf(\"%d\",sum);\n return 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n long long int n, m;\n long long int result;\n scanf(\"%lld %lld\",&n,&m);\n double temp = n*m;\n result = (int)((temp/5)+.5);\n printf(\"%lld\",result);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint n,m,i,sum=0,k;\n\tscanf(\"%d%d\",&n,&m);\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tfor(k=1;k<=2*(m/5)+1;k++){\n\t\tif(5*k-i<=m && 5*k-i>0)\n\t\tsum++;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",sum);\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main ()\n{\n int n , m , i;\n int cnt =0;\n scanf(\"%d%d\",&n,&m);\n for (i=1;i<=n;i++)\n {\n cnt+=(i+m)/5-i/5;\n\n }\n printf(\"%d\\n\",cnt);\n return 0 ;\n}"}, {"source_code": "#include \n\nint main()\n{\n long long int n, m;\n long long int result;\n scanf(\"%lld %lld\",&n,&m);\n double temp = n*m;\n result = (int)((temp/5)+.5);\n printf(\"%lld\",result);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int a,b,i,j,x,y,z;\n double c=0;\n scanf(\"%d%d\",&a,&b);\n int r1=a%5;\n int r2=b%5;\n\n for(i=1;i<=4;i++)\n {\n x=a/5;\n y=b/5;\n if(r1>=i)\n {\n x=x+1;\n }\n if(r2>=(5-i))\n {\n y=y+1;\n }\n c=x*y + c;\n }\n c=c+(a/5)*(b/5);\n\n printf(\"%lld\\n\",c);\n return 0;\n}\n"}, {"source_code": "#include \nint a[6],b[6];\nint main()\n{\n\tlong long n,m,i,sum,j;\n\tscanf(\"%lld%lld\",&n,&m);\n\tfor(i=1;i<=n;i++)\n\t\ta[i%5]++;\n\tfor(i=1;i<=m;i++)\n\t\tb[i%5]++;\n\tsum=a[0]*b[0];\n\tfor(i=1,j=4;i<=4&&j>=0;i++,j--){\n\t\tsum+=a[i]*b[j];\n\t}\n\tprintf(\"%lld\",sum);\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 \n\nint main()\n{\n int n , m ,p , i;\n long int sum = 0;\n scanf(\"%d %d\",&n,&m);\n if (n > 4){\n for (i=0;i<5;i++){\n sum = sum + (i+m)/5;\n }\n sum = sum*(n/5);\n p = n%5;\n for (i=1;i\n\nint main()\n {\n int n,m,d=0,i;\n scanf(\"%d %d\",&n,&m);\n for(i=1;i<=n;i++)\n {\n d+=(m+i%5)/5;\n }\n printf(\"%d\",d);\n }\n\n\n\n"}, {"source_code": "#include \n#include \n#include \n#include\nlong long p[10],q[10];\nint main()\n{\n\tint n,x,y,l;\n\tlong long ans=0,i,j,k,a,b; \n\tscanf(\"%I64d%I64d\",&a,&b);\n\tfor(i=1;i<=a;i++)\n\t\tp[i%5]++;\n\tfor(i=1;i<=b;i++)\n\t\tq[i%5]++;\n\tans+=p[1]*q[4];\n\tans+=p[2]*q[3];\n\tans+=p[3]*q[2];\n\tans+=p[4]*q[1];\n\tans+=p[0]*q[01];\n \tprintf(\"%I64d\",ans);\nreturn 0;\n}\n\n"}, {"source_code": "#include\n#include\nint main()\n{\n int64_t n,m,y=0;\n scanf(\"%I64d%I64d\",&n,&m);\n y=(n*m)/5;\n if(n%2&&n!=1&&n%5&&m%2==0)\n y=y+1;\n printf(\"%I64d\",y);\n return 0;\n}"}, {"source_code": "#include\nint main(){\n\tlong i,n,m,count=0,min,max;\n\tscanf(\"%ld %ld\",&n,&m);\n\tmin=n;max=m;\n\tif(n>m){\n\t\tmax=n;\n\t\tmin=m;\n\t}\n\tfor(i=1;i<=min;i++){\n\t\tcount+=max/5;\n\t\tif((max%5)>=5-(i%5))\n\t\t\tcount++;\n\t}\n\tprintf(\"%ld\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int n,m;\n long long int count=0;\n int rem,mrem;\n scanf(\"%d %d\",&n,&m);\n if(n>m)\n {\n int temp=m;\n m=n;\n n=temp;\n }\n mrem=m%5;\n for(int i=1;i<=n;i++)\n {\n rem=i%5;\n if(mrem>=5-rem)\n {\n count+=(m-mrem)/5 + 1;\n \n }\n else\n {\n count+=(m-mrem)/5;\n \n }\n }\n\n printf(\"%ll\",count);\n}"}, {"source_code": "#include \n\nint main ()\n{\n int n , m , i;\n int cnt =0;\n scanf(\"%d%d\",&n,&m);\n for (i=1;i<=n;i++)\n {\n cnt+=(i+m)/5-i/5;\n\n }\n printf(\"%d\\n\",cnt);\n return 0 ;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n long long a,b;\n scanf(\"%lld%lld\",&a,&b);\n if(a==b&&a%10==0)\n printf(\"%lld\",a*((b*2)/10));\n else if((a*b)>100000&&a!=1&&b!=1)\n printf(\"%lld\",(long long)round((a*b)/5.0)+1);\n else\n printf(\"%lld\",(long long)round((a*b)/5.0));\n}"}, {"source_code": "#include \n\nint main()\n{\n int n,m;\n long long int count=0;\n int rem,mrem;\n scanf(\"%d %d\",&n,&m);\n if(n>m)\n {\n int temp=m;\n m=n;\n n=temp;\n }\n mrem=m%5;\n for(int i=1;i<=n;i++)\n {\n rem=i%5;\n if(mrem>=5-rem)\n {\n count+=(m-mrem)/5 + 1;\n \n }\n else\n {\n count+=(m-mrem)/5;\n \n }\n }\n\n printf(\"%ll\",count);\n}"}, {"source_code": "#include \n\n\nint main()\n{\n int n, m, mx[6], nx[6], i, ways;\n\n\n while(scanf(\"%d %d\", &m, &n) != EOF){\n for(i=0; i<6; i++){\n mx[i] = m/5;\n nx[i] = n/5;\n }\n for(i=1; i<=(m%5); i++) mx[i]++;\n for(i=1; i<=(n%5); i++) nx[i]++;\n ways = mx[5] * nx[5] + mx[1] * nx[4] + mx[2] * nx[3] + mx[3] * nx[2] + mx[4] * nx[1];\n printf(\"%d\\n\", ways);\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n long long int n, m, i, num = 0, t;\n\n scanf(\"%lld%lld\", &n, &m);\n\n if(n <= m)\n {\n for(i = 0;i < 5;i++)\n {\n if(i == 0)\n {\n t = (n / 5) * (m / 5);\n }\n else\n {\n if(i > n || (5 - i) > m)\n break;\n\n t = ((n - i) / 5 + 1) * ((m + i - 5) / 5 + 1);\n }\n\n num += t;\n }\n }\n else\n {\n for(i = 0;i < 5;i++)\n {\n if(i == 0)\n {\n t = (n / 5) * (m / 5);\n }\n else\n {\n if(i > m || (5 - i) > n)\n break;\n\n t = ((n + i - 5) / 5 + 1) * ((m - i) / 5 + 1);\n }\n\n num += t;\n }\n }\n\n printf(\"%lld\", num);\n\n return 0;\n}\n"}, {"source_code": "#include\nint a[5]={0};\nint b[5]={0};\nint main(){\n long long m,n,i,count=0;\n scanf(\"%I64d%I64d\",&m,&n);\n for(i=1;i<=m;i++){\n a[i%5]++;\n }\n for(i=1;i<=n;i++){\n b[i%5]++;\n }\n count=a[0]*b[0]+a[1]*b[4]+a[2]*b[3]+a[3]*b[2]+a[4]*b[1];\n printf(\"%I64d\",count);\n scanf(\" \");\n return 0;\n}\n"}, {"source_code": "#include \nvoid ans(int a,int b)\n{\n int a1=a%5;\n int a2=b%5;\n \n int sum=0;\n if(a1+a2>=5)\n sum+=a1+a2-4;\n \n sum+=5*(a/5)*(b/5)+a1*(b/5)+a2*(a/5);\n printf(\"%d\\n\" , sum);\n \n}\n\nint main()\n{\n int a,b;\n scanf(\"%d%d\", &a, &b);\n ans(a,b);\n}"}, {"source_code": "#include \n\nint main()\n{\n long long int n, m;\n long long int result;\n scanf(\"%lld %lld\",&n,&m);\n double temp = n*m;\n result = (int)((temp/5)+.5);\n printf(\"%lld\",result);\n return 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n int i,j,n,m,k=0,a=0,b,c;\n scanf(\"%d %d\",&n,&m);\n for(i=1;i<=n;i++){\n a=0;\n a=m+i;\n k=k+(a/5);\n if(i>=5){\n c=i/5;\n k=k-c;\n }\n }\n printf(\"%d\\n\",k);\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n long long a,b;\n scanf(\"%lld%lld\",&a,&b);\n if(a==b&&a%10==0)\n printf(\"%lld\",a*((b*2)/10));\n else if((a*b)>100000)\n printf(\"%lld\",(long long)round((a*b)/5.0)+1);\n else\n printf(\"%lld\",(long long)round((a*b)/5.0));\n}"}, {"source_code": "#include \n#include \n\n#define __max(a, b) (((a) > (b)) ? (a) : (b))\n#define __min(a, b) (((a) < (b)) ? (a) : (b))\n\nint main()\n{\n\tint n, m;\n\tscanf(\"%d %d\\n\", &n, &m);\n\n\tif (n < 5 && m < 5)\n\t{\n\t\tputs(\"0\");\n\t\treturn 0;\n\t}\n\n\tlong long count = 0;\n\tint n1 = __min(n, m);\n\tint m1 = __max(n, m);\n\tfor (int i = 1; i < n1 + 1; ++i)\n\t{\n\t\t// printf(\"%d\\n\", ((m - (m + i) % 5 - 1) / 5 + 1));\n\t\tcount += ((m1 - (m1 + i) % 5 - 1) / 5 + 1);\n\t}\n\tprintf(\"%I64d\", count);\n\n\treturn 0;\n\n}\n\n/*\n0 5 10 15 20 25 30\n\n\n1 4 9 14 19 24 29\n2 3 8 13 18 23 28\n3 2 7 12 17 22 27\n4 1 6 11 16 21 26\n5 5 10 15 20 25 30\n6 4 9 14 19 24 29\n7 3 8 13 18 23 28\n8 2 7 12 17 22 27\n9 1 6 11 16 21 26\n10 5 10 15 20 25\n11 4 9 14 19 24\n\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 \n\nint main()\n{\n int n , m , sum = 0 ,p , i;\n scanf(\"%d %d\",&n,&m);\n if (n > 5){\n for (i=0;i<5;i++){\n sum = sum + (i+m)/5;\n }\n sum = sum*(n/5);\n p = n%5;\n for (i=1;i\n#include \n\nint main()\n{\n\tlong x,y;\n\tscanf(\"%ld %ld\",&x,&y);\n\tlong i,j;\n\tlong long count = 0;\n\n\ti = x/5;\n\tj = y/5;\n\tcount = i*j*5;\n\tint m,n;\n\tm=x%5;\n\tn=y%5;\n\tcount = count + m*j + n * i;\n\tif ((n+m)==5) count++;\n\telse if ((n+m)==6) count = count + 2;\n\telse if ((n+m)==7) count = count +3;\n\telse if ((n+m)==8) count = count + 4;\n\tprintf(\"%I64d\",count);\n\treturn 0;\n}"}, {"source_code": "#include \nint main(int argc, char const *argv[])\n{\n\tint x, y,i;\n\tscanf(\"%d %d\", &x, &y);\n\tint xl = x/5;\n\tint yl = y/5;\n\tint c = xl * yl * 5;\n\tint xm = x % 5;\n\tint ym = y % 5;\n\tc += xm * yl;\n\tc += ym * xl;\n\tfor (i = xm; i > 0; --i)\n\t{\n\t\tif(ym >= 5-i) c++;\n\t}\n\tprintf(\"%d\\n\", c);\n\treturn 0;\n}"}, {"source_code": "#include \nint main(int argc, char const *argv[])\n{\n\tint x, y,i;\n\tscanf(\"%d %d\", &x, &y);\n\tint xl = x/5;\n\tint yl = y/5;\n\tint c = xl * yl * 5;\n\tint xm = x % 5;\n\tint ym = y % 5;\n\tc += xm * yl;\n\tc += ym * xl;\n\tfor (i = xm; i > 0; --i)\n\t{\n\t\tif(ym >= 5-xm) c++;\n\t}\n\tprintf(\"%d\\n\", c);\n\treturn 0;\n}"}, {"source_code": "#include \nint main() {\n\tlong m, n, i, temp;\n\tlong count = 0;\n\n\tscanf(\"%d %d\", &n, &m);\n\tfor (i = 1; i <= n; i++) {\n\t\ttemp = (m + i % 5) / 5;\n\t\tcount += temp;\n\t}\n\tprintf(\"%d\", count);\n\n\treturn 0;\n}"}, {"source_code": "#include\n#include\n\nint main()\n{\n\tlong int n,m,i,j,count=0;\n\tscanf(\"%ld%ld\",&n,&m);\n\tcount=(n/5)*(m/5)*5;\n\tfor(i=0;i<=m%5;i++)\n\t\tfor(j=0;j<=n%5;j++)\n\t\t\tif(i+j==5)\n\t\t\t\tcount++;\n\tcount+=(m%5)*(n/5);\n\tcount+=(n%5)*(m/5);\n\tprintf(\"%ld\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\n#define __max(a, b) (((a) > (b)) ? (a) : (b))\n#define __min(a, b) (((a) < (b)) ? (a) : (b))\n\nint main()\n{\n\tint n, m;\n\tscanf(\"%d %d\\n\", &n, &m);\n\n\tif (n+m < 5)\n\t{\n\t\tputs(\"0\");\n\t\treturn 0;\n\t}\n\n\tlong long count = 0;\n\tint n1 = __min(n, m);\n\tint m1 = __max(n, m);\n\tfor (int i = 1; i < n1 + 1; ++i)\n\t{\n\t\t// printf(\"%d\\n\", ((m - (m + i) % 5 - 1) / 5 + 1));\n\t\tcount += ((m1 - (m1 + i) % 5 - 1) / 5 + 1);\n\t}\n\tprintf(\"%I64d\", count);\n\n\treturn 0;\n\n}\n\n/*\n0 5 10 15 20 25 30\n\n\n1 4 9 14 19 24 29\n2 3 8 13 18 23 28\n3 2 7 12 17 22 27\n4 1 6 11 16 21 26\n5 5 10 15 20 25 30\n6 4 9 14 19 24 29\n7 3 8 13 18 23 28\n8 2 7 12 17 22 27\n9 1 6 11 16 21 26\n10 5 10 15 20 25\n11 4 9 14 19 24\n\n\n\n*/\n"}, {"source_code": "#include\nint main(){\n\tint n,m,div,rem,output;\n\tscanf(\"%d %d\",&n,&m);\n\tdiv=m/5;\n\trem=m%5;\n\toutput=n*(div)+((n/5)*rem);\n\tif((n%5)&&rem){\n\t\t\n\t\tif((n%5)==1){\n\t\t\tif(rem==4){\n\t\t\t\toutput++;\n\t\t\t}\n\t\t}\n\t\tif((n%5)==2){\n\t\t\tif(rem==4){\n\t\t\t\toutput+=2;\n\t\t\t}\n\t\t\telse if (rem==3){\n\t\t\t\toutput+=1;\n\t\t\t}\n\t\t}\n\t\tif((n%5)==3){\n\t\t\tif(rem==4){\n\t\t\t\toutput+=3;\n\t\t\t}\n\t\t\telse if (rem==3){\n\t\t\t\toutput+=2;\n\t\t\t}\n\t\t\telse if(rem==2){\n\t\t\t\toutput+=1;\n\t\t\t}\n\t\t}\n\t\tif((n%5)==4){\n\t\t\tif(rem==4){\n\t\t\t\toutput+=4;\n\t\t\t}\n\t\t\telse if (rem==3){\n\t\t\t\toutput+=3;\n\t\t\t}\n\t\t\telse if(rem==2){\n\t\t\t\toutput+=2;\n\t\t\t}\n\t\t\telse if (rem==1){\n\t\t\t\toutput++;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\",output);\n\t\n}\n"}, {"source_code": "#include\nint main()\n{\nlong int n,m,i,j,t;\nlong long int c=0;\nscanf(\"%li%li\",&n,&m);\nfor(i=1;i<=n;i++)\n{\nfor(j=1;(i+j)%5!=0 && j<=m;j++)\n;\nif(j<=m)\n{\nt=(m-j)/5;\nc+=t+1;\t\n}\nelse\nc=0;\n}\nprintf(\"%I64d\",c);\t\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n //input\n unsigned long int n, m;\n scanf(\"%ld %ld\", &n, &m);\n long int max, min;\n if(n > m)\n {\n max = n;\n min = m;\n }\n else\n {\n max = m;\n min = n;\n }\n\n long int count = min * (max/5);\n\n for(int i = 1; i <= min; i++)\n for(int j = 1; j <= max%5; j++)\n if((i+j) % 5 == 0) count++;\n\n printf(\"%d\", count);\n\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n\tint n,m,t,i,j;\n\tscanf(\"%d %d\",&n,&m);\n\tfor(i=1;i<=n;i++){\n\t\tfor(j=1;j<=m;j++){\n\t\t\tif((i+j)%5==0)\n\t\t\t\tt++;\n\t\t}\n\t}\n\tprintf(\"%d\",t);\t\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n long long int n, m, i, num = 0, t;\n\n scanf(\"%lld%lld\", &n, &m);\n\n for(i = 0;i < 5;i++)\n {\n if(i == 0)\n {\n t = (n / 5) * (m / 5);\n }\n else\n {\n t = ((n - i) / 5 + 1) * ((m + i - 5) / 5 + 1);\n }\n\n num += t;\n }\n\n printf(\"%lld\", num);\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n long m,n,k;\n long a=0,b=0,c=0,d=0,e=0;\n long a1=0, b1=0, c1=0, d1=0, e1=0;\n scanf(\"%d%d\", &m,&n);\n\n if(m>n){\n k=m;\n m=n;\n n=k;\n }\n\n for(long i=1;i<=m;i++){\n if(i%5==1){\n a++;\n }else if(i%5==2){\n b++;\n }else if(i%5==3){\n c++;\n }else if(i%5==4){\n d++;\n }else{\n e++;\n }\n\n }\n\n for(long i=1;i<=n;i++){\n if(i%5==1){\n d1++;\n }else if(i%5==2){\n c1++;\n }else if(i%5==3){\n b1++;\n }else if(i%5==4){\n a1++;\n }else{\n e1++;\n }\n }\n\n printf(\"%d\", (a*a1 + b*b1 + c*c1 + d*d1 + e*e1));\n return 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n\tstatic int kk1[5], kk2[5];\n\tint n, m, x, a, b, c, d, e;\n\n\tscanf(\"%d%d\", &n, &m);\n\tfor (x = 1; x <= n; x++)\n\t\tkk1[x % 5]++;\n\tfor (x = 1; x <= m; x++)\n\t\tkk2[x % 5]++;\n\ta = kk1[0] * kk2[0];\n\tb = kk1[1] * kk2[4];\n\tc = kk1[2] * kk2[3];\n\td = kk1[3] * kk2[2];\n\te = kk1[4] * kk2[1];\n\tprintf(\"%lld\\n\", (long long) a + b + c + d + e);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n long long int n, m;\n long long int result;\n scanf(\"%lld %lld\",&n,&m);\n double temp = n*m;\n if(m*n==m || m*n==n) result = ((m*n)+1)/5;\n else result = (int)((temp/5)+.5);\n printf(\"%lld\",result);\n return 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n\tint n, m;\n\tscanf(\"%d %d\\n\", &n, &m);\n\n\tif (n<5 &&m<5)\n\t{\n\t\tputs(\"0\");\n\t\treturn 0;\n\t}\n\n\tint count=0;\n\tfor (int i = 1; i < n+1; ++i)\n\t{\n\t\t// printf(\"%d\\n\", ((m - (m + i) % 5 - 1) / 5 + 1));\n\t\tcount+=((m - (m + i) % 5 - 1) / 5 + 1);\n\t}\n\tprintf(\"%d\", count);\n\n\treturn 0;\n\n}\n\n/*\n0 5 10 15 20 25 30\n\n\n1 4 9 14 19 24 29\n2 3 8 13 18 23 28\n3 2 7 12 17 22 27\n4 1 6 11 16 21 26\n5 5 10 15 20 25 30\n6 4 9 14 19 24 29\n7 3 8 13 18 23 28\n8 2 7 12 17 22 27\n9 1 6 11 16 21 26\n10 5 10 15 20 25\n11 4 9 14 19 24\n\n\n\n*/"}, {"source_code": "#include \n\n#define g(x, i) (x / 5 + (x % 5 >= (i)))\n\nint main() {\n int m, n, i, c = 0;\n scanf(\"%d %d\\n\", &n, &m);\n for (i = 0; i < 5; ++i)\n c += g(n, i ? i : 5) * g(m, 5 - i);\n printf(\"%d\", c);\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n long a,b;\n int c=0,n=1,t=5,k=t,temp;\n scanf(\"%ld%ld\",&a,&b);\n if(a==b&&a%10==0)\n {printf(\"%ld\",a*((b*2)/10));exit(0);}\n while(n<=a)\n {\n temp=abs(n-k);\n if(temp<=b)\n {\n if(temp>0)\n c++;\n k+=5;\n continue;\n }\n n++;\n if((n-t)>0)\n t+=5;\n k=t;\n }\n printf(\"%d\",c);\n}"}, {"source_code": "#include\n\nint main()\n{\nint n,m;\nscanf(\"%d %d\",&n,&m);\nint p=n/5,q=n%5;\nint r=m/5,s=m%5;\nint count=0;\ncount=p*5*r+q*r+s*p;\nif(q+s>=5) {count+=(q+s)-4;}\nprintf(\"%d\",count);\nreturn 0;\n}\n"}, {"source_code": "#include \n\n#define g(x, i) (x / 5 + (x % 5 >= (i)))\n\nint main() {\n int m, n, i, c = 0;\n scanf(\"%d %d\\n\", &n, &m);\n for (i = 0; i < 5; ++i)\n c += g(n, i ? i : 5) * g(m, 5 - i);\n printf(\"%d\", c);\n}\n"}, {"source_code": "#include\nint main()\n{\nint n,m,i;\nlong long int num_sol;\nint rem_n[5];\nint rem_m[5];\nnum_sol=0;\nscanf(\"%d%d\",&n,&m);\nrem_m[0]=m/5-1;\nrem_n[0]=n/5-1;\nfor(i=1;i<5;i++)\n{rem_m[i]=m/5;\nrem_n[i]=n/5;}\nfor(i=0;i<=m%5;i++)\nrem_m[i]+=1;\nfor(i=0;i<=n%5;i++)\nrem_n[i]+=1;\nfor(i=0;i<5;i++)\nnum_sol+=rem_m[i]*rem_n[(5-i)%5];\nprintf(\"%lld\",num_sol);\n\n\nreturn 0;}"}, {"source_code": "#include \n\nint main()\n{\n int x,y;\n int a[5]={0};\n int b[5]={0};\n scanf(\"%d %d\",&x,&y);\n int i;\n for(i=1;i<=x;i++)\n a[i%5]++;\n for(i=1;i<=y;i++)\n b[i%5]++;\n printf(\"%I64d\\n\",a[0]*b[0]+a[1]*b[4]+a[2]*b[3]+a[3]*b[2]+a[4]*b[1]);\n\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n\tint x,y;\n\tscanf(\"%i %i\",&x,&y);\n\tint i,j;\n\tint count = 0;\n\tif (x<5||y<5)\n\t{\n\t\tfor (i=1;i<=x;i++)\n\t\t{\n\t\t\tfor(j=1;j<=y;j++)\n\t\t\t{\n\t\t\t\tif ((i+j)%5==0) count++;\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\tprintf(\"%d\",count);\n\t\treturn 0;\n\t}\n\ti = x/5;\n\tj = y/5;\n\tcount = i*j*5;\n\tint m,n;\n\tm=x%5;\n\tn=y%5;\n\tcount = count + m*j + n * i;\n\tif ((n+m)>=5) count++;\n\tprintf(\"%d\",count);\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n long a,b;\n int c=0,n=1,t=5,k=t,temp;\n scanf(\"%ld%ld\",&a,&b);\n if(a==b&&a%10==0)\n {printf(\"%ld\",a*((b*2)/10));exit(0);}\n while(n<=a)\n {\n temp=abs(n-k);\n if(temp<=b)\n {\n if(temp>0)\n c++;\n k+=5;\n continue;\n }\n n++;\n if((n-t)>0)\n t+=5;\n k=t;\n }\n printf(\"%d\",c);\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n long long m,n,k;\n long long a=0,b=0,c=0,d=0,e=0;\n long long a1=0, b1=0, c1=0, d1=0, e1=0;\n scanf(\"%d%d\", &m,&n);\n\n if(m>n){\n k=m;\n m=n;\n n=k;\n }\n\n for(int i=1;i<=m;i++){\n if(i%5==1){\n a++;\n }else if(i%5==2){\n b++;\n }else if(i%5==3){\n c++;\n }else if(i%5==4){\n d++;\n }else{\n e++;\n }\n\n }\n\n for(int i=1;i<=n;i++){\n if(i%5==1){\n d1++;\n }else if(i%5==2){\n c1++;\n }else if(i%5==3){\n b1++;\n }else if(i%5==4){\n a1++;\n }else{\n e1++;\n }\n }\n\n printf(\"%d\", (a*a1 + b*b1 + c*c1 + d*d1 + e*e1));\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tlong int n,m,s[6],ans,i,min,max;\n\tscanf(\"%ld %ld\",&n,&m);\n\tif(n>m)\n\t{min=m;\n\tmax=n;\n\t}\n\telse\n\t{\n\tmin=n;\n\tmax=m;}\ns[1]=max/5;\nif(max%5>=4&&max%5!=0)\ns[1]++;\ns[2]=max/5;\nif(max%5>=3&&max%5!=0)\ns[2]++;\n\ts[3]=max/5;\nif(max%5>=2&&max%5!=0)\ns[3]++;\n\ts[4]=max/5;\nif(max%5>=1&&max%5!=0)\ns[4]++;\ns[5]=max/5;\nans=(s[1]+s[2]+s[3]+s[4]+s[5])*(min/5);\nfor(i=1;i<=min%5;i++)\n{\n\tans+=s[i];\n}\n\tprintf(\"%ld\",ans);\n\t\n}"}, {"source_code": "#include\n\nint main()\n{\n int n, m, c=0, max, min, i, j, t, r, p;\n \n scanf(\"%d%d\", &n, &m);\n if(n>m)\n {\n max=n;\n min=m;\n }\n else\n {\n max=m;\n min=n;\n }\n if(max%5==0)\n t=max/5;\n else\n t=(max/5)+1;\n for(i=1;i<=min;i++)\n {\n r=max+i;\n j=i/5;\n p=r/5;\n p-=j;\n if(p>t)\n c+=t;\n else\n c+=p;\n \n }\n printf(\"%d\\n\", c);\n return 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n int n,m,count=0;\n int rem;\n scanf(\"%d %d\",&n,&m);\n if(n>m)\n {\n int temp=m;\n m=n;\n n=temp;\n }\n for(int i=1;i<=m;i++)\n {\n rem=5*(i/5 + 1) -i;\n \n if(rem==5)\n rem=0;\n \n for(int j=5-rem;j<=n;j+=5)\n {\n count++;\n }\n }\n printf(\"%d\",count);\n}"}, {"source_code": "#include \n\nint solve(int n, int m) \n{\n\tint r = 0;\n\tfor(int i = 1; i <= n; ++i) \n\t{\n\t\tfor(int j = 1; j <= 5 && j <= m; ++j) \n\t\t{\n\t\t\tif((i + j) % 5 == 0)\n\t\t\t{\n\t\t\t\tr += ((m - j) / 5) + 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn r;\n}\n\nint main() \n{\n\tint n, m;\n\tscanf(\"%d %d\", &n, &m);\n\n\tint r = solve(n, m);\n\tprintf(\"%d\\n\", r);\n\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tlong long int i,n,m,count_n=0,count_m=0,ans;\n\tscanf(\"%lld\",&n);\n\tscanf(\"%lld\",&m);\n \n for(i=2;i\n\n#define __max(a, b) (((a) > (b)) ? (a) : (b))\n#define __min(a, b) (((a) < (b)) ? (a) : (b))\n\nint main()\n{\n\tint n, x;\n\tscanf(\"%d\\n%d\\n\", &n, &x);\n\n\tint temp1, temp2, flag = 0;\n\n\tfor (int i = 0; i < n; ++i)\n\t{\n\t\tscanf(\"%d %d\\n\", &temp1, &temp2);\n\t\tif (temp1 == x || temp1 == 7 - x)\n\t\t{\n\t\t\tflag = 1;\n\t\t}\n\t\tif (temp2 == x || temp2 == 7 - x)\n\t\t{\n\t\t\tflag = 1;\n\t\t}\n\t}\n\tif (flag == 0)\n\t{\n\t\tputs(\"YES\");\n\t}\n\telse\n\t{\n\t\tputs(\"NO\");\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include\nlong long p[10],q[10];\nint main()\n{\n\tint n,x,y,l;\n\tlong long ans=0,i,j,k,a,b; \n\tscanf(\"%I64d%I64d\",&a,&b);\n\tfor(i=1;i<=a;i++)\n\t\tp[i%5]++;\n\tfor(i=1;i<=b;i++)\n\t\tq[i%5]++;\n\tans+=p[1]*q[4];\n\tans+=p[2]*q[3];\n\tans+=p[3]*q[2];\n\tans+=p[4]*q[1];\n\tans+=p[0]*q[01];\n \tprintf(\"%I64d\",ans);\nreturn 0;\n}\n\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n unsigned long m,n,k;\n unsigned long a=0,b=0,c=0,d=0,e=0;\n unsigned long a1=0, b1=0, c1=0, d1=0, e1=0;\n scanf(\"%d%d\", &m,&n);\n\n if(m>n){\n k=m;\n m=n;\n n=k;\n }\n\n for(unsigned long i=1;i<=m;i++){\n if(i%5==1){\n a++;\n }else if(i%5==2){\n b++;\n }else if(i%5==3){\n c++;\n }else if(i%5==4){\n d++;\n }else{\n e++;\n }\n\n }\n\n for(unsigned long i=1;i<=n;i++){\n if(i%5==1){\n d1++;\n }else if(i%5==2){\n c1++;\n }else if(i%5==3){\n b1++;\n }else if(i%5==4){\n a1++;\n }else{\n e1++;\n }\n }\n\n printf(\"%lu\", (unsigned long)(a*a1 + b*b1 + c*c1 + d*d1 + e*e1));\n return 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n long a,b;\n scanf(\"%ld%ld\",&a,&b);\n printf(\"%.0f\",round((a*b)/5.0));\n}"}, {"source_code": "#include\nint main()\n{\n int n,m;\n long long cnt=0;\n scanf(\"%d %d\",&n,&m);\n int mx,lo;\n if(n>m)\n {\n mx=n;\n lo=m;\n }\n else\n {\n mx=m;\n lo=n;\n }\n for(int i=1;i<=lo;i++)\n {\n if(mx+lo<5)\n {\n break;\n }\n if(i<=mx)\n {\n cnt++;\n cnt+=(mx-(5-i%5))/5;\n }\n }\n printf(\"%lld\\n\",cnt);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tint a,b;\n\tscanf(\"%d %d\",&a, &b);\n\tint f0,f1,f2,f3,f4,s0,s1,s2,s3,s4;\n\tf0 = a / 5;\n\tf1 = a / 5 + (a % 5 > 0 ? 1 : 0);\n\tf2 = a / 5 + (a % 5 > 1 ? 1 : 0);\n\tf3 = a / 5 + (a % 5 > 2 ? 1 : 0);\n\tf4 = a / 5 + (a % 5 > 3 ? 1 : 0);\n\ts0 = b / 5;\n\ts1 = b / 5 + (b % 5 > 0 ? 1 : 0);\n\ts2 = b / 5 + (b % 5 > 1 ? 1 : 0);\n\ts3 = b / 5 + (b % 5 > 2 ? 1 : 0);\n\ts4 = b / 5 + (b % 5 > 3 ? 1 : 0);\n\tprintf(\"%d\", f0 * s0 + f1 * s4 + f2 * s3 + f3 *s2 + f4 * s1);\n}"}, {"source_code": "#include\nint main()\n{\n int a,b,i,j,x,y,z;\n long long int c=0;\n scanf(\"%d%d\",&a,&b);\n int r1=a%5;\n int r2=b%5;\n\n for(i=1;i<=4;i++)\n {\n x=a/5;\n y=b/5;\n if(r1>=i)\n {\n x=x+1;\n }\n if(r2>=(5-i))\n {\n y=y+1;\n }\n c=x*y + c;\n }\n c=c+(a/5)*(b/5);\n\n printf(\"%lld\\n\",c);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\nlong int n,m,i,j,t;\nlong long int c=0;\nscanf(\"%li%li\",&n,&m);\nfor(i=1;i<=n;i++)\n{\nfor(j=1;(i+j)%5!=0;j++)\n;\nt=(m-j)/5;\nc+=t+1;\t\n}\nprintf(\"%I64d\",c);\t\n}"}, {"source_code": "#include\n#include\nint finrange(int n){\n\tint i;\n\tif((n+5)%5==0)\n\t\treturn 5;\n\tif((n+1)%5==0)\n\t\treturn 1;\n\tif((n+2)%5==0)\n\t\treturn 2;\n\tif((n+3)%5==0)\n\t\treturn 3;\n\tif((n+4)%5==0)\n\t\treturn 4;\n\treturn 0;\n}\nint main(){\n\tint c,n,m,i=1,ans=0,diff;\n\tscanf(\"%d%d\",&n,&m);\n\twhile(i<=n){\n\t\t//finrange(i);\n\t\tdiff=finrange(i);\n\t\tans+=(m-diff)/5;\n\t\tans++;\n\t\t//printf(\"Ans : %d Diff : %d\\n\",ans,diff);\n\t\ti++;\n\t}\n\tprintf(\"%d\\n\",ans);\n}\n"}, {"source_code": "#include \n\nint solve(int n, int m) \n{\n\tint r = 0;\n\tfor(int i = 1; i <= n; ++i) \n\t{\n\t\tfor(int j = 1; j <= 5 && j <= m; ++j) \n\t\t{\n\t\t\tif((i + j) % 5 == 0)\n\t\t\t{\n\t\t\t\tr += ((m - j) / 5) + 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn r;\n}\n\nint main() \n{\n\tint n, m;\n\tscanf(\"%d %d\", &n, &m);\n\n\tint r = solve(n, m);\n\tprintf(\"%d\\n\", r);\n\n\treturn 0;\n}\n"}, {"source_code": "#include\nint a[5]={0};\nint b[5]={0};\nint main(){\n long long m,n,i,count=0;\n scanf(\"%I64d%I64d\",&m,&n);\n for(i=1;i<=m;i++){\n a[i%5]++;\n }\n for(i=1;i<=n;i++){\n b[i%5]++;\n }\n count=a[0]*b[0]+a[1]*b[4]+a[2]*b[3]+a[3]*b[2]+a[4]*b[1];\n printf(\"%I64d\",count);\n scanf(\" \");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long int i,j,k,n,m;\n long long s;\n while(scanf(\"%ld %ld\",&n,&m)!=EOF)\n {\n s=0;\n for(i=1;i<=n;i++)\n {\n k=1;\n j=(5-i%5)%5;\n if(j==0)\n k=0;\n s+=(m-j)/5+k;\n }\n printf(\"%I64d\\n\",s);\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n long long int m,n;\n int arr[6]={0,0,0,0,0};\n scanf(\"%lld %lld\",&n,&m);\n long long int i,j,x,y,temp,p;\n long long int ans=0;\n if (n\n\nint main()\n{\n int n,m,count=0;\n int rem;\n scanf(\"%d %d\",&n,&m);\n if(n>m)\n {\n int temp=m;\n m=n;\n n=temp;\n }\n for(int i=1;i<=n;i++)\n {\n rem=5*(i%5 + 1) -i;\n \n if(rem==5)\n rem=0;\n \n for(int j=5-rem;j\n\nint min(int a,int b){\n\n if(a < b)\n return a;\n return b;\n}\nint main(){\n\n int n, m, v[10], i, answ = 0;\n scanf(\"%d %d\",&n,&m);\n\n for(i = 0;i <= 4; ++i)\n v[i] = 0;\n\n for(i = 1;i <= n; ++i)\n ++v[i % 5];\n for(i = 1;i <= m; ++i)\n if(i % 5 > 0)\n answ = answ + v[5 - (i % 5)];\n else\n answ = answ + v[0];\n\n printf(\"%d\",answ);\n}\n"}, {"source_code": "#include\nint main(){\n\tint c,n,m,i=1,ans=0,diff;\n\tscanf(\"%d%d\",&n,&m);\n\twhile(i<=n){\n\t\tans+=(m+(i%5))/5;\n\t\ti++;\n\t}\n\tprintf(\"%d\\n\",ans);\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tlong long int i,n,m,count_n=0,count_m=0,ans;\n\tscanf(\"%lld\",&n);\n\tscanf(\"%lld\",&m);\n \n for(i=2;i\nmain()\n{\n int n,m,i=1,j,sum,p=0;\n scanf(\"%d %d\",&n,&m);\n\n if((n%2==0&&m%2==0)||(n%2!=0&&m%2!=0))\n {\n printf(\"%d\",(n*m)/5);\n }\n else {\n printf(\"%d\",(n*m)/5+1);\n }\n}\n"}, {"source_code": "#include\nint main()\n{\n\tlong int n,m,s[6],ans,i,min,max;\n\tscanf(\"%ld %ld\",&n,&m);\n\tif(n>m)\n\t{min=m;\n\tmax=n;\n\t}\n\telse\n\t{\n\tmin=n;\n\tmax=m;}\ns[1]=max/5;\nif(max%5>=4&&max%5!=0)\ns[1]++;\ns[2]=max/5;\nif(max%5>=3&&max%5!=0)\ns[2]++;\n\ts[3]=max/5;\nif(max%5>=2&&max%5!=0)\ns[3]++;\n\ts[4]=max/5;\nif(max%5>=1&&max%5!=0)\ns[4]++;\ns[5]=max/5;\nans=(s[1]+s[2]+s[3]+s[4]+s[5])*(min/5);\nfor(i=1;i<=min%5;i++)\n{\n\tans+=s[i];\n}\n\tprintf(\"%ld\",ans);\n\t\n}"}, {"source_code": "#include \n\nint main()\n{\n\tint n,m,countA_0=0,countA_1=0,countA_2=0,countA_3=0,countA_4=0,countB_0=0,countB_1=0,countB_2=0,countB_3=0,countB_4=0,i,ans=0;\n scanf(\"%d\",&n);\n scanf(\"%d\",&m);\n\n for(i=1;i<=n;i++)\n {\n if((i%5)==0)\n countA_0++;\n else if((i%5)==1)\n countA_1++;\n else if((i%5)==2)\n countA_2++;\n else if((i%5)==3)\n countA_3++;\n else if((i%5)==4)\n countA_4++;\n }\n\n for(i=1;i<=m;i++)\n {\n if((i%5)==0)\n countB_0++;\n else if((i%5)==1)\n countB_1++;\n else if((i%5)==2)\n countB_2++;\n else if((i%5)==3)\n countB_3++;\n else if((i%5)==4)\n countB_4++;\n }\n\n ans=ans+(countB_0*countA_0)+(countB_1*countA_4)+(countB_2*countA_3)+(countB_3*countA_2)+(countB_4*countA_1);\n\n printf(\"%d\",ans);\n}\n"}, {"source_code": "#include\n#include\n\nint main()\n{\n\tlong int n,m,i,j,count=0;\n\tscanf(\"%ld%ld\",&n,&m);\n\tcount=(n/5)*(m/5)*5;\n\tfor(i=0;i<=m%5;i++)\n\t\tfor(j=0;j<=n%5;j++)\n\t\t\tif(i+j==5)\n\t\t\t\tcount++;\n\tcount+=(m%5)*(n/5);\n\tcount+=(n%5)*(m/5);\n\tprintf(\"%ld\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main(void)\n{\n\tunsigned long long n, m, j, k, t = 0;\n\t\n\tscanf(\"%I64d %I64d\", &n, &m);\n\tif(n < 5 && m < 5)\n\t{\n\t\tfor(j = 1; j <= n; j++)\n\t\t{\n\t\t\tfor(k = 1; k <= m; k++)\n\t\t\t{\n\t\t\t\tif((j + k) % 5 == 0)\n\t\t\t\t\tt++;\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tfor(j = 1; j <= n; j++)\n\t\t{ \n\t\t\tt += (m - (5 - j % 5)) / 5 + 1;\n\t\t}\n\t}\n\tprintf(\"%I64d\\n\", t);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n\nint main()\n{\n///__________________________________________________///\n///_____________A. Alyona and Numbers\nint Num,k,i,j,cnt=0,x=0;\nscanf(\"%i %i\",&Num,&k);\nfor (i=1;i<=Num;i++)\n{\n for (j=1;j<=5;j++)\n {\n if ((i+j)%5==0 )\n {\n x=j;\n cnt++;\n while (x<=k)\n {\n x=x+5;\n if ( x<=k)\n cnt++;\n }\n }\n }\n}\n\nprintf(\"%i\",cnt);\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int m,n,i,j,k;\n\n scanf(\"%d %d\",&n,&m);\n long long int ctr=0;\n\n for(int i=1;i<=n;i++)\n {\n ctr=ctr+(long long int)((m-5+i%5)/5);\n }\n\n printf(\"%lld\\n\",ctr+n);\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,m,i,a;\n\tscanf(\"%d %d\",&n,&m);\n\tint b,count = 0;\n\ta = n/5;\n\tb = m/5;\n\tint modA = n%5,modB = m%5,A[5]={0},B[5]={0};\n\tfor(i = 0;i <= 4; i++)\n\t{\n\t\tif(modA >= i)\n\t\t\tA[i] = a + 1;\n\t\telse\n\t\t\tA[i] = a;\n\t\tif(modB >= i)\n\t\t\tB[i] = b + 1;\n\t\telse \n\t\t\tB[i] = b;\n\t}\n\tA[0]--;\n\tB[0]--;\n//\tfor(i = 0;i <=4; i++)\n//\t\tprintf(\"%d\\t%d\\n\",A[i],B[i]);\n\tfor(i = 1;i <=4; i++)\n\t{\n\t\tcount += A[i]*B[5-i];\n\t}\n\tcount += A[0]*B[0];\n\tprintf(\"%d\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n long long a,b;\n scanf(\"%lld%lld\",&a,&b);\n if(a==b&&a%10==0)\n printf(\"%lld\",a*((b*2)/10));\n else\n printf(\"%lld\",(long long)round((a*b)/5.0));\n}"}], "src_uid": "df0879635b59e141c839d9599abd77d2"} {"nl": {"description": "Two players play a simple game. Each player is provided with a box with balls. First player's box contains exactly n1 balls and second player's box contains exactly n2 balls. In one move first player can take from 1 to k1 balls from his box and throw them away. Similarly, the second player can take from 1 to k2 balls from his box in his move. Players alternate turns and the first player starts the game. The one who can't make a move loses. Your task is to determine who wins if both players play optimally.", "input_spec": "The first line contains four integers n1, n2, k1, k2. All numbers in the input are from 1 to 50. This problem doesn't have subproblems. You will get 3 points for the correct submission.", "output_spec": "Output \"First\" if the first player wins and \"Second\" otherwise.", "sample_inputs": ["2 2 1 2", "2 1 1 1"], "sample_outputs": ["Second", "First"], "notes": "NoteConsider the first sample test. Each player has a box with 2 balls. The first player draws a single ball from his box in one move and the second player can either take 1 or 2 balls from his box in one move. No matter how the first player acts, the second player can always win if he plays wisely."}, "positive_code": [{"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2,kq1=0,kq2=0;\n scanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n if (n1>n2)\n {\n printf(\"First\");\n }\n else\n {\n if (n2>n1)\n {\n printf(\"Second\");\n }\n else\n {\n if (n1==n2)\n {\n if (k1==k2)\n {\n printf(\"Second\");\n }\n else\n {\n kq1=k1+k2;\n if (kq1%2!=0)\n {\n printf(\"Second\");\n }\n else\n {\n printf(\"First\");\n }\n }\n }\n }\n }\n}\n"}, {"source_code": "#include \nint main()\n{\n\tint n,num,i,j;\n\tscanf(\"%d%d%d%d\",&n,&num,&i,&j);\n\tif(n<=num)\n\tprintf(\"Second\\n\");\n\telse\n\tprintf(\"First\\n\");\n\treturn 0;\n}\n\t "}, {"source_code": "#include\nint main ()\n{\n int x,y,a,b,i,j;\n scanf(\"%d%d%d%d\",&x,&y,&a,&b);\n if(x>y){\n printf(\"First\\n\");\n }\n else {\n printf(\"Second\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,m, k1,k2;\n\tscanf(\"%d %d %d %d\",&n,&m,&k1,&k2);\n\tint f1=n/k1;\n\tint f2=n%k1;\n\tint g1=m/k2;\n\tint g2=m%k2;\n\tif(n>m)\n\t\tprintf(\"First\\n\");\n\telse \n\t\tprintf(\"Second\\n\");\n\t\n/*\telse\n\t{\n\t\tif(n%2==0)\n\t\t\tprintf(\"Second\\n\");\n\t\telse\n\t\t\tprintf(\"First\\n\");\n\t\tif(f2!=0 && g2==0)\n\t\t\tprintf(\"First\\n\");\n\t\telse(\n\t\t\tprintf(\"Second\\n\");\n\t}*/\n\treturn 0;\n}\n\n"}, {"source_code": "#include \nint main()\n\n{\n int n1,n2,k1,k2;\n scanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n\n if(n1>n2){\n printf(\"First\\n\");\n }\n\n \n else{\n printf(\"Second\\n\");\n }\n\n return 0;\n\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n1,n2,k1,k2;\n\tscanf(\"%d\",&n1);\n\tscanf(\"%d\",&n2);\n\tscanf(\"%d\",&k1);\n\tscanf(\"%d\",&k2);\n\tif(n1>n2)\n\t\tprintf(\"First\");\n\telse\n\t\tprintf(\"Second\");\n\treturn 0;\n\n}\n"}, {"source_code": "#include \n\nint main(){\n\tint a, b, c, d;\n\tscanf(\"%d %d %d %d\", &a, &b, &c, &d);\n\tif(a<=b){\n\t\tprintf(\"Second\\n\");\n\t}\n\telse{\n\t\tprintf(\"First\\n\");\n\t}\n\treturn(0);\n}\n\n/* 1512490450052 */\n"}, {"source_code": "#include \nint main()\n{\n int a, b, ax, bx, a_total, b_total;\n scanf(\"%d %d %d %d\", &a, &b, &ax, &bx);\n\n if(a>b) printf(\"First\\n\");\n else printf(\"Second\\n\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(n1<=n2&&k1<=k2){\n printf(\"Second\\n\");\n }\n else if(n1>n2&&k1>=k2){\n printf(\"First\\n\");\n }\n else if(n1>=n2&&k1<=k2){\n printf(\"First\\n\");\n }\n else if(n1==n2&&k1>k2){\n printf(\"Second\\n\");\n }\n else {\n printf(\"Second\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main ()\n{\n int a,b,c,d;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n if(a>b)\n printf(\"First\");\n else\n printf(\"Second\");\n return 0;\n}\n"}, {"source_code": "#include\nint main ()\n{\n int x,y,a,b,i,j;\n scanf(\"%d%d%d%d\",&x,&y,&a,&b);\n if(x>y){\n printf(\"First\\n\");\n }\n else {\n printf(\"Second\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n1,n2,k1,k2,max,step=0,step1=0;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n\n if(n1==n2)\n {\n printf(\"Second\");\n }\n else if(n1>n2)\n {\n printf(\"First\");\n }\n else\n {\n printf(\"Second\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nvoid fun(int n1,int n2,int k1,int k2,int turn)\n{int i;\nif(n1==0)\n{\nprintf(\"Second \");\nexit(0);\n}\nelse if(n2==0)\n{printf(\"First\");\nexit(0);\n}\nelse\n{if(turn==0)\n{\nfor(i=1;i<=k1;i++)\nfun(n1-i,n2,k1,k2,1);\n}\nelse\n{ for(i=1;i<=k2;i++)\nfun(n1,n2-i,k1,k2,0);\n}\n}\n}\nmain()\n{ int n1,n2,k1,k2,turn=0;\n scanf(\"%d %d %d %d\\n\",&n1,&n2,&k1,&k2);\n fun(n1,n2,k1,k2,turn);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int a,b,c,d;\n\tscanf(\"%d%d%d%d\",&a,&b,&c,&d);\n\tif(a>b)\n\tprintf(\"First\");\n\telse\n\tprintf(\"Second\");\n\t\nreturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n \n if(n1<=n2)\n {\n printf(\"Second\");\n }\n else if(n1>n2)\n {\n printf(\"First\");\n }\n\n}"}, {"source_code": "#include\n#include\n#include\nint main()\n{\n int i,n,m,s,k;\n scanf(\"%d %d %d %d\",&m,&s,&k,&n);\n if(m==s)printf(\"Second\");\n else if(m>s)printf(\"First\");\n else printf(\"Second\");\n return 0;\n}\n"}, {"source_code": "#include\nmain(){int a,b;scanf(\"%d%d\",&a,&b);puts(a>b?\"First\":\"Second\");return 0;}\n"}, {"source_code": "#include\nint main(){\nint a,b;\nscanf(\"%d%d\",&a,&b);\nputs(a>b ? \"First\":\"Second\");\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int a,b,c,d;\n\n scanf(\"%lld%lld%lld%lld\",&a,&b,&c,&d);\n if(a>b)\n printf(\"First\");\n else\n printf(\"Second\");\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n if(n1>n2) printf(\"First\\n\");\n else printf(\"Second\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n\n\nint main()\n{ \n int n1,n2,k1,k2 ;\nscanf(\"%d\",&n1);\nscanf(\"%d\",&n2);\nscanf(\"%d\",&k1);\nscanf(\"%d\",&k2);\n if ( n1>n2){\n printf(\"First\");\n }\n else\n {\n printf (\"Second\"); \n }\n \n return 0; \n}\n"}, {"source_code": "#include\n//#include\nint main()\n{\nint i,j,k,l;\nscanf(\"%d%d%d%d\",&i,&j,&k,&l);\nif(ij) printf(\"First\");\nelse if(i==j)\n{\n printf(\"Second\");\n}\nreturn 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n int n1, n2, k1, k2;\n scanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n if(n1==n2)\n {\n if(k1<=k2)\n printf(\"Second\\n\");\n else\n printf(\"Second\\n\");\n }\n else if(n1>n2)\n {\n if(k1>=k2)\n printf(\"First\\n\");\n else\n printf(\"First\\n\");\n }\n if(n1=k2)\n printf(\"Second\\n\");\n else\n printf(\"Second\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,c,d;\n\tscanf(\"%d%d%d%d\",&a,&b,&c,&d);\n\tif(a>b)\n\tprintf(\"First\");\n\telse\n\tprintf(\"Second\");\n\t\nreturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(n1>n2)\n {\n printf(\"First\");\n }\n else\n {\n printf(\"Second\");\n }\n}"}, {"source_code": "#include \n\nint main(void){\n\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\", &n1, &n2, &k1, &k2);\n\n if(n1<=n2){\n printf(\"Second\\n\");\n return 0;\n }\n\n if(n1>n2){\n printf(\"First\\n\");\n }\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,c,d;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n if(a>b)\n {\n printf(\"First\\n\");\n }\n else if(a==b)\n {\n if(c>d)\n printf(\"Second\\n\");\n else\n printf(\"Second\\n\");\n }\n else\n printf(\"Second\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n1,n2,k1,k2,a,b;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(n1<=n2)\n printf(\"Second\\n\");\n else\n printf(\"First\\n\");\n return 0;\n}\n"}, {"source_code": " #include\nint main()\n{\n int m,n,p,q;\n scanf(\"%d %d %d %d\",&m,&n,&p,&q);\n if(m==n)\n {\n printf(\"Second\");\n }\n else if(m>n)\n {\n printf(\"First\");\n }\n else if(m\nmain()\n{\n\tint a, b, c, d;\n\tscanf(\"%d%d%d%d\", &a, &b, &c, &d);\n\tprintf(a > b ? \"First\" : \"Second\");\n}\n"}, {"source_code": "#include \n#include \n \nint main() {\n int n1,n2,k1,k2;\n int i,j,x;\n \n scanf (\"%d\",&n1);\n scanf (\"%d\",&n2);\n scanf (\"%d\",&k1);\n scanf (\"%d\",&k2);\n if (n1>n2){\n printf(\"First\");\n \n }\n else printf(\"Second\");\n \n \n return 0;\n}"}, {"source_code": "#include\nint main()\n{\nint n1,n2,k1,k2;\nscanf(\"%d\", &n1);\nscanf(\"%d\", &n2);\nscanf(\"%d\", &k1);\nscanf(\"%d\", &k2);\nif(n1>n2)\nputs(\"First\");\nelse\nputs(\"Second\");\nreturn 0;\n}\n"}, {"source_code": "#include\n#include\n#include\nint main()\n{\n int i,n,m,s,k;\n scanf(\"%d %d %d %d\",&m,&s,&k,&n);\n if(m==s)printf(\"Second\");\n else if(m>s)printf(\"First\");\n else printf(\"Second\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int m,n,p,q;\n scanf(\"%d %d %d %d\",&m,&n,&p,&q);\n\n if(m<=n)\n printf(\"Second\");\n else\n printf(\"First\");\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int b1,b2,m1,m2,i;\n\n scanf(\"%d %d %d %d\",&b1,&b2,&m1,&m2);\n if(b1>b2)printf(\"First\");\n else printf(\"Second\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n1,n2,k1,k2;\n\tscanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n\tif (n1>n2)\n\t{\n\t\tprintf(\"First\");\n\t}\n\telse if (n1\nint main()\n{\n\nint a,b,c,d;\nscanf(\"%d %d %d %d\",&a,&b,&c,&d);\nif(a>b){\nprintf(\"First\");\n\n}\n\nelse\nprintf(\"Second\");\n\n\n}"}, {"source_code": "#include \n\nint main()\n{\n int n1, n2, k1, k2, p1, p2;\n\n scanf(\"%d %d %d %d\",&n1, &n2, &k1, &k2);\n if(n1>n2)\n printf(\"First\\n\");\n\n else if(n1<=n2)\n printf(\"Second\\n\");\n\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint n1,n2,k1,k2;\n\tscanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n\tif(n1>n2){\n\t\tprintf(\"First\\n\");\n\t}\n\telse{\n\t\tprintf(\"Second\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n\n if(n1>n2)\n printf(\"First\");\n else\n printf(\"Second\");\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n if(abs(n1>n2))\n puts(\"First\");\n else\n puts(\"Second\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(n1==n2 && k1n2)\n {\n printf(\"First\\n\");\n }\n else\n {\n printf(\"Second\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include\n\nint main(){\n\tint n1,n2,k1,k2;\n\tscanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n\tif(n1<=n2)\n\tprintf(\"Second\");\n\telse\n\tprintf(\"First\");\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n1,n2,k1,k2,f;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(n1==n2)\n f=2;\n else if(n1 > n2)\n f=1;\n\n else if(n1 < n2 )\n f=2;\n if(f==1)\n printf(\"First\\n\");\n else\n printf(\"Second\\n\" );\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\nint a,b;\nscanf(\"%d%d\",&a,&b);\nputs(a>b ? \"First\":\"Second\");\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n if(n1>n2)\n {\n printf(\"First\");\n }\n else\n {\n printf(\"Second\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(void) {\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(n1>n2)\n printf(\"First\");\n else\n printf(\"Second\");\n\treturn 0;\n} \n\n"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n\n if(n1>n2)\n printf(\"First\\n\");\n else\n printf(\"Second\\n\");\n return 0;\n}"}, {"source_code": "#include\n//#include\nint main()\n{\nint i,j,k,l;\nscanf(\"%d%d%d%d\",&i,&j,&k,&l);\nif(ij) printf(\"First\");\nelse if(i==j)\n{\n printf(\"Second\");\n}\nreturn 0;\n}\n\n"}, {"source_code": "#include\nint main ()\n{\n int a,b,c,d;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n if(a>b)\n printf(\"First\");\n else\n printf(\"Second\");\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(n1>n2)\n printf(\"First\");\n else\n printf(\"Second\");\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n\n if(n1>n2)\n printf(\"First\");\n else\n printf(\"Second\");\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n while(1){\n n1=n1-1;\n n2=n2-1;\n if(n1==0){\n printf(\"Second\");\n return 0;\n }\n if(n2==0){\n printf(\"First\");\n return 0;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n1,n2,k1,k2;\n\tscanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n\tif(n1>n2)\n\t{\t\n\t\t\tprintf(\"First\");\t\n\t}\n\telse\n\t{\t\n\t\t\tprintf(\"Second\");\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include \n\nint main()\n{\n int a,b;scanf(\"%d %d\",&a,&b);if(a>b){printf(\"First\");}\n else{printf(\"Second\");}\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,c,d,x,y;\n scanf(\"%d%d%d%d\",&a,&b,&c,&d);\n if(a>b)\n {\n printf(\"First\");\n return 0;\n }\n else printf(\"Second\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n if(n1>n2) printf(\"First\\n\");\n else printf(\"Second\\n\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\nint n1,n2,k1,k2;\nscanf(\"%d\", &n1);\nscanf(\"%d\", &n2);\nscanf(\"%d\", &k1);\nscanf(\"%d\", &k2);\nif(n1>n2)\nputs(\"First\");\nelse\nputs(\"Second\");\nreturn 0;\n}\n"}, {"source_code": "#include\nint main() {\nint n1,n2,k1,k2;\nscanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\nif(n1 > n2)\nprintf(\"First\");\nelse \nprintf(\"Second\");\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n1,n2,k1,k2,p;\n\n scanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n\n for(int i=1;;i++)\n {\n if(i%2!=0)\n {\n n1--;\n if(n1==0)\n {\n p=1;\n break;\n }\n }\n else\n {\n n2--;\n if(n2==0)\n {\n p=2;\n break;\n }\n }\n }\n if(p==1)\n {\n printf(\"Second\");\n }\n else{\n printf(\"First\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(n1<=n2&&k1<=k2){\n printf(\"Second\\n\");\n }\n else if(n1>n2&&k1>=k2){\n printf(\"First\\n\");\n }\n else if(n1>=n2&&k1<=k2){\n printf(\"First\\n\");\n }\n else if(n1==n2&&k1>k2){\n printf(\"Second\\n\");\n }\n else {\n printf(\"Second\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,c,d,m,n;\n scanf(\"%d%d%d%d\",&a,&b,&c,&d);\n if(b>a)\n printf(\"Second\");\n else if(b==a)\n printf(\"Second\");\n else\n printf(\"First\");\n return 0;\n\n\n\n\n\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n\n if(n1==n2 && n2==k1 && k1==k2 && k2==n1)\n printf(\"Second\");\n else if(n1==n2 && k1k2)||(k2>k1)))\n printf(\"Second\");\n else if(n1>n2)\n printf(\"First\");\n else if(n1\nint main ()\n{int n1,n2,k1,k2;\nscanf(\"%d\",&n1);\nscanf(\"%d\",&n2);\nscanf(\"%d\",&k1);\nscanf(\"%d\",&k2);\nif(n1>n2 && k1>=k2)\n printf(\"First\");\nif(n1>n2 && k1k2)\n printf(\"Second\");\nif(n1==n2 && k1>k2)\n printf(\"Second\");\nif(n1==n2 && k1<=k2)\n printf(\"Second\");\n return 0;}\n"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2,a,b;\n scanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n\n if(n1>n2){\n\n printf(\"First\\n\");\n\n }\n else{\n\n printf(\"Second\\n\");\n\n }\n return 0;\n\n\n\n\n}\n"}, {"source_code": "#include \nint main()\n{\n int a,b,c,d;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n if(a>b) printf(\"First\");\n else printf(\"Second\");\n return 0;\n}\n"}, {"source_code": "#include\nmain()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(n1>n2)\n printf(\"First\");\n else if(n1\n#include \n\nint main()\n{\n int n1,n2,k1,k2,max,step=0,step1=0;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n\n if(n1==n2)\n {\n printf(\"Second\");\n }\n else if(n1>n2)\n {\n printf(\"First\");\n }\n else\n {\n printf(\"Second\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n\n if(n1>n2)\n printf(\"First\");\n else\n printf(\"Second\");\n}\n"}, {"source_code": "int main() \n{\n\tint n1, n2, k1, k2;\n\tscanf (\"%d %d %d %d\", &n1, &n2, &k1, &k2);\n\tif (n1==n2)\n\t\tprintf (\"Second\");\n\tif (n1!=n2){\n\t\tif(n1>n2&&k1>=1)\n\t\t\tprintf (\"First\");\n\t\tif(n2>n1&&k2>=1)\n\t\t\tprintf (\"Second\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int a[4],i,t1,t2;\n for(i=0;i<4;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n if(a[0]>a[1])\n {\n printf(\"First\");\n }\n else\n printf(\"Second\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint a,b,c,d;\n\tscanf(\"%d%d%d%d\",&a,&b,&c,&d);\n\tif(a>b)\n\tprintf(\"First\\n\");\n\telse\n\tprintf(\"Second\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main(){\n int n1,n2,k1,k2;\n\n scanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n if(n1>n2)\n printf(\"First\");\n else printf(\"Second\");\n\n return 0;}\n\n"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2,x,y;\n scanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n if(n1>n2)\n printf(\"First\");\n else\n printf(\"Second\");\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n if(n1>n2){printf(\"First\");}\n else{printf(\"Second\");}\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(n1 <= 50 && n2 <= 50 && k1 <= 50 && k2 <= 50){\n if(n1 > n2)\n printf(\"First\");\n else\n printf(\"Second\");\n }\n \n \n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2,t1,t2;\n scanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n if(n1>n2)\n printf(\"First\");\n else\n printf(\"Second\");\n}\n"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(n1>n2&&k1>k2||(n1>n2&&k1<=k2))\n {\n printf(\"First\");\n }\n else\n {\n printf(\"Second\");\n }\n}"}, {"source_code": "#include \n#include\n#include\nint main()\n{\n #ifndef ONLINE_JUDGE\n freopen(\"input.txt\",\"r\",stdin);\n\tfreopen(\"output.txt\",\"w\",stdout);\n #endif\n\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n\n if(n1>n2)\n printf(\"First\\n\");\n else if(n2>=n1)\n printf(\"Second\\n\");\n\n \n}"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(n1>n2)\n printf(\"First\\n\");\n else\n printf(\"Second\\n\");\n return 0;\n}\n"}, {"source_code": "#include\nmain()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(n1>n2)\n printf(\"First\");\n else if(n1\n#include\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(n1==n2){\n if(k1k2){\n printf(\"Second\");\n }\n else if(k1==k2){\n printf(\"Second\");\n }\n }\n else if(n1>n2){\n printf(\"First\");\n }\n else if(n1\nint main(){\n int a,b,a2,b2;\n scanf(\"%d %d %d %d\",&a,&b,&a2,&b2);\n if(a > b)\n printf(\"First\");\n else\n printf(\"Second\");\n return 0;\n}\n"}, {"source_code": "#include\nmain()\n{\n\tint n1,k1,n2,k2;\n\tscanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n\tprintf(\"%s\",n1>n2?\"First\":\"Second\");\n}"}, {"source_code": "#include\nint main()\n{\nint n1,n2,k1,k2;\nscanf(\"%d\", &n1);\nscanf(\"%d\", &n2);\nscanf(\"%d\", &k1);\nscanf(\"%d\", &k2);\nif(n1>n2)\nputs(\"First\");\nelse\nputs(\"Second\");\nreturn 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(n1<=n2)\n printf(\"Second\");\n else\n printf(\"First\");\n return 0 ;\n}"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n if(n1>n2)\n printf(\"First\\n\");\n else\n printf(\"Second\\n\");\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n if(n1>n2)\n printf(\"First\");\n else \n printf(\"Second\"); \n return 0;\n}"}, {"source_code": "#include\nint main(){\nint n1,n2,k1,k2;\nscanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\nif(n1>n2)\nprintf(\"First\\n\");\nelse\nprintf(\"Second\\n\");\nreturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int a,b,c,d,m,k;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n if(b>=a) printf(\"Second\");\n else printf(\"First\");\n}\n"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(n1>n2)\n printf(\"First\");\n else if(n1==n2)\n printf(\"Second\");\n else\n printf(\"Second\"); \n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n if(n1>n2)\n printf(\"First\\n\");\n else\n printf(\"Second\\n\");\n return 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n\n int a,k1,k2,n1,n2;\n scanf(\"%d%d%d%d\",&k1,&k2,&n1,&n2);\n if (k1>k2)\n printf(\"First\\n\");\n else printf(\"Second\\n\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2,x,y;\n scanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n if(n1>n2)\n printf(\"First\");\n else\n printf(\"Second\");\n}\n"}, {"source_code": "#include \nint main (){\n\tint a,b,c,d;\n\tscanf(\"%d %d %d %d\",&a,&b,&c,&d);\n\tprintf((b>=a)?\"Second\":\"First\");\n\treturn 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int n1, n2, k1, k2 ;\n scanf(\"%d %d %d %d\", &n1, &n2, &k1,&k2) ;\n if( n1>n2){\n printf(\"First\");\n }\n else{\n printf(\"Second\");\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\n\tint n1,n2,k1,k2;\n\tscanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n\tint a1,a2;\n\n if(n1>n2)\n printf(\"First\");\n else\n printf(\"Second\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n1,n2,k1,k2;\n\tscanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n\tif(n1>n2)\n\t{\n\t\tprintf(\"First\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"Second\\n\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \nint main(){\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(n1<=n2)\n printf(\"Second\");\n else\n printf(\"First\");\n return 0 ;\n}"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(n1>n2&&k1>=k2||(n1>n2&&k1\nint main()\n{\n int n1,n2,k1,k2;\n\n scanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n if(n1==n2)\n {\n if(k2>k1)\n printf(\"Second\");\n else if(k1==k2)\n printf(\"First\");\n\n }\n else if(n1>n2)\n {\n printf(\"First\");\n }\n else if(n2>n1)\n {\n printf(\"Second\");\n }\n return 0;\n\n}"}, {"source_code": "\n\n #include\n int main()\n {\n int i,j,a,b,x,y;\n scanf(\"%d %d %d %d\",&a,&b,&x,&y);\n if(a>=b)\n {\n if(x>=y)\n printf(\"First\");\n else printf(\"Second\");\n }\n else if(a=y)\n printf(\"Second\");\n else printf(\"First\");\n }\n }\n"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(n1>n2)\n {\n printf(\"First\\n\");\n }\n else if(n1k2)\n {\n printf(\"First\\n\");\n }\n else\n {\n printf(\"Second\\n\");\n }\n }\n}"}, {"source_code": "#include\n//#include\nint main()\n{\nint i,j,k,l;\nscanf(\"%d%d%d%d\",&i,&j,&k,&l);\nif(ij) printf(\"First\");\nelse if(i==j)\n{\n if(kl) printf(\"First\");\n}\nreturn 0;\n}\n\n"}, {"source_code": "#include\n\nint main()\n{\n int n1,n2,k1,k2,num,sum;\n\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n num=n1/k1;\n sum=k2;\n if(sum>=num)\n {\n printf(\"Second\");\n }\n else\n {\n printf(\"First\");\n }\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\nint n1,n2,k1,k2;\nscanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\nif(n1>n2)\n{\nprintf(\"first\");\n}\nelse\n{\nprintf(\"second\");\n}\nreturn 0;\n}\n"}, {"source_code": "\n\n #include\n int main()\n {\n int i,j,a,b,x,y;\n scanf(\"%d %d %d %d\",&a,&b,&x,&y);\n if(a>=b)\n {\n if(x>=y)\n printf(\"First\");\n else printf(\"Second\");\n }\n else if(a=y)\n printf(\"Second\");\n else printf(\"First\");\n }\n }\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int b1,b2,m1,m2,i;\n\n scanf(\"%d %d %d %d\",&b1,&b2,&m1,&m2);\n if(m1<=b1&&m2<=b2)\n {\n if(m1==m2&&b2>b1)printf(\"Second\");\n else if(m1==m2&&b1>b2)printf(\"First\");\n else if(m1==m2&&b1==b2)printf(\"Second\");\n else if(m1>m2&&b1>=b2)printf(\"First\");\n else if(m1>m2&&b2-m2>=b1-m1)printf(\"Second\");\n else if(m2>m1&&b2>=b1)printf(\"Second\");\n else if(m2>m1&&b1-m1>=b2-m2)printf(\"First\");\n else printf(\"Second\");\n }\n else\n {\n if(m1-b1>m2-b2&&m1==m2)printf(\"Second\");\n else if(m1-b1m2-b2)printf(\"First\");\n else if(m1-b1\n#include\nint main()\n{\n int n1,n2,k1,k2,l,p;\n scanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n if(n1==n2)\n {\n l=abs(n1-k1);\n p=abs(n2-k2);\n if(l>p)\n {\n printf(\"Second\\n\");\n }\n }\n else if(n1>n2)\n {\n printf(\"First\\n\");\n }\n}\n"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(n1>n2&&k1>k2||(n1>n2&&k1\nint main()\n{\n int a[4],i,t1,t2;\n for(i=0;i<4;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n if(a[0]>a[1])\n {\n printf(\"First\");\n\n }\n else if(a[0]a[3])\n {\n printf(\"First\");\n }\n else\n printf(\"Second\");\n }\n\n\n\n return 0;\n}\n"}, {"source_code": "#include\nint main ()\n{\n int x,y,a,b,i,j;\n scanf(\"%d%d%d%d\",&x,&y,&a,&b);\n if(x>y){\n printf(\"First\\n\");\n }\n else if(y>x){\n printf(\"Second\\n\");\n }\n else if(x==y){\n i=x*a;\n j=b*y;\n if(i>j){\n printf(\"First\\n\");\n }\n else{\n printf(\"Second\\n\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n if(n1>n2)\n {\n if(k1>k2)\n puts(\"Second\");\n else if(k2>k1)\n puts(\"First\");\n else if(k1==k2)\n puts(\"First\");\n }\n else if(n2>n1)\n {\n if(k1>k2)\n puts(\"Second\");\n else if(k2>k1)\n puts(\"First\");\n else if(k1==k2)\n puts(\"First\");\n }\n else if(n1==n2)\n {\n if(k1>k2)\n puts(\"Second\");\n else if(k2>k1)\n puts(\"Second\");\n else if(k1==k2)\n puts(\"Second\");\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,m, k1,k2;\n\tscanf(\"%d %d %d %d\",&n,&m,&k1,&k2);\n\tint f1=n/k1;\n\tint f2=n%k1;\n\tint g1=m/k2;\n\tint g2=m%k2;\n\tif(n>m)\n\t\tprintf(\"First\\n\");\n\telse if(n\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(n1<=n2&&k1<=k2){\n printf(\"Second\\n\");\n }\n else if(n1>=n2&&k1>=k2){\n printf(\"First\\n\");\n }\n else if(n1>=n2&&k1<=k2){\n printf(\"First\\n\");\n }\n else if(n1==n2&&k1\nint main()\n{\n\tint n1,n2,k1,k2;\n\tscanf(\"%d\",&n1);\n\tscanf(\"%d\",&n2);\n\tscanf(\"%d\",&k1);\n\tscanf(\"%d\",&k2);\n\tif(n1>2)\n\t\tprintf(\"First\");\n\telse\n\t\tprintf(\"Second\");\n\treturn 0;\n\n}\n"}, {"source_code": "\n\n #include\n int main()\n {\n int i,j,a,b,x,y;\n scanf(\"%d %d %d %d\",&a,&b,&x,&y);\n if(a>b)\n {\n\n printf(\"First\");\n\n }\n else if(a\n#include \n\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n if((n1+n2)%2==0)printf(\"Second\");\n else printf(\"First\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include\nint main()\n{int n1,n2,k1,k2; \n\nscanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\nif (n1==n2 )\n if( k1>=k2)\n printf(\"Second\");\n else\n printf(\"First\");\nelse if (n1>n2 )\n if (k1>k2)\n printf(\"Second\");\n else \n printf(\"First\");\nelse \n if (k2>=k1)\n printf(\"Second\");\n else \n printf(\"First\");\n \n return 0;\n}\n"}, {"source_code": "#include\nint main ()\n{\n int x,y,a,b,i,j;\n scanf(\"%d%d%d%d\",&x,&y,&a,&b);\n if(x>y){\n printf(\"First\\n\");\n }\n else if(y>x){\n printf(\"Second\\n\");\n }\n else if(x==y){\n i=x*a;\n j=b*y;\n if(i>j){\n printf(\"First\\n\");\n }\n else{\n printf(\"Second\\n\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\n\tint n1,n2,k1,k2;\n\tscanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n\tint a1,a2;\n\n if(n1\n#include \n#include \n#include \n#include \n\n\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%i%i%i%i\",&n1,&n2,&k1,&k2);\n int i;\n\n if(n1 == n2)\n printf(\"Second\\n\");\n else if(n1>n2)\n printf(\"First\\n\");\n else\n printf(\"First\\n\");\n\n\n\n return 0;\n}\n\n\n"}, {"source_code": "#include \n#include \nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n if(n1>n2)\n {\n if(k1>k2)\n puts(\"Second\");\n else if(k2>k1)\n puts(\"First\");\n else if(k1==k2)\n puts(\"First\");\n }\n else if(n2>n1)\n {\n if(k1>k2)\n puts(\"Second\");\n else if(k2>k1)\n puts(\"Second\");\n else if(k1==k2)\n puts(\"Second\");\n }\n else if(n1==n2)\n {\n if(k1>k2)\n puts(\"Second\");\n else if(k2>k1)\n puts(\"Second\");\n else if(k1==k2)\n puts(\"Error\");\n }\n else\n puts(\"Error\");\n\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n \nint main()\n{\n int n1,n2,k1,k2;\n int i,j,x;\n \n scanf (\"%d\",&n1);\n scanf (\"%d\",&n2);\n scanf (\"%d\",&k1);\n scanf (\"%d\",&k2);\n if (n1>n2){\n printf(\"first\");\n \n }\n else printf(\"second\");\n \n \n return 0;\n}"}, {"source_code": "#include\n\nint main()\n\n{\n\n int n1,n2,k1,k2;\n\n scanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n\n\n\n if(n1==n2)\n {\n if(k1>k2)\n printf(\"FIRST\\n\");\n else\n printf(\"SECOND\\n\");\n }\n\n if(k1==k2)\n {\n if(n1>n2)\n printf(\"FIRST\\n\");\n else\n printf(\"SECOND\\n\");\n }\n\n\n return 0;\n\n\n}\n"}, {"source_code": "#include\n\nint main(){\n\tint n1,n2,k1,k2;\n\tscanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n\tif(n1*k1\nint main(){\n int n1, n2, k1, k2 ;\n scanf(\"%d %d %d %d\", &n1, &n2, &k1,&k2) ;\n if( n1 == n2){\n if( k1 > k2){\n printf(\"First\");\n }\n else{\n printf(\"Second\");\n }\n }\n else{\n if(n1 > n2){\n printf(\"First\");\n }\n else{\n printf(\"Second\");\n }\n }\n return 0;\n }\n"}, {"source_code": "#include\nint main()\n{\nint n1,n2,k1,k2;\nscanf(\"%d\", &n1);\nscanf(\"%d\", &n2);\nscanf(\"%d\", &k1);\nscanf(\"%d\", &k2);\nif((n1+n2)%2==0)\nputs(\"Second\");\nelse\nputs(\"First\");\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2,k3;\n scanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n if(n1>n2)\n printf(\"First\\n\");\n else if(n1== n2 && k1>k2)\n printf(\"First\\n\");\n else\n printf(\"Second\\n\");\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n\nint a,b,c,d;\nscanf(\"%d %d %d %d\",&a,&b,&c,&d);\nif(c\n\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(n1==n2 && k1>k2)\n printf(\"First\");\n else if(n1>n2 && k1==k2)\n printf(\"First\");\n else if(n1==n2 && k2>k1)\n printf(\"Second\");\n else\n printf(\"Second\");\n \n return 0;\n}"}, {"source_code": "#include\nint main ()\n{\n int x,y,a,b,i,j;\n scanf(\"%d%d%d%d\",&x,&y,&a,&b);\n i=x*a;\n j=b*y;\n if(i>j){\n printf(\"First\\n\");\n }\n else{\n printf(\"Second\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n,nn,k,kk;\n scanf(\"%d%d%d%d\",&n,&nn,&k,&kk);\n if(k\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(n1==n2 && k1n2)\n {\n printf(\"First\\n\");\n }\n return 0;\n}\n"}, {"source_code": "/*in the name of allah*/\n#include\nint main()\n{\n\tint n1, n2, k1, k2;\n\tscanf(\"%d %d %d %d\\n\", &n1, &n2, &k1, &k2);\t\n\tif (n1 > n2 ){\t\t\t\t\n\t\t\tprintf(\"first\");\t\n\t}\n\telse{\n\t\tprintf(\"secend\");\n\t}\t\n\treturn 0;\n}"}, {"source_code": "#include\nmain()\n{int n1,n2,k1,k2;\nscanf(\"%d\\t%d\\t%d\\t%d\",&n1,&n2,&k1,&k2);\nif(n1>=n2)\n printf(\"First\");\nelse\n printf(\"Second\");\n}\n"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(n1<=n2&&k1=n2&&k1>=k2){\n printf(\"First\\n\");\n }\n else if(n2>=n1&&k1>k2){\n printf(\"Second\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(n1>n2)\n {\n printf(\"First\\n\");\n }\n else if(n1k2)\n {\n printf(\"First\\n\");\n }\n else\n {\n printf(\"Second\\n\");\n }\n }\n}"}, {"source_code": "#include\nint main()\n{\n int n1, n2, k1, k2;\n scanf(\"%d %d %d %d\", &n1, &n2, &k1, &k2);\n if (n1 > n2) printf(\"First\\n\");\n else if (n1 < n2) printf(\"Second\\n\");\n else if (n1 == n2) {\n if (n1 % 2 == 0) printf(\"Second\\n\");\n else printf(\"First\\n\");\n }\n return 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n if(n1==n2){if (((n1-k1)>(n2-k2))){printf(\"Second\");}\n else {printf(\"First\");}}\n\n else if ((n1>n2)&&((n1-k1)>(n2-k2))){printf(\"First\");}\n else {printf(\"Second\");}\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\nint n1,n2,k1,k2;\nscanf(\"%d\", &n1);\nscanf(\"%d\", &n2);\nscanf(\"%d\", &k1);\nscanf(\"%d\", &k2);\nif(n1>n2)\nputs(\"First\");\nelse if(n2>n1)\nputs(\"Second\");\nelse if(k1>k2)\nputs(\"First\");\nelse\nputs(\"Second\");\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(n1 <= 50 && n2 <= 50 && k1 <= 50 && k2 <= 50){\n if(n1 > n2)\n printf(\"FIRST\");\n else\n printf(\"SECOND\");\n }\n \n \n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint n1,n2,k1,k2,a,b;\n\tscanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n\ta=n1-k1;\n\tb=n2-k2;\n\tif(n1>n2){\n\t\tprintf(\"FIRST\\n\");\n\t}\n\telse{\n\t\tprintf(\"SECOND\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\", &n1,&n2,&k1,&k2);\n if(n1>=n2&&k1>=k2)printf(\"First\");\n else printf(\"Second\");\n return 0;\n }\n"}, {"source_code": "#include \n#include \nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n if(n1>n2)\n {\n if(k1>k2)\n puts(\"Second\");\n else if(k2>k1)\n puts(\"First\");\n else if(k1==k2)\n puts(\"First\");\n }\n else if(n2>n1)\n {\n if(k1>k2)\n puts(\"Second\");\n else if(k2>k1)\n puts(\"Second\");\n else if(k1==k2)\n puts(\"Second\");\n }\n else if(n1==n2)\n {\n if(k1>k2)\n puts(\"Second\");\n else if(k2>k1)\n puts(\"Second\");\n else if(k1==k2)\n puts(\"Error\");\n }\n else\n puts(\"Error\");\n\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\n\tint n1,n2,k1,k2,k;\n\tscanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n\tint a1,a2;\n\ta1=n1-k1;\n\ta2=n2-k2;\n\tk=k1-k2;\n\tif(a1>a2&&k>0)\n {\n printf(\"Second\");\n }\n else\n printf(\"First\");\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,c,d,m,k;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n while(1){\n a=a-c;\n if(a<0) break;\n b=b-d;\n if(b<0) break;\n m=c;\n c=d;\n d=m;\n }\n if(b<0) printf(\"First\");\n else printf(\"Second\");\n}\n"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(k1k2)\n printf(\"First\\n\");\n else\n printf(\"First\\n\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,c,d;\n scanf(\"%d\",&a,&b,&c,&d);\n \n if(a>b)\n printf(\"first\\n\");\n \n else\n printf(\"second\\n\");\n \n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n1,n2,k1,k2;\n int flag=1;\n scanf(\"%d\\n\",&n1);\n scanf(\"%d\\n\",&n2);\n scanf(\"%d\\n\",&k1);\n scanf(\"%d\",&k2);\n while (flag==1){\n n1=n1-1;\n if (n1<=0&&n2<=0){\n printf(\"Frist\");\n flag=0;\n break;\n }\n n2=n2-1;\n if (n2<=0&&n1<=0){\n printf(\"Second\");\n flag=0;\n }\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\n int a,k1,k2,n1,n2;\n scanf(\"%d%d%d%d\",&k1,&k2,&n1,&n2);\n if (k1==k2) {\n if (n1>=n2)\n printf(\"First\\n\");\n else\n printf(\"Second\\n\");\n }\n else if (k1>k2)\n printf(\"First\\n\");\n else printf(\"Second\\n\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,c,d,m,k;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n while(1){\n a=a-c;\n if(a<0) break;\n b=b-d;\n if(b<0) break;\n m=c;\n c=d;\n d=m;\n }\n if(b<0) printf(\"First\");\n else printf(\"Second\");\n}\n"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2,k3;\n scanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n if(n1>n2)\n printf(\"First\\n\");\n else if(n1== n1 && k1>k2)\n printf(\"First\\n\");\n else\n printf(\"Second\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int b1,b2,m1,m2,i;\n\n scanf(\"%d %d %d %d\",&b1,&b2,&m1,&m2);\n if(m1<=b1&&m2<=b2)\n {\n if(m1==m2&&b2>b1)printf(\"Second\");\n else if(m1==m2&&b1>b2)printf(\"First\");\n else if(m1==m2&&b1==b2)printf(\"Second\");\n else if(m1>m2&&b1>=b2)printf(\"First\");\n else if(m1>m2&&b2-m2>=b1-m1)printf(\"Second\");\n else if(m2>m1&&b2>=b1)printf(\"Second\");\n else if(m2>m1&&b1-m1>=b2-m2)printf(\"First\");\n else printf(\"Second\");\n }\n else\n {\n if(m1-b1>m2-b2&&m1==m2)printf(\"Second\");\n else if(m1-b1m2-b2)printf(\"First\");\n else if(m1-b1\n//#include\nint main()\n{\nint i,j,k,l;\nscanf(\"%d%d%d%d\",&i,&j,&k,&l);\nif(ij) printf(\"First\");\nelse if(i==j)\n{\n if(kl) printf(\"First\");\n}\nreturn 0;\n}\n\n"}, {"source_code": "#include\nint main ()\n{int n1,n2,k1,k2;\nscanf(\"%d\",&n1);\nscanf(\"%d\",&n2);\nscanf(\"%d\",&k1);\nscanf(\"%d\",&k2);\nif(n1>n2 && k1>=k2)\n printf(\"First\");\nif(n1>n2 && k1k2)\n printf(\"second\");\nif(n1==n2 && k1>=k2)\n printf(\"First\");\nif(n1==n2 && k1\nint main()\n{\n int m,n,p,q;\n scanf(\"%d %d %d %d\",&m,&n,&p,&q);\n if(p==q)\n {\n printf(\"Second\");\n }\n else if(p>q)\n {\n printf(\"First\");\n }\n else if(p\nint main() {\nint n1,n2,k1,k2;\nscanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\nif(n1 == n2 || n1 > k1)\nprintf(\"Second\");\nelse \nprintf(\"First\");\n}"}, {"source_code": "#include\nint main()\n{\n\tint n1,n2,k1,k2;\n\tscanf(\"%d\",&n1);\n\tscanf(\"%d\",&n2);\n\tscanf(\"%d\",&k1);\n\tscanf(\"%d\",&k2);\n\tif(k1>=k2)\n\t\tprintf(\"First\");\n\telse\n\t\tprintf(\"Second\");\n\treturn 0;\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(n1==n2 && k1>k2)\n printf(\"First\");\n else if(n1==n2 && k1n2)\n printf(\"First\");\n else if(n1\nint main ()\n{\nint a,b,c,d;\nscanf(\"%d %d %d %d\",&a,&b,&c,&d);\nif (a==b)\n\tprintf(\"second\");\nelse if (a>b)\n{\n\tif (c>=a-b+1)\n\t\tprintf(\"second\");\n\telse\n\t\tprintf(\"first\");\n}\nelse\n{\n\tif (c>=a-b+1)\n\t\tprintf(\"first\");\n\telse\n\t\tprintf(\"second\");\n}\nreturn 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2,i,j;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(k1==0 && k2>0)\n printf(\"Second\");\n else if(k2==0 && k1>0)\n printf(\"First\");\n else if((n1-k1)>(n2-k2))\n printf(\"First\");\n else if((n1-k1)>(n2-k2))\n printf(\"Second\");\n\n}"}, {"source_code": "main(){\n\tint a,b,c,d;\n\tscanf(\"%d %d %d %d\",&a,&b,&c,&d);\n\tprintf(\"%s\",c \nint main()\n{\n\tint n,m,k,p;\n\tscanf(\"%d%d%d%d\",&n,&m,&k,&p);\n if(n>=m&&p==k)\n {\n \tprintf(\"First\");\n\t}\n\telse\n\t{\n\t\tprintf(\"Second\");\n\t}\n}\n"}, {"source_code": "#include \nint main()\n{\nint n1,n2,k1,k2;\nscanf(\"%d\", &n1);\nscanf(\"%d\", &n2);\nscanf(\"%d\",&k1);\nscanf(\"%d\", &k2);\nif ( n1>1 && n1<50 && n2>1 && n2<50 && k1>1 && k1<50 && k2>1 && k2<50 && k1\n#include\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(n1==n2){\n if(k1k2){\n printf(\"First\");\n }\n else if(k1==k2){\n printf(\"Second\");\n }\n }\n else if(n1>n2){\n printf(\"First\");\n }\n else if(n1\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\", &n1,&n2,&k1,&k2);\n if(n1>=n2&&k1>=k2)printf(\"First\");\n else printf(\"Second\");\n return 0;\n }\n"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(n1>=n2)\n {\n printf(\"First\");\n }\n else\n {\n printf(\"Second\");\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\n\tint n1,n2,k1,k2;\n\tscanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n\tint a1,a2;\n\n if(n1\n\nvoid doPrint(int n1, int n2)\n{\n if(n1 < n2)\n printf(\"First\");\n else\n printf(\"Second\");\n}\n\nint main()\n{\n int n1, n2, k1, k2;\n scanf(\"%d %d %d %d\", &n1, &n2, &k1, &k2);\n doPrint(n1, n2);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(n1==n2 && k1>k2)\n printf(\"First\");\n else if(n1==n2 && k1n2)\n printf(\"First\");\n else if(n1\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n\n if(k1>=k2)\n printf(\"First\");\n else\n printf(\"Second\");\n}\n"}, {"source_code": "#include \n\nint main(void)\n{\n\tint a, b, c, k;\n\tscanf(\"%d %d %d %d\", &a, &b, &c, &k);\n\tprintf(\"%s\\n\", a*c>b*k?\"First\":\"Second\");\n\n\treturn 0;\n}\n"}, {"source_code": "\n#include\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(n1>n2)\n {\n printf(\"First\");\n }\n else if(n1k2)\n printf(\"First\");\n else\n printf(\"Second\");\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include\nint main()\n{int n1,n2,k1,k2; \n\nscanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\nif (n1==n2 )\n if( k1>=k2)\n printf(\"Second\");\n else\n printf(\"First\");\nelse if (n1>n2 )\n if (k1>k2)\n printf(\"Second\");\n else \n printf(\"First\");\nelse \n if (k2>=k1)\n printf(\"Second\");\n else \n printf(\"First\");\n \n return 0;\n}\n"}, {"source_code": "#include \n#include\n#include\nint main()\n{\n #ifndef ONLINE_JUDGE\n freopen(\"input.txt\",\"r\",stdin);\n\tfreopen(\"output.txt\",\"w\",stdout);\n #endif\n\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n\n if(n1>n2&&k1>=k2)\n printf(\"First\\n\");\n if (n2>n1&&k2>=k1)\n {\n printf(\"Second\\n\");\n }\n if(n1==n2&&k1>k2)\n printf(\"First\\n\");\n if (n1==n2&&k2>k1)\n {\n printf(\"Second\\n\");\n }\n\n\n \n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int b1,b2,m1,m2,i;\n\n scanf(\"%d %d %d %d\",&b1,&b2,&m1,&m2);\n if(m1<=b1&&m2<=b2)\n {\n if(m1==m2&&b2>b1)printf(\"Second\");\n else if(m1==m2&&b1>b2)printf(\"First\");\n else if(m1==m2&&b1==b2)exit(1);\n else if(m1>m2&&b1>=b2)printf(\"First\");\n else if(m1>m2&&b2-m2>=b1-m1)printf(\"Second\");\n else if(m2>m1&&b2>=b1)printf(\"Second\");\n else if(m2>m1&&b1-m1>=b2-m2)printf(\"First\");\n else exit(1);\n }\n\n return 0;\n}\n"}, {"source_code": "//game complete\n//Bismillahir Rahmanir Rahim\n\n#include\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n if(n1n2) printf(\"First\\n\");\n else if(n1==n2)\n {\n if(k1>k2)\n printf(\"First\\n\");\n else if(k1\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\", &n1,&n2,&k1,&k2);\n if(n1>n2&&k1>=k2)printf(\"First\");\n else printf(\"Second\");\n return 0;\n }"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2,x,y;\n scanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n x=n1*k1;\n y=n2*k2;\n if(x>y)\n printf(\"First\");\n else\n printf(\"Second\");\n}\n"}, {"source_code": "#include \n\nint main() \n{\n\tint n1, n2, k1, k2;\n\tscanf (\"%d %d %d %d\", &n1, &n2, &k1, &k2);\n\tif (n1==n2&&k1==k2)\n\t\tprintf (\"Second\");\n\tif (n1!=n2){\n\t\tif(n1>n2&&k1>=1)\n\t\t\tprintf (\"First\");\n\t\tif(n2>n1&&k2>=1)\n\t\t\tprintf (\"Second\");\n\t}\n\tif (n1==n2){\n\t\tif (k1>k2)\n\t\t\tprintf (\"First\");\n\t\tif (k2>k1)\n\t\t\tprintf (\"Second\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \nint main()\n{\n int n1,n2,k1,k2;\n printf(\"Enter n1 then n2:\\t\");\n scanf(\"%d%d\",&n1,&n2);\n scanf(\"%d%d\",&k1,&k2);\n if (n1>n2)\n printf(\"First\");\n\nif (n1<=n2)\n printf(\"Second\");\n return 0;\n}\n"}, {"source_code": "# include \nint main ()\n{\n int n1,n2,k1,k2;\n scanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n if(n1==n2 && k1n2 && k2>k1)\n printf(\"Second\\n\");\n else if(n2>n1 && k1>k2)\n printf(\"Second\\n\");\n return 0;\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,m,k,l;\n scanf(\"%d%d%d%d\",&n,&m,&k,&l);\n if(n==m)\n {\n l>=k?printf(\"Second\"):printf(\"First\");\n }\n else\n {\n m>=n?printf(\"Second\"):printf(\"First\");\n }\n return 0;\n}"}, {"source_code": "#include\n\n\nint main (void) {\n\tint n1, n2;\n\n\tscanf(\" %d %d %*d %*d\", &n1, &n2);\n\n\tif(n1 > n2) {\n\t\tprintf(\"First\\n\");\n\t} else if(n2 > n1) {\n\t\tprintf(\"Second\\n\");\n\t} else {\n\t\tif(n1 % 2 == 0) {\n\t\t\tprintf(\"Second\\n\");\n\t\t} else {\n\t\t\tprintf(\"First\\n\");\n\t\t}\n\t}\n\treturn 0;\n}\n\n// 1472848509537"}, {"source_code": "#include\nint main()\n{\n int n,m,b,a;\n scanf(\"%d %d %d %d\",&n,&m,&a,&b);\n int l = 0;\n int p = 0;\n int ara[n];\n while(l\nint main()\n{\nint n1,n2,k1,k2;\nscanf(\"%d\", &n1);\nscanf(\"%d\", &n2);\nscanf(\"%d\", &k1);\nscanf(\"%d\", &k2);\nif((n1+n2)%2==0)\nputs(\"Second\");\nelse\nputs(\"First\");\nreturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n1,n2,k1,k2,min,step=0,step1=0;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(k2=min;){\n n1=n1-min;\n step++;\n\n }\n for(;n2!=0&&n2>=min;){\n n2=n2-min;\n step1++;\n }\n if(step==step1){\n printf(\"second\");\n }\n else if(step>step1){\n printf(\"first\");\n }\n else{\n printf(\"second\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(n1 <= 50 && n2 <= 50 && k1 <= 50 && k2 <= 50){\n if(n1 > n2)\n printf(\"FIRST\");\n else\n printf(\"SECOND\");\n }\n \n \n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2,t1=0,t2=0;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n t1=n1+k1;\n t2=n2+k2;\n if(t1>t2)\n printf(\"First\\n\");\n else\n printf(\"Second\\n\");\nreturn 0;\n}\n"}, {"source_code": "#include\nmain()\n{\n int n1, n2, k1, k2;\n scanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n if(n1>=n2)\n {\n if(k1>=k2)\n {\n printf(\"First\");\n }\n else\n printf(\"Second\");\n }\n else\n {\n if(k1>=k2)\n printf(\"Second\");\n else\n printf(\"First\");\n \n }\n}"}, {"source_code": "#include \n#include \n\nint main()\n{int n1,n2,k1,k2;\n\nscanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\nif (n1==n2 )\n if (k1==k2)\n printf(\"Second\");\n\n else if( k1>k2)\n printf(\"First\");\n else\n printf(\"Second\");\nelse if (n1>n2 )\n if (k1>k2)\n printf(\"First\");\n else\n printf(\"Second\");\n\nelse\n if (k1==k2)\n printf(\"Second\");\n\n else if (k2>k1)\n printf(\"Second\");\n else\n printf(\"Second\");\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n1,n2,k1,k2,i,j;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(k1==0 && k2>0)\n printf(\"Second\");\n else if(k2==0 && k1>0)\n printf(\"First\");\n else if((n1-k1)<(n2-k2) && (n1-k1)==0)\n printf(\"First\");\n else if((n1-k1)>(n2-k2) && (n2-k2)==0)\n printf(\"Second\");\n else if((n1-k1)<(n2-k2))\n printf(\"Second\");\n else if((n1-k1)>(n2-k2))\n printf(\"First\");\n}"}, {"source_code": "#include \n#include \n\n/* run this program using the console pauser or add your own getch, system(\"pause\") or input loop */\n\nint main() {\n int n1 , n2 , k1 , k2 ;\n scanf (\"%d %d %d %d\" , &n1 , &n2 , &k1 ,&k2 ) ;\n if (n2 >= n1 )\n { \n printf (\"2\") ;\n}\n else \n {\n printf (\"1\") ;\n}\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n int n1,n2,k1,k2;\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n if(n1==n2){\n if(k1k2){\n printf(\"First\");\n }\n else if(k1==k2){\n printf(\"Second\");\n }\n }\n else if(n1>n2){\n printf(\"First\");\n }\n else if(n1\nint main()\n{\n\tint n1,n2,k1,k2; \n\tscanf(\"%d%d%d%d\",&n1,&n2,&k1,&k2);\n\tif(n1>n2&&k1==k2)\n\t{\n\t\tprintf(\"First\");\n\t}\n\telse if(n1==n2&&k1>n2&&k1>k2)\n\t{\n\t\tprintf(\"First\");\n\t}\n\telse\n\t{\n\t\tprintf(\"Second\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int b1,b2,m1,m2,i;\n\n scanf(\"%d %d %d %d\",&b1,&b2,&m1,&m2);\n if(m1<=b1&&m2<=b2)\n {\n if(m1==m2&&b2>b1)printf(\"Second\");\n else if(m1==m2&&b1>b2)printf(\"First\");\n else if(m1==m2&&b1==b2)printf(\"\");\n else if(m1>m2&&b1>=b2)printf(\"First\");\n else if(m1>m2&&b2-m2>=b1-m1)printf(\"Second\");\n else if(m2>m1&&b2>=b1)printf(\"Second\");\n else if(m2>m1&&b1-m1>=b2-m2)printf(\"First\");\n else printf(\"\");\n }\n else\n {\n if(m1-b1>m2-b2&&m1==m2)printf(\"Second\");\n else if(m1-b1m2-b2)printf(\"First\");\n else if(m1-b1\n\nint main()\n{\n int n1,n2,k1,k2,num,sum;\n\n scanf(\"%d %d %d %d\",&n1,&n2,&k1,&k2);\n num=n1/k1;\n sum=n2;\n if(sum>=num)\n {\n printf(\"Second\");\n }\n else\n {\n printf(\"First\");\n }\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\nint n,m,k,l;\nscanf(\"%d%d%d%d\",&n,&m,&k,&l);\nif(n>=m)\n{\n if(k>=l)\nprintf(\"First\");\nif(k\nint main(){\n\tint n,m,x,y;\n\tscanf(\"%d % d %d %d\",&n,&m,&x,&y);\n\tif(n>m){\n\t\tprintf(\"First\");}\n\tif(n<=m){\n\t\tprintf(\"Second\");}\n}\n\t\t\t\t"}], "src_uid": "aed24ebab3ed9fd1741eea8e4200f86b"} {"nl": {"description": "It's tough to be a superhero. And it's twice as tough to resist the supervillain who is cool at math. Suppose that you're an ordinary Batman in an ordinary city of Gotham. Your enemy Joker mined the building of the city administration and you only have several minutes to neutralize the charge. To do that you should enter the cancel code on the bomb control panel.However, that mad man decided to give you a hint. This morning the mayor found a playing card under his pillow. There was a line written on the card:The bomb has a note saying \"J(x) = A\", where A is some positive integer. You suspect that the cancel code is some integer x that meets the equation J(x) = A. Now in order to decide whether you should neutralize the bomb or run for your life, you've got to count how many distinct positive integers x meet this equation.", "input_spec": "The single line of the input contains a single integer A (1 ≤ A ≤ 1012).", "output_spec": "Print the number of solutions of the equation J(x) = A.", "sample_inputs": ["3", "24"], "sample_outputs": ["1", "3"], "notes": "NoteRecord x|n means that number n divides number x. is defined as the largest positive integer that divides both a and b.In the first sample test the only suitable value of x is 2. Then J(2) = 1 + 2.In the second sample test the following values of x match: x = 14, J(14) = 1 + 2 + 7 + 14 = 24 x = 15, J(15) = 1 + 3 + 5 + 15 = 24 x = 23, J(23) = 1 + 23 = 24 "}, "positive_code": [{"source_code": "#include \n\n#define MAX 1000010\n\nint p, primes[78777], flag[MAX] = {0};\n\nvoid Sieve(){\n int i, j, d;\n\n flag[2] = 1;\n for (i = 3; i < MAX; i++, i++) flag[i] = 1;\n for (i = 3; i < 1001;){\n d = i << 1;\n for (j = (i * i); j < MAX; j += d) flag[j] = 0;\n\n i++, i++;\n while (!flag[i]) i++, i++;\n }\n\n p = 0;\n for (i = 0; i < MAX; i++){\n if (flag[i]) primes[p++] = i;\n }\n}\n\nint isPrime(long long x){\n if ((x < 2)) return 0;\n\n int i;\n for (i = 0; ; i++){\n long long y = primes[i];\n if ((y * y) > x) return 1;\n if ((x % y) == 0) return 0;\n }\n}\n\nint F(int i, long long a){\n if (a == 1) return 1;\n long long y = primes[i];\n if ((y + 1) > a) return 0;\n\n if (((y * y) + 1) > a){\n if (isPrime(a - 1)) return 1;\n return 0;\n }\n\n long long x = 1;\n int res = F(i + 1, a);\n\n for (; ;){\n x *= y;\n if ((x + 1) > a) break;\n\n if ((a % (x + 1)) == 0) res = res + F(i + 1, a / (x + 1));\n }\n return res;\n}\n\nint Solve(long long a){\n if (a < 5) return (a != 2);\n return F(0, a);\n}\n\nint main(){\n Sieve();\n long long a;\n while (scanf(\"%I64d\", &a) != EOF) printf(\"%d\\n\", Solve(a));\n return 0;\n}\n"}, {"source_code": "#include \n\n#define MAX 1000010\n\nint p, primes[78777], flag[MAX];\n\nvoid Sieve(){\n int i, j, d;\n\n flag[2] = 1;\n for (i = 3; i < MAX; i++, i++) flag[i] = 1;\n for (i = 3; i < 1001;){\n d = i << 1;\n for (j = (i * i); j < MAX; j += d) flag[j] = 0;\n do{\n i++;\n }while (!flag[++i]);\n }\n\n for (i = 0; i < MAX; i++){\n if (flag[i]) primes[p++] = i;\n }\n}\n\nint isPrime(long long x){\n int i;\n for (i = 0; ; i++){\n long long y = primes[i];\n if ((y * y) > x) return 1;\n if ((x % y) == 0) return 0;\n }\n}\n\nint F(int i, long long a){\n if (a == 1) return 1;\n long long y = primes[i];\n if ((y + 1) > a) return 0;\n\n if (((y * y) + 1) > a){\n if (isPrime(a - 1)) return 1;\n return 0;\n }\n\n long long x = 1;\n int res = F(i + 1, a);\n\n for (; ;){\n x *= y;\n if ((x + 1) > a) break;\n\n if ((a % (x + 1)) == 0) res = res + F(i + 1, a / (x + 1));\n }\n return res;\n}\n\nint Solve(long long a){\n if (a < 5) return (a != 2);\n return F(0, a);\n}\n\nint main(){\n Sieve();\n long long a;\n while (scanf(\"%I64d\", &a) != EOF) printf(\"%d\\n\", Solve(a));\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\n#define MAX 1000010\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint p, primes[78777], flag[MAX] = {0};\n\nvoid Sieve(){\n int i, j, d;\n\n flag[2] = 1;\n for (i = 3; i < MAX; i++, i++) flag[i] = 1;\n for (i = 3; i < 1001;){\n d = i << 1;\n for (j = (i * i); j < MAX; j += d) flag[j] = 0;\n\n i++, i++;\n while (!flag[i]) i++, i++;\n }\n\n p = 0;\n for (i = 0; i < MAX; i++){\n if (flag[i]) primes[p++] = i;\n }\n}\n\nint isPrime(long long x){\n if ((x < 2) || !(x & 1)) return 0;\n\n int i;\n for (i = 1; i < p; i++){\n long long y = primes[i];\n if ((y * y) > x) return 1;\n if ((x % y) == 0) return 0;\n }\n return 1;\n}\n\nint F(int i, long long a){\n if (a == 1) return 1;\n long long y = primes[i];\n if ((y + 1) > a) return 0;\n\n if ((i == p) || ( ((y * y) + 1) > a) ){\n if ((primes[i - 1] + 1) < a){\n if (isPrime(a - 1)) return 1;\n return 0;\n }\n return 0;\n }\n\n long long x = 1;\n int res = F(i + 1, a);\n\n for (; ;){\n x *= y;\n if ((x + 1) > a) break;\n\n if ((a % (x + 1)) == 0) res = res + F(i + 1, a / (x + 1));\n }\n return res;\n}\n\nint Solve(long long a){\n if (a < 5) return (a != 2);\n return F(0, a);\n}\n\nint main(){\n Sieve();\n long long a;\n while (scanf(\"%I64d\", &a) != EOF) printf(\"%d\\n\", Solve(a));\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\n#define MAXI 100\n#define MAXA 50000\n#define MAX 1000010\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint dp[MAXI][MAXA];\nint p, primes[78777], flag[MAX] = {0};\n\nvoid Sieve(){\n int i, j, d;\n\n flag[2] = 1;\n for (i = 3; i < MAX; i++, i++) flag[i] = 1;\n for (i = 3; i < 1001;){\n d = i << 1;\n for (j = (i * i); j < MAX; j += d) flag[j] = 0;\n\n i++, i++;\n while (!flag[i]) i++, i++;\n }\n\n p = 0;\n for (i = 0; i < MAX; i++){\n if (flag[i]) primes[p++] = i;\n }\n}\n\nint isPrime(long long x){\n if ((x < 2) || !(x & 1)) return 0;\n\n int i;\n for (i = 1; i < p; i++){\n long long y = primes[i];\n if ((y * y) > x) return 1;\n if ((x % y) == 0) return 0;\n }\n return 1;\n}\n\nint F(int i, long long a){\n if (a == 1) return 1;\n long long y = primes[i];\n if ((y + 1) > a) return 0;\n\n if ((i == p) || ( ((y * y) + 1) > a) ){\n if ((primes[i - 1] + 1) < a){\n if (isPrime(a - 1)) return 1;\n return 0;\n }\n return 0;\n }\n if (i < MAXI && a < MAXA && dp[i][a] != -1) return dp[i][a];\n\n long long x = 1;\n int res = F(i + 1, a);\n\n for (; ;){\n x *= y;\n if ((x + 1) > a) break;\n\n if ((a % (x + 1)) == 0) res = res + F(i + 1, a / (x + 1));\n }\n\n if (i < MAXI && a < MAXA) dp[i][a] = res;\n return res;\n}\n\nint Solve(long long a){\n if (a < 5) return (a != 2);\n return F(0, a);\n}\n\nint main(){\n Sieve();\n memset(dp, -1, sizeof(dp));\n\n long long a;\n while (scanf(\"%I64d\", &a) != EOF) printf(\"%d\\n\", Solve(a));\n return 0;\n}\n"}, {"source_code": "#include \n\n#define MAX 1000010\n\nint p, primes[78777], flag[MAX] = {0};\n\nvoid Sieve(){\n int i, j, d;\n\n flag[2] = 1;\n for (i = 3; i < MAX; i++, i++) flag[i] = 1;\n for (i = 3; i < 1001;){\n d = i << 1;\n for (j = (i * i); j < MAX; j += d) flag[j] = 0;\n\n i++, i++;\n while (!flag[i]) i++, i++;\n }\n\n p = 0;\n for (i = 0; i < MAX; i++){\n if (flag[i]) primes[p++] = i;\n }\n}\n\nint isPrime(long long x){\n if ((x < 2)) return 0;\n\n int i;\n for (i = 0; i < p; i++){\n long long y = primes[i];\n if ((y * y) > x) return 1;\n if ((x % y) == 0) return 0;\n }\n return 1;\n}\n\nint F(int i, long long a){\n if (a == 1) return 1;\n long long y = primes[i];\n if ((y + 1) > a) return 0;\n\n if ((i == p) || ( ((y * y) + 1) > a) ){\n if ((primes[i - 1] + 1) < a){\n if (isPrime(a - 1)) return 1;\n return 0;\n }\n return 0;\n }\n\n long long x = 1;\n int res = F(i + 1, a);\n\n for (; ;){\n x *= y;\n if ((x + 1) > a) break;\n\n if ((a % (x + 1)) == 0) res = res + F(i + 1, a / (x + 1));\n }\n return res;\n}\n\nint Solve(long long a){\n if (a < 5) return (a != 2);\n return F(0, a);\n}\n\nint main(){\n Sieve();\n long long a;\n while (scanf(\"%I64d\", &a) != EOF) printf(\"%d\\n\", Solve(a));\n return 0;\n}\n"}, {"source_code": "#include \n\n#define MAX 1000010\n\nint p, primes[78777], flag[MAX] = {0};\n\nvoid Sieve(){\n int i, j, d;\n\n flag[2] = 1;\n for (i = 3; i < MAX; i++, i++) flag[i] = 1;\n for (i = 3; i < 1001;){\n d = i << 1;\n for (j = (i * i); j < MAX; j += d) flag[j] = 0;\n\n i++, i++;\n while (!flag[i]) i++, i++;\n }\n\n p = 0;\n for (i = 0; i < MAX; i++){\n if (flag[i]) primes[p++] = i;\n }\n}\n\nint isPrime(long long x){\n if ((x < 2)) return 0;\n\n int i;\n for (i = 0; i < p; i++){\n long long y = primes[i];\n if ((y * y) > x) return 1;\n if ((x % y) == 0) return 0;\n }\n return 1;\n}\n\nint F(int i, long long a){\n if (a == 1) return 1;\n long long y = primes[i];\n if ((y + 1) > a) return 0;\n\n if ((i == p) || ( ((y * y) + 1) > a) ){\n if (isPrime(a - 1)) return 1;\n return 0;\n }\n\n long long x = 1;\n int res = F(i + 1, a);\n\n for (; ;){\n x *= y;\n if ((x + 1) > a) break;\n\n if ((a % (x + 1)) == 0) res = res + F(i + 1, a / (x + 1));\n }\n return res;\n}\n\nint Solve(long long a){\n if (a < 5) return (a != 2);\n return F(0, a);\n}\n\nint main(){\n Sieve();\n long long a;\n while (scanf(\"%I64d\", &a) != EOF) printf(\"%d\\n\", Solve(a));\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include \n\n#define MAX 1000010\n\nint p, i, j, primes[78777];\n\nint isPrime(long long x){\n for (j = 0; ;j++){\n long long y = primes[j];\n if ((y * y) > x) return 1;\n if (!(x % y)) return 0;\n }\n}\n\nint F(int i, long long a){\n if (a == 1) return 1;\n long long x = 1, y = primes[i];\n if ((y + 1) > a) return 0;\n if (((y * y) + 1) > a) return isPrime(--a);\n\n int res = F(++i, a);\n for (; ;){\n x *= y;\n if ((x + 1) > a) break;\n if (!(a % (x + 1))) res = res + F(i, a / (x + 1));\n }\n return res;\n}\n\nint Solve(long long a){\n if (a < 5) return (a != 2);\n return F(0, a);\n}\n\nint main(){\n freopen(\"lol.txt\", \"r\", stdin);\n primes[p++] = 2;\n for (i = 3; i < MAX; i+=2){\n if (isPrime(i)) primes[p++] = i;\n }\n\n long long a;\n while (scanf(\"%I64d\", &a) != EOF) printf(\"%d\\n\", Solve(a));\n return 0;\n}\n"}], "src_uid": "1f68bd6f8b40e45a5bd360b03a264ef4"} {"nl": {"description": "Baby Badawy's first words were \"AND 0 SUM BIG\", so he decided to solve the following problem. Given two integers $$$n$$$ and $$$k$$$, count the number of arrays of length $$$n$$$ such that: all its elements are integers between $$$0$$$ and $$$2^k-1$$$ (inclusive); the bitwise AND of all its elements is $$$0$$$; the sum of its elements is as large as possible. Since the answer can be very large, print its remainder when divided by $$$10^9+7$$$.", "input_spec": "The first line contains an integer $$$t$$$ ($$$1 \\le t \\le 10$$$) — the number of test cases you need to solve. Each test case consists of a line containing two integers $$$n$$$ and $$$k$$$ ($$$1 \\le n \\le 10^{5}$$$, $$$1 \\le k \\le 20$$$).", "output_spec": "For each test case, print the number of arrays satisfying the conditions. Since the answer can be very large, print its remainder when divided by $$$10^9+7$$$.", "sample_inputs": ["2\n2 2\n100000 20"], "sample_outputs": ["4\n226732710"], "notes": "NoteIn the first example, the $$$4$$$ arrays are: $$$[3,0]$$$, $$$[0,3]$$$, $$$[1,2]$$$, $$$[2,1]$$$. "}, "positive_code": [{"source_code": "#include\r\nint main(){\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--){\r\n int n,k;\r\n int max=1e9+7;\r\n scanf(\"%d%d\",&n,&k);\r\n long long int ans=1;\r\n for(int i=0;i\r\n\r\nint main()\r\n{\r\n unsigned int t,k;\r\n unsigned long long int n,i;\r\n scanf(\"%u\",&t);\r\n while(t--)\r\n {\r\n scanf(\"%llu%u\",&n,&k);\r\n i=1;\r\n while(k--)\r\n {\r\n i=i*n%1000000007;\r\n }\r\nprintf(\"%llu\",i);\r\nprintf(\"\\n\");\r\n }\r\n \r\n return 0;\r\n}"}, {"source_code": "#include \n\nenum{ MAX = 1000000007 };\n\nint main()\n{\n int t;\n scanf(\"%d\", &t);\n for(int i = 0; i < t; ++i) {\n int n, k;\n scanf(\"%d%d\", &n, &k);\n unsigned long long res = 1;\n for(int j = 0; j < k; ++j) {\n res *= n;\n res %= MAX;\n }\n printf(\"%llu\\n\", res);\n }\n}"}, {"source_code": "#include\r\nint main(){\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--){\r\n int n,k;\r\n scanf(\"%d %d\",&n,&k);\r\n long long int ans = 1;\r\n for(int i=1; i<=k; i++){\r\n ans=ans*n;\r\n ans=ans%1000000007;\r\n }\r\n printf(\"%lld\\n\",ans);\r\n }\r\n return 0;\r\n}"}, {"source_code": "#include\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\", &t);\r\n while(t--)\r\n {\r\n long long int n, k, c=1;\r\n scanf(\"%lld %lld\", &n, &k);\r\n while(k--)\r\n c=c*n%1000000007;\r\n printf(\"%lld\\n\", c);\r\n }\r\n}"}, {"source_code": "#include\r\nint main() {\r\n\tint t; scanf(\"%d\", &t);\r\n\tint mod = 1e9 + 7;\r\n\twhile (t--) {\r\n\t\tint n, k; scanf(\"%d%d\", &n, &k);\r\n\t\tlong long ans = 1;\r\n\t\tfor (int i = 0; i < k; i++) {\r\n\t\t\tans *= n;\r\n\t\t\tans %= mod;\r\n\t\t}\r\n\t\tprintf(\"%lld\\n\", ans);\r\n\t}\r\n}"}, {"source_code": "#include\n#include\nconst int N=1000000007;\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\twhile(n--){\n\t\tlong long a,b;\n\t\tscanf(\"%lld%lld\",&a,&b);\n\t\tlong long t=1;\n\t\twhile(b--){\n\t\t\tt=t*a;\n\t\t\tt=t%N;\n\t\t}\n\t\tprintf(\"%lld\\n\",t);\n\t} \n\treturn 0;\n} \n \t \t \t\t \t\t \t \t \t\t\t\t\t \t \t"}, {"source_code": "#include\r\n//using namespace std;\r\nint main()\r\n{\r\n int n,k,i,T;\r\n long long ans=1LL;\r\n long long mod=(1E9)+7;\r\n scanf(\"%d\",&T);\r\n while(T--)\r\n {\r\n ans=1LL;\r\n scanf(\"%d%d\",&n,&k);\r\n for(i=0;i\r\n\r\n#define M 1000000007\r\n\r\nint min(int a, int b) { return a < b ? a : b; }\r\n\r\nint main()\r\n{\r\n int x,y,z,i,j,k,a,b,c,n,m,t;\r\n long long res;\r\n \r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n res = 1; \r\n scanf(\"%d %d\",&n,&k);\r\n //k = min(n, k);\r\n for(x = 0; x < k; x++)\r\n res = (res * n) % M;\r\n \r\n printf(\"%lld\\n\",res); \r\n }\r\n return 0;\r\n}\r\n"}, {"source_code": "#include\r\n\r\nint main()\r\n{\r\n long long int sum=1,n,k;\r\n long long int t;\r\n scanf(\"%lld\",&t);\r\n for(long long int i=0;i\r\n#include \r\n#include \r\n#include \r\n#include \r\n\r\nvoid solve(){\r\n int n, k;\r\n scanf(\"%d %d\", &n, &k);\r\n int mod = 1e9 + 7;\r\n long long ans = 1;\r\n for(int i = 0; i < k; i++){\r\n ans *= n;\r\n ans %= mod;\r\n }\r\n printf(\"%d\\n\", ans);\r\n return;\r\n}\r\n \r\nint main(){\r\n int t;\r\n scanf(\"%d\", &t);\r\n for(int tt = 0; tt < t; tt++){\r\n solve();\r\n }\r\n return 0;\r\n}"}, {"source_code": "#include \r\nint main()\r\n{\r\n int t,n,k,max_sum;\r\n long long ans;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n scanf(\"%d%d\",&n,&k);\r\n ans=1;\r\n for(int i=0;i\r\n#include \r\n\r\n\r\nconst unsigned long long int mod=1000000007;\r\n\r\nvoid solve() {\r\n\r\nint n,k;\r\nscanf(\"%d %d\",&n,&k);\r\n\r\n\r\nunsigned long long int r=1;\r\n\r\nfor(int i=0; i\r\n\r\nint main () {\r\n int t;\r\n scanf(\"%d\", &t);\r\n while (t--) {\r\n long long n;\r\n int k;\r\n scanf(\"%lld %d\", &n, &k);\r\n long long cnt = 1;\r\n for (int i = 0; i < k; i++) {\r\n cnt *= n;\r\n cnt %= 1000000007;\r\n }\r\n printf(\"%lld\\n\", cnt);\r\n }\r\n return 0;\r\n}"}, {"source_code": "#include \r\n\r\nconst long long MOD = 1e9 + 7;\r\n\r\nint main() {\r\n long long t, n, k, ans;\r\n scanf(\"%I64d\", &t);\r\n while (t--) {\r\n scanf(\"%I64d%I64d\", &n, &k);\r\n ans = 1; while (k--) ans = ans * n % MOD;\r\n printf(\"%I64d\\n\", ans);\r\n }\r\n return 0;\r\n}\r\n"}, {"source_code": "#include\r\n#include\r\n#include\r\n#include\r\ntypedef long long int ll;\r\ntypedef unsigned long long ull;\r\ntypedef long double lld;\r\nll gcd(ll a, ll b) {\r\n return b ? gcd(b, a % b) : a;\r\n}\r\nvoid swap(int *a, int *b) {\r\n int t = *a;\r\n *a = *b;\r\n *b = t;\r\n}\r\ntypedef struct array {\r\n int first, second, third;\r\n} point;\r\nll min(ll a, ll b) {\r\n return a < b ? a : b;\r\n}\r\nll max(ll a, ll b) {\r\n return a > b ? a : b;\r\n}\r\nint cmpfunc (const void * a, const void * b) {\r\n return ( * (int*)a - * (int*)b );\r\n}\r\nint cmc(const void *a, const void *b) {\r\n return *(char *)b - *(char *)a;\r\n}\r\nint comp(const void* a, const void* b) {\r\n long long i = *(long long*)a;\r\n long long j = *(long long*)b;\r\n return (int)((i > j) - (i < j));\r\n}\r\n#define pr printf\r\n#define sc scanf\r\n#define re(i,a,b) for(int i=a;i 0)\r\n {\r\n if (k & 1)\r\n {\r\n res = (res * n % m) % m;\r\n }\r\n n = n % m * n % m;\r\n k = k >> 1;\r\n }\r\n printf(\"%lld\\n\", res);\r\n\r\n\r\n\r\n}"}, {"source_code": "#include\n#define ll long long\n#define MOD 1000000007\nint main(){\n int t;\n scanf(\"%d\",&t);\n\n while(t--){\n\n int n,k;\n scanf(\"%d%d\",&n,&k);\n\n ll ans = 1;\n for(int i = 0 ; i < k; i++){\n ans *= n;\n if(ans >= MOD){\n ans %= MOD;\n }\n }\n printf(\"%lld\\n\",ans);\n \n\n }\n\n\n\n return 0;\n}"}, {"source_code": "#include \r\nconst int N=1e+9+7;\r\n\r\nint main()\r\n{\r\n\tlong long int a,b,c,d;\r\n\tscanf(\"%lld\",&a);\r\n\twhile(a--) {\r\n\t\td=1;\r\n\t\tscanf(\"%lld%lld\",&b,&c);\r\n\t\twhile(c--) d=(d*b)%N;\r\n\t\tprintf(\"%lld\\n\",d);\r\n\t}\r\n}\r\n"}, {"source_code": "#include \r\n#define div 1000000007\r\nint main(){\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--){\r\n long long n,k,ans=1;\r\n scanf(\"%lld %lld\",&n,&k);\r\n for(int i=0;i\r\n#include\r\n#include\r\ntypedef long long int ll;\r\nll p=1000000000+7;\r\nint main()\r\n{\r\n int t,i;\r\n scanf(\"%d\",&t);\r\n for(i=0;i\r\nint main(){\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--){\r\n int n,k;\r\n int max=1e9+7;\r\n scanf(\"%d%d\",&n,&k);\r\n long long int ans=1;\r\n for(int i=0;i\nvoid main(){\n\tlong long mod = 1000000007;\n\tint t;\n\tscanf(\"%d\",&t);\n\twhile (t--){\n\t\tlong long n,k;\n\t\tscanf(\"%lld %lld\",&n,&k);\n\t\tlong long ans = 1;\n\t\tfor (int i=0;i\n#define f 1000000007\nint main()\n{\n\tint n;\n\tlong long sum;\n\tscanf(\"%d\",&n);\n\tfor(int i=0;i\r\nint main()\r\n{\r\n int no_of_test_cases;\r\n scanf(\"%d\",&no_of_test_cases);\r\n long long int no_of_bits,k;\r\n int no_of_numbers;\r\n for(int i=0;i 1000000007)\r\n {\r\n no_of_bits = (no_of_bits%1000000007);\r\n }\r\n }\r\n printf(\"%lld\\n\",no_of_bits);\r\n }\r\n}"}, {"source_code": "#include \r\n\r\nint main()\r\n{\r\n int n,k,i,j,test;\r\n long long int c;\r\n scanf(\"%d\",&test);\r\n for(i=1;i<=test;i++)\r\n {\r\n c=1;\r\n scanf(\"%d\",&n);\r\n scanf(\"%d\",&k);\r\n for(j=1;j<=k;j++)\r\n {\r\n c=(c*n)%(1000000000+7);\r\n }\r\n printf(\"%lld\\n\",c);\r\n }\r\n return 0;\r\n}\r\n"}, {"source_code": "#include\r\nconst long long int max=1e9+7;\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n long long int n,k;\r\n scanf(\"%lld%lld\",&n,&k);\r\n long long int sum=1;\r\n for(int i=0; i\r\n#define forin(i, n) for (i = 0; i < n; i++)\r\n#define lli long long int\r\n#define printSp(i, a, n) forin(i, n) printf('%d ', a[i]);\r\n#define printLn(i, a, n) forin(i, n) printf('%d\\n', a[i]);\r\n#define fis(n) fast_int_scan(n)\r\n#define fls(n) fast_long_scan(n)\r\n#define flli(n) fast_lli_scan(n)\r\n#define scanIA(i, a, n) forin(i, n) fis(a + i);\r\n#define scanLA(i, a, n) forin(i, n) fls(a + i);\r\n#define scanLLIA(i, a, n) forin(i, n) flli(a + i);\r\n\r\nvoid fast_int_scan(int *number)\r\n{\r\n //variable to indicate sign of input number\r\n int negative = 0;\r\n register int c;\r\n\r\n *number = 0;\r\n\r\n // extract current character from buffer\r\n c = getchar();\r\n if (c == '-')\r\n {\r\n // number is negative\r\n negative = 1;\r\n\r\n // extract the next character from the buffer\r\n c = getchar();\r\n }\r\n\r\n // Keep on extracting characters if they are integers\r\n // i.e ASCII Value lies from '0'(48) to '9' (57)\r\n for (; (c > 47 && c < 58); c = getchar())\r\n (*number) = (*number) * 10 + c - 48;\r\n\r\n // if scanned input has a negative sign, negate the value\r\n if (negative)\r\n (*number) *= -1;\r\n}\r\n\r\nvoid fast_lli_scan(lli *number)\r\n{\r\n //variable to indicate sign of input number\r\n int negative = 0;\r\n register int c;\r\n\r\n *number = 0;\r\n\r\n // extract current character from buffer\r\n c = getchar();\r\n if (c == '-')\r\n {\r\n // number is negative\r\n negative = 1;\r\n\r\n // extract the next character from the buffer\r\n c = getchar();\r\n }\r\n\r\n // Keep on extracting characters if they are integers\r\n // i.e ASCII Value lies from '0'(48) to '9' (57)\r\n for (; (c > 47 && c < 58); c = getchar())\r\n (*number) = (*number) * 10 + c - 48;\r\n\r\n // if scanned input has a negative sign, negate the value\r\n if (negative)\r\n (*number) *= -1;\r\n}\r\n\r\n \r\nint main(void)\r\n{\r\n\tint T;\r\n\tfast_int_scan(&T);\r\n\twhile (T--)\r\n\t{\r\n\t\tlli n, k, i, sum = 1;\r\n\t\tfast_lli_scan(&n);\r\n fast_lli_scan(&k);\r\n\t\tfor(i=1; i<=k; i++)\r\n\t\t{\r\n\t\t\tsum *= n;\r\n\t\t\tsum %= 1000000007;\r\n\t\t}\r\n\r\n\t\tprintf(\"%lld\\n\", sum);\r\n\t}\r\n\treturn 0;\r\n}"}, {"source_code": " /*Design by Dinh Viet Anh(JOKER)*/\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#include \n#include \n#include \n#include \n#define maxn 300010\n#define maxm 10000005\n#define maxc 1000000007\n#define mp make_pair\n#define pb push_back\n#define F first\n#define S second\n#define pii pair\n#define fort(i, a, b) for(int i = (a); i <= (b); i++)\n#define ford(i, a, b) for(int i = (a); i >= (b); i--)\n#define Task \"\"\n#define stop1 {cout << \"-1\\n\"; return;}\n#define stop2 {cout << \"NO\\n\"; return;}\n#define stop3 {cout << \"YES\\n\"; return;}\n#define ll long long\n#define JOKER main\n\nvoid setup()\n{\n \n}\n\nint check(int x)\n{\n int i = 1;\n while(i * i <= x)\n if(i * i == x)\n return 1;\n else i++;\n return 0;\n}\n\nlong long calc(int n, int m)\n{\n if(m == 1) return n;\n long long ans = calc(n, m/2) % maxc;\n if(m % 2) return (((ans * ans) % maxc) * n) % maxc;\n return ((ans * ans) % maxc);\n}\n \nvoid work()\n{\n int t = 1;\n scanf(\"%d\", &t);\n while(t--)\n {\n int n, m;\n scanf(\"%d%d\", &n, &m);\n printf(\"%lld\\n\", calc(n, m));\n } \n}\n \nint JOKER()\n{\n //freopen(Task\".inp\", \"r\", stdin);\n //freopen(Task\".out\", \"w\", stdout);\n setup();\n work();\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(void) {\n\tunsigned t, k;\n\tunsigned long long n, i;\n\n\tscanf(\"%u\", &t);\n\n\twhile (t--) {\n\t\tscanf(\"%llu %u\", &n, &k);\n\n\t\ti = 1;\n\n\t\twhile (k--) {\n\t\t\ti *= n;\n\t\t\ti %= 1000000007;\n\t\t}\n\n\t\tprintf(\"%llu\\n\", i);\n\t}\n}\n"}, {"source_code": "//每一个元素最多有k位 高于k位不考虑 \r\n//要使数组元素尽可能大且所有元素按位与为0\r\n//即所有元素的2进制每一位都有且仅有一个为0\r\n//每一位有n种可能,结果为n^k \r\n#include\r\nconst int mod=1e9+7;\r\nint duqi(int n,int k){\r\n\tlong long p=n,sum=1;\r\n\twhile(k!=0){\r\n\tp=p%mod;\r\n\tif(k%2==0){\r\n\t\tk/=2;p*=p;\r\n\t}\r\n\telse{\r\n\t\tk/=2;sum=sum*p%mod;p*=p;\r\n\t}\r\n\t}\r\n\treturn sum;\r\n}\r\nint main()\r\n{\r\n\tint k,n,t;\r\n\tscanf(\"%d\",&t);\r\n\twhile(t--){\r\n\t\tscanf(\"%d%d\",&n,&k);\r\n\t\tprintf(\"%d\\n\",duqi(n,k));\r\n\t}\r\n}"}, {"source_code": "#include \r\n#include\r\n \r\nint n,k;\r\nconst int MOD=1e9+7;\r\n \r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n scanf(\"%d %d\",&n,&k);\r\n long long ans=1;\r\n for(int i=0;i \r\nconst long long mod=1e9+7;\r\nlong long f(long long n,long long k){\r\n\tlong long sum=1,i;\r\n\tfor(i=1;i<=k;i++){\r\n\t\tsum=sum%mod*n%mod;\r\n\t}\r\n\treturn sum;\r\n}\r\nint main(void){\r\n\tlong long t;\r\n\tlong long n,k;\r\n\tlong long ans;\r\n\tscanf(\"%lld\",&t);\r\n\twhile(t--){\r\n\t\tscanf(\"%lld%lld\",&n,&k);\r\n\t\tans=f(n,k)%mod;\r\n\t\tprintf(\"%lld\\n\",ans);\r\n\t}\r\n\treturn 0;\r\n}"}, {"source_code": "#include\r\n#define ll long long \r\n#define rep(a,b) for(ll i=a;i\r\n#define MOD 1000000007\r\n#define ll long long \r\n\r\nint main(void)\r\n{ \r\n int t;\r\n scanf(\"%d\", &t);\r\n\r\n while (t--) {\r\n\r\n int n, k;\r\n scanf(\"%d%d\", &n, &k); \r\n\r\n ll result = n;\r\n for (int i = 1; i < k; i++) {\r\n result = result * n % MOD;\r\n }\r\n printf(\"%lld\\n\", result);\r\n }\r\n return 0;\r\n} "}, {"source_code": "#include\r\n#include\r\n\r\nint main(void)\r\n{\r\n\tint T;\r\n\tscanf(\"%d\",&T);\r\n\twhile(T--)\r\n\t{\r\n\t\tlong long int n,k,i,sum=1;\r\n\t\tscanf(\"%lld %lld\",&n,&k);\r\n\t\tfor(i=1;i<=k;i++)\r\n\t\t{\r\n\t\t\tsum*=n;\r\n\t\t\tsum=sum%(1000000000+7);\r\n\t\t}\r\n\t\tprintf(\"%lld\\n\",sum);\r\n\t}\r\n\treturn 0;\r\n}\r\n"}, {"source_code": "#include \r\n#include \r\n\r\nint main()\r\n{\r\n int t,n,k,i,j;long long s;\r\n scanf (\"%d\",&t);\r\n for (i=0;i\r\n#define ll long long\r\nconst int mod=1e9+7;\r\nint main()\r\n{\r\n\tint t;\r\n\tscanf(\"%d\",&t);\r\n\twhile(t--)\r\n\t{\r\n\t\tint n,k;\r\n\t\tscanf(\"%d%d\",&n,&k);\r\n\t\tll ans=1;\r\n\t\tfor(int i=1;i<=k;i++)\r\n\t\t{\r\n\t\t\tans=(ans*n)%mod;\t\r\n\t\t}\r\n\t\tprintf(\"%lld\\n\",ans);\r\n\t}\r\n\treturn 0;\r\n}\r\n"}, {"source_code": "#include \r\n#include \r\n#include \r\n#include \r\n#define MOD (1000000007)\r\n\r\n\r\nint main(void)\r\n{\r\n\tint TC, tcase, n, k;\r\n\tscanf(\"%d\", &TC);\r\n\tfor (tcase = 0; tcase < TC; tcase++)\r\n\t{\r\n\t\tscanf(\"%d %d\", &n, &k);\r\n\t\tlong long p = 1;\r\n\t\tfor (int i = 0; i < k; ++i)\r\n\t\t{\r\n\t\t\tp = (p * n) % MOD;\r\n\t\t}\r\n\t\tprintf(\"%lld\\n\", p);\r\n\t}\r\n\treturn 0;\r\n}"}, {"source_code": "#include \r\n\r\nlong long K = 1000000000+7;\r\n\r\nint main() {\r\n long long t, n, k, i, sol, j;\r\n scanf(\"%lld\", &t);\r\n\r\n for( i = 0; i < t; i++ ){\r\n scanf(\"%lld\", &n);\r\n scanf(\"%lld\", &k);\r\n sol = 1;\r\n for( j = 0; j < k; j++ )\r\n sol = (sol*n)%K;\r\n printf(\"%lld\\n\", sol);\r\n }\r\n}"}, {"source_code": "#include\r\n#include\r\n#include\r\n#include\r\ntypedef long long (ll);\r\n#define A 10005\r\n#define M 1000000007\r\nll z[A],p[A],q[A],r[A];\r\nchar s[A];\r\n\r\nvoid merge(ll arr[],ll l,ll m,ll r) \r\n{ \r\n ll i,j,k,n1,n2; \r\n n1=m-l+1; \r\n n2=r-m;\r\n ll L[n1],R[n2];\r\n for(i=0;i\r\nlong long BP(long long a, long long b, long long p)\r\n{\r\n\tlong long r = 1;\r\n\twhile (b)\r\n\t{\r\n\t\tif (b & 1)\r\n\t\t{\r\n\t\t\tr *= a;\r\n\t\t\tr %= p;\r\n\t\t}\r\n\t\ta *= a;\r\n\t\ta %= p;\r\n\t\tb >>= 1;\r\n\t}\r\n\treturn r;\r\n}\r\nint main()\r\n{\r\n\tint T;\r\n\tlong long n, k;\r\n\tlong long R;\r\n\tscanf(\"%d\", &T);\r\n\twhile (T--)\r\n\t{\r\n\t\tscanf(\"%I64d %I64d\", &n, &k);\r\n\t\tR = BP(n, k, 1000000007);\r\n\t\tprintf(\"%I64d\\n\", R);\r\n\t}\r\n\treturn 0;\r\n}"}, {"source_code": "#include\n\nint t;\nint n,k;\nlong long mod;\n\nlong long p(int nn,int kk)\n{\n\tlong long mm,tt;\n\tmm=1;\n\ttt=nn;\n\twhile(kk){\n\t\tif(kk%2){\n\t\t\tmm=mm*tt%mod;\n\t\t}\n\t\ttt=tt*tt%mod;\n\t\tkk/=2;\n\t}\n\treturn mm;\n}\n\nint main()\n{\n\tmod=1000000007;\n\tscanf(\"%d\",&t);\n\twhile(t--){\n\t\tscanf(\"%d%d\",&n,&k);\n\t\tprintf(\"%lld\\n\",p(n,k));\n\t}\n\treturn 0;\n}\n\n"}], "negative_code": [{"source_code": "#include\r\nint main(){\r\n int t;\r\n scanf(\"%d\",&t);\r\n\r\n while(t--){\r\n int n,k;\r\n int max=1e9+7;\r\n scanf(\"%d%d\",&n,&k);\r\n long long int ans=1;\r\n for(int i=1;i<=n;i++){\r\n ans=(ans*i)%max;\r\n }\r\n printf(\"%lld\",ans);\r\n }\r\n return 0;\r\n}"}, {"source_code": "#include \r\nint a[100000];\r\nint main()\r\n{\r\n unsigned int t,n,k;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n scanf(\"%d%d\",&n,&k);\r\n int d,l=0,new=0,kk=0;\r\n while(k--){\r\n l=0,new=0;\r\n while(n)\r\n {\r\n d=n%10;\r\n a[l]=d+1;\r\n l++;\r\n n/=10;\r\n }\r\n kk=0;\r\n while(l--)\r\n { \r\n if(a[l]==10)\r\n { new=new*10+1;\r\n new=new*10+0;kk=kk+2; \r\n continue; }\r\n new=new*10+a[l]; kk++; }\r\n n=new;\r\n }\r\n \r\n printf(\"\\n%d\",kk);\r\n }\r\n \r\n return 0;\r\n}"}, {"source_code": "#include \r\n\r\nint main()\r\n{\r\n unsigned int t,k;\r\n unsigned long long int n,i;\r\n scanf(\"%u\",&t);\r\n while(t--)\r\n {\r\n scanf(\"%llu%u\",&n,&k);\r\n i=1;\r\n while(k--)\r\n {\r\n i=i*n%1000000007;\r\n }\r\nprintf(\"%\\nllu\",i);\r\n }\r\n \r\n return 0;\r\n}"}, {"source_code": "#include \r\n\r\nint main()\r\n{\r\n unsigned int t,k;\r\n unsigned long long int n,i;\r\n scanf(\"%u\",&t);\r\n while(t--)\r\n {\r\n scanf(\"%llu%u\",&n,&k);\r\n i=1;\r\n while(k--)\r\n {\r\n i=i*n%1000000007;\r\n }\r\nprintf(\"%llu\",i);\r\n }\r\n \r\n return 0;\r\n}"}, {"source_code": "#include \n\nenum{ MAX = 1000000007 };\n\nint main()\n{\n int t;\n scanf(\"%d\", &t);\n for(int i = 0; i < t; ++i) {\n int n, k;\n scanf(\"%d%d\", &n, &k);\n unsigned long res = 1;\n for(int j = 0; j < k; ++j) {\n res *= n;\n res %= MAX;\n }\n printf(\"%lu\\n\", res);\n }\n}"}, {"source_code": "#include \n\nenum{ MAX = 1000000007 };\n\nint main()\n{\n int t;\n scanf(\"%d\", &t);\n for(int i = 0; i < t; ++i) {\n int n, k;\n scanf(\"%d%d\", &n, &k);\n long res = 1;\n for(int j = 0; j < k; ++j) {\n res *= n;\n res %= MAX;\n }\n printf(\"%ld\\n\", res);\n }\n}"}, {"source_code": "#include\r\nint main(){\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--){\r\n int n,k;\r\n scanf(\"%d %d\",&n,&k);\r\n long long int ans = 0;\r\n for(int i=1; i<=k; i++){\r\n ans=ans*n;\r\n ans=ans%1000000007;\r\n }\r\n printf(\"%lld\\n\",ans);\r\n }\r\n return 0;\r\n}\r\n\r\n"}, {"source_code": "#include\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\", &t);\r\n while(t--)\r\n {\r\n int n, k, c=1;\r\n scanf(\"%d %d\", &n, &k);\r\n while(k--)\r\n c=c*n;\r\n printf(\"%d\", c%1000000007);\r\n }\r\n}"}, {"source_code": "#include\r\nint main() {\r\n\tint t; scanf(\"%d\", &t);\r\n\tint mod = 1e9 + 7;\r\n\twhile (t--) {\r\n\t\tint n, k; scanf(\"%d%d\", &n, &k);\r\n\t\tint ans = 1;\r\n\t\tfor (int i = 0; i < k; i++) {\r\n\t\t\tans *= n;\r\n\t\t\tans %= mod;\r\n\t\t}\r\n\t\tprintf(\"%d\\n\", ans);\r\n\t}\r\n}"}, {"source_code": "#include\nint a=1e9+7;\nint main(){\n\tint t;\n\tlong long int ans,n,k;\n\tscanf(\"%d\",&t);\n\twhile(t--){\n\t\tans=1;\n\t\tscanf(\"%d %d\",&n,&k);\n\t\tn=n%a;\n\t\twhile(k>0){\n\t\t\tif(k%2==1){\n\t\t\t\tans=(ans*n)%a;\t\t\n\t\t\t}\n\t\t\tk=k/2;\n\t\t\tn=(n*n)%a;\n\t\t\t\n\t\t}\n\t\tprintf(\"%d\\n\",ans);\n\t}\n\treturn 0;\n}\n\t\t \t \t\t \t \t\t \t\t \t \t \t\t"}, {"source_code": "#include \r\n\r\n#define M 1000000007\r\n\r\nint min(int a, int b) { return a < b ? a : b; }\r\n\r\nint main()\r\n{\r\n int x,y,z,i,j,k,a,b,c,n,m,t;\r\n long long res;\r\n \r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n res = 1; \r\n scanf(\"%d %d\",&n,&k);\r\n k = min(n, k);\r\n for(x = 0; x < k; x++)\r\n res = (res * n) % M;\r\n \r\n printf(\"%lld\\n\",res); \r\n }\r\n return 0;\r\n}\r\n"}, {"source_code": "#include\r\n\r\nint main()\r\n{\r\n long long int sum=1,n,k;\r\n int t;\r\n scanf(\"%d\",&t);\r\n for(int i=0;i\n#include \n#include \n#include \n\nint len(char a[]){\n int i;\n for(i = 0; a[i] != '\\0'; ++i);\n return i;\n}\nint merge(char *a, int first, int mid, int last){\n\n int length1, length2;\n length1 = mid - first + 1;\n length2 = last - mid;\n\n int left[length1+1000], right[length2+1000];\n int i,j,k;\n\n for(i = 0; i < length1; i++){\n left[i] = a[first+i];\n }\n for(j = 0; j < length2; j++){\n right[j] = a[mid+j+1];\n }\n\n left[i] = 2147483647;\n right[j] = 2147483647;\n\n i = 0;\n j = 0;\n k = first;\n\n for(k = first; k <= last; k++){\n if(left[i] <= right[j]){\n a[k] = left[i];\n i++;\n } else {\n a[k] = right[j];\n j++;\n }\n \n }\n\nreturn *a;\n\n}\n\nint merge_sort(char *a, int first, int last){\n\n int mid = 0;\n\n if (first= len(guest)){\n big_array[i] = residence[t];\n t++;\n }\n i++;\n }\n\n merge_sort(big_array,0,(len(guest)+len(residence))-1);\n merge_sort(pile,0,len(pile)-1);\n\n for (i = 0; i < len(pile); i++){\n r = r && (pile[i] == big_array[i]);\n }\n \nif (r && s){\n printf(\"YES\");\n} else {\n printf(\"NO\"); \n}\n\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include\nint main()\n{\n \n//27......................A. Amusing Joke\nchar name1[100],name2[100],mix[200];\nint i ,j,check=0;\ngets (name1);\ngets (name2);\ngets (mix);\n\n for (j=0;j\n#include \nint main()\n{\n\tchar a[100],b[100],c[100],x[100];\n\tscanf(\"%[^\\n]%*c\\n\",a);\n\tscanf(\"%[^\\n]%*c\\n\",b);\n\tscanf(\"%[^\\n]%*c\",c);\n\tint l=strlen(a);\n\tint m=strlen(b);\n\tint n=strlen(c);\n\tif((l+m)==n)\n\t{\n\t\tint i;\n\t\t/*for(i=0; i\n#include\nint main()\n{\n int l,l1,l2,i,j,k,ln,sign,t;\n char s[205];\n char s1[205];\n char s2[205];\n int a[500];\n int r[500];\n gets(s1);\n gets(s2);\n gets(s);\n l1=strlen(s1);\n l2=strlen(s2);\n l=strlen(s);\n ln=l1+l2;\n if(l!=ln)\n {\n printf(\"NO\\n\");\n\n }\n else\n {\n\n for(i=0; ir[j])\n {\n t=r[i];\n r[i]=r[j];\n r[j]=t;\n }\n if(a[i]>a[j])\n {\n t=a[i];\n a[i]=a[j];\n a[j]=t;\n }\n }\n }\n for(i=0; i\nint main()\n{\n int i,t=0,t1=0,t2=0,j,k=0,l=0;\n char *a=malloc(100);\n gets(a);\n int a1=strlen(a);\n char *s=malloc(100);\n gets(s);\n int s1=strlen(s);\n char *b=malloc(200);\n b=strcat(a,s);\n char *as=malloc(200);\n gets(as);\n int as1=strlen(as);\n for(i=0;i\n#include\nint main()\n{\n char a[101],b[101],c[205];\n int m,i,j,r=0;\n scanf(\"%s%s%s\",a,b,c);\n strcat(a,b);\n m=strlen(c);\n for(i=0;i\n#include \nvoid sort_t(char *str)\n{\n int i;\n int j;\n char tmp;\n\n i = 0;\n while (str[i])\n {\n j = i + 1;\n while (str[j])\n {\n if (str[i] > str[j])\n {\n tmp = str[i];\n str[i] = str[j];\n str[j] = tmp;\n }\n j++;\n }\n i++;\n }\n}\nint main()\n{\n char l1[10001], l2[10001], l3[10001], l12[10002];\n int i = -1,j = -1,k = -1;\n scanf(\"%s\", l1);\n scanf(\"%s\", l2);\n scanf(\"%s\", l3);\n while (l1[++i])\n l12[i] = l1[i];\n while (l2[++j])\n l12[i + j] = l2[j];\n sort_t(l12);\n sort_t(l3);\n if (strcmp(l12, l3) == 0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return (0);\n}"}, {"source_code": "#include\n#include\nint main()\n{\n char str1[202],str2[101],str3[101],temp;\n int i,j,l,find,l3;\n find=1;\n scanf(\"%s\",str1);\n scanf(\"%s\",str2);\n scanf(\"%s\",str3);\n\n strcat(str1,str2);\n\n l=strlen(str1);\n l3=strlen(str3);\n\n for(i=0;i str1[j]){\n temp=str1[i];\n str1[i]=str1[j];\n str1[j]=temp;\n }\n\n }\n }\n\n for(i=0;i str3[j]){\n temp=str3[i];\n str3[i]=str3[j];\n str3[j]=temp;\n }\n\n }\n }\n if(l==l3){\n for(i=0;i\n#include\nint main()\n{\n char a[1000],b[1000],c[1000];\n int visit[10000];\n int l1,l2,l3,i,j,k,m,ct;\n\n while(gets(a))\n {\n gets(b);\n gets(c);\n l1=strlen(a);\n l2=strlen(b);\n l3=strlen(c);\n ct=0;\n memset(visit,0,sizeof visit);\n m=l1+l2;\n if(m!=l3)\n ct=1;\n else\n {\n\n for(i=0; i\nint main()\n{\n char u[101],t[101],s[101];\n int a[26],b[26],i,c=0;\n for(i=0;i<26;i++)\n {\n a[i]=0; b[i]=0;\n }\n scanf(\"%s\",u);\n scanf(\"%s\",t);\n scanf(\"%s\",s);\n for(i=0;u[i]!='\\0';i++)\n {\n a[u[i]-'A']++;\n }\n for(i=0;t[i]!='\\0';i++)\n {\n a[t[i]-'A']++;\n }\n for(i=0;s[i]!='\\0';i++)\n {\n b[s[i]-'A']++;\n }\n for(i=0;i<26;i++)\n {\n if(a[i]==b[i])\n {\n c++;\n }\n }\n if(c==26) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n#include\nint main()\n{\n char a[1000],b[1000],c[1000];\n int visit[10000];\n int l1,l2,l3,i,j,k,m,ct;\n\n while(gets(a))\n {\n gets(b);\n gets(c);\n l1=strlen(a);\n l2=strlen(b);\n l3=strlen(c);\n ct=0;\n memset(visit,0,sizeof visit);\n m=l1+l2;\n if(m!=l3)\n ct=1;\n else\n {\n\n for(i=0; i\n#include\nint main()\n{\n\tchar s1[101],s2[101],s3[202];\n\tint c=0;\n\t\n\tscanf(\"%s%s%s\",s1,s2,s3);\n\t\n\tfor(int i=0; i\n#include \nint main()\n{\n char s1[101],s2[101],s3[101];\n int alpha[26],beta[26];\n int i,j=0,k,c1=0,c2=0,c3=0;\n for(i=0;i<26;i++){\n alpha[i]=0;\n beta[i]=0;\n }\n gets(s1);\n gets(s2);\n gets(s3);\n for(i=0;i\n#include\nint main()\n{\n int i=0,k=0,j=0;\n char A[1000],B[1000],C[1000],d;\n scanf(\"%s %s %s\",&A,&B,&C);\n strcat(A,B);\n k=strlen(A);\n j=strlen(B);\n if(j>k)\n k=j;\n for(i=0;iA[j])\n {\n d=A[i];\n A[i]=A[j];\n A[j]=d;\n }\n if (C[i]>C[j])\n {\n d=C[i];\n C[i]=C[j];\n C[j]=d;\n }\n }\n }\n k=strcmp(A,C);\n if(k==0)\n printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int i,t=0,t1=0,t2=0,j,k=0,l=0;\n char *a=malloc(100);\n gets(a);\n int a1=strlen(a);\n char *s=malloc(100);\n gets(s);\n int s1=strlen(s);\n char *b=malloc(200);\n b=strcat(a,s);\n char *as=malloc(200);\n gets(as);\n int as1=strlen(as);\n for(i=0;i\n\n#include\nint main()\n{\n char a[200];\n char b[200];\n char c[200];\n char temp;\n int x,y,z,i,j,s=0,s1=0,s2=0,ck,ln;\n gets(a);\n gets(b);\n gets(c);\n strcat(a,b);\n ln=strlen(a);\n for(i=0;ia[j])\n {\n temp=a[i];\n a[i]=a[j];\n a[j]=temp;\n }\n }\n }\n for(i=0;c[i]!='\\0';i++)\n {\n for(j=1;c[j]!='\\0';j++)\n {\n if(c[i]>c[j])\n {\n temp=c[i];\n c[i]=c[j];\n c[j]=temp;\n }\n }\n }\n if((ck=(strcmp(a,c)))==0)\n\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main ()\n{\n char a[200], b[200], c[200];\n int i, j; char temp;\n gets(a);\n gets(b);\n strcat(a,b);\n gets(c);\n int lena=strlen(a), lenc=strlen(c);\n for (i=0; ia[j]){\n temp=a[i];\n a[i]=a[j];\n a[j]=temp;\n }\n }\n }\n for (i=0; ic[j]){\n temp=c[i];\n c[i]=c[j];\n c[j]=temp;\n }\n }\n }\n if (strcmp(a,c)==0) printf (\"YES\");\n else printf (\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main(){\n\tint sw = 0;\n\tint i = 0 , j = 0 , p = 0 ;\n\tchar name1[1000];\n\tchar name2[1000];\n\tchar ans[2000];\n\tscanf(\"%s\" , name1);\n\tscanf(\"%s\" , name2);\n\tscanf(\"%s\" , ans);\n\n\tfor( i = 0 ; name1[i] ; i++ )\n\t\t;\n\tfor( j = 0 ; name2[j] ; j++ )\n\t\t;\n\tfor( p = 0 ; ans[p] ; p++ )\n\t\t;\n\tif( (i + j) != p ){\n\t\tprintf(\"NO\\n\");\n\t\texit(0);\n\t}\n\tfor( int k = 0 ; k < i ; k++ ){\n\t\tsw = 0;\n\t\tfor( int l = 0 ; l < p && sw == 0 ; l++ ){\n\t\t\tif( name1[k] == ans[l] ){\n\t\t\t\tans[l] = '.';\n\t\t\t\tsw = 1;\n\t\t\t}\n\t\t}\n\t\tif( sw == 0 ){\n\t\t\tprintf(\"NO\\n\");\n\t\t\texit(0);\n\t\t}\n\t\t \n\t}\n\n\n\n\tfor( int k = 0 ; k < j ; k++ ){\n\t\tsw = 0;\n\t\tfor( int l = 0 ; l < p && sw == 0 ; l++ ){\n\t\t\tif( name2[k] == ans[l] ){\n\t\t\t\tans[l] = '.';\n\t\t\t\tsw = 1;\n\t\t\t}\n\t\t} \n\t\tif( sw == 0 ){\n\t\t\tprintf(\"NO\\n\");\n\t\t\texit(0);\n\t\t}\n\t}\n\n\n\tprintf(\"YES\\n\");\n\n}"}, {"source_code": "#include \n#include \n#include \n\nint cmp(const void *a, const void *b) {\n return *(const char *)a - *(const char *)b;\n}\n\nint main(void) {\n char names[500] = {0};\n char pile[500] = {0};\n char c, i = 0, f = 0;\n\n while((c = getchar()) != '\\n') {\n names[i++] = c;\n }\n\n while((c = getchar()) != '\\n') {\n names[i++] = c;\n }\n \n gets(pile);\n\n if(strlen(names) != strlen(pile)) {\n puts(\"NO\");\n return 0;\n }\n\n qsort(names, strlen(names), sizeof(char), cmp);\n qsort(pile, strlen(pile), sizeof(char), cmp);\n \n i = c = 0;\n while(c < strlen(names) && i < strlen(pile)) {\n if(names[c] != pile[i]) {\n f = 1;\n break;\n }\n c++; i++;\n }\n puts(f ? \"NO\" : \"YES\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nmain()\n{\n int x, y;\n char a[203], b[203];\n scanf(\"%s\", a);\n x = strlen(a);\n scanf(\"%s\", &a[x]);\n x = strlen(a);\n scanf(\"%s\", b);\n y = strlen(b);\n if(x!=y)\n {\n printf(\"NO\");\n }\n else\n {\n int i, j;\n for(i=0; i\n int main() {\n char a[101], b[101], c[201];\n int h1[30] = {0}, i, j, sum = 0;\n gets(a);\n gets(b);\n gets(c);\n for(i = 0 ; a[i] != '\\0' ; i++)\n ++h1[a[i]-65];\n for(j = 0 ; b[j] != '\\0' ; j++)\n ++h1[b[j]-65];\n for(i = 0 ; c[i] != '\\0' ; i++ )\n h1[c[i]-65]--;\n for(i = 0 ; i < 27 ; i++ )\n if(h1[i])\n break;\n if(i == 27)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0; \n }\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n char a[101], b[101], c[101];\n int count1[26] = {}, count2[26] = {}, count3[26] = {}, i;\n\n scanf(\"%s %s %s\", a, b, c);\n\n for(i=0; i\n#include\n#include\n#include\nint main()\n{\n char a[100],b[100],c[200];\n int count1[26]={0},count2[26]={0},count3[26]={0},i,p;\n scanf(\"%s%s%s\",a,b,c);\n for(i=0;i\n#include\nint main()\n{\n char str1[100],str2[200],str3[1000],str4[1000],str5[1000];\n int n,i,j,flag,count=0;\n gets(str1);\n gets(str2);\n gets(str3);\n for(i=0;str3[i]!='\\0';i++)\n {\n str5[i]=str3[i];\n }\n str5[i]='\\0';\n for(i=0,j=0;str1[i]!='\\0';i++,j++)\n {\n str4[j]=str1[i];\n }\n for(i=0;str2[i]!='\\0';i++,j++)\n {\n str4[j]=str2[i];\n }\n str4[j]='\\0';\n\n if(strlen(str4)!=strlen(str3))\n {\n printf(\"NO\\n\");\n }\n else\n {\n for(i=0;str4[i]!='\\0';i++)\n { flag=0;\n for(j=0;str3[j]!='\\0';j++)\n { if(str3[j]=='a')\n {\n continue;\n }\n if(str4[i]==str3[j])\n {\n str3[j]='a';\n flag=1;\n break;\n }\n }\n count=count+flag;\n\n }\n\n if(count!=strlen(str4))\n {\n printf(\"NO\\n\");\n }\n if(count==strlen(str4))\n {\n count=0;\n\n for(i=0;str5[i]!='\\0';i++)\n { flag=0;\n for(j=0;str4[j]!='\\0';j++)\n {\n if(str4[j]=='a')\n {\n continue;\n }\n if(str5[i]==str4[j])\n {\n str4[j]=='a';\n flag=1;\n break;\n }\n }\n count=count+flag;\n }\n if(count==strlen(str3))\n {\n printf(\"YES\\n\");\n }\n else\n printf(\"NO\\n\");\n }\n }\n return 0;\n\n\n}\n"}, {"source_code": "#include\nint main()\n{\n char str1[105],str2[105];\n int i,j,temp=0,n,l,count=0;\n scanf(\"%s%s\",&str1,&str2);\n char str3[220];\n scanf(\"%s\",&str3);\n\n\n strcat(str1,str2);\n n=strlen(str1);\n l=strlen(str3);\n\n if(n==l)\n {\n\n for(i=0; i<=n; i++)\n {\n for(j=i+1; j<=n; j++)\n {\n if(str1[i]>str1[j])\n {\n temp=str1[i];\n str1[i]=str1[j];\n str1[j]=temp;\n }\n }\n\n\n\n }\n\n for(i=0; i<=l; i++)\n {\n for(j=i+1; j<=l; j++)\n {\n if(str3[i]>str3[j])\n {\n temp=str3[i];\n str3[i]=str3[j];\n str3[j]=temp;\n }\n }\n\n\n\n\n }\n j=0;\n for(i=0; i<=n; i++)\n {\n if(str1[i]==str3[j])\n {\n count++;\n j++;\n\n }\n\n }\n\n if(count-1==n)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n else\n printf(\"NO\");\n\n\n}"}, {"source_code": "#include\n#include\n#include\nint cmp(const void*a,const void*b)\n{\n return (*(char*)a) - (*(char*)b);\n}\nint main(void)\n{\n char str1[1000],str2[1000],str3[1000];\n int i;\n gets(str1);\n gets(str2);\n gets(str3);\n strcat(str1,str2);\n qsort(str1,strlen(str1),sizeof(char),cmp);\n qsort(str3,strlen(str3),sizeof(char),cmp);\n if(strcmp(str1,str3) == 0)\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\t \t \t \t"}, {"source_code": "#include \n#include\nint main()\n{\n int n,m,t,i,j;\n char a[1000],b[1000],c[1000],d[1000];\n char ch1,ch2;\n gets(a);\n gets(b);\n gets(c);\n strcat(a,b);\n n=strlen(a);\n for(i=0; i\n#include\nint main(){\n int x,y,z,i,j,p,k,l=0;\nchar a[1000],b[1000],c[1000],d[1000];\nscanf(\"%s\",a);\nscanf(\"%s\",b);\nscanf(\"%s\",d);\nx=strlen(a),y=strlen(b),z=strlen(d);\nfor(i=0;i\nint main()\n{\nchar p[101],q[101],r[101];\nint A[26]={0},C[26]={0},flag=1;\nscanf(\"%s\",p);\nscanf(\"%s\",q);\nscanf(\"%s\",r);\nfor(int i=0;p[i]!='\\0';i++)\nA[p[i]-'A']++;\nfor(int i=0;q[i]!='\\0';i++)\nA[q[i]-'A']++;\nfor(int i=0;r[i]!='\\0';i++)\nC[r[i]-'A']++;\nfor(int i=0;i<26;i++)\nif(A[i]!=C[i])\n{\nflag=0;\nbreak;\n}\nif(flag==1)\nprintf(\"YES\");\nelse\nprintf(\"NO\");\n}"}, {"source_code": "#include\n#include\nint main()\n{\n char str1[1000],str2[1000],str3[1000],temp;\n scanf(\"%s\",&str1);\n scanf(\"%s\",&str2);\n scanf(\"%s\",&str3);\n strcat(str1,str2);\n int i,j,l1,l2,count=0;\n l1=strlen(str1);\n l2=strlen(str3);\n for(i=0; istr1[j+1])\n {\n temp=str1[j+1];\n str1[j+1]=str1[j];\n str1[j]=temp;\n }\n }\n }\n for(i=0; istr3[j+1])\n {\n temp=str3[j+1];\n str3[j+1]=str3[j];\n str3[j]=temp;\n }\n }\n }\n if(l1!=l2)\n {\n printf(\"NO\");\n return 0;\n }\n else\n {\n for(i=0; i\n#include \n\nint main()\n{\n char name[101], host[101], ltr[101];\n int i, j, k;\n scanf(\"%s %s %s\",name,host,ltr);\n for(i=0;i\n#include\n#include\n#include\nint main()\n{\n char a[100],b[100],c[200];\n int count1[26]={0},count2[26]={0},count3[26]={0},i,p;\n scanf(\"%s%s%s\",a,b,c);\n for(i=0;i\nint count[26];\nint copy[26];\n\nvoid markChar(char in[], int mark[]){\n\tfor(int j = 0; in[j] != '\\0' && in[j] != '\\n'; j++){\n\t\tmark[ in[j] - 'A'] += 1;\n\t}\n\n}\n\nint main(){\n\tchar in[101];\n\tfor(int i = 1; i < 3; i++){\n\t\tscanf(\"%s\", in);\n\t\tmarkChar(in, count);\n\t}\n\n\tscanf(\"%s\", in);\n\tmarkChar(in, copy);\n\n\tint i = 0;\n\twhile(i < 26 && count[i] == copy[i]){\n\t\ti++;\n\t}\n\n\tif(i == 26){\n\t\tprintf(\"YES\\n\");\n\t} else {\n\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n#include\nint cmp(const void*a,const void*b)\n{\n return (*(char*)a) - (*(char*)b);\n}\nint main(void)\n{\n char str1[1000],str2[1000],str3[1000];\n int i;\n gets(str1);\n gets(str2);\n gets(str3);\n strcat(str1,str2);\n qsort(str1,strlen(str1),sizeof(char),cmp);\n qsort(str3,strlen(str3),sizeof(char),cmp);\n if(strcmp(str1,str3) == 0)\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\t \t \t \t"}, {"source_code": "#include\n#include\n#include\nint main()\n{\n char a[100],b[100],c[200];\n int count1[26]={0},count2[26]={0},count3[26]={0},i,p;\n scanf(\"%s%s%s\",a,b,c);\n for(i=0;i\n\nint main()\n{\n char s1[101], s2[101], s3[101];\n int a[256] = {0}, i;\n\n scanf(\"%s\", s1);\n scanf(\"%s\", s2);\n scanf(\"%s\", s3);\n\n for(i=0; i\n#include\n#include\n#define ll long long int\nint main()\n{\n int i,j=0,ln1,ln2,ln3,ln4,k;\n char s1[101],s2[101],s3[101],s[101],temp;\n gets(s1);\n gets(s2);\n gets(s3);\n ln1=strlen(s1);\n ln2=strlen(s2);\n ln3=strlen(s3);\n ln4=ln1+ln2;\n if(ln3!=ln4)\n {\n printf(\"NO\\n\");\n return 0;\n }\n for(i=0; is[j+1])\n {\n temp=s[j];\n s[j]=s[j+1];\n s[j+1]=temp;\n }\n }\n }\n for(i=0; is3[j+1])\n {\n temp=s3[j];\n s3[j]=s3[j+1];\n s3[j+1]=temp;\n }\n }\n }\n// printf(\"%s %s\",s,s3)\n s[ln4]='\\0';\n s[ln3]='\\0';\n int result = strcmp(s, s3);\n// printf(\"%d\",result);\n if(result==0)\n {\n puts(\"YES\");\n }\n else\n {\n puts(\"NO\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int count=0;\n char a[1000], b[1000], c[1000],d[2000];\n scanf(\"%s\", &a);\n scanf(\"%s\", &b);\n scanf(\"%s\", &c);\n\n strcat(a,b);\n\n for(int i=0;ia[j]){\n t=a[i];\n a[i]=a[j];\n a[j]=t;\n }\n }\n }\n\n for(int i=0;ic[j]){\n t=c[i];\n c[i]=c[j];\n c[j]=t;\n }\n }\n }\n\n if(strlen(a)==strlen(c)){\n for(int i=0;i\n#include\n\nint main()\n\n{\n char fawra[102], dewra[102] , jabra[204] ;\n int bakso[26];\n\n int i , hisab=0 ;\n\n scanf(\"%s\",&fawra);\n scanf(\"%s\",&dewra);\n scanf(\"%s\",&jabra);\n\n i = 0;\n while(i<26)\n {\n bakso[i]=0;\n i++;\n }\n\n i = 0;\n\n while( i\n#include\nint main()\n{\n char a[200];\n char b[200];\n char c[200];\n int ln,temp,i,j,result;\n gets(a);\n gets(b);\n gets(c);\n strcat(a,b);\n ln=strlen(a);\n for(i=0;ia[j]){\n temp=a[i];\n a[i]=a[j];\n a[j]=temp;\n }\n }\n }\n for(i=0;ic[j]){\n temp=c[i];\n c[i]=c[j];\n c[j]=temp;\n }\n }\n }\n if((result=strcmp(a,c))==0){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int l,l1,l2,i,j,k,ln,sign,t;\n char s[205];\n char s1[205];\n char s2[205];\n int a[500];\n int r[500];\n gets(s1);\n gets(s2);\n gets(s);\n l1=strlen(s1);\n l2=strlen(s2);\n l=strlen(s);\n ln=l1+l2;\n if(l!=ln)\n {\n printf(\"NO\\n\");\n\n }\n else\n {\n\n for(i=0; ir[j])\n {\n t=r[i];\n r[i]=r[j];\n r[j]=t;\n }\n if(a[i]>a[j])\n {\n t=a[i];\n a[i]=a[j];\n a[j]=t;\n }\n }\n }\n for(i=0; i\n#include\nmain()\n{\n\tchar s1[1000],s2[1000],s3[1000];\n\tint i,j,k,l1,l2,l3,m,n,flag=0;\n\tgets(s1);\n\tgets(s2);\n\tgets(s3);\n\tl1=strlen(s1);\n\tl2=strlen(s2);\n\tl3=strlen(s3);\n\tfor (i=0;i\n#include \n\nint Judge(char *a,char *b)\n{\n int i,j,len1,len2,count=0;\n len1=strlen(a);\n len2=strlen(b);\n for (i=0; i\nint glb[28];\n\n\nchar cat(char arra[],char barra[])\n{\n int i,j,k,l;\n i=0;\n j=0;\n while(arra[i]){\n i++;\n }\n while(barra[j]){\n arra[i]=barra[j];\n j++;\n i++;}\n arra[i]='\\0';\n return arra;\n }\nint len(char arra[]){\n int i;\n i=0;\n while(arra[i]){\n i++;\n }\n return i;}\nint main()\n{\n int i,k,l1,l2;\n char str1[210];\n char str2[102];\n char sum[102];\n scanf(\"%s\",str1);\n scanf(\"%s\",str2);\n scanf(\"%s\",sum);\n cat(str1,str2);\n l1=len(str1);\n l2=len(sum);\n\n\n if(l1==l2){\n\n\n\n for(i=0;i\n#include\n\nint main()\n{\n int a[26];\n int i;\n int flag;\n char name1[101];\n char name2[101];\n char temp[202];\n scanf(\"%s\",&name1);\n scanf(\"%s\",&name2);\n scanf(\"%s\",&temp);\n for(i=0;i<26;i++)\n {\n\t a[i]=0;\n }\n for(i=0;name1[i]!='\\0';i++)\n {\n\t a[name1[i]-'A']++;\n }\n for(i=0;name2[i]!='\\0';i++)\n {\n\t a[name2[i]-'A']++;\n }\n for(i=0;temp[i]!='\\0';i++)\n {\n\t a[temp[i]-'A']--;\n }\n flag=0;\n for(i=0;i<26;i++)\n {\n\t if(a[i]!=0)\n\t {\n\t\t flag=1;\n\t }\n }\n if(flag==1)\n {\n\t printf(\"NO\\n\");\n }\n else\n {\n\t printf(\"YES\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\n\n\nvoid null(char ch[])\n{\n int i=0;\n for(i=0;i<1000;i++)\n {\n ch[i]=0;\n }\n}\n\nint main()\n{\n char str1[1000],str2[1000],ch[1000];\n int i,length1=0;\n int num[26];\n int cum[26];\n int length2=0;\n int mode=0;\n scanf(\"%s\",str1);\n scanf(\"%s\",str2);\n scanf(\"%s\",ch);\n\n /*\n gets(str1);\n gets(str2);\n gets(ch);\n */\n for(i=0;i<26;i++)\n {\n num[i]=0;\n cum[i]=0;\n }\n ///strcat(str1,str2);\n i=0;\n length1=strlen(str1);\n length2=strlen(ch);\n for(;i\n#include\nint main()\n{\n int i,x=1,y=1,a;\n char s[100],t[100],r[100];\n scanf(\"%s%s%s\",s,t,r);\n for(a=0;a\nint main()\n{\n char a[1000],b[1000],c[1000];\n int i,j,k,temp,t=0;\n gets(a);\n gets(b);\n gets(c);\n strcat(a,b);\n strlen(a);\n for(i=0;ia[j+1])\n {\n temp=a[j];\n a[j]=a[j+1];\n a[j+1]=temp;\n }\n }\n }\n for(i=0;ic[j+1])\n {\n temp=c[j];\n c[j]=c[j+1];\n c[j+1]=temp;\n }\n }\n }\n if(strlen(a)>strlen(c))\n {\n printf(\"NO\");\n }\n else{\n for(i=0;i\n#include\n\nint main()\n{\n int a[26];\n int i;\n int flag;\n char name1[101];\n char name2[101];\n char temp[202];\n scanf(\"%s\",&name1);\n scanf(\"%s\",&name2);\n scanf(\"%s\",&temp);\n for(i=0;i<26;i++)\n {\n\t a[i]=0;\n }\n for(i=0;name1[i]!='\\0';i++)\n {\n\t a[name1[i]-'A']++;\n }\n for(i=0;name2[i]!='\\0';i++)\n {\n\t a[name2[i]-'A']++;\n }\n for(i=0;temp[i]!='\\0';i++)\n {\n\t a[temp[i]-'A']--;\n }\n flag=0;\n for(i=0;i<26;i++)\n {\n\t if(a[i]!=0)\n\t {\n\t\t flag=1;\n\t }\n }\n if(flag==1)\n {\n\t printf(\"NO\\n\");\n }\n else\n {\n\t printf(\"YES\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nvoid in(char a[],int x[])\n{\n int l,i;\n l=strlen(a);\n for(i=0;i\n#include\nint main()\n{\n int i,j,swap;\n char ch1[500],ch2[500],ch3[500];\n scanf(\"%s %s %s\",ch1,ch2,ch3);\n i=strlen(ch1);\n for(i=strlen(ch1),j=0;ch1[j]!='\\0';i++,j++)\n {\n ch1[i]=ch2[j];\n }\n ch1[i+1]='\\0';\n for(i=0;ich1[j+1])\n {\n swap=ch1[j];\n ch1[j]=ch1[j+1];\n ch1[j+1]=swap;\n }\n }\n }\n for(i=0;ich3[j+1])\n {\n swap=ch3[j];\n ch3[j]=ch3[j+1];\n ch3[j+1]=swap;\n }\n }\n }\n if(strcmp(ch1,ch3)==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n char str1[110],str2[110],str3[230],str4[230],temp;\n int i,j,m,n;\n gets(str1);\n gets(str2);\n gets(str3);\n strcpy(str4,str1);\n strcat(str4,str2);\n n=strlen(str4);\n //printf(\"%s\\n\",str4);\n for(i=0;i\n#include\n#include\n#include\nint main()\n{\n char a[100],b[100],c[200];\n int count1[26]={0},count2[26]={0},count3[26]={0},i,p;\n scanf(\"%s%s%s\",a,b,c);\n for(i=0;i\n#include \n\nmain()\n{\n int x, y;\n char a[203], b[203];\n scanf(\"%s\", a);\n x = strlen(a);\n scanf(\"%s\", &a[x]);\n x = strlen(a);\n scanf(\"%s\", b);\n y = strlen(b);\n if(x!=y)\n {\n printf(\"NO\");\n }\n else\n {\n int i, j;\n for(i=0; i\n#include\n#include\n#include\nint main()\n{\n char a[100],b[100],c[200];\n int count1[26]={0},count2[26]={0},count3[26]={0},i,p;\n scanf(\"%s%s%s\",a,b,c);\n for(i=0;i\n#include \n\nint main(){\n\tint sw = 0;\n\tint i = 0 , j = 0 , p = 0 ;\n\tchar name1[1000];\n\tchar name2[1000];\n\tchar ans[2000];\n\tscanf(\"%s\" , name1);\n\tscanf(\"%s\" , name2);\n\tscanf(\"%s\" , ans);\n\n\tfor( i = 0 ; name1[i] ; i++ )\n\t\t;\n\tfor( j = 0 ; name2[j] ; j++ )\n\t\t;\n\tfor( p = 0 ; ans[p] ; p++ )\n\t\t;\n\tif( (i + j) != p ){\n\t\tprintf(\"NO\\n\");\n\t\texit(0);\n\t}\n\tfor( int k = 0 ; k < i ; k++ ){\n\t\tsw = 0;\n\t\tfor( int l = 0 ; l < p && sw == 0 ; l++ ){\n\t\t\tif( name1[k] == ans[l] ){\n\t\t\t\tans[l] = '.';\n\t\t\t\tsw = 1;\n\t\t\t}\n\t\t}\n\t\tif( sw == 0 ){\n\t\t\tprintf(\"NO\\n\");\n\t\t\texit(0);\n\t\t}\n\t\t \n\t}\n\n\n\n\tfor( int k = 0 ; k < j ; k++ ){\n\t\tsw = 0;\n\t\tfor( int l = 0 ; l < p && sw == 0 ; l++ ){\n\t\t\tif( name2[k] == ans[l] ){\n\t\t\t\tans[l] = '.';\n\t\t\t\tsw = 1;\n\t\t\t}\n\t\t} \n\t\tif( sw == 0 ){\n\t\t\tprintf(\"NO\\n\");\n\t\t\texit(0);\n\t\t}\n\t}\n\n\n\tprintf(\"YES\\n\");\n\n}"}, {"source_code": "#include \n#include \n\nint main() {\n\tchar word1[250]; char word2[110]; \n\tchar word3[110];\n\tscanf(\"%s%s%s\", word1, word2, word3);\n\tstrcat(word1, word2);\n\tint check1[26]={0}; int check2[26]={0};\n\t\n\tfor (int i=0; word1[i]!='\\0'; i++) {\n\t\tcheck1[word1[i]-65]++;\n\t}\n\tfor (int i=0; word3[i]!='\\0'; i++) {\n\t\tcheck2[word3[i]-65]++;\n\t}\n\tfor (int i=0; i<26; i++) {\n\t\tif (check1[i]!=check2[i]) {\n\t\t\tprintf(\"NO\\n\"); return 0;\n\t\t}\n\t}\n\tprintf(\"YES\\n\");\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int count=0;\n char a[1000], b[1000], c[1000],d[2000];\n scanf(\"%s\", &a);\n scanf(\"%s\", &b);\n scanf(\"%s\", &c);\n\n strcat(a,b);\n\n for(int i=0;ia[j]){\n t=a[i];\n a[i]=a[j];\n a[j]=t;\n }\n }\n }\n\n for(int i=0;ic[j]){\n t=c[i];\n c[i]=c[j];\n c[j]=t;\n }\n }\n }\n\n if(strlen(a)==strlen(c)){\n for(int i=0;i\n#include\nvoid bubble(int l, char s[]);\n\nint main()\n{\n int l,ll,i,j;\n char s1[202],s2[101],s3[101],b;\n\n scanf(\"%s %s %s\",s1,s2,s3);\n strcat(s1,s2);\n l=strlen(s1);\n bubble(l,s1);\n ll=strlen(s3);\n bubble(ll,s3);\n if(strcmp(s1,s3)==0) printf(\"YES\");\n else printf(\"NO\");\n\n return 0;\n}\n\n\nvoid bubble(int l, char s[])\n{\n int i,j;\n char b;\n\n for(i=0; i=s[j]){\n b=s[i];\n s[i]=s[j];\n s[j]=b;\n }\n }\n }\n\n}"}, {"source_code": "#include\n#include\nmain()\n{\n char s1[101],s2[101],s3[101],s[10];\n int i,n1,n2,n3,j;\n gets(s1);gets(s2);gets(s3);\n n3=strlen(s3);\n strcat(s1,s2);\n n1=strlen(s1);\n \n \n for(i=0;is1[j]) {s[0]=s1[i];s1[i]=s1[j];s1[j]=s[0];}\n }}\n\n for(i=0;is3[j]) {s[0]=s3[i];s3[i]=s3[j];s3[j]=s[0];}\n }}\n\n if(strcmp(s1,s3)==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n \nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int l,i,j;\n char s1[101],s[201],s2[101],temp;\n scanf(\"%s %s %s\",s1,s2,s);\n strcat(s1,s2);\n l=strlen(s1);\n for(i=0;is1[j]){\n temp=s1[i];\n s1[i]=s1[j];\n s1[j]=temp;\n }\n }\n }\n l=strlen(s);\n for(i=0;is[j]){\n temp=s[i];\n s[i]=s[j];\n s[j]=temp;\n }\n }\n }\n if(strcmp(s1,s)==0)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int ch[128]={0},ans=0,i;\n char a;\n \n scanf(\"%c\",&a);\n for(;a!='\\n';){\n ch[a]++;\n scanf(\"%c\",&a);\n }\n \n scanf(\"%c\",&a);\n for(;a!='\\n';){\n ch[a]++;\n scanf(\"%c\",&a);\n }\n \n scanf(\"%c\",&a);\n for(;a!='\\n';){\n ch[a]--;\n scanf(\"%c\",&a);\n }\n \n for(i=0;i<127;i++){\n if(ch[i])ans=1;\n }\n \n printf(\"%s\\n\",(ans==0?\"YES\":\"NO\"));\n \n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n char str1[50000],str2[50000],str3[50000];\n int i,j,k,l,m,a1=0,b1=0,c1=0,d1=0,e1=0,f1=0,g1=0,h1=0,i1=0,j1=0,k1=0,l1=0,m1=0,\n n1=0,o1=0,p1=0,q1=0,r1=0,s1=0,t1=0,u1=0,v1=0,w1=0,x1=0,y1=0,z1=0;\n int a2=0,b2=0,c2=0,d2=0,e2=0,f2=0,g2=0,h2=0,i2=0,j2=0,k2=0,l2=0,m2=0,\n n2=0,o2=0,p2=0,q2=0,r2=0,s2=0,t2=0,u2=0,v2=0,w2=0,x2=0,y2=0,z2=0;\n int a3=0,b3=0,c3=0,d3=0,e3=0,f3=0,g3=0,h3=0,i3=0,j3=0,k3=0,l3=0,m3=0,\n n3=0,o3=0,p3=0,q3=0,r3=0,s3=0,t3=0,u3=0,v3=0,w3=0,x3=0,y3=0,z3=0;\n gets(str1);\n gets(str2);\n gets(str3);\n for(i=0; str1[i]!='\\0'; i++)\n {\n if(str1[i]=='A')\n a1++;\n if(str1[i]=='B')\n b1++;\n if(str1[i]=='C')\n c1++;\n if(str1[i]=='D')\n d1++;\n if(str1[i]=='E')\n e1++;\n if(str1[i]=='F')\n f1++;\n if(str1[i]=='G')\n g1++;\n if(str1[i]=='H')\n h1++;\n if(str1[i]=='I')\n i1++;\n if(str1[i]=='J')\n j1++;\n if(str1[i]=='K')\n k1++;\n if(str1[i]=='L')\n l1++;\n if(str1[i]=='M')\n m1++;\n if(str1[i]=='N')\n n1++;\n if(str1[i]=='O')\n o1++;\n if(str1[i]=='P')\n p1++;\n if(str1[i]=='Q')\n q1++;\n if(str1[i]=='R')\n r1++;\n if(str1[i]=='S')\n s1++;\n if(str1[i]=='T')\n t1++;\n if(str1[i]=='U')\n u1++;\n if(str1[i]=='V')\n v1++;\n if(str1[i]=='W')\n w1++;\n if(str1[i]=='X')\n x1++;\n if(str1[i]=='Y')\n y1++;\n if(str1[i]=='Z')\n z1++;\n }\n for(j=0; str2[j]!='\\0'; j++)\n {\n if(str2[j]=='A')\n a2++;\n if(str2[j]=='B')\n b2++;\n if(str2[j]=='C')\n c2++;\n if(str2[j]=='D')\n d2++;\n if(str2[j]=='E')\n e2++;\n if(str2[j]=='F')\n f2++;\n if(str2[j]=='G')\n g2++;\n if(str2[j]=='H')\n h2++;\n if(str2[j]=='I')\n i2++;\n if(str2[j]=='J')\n j2++;\n if(str2[j]=='K')\n k2++;\n if(str2[j]=='L')\n l2++;\n if(str2[j]=='M')\n m2++;\n if(str2[j]=='N')\n n2++;\n if(str2[j]=='O')\n o2++;\n if(str2[j]=='P')\n p2++;\n if(str2[j]=='Q')\n q2++;\n if(str2[j]=='R')\n r2++;\n if(str2[j]=='S')\n s2++;\n if(str2[j]=='T')\n t2++;\n if(str2[j]=='U')\n u2++;\n if(str2[j]=='V')\n v2++;\n if(str2[j]=='W')\n w2++;\n if(str2[j]=='X')\n x2++;\n if(str2[j]=='Y')\n y2++;\n if(str2[j]=='Z')\n z2++;\n }\n for(k=0; str3[k]!='\\0'; k++)\n {\n if(str3[k]=='A')\n a3++;\n if(str3[k]=='B')\n b3++;\n if(str3[k]=='C')\n c3++;\n if(str3[k]=='D')\n d3++;\n if(str3[k]=='E')\n e3++;\n if(str3[k]=='F')\n f3++;\n if(str3[k]=='G')\n g3++;\n if(str3[k]=='H')\n h3++;\n if(str3[k]=='I')\n i3++;\n if(str3[k]=='J')\n j3++;\n if(str3[k]=='K')\n k3++;\n if(str3[k]=='L')\n l3++;\n if(str3[k]=='M')\n m3++;\n if(str3[k]=='N')\n n3++;\n if(str3[k]=='O')\n o3++;\n if(str3[k]=='P')\n p3++;\n if(str3[k]=='Q')\n q3++;\n if(str3[k]=='R')\n r3++;\n if(str3[k]=='S')\n s3++;\n if(str3[k]=='T')\n t3++;\n if(str3[k]=='U')\n u3++;\n if(str3[k]=='V')\n v3++;\n if(str3[k]=='W')\n w3++;\n if(str3[k]=='X')\n x3++;\n if(str3[k]=='Y')\n y3++;\n if(str3[k]=='Z')\n z3++;\n }\n if(a1+a2!=a3||b1+b2!=b3||c1+c2!=c3||d1+d2!=d3||e1+e2!=e3||f1+f2!=f3)\n printf(\"NO\\n\");\n else if(g1+g2!=g3||h1+h2!=h3||i1+i2!=i3||j1+j2!=j3||k1+k2!=k3||l1+l2!=l3)\n printf(\"NO\\n\");\n else if(m1+m2!=m3||n1+n2!=n3||o1+o2!=o3||p1+p2!=p3||q1+q2!=q3||r1+r2!=r3)\n printf(\"NO\\n\");\n else if(s1+s2!=s3||t1+t2!=t3||u1+u2!=u3||v1+v2!=v3||w1+w2!=w3)\n printf(\"NO\\n\");\n else if(x1+x2!=x3||y1+y2!=y3||z1+z2!=z3)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n char str1[110],str2[110],str3[230],str4[230],temp;\n int i,j,m,n;\n gets(str1);\n gets(str2);\n gets(str3);\n strcpy(str4,str1);\n strcat(str4,str2);\n n=strlen(str4);\n //printf(\"%s\\n\",str4);\n for(i=0;i\n#include\nint main()\n{\n int i,j,len1,len2,temp1,temp2;\n char g[100],h[100],p[200],n[200];\n gets(g);\n gets(h);\n gets(p);\n if(strlen(g)+strlen(h)!=strlen(p)) printf(\"NO\\n\");\n else{\n strcpy(n,strcat(g,h));\n len1=strlen(n);\n len2=strlen(p);\n for (i = 0; i < len1-1; i++)\n {\n for (j = i+1; j < len1; j++)\n {\n if (n[i] > n[j])\n {\n temp1 = n[i];\n n[i] = n[j];\n n[j] = temp1;\n }\n }\n }\n for (i = 0; i < len2-1; i++)\n {\n for (j=i+1; j p[j])\n {\n temp2 = p[i];\n p[i] = p[j];\n p[j] = temp2;\n }\n }\n }\n if(strcmp(p,n)==0)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint c,i;\n\tint alp[26]={0};\n\tfor(i=0;i<3;i++)\n\t{\n\t\tc=getchar();\n\t\twhile(c!='\\n')\n\t\t{\n\t\t\talp[c-65]++;\n\t\t\tc=getchar();\n\t\t}\n\t}\n\tfor(i=0;i<26;i++)\n\t{\n\t\tif(alp[i]%2!=0)\n\t\t{\n\t\t\tprintf(\"NO\\n\");\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(i==26)\n\t\tprintf(\"YES\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n#include\nint cmp(const void*a,const void*b)\n{\n return (*(char*)a) - (*(char*)b);\n}\nint main(void)\n{\n char str1[1000],str2[1000],str3[1000];\n int i;\n gets(str1);\n gets(str2);\n gets(str3);\n strcat(str1,str2);\n qsort(str1,strlen(str1),sizeof(char),cmp);\n qsort(str3,strlen(str3),sizeof(char),cmp);\n if(strcmp(str1,str3) == 0)\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\t \t \t \t"}, {"source_code": "#include\n#include\nint main(){\n int i,j,e=0,x,y,z;\n char a[101],b[101],c[202],d[202];\n scanf(\"%s%s%s\",a,b,c);\n \n //c[strlen(c)]='\\';\n \n for(i=0;i\n#include \n#include \n#include\nint main()\n{\n \n//27......................A. Amusing Joke\nchar name1[100],name2[100],mix[200];\nint i ,j,check=0;\ngets (name1);\ngets (name2);\ngets (mix);\n\n for (j=0;j\n#include \n#include \n\nint ordena(const void* a, const void* b){\n char x = *((char*)a);\n char y = *((char*)b);\n\n if(x < y)\n return -1;\n return 1;\n}\n\nint main(){\n char n1[112];\n char n2[112];\n char n3[112];\n\n scanf(\"%s\", n1);\n scanf(\" %s\", n2);\n scanf(\" %s\", n3);\n\n strcat(n1, n2);\n int x = strlen(n1);\n int y = strlen(n3);\n\n if(x != y){\n printf(\"NO\\n\");\n return 0;\n }\n\n qsort(n1, x, sizeof(n1[0]), ordena);\n qsort(n3, y, sizeof(n3[0]), ordena);\n\n int k = strcmp(n1,n3);\n\n if(k == 0){\n printf(\"YES\\n\");\n }\n else{\n printf(\"NO\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n\n#include\n\n\n\nint main()\n{\n char st1[500],st2[500],st3[500],temp;\n int i,j,x;\n gets(st1);\n gets(st2);\n gets(st3);\n for(i=strlen(st1),j=0; ist1[j+1])\n {\n temp=st1[j];\n st1[j]=st1[j+1];\n st1[j+1]=temp;\n }\n }\n }\n //puts(st3);\n for(i=0; ist3[j+1])\n {\n temp=st3[j];\n st3[j]=st3[j+1];\n st3[j+1]=temp;\n }\n }\n }\n //puts(st3);\n x=strcmp(st1,st3);\n if(x==0)\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n\n\n\n else\n printf(\"NO\");\n //puts(st1);\n\n\n return 0;\n\n}\n"}, {"source_code": "#include \n#include \n#include \n\nint main(void) {\n char * guestNames = malloc(100);\n char * residenceHost = malloc(100);\n char * mergeNames = malloc(100);\n scanf(\"%s%s%s\", guestNames, residenceHost, mergeNames);\n\n int * countBefore = malloc(26*sizeof(int));\n int * countAfter = malloc(26*sizeof(int));\n\n for(int i = 0; i < 26; i++){\n \tcountAfter[i] = 0;\n \tcountBefore[i] = 0;\n }\n\n for(int i = 0; i < strlen(guestNames); i++){\n \tint index = guestNames[i] - 'A';\n \tcountBefore[index]++;\n }\n\n for(int i = 0; i < strlen(residenceHost); i++){\n \tint index = residenceHost[i] - 'A';\n \tcountBefore[index]++;\n }\n\n for(int i = 0; i < strlen(mergeNames); i++){\n \tint index = mergeNames[i] - 'A';\n \tcountAfter[index]++;\n }\n\n int result = 1;\n\n for(int i = 0; i < 26; i++){\n \tif(countAfter[i] != countBefore[i])\n \t\tresult = 0;\n }\n\n if(result)\n \tprintf(\"%s\\n\", \"YES\");\n else \n \tprintf(\"%s\\n\", \"NO\");\t\n\n free(countBefore);\n free(countAfter);\n free(guestNames);\n free(residenceHost);\n free(mergeNames);\n}\n\n\n"}, {"source_code": "#include\n#include\nint main()\n{\n int n, i, len1, len2, j, x, count=0, flag;\n char s1[101], s2[101], s3[202], c[202], temp;\n scanf(\"%s\", s1);\n scanf(\"%s\", s2);\n scanf(\"%s\", s3);\n\n strcpy(c, s2);\n strcat(c, s1);\n len1=strlen(s3);\n len2=strlen(c);\n\n if(len1!=len2){\n printf(\"NO\");\n return 0;\n }\n\n for(i=0;is3[j+1]){\n temp=s3[j];\n s3[j]=s3[j+1];\n s3[j+1]=temp;\n }\n }\n }\n for(i=0;ic[j+1]){\n temp=c[j];\n c[j]=c[j+1];\n c[j+1]=temp;\n }\n }\n }\n flag=strcmp(s3,c);\n if(flag==0){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n\n return 0;\n}\n\n\n"}, {"source_code": "#include \n#include \nint main()\n{\n char n1[100],n2[100],n3[100];\n gets(n1);\n gets(n2);\n gets(n3);\n int l1,l2,l3;\n l1=strlen(n1);\n l2=strlen(n2);\n l3=strlen(n3);\n if(l3!=(l1+l2)){\n printf(\"NO\");\n }\n else{\n strcat(n1,n2);\n char t;\n int i,j,c=0;\n for(i=0;i<(l1+l2);i++)\n {\n for(j=0;j<(l1+l2);j++){\n if(n1[j]>n1[j+1]){\n t=n1[j+1];\n n1[j+1]=n1[j];\n n1[j]=t;\n }\n }\n }\n for(i=0;in3[j+1]){\n t=n3[j+1];\n n3[j+1]=n3[j];\n n3[j]=t;\n }\n }\n }\n for(i=0;i\n#include\n#include\nint a[30];\nint main()\n{\n int i,j,n;\n char s[105];\n memset(a,0,sizeof(a));\n scanf(\"%s\",s);\n for(i=0;s[i];i++)\n {\n a[s[i]-'A']++;\n }\n scanf(\"%s\",s);\n for(i=0;s[i];i++)\n {\n a[s[i]-'A']++;\n }\n scanf(\"%s\",s);\n for(i=0;s[i];i++)\n {\n a[s[i]-'A']--;\n }\n int tag=1;\n for(i=0;i<30;i++)\n {\n if(a[i]!=0)\n tag=0;\n }\n if(tag)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n\tchar word1[100]; char word2[100]; char word3[100];\n\tscanf(\"%s%s%s\", word1, word2, word3);\n\tint dictionary1[26]={0}; int dictionary2[26]={0};\n\t\n\tfor (int i=0; word1[i]!='\\0'; i++) {\n\t\tdictionary1[word1[i]-65]++;\n\t}\n\tfor (int i=0; word2[i]!='\\0'; i++) {\n\t\tdictionary1[word2[i]-65]++;\n\t}\n\tfor (int i=0; word3[i]!='\\0'; i++) {\n\t\tdictionary2[word3[i]-65]++;\n\t}\n\tfor (int i=0; i<26; i++) {\n\t\tif (dictionary1[i]!=dictionary2[i]) {\n\t\t\tprintf(\"NO\\n\"); return 0;\n\t\t}\n\t}\n\tprintf(\"YES\\n\");\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n char s1[105], s2[105], s3[105];\n int c1[26], c3[26];\n int i, j, len1, len2, k;\n\n scanf(\"%s %s %s\", &s1, &s2, &s3);\n\n strcat(s1, s2);\n\n len1 = strlen(s1);\n len2 = strlen(s3);\n\n\n if(len1 != len2)\n {\n printf(\"NO\\n\");\n return 0;\n }\n for(i = 0; i < 26; i++)\n {\n c1[i] = 0;\n }\n\n for(i = 0; s1[i] != '\\0'; i++)\n {\n j = s1[i] - 'A';\n c1[j]++;\n }\n for(i = 0; i < 26; i++)\n {\n c3[i] = 0;\n }\n for(i = 0; s3[i] != '\\0'; i++)\n {\n k = s3[i] - 'A';\n c3[k]++;\n }\n\n for(j=0, k=0; j < 26 , k < 26 ; j++, k++)\n {\n if (c1[j] != c3[k])\n {\n printf(\"NO\\n\");\n break;\n }\n\n }\n\n if( j >= 26 )\n {\n printf(\"YES\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int i,t=0,t1=0,t2=0,j,k=0,l=0;\n char *a=malloc(100);\n gets(a);\n int a1=strlen(a);\n char *s=malloc(100);\n gets(s);\n int s1=strlen(s);\n char *b=malloc(200);\n b=strcat(a,s);\n char *as=malloc(200);\n gets(as);\n int as1=strlen(as);\n for(i=0;i\n#include \n#include \n\nint main(){\n\tint i,j,n,le=0,chan=0,k,a,b;\n\tchar s1[200],s2[101],s[101];\n\tscanf(\"%s\",&s1);\n\tscanf(\"%s\",&s2);\n\tscanf(\"%s\",&s);\n\tstrcat(s1,s2);\n\ta=strlen(s1);\n\tb=strlen(s);\n\tif (a != b){\n\tprintf(\"NO\");\n\treturn 0;\n\t}\n\tfor(i=0;i\n#include\n#include\nint main()\n{\n char a[101],b[101],c[101];\n scanf(\"%s%s%s\",&a,&b,&c);\n if(strlen(a)+strlen(b)==strlen(c))\n {\n int i,j=0;\n char* arr;\n arr=(char*)malloc(strlen(c)*sizeof(char));\n for(int i=0;i\n#include \n#include \n\nint compare(const void * first, const void * second) \n{ \n if (*(char*)first > *(char *)second) \n return 1; \n else if (*(char*)first < *(char *)second) \n return -1; \n else \n return 0; \n}\n\nint main(void){\n char f[100];\n char s[100];\n char t[100];\n\n scanf(\"%s\", f);\n scanf(\"%s\", s);\n scanf(\"%s\", t);\n\n if(strlen(f)+strlen(s) != strlen(t)){\n printf(\"NO\");\n return 0;\n }\n \n strcat(f, s);\n \n qsort((char*)f, strlen(f), sizeof(char), compare);\n qsort((char*)t, strlen(t), sizeof(char), compare);\n \n if(strcmp(f, t)==0){\n printf(\"YES\");\n }else{\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include \n#include \nint cmp(void *p, void *q);\nint main(void){\n\tchar a[220];\n\tchar b[120];\n\tchar c[120];\n\tgets(a);\n\tgets(b);\n\tgets(c);\n\tstrcat(a,b);\n\tqsort(a,strlen(a),sizeof(char),cmp);\n\tqsort(c,strlen(c),sizeof(char),cmp);\n\tprintf(\"%s\",strcmp(a,c)==0?\"YES\":\"NO\");\n\treturn 0;\n}\n\nint cmp(void *p, void *q){\n\treturn (*(char *)p)-(*(char *)q);\n}\n\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"}, {"source_code": "#include\nint main()\n{\n int count=0,i,j;\n char a[100],b[100],c[100];\n scanf(\"%s %s %s\",&a,&b,&c);\n\n for(i=0;i\n#include\nint main()\n{\n char s1[100], s2[100], i, j,temp,s[100];\n\n \n scanf(\"%s\", s1);\n int l1=strlen(s1);\n \n scanf(\"%s\", s2);\n int l2=strlen(s2);\n \n scanf(\"%s\",s);\n int l=strlen(s);\n if(l1+l2>l)\n printf(\"NO\");\n else\n {\n for(i = 0; s1[i] != '\\0'; ++i);\n\n for(j = 0; s2[j] != '\\0'; ++j, ++i)\n {\n s1[i] = s2[j];\n }\n\n s1[i] = '\\0';\n for (i = 0; i < l1+l2-1; i++)\n {\n for (j = i+1; j < l1+l2; j++) \n {\n if (s1[i] > s1[j]) \n {\n temp = s1[i];\n s1[i] = s1[j];\n s1[j] = temp;\n }\n }\n }\n for (i = 0; i < l-1; 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 int p=strcmp(s1,s);\n if(p==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n}\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\nchar s1[1000],s2[1000],s3[1000];\nint i,a[26]={0},b[26]={0};\ngets(s1);\ngets(s2);\ngets(s3);\nfor(i=0;s1[i];i++)\na[s1[i]-65]++;\nfor(i=0;s2[i];i++)\na[s2[i]-65]++;\n\nfor(i=0;s3[i];i++)\nb[s3[i]-65]++;\n\n\nfor(i=0;i<26;i++)\nif(a[i]!=b[i])\n{\nprintf(\"NO\");\nreturn 0;\n}\n\nprintf(\"YES\");\n}"}, {"source_code": "#include\n#include\n#include\n\nint main()\n{\n int i,j,k,l,n,m;\n\n char a[102];\n char b[102];\n char c[102];\n gets(a);gets(b);gets(c);\n\n if(strlen(a) + strlen(b) != strlen(c)) printf(\"NO\");\n\n else {\n for(i=0;i\n#include\nint main()\n{ \n\tint i,j,t=0;\n\tchar temp; \n\tchar g[100];\n\tchar r[100];\n\tchar p[100];\n\tgets(g);\n\tgets(r);\n\tgets(p);\n\tif(strlen(g)+strlen(r)!=strlen(p))\n\tprintf(\"NO\");\n\telse\n\t{\n\t\tstrcat(g,r);\n\t\tfor(i =0;ig[j])\n\t\t\t\t{\n\t\t\t\t\ttemp = g[i];\n\t\t\t\t\tg[i] = g[j];\n\t\t\t\t\tg[j] = temp;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(i=0;ip[j])\n\t\t\t\t{\n\t\t\t\t\ttemp = p[i];\n\t\t\t\t\tp[i] = p[j];\n\t\t\t\t\tp[j] = temp;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(i=0;i\n#include \nint main()\n{\nchar str1[100],str2[100],str4[100];\nint i,j,l1,l2,l3,l4,d=0,m=0;\nscanf(\"%[^\\n]%*c\",str1);\nscanf(\"%[^\\n]%*c\",str2);\nscanf(\"%[^\\n]%*c\",str4);\nl1=strlen(str1);\nl2=strlen(str2);\nl4=strlen(str4);\nfor(i=0;i\n#include\nint main()\n{\n char s1[300],s2[300],s3[300],i;\n int j,l1,l2,c,d;\n scanf(\"%s\",s1);\n scanf(\"%s\",s2);\n scanf(\"%s\",s3);\n strcat(s1,s2);\n l1=strlen(s1);\n l2=strlen(s3);\n if(l1==l2)\n {\n for(i='A';i<='Z';i++)\n {\n c=0;\n d=0;\n for(j=0;j\n\nint main(){\nchar anfitrion[120];\nchar invitado[120];\nchar broma[150];\nchar aver[300];\n\n\nint tam=0,tam1=0,tam2=0,total=0;\nint x,b,v,c,l=0;\nint pos=0,aux,p=0;\n\n\ngets(anfitrion); tam=strlen(anfitrion);\ngets(invitado); tam1=strlen(invitado);\ngets(broma); tam2=strlen(broma);\n\ntotal=tam+tam1;\n\n\nif(total==tam2){\n\nfor(x=0;x=tam){aver[x]=invitado[l];l++;} }\n\n }\n\n\n\nfor(x=0;x0) && (aux0) && (aux\n#include\n\nint main()\n\n{\n char fawra[102], dewra[102] , jabra[204] ;\n int bakso[26];\n\n int i , hisab=0 ;\n\n scanf(\"%s\",&fawra);\n scanf(\"%s\",&dewra);\n scanf(\"%s\",&jabra);\n\n i = 0;\n while(i<26)\n {\n bakso[i]=0;\n i++;\n }\n\n i = 0;\n\n while( i\n#include\nint main(){\n char a[10000],b[10000];\n char c[100000];\n scanf(\"%s\\n%s\\n%s\",a,b,c);\n int i,j;\n int count=0;\n for(i=0;i\n#include\n#include\n\nvoid triBulle(char temp[],int c){\n int i,j,tempi;\n for(i=0;itemp[j]){\n tempi=temp[i];\n temp[i]=temp[j];\n temp[j]=tempi;\n }\n }\n }\n}\n\n\nint comparer(char temp[],char tab[],int c){\n int i,flag;\n for(i=0;ic||a+b\n\nint main(){\nchar anfitrion[120];\nchar invitado[120];\nchar broma[150];\nchar aver[300];\n\n\nint tam=0,tam1=0,tam2=0,total=0;\nint x,b,v,c,l=0;\nint pos=0,aux,p=0;\n\n\ngets(anfitrion); tam=strlen(anfitrion);\ngets(invitado); tam1=strlen(invitado);\ngets(broma); tam2=strlen(broma);\n\ntotal=tam+tam1;\n\n\nif(total==tam2){\n\nfor(x=0;x=tam){aver[x]=invitado[l];l++;} }\n}\n\n\n\nfor(x=0;x0) && (aux0) && (aux\n#include\nmain()\n{\nint i,j,x,y,z,k,u=0,q=0;\nchar a[100],b[100],c[1000],d[10000];\nscanf(\"%s %s %s\",a,b,c);\nx=strlen(a);\ny=strlen(b);\nz=strlen(c);\nfor(i=0,j=0;i='A' && d[i]<='Z'){\nif(d[i]==c[j])\n{\nk--;\nd[i]=d[i]+32;\nc[j]=c[j]+32;\n }\n }\n }if(z!=x+y)\n {\n k=k+100;\n }\n}if(k==0)\n{\n printf(\"YES\");\n}\nif(k!=0)\n{\n printf(\"NO\");\n}\n}\n"}, {"source_code": "#include\n#include\n#include\nint isin(char alpha, char *s);\n\nint main()\n{\nchar str1[100];\nchar str2[100];\nchar str3[100];\n\nscanf(\"%s\", str1);\nscanf(\"%s\", str2);\nscanf(\"%s\", str3);\n\nint pos;\n\nint l1 = strlen(str1);\nint l2 = strlen(str2);\nint l3 = strlen(str3);\n//printf(\"%d %d %d\", l1, l2, l3);\n\nif(l3 != (l1 + l2))\n{\n //printf(\"UNEQUAL\");\n printf(\"NO\");\n //exit(0);\n}\nelse\n{\n\n for(int i = 0; i\n #include\n int main()\n {\n int i,j,len1,len3,c=0,d=0;\n char s1[102],s2[102],s3[105];\n scanf(\"%s\",s1);\n scanf(\"%s\",s2);\n scanf(\"%s\",s3);\n\n strcat(s1,s2);\n len1=strlen(s1);\n len3=strlen(s3);\n\n\n if(len1!=len3)\n {\n printf(\"NO\\n\");\n return 0;\n }\n else\n {\n for(i=0;i\n#include \n\n#define N 100\n\nint main() {\n\tstatic char aa[N + 1], bb[N + 1], cc[N + 1];\n\tstatic int kk[26];\n\tint a, b, c, i, x;\n\n\tscanf(\"%s%s%s\", aa, bb, cc);\n\ta = strlen(aa);\n\tb = strlen(bb);\n\tc = strlen(cc);\n\tfor (i = 0; i < c; i++)\n\t\tkk[cc[i] - 'A']++;\n\tfor (i = 0; i < a; i++)\n\t\tkk[aa[i] - 'A']--;\n\tfor (i = 0; i < b; i++)\n\t\tkk[bb[i] - 'A']--;\n\tfor (x = 0; x < 26; x++)\n\t\tif (kk[x]) {\n\t\t\tprintf(\"NO\\n\");\n\t\t\treturn 0;\n\t\t}\n\tprintf(\"YES\\n\");\n\treturn 0;\n}\n"}], "negative_code": [{"source_code": "#include\nint main()\n{\n\tchar a[100],b[100],c[200],d[200],k;\n\tint n,m,i,j,l,h=0;\n\n\tscanf(\"%s%s%s\",a,b,d);\n\n\tn=strlen(a);\n\tm=strlen(b);\n\tl=strlen(d);\n\n\tfor (i=0;a[i]!='\\0'; i++)\n\t\tc[i]=a[i];\n\tfor (j=0; a[j]!='\\0'; j++)\n\t{\n\t\tc[i]=b[j];\n\t\ti++;\n\t}\n\tc[i]='\\0';\n\n\tfor (i=0; i(int)c[j+1])\n\t\t\t{\n\t\t\t\tk=c[j];\n\t\t\t\tc[j]=c[j+1];\n\t\t\t\tc[j+1]=k;\n\t\t\t}\n\t\t}\n\t}\n\n\n\tfor (i=0; i(int)d[j+1])\n\t\t\t{\n\t\t\t\tk=d[j];\n\t\t\t\td[j]=d[j+1];\n\t\t\t\td[j+1]=k;\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (i=0; i\n#include \n#include \n\nint cmpfn(const void *a, const void *b) {\n return (*(char*)a - *(char*)b);\n}\n\nvoid can_make(void) {\n char a[201];\n char c[101];\n int newline = 0;\n int i = 0;\n while(newline < 2) {\n char c;\n scanf(\"%c\", &c);\n if (c == '\\n') {\n newline++;\n scanf(\"\\n\");\n } else {\n a[i] = c;\n i++;\n }\n }\n\n a[i+1] = '\\0';\n scanf(\"%s\", c);\n qsort(a,strlen(a),sizeof(char),cmpfn);\n qsort(c,strlen(c),sizeof(char),cmpfn);\n if (!strcmp(a,c)) {\n printf(\"YES\\n\");\n } else {\n printf(\"NO\\n\");\n }\n}\n\nint main(void) {\n can_make();\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\nchar x[1000],y[1000],s[1000];\nint main()\n{\n\tint temp=1,I,a,b,c;\n\ta=strlen(gets(x));\n\tb=strlen(gets(y));\n\tc=strlen(gets(s));\n\n\n\n\n\t\tfor(I=0;I\n#include \n\nint main()\n{\n int l1, l3, i, j;\n char str1[101], str2[101], str3[101], temp1, temp3;\n scanf(\"%s %s %s\", str1, str2, str3);\n\n strcat(str1, str2);\n l1 = strlen(str1);\n l3 = strlen(str3);\n\n for(i=0; i<(l1-1); i++){\n for(j=0; j<(l1-1); j++){\n if(str1[j] > str1[j+1]){\n temp1 = str1[j];\n str1[j] = str1[j+1];\n str1[j+1] = temp1;\n }\n }\n }\n for(i=0; i<(l3-1); i++){\n for(j=0; j<(l3-1); j++){\n if(str3[j] > str3[j+1]){\n temp3 = str3[j];\n str3[j] = str3[j+1];\n str3[j+1] = temp3;\n }\n }\n }\n\n if(l1 == l3){\n for(i=0; i\nint main()\n{\n char str1[50000],str2[50000],str3[50000];\n int i,j,k,l,m,a1=0,b1=0,c1=0,d1=0,e1=0,f1=0,g1=0,h1=0,i1=0,j1=0,k1=0,l1=0,m1=0,\n n1=0,o1=0,p1=0,q1=0,r1=0,s1=0,t1=0,u1=0,v1=0,w1=0,x1=0,y1=0,z1=0;\n int a2=0,b2=0,c2=0,d2=0,e2=0,f2=0,g2=0,h2=0,i2=0,j2=0,k2=0,l2=0,m2=0,\n n2=0,o2=0,p2=0,q2=0,r2=0,s2=0,t2=0,u2=0,v2=0,w2=0,x2=0,y2=0,z2=0;\n int a3=0,b3=0,c3=0,d3=0,e3=0,f3=0,g3=0,h3=0,i3=0,j3=0,k3=0,l3=0,m3=0,\n n3=0,o3=0,p3=0,q3=0,r3=0,s3=0,t3=0,u3=0,v3=0,w3=0,x3=0,y3=0,z3=0;\n gets(str1);\n gets(str2);\n gets(str3);\n for(i=0; str1[i]!='\\0'; i++)\n {\n if(str1[i]=='A')\n a1++;\n else\n a1=0;\n if(str1[i]=='B')\n b1++;\n else\n b1=0;\n if(str1[i]=='C')\n c1++;\n else\n c1=0;\n if(str1[i]=='D')\n d1++;\n else\n d1=0;\n if(str1[i]=='E')\n e1++;\n else\n e1=0;\n if(str1[i]=='F')\n f1++;\n else\n f1=0;\n if(str1[i]=='G')\n g1++;\n else\n g1=0;\n if(str1[i]=='H')\n h1++;\n else\n h1=0;\n if(str1[i]=='I')\n i1++;\n else\n i1=0;\n if(str1[i]=='J')\n j1++;\n else\n j1=0;\n if(str1[i]=='K')\n k1++;\n else\n k1=0;\n if(str1[i]=='L')\n l1++;\n else\n l1=0;\n if(str1[i]=='M')\n m1++;\n else\n m1=0;\n if(str1[i]=='N')\n n1++;\n else\n n1=0;\n if(str1[i]=='O')\n o1++;\n else\n o1=0;\n if(str1[i]=='P')\n p1++;\n else\n p1=0;\n if(str1[i]=='Q')\n q1++;\n else\n q1=0;\n if(str1[i]=='R')\n r1++;\n else\n r1=0;\n if(str1[i]=='S')\n s1++;\n else\n s1=0;\n if(str1[i]=='T')\n t1++;\n else\n t1=0;\n if(str1[i]=='U')\n u1++;\n else\n u1=0;\n if(str1[i]=='V')\n v1++;\n else\n v1=0;\n if(str1[i]=='W')\n w1++;\n else\n w1=0;\n if(str1[i]=='X')\n x1++;\n else\n x1=0;\n if(str1[i]=='Y')\n y1++;\n else\n y1=0;\n if(str1[i]=='Z')\n z1++;\n else\n z1=0;\n }\n for(i=0; str2[i]!='\\0'; i++)\n {\n if(str2[i]=='A')\n a2++;\n else\n a2=0;\n if(str2[i]=='B')\n b2++;\n else\n b2=0;\n if(str2[i]=='C')\n c2++;\n else\n c2=0;\n if(str2[i]=='D')\n d2++;\n else\n d2=0;\n if(str2[i]=='E')\n e2++;\n else\n e2=0;\n if(str2[i]=='F')\n f2++;\n else\n f2=0;\n if(str2[i]=='G')\n g2++;\n else\n g2=0;\n if(str2[i]=='H')\n h2++;\n else\n h2=0;\n if(str2[i]=='I')\n i2++;\n else\n i2=0;\n if(str2[i]=='J')\n j2++;\n else\n j2=0;\n if(str2[i]=='K')\n k2++;\n else\n k2=0;\n if(str2[i]=='L')\n l2++;\n else\n l2=0;\n if(str2[i]=='M')\n m2++;\n else\n m2=0;\n if(str2[i]=='N')\n n2++;\n else\n n2=0;\n if(str2[i]=='O')\n o2++;\n else\n o2=0;\n if(str2[i]=='P')\n p2++;\n else\n p2=0;\n if(str2[i]=='Q')\n q2++;\n else\n q2=0;\n if(str2[i]=='R')\n r2++;\n else\n r2=0;\n if(str2[i]=='S')\n s2++;\n else\n s2=0;\n if(str2[i]=='T')\n t2++;\n else\n t2=0;\n if(str2[i]=='U')\n u2++;\n else\n u2=0;\n if(str2[i]=='V')\n v2++;\n else\n v2=0;\n if(str2[i]=='W')\n w2++;\n else\n w2=0;\n if(str2[i]=='X')\n x2++;\n else\n x2=0;\n if(str2[i]=='Y')\n y2++;\n else\n y2=0;\n if(str1[i]=='Z')\n z2++;\n else\n z2=0;\n }\n for(i=0; str3[i]!='\\0'; i++)\n {\n if(str3[i]=='A')\n a3++;\n else\n a3=0;\n if(str3[i]=='B')\n b3++;\n else\n b3=0;\n if(str3[i]=='C')\n c3++;\n else\n c3=0;\n if(str3[i]=='D')\n d3++;\n else\n d3=0;\n if(str3[i]=='E')\n e3++;\n else\n e3=0;\n if(str3[i]=='F')\n f3++;\n else\n f3=0;\n if(str3[i]=='G')\n g3++;\n else\n g3=0;\n if(str3[i]=='H')\n h3++;\n else\n h3=0;\n if(str3[i]=='I')\n i3++;\n else\n i3=0;\n if(str3[i]=='J')\n j3++;\n else\n j3=0;\n if(str3[i]=='K')\n k3++;\n else\n k3=0;\n if(str3[i]=='L')\n l3++;\n else\n l3=0;\n if(str3[i]=='M')\n m3++;\n else\n m3=0;\n if(str3[i]=='N')\n n3++;\n else\n n3=0;\n if(str3[i]=='O')\n o3++;\n else\n o3=0;\n if(str3[i]=='P')\n p3++;\n else\n p3=0;\n if(str3[i]=='Q')\n q3++;\n else\n q3=0;\n if(str3[i]=='R')\n r3++;\n else\n r3=0;\n if(str3[i]=='S')\n s3++;\n else\n s3=0;\n if(str3[i]=='T')\n t3++;\n else\n t3=0;\n if(str3[i]=='U')\n u3++;\n else\n u3=0;\n if(str3[i]=='V')\n v3++;\n else\n v3=0;\n if(str3[i]=='W')\n w3++;\n else\n w3=0;\n if(str3[i]=='X')\n x3++;\n else\n x3=0;\n if(str3[i]=='Y')\n y3++;\n else\n y3=0;\n if(str3[i]=='Z')\n z3++;\n else\n z3=0;\n }\n if(a1+a2!=a3||b1+b2!=b3||c1+c2!=c3||d1+d2!=d3||e1+e2!=e3||f1+f2!=f3||g1+g2!=g3||h1+h2!=h3||i1+i2!=i3||j1+j2!=j3||k1+k2!=k3||l1+l2!=l3||m1+m2!=m3||n1+n2!=n3||o1+o2!=o3||p1+p2!=p3||q1+q2!=q3||r1+r2!=r3||s1+s2!=s3||t1+t2!=t3||u1+u2!=u3||v1+v2!=v3||w1+w2!=w3||x1+x2!=x3||y1+y2!=y3||z1+z2!=z3)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n char s1[105], s2[105], s3[105], c[26] = {0};\n int i, j, len1, len2, k;\n\n scanf(\"%s %s %s\", &s1, &s2, &s3);\n\n strcat(s1, s2);\n\n len1 = strlen(s1);\n len2 = strlen(s3);\n\n\n if(len1 != len2)\n {\n printf(\"NO\\n\");\n return 0;\n }\n for(i = 0; i < 26; i++)\n {\n c[i] = 0;\n }\n\n for(i = 0; s1[i] != '\\0'; i++)\n {\n j = s1[i] - 'A';\n c[j]++;\n }\n for(i = 0; i < 26; i++)\n {\n c[i] = 0;\n }\n for(i = 0; s3[i] != '\\0'; i++)\n {\n k = s3[i] - 'A';\n c[k]++;\n }\n\n for(j=0, k=0; c[j] != '\\0' , c[k] != '\\0' ; j++, k++)\n {\n if (c[j] != c[k])\n {\n printf(\"NO\\n\");\n return 0;\n }\n\n\n }\n if(c[j] == c[i])\n {\n printf(\"YES\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n char str1[100],str2[100],str3[100],temp;\n scanf(\"%s\",&str1);\n scanf(\"%s\",&str2);\n scanf(\"%s\",&str3);\n strcat(str1,str2);\n int i,j,l1,l2,count=0;\n l1=strlen(str1);\n l2=strlen(str3);\n for(i=0;istr1[j+1])\n {\n temp=str1[j+1];\n str1[j+1]=str1[j];\n str1[j]=temp;\n }\n }\n }\n for(i=0;istr3[j+1])\n {\n temp=str3[j+1];\n str3[j+1]=str3[j];\n str3[j]=temp;\n }\n }\n }\n if(l1!=l2)\n printf(\"NO\");\n else\n {\n for(i=0;i\n#include\n#include\n\n\nmain()\n{\n int i,j,x,y,k,z=0;\n int a[26]={};\n int b[26]={};\n char guest[100];\n //int gh[1000];\n char host[100];\n char hn[1000];\n char pile[1000];\n char pn[1000];\n //int a[26];\n gets(guest);\n //printf(\"\\n\");\n gets(host);\n //printf(\"\\n\");\n gets(pile);\n //printf(\"\\n\");\n\n\n strcat(guest,host);\n int p = 0;\n\n for(i=0;i\n#include\nint main()\n{\n int count;\n char a[1000], b[1000], c[1000],d[2000];\n scanf(\"%s\", &a);\n scanf(\"%s\", &b);\n scanf(\"%s\", &c);\n\n strcat(a,b);\n\n for(int i=0;ia[j]){\n t=a[i];\n a[i]=a[j];\n a[j]=t;\n }\n }\n }\n\n for(int i=0;ic[j]){\n t=c[i];\n c[i]=c[j];\n c[j]=t;\n }\n }\n }\n\n for(int i=0;i\nint main()\n{\n char str1[100],str2[100],str3[100];\n int l1,l2,l3,count=0,i,j;\n scanf(\"%s %s %s\",&str1,&str2,&str3);\n l1=strlen(str1);\n l2=strlen(str2);\n l3=strlen(str3);\n for(i=0;i\n#include \n#include \n\nint cmp(const void *a, const void *b) {\n return *(const char *)a - *(const char *)b;\n}\n\nint main(void) {\n char names[200] = {0};\n char pile[100] = {0};\n char c, i = 0, f = 0;\n\n while((c = getchar()) != '\\n') {\n names[i++] = c;\n }\n\n while((c = getchar()) != '\\n') {\n names[i++] = c;\n }\n \n gets(pile);\n qsort(names, strlen(names), sizeof(char), cmp);\n qsort(pile, strlen(pile), sizeof(char), cmp);\n \n i = c = 0;\n while(c < strlen(names) && i < strlen(pile)) {\n if(names[c] != pile[i]) {\n f = 1;\n break;\n }\n c++; i++;\n }\n puts(f ? \"NO\" : \"YES\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main()\n\n{\n char fawra[102], dewra[102] , jabra[204] , e1[]=\"SANTACLAUS\",e2[]=\"DEDMOROZ\",e3[]=\"SANTAMOROZDEDCLAUS\" ;\n int bakso[26];\n\n int i , hisab ;\n\n scanf(\"%s\",fawra);\n scanf(\"%s\",dewra);\n scanf(\"%s\",jabra);\n \n if( strcmp(fawra,e1)==0 && strcmp(dewra,e2)==0 && strcmp(jabra,e3)==0 )\n {\n printf(\"YES\");\n }\n \n else\n {\n i = 0;\n while(i<26)\n {\n bakso[i]=0;\n i++;\n }\n\n i = 0;\n\n while( i\n#include\nint main()\n{\n char a[100];\n char b[100];\n char c[100];\n int x,y,z,i,s=0,s1=0,s2=0;\n gets(a);\n gets(b);\n gets(c);\n x=strlen(a);\n y=strlen(b);\n z=strlen(c);\n for(i=0;i\n#include \n#include \n#include \n#define SIZE 100000\t\n\nint main(){\n\tchar a[SIZE], b[SIZE], c[SIZE];\n\tfgets(a, sizeof(a), stdin);\n\tfgets(b, sizeof(b), stdin);\n\tfgets(c, sizeof(c), stdin);\n\tint sum1, sum2;\n\tsum1 = sum2 = 0;\n\tint len_a, len_b, len_c;\n\tlen_a = strlen(a);\n\tlen_b = strlen(b);\n\tlen_c = strlen(c);\n\tfor(int i = 0; i < len_a; i++){\n\t\tsum1 += a[i];\n\t}\n\tfor(int i = 0; i < len_b; i++){\n\t\tsum1 += b[i];\n\t}\n\tfor(int i = 0; i < len_c; i++){\n\t\tsum2 += c[i];\n\t}\n\tsum1 -= 20;\n\tsum2 -= 10;\n\t// printf(\"%d %d\\n\", sum1, sum2);\n\t(sum1 == sum2) ? printf(\"YES\\n\") : printf(\"N0\\n\");\nreturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nchar host[102];\nchar guest[102];\nchar total[102];\n\nvoid compare(char ar[], char br[]){\n\t\n\tint i,j;\n\t\n\tfor( i=0 ; i\n#include \n\nchar host[102];\nchar guest[102];\nchar total[102];\n\nvoid compare(char ar[], char br[]){\n\t\n\tint i,j;\n\t\n\tfor( i=0 ; i\n\nint main(void) {\n char *p = 0;\n char n1[101] = {0, }, n2[101] = {0, };\n char s[101] = {0, };\n int cnt[26] = {0, };\n \n scanf(\"%s\", n1);\n scanf(\"%s\", n2);\n scanf(\"%s\", s);\n \n p = n1;\n while (*p) {\n cnt[*p - 'A']++;\n p++;\n }\n \n p = n2;\n while (*p) {\n cnt[*p - 'A']++;\n p++;\n }\n \n p = s;\n while (*p) {\n if (cnt[*p - 'A'] == 0) {\n break;\n } else {\n cnt[*p - 'A']--;\n }\n \n p++;\n }\n \n if (*p) {\n printf(\"NO\\n\");\n } else {\n printf(\"YES\\n\");\n }\n\n return 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\nchar a[301],b[101],c[101];\nscanf(\"%s %s %s\",a,b,c);\nstrcat(a,b);\nint i,count=0,k,j,z;\nk=strlen(c);\nfor(i=0;i\nint main(void)\n{\n char arr[200],arr2[100],arr3[200];\n gets(arr);\n gets(arr2);\n gets(arr3);\n strcat(arr,arr2);\n int i=0,j=0;\n char mode;\n if(strlen(arr)==strlen(arr3)){\n while(arr[i]!='\\0')\n {\n mode='0';\n while(arr3[j]!='\\0')\n {\n if(arr[i]==arr3[j])\n {\n mode='1';\n break;\n }\n else\n j++;\n }\n if(mode=='1')\n i++;\n else\n {\n printf(\"NO\");\n break;\n }\n }\n if(arr[i]=='\\0')\n printf(\"YES\");\n }\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n\tchar a[101], b[101], c[101], d[1001];\n\tint l, i, j = 0;\n\tgets(a);\n\tgets(b);\n\tgets(c);\n\tl = strlen(a) + strlen(b);\n\tfor (i = 0; i < strlen(a); i++)\n\t{\n\t\td[j] = a[i];\n\t\tj++;\n\t}\n\tfor (i = 0; i < strlen(b); i++)\n\t{\n\t\td[j] = b[i];\n\t\tj++;\n\t}\n\td[j] = '\\0';\n\tif (0 == strcmp(d, c))\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\treturn 0;\n}"}, {"source_code": "#include\n#include\n#include\n\nint main(){\n char tab1[101];\n char tab2[101];\n char tab[201];\n int a,b,c;\n scanf(\"%s %s %s\",tab1,tab2,tab);\n a=strlen(tab1);\n b=strlen(tab2);\n c=strlen(tab);\n if(a+b>c||a+b\n#include\nint main()\n{\n char a[1000],b[10000],c[1000];\n int i,j,k,l,m,n;\n gets(a);\n gets(b);\n gets(c);\n for(i=0; i\n#include \nchar name[110],host[110],words[110];\nint Judge(char *a,char *b)\n{\n int i,j,len1,len2,count=0;\n len1=strlen(a);\n len2=strlen(b);\n for (i=0; i\n#include\n#include\n#include\n#include\n\n\n\n\n\n\nint main()\n{\n int i,j,ct,len1,len2,len3;\n ct=0;\n\n char a[1000];\n char b[1000];\n char c[1000];\n gets(a);\n gets(b);\n gets(c);\n len1=strlen(a);\n len2=strlen(b);\n len3=strlen(c);\n for(i=0; i\n#include\nint main()\n{\n char a[101],b[101],c[101];\n scanf(\"%s%s%s\",&a,&b,&c);\n if(strlen(a)+strlen(b)==strlen(c))\n {\n int i,j=0;\n char arr[strlen(c)];\n strcat(arr,a);\n strcat(arr,b);\n for(i=0;i\n\nmain()\n{\n char a[100],b[100],c[100];\n int i,j,x,y,z,k;\n scanf(\"%s %s %s\",a,c,b);\n x=strlen(b);\n y=strlen(a);\n z=strlen(c);\n k=x;\n\n\n for(i=0;i\n#include\n\nint sum(char a[],int length)\n{\n int sum=0,i;\n for(i=0;i\n#include\nint main (){\n\tchar word1[101] , word2[101] , word3[201];\n scanf(\"%s %s %s\",word1,word2,word3);\n int l1=strlen(word1);\n\tint l2=strlen(word2);\n\tint l3=strlen(word3);\n\tif (l3-(l2+l1)){\n\t\tprintf (\"NO\");\n\t}\n\tfor (int i=0; i\n#include \n\n#define N 100\n\nint main() {\n\tstatic char aa[N + 1], bb[N + 1], cc[N + 1], kk[27];\n\tint a, b, c, i;\n\n\tscanf(\"%s%s%s\", aa, bb, cc);\n\ta = strlen(aa);\n\tb = strlen(bb);\n\tc = strlen(cc);\n\tfor (i = 0; i < c; i++)\n\t\tkk[cc[i] - 'a']++;\n\tfor (i = 0; i < a; i++) {\n\t\tif (kk[aa[i] - 'a'] < 1) {\n\t\t\tprintf(\"NO\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\tkk[aa[i] - 'a']--;\n\t}\n\tfor (i = 0; i < b; i++) {\n\t\tif (kk[bb[i] - 'a'] < 1) {\n\t\t\tprintf(\"NO\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\tkk[bb[i] - 'a']--;\n\t}\n\tfor (i = 0; i < c; i++) {\n\t\tif (kk[cc[i] - 'a'] > 0) {\n\t\t\tprintf(\"NO\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\tkk[cc[i] - 'a']--;\n\t}\n\tprintf(\"YES\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int n, i, len1, len2, j, x, count=0, flag;\n char s1[101], s2[101], s3[202], c[202], temp;\n scanf(\"%s\", s1);\n scanf(\"%s\", s2);\n scanf(\"%s\", s3);\n\n strcpy(c, s2);\n len1=strlen(s3);\n strcat(c, s1);\n len2=strlen(c);\n for(i=0;is3[j+1]){\n temp=s3[j];\n s3[j]=s3[j+1];\n s3[j+1]=temp;\n }\n }\n }\n for(i=0;ic[j+1]){\n temp=c[j];\n c[j]=c[j+1];\n c[j+1]=temp;\n }\n }\n }\n flag=strncmp(s3,c,len2);\n if(flag>=0){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n\n return 0;\n}\n\n\n"}, {"source_code": "/*\n @author: Sanjoy Paul\n*/\n\n#include \n#include \n\nvoid sorting_letters(char *str)\n{\n for (int i = 0; str[i] != '\\0'; i++)\n {\n for (int j = 0; str[j] != '\\0';j++)\n {\n if (str[j] > str[i])\n {\n char temp = str[i];\n str[i] = str[j];\n str[j] = temp;\n }\n }\n }\n}\n\n\nint main()\n{\n char guests[220];\n char hosts[105];\n char pile[105];\n int count = 0;\n\n scanf(\"%[^\\n]\", guests);\n scanf(\" %[^\\n]\", hosts);\n scanf(\" %[^\\n]\", pile);\n\n strcat(guests, hosts);\n \n sorting_letters(guests);\n \n sorting_letters(pile);\n\n for(int i = 0; guests[i] != '\\0'; i++){\n if(guests[i] != pile[i]){\n count++;\n }\n }\n\n if(count != 0){\n printf(\"NO\\n\");\n }\n else{\n printf(\"YES\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n char str1[100],str2[100],str3[100];\n scanf(\"%s\",str1);\n scanf(\"%s\",str2);\n scanf(\"%s\",str3);\n strcat(str1,str2);\n int a[26],b[26];\n int i,j;\n int p[200],q[100];\n for(i=0;i<26;i++)\n {\n a[i]=0;\n b[i]=0;\n }\n for(i=0;i\n#include\nint main(){\n int i,j,e=0,x,y,z;\n char a[101],b[101],c[202],d[202];\n scanf(\"%s%s%s\",a,b,c);\n \n \n \n for(i=0;i\n#include\nint main (){\n char x[105],y[105],z[105];\n int length,length_1,length_2,i,j,k,cnt_star=0;\n scanf(\"%s\",x);\n scanf(\"%s\",y);\n scanf(\"%s\",z);\n length=strlen(x);\n length_1=strlen(y);\n length_2=strlen(z);\n\n for(i=0;i\n#include\nint main()\n{\n\tchar a[101], b[101], c[101], d[1001];\n\tint i, j, l = 0;\n\tgets(a);\n\tgets(b);\n\tgets(c);\n\tfor (i = 0; i < strlen(a); i++)\n\t\tfor (j = 0; j < strlen(c); j++)\n\t\t\tif (a[i] == c[j])\n\t\t\t{\n\t\t\t\tc[j] = '.';\n\t\t\t\tl++;\n\t\t\t\tbreak;\n\t\t\t}\n\tfor (i = 0; i < strlen(b); i++)\n\t\tfor (j = 0; j < strlen(c); j++)\n\t\t\tif (b[i] == c[j])\n\t\t\t{\n\t\t\t\tc[j] = '*';\n\t\t\t\tl++;\n\t\t\t\tbreak;\n\t\t\t}\n\tif (l == strlen(c))\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n\tint i,j,u1,u2,top,u3,ctrl[1000],as[1000];\n\tchar a[1000],b[1000],c[1000];\n\tscanf(\"%s\",a);\n\tscanf(\"%s\",b);\n\tscanf(\"%s\",c);\n\tu1=strlen(a);\n\tu2=strlen(b);\n\tu3=strlen(c);\n\tfor(i=0;i\n#include\nint main()\n{\n char str1[110],str2[110],str3[230],str4[230],temp;\n int i,j,m,n;\n gets(str1);\n gets(str2);\n gets(str3);\n strcpy(str4,str1);\n strcat(str4,str2);\n n=strlen(str4);\n for(i=0;i\n#include \n#include \n#define MaxNum 100\nvoid mergesort(char A[] , int ArrayLen);\nint main()\n{\n char Host[MaxNum],Guest[MaxNum],Letters[MaxNum],Check[MaxNum],i,j,length;\n gets(Host);\n gets(Guest);\n gets(Letters);\n for(i=0;Host[i]!=0;i++){\n Check[i]=Host[i];\n }\n for(j=0;Guest[j]!=0;j++){\n Check[i]=Guest[j];\n i++;\n }\n Check[i]=0;\n for(j=0;Letters[j]!=0;j++){\n\n }\n if(i!=j){\n printf(\"NO\");\n }\n\n else{\n\n mergesort(Check,i);\n mergesort(Letters,i);\n\n /* for(j=0;jA[1]){\n temp=A[0];\n A[0]=A[1];\n A[1]=temp;\n }\n return 0;\n }\n if(ArrayLen==3){\n\n if(A[1]=ArrayLen/2){\n A[i]=B[k];\n k++;\n }\n else{\n A[i]=C[j];\n j++;\n }\n\n }\n\n}\nelse{\n\n for(i=0;i=ArrayLen/2){\n A[i]=B[k];\n k++;\n }\n else{\n A[i]=C[j];\n j++;\n }\n\n }\n}\n}\n"}, {"source_code": "#include \n#include\n#include\n#include\n\nint main()\n{\nint i,j,k,s[26],t[101],n=0;\n char s1[101],s2[101],s3[101],s4[101];\n scanf(\"%s\",s1);\n scanf(\"%s\",s2);\n scanf(\"%s\",s3);\n int n3=strlen(s3);\n int n1=strlen(s1);\n int n2=strlen(s2);\n if(n1+n2>n3 || n1+n2\n#include\n#include\nint main ()\n{\nchar g[101],h[101],s[101];\nscanf(\"%s%s%s\",g,h,s);\nif(strlen(g)+strlen(h)!=strlen(s)) printf(\"NO\\n\");\nelse printf(\"YES\\n\");\nreturn 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n char str1[110],str2[110],str3[210];\n char temp[210];\n int i,j;\n scanf(\" %s\",str1);\n scanf(\" %s\",str2);\n scanf(\" %s\",str3);\n for(i=0,j=0;i\nmain()\n{\n int i,j,k,l,m,px,qx,sx,count=0;\n char p[100],q[100],s[200];\n gets(p);\n px=strlen(p);\n p[px]=0;\n gets(q);\n qx=strlen(q);\n q[qx]=0;\n gets(s);\n sx=strlen(s);\n s[sx]=0;\n for(i=0;i\n#include\n\nint main()\n\n{\n char fawra[102], dewra[102] , jabra[204] , e1[]=\"SANTACLAUS\",e2[]=\"DEDMOROZ\",e3[]=\"SANTAMOROZDEDCLAUS\" ;\n int bakso[26];\n\n int i , hisab ;\n\n scanf(\"%s\",fawra);\n scanf(\"%s\",dewra);\n scanf(\"%s\",jabra);\n \n if( strcmp(fawra,e1)==0 && strcmp(dewra,e2)==0 && strcmp(jabra,e3) )\n {\n printf(\"YES\");\n }\n \n else\n {\n i = 0;\n while(i<26)\n {\n bakso[i]=0;\n i++;\n }\n\n i = 0;\n\n while( i\n#include\nint main (){\n char x[105],y[105],z[105];\n int length,length_1,length_2,i,j,k,cnt_star=0;\n scanf(\"%s\",x);\n scanf(\"%s\",y);\n scanf(\"%s\",z);\n length=strlen(x);\n length_1=strlen(y);\n length_2=strlen(z);\n\n for(i=0;i\n#include\n\nint main()\n\n{\n char fawra[102], dewra[102] , jabra[204] ;\n int bakso[26];\n\n int i , hisab ;\n\n scanf(\"%s\",fawra);\n scanf(\"%s\",dewra);\n scanf(\"%s\",jabra);\n\n i = 0;\n while(i<26)\n {\n bakso[i]=0;\n i++;\n }\n\n i = 0;\n\n while( i\n#include\nint main()\n{\n char s1[200],s2[100],s3[100],m;\n scanf(\"%s%s%s\",s1,s2,s3);\n strcat(s1, s2);\n int i,j,l=strlen(s1);\n for(i=0;is1[j+1]) {\n m=s1[j];\n s1[j]=s1[j+1];\n s1[j+1]=m;\n }\n }\n }\n for(i=0;is3[j+1]) {\n m=s3[j];\n s3[j]=s3[j+1];\n s3[j+1]=m;\n }\n }\n }\n int r=strcmp(s1,s3);\n if(r==0) {\n printf(\"YES\\n\");\n }\n else {\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n char s1[105], s2[105], s3[105], c[26] = {0};\n int i, j, len1, len2, k;\n\n scanf(\"%s %s %s\", &s1, &s2, &s3);\n\n strcat(s1, s2);\n\n len1 = strlen(s1);\n len2 = strlen(s3);\n\n\n if(len1 != len2)\n {\n printf(\"NO\\n\");\n return 0;\n }\n for(i = 0; i < 26; i++)\n {\n c[i] = 0;\n }\n\n for(i = 0; s1[i] != '\\0'; i++)\n {\n j = s1[i] - 'A';\n c[j]++;\n }\n for(i = 0; i < 26; i++)\n {\n c[i] = 0;\n }\n for(i = 0; s3[i] != '\\0'; i++)\n {\n k = s3[i] - 'A';\n c[k]++;\n }\n\n for(j=0, k=0; c[j] != '\\0' , c[k] != '\\0' ; j++, k++)\n {\n if (c[j] != c[k])\n {\n printf(\"NO\\n\");\n return 0;\n }\n\n\n }\n if(c[j] == c[i])\n {\n printf(\"YES\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include \nint Len(char c[]){\n int j;\n for(int i=0;c[i]!='\\0';i++){\n j=i;\n }\n return j;\n}\nvoid print(char c[]){\n for(int i=0;c[i]!='\\0';i++){\n if(c[i]!='a'){\n printf(\"NO\");\n return;\n }\n }\n printf(\"YES\");\n}\nchar Char(char a[],char c[], int len){\n for(int i=0;a[i]!='\\0';i++){\n for(int j=0;j\n#include \nint main()\n{\n char l1[101], l2[101], l3[101], l12[202];\n int i = -1,j = -1;\n char tmp;\n scanf(\"%s\", l1);\n scanf(\"%s\", l2);\n scanf(\"%s\", l3);\n while (l1[++i])\n l12[i] = l1[i];\n while (l2[++j])\n l12[i + j] = l2[j];\n i = 0;\n while (l3[i])\n {\n j = i + 1;\n while (l3[j])\n {\n if (l3[i] > l3[j])\n {\n tmp = l3[i];\n l3[i] = l3[j];\n l3[j] = tmp;\n }\n j++;\n }\n i++;\n }\n i = 0;\n while (l12[i])\n {\n j = i + 1;\n while (l12[j])\n {\n if (l12[i] > l12[j])\n {\n tmp = l12[i];\n l12[i] = l12[j];\n l12[j] = tmp;\n }\n j++;\n }\n i++;\n }\n if (strcmp(l12, l3) == 0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return (0);\n}"}, {"source_code": "#include\n#include\nint main()\n{\n int x,y,i,j,count=0,z;\n char a[101],b[101],c[101];\n scanf(\"%s\",&a);\n scanf(\"%s\",&b);\n scanf(\"%s\",&c);\n y=strlen(b);\n x=strlen(a);\n z=strlen(c);\n\n if(x+y!=z)\n {\n printf(\"NO\\n\");\n }\n else\n {\n for(i=0; i\n#include \n#include\n\nint main()\n{\n char a[100],b[100];\n\n char mix[200];\n\n scanf(\"%s%s%s\",a,b,mix);\n\n int letters[26]={0},check[26]={0},i;\n for(i=0;i<(strlen(a)>strlen(b)?strlen(a):strlen(b));i++)\n {\n if(a[i]!='\\0'||a[i]!='0')\n letters[a[i]-65]+=1;\n if(b[i]!='\\0'||b[i]!='0')\n letters[b[i]-65]+=1;\n }\n for(i=0;mix[i]!='\\0';i++)\n check[mix[i]-65]+=1;\n\n for(i=0;i<26;i++)\n {\n if(letters[i]!=check[i])\n {\n printf(\"NO\");\n exit(0);\n }\n }\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n char a[101],b[101],c[202];\n int d[26]={0},e[26]={0};\n scanf(\"%s\\n%s\\n%s\",a,b,c);\n for(int i=0;i<101;i++)d[a[i]-'a']++;\n for(int i=0;i<101;i++)d[b[i]-'a']++;\n for(int i=0;i<202;i++)e[c[i]-'a']++;\n for(int i=0;i<26;i++){\n if(d[i]\n\nint ara[26],ara2[26];\n\nint main()\n{\n char a[199],b[199],c[300];\n scanf(\"%s %s %s\",a,b,c);\n int i;\n if(strlen(a)+strlen(b) == strlen(c))\n {\n for(i=0; i\n#include\n#include\n\nint main(){\n char tab1[101];\n char tab2[101];\n char tab[201];\n int a,b,c;\n scanf(\"%s %s %s\",tab1,tab2,tab);\n a=strlen(tab1);\n b=strlen(tab2);\n c=strlen(tab);\n if(a+b>c||a+b\n#include\n\nint main(){\n\tchar a[1000];\n\tchar b[1000];\n\tchar c[1000];\n\tgets(a);\n\tgets(b);\n\tgets(c);\n\tstrcat(a,b);\n\tchar d[1000]={0};\n\tint dem=0;\n\tfor(int i=0;i\nint main(void)\n{\n char arr[200],arr2[100],arr3[200];\n gets(arr);\n gets(arr2);\n gets(arr3);\n strcat(arr,arr2);\n int i=0,j=0;\n char mode;\n if(strlen(arr)==strlen(arr3)){\n while(arr[i]!='\\0')\n {\n mode='0';\n while(arr3[j]!='\\0')\n {\n if(arr[i]==arr3[j])\n {\n mode='1';\n break;\n }\n else\n j++;\n }\n if(mode=='1')\n i++;\n else\n {\n printf(\"NO\");\n break;\n }\n }\n if(arr[i]=='\\0')\n printf(\"YES\");\n }\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n char w1[100],w2[100],w3[100],t;\n scanf(\"%s %s %s\",w1,w2,w3);\n int i,j,p=0;\n strcat(w1,w2);\n int l=strlen(w3);\n for(i=0;iw1[i+1])\n {\n w1[i+1]=t;\n w1[i]=w1[i+1];\n w1[i]=t;\n }\n }\n }\n for(i=0;iw3[i+1])\n {\n w3[i+1]=t;\n w3[i]=w3[i+1];\n w3[i]=t;\n }\n }\n }\n for(i=0;i\n#include\n#include\nint main()\n{\n char a[50],b[50],c[100],d[100];\n int i,j,k=1,n1,n2,n3;\n gets(a);\n gets(b);\n gets(c);\n strcat(a,b);\n n1=strlen(a);\n n3=strlen(c);\n if(n1!=n3)\n {\n k=0;\n\n }\n else\n {\n for(i=0;i\n#include\nint main(){\n char str[101],nstr[101],anstr[201];\n char alpha[26]={-1},nalpha[26]={-1};\n int no1[26]={0},no2[26]={0};\n scanf(\"%s\",str);\n scanf(\"%s\",nstr);\n scanf(\"%s\",anstr);\n for(int i=0;str[i]!='\\0';i++){\n if(alpha[str[i]%65] == str[i]){\n no1[str[i]%65]++;\n }\n alpha[str[i]%65] = str[i];\n }\n for(int i=0;nstr[i]!='\\0';i++){\n if(alpha[nstr[i]%65] == nstr[i]){\n no1[nstr[i]%65]++;\n }\n alpha[nstr[i]%65] = nstr[i];\n }\n for(int i=0;anstr[i]!='\\0';i++){\n if(nalpha[nstr[i]%65] == anstr[i]){\n no2[anstr[i]%65]++;\n }\n nalpha[nstr[i]%65] = anstr[i];\n }\n for(int i=0;i<26;i++){\n if((alpha[i] != nalpha[i])&&(no1[i]!=no2[i])){\n printf(\"NO\");\n exit(0);\n }\n }\n printf(\"YES\");\n \n \n \n}"}, {"source_code": "#include \n\nint main(){\nchar anfitrion[120];\nchar invitado[120];\nchar broma[150];\nchar aver[300];\n\n\nint tam=0,tam1=0,tam2=0,total=0;\nint x,b,v,c,l=0;\nint pos=0,aux,p=0,r;\n\n\ngets(anfitrion); tam=strlen(anfitrion);\ngets(invitado); tam1=strlen(invitado);\ngets(broma); tam2=strlen(broma);\n\ntotal=tam+tam1;\n\n\nif(total==tam2){\n\nfor(x=0;x=tam){aver[x]=invitado[l];l++;} }\n}\n\n\n\nfor(x=0;x0) && (aux0) && (aux\n#include \n#define Nbelem 1000\nint main(void) {\n int i=0,j=0;\n\n char phr[Nbelem],phr1[Nbelem],phr2[Nbelem],*p;\n gets(phr1);\n gets(phr2);\n gets(phr);\n while(phr&&phr1[i]!='\\0')\n {\n char *p = strchr(phr,phr1[i]);\n if(p)\n *p = '*';\n else {printf(\"NO\"); return(0);}\n i++;\n }\n printf(\"%s\\n\",phr);\n while(phr&&phr2[j]!='\\0')\n {\n char *p =strchr(phr,phr2[j]);\n if(p)\n *p = '*';\n else {printf(\"NO\"); return(0);}\n j++;\n }\n printf(\"%s\\n\",phr);\n i=0;\n while(phr[i]!='\\0'&&phr[i]=='*') i++;\n\n if(phr[i]=='\\0')\n printf(\"YES\");\n else\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main ()\n{\n\n char a[110],b[110],c[220];\n int d[110],e[110],f[220];\n int x,h,g=0;\n int tam,tam1,tam2;\n int i=0,o=0,p=0,k;\n\n scanf(\"%s\",&a);\n scanf(\"%s\",&b);\n scanf(\"%s\",&c);\n\n tam=strlen(a);\n tam1=strlen(b);\n tam2=strlen(c);\n\n\n\n h=tam+tam1;\n\n if(h==tam2){\n\n\n for(x=0;x\n#include \n\nint main()\n{\n long long int i,j,k,l;\n char arr[10000],arr2[1000],arr3[10000];\n gets(arr);\n gets(arr2);\n\n strcat(arr,arr2);\n\n int len=strlen(arr);\n\n gets(arr3);\n\n int len2=strlen(arr3);\n\n long long temp=0,temp2=0;\n\n for(i=0 ,j=0; i\n#include\nint main(){\n int x,y,z,i,k=0,l=0,p;\nchar a[1000],b[1000],c[1000];\nscanf(\"%s\",a);\nscanf(\"%s\",b);\nscanf(\"%s\",c);\nx=strlen(a),y=strlen(b),z=strlen(c);\nfor(i=0;i\n#include \n#include \nint main()\n{\n int f[1000],n[1000],i,j,a,flag=0,l;\n for(i=0;i<500;i++)\n {\n f[i]=0;\n n[i]=0;\n }\n for(i=0;i<3;i++)\n {\n char str[1000];\n scanf(\"%s\",str);\n l=strlen(str);\n printf(\"\\n%d \",l);\n for(j=0;j\n#include \n#include \n\nint main(){\n\tchar host[101], guest[101], hostx[101], guestx[101], pile[202];\n\tint i=0, j=0, check=0, aux=0, aux2=0;\n\tint size;\n\t\n\tscanf(\"%s\", &host);\n\tsize = strlen(host);\n\thostx[size]='\\0';\n\t\n\tscanf(\"%s\", &guest);\n\tsize = strlen(guest);\n\tguestx[size]='\\0';\n\t\n\tscanf(\"%s\", &pile);\n\t\n\twhile(pile[i]!='\\0'){\n\t\twhile(guest[j]!='\\0'){\n\t\t\tif(guest[j]==pile[i]){\n\t\t\t\tif(pile[i]!=guestx[j]){\n\t\t\t\t\tguestx[j]=guest[j];\n\t\t\t\t\tcheck=1;\n\t\t\t\t\taux=0;\n\t\t\t\t\taux2=0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\taux=1;\n\t\t\t}\n\t\t\telse\n\t\t\t\taux2=1;\n\t\t\tj++;\n\t\t}\n\t\t\n\t\t\n\t\tj=0;\n\t\twhile(host[j]!='\\0' && check!=1){\n\t\t\tif(host[j]==pile[i]){\n\t\t\t\tif(pile[i]!=hostx[j]){\n\t\t\t\t\thostx[j]=host[j];\n\t\t\t\t\tcheck=1;\n\t\t\t\t\taux=0;\n\t\t\t\t\taux2=0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\taux=1;\n\t\t\t}\n\t\t\telse\n\t\t\t\taux2=1;\n\t\t\tj++;\n\t\t}\n\t\t\n\t\tif(aux==1 || aux2==1)\n\t\t\tbreak;\n\t\t\n\t\tj=0;\n\t\taux=0;\n\t\tcheck=0;\n\t\ti++;\n\t}\n\t\n\t\n\tif(!(strcmp(guest, guestx)) && !(strcmp(host, hostx)) &&aux2==0)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\t\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \nconst int M = 101;\nint main() {\n int i;\n char s[M],t[M],k[M],a[26];\n for(i=0;i<26;i++)\n a[i]=0;\n \n scanf(\"%100s\\n%100s\\n%100s\",s,t,k); \n for (i=0;i\n#include \n#include \nint main()\n{\n int f[1000],n[1000],i,j,a,flag=0,l;\n for(i=0;i<500;i++)\n {\n f[i]=0;\n n[i]=0;\n }\n for(i=0;i<3;i++)\n {\n char str[1000];\n scanf(\"%s\",str);\n l=strlen(str);\n printf(\"\\n%d \",l);\n for(j=0;j\n#include\n#include\n\nint main()\n{\n int i,j,k,n=0,m=0;\n\n char a[102];\n char b[102];\n char c[102];\n gets(a);gets(b);gets(c);\n\n if(strlen(a) + strlen(b) != strlen(c)) printf(\"NO\");\n\n else {\n for(i=0;i\n#include\nint main(){\n int i,j,e=0,x,y,z;\n char a[101],b[101],c[202],d[202];\n scanf(\"%s%s%s\",a,b,c);\n \n \n \n for(i=0;i\n#include \n\n#define N 100\n\nint main() {\n\tstatic char aa[N + 1], bb[N + 1], cc[N + 1], kk[27];\n\tint a, b, c, i;\n\n\tscanf(\"%s%s%s\", aa, bb, cc);\n\ta = strlen(aa), b = strlen(bb), c = strlen(cc);\n\tfor (i = 0; i < c; i++)\n\t\tkk[cc[i] - 'a']++;\n\tfor (i = 0; i < a; i++) {\n\t\tif (kk[aa[i] - 'a'] < 1) {\n\t\t\tprintf(\"NO\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\tkk[aa[i] - 'a']--;\n\t}\n\tfor (i = 0; i < b; i++) {\n\t\tif (kk[bb[i] - 'a'] < 1) {\n\t\t\tprintf(\"NO\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\tkk[bb[i] - 'a']--;\n\t}\n\tfor (i = 0; i < c; i++)\n\t\tif (kk[cc[i] - 'a'] > 0) {\n\t\t\tprintf(\"NO\\n\");\n\t\t\treturn 0;\n\t\t}\n\tprintf(\"YES\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main()\n{\n char a[101], b[101], s[202];\n int i, j, count=0;\n scanf(\"%s\", a);\n scanf(\"%s\", b);\n scanf(\"%s\", s);\n\n if(strlen(a)+strlen(b)!=strlen(s))\n printf(\"NO\\n\");\n else\n {\n i=0;\n while(a[i]!='\\0')\n {\n j=0;\n while(s[j]!='\\0')\n {\n if(a[i]==s[j])\n {\n count++;\n break;\n }\n j++;\n }\n i++;\n }\n i=0;\n while(a[i]!='\\0')\n {\n j=0;\n while(s[j]!='\\0')\n {\n if(b[i]==s[j])\n {\n count++;\n break;\n }\n j++;\n }\n i++;\n }\n if(count==strlen(s))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int i,j,k,count=0,count1=0,x;\n char a[100],b[]=\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\",c[100],d[100];\n scanf(\"%s\",a);\n scanf(\"%s\",c);\n scanf(\"%s\",d);\n strcat(a,c);\n for(i=0;i\nint main()\n{\n char str1[105],str2[105];\n int i,j,temp=0,n,l,count=0;\n scanf(\"%s%s\",&str1,&str2);\n char str3[220];\n scanf(\"%s\",&str3);\n\n\n strcat(str1,str2);\n n=strlen(str1);\n l=strlen(str3);\n\n\n\n for(i=0; i<=n; i++)\n {\n for(j=i+1; j<=n; j++)\n {\n if(str1[i]>str1[j])\n {\n temp=str1[i];\n str1[i]=str1[j];\n str1[j]=temp;\n }\n }\n\n\n\n }\n\n for(i=0; i<=l; i++)\n {\n for(j=i+1; j<=l; j++)\n {\n if(str3[i]>str3[j])\n {\n temp=str3[i];\n str3[i]=str3[j];\n str3[j]=temp;\n }\n }\n\n\n\n\n }\n j=0;\n for(i=0; i<=n; i++)\n {\n if(str1[i]==str3[j])\n {\n count++;\n j++;\n\n }\n\n }\n\n if(count-1==n)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n\n}"}, {"source_code": "#include \n#include \n#include \n\nint cmpfn(const void *a, const void *b) {\n return (*(char*)a - *(char*)b);\n}\n\nvoid can_make(void) {\n char a[201];\n char c[101];\n int newline = 0;\n int i = 0;\n while(newline < 2) {\n char c;\n scanf(\"%c\", &c);\n if (c == '\\n') {\n newline++;\n scanf(\"\\n\");\n } else {\n a[i] = c;\n i++;\n }\n }\n a[i+1] = '\\0';\n scanf(\"%s\", c);\n qsort(a,strlen(a),sizeof(char),cmpfn);\n qsort(c,strlen(c),sizeof(char),cmpfn);\n if (!strcmp(a,c)) {\n printf(\"YES\\n\");\n } else {\n printf(\"NO\\n\");\n }\n}\n\nint main(void) {\n can_make();\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n char str1[1000],str2[1000],str3[1000],flag=0,blag=0;\n int i,j,count=0;\n gets(str1);\n gets(str2);\n gets(str3);\n\n for(i=0;str1[i];i++){\n\n for(j=0;str3[j];j++){\n\n if(str1[i]==str3[j]){\n count++;\n str3[j]='*';\n }\n }\n }\n if(count=strlen(str1)){\n flag=1;\n }\n else {\n printf(\"NO\");\n return 0;\n }\n count=0;\n for(i=0;str2[i];i++){\n\n for(j=0;str3[j];j++){\n\n if(str2[i]==str3[j]){\n count++;\n str3[j]='*';\n }\n }\n }\n if(count==strlen(str2))\n {\n blag=1;\n }\n else {\n printf(\"NO\");\n return 0;\n }\n\n if(flag==1 && blag==1){\n printf(\"YES\");\n }\n\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n char a[101],b[101],c[101];\n scanf(\"%s%s%s\",&a,&b,&c);\n if(strlen(a)+strlen(b)==strlen(c))\n {\n int i,j=0;\n char arr[strlen(c)];\n strcat(arr,a);\n strcat(arr,b);\n for(i=0;i\n#include \n#include \n\nint sortStr(char str[])\n{\n int i,j,sizeStr=strlen(str);\n char temp;\n for(i=0;i<=sizeStr-1;i++)\n for(j=1;j<=sizeStr-i-1;j++)\n if (tolower(str[j])\nint main()\n{\n int i=0,j=0,k=0,h;\n char a[100],b[100],c[100],d[200];\n scanf(\"%s\",a);\n scanf(\"%s\",b);\n scanf(\"%s\",c);\n while(a[i]!='\\0')\n i++;\n while(b[j]!='\\0')\n j++;\n while(c[k]!='\\0')\n k++;\n for(h=0;h=k)\n printf(\"NO\");\n else\n {\n for(i=0;i\n\nmain()\n{\n char a[100],b[100],c[100];\n int i,j,x,y,z,k;\n scanf(\"%s %s %s\",a,c,b);\n x=strlen(b);\n y=strlen(a);\n z=strlen(c);\n k=x;\n \n\n for(i=0;i\n#include\nint main()\n{\n int i,j=0,n,m,l,d[26],f[26];\n char a[51],b[51],c[102];\n scanf(\"%s %s %s\",a,b,c);\n n=strlen(a);\n m=strlen(b);\n l=strlen(c);\n if((n+m)!=l)\n {\n printf(\"NO\");\n }\n else\n {\n for(i=0; i<26; i++)\n {\n d[i]=0;\n f[i]=0;\n }\n for(i=0; i\n#include\n#include\n\n\nint main()\n{\n char a[100], b[100], all[100];\n gets(a);\n gets(b);\n gets(all);\n if (strlen(a) + strlen(b) != strlen(all))\n {\n printf(\"NO\\n\"); return 0;\n }\n\n int i,j;\n for (i = 0; i < strlen(a); i++)\n {\n for (j = 0; j < strlen(all); j++)\n {\n if (a[i] == all[j])\n {\n all[j] = '*';\n break;\n }\n }\n }\n\n for (i = 0; i <= strlen(b); i++)\n {\n for (j = 0; j <= strlen(all); j++)\n {\n if (b[i] == all[j])\n {\n all[j] = '*';\n break;\n }\n }\n }\n\n for (i = 0; i <= strlen(all); i++)\n {\n if (all[i] != '*')\n {\n printf(\"NO\\n\"); return 0;\n }\n }\n printf(\"YES\\n\");\n\n return 0;\n\n}"}, {"source_code": "#include\n#include\nint main()\n{\n char str1[1000],str2[1000],str3[1000],flag=0,blag=0;\n int i,j,count=0;\n gets(str1);\n gets(str2);\n gets(str3);\n\n for(i=0;str1[i];i++){\n\n for(j=0;str3[j];j++){\n\n if(str1[i]==str3[j]){\n count++;\n str1[i]='^';\n str3[j]='*';\n }\n }\n }\n if(count==strlen(str1)){\n flag=1;\n }\n else {\n puts(str3);\n printf(\"%d\\n\",count);\n printf(\"NO\");\n return 0;\n }\n count=0;\n for(i=0;str2[i];i++){\n\n for(j=0;str3[j];j++){\n\n if(str2[i]==str3[j]){\n count++;\n str2[i]='^';\n str3[j]='*';\n }\n }\n }\n if(count==strlen(str2))\n {\n blag=1;\n }\n else {\n printf(\"NO\");\n return 0;\n }\n\n if(flag==1 && blag==1){\n printf(\"YES\");\n }\n\n}\n"}, {"source_code": "#include \n#include \n#include \nint main()\n{\n int f[1000],n[1000],i,j,a,flag=0,l;\n for(i=0;i<500;i++)\n {\n f[i]=0;\n n[i]=0;\n }\n for(i=0;i<3;i++)\n {\n char str[1000];\n scanf(\"%s\",str);\n l=strlen(str);\n printf(\"\\n%d \",l);\n for(j=0;j\n#include \n\nint main()\n{\n char name[101], host[101], ltr[101];\n int i, j, k;\n scanf(\"%s %s %s\",name,host,ltr);\n for(i=0;i\n\nint main(void) {\n char *p = 0;\n char n1[101] = {0, }, n2[101] = {0, };\n char s[101] = {0, };\n int cnt[26] = {0, };\n \n scanf(\"%s\", n1);\n scanf(\"%s\", n2);\n scanf(\"%s\", s);\n \n p = n1;\n while (*p) {\n cnt[*p - 'A']++;\n p++;\n }\n \n p = n2;\n while (*p) {\n cnt[*p - 'A']++;\n p++;\n }\n \n p = s;\n while (*p) {\n if (cnt[*p - 'A'] == 0) {\n break;\n } else {\n cnt[*p - 'A']--;\n }\n \n p++;\n }\n \n if (*p) {\n printf(\"NO\\n\");\n } else {\n printf(\"YES\\n\");\n }\n\n return 0;\n}"}, {"source_code": "#include\n#include\n\nint main(){\n\nint i,j,k,l,swap,a=0,swapa;\nchar str1[101],str2[101],arr[201],are[201],temp,tempa;\n\n\ngets(str1);\ngets(str2);\ngets(are);\n\nfor(i=0;i<101;i++){\n\n if(str1[i] == 0)\n break;\n\n arr[i] = str1[i];\n\n }\n\nk=i;\n\nfor(j=0;j<101;j++){\n\n if(str2[j] == 0)\n break;\n\n\n while(1){\n\n arr[k] = str2[j];\n k++;\n break;\n }\n\n}\n\n\nwhile(1){\n\n swap = 0;\n for(i=0;i arr[i+1]){\n\n temp = arr[i];\n arr[i] = arr[i+1];\n arr[i+1] = temp;\n swap = 1;\n\n\n }\n\n}\nif(swap == 0)\n break;\n\n}\n\n\nfor(l = 0;l<201;l++){\n if(are[l] == 0)\n break;\n\n}\n\n\nif(l!=k){\n printf(\"NO\");\n return 0;;\n}\n\nwhile(1){\n\n swapa = 0;\n\nfor(i=0;i are[i+1]){\n\n tempa = are[i];\n are[i] = are[i+1];\n are[i+1] = tempa;\n swapa = 1;\n\n\n }\n\n}\nif(swapa == 0)\n break;\n\n}\n\na = strncmp(are,arr,k);\n\n\nputs(arr);\nputs(are);\n\nif(a == 0)\n printf(\"YES\");\n\nelse\n printf(\"NO\");\n\n\n\nreturn 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n char a[1000],b[1000],c[1000];\n gets(a);\n gets(b);\n gets(c);\n strcat(a,b);\n int i,j,len,len2,flag=0;\n char temp;\n len=strlen(a);\n for(i=0;i=a[j+1]){\n temp=a[j];\n a[j]=a[j+1];\n a[j+1]=temp;\n }\n }\n }\n //printf(\"%s\\n\",a);\n for(i=0;i=c[j+1]){\n temp=c[j];\n c[j]=c[j+1];\n c[j+1]=temp;\n }\n }\n }\n len2=strlen(c);\n //printf(\"%s\\n\",c);\n for(i=0;i\n#include\n#include\nint isin(char alpha, char *s);\n\nint main()\n{\nchar str1[100];\nchar str2[100];\nchar str3[100];\n\nscanf(\"%s\", str1);\nscanf(\"%s\", str2);\nscanf(\"%s\", str3);\n\nint pos;\nint l1 = strlen(str1);\nint l2 = strlen(str2);\nint l3 = strlen(str3);\n\nif(l3 != (l1 + l2))\n{\n printf(\"NO\");\n}\nelse\n{\n\n for(int i = 0; i\n#include\n#include\n#include\n#include\n#define MAX 1000\n\nint main()\n{\n char stringA[MAX],stringB[MAX],stringC[MAX],stringD[MAX],t;\n int a,b,c,i,j,brojac=0;\n gets(stringA);\n gets(stringB);\n gets(stringC);\n a=strlen(stringA);\n b=strlen(stringB);\n c=strlen(stringC);\n strcat(stringA,stringB);\n for(i=0; istringA[j])\n {\n t=stringA[i];\n stringA[i]=stringA[j];\n stringA[j]=t;\n }\n }\n }\n for(i=0; istringC[j])\n {\n t=stringC[i];\n stringC[i]=stringC[j];\n stringC[j]=t;\n }\n }\n }\n for(i=0; i\n#include\nint main(){\n int i,j,e=0,x,y,z;\n char a[101],b[101],c[202],d[202];\n scanf(\"%s%s%s\",a,b,c);\n \n \n \n for(i=0;i\n#include \n#include \n\nint main()\n{\n char k[200],l[200],m[200],t;\n int c=1,i,j,y,sm;\n scanf(\"%s %s %s\",&k,&l,&m);\n sm=strlen(m);\n for(i=0;i\n#include\nint main()\n{\n\tchar a[101], b[101], c[101], d[1001];\n\tint i, j, l = 0;\n\tgets(a);\n\tgets(b);\n\tgets(c);\n\tfor (i = 0; i < strlen(a); i++)\n\t\tfor (j = 0; j < strlen(c); j++)\n\t\t\tif (a[i] == c[j])\n\t\t\t{\n\t\t\t\tc[j] = '.';\n\t\t\t\tl++;\n\t\t\t\tbreak;\n\t\t\t}\n\tfor (i = 0; i < strlen(b); i++)\n\t\tfor (j = 0; j < strlen(c); j++)\n\t\t\tif (b[i] == c[j])\n\t\t\t{\n\t\t\t\tc[j] = '*';\n\t\t\t\tl++;\n\t\t\t\tbreak;\n\t\t\t}\n\tif (l == strlen(c))\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n char l1[101], l2[101], l3[101], l12[202];\n int i = -1,j = -1, t1[26], t2[26];\n scanf(\"%s\", l1);\n scanf(\"%s\", l2);\n scanf(\"%s\", l3);\n \n while (i < 26)\n {\n t1[i] = 0;\n t2[i] = 0;\n i++;\n }\n i = 0;\n while (l1[i])\n {\n t1[l1[i] - 'A'] += 1;\n i++;\n }\n i = 0;\n while (l2[i])\n {\n t1[l2[i] - 'A'] += 1;\n i++;\n }\n i = 0;\n while (l3[i])\n {\n t2[l3[i] - 'A'] += 1;\n i++;\n }\n i = 0;\n while (i < 26)\n {\n if (t1[i] != t2[i])\n {\n printf(\"NO\");\n return 0;\n }\n i++;\n }\n printf(\"YES\");\n return (0);\n}"}, {"source_code": "#include \n#include \n#include \n\nint main(){\n\tchar host[101], guest[101], pile[202], final[202];\n\tint i, j, check=0;\n\tint hostl, guestl, pilel;\n\t\n\tscanf(\"%s\", &host);\n\tscanf(\"%s\", &guest);\n\tscanf(\"%s\", &pile);\n\t\n\thostl = strlen(host);\n\tguestl = strlen(guest);\n\tpilel = strlen(pile);\n\t\n\tfor(i=0;i\n#include\n \nint main()\n{\n char str1[101];\n char str2[101];\n char str[202];\n \n scanf(\"%s %s %s\",str1,str2,str);\n \n if(strlen(str1)+strlen(str2) != strlen(str))\n {\n printf(\"lengthNO\");\n return(0);\n }\n \n int i,j,found;\n \n for(i=0;i\n#include \n#include\nvoid sorting (char a[])\n{\n char c;\n int i,j;\n for(j=0;ja[i+1])\n {\n c=a[i];\n a[i]=a[i+1];\n a[i+1]=c;\n }\n }\n }\n}\n\nint main()\n{\n int i,j=0;\n char a[100],b[100],c[200],d[200];\n gets(a);\n gets(b);\n gets(c);\n //if(strlen(a)+strlen(b)!=strlen(c)){ printf(\"NO\"); }\n\n for(i=0;i\n#include\n\nint main()\n\n{\n char fawra[102], dewra[102] , jabra[204] , e1[]=\"SANTACLAUS\",e2[]=\"DEDMOROZ\",e3[]=\"SANTAMOROZDEDCLAUS\" ;\n int bakso[26];\n\n int i , hisab ;\n\n scanf(\"%s\",fawra);\n scanf(\"%s\",dewra);\n scanf(\"%s\",jabra);\n \n if( strcmp(fawra,e1)==0 && strcmp(dewra,e2)==0 && strcmp(jabra,e3)==0 )\n {\n printf(\"YES\");\n }\n \n else\n {\n i = 0;\n while(i<26)\n {\n bakso[i]=0;\n i++;\n }\n\n i = 0;\n\n while( i\n#include\n#include\n#include\n\nint main()\n{\nint i,j,k,s[26],t[101],n=0;\n char s1[101],s2[101],s3[101],s4[101];\n scanf(\"%s\",s1);\n scanf(\"%s\",s2);\n scanf(\"%s\",s3);\n int n3=strlen(s3);\n int n1=strlen(s1);\n int n2=strlen(s2);\n if(n1+n2>n3 || n1+n2\nint main(){\n char a[101],b[101],c[202];\n int d[26]={0},e[26]={0};\n scanf(\"%s\\n%s\\n%s\",a,b,c);\n for(int i=0;i<101;i++)d[a[i]-'a']++;\n for(int i=0;i<101;i++)d[b[i]-'a']++;\n for(int i=0;i<202;i++)e[c[i]-'a']++;\n for(int i=0;i<26;i++){\n if(d[i]\nint main()\n{\n int n,a1=0,a2=0,a3=0,a4=0,sum=0,i;\n scanf(\"%d\",&n);\n char a[n];\n scanf(\"%s\",a);\n for(i=0;i=a2) sum=sum+a2;\n else sum=sum+a1;\n if(a3>=a4) sum=sum+a4;\n else sum=sum+a3;\n printf(\"%d\",sum*2);\n}\n"}, {"source_code": "#include \n#define min(a,b) a>=b ? b : a\nint main()\n{\n\tint n,i,L=0,R=0,U=0,D=0;\n\tchar move[101];\n\tint count1=0,count2=0;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i0 && R>0)\n\t{\n\t\tcount1 = min(L,R);\n\t}\n\tif(U>0 && D>0)\n\t{\n\t\tcount2 = min(U,D);\n\t}\n\t//printf(\"1.%d 2.%d\\n\",count1,count2);\n\tprintf(\"%d\\n\",2*(count1+count2));\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main(){\n\tint i,n;\n\tchar OP;\n\tint result = 0;\n\tint L=0,R=0,D=0,U=0;\n\n\tscanf(\" %d\",&n);\n\n\tfor(i=0;i R) \n\t\tresult += (R*2);\n\telse\n\t\tresult += (L*2);\n\n\tif(U > D) \n\t\tresult += (D*2);\n\telse\n\t\tresult += (U*2);\n\n\tprintf(\"%d\\n\", result);\n\n\treturn 0;\n}\n/* 1512828846855 */\n"}, {"source_code": "#include \n\nint main(void)\n{\n int n;\n scanf(\"%d\", &n);\n int o[4] = {};\n char c;\n \n while (scanf(\"%c\", &c) != EOF) {\n switch (c) {\n case 'L' : o[0]++; break;\n case 'R' : o[1]++; break;\n case 'U' : o[2]++; break;\n case 'D' : o[3]++; break;\n }\n }\n int minw = (o[0] > o[1]) ? o[1] : o[0];\n int minh = (o[2] > o[3]) ? o[3] : o[2];\n\n printf(\"%d\\n\", minw * 2 + minh * 2);\n\n return 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n\n int n, i, dx=0,dy=0;\n\n char str[105];\n\n scanf(\"%d\",&n);\n scanf(\"%s\",str);\n\n for(i=0; i\nint min(int a, int b) {\n\tif (a>b) return b;\n\telse return a;\n}\nint main() {\n\tint n;\n\tscanf(\"%d\", &n);\n\tchar s[n+1];\n\tint l=0, r=0, u=0, d=0;\n\tscanf(\"%s\", s);\n\tfor (int i=0;s[i]!='\\0';i++) {\n\t\tif (s[i]=='L') l++;\n\t\tif (s[i]=='R') r++;\n\t\tif (s[i]=='U') u++;\n\t\tif (s[i]=='D') d++;\n\t}\n\tprintf(\"%d\\n\", min(l, r)*2+min(u, d)*2);\n}\n"}, {"source_code": "/*\n ============================================================================\n Name : puggy.c\n Author : Hossam Tourki\n Version :\n Copyright : Your copyright notice\n Description : Hello World in C, Ansi-style\n ============================================================================\n */\n\n#include \n#include \n\nint main(void) {\n\tint n;\n\tscanf(\"%d \",&n);\n\tchar commands[100];\n\tgets(commands);\n\tint i,U=0,D=0,L=0,R=0,m=0;\n\tfor(i=0;i\n\nint main()\n{\n int n, i; scanf(\"%d\", &n);\n int ud[2] = {0}, lr[2] = {0};\n char com[101]; scanf(\"%s\", com);\n\n for(i = 0; i < n; i++)\n {\n if(com[i] == 'U') ud[0]++;\n if(com[i] == 'D') ud[1]++;\n if(com[i] == 'L') lr[0]++;\n if(com[i] == 'R') lr[1]++;\n }\n\n int ans = 0;\n ans += 2*(ud[0]\n#include \n\nint main(void) {\n\tint n;\n\tscanf(\"%d \",&n);\n\tchar commands[100];\n\tgets(commands);\n\tint i,U=0,D=0,L=0,R=0,m=0;\n\tfor(i=0;i\n#include \n#include \n\n#define M 101\n//#define N 26\n#define MAX(a, b) (((a)>(b))?(a):(b))\n#define MIN(a, b) (((a)>(b))?(b):(a))\n\nint a[4];\nint main() {\n int n;\n char s[M];\n scanf(\"%d%s\", &n, s);\n for (int i = 0; i < n; ++i) {\n switch(s[i]) {\n case 'L' : a[0]++; break;\n case 'R' : a[1]++; break;\n case 'U' : a[2]++; break;\n case 'D' : a[3]++; break;\n }\n }\n printf(\"%d\\n\", (MIN(a[0], a[1]) + MIN(a[2], a[3])) *2);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n\n\tint n,i;\n\tint lcount=0,rcount=0,dcount=0,ucount=0,count=0;\n\n\tchar a[105];\n\n\tscanf(\"%d\",&n);\n\tscanf(\"%s\",a);\n\n\tfor(i=0;i=rcount)\n\t\t\tcount = count + 2 * rcount;\n\t\t\n\n\t\tif(dcount=ucount)\n\t\t\tcount=count + 2 * ucount;\n\t\t \n\t\n\n\tprintf(\"%d\",count);\n\n\treturn 0;\n}\n\n"}, {"source_code": "#include\n#include\nint main(){\n\tint n,i,a=0,b=0,c=0,d=0,sum=0;\n\tchar s[110];\n\tscanf(\"%d%s\",&n,&s);\n\tfor(i=0;ib) sum+=2*b;\n\telse sum+=2*a;\n\tif(c>d) sum+=2*d;\n\telse sum+=2*c;\n\tprintf(\"%d\\n\",sum);\n\treturn 0;\n}\n\t\n\t"}, {"source_code": "#include \n#include \n#include \n#include \n\nint main() {\n int n, u, d, l, r, resp, j;\n resp = u = d = l = r;\n scanf(\"%d\\n\", &n);\n char c;\n for(j = 0; j < n; j++) {\n scanf(\"%c\", &c);\n switch(c) {\n case 'U' : u++; break;\n case 'D' : d++; break;\n case 'L' : l++; break;\n case 'R' : r++; break;\n }\n if((u > 0) && (d > 0)) {\n resp+=2;\n u--;\n d--;\n }\n if((l > 0) && (r > 0)) {\n resp+=2;\n l--;\n r--;\n }\n }\n printf(\"%d\", resp);\n\treturn 0;\n}\n/* 1512824806805 */\n"}, {"source_code": "#include\nint main()\n{\n int n,i=0,num=0,cum=0,sum=0,pum=0,a=0;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"%s\",&s);\n while(s[i]!=0)\n {\n if(s[i]=='L')\n {\n num=num+1;\n }\n else if(s[i]=='R')\n {\n cum=cum+1;\n }\n else if(s[i]=='U')\n {\n pum=pum+1;\n }\n else if(s[i]=='D')\n {\n sum=sum+1;\n }\n i=i+1;\n }\n if(num>=cum)\n {\n a=a+cum+cum;\n }\n else\n {\n a=a+num+num;\n }\n if(pum>=sum)\n {\n a=a+sum+sum;\n }\n else\n {\n a=a+pum+pum;\n }\n printf(\"%d\",a);\n}"}, {"source_code": "#include \n\nint main()\n{\n\tint c,aux=0,i,l=0,d=0,u=0,r=0;\n\tscanf(\"%d\",&c);\n\tchar s[c];\n\tscanf(\" %s\",s);\n\tfor(i=0;i\n#include \n#include \n\n#define M 101\n//#define N 26\n#define MAX(a, b) (((a)>(b))?(a):(b))\n#define MIN(a, b) (((a)>(b))?(b):(a))\n\nint a[4];\nint main() {\n int n;\n char s[M];\n scanf(\"%d%s\", &n, s);\n for (int i = 0; i < n; ++i) {\n switch(s[i]) {\n case 'L' : a[0]++; break;\n case 'R' : a[1]++; break;\n case 'U' : a[2]++; break;\n case 'D' : a[3]++; break;\n }\n }\n printf(\"%d\\n\", (MIN(a[0], a[1]) + MIN(a[2], a[3])) *2);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n;\n scanf(\"%d\\n\",&n);\n char a[n];\n gets(a);\n int i,dx=0,dy=0;\n for(i=0;i\n#include \nint main()\n{\n unsigned u,d,r,l,i,n,ud,lr;\n char *s;\n\n scanf(\"%u\",&n);\n s=(char *)malloc(n+1);\n scanf(\"%s\",s);\n for(i=0,r=0,l=0,d=0,u=0;i\n#include \n\nint main(void) {\n\tint n;\n\tscanf(\"%d \",&n);\n\tchar commands[100];\n\tgets(commands);\n\tint i,U=0,D=0,L=0,R=0,m=0;\n\tfor(i=0;i\n#include \n\n\nint main() {\n int n;\n scanf(\"%d\", &n);\n int ct;\n int right, left, up, down;\n right = left = up = down = 0;\n for (ct = 0; ct <= n; ct++) {\n char temp;\n scanf(\"%c\", &temp);\n if(temp == 'U'){\n up++;\n }\n if(temp == 'L'){\n left++;\n }\n if(temp == 'R'){\n right++;\n }\n if(temp == 'D'){\n down++;\n }\n }\n\n int minx, miny;\n if(right == left){\n minx = right;\n }else{\n minx = (right < left) ? right : left;\n }\n if(up == down){\n miny = up ;\n }else {\n miny = (up < down) ? up : down;\n }\n printf(\"%d\", 2 * (minx + miny));\n\n}"}, {"source_code": "#include \n\n#define MAX_COMMANDS \t100\n#define ABS(x) \t\t\t((x < 0) ? (-x) : (x))\n\nint\t\tmain(void)\n{\n\tchar commands[MAX_COMMANDS + 1];\n\tint num_commands;\n\tint lr_dist;\n\tint ud_dist;\n\n\tcommands[MAX_COMMANDS] = '\\0';\n\n\tscanf(\"%d\\n\", &num_commands);\n\tfor (int i = 0; i < num_commands; i++)\n\t\tscanf(\"%c\", &commands[i]);\n\n\tlr_dist = 0;\n\tud_dist = 0;\n\tfor (int i = 0; i < num_commands; i++)\n\t{\n\t\tif (commands[i] == 'L')\n\t\t\tlr_dist--;\n\t\telse if (commands[i] == 'R')\n\t\t\tlr_dist++;\n\t\telse if (commands[i] == 'U')\n\t\t\tud_dist++;\n\t\telse if (commands[i] == 'D')\n\t\t\tud_dist--;\n\t}\n\tprintf(\"%d\\n\", num_commands - ABS(lr_dist) - ABS(ud_dist));\n\treturn (0);\n}"}, {"source_code": "#include \n\nint main()\n{\n int n, i; scanf(\"%d\", &n);\n int ud[2] = {0}, lr[2] = {0};\n char com[101]; scanf(\"%s\", com);\n\n for(i = 0; i < n; i++)\n {\n if(com[i] == 'U') ud[0]++;\n if(com[i] == 'D') ud[1]++;\n if(com[i] == 'L') lr[0]++;\n if(com[i] == 'R') lr[1]++;\n }\n\n int ans = 0;\n ans += 2*(ud[0]\nint min(int a,int b)\n{\n\tif(a>b) return b;\n\telse return a;\n}\nint main(){\n\tint i,n,ans;\n\tchar s[100];\n\tint a[4]={0};\n\tscanf(\"%d%s\",&n,s);\n\tfor(i=0;i\n\nint double_of_min(int a, int b)\n{\n\tint aux;\n\tif(a < b)\n\t{\n\t\taux = a;\n\t\ta = b;\n\t\tb = aux;\n\t}\n\treturn 2*b;\n}\n\nint main()\n{\n\tint n, i;\n\tint u, d, l, r;\n\t\n\tscanf(\"%d\", &n);\n\tgetchar();\n\t\n\tu = 0;\n\td = 0;\n\tl = 0;\n\tr = 0;\n\t\n\tchar commands[n];\n\t\n\tfor(i = 0; i < n; ++i)\n\t{\n\t\tscanf(\"%c\", &commands[i]);\n\t}\n\t\n\tfor(i = 0; i < n; ++i)\n\t{\n\t\tif(commands[i] == 'U') u++;\n\t\tif(commands[i] == 'D') d++;\n\t\tif(commands[i] == 'L') l++;\n\t\tif(commands[i] == 'R') r++;\t\t\n\t}\n\t\n\tprintf(\"%d\\n\", double_of_min(u, d) + double_of_min(l, r));\t\n\t//printf(\"%s\", commands);\n\treturn 0;\n}\n/* 1512874373797 */\n"}, {"source_code": "#include \n#include \n#include \n\n#define M 101\n//#define N 26\n#define MAX(a, b) (((a)>(b))?(a):(b))\n#define MIN(a, b) (((a)>(b))?(b):(a))\n\nint a[4];\nint main() {\n int n;\n char s[M];\n scanf(\"%d%s\", &n, s);\n for (int i = 0; i < n; ++i) {\n switch(s[i]) {\n case 'L' : a[0]++; break;\n case 'R' : a[1]++; break;\n case 'U' : a[2]++; break;\n case 'D' : a[3]++; break;\n }\n }\n printf(\"%d\\n\", (MIN(a[0], a[1]) + MIN(a[2], a[3])) *2);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\nint n,i,U,D,L,R,cmd,x,y;\nU=L=D=R=cmd=x=y=0;\nscanf(\"%d\",&n);\nchar str[n];\nscanf(\"%s\",str);\n\nfor(i=0;i\n#include \n#include \n#define ABS(a)((a < 0) ? -1 * a : a)\nint main()\n{\n\tint dx=0,dy=0,n,i=0;\n\tscanf(\"%d\",&n);\n\tchar frase[n];\n\tscanf(\" %s\",frase);\n\t//printf(\"%d %s\\n\",n,frase);\n\tfor(i=0;i < strlen(frase);i++)\n\t{\n\t\tif(frase[i] == 'U' )\n\t\t{\n\t\t\t++dx;\n\t\t}\n\t\telse if(frase[i] == 'D')\n\t\t{\n\t\t\t--dx;\n\t\t}\n\t\telse if(frase[i] == 'L')\n\t\t{\n\t\t\t--dy;\n\t\t}\n\t\telse if(frase[i] == 'R')\n\t\t{\n\t\t\t++dy;\n\t\t}\n\t}\n\tprintf(\"%d\",n-ABS(dx)-ABS(dy));\nreturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n getchar();\n char c;\n int up,down,left,right;\n up=down=left=right=0;\n while(n--)\n {\n scanf(\"%c\",&c);\n switch(c)\n {\n case 'U':up++;break;\n case 'D':down++;break;\n case 'L':left++;break;\n case 'R':right++;\n }\n }\n getchar();\n int sum=0;\n if(up>down) sum+=down*2;\n else sum+=up*2;\n if(left>right) sum+=right*2;\n else sum+=left*2;\n printf(\"%d\\n\",sum);\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n\tint N;\n\tchar str[100];\n\tscanf(\"%d\",&N);\n\tscanf(\"%s\",str);\n\t\n\tint i;\n\tint num_u=0,num_d=0,num_l=0,num_r=0;\n\tfor(i=0;i\nint min(int a,int b)\n{\n\tif(a>b) return b;\n\telse return a;\n}\nint main(){\n\tint i,n,ans;\n\tchar s[100];\n\tint a[4]={0};\n\tscanf(\"%d%s\",&n,s);\n\tfor(i=0;i\nint main()\n{\n int n,a1=0,a2=0,a3=0,a4=0,sum=0,i;\n scanf(\"%d\",&n);\n char a[n];\n scanf(\"%s\",a);\n for(i=0;i=a2) sum=sum+a2;\n else sum=sum+a1;\n if(a3>=a4) sum=sum+a4;\n else sum=sum+a3;\n printf(\"%d\",sum*2);\n}\n"}, {"source_code": "#include\n#define min(a,b) ((a)<(b))?a:b\nint main()\n{\n\t\n\tint l=0,r=0,u=0,d=0;\n\tchar c;\n\tint i,n;\n\tscanf(\"%d \\n\",&n);\n\t\n\tfor(i=0;i\nint min(int a,int b)\n{return a>b ? b:a;}\nint main()\n{\n int n,i,l=0,r=0,u=0,d=0;\n scanf(\"%d\",&n);\n char s[200];\n scanf(\"%s\",s);\n for(i=0;i\nint main()\n{\n int n,a1=0,a2=0,a3=0,a4=0,sum=0,i;\n scanf(\"%d\",&n);\n char a[n];\n scanf(\"%s\",a);\n for(i=0;i=a2) sum=sum+a2;\n else sum=sum+a1;\n if(a3>=a4) sum=sum+a4;\n else sum=sum+a3;\n printf(\"%d\",sum*2);\n}\n"}, {"source_code": "/*\n ============================================================================\n Name : Buggy_Robot.c\n Author : zizo\n Version :\n Copyright : Your copyright notice\n Description : Hello World in C, Ansi-style\n ============================================================================\n */\n\n#include \n#include \n\n#define max(a,b) (a>=b?a:b)\n#define min(a,b) (a<=b?a:b)\n\nint L=0,U=0,D=0,R=0,r,c1;\nvoid move(char c);\nint main() {\n\tint n,i=0,z=0;\n\tscanf(\"%d\",&n);\n\tchar c[n];\n\tscanf(\"%s\",c);\n\twhile(i\n#include\nint main(){\n int n,i,x=0,y=0;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"\\n\");\n gets(s);\n for (i=0;i\n\n#define N\t100\n\nint main() {\n\tstatic char cc[N + 1];\n\tint n, i, ku, kd, kl, kr;\n\n\tscanf(\"%d%s\", &n, cc);\n\tku = kd = kl = kr = 0;\n\tfor (i = 0; i < n; i++)\n\t\tif (cc[i] == 'U')\n\t\t\tku++;\n\t\telse if (cc[i] == 'D')\n\t\t\tkd++;\n\t\telse if (cc[i] == 'L')\n\t\t\tkl++;\n\t\telse if (cc[i] == 'R')\n\t\t\tkr++;\n\tprintf(\"%d\\n\", ((ku < kd ? ku : kd) + (kl < kr ? kl : kr)) * 2);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\nint main(){\n int n,i,j,k,l=0,m=0, c=0, a[2000];\n scanf(\"%d\", &n);\n char h;\n for(i=0;i\n#include\nint main()\n{\nint n,i,U,D,L,R,cmd,x,y;\nU=L=D=R=cmd=x=y=0;\nscanf(\"%d\",&n);\nchar str[n];\nscanf(\"%s\",str);\n\nfor(i=0;i\n#include \n#include \n#define ABS(a)((a < 0) ? -1 * a : a)\nint main()\n{\n\tint dx=0,dy=0,n,i=0;\n\tscanf(\"%d\",&n);\n\tchar frase[n];\n\tscanf(\" %s\",frase);\n\t//printf(\"%d %s\\n\",n,frase);\n\tfor(i=0;i < strlen(frase);i++)\n\t{\n\t\tif(frase[i] == 'U' )\n\t\t{\n\t\t\t++dx;\n\t\t}\n\t\telse if(frase[i] == 'D')\n\t\t{\n\t\t\t--dx;\n\t\t}\n\t\telse if(frase[i] == 'L')\n\t\t{\n\t\t\t--dy;\n\t\t}\n\t\telse if(frase[i] == 'R')\n\t\t{\n\t\t\t++dy;\n\t\t}\n\t}\n\tprintf(\"%d\",n-ABS(dx)-ABS(dy));\nreturn 0;\n}\n/* 1513358766868 */\n"}, {"source_code": "#include\n#include\nint main()\n{\n char s[105];\n int r,l,u,d,n,i,ans,ans1,total;\n while(~scanf(\"%d\",&n))\n {\n getchar();\n scanf(\"%s\",s);\n r=0,l=0,u=0,d=0;\n for(i=0;ir)\n ans=r*2;\n else\n ans=l*2;\n if(u>d)\n ans1=d*2;\n else\n ans1=u*2;\n total=ans+ans1;\n printf(\"%d\\n\",total);\n }\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\nint n,i,U,D,L,R,cmd,x,y;\nU=L=D=R=cmd=x=y=0;\nscanf(\"%d\",&n);\nchar str[n];\nscanf(\"%s\",str);\n\nfor(i=0;i\n#define min(x,y) (((x) < (y)) ? (x) : (y))\nint main()\n{\n int n,i,u=0,d=0,r=0,l=0;\n scanf(\"%d\",&n);\n char arr[n];\n scanf(\"%s\",&arr);\n for (i=0;i\nint com[150];\nchar s[1005];\n\nint min(int a, int b)\n{\n return a < b ? a : b;\n}\n\nint main()\n{\n int n, i, tot;\n scanf(\"%d%s\", &n, s);\n for(i = 0; i < n; ++i)\n ++com[s[i]];\n tot = 2 * (min(com['U'], com['D']) + min(com['L'], com['R']));\n printf(\"%d\\n\", tot);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,i=0,num=0,cum=0,sum=0,pum=0,a=0;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"%s\",&s);\n while(s[i]!=0)\n {\n if(s[i]=='L')\n {\n num=num+1;\n }\n else if(s[i]=='R')\n {\n cum=cum+1;\n }\n else if(s[i]=='U')\n {\n pum=pum+1;\n }\n else if(s[i]=='D')\n {\n sum=sum+1;\n }\n i=i+1;\n }\n if(num>=cum)\n {\n a=a+cum+cum;\n }\n else\n {\n a=a+num+num;\n }\n if(pum>=sum)\n {\n a=a+sum+sum;\n }\n else\n {\n a=a+pum+pum;\n }\n printf(\"%d\",a);\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int temp1, temp2, rep, i, U = 0, R = 0, D = 0, L = 0, tot; \n char comando;\n scanf(\"%d\", &rep);\n for(i = 0; i < rep; i++)\n {\n scanf(\" %c\", &comando);\n// printf(\"comando: %c\\n\", comando);\n if(comando == 'U') U++;\n if(comando == 'R') R++;\n if(comando == 'D') D++;\n if(comando == 'L') L++;\n }\n// printf(\"U = %d, R = %d, D = %d, L = %d\\n\", U, R, D, L);\n temp1 = (U < D)? U: D;\n temp2 = (R < L)? R: L;\n\n printf(\"%d\\n\", (temp2 + temp1)*2);\n\n return 0;\n}\n\n/* 1514038923158 */\n"}, {"source_code": "/*\n ============================================================================\n Name : Buggy_Robot.c\n Author : zizo\n Version :\n Copyright : Your copyright notice\n Description : Hello World in C, Ansi-style\n ============================================================================\n */\n\n#include \n#include \n\n#define max(a,b) (a>=b?a:b)\n#define min(a,b) (a<=b?a:b)\n\nint L=0,U=0,D=0,R=0,r,c1;\nvoid move(char c);\nint main() {\n\tint n,i=0,z=0;\n\tscanf(\"%d\",&n);\n\tchar c[n];\n\tscanf(\"%s\",c);\n\twhile(i\nint main(){\n\tint N;\n\tchar str[100];\n\tscanf(\"%d\",&N);\n\tscanf(\"%s\",str);\n\t\n\tint i;\n\tint num_u=0,num_d=0,num_l=0,num_r=0;\n\tfor(i=0;i\nint com[150];\nchar s[1005];\n\nint min(int a, int b)\n{\n return a < b ? a : b;\n}\n\nint main()\n{\n int n, i, tot;\n scanf(\"%d%s\", &n, s);\n for(i = 0; i < n; ++i)\n ++com[s[i]];\n tot = 2 * (min(com['U'], com['D']) + min(com['L'], com['R']));\n printf(\"%d\\n\", tot);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main(){\n int n,min;\n scanf(\"%d\",&n);\n // char Command[]=malloc((n+1)*sizeof(char)); // does it work? /// NO!!!\n char* Command=malloc((n+1)*sizeof(char));\n scanf(\"%s\",Command);\n int LR[2]={0,0};\n int DU[2]={0,0};\n for(int i=0;i\nint main(){\n\tint N;\n\tchar str[100];\n\tscanf(\"%d\",&N);\n\tscanf(\"%s\",str);\n\t\n\tint i;\n\tint num_u=0,num_d=0,num_l=0,num_r=0;\n\tfor(i=0;i\n#include \n\nint main()\n{ int n,i,l=0,r=0,u=0,d=0,M=0;\nscanf(\"%d\",&n);\nchar command[n];\n for(i=0;i<=n;i++)\n scanf(\"%c\",&command[i]);\n for(i=0;i<=n;i++)\n {\n if(command[i]=='L')\n l++;\n if(command[i]=='R')\n r++;\n if(command[i]=='U')\n u++;\n if(command[i]=='D')\n d++;\n }\n if(r==l||r\n#include \n#include \n#define ABS(a)((a < 0) ? -1 * a : a)\nint main()\n{\n\tint dx=0,dy=0,n,i=0;\n\tscanf(\"%d\",&n);\n\tchar frase[n];\n\tscanf(\" %s\",frase);\n\t//printf(\"%d %s\\n\",n,frase);\n\tfor(i=0;i < strlen(frase);i++)\n\t{\n\t\tif(frase[i] == 'U' )\n\t\t{\n\t\t\t++dx;\n\t\t}\n\t\telse if(frase[i] == 'D')\n\t\t{\n\t\t\t--dx;\n\t\t}\n\t\telse if(frase[i] == 'L')\n\t\t{\n\t\t\t--dy;\n\t\t}\n\t\telse if(frase[i] == 'R')\n\t\t{\n\t\t\t++dy;\n\t\t}\n\t}\n\tprintf(\"%d\",n-ABS(dx)-ABS(dy));\nreturn 0;\n}\n/* 1513358766868 */\n"}, {"source_code": "#include\n#include\nint main(){\n int n,i,x=0,y=0;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"\\n\");\n gets(s);\n for (i=0;i\nint main(){\n\tint N;\n\tchar str[100];\n\tscanf(\"%d\",&N);\n\tscanf(\"%s\",str);\n\t\n\tint i;\n\tint num_u=0,num_d=0,num_l=0,num_r=0;\n\tfor(i=0;i\nchar s[101];\nint min(int a,int b){return (a\n\nint min(int a, int b)\n{\n return a < b ? a : b;\n}\n\nint main()\n{\n int n, max;\n char str[101];\n int U, D, L, R;\n max = U = D = L = R = 0;\n scanf(\"%d %s\", &n, str);\n for(int i = 0; i < n; ++i) {\n if(str[i] == 'U') {\n ++U;\n } else if(str[i] == 'D') {\n ++D;\n } else if(str[i] == 'L') {\n ++L;\n } else {\n ++R;\n }\n }\n printf(\"%d\\n\", min(U, D) * 2 + min(L, R) * 2);\n return 0;\n}\n"}, {"source_code": "#include \n#define MAXN 100\n\nint main()\n{\n int n, cnt[4] = {0};\n char seq[MAXN];\n enum { U, D, L, R };\n scanf(\"%d %s\", &n, seq);\n for (int i = 0; i < n; i++) {\n if (seq[i] == 'U') cnt[U]++;\n else if (seq[i] == 'D') cnt[D]++;\n else if (seq[i] == 'L') cnt[L]++;\n else cnt[R]++;\n }\n int min_ud = ((cnt[U] < cnt[D])? cnt[U]: cnt[D]) * 2;\n int min_lr = ((cnt[L] < cnt[R])? cnt[L]: cnt[R]) * 2;\n printf(\"%d\\n\", min_ud + min_lr);\n return 0;\n}\n"}, {"source_code": "#include\n#include\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,i,a,left=0,right=0,up=0,down=0,result;\n scanf(\"%d\",&n);\n char str[n];\n scanf(\"%s\",str);\n a=strlen(str);\n\n for(i=0;i\nint main()\n{\n\tint n,count=0;\n\tscanf(\"%d\",&n);\n\tchar arr[n+1];\n\tscanf(\"%s\",arr);\n\tint l=0,r=0,u=0,d=0;\n\tfor (int i = 0; i < n; ++i)\n\t{\n\t\tif (arr[i]=='L')\n\t\t{\n\t\t\tl++;\n\t\t}\n\t\tif (arr[i]=='R')\n\t\t{\n\t\t\tr++;\n\t\t}\n\t\tif (arr[i]=='U')\n\t\t{\n\t\t\tu++;\n\t\t}\n\t\tif (arr[i]== 'D')\n\t\t{\n\t\t\td++;\n\t\t}\n\t}\n\t\n\tif (l>r)\n\t{\n\t\tcount+=r;\n\t}\n\telse\n\t\tcount+=l;\n\tif (u>d)\n\t{\n\t\tcount+=d;\n\t}\n\telse\n\t\tcount+=u;\n\tprintf(\"%d\\n\",2*count );\n\t\t}"}, {"source_code": "#include \n#include \n#include\n\nint main()\n{\n int n,i,l=0,u=0,d=0,r=0,j,x=0,y=0,count = 0;\n char a[500];\n scanf(\"%d\",&n);\n scanf(\"%s\",a);\n j = strlen(a);\n if(j==n)\n {\n\n for(i=0;i0 && r>0)\n {\n if(l0 && r==0)\n {\n x = l;\n count = n-(x+y);\n }\n\n else if(l==0 && r>0)\n {\n x = r;\n count = n-(x+y);\n }\n\n if(u>0 && d>0)\n {\n if(u0 && d==0)\n {\n y = u;\n count = n-(x+y);\n }\n\n else if(u==0 && d>0)\n {\n y = d;\n count = n-(x+y);\n }\n\n\n\n\n printf(\"%d\",count);\n\n\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n\tint hash[27]={},n,i,a,b,ans;\n\tchar s[1000022];\n\tscanf(\"%d\",&n);\n\tscanf(\"%s\",s);\n\ti=0;\n\twhile(s[i]!='\\0')\n\t{\n\t\thash[s[i]-'A']++;\n\t\ti++;\n\t}\n\tif(hash['R'-'A']>hash['L'-'A'])\n\t\ta=hash['L'-'A'];\n\telse\n\t\ta=hash['R'-'A'];\n\tif(hash['U'-'A']>hash['D'-'A'])\n\t\tb=hash['D'-'A'];\n\telse\n\t\tb=hash['U'-'A'];\n ans=a+b;\n ans*=2;\n printf(\"%d\",ans);\n\n}"}, {"source_code": "#include\nint main()\n{\n\tint n,count=0;\n\tscanf(\"%d\",&n);\n\tchar arr[n+1];\n\tscanf(\"%s\",arr);\n\tint l=0,r=0,u=0,d=0;\n\tfor (int i = 0; i < n; ++i)\n\t{\n\t\tif (arr[i]=='L')\n\t\t{\n\t\t\tl++;\n\t\t}\n\t\tif (arr[i]=='R')\n\t\t{\n\t\t\tr++;\n\t\t}\n\t\tif (arr[i]=='U')\n\t\t{\n\t\t\tu++;\n\t\t}\n\t\tif (arr[i]== 'D')\n\t\t{\n\t\t\td++;\n\t\t}\n\t}\n\t\n\tif (l>r)\n\t{\n\t\tcount+=r;\n\t}\n\telse\n\t\tcount+=l;\n\tif (u>d)\n\t{\n\t\tcount+=d;\n\t}\n\telse\n\t\tcount+=u;\n\tprintf(\"%d\\n\",2*count );\n\t\t}"}, {"source_code": "#include \n#include \n#include \n\nint main(){\n int n,i,j,k,l=0,m=0, c=0, a[2000];\n scanf(\"%d\", &n);\n char h;\n for(i=0;i\n\n#define N 100\n#define min(A, B) ((A) < (B) ? (A) : (B))\n\nint main() {\n\tstatic char s[N + 1];\n\tint n, i, cnt1, cnt2, cnt3, cnt4;\n\n\tscanf(\"%d%s\", &n, s);\n\tcnt1 = cnt2 = cnt3 = cnt4 = 0;\n\tfor (i = 0; i < n; i++)\n\t\tif (s[i] == 'U')\n\t\t\tcnt1++;\n\t\telse if (s[i] == 'D')\n\t\t\tcnt2++;\n\t\telse if (s[i] == 'L')\n\t\t\tcnt3++;\n\t\telse\n\t\t\tcnt4++;\n\tprintf(\"%d\\n\", (min(cnt1, cnt2) + min(cnt3, cnt4)) * 2);\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int i,j,k,n,c,x,y,p,q,r,w;\n scanf(\"%d\",&n);\n char s[2000];\n scanf(\"%s\",s);\n x=0;\n y=0;\n c=0;\n p=0;\n q=0;\n r=0;\n for(i=0;i\n\nint min(int a, int b)\n{\n return a < b ? a : b;\n}\n\nint main()\n{\n int n, max;\n char str[101];\n int U, D, L, R;\n max = U = D = L = R = 0;\n scanf(\"%d %s\", &n, str);\n for(int i = 0; i < n; ++i) {\n if(str[i] == 'U') {\n ++U;\n } else if(str[i] == 'D') {\n ++D;\n } else if(str[i] == 'L') {\n ++L;\n } else {\n ++R;\n }\n }\n printf(\"%d\\n\", min(U, D) * 2 + min(L, R) * 2);\n return 0;\n}\n"}, {"source_code": "#include \n\n#define N 100\n#define min(A, B) ((A) < (B) ? (A) : (B))\n\nint main() {\n\tstatic char s[N + 1];\n\tint n, i, cnt1, cnt2, cnt3, cnt4;\n\n\tscanf(\"%d%s\", &n, s);\n\tcnt1 = cnt2 = cnt3 = cnt4 = 0;\n\tfor (i = 0; i < n; i++)\n\t\tif (s[i] == 'U')\n\t\t\tcnt1++;\n\t\telse if (s[i] == 'D')\n\t\t\tcnt2++;\n\t\telse if (s[i] == 'L')\n\t\t\tcnt3++;\n\t\telse\n\t\t\tcnt4++;\n\tprintf(\"%d\\n\", (min(cnt1, cnt2) + min(cnt3, cnt4)) * 2);\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n#include\nint main(){\n int i,n,j,k,sum=0;\n char ch[100],dh,direction[2][2];\n int A[2][2]={0};\n direction[0][0]='0';\n direction[1][0]='0';\n scanf(\"%d\",&n);\n scanf(\"%c\",&dh);\n for(i=0;i\n#include \nint saisie(int n)\n{\n do\n {\n scanf(\"%d\",&n);\n }while (!((n>=1)&&(n<=100)));\n return n;\n\n}\nint min(int x,int y)\n{\n if (x\n#include\nint main(){\n\tint n,i,a=0,b=0,c=0,d=0,sum=0;\n\tchar s[110];\n\tscanf(\"%d%s\",&n,&s);\n\tfor(i=0;ib) sum+=2*b;\n\telse sum+=2*a;\n\tif(c>d) sum+=2*d;\n\telse sum+=2*c;\n\tprintf(\"%d\\n\",sum);\n\treturn 0;\n}\n\t\n \t \t \t \t\t \t \t\t \t \t\t\t \t\t"}, {"source_code": "#include \n#include \n\nint main()\n{\n int temp1, temp2, rep, i, U = 0, R = 0, D = 0, L = 0, tot; \n char comando;\n scanf(\"%d\", &rep);\n for(i = 0; i < rep; i++)\n {\n scanf(\" %c\", &comando);\n// printf(\"comando: %c\\n\", comando);\n if(comando == 'U') U++;\n if(comando == 'R') R++;\n if(comando == 'D') D++;\n if(comando == 'L') L++;\n }\n// printf(\"U = %d, R = %d, D = %d, L = %d\\n\", U, R, D, L);\n temp1 = (U < D)? U: D;\n temp2 = (R < L)? R: L;\n\n printf(\"%d\\n\", (temp2 + temp1)*2);\n\n return 0;\n}\n\n/* 1514038923158 */\n"}, {"source_code": "#include\n#include\nint main(){\n\tint n,i,a=0,b=0,c=0,d=0,sum=0;\n\tchar s[110];\n\tscanf(\"%d%s\",&n,&s);\n\tfor(i=0;ib) sum+=2*b;\n\telse sum+=2*a;\n\tif(c>d) sum+=2*d;\n\telse sum+=2*c;\n\tprintf(\"%d\\n\",sum);\n\treturn 0;\n}\n\t\n \t \t \t \t\t \t \t\t \t \t\t\t \t\t"}, {"source_code": "#include \n\nint min(int a, int b)\n{\n return a < b ? a : b;\n}\n\nint main()\n{\n int n, max;\n char str[101];\n int U, D, L, R;\n max = U = D = L = R = 0;\n scanf(\"%d %s\", &n, str);\n for(int i = 0; i < n; ++i) {\n if(str[i] == 'U') {\n ++U;\n } else if(str[i] == 'D') {\n ++D;\n } else if(str[i] == 'L') {\n ++L;\n } else {\n ++R;\n }\n }\n printf(\"%d\\n\", min(U, D) * 2 + min(L, R) * 2);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main(){\n int n,min;\n scanf(\"%d\",&n);\n // char Command[]=malloc((n+1)*sizeof(char)); // does it work? /// NO!!!\n char* Command=malloc((n+1)*sizeof(char));\n scanf(\"%s\",Command);\n int LR[2]={0,0};\n int DU[2]={0,0};\n for(int i=0;i\n\nint min(int a, int b)\n{\n return a < b ? a : b;\n}\n\nint main()\n{\n int n, max;\n char str[101];\n int U, D, L, R;\n max = U = D = L = R = 0;\n scanf(\"%d %s\", &n, str);\n for(int i = 0; i < n; ++i) {\n if(str[i] == 'U') {\n ++U;\n } else if(str[i] == 'D') {\n ++D;\n } else if(str[i] == 'L') {\n ++L;\n } else {\n ++R;\n }\n }\n printf(\"%d\\n\", min(U, D) * 2 + min(L, R) * 2);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int i,n,nU,nL,nR,nD,c;\n nU=0; nL=0; nR=0; nD=0; c=0;\n scanf(\"%d\",&n);\n char s[n];\n for(i=0;i\n#include \n#include\n\nint main()\n{\n int n,i,l=0,u=0,d=0,r=0,j,x=0,y=0,count = 0;\n char a[500];\n scanf(\"%d\",&n);\n scanf(\"%s\",a);\n j = strlen(a);\n if(j==n)\n {\n\n for(i=0;i0 && r>0)\n {\n if(l0 && r==0)\n {\n x = l;\n count = n-(x+y);\n }\n\n else if(l==0 && r>0)\n {\n x = r;\n count = n-(x+y);\n }\n\n if(u>0 && d>0)\n {\n if(u0 && d==0)\n {\n y = u;\n count = n-(x+y);\n }\n\n else if(u==0 && d>0)\n {\n y = d;\n count = n-(x+y);\n }\n\n\n\n\n printf(\"%d\",count);\n\n\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint x = 0, y = 0, n, i, s;\nchar d[3000];\n\nint main()\n{\n scanf(\"%d\", &n);\n for (i = 0; i <= n; i++) scanf(\"%c\", &d[i]);\n s = 0;\n for (i = 1; i <= n; i++)\n switch(d[i])\n {\n case 'U' : y++; break;\n case 'D' : y--; break;\n case 'L' : x--; break;\n case 'R' : x++; break;\n }\n s = n - abs(x) - abs(y);\n printf(\"%d\", s);\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n\tint N;\n\tchar str[100];\n\tscanf(\"%d\",&N);\n\tscanf(\"%s\",str);\n\t\n\tint i;\n\tint num_u=0,num_d=0,num_l=0,num_r=0;\n\tfor(i=0;i\nint min(int x, int y) {\n return (x<=y) ? x:y;\n}\nint move(int length) {\n int save[]={0,0,0,0};\n char curr;\n for (int i=0; i\n#include \n\nint main()\n{\n int x=0,y=0,n=0,i=0;\n do\n {\n scanf(\"%d\",&n);\n\n }while((n<1)||(n>100));\n char a[n];\n scanf(\"%s\",&a);\n while(i\n#include\nint min(int a,int b)\n{\n return a\nint nnn(int a,int b)\n{\nreturn (a\n#include\nint main()\n{\nint n,i,U,D,L,R,cmd,x,y;\nU=L=D=R=cmd=x=y=0;\nscanf(\"%d\",&n);\nchar str[n];\nscanf(\"%s\",str);\n\nfor(i=0;i\n#include\nint min(int a,int b)\n{\n return a\n#include \n#include \n\n#define max(a, b) ((a) > (b) ? (a) : (b))\n#define min(a, b) ((a) < (b) ? (a) : (b))\n#define MAXN 1005\n\n\n\nint main()\n{\n int T, i, L, D, U, R;\n char str[MAXN];\n scanf(\"%d\", &T);\n T = 1;\n while (T--)\n {\n scanf(\"%s\", str);\n L = D = U = R = 0;\n for (i = 0; str[i]; ++i)\n {\n if (str[i] == 'L')\n ++L;\n else if (str[i] == 'D')\n ++D;\n else if (str[i] == 'U')\n ++U;\n else\n ++R;\n }\n printf(\"%d\\n\", 2 * (min(L, R) + min(U, D)));\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main(void) {\n\tint n,i;\n\tscanf(\"%d\",&n);\n\tchar a[101];\n\tscanf(\"%s\", a);\n\t\n\tint x=0;\n\tint y=0;\n\tfor (i=0;i\n#include\nint main(){\n\tint n,i,a=0,b=0,c=0,d=0,sum=0;\n\tchar s[110];\n\tscanf(\"%d%s\",&n,&s);\n\tfor(i=0;ib) sum+=2*b;\n\telse sum+=2*a;\n\tif(c>d) sum+=2*d;\n\telse sum+=2*c;\n\tprintf(\"%d\\n\",sum);\n\treturn 0;\n}\n\t\n \t \t \t \t\t \t \t\t \t \t\t\t \t\t"}, {"source_code": "#include\nint main()\n{\n int n,a1=0,a2=0,a3=0,a4=0,sum=0,i;\n scanf(\"%d\",&n);\n char a[n];\n scanf(\"%s\",a);\n for(i=0;i=a2) sum=sum+a2;\n else sum=sum+a1;\n if(a3>=a4) sum=sum+a4;\n else sum=sum+a3;\n printf(\"%d\",sum*2);\n}\n"}, {"source_code": "#include \n\nint main(void){\n int n;\n scanf(\"%d\", &n);\n char udlr;\n int xf = 0;\n int yf = 0;\n for(int i = 0; i < n; ++i){\n scanf(\" %c\", &udlr);\n if(udlr == 'U'){\n ++yf;\n }\n else if(udlr == 'D'){\n --yf;\n }\n else if(udlr == 'R'){\n ++xf;\n }\n else if(udlr == 'L'){\n --xf;\n }\n }\n if(xf < 0){\n xf *= -1;\n }\n if(yf < 0){\n yf *= -1;\n }\n printf(\"%d\\n\", n-xf-yf);\n return 0;\n}\n\n/* 1515103045754 */\n"}, {"source_code": "#include\nint main()\n{\n\tint n,count=0;\n\tscanf(\"%d\",&n);\n\tchar arr[n+1];\n\tscanf(\"%s\",arr);\n\tint l=0,r=0,u=0,d=0;\n\tfor (int i = 0; i < n; ++i)\n\t{\n\t\tif (arr[i]=='L')\n\t\t{\n\t\t\tl++;\n\t\t}\n\t\tif (arr[i]=='R')\n\t\t{\n\t\t\tr++;\n\t\t}\n\t\tif (arr[i]=='U')\n\t\t{\n\t\t\tu++;\n\t\t}\n\t\tif (arr[i]== 'D')\n\t\t{\n\t\t\td++;\n\t\t}\n\t}\n\t\n\tif (l>r)\n\t{\n\t\tcount+=r;\n\t}\n\telse\n\t\tcount+=l;\n\tif (u>d)\n\t{\n\t\tcount+=d;\n\t}\n\telse\n\t\tcount+=u;\n\tprintf(\"%d\\n\",2*count );\n\t\t}"}, {"source_code": "#include \n#include \nchar s[110];\n\nint main() {\n\tint n, i;\n\tint x = 0;\n\tint y = 0;\n\tint o = 0;\n\tscanf(\"%d\", &n);\n\tscanf(\"%s\", s);\n\tfor (i=0; i\n#include\nint main(){\n int n,min;\n scanf(\"%d\",&n);\n // char Command[]=malloc((n+1)*sizeof(char)); // does it work? /// NO!!!\n char* Command=malloc((n+1)*sizeof(char));\n scanf(\"%s\",Command);\n int LR[2]={0,0};\n int DU[2]={0,0};\n for(int i=0;i\n\n#define MAX_COMMANDS \t100\n#define ABS(x) \t\t\t((x < 0) ? (-x) : (x))\n\nint\t\tmain(void)\n{\n\tchar commands[MAX_COMMANDS + 1];\n\tint num_commands;\n\tint lr_dist;\n\tint ud_dist;\n\n\tcommands[MAX_COMMANDS] = '\\0';\n\n\tscanf(\"%d\\n\", &num_commands);\n\tfor (int i = 0; i < num_commands; i++)\n\t\tscanf(\"%c\", &commands[i]);\n\n\tlr_dist = 0;\n\tud_dist = 0;\n\tfor (int i = 0; i < num_commands; i++)\n\t{\n\t\tif (commands[i] == 'L')\n\t\t\tlr_dist--;\n\t\telse if (commands[i] == 'R')\n\t\t\tlr_dist++;\n\t\telse if (commands[i] == 'U')\n\t\t\tud_dist++;\n\t\telse if (commands[i] == 'D')\n\t\t\tud_dist--;\n\t}\n\tprintf(\"%d\\n\", num_commands - ABS(lr_dist) - ABS(ud_dist));\n\treturn (0);\n}"}, {"source_code": "/*\n ============================================================================\n Name : puggy.c\n Author : Hossam Tourki\n Version :\n Copyright : Your copyright notice\n Description : Hello World in C, Ansi-style\n ============================================================================\n */\n\n#include \n#include \n\nint main(void) {\n\tint n;\n\tscanf(\"%d \",&n);\n\tchar commands[100];\n\tgets(commands);\n\tint i,U=0,D=0,L=0,R=0,m=0;\n\tfor(i=0;i\n#include \n\nint main()\n{\n int temp1, temp2, rep, i, U = 0, R = 0, D = 0, L = 0, tot; \n char comando;\n scanf(\"%d\", &rep);\n for(i = 0; i < rep; i++)\n {\n scanf(\" %c\", &comando);\n// printf(\"comando: %c\\n\", comando);\n if(comando == 'U') U++;\n if(comando == 'R') R++;\n if(comando == 'D') D++;\n if(comando == 'L') L++;\n }\n// printf(\"U = %d, R = %d, D = %d, L = %d\\n\", U, R, D, L);\n temp1 = (U < D)? U: D;\n temp2 = (R < L)? R: L;\n\n printf(\"%d\\n\", (temp2 + temp1)*2);\n\n return 0;\n}\n\n/* 1514038923158 */\n"}, {"source_code": "#include\t\nint main()\n{ int n,i,l,u,d,r;\n\tchar a[200];\n\tscanf(\"%d%s\",&n,a);\n\tl=0; r=0; d=0; u=0;\n\t for(i=0;ir)\n\t\t l=r;\n\t if(d>u)\n\t\t d=u;\n\t printf(\"%d\",d+l+d+l);\n\n\treturn 0; }\n"}, {"source_code": "#include \n\n#define N 100\n#define min(A, B) ((A) < (B) ? (A) : (B))\n\nint main() {\n\tstatic char s[N + 1];\n\tint n, i, cnt1, cnt2, cnt3, cnt4;\n\n\tscanf(\"%d%s\", &n, s);\n\tcnt1 = cnt2 = cnt3 = cnt4 = 0;\n\tfor (i = 0; i < n; i++)\n\t\tif (s[i] == 'U')\n\t\t\tcnt1++;\n\t\telse if (s[i] == 'D')\n\t\t\tcnt2++;\n\t\telse if (s[i] == 'L')\n\t\t\tcnt3++;\n\t\telse\n\t\t\tcnt4++;\n\tprintf(\"%d\\n\", (min(cnt1, cnt2) + min(cnt3, cnt4)) * 2);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n#include\nint min(int a, int b)\n{\n if (a>b)\n return b;\n return a;\n}\nint Buggy_Robot(int n, char seq[])\n{\n int i,u=0,d=0,l=0,r=0;\n for (i=0;i\n#include \n#include \n#define ABS(a)((a < 0) ? -1 * a : a)\nint main()\n{\n\tint l=0,d=0,r=0,u=0,n,i=0;\n\tscanf(\"%d\",&n);\n\tchar frase[n];\n\tscanf(\" %s\",frase);\n\t//printf(\"%d %s\\n\",n,frase);\n\tfor(i=0;i < strlen(frase);i++)\n\t{\n\t\tif(frase[i] == 'U' )\n\t\t{\n\t\t\t++u;\n\t\t}\n\t\telse if(frase[i] == 'D')\n\t\t{\n\t\t\t--d;\n\t\t}\n\t\telse if(frase[i] == 'L')\n\t\t{\n\t\t\t--l;\n\t\t}\n\t\telse if(frase[i] == 'R')\n\t\t{\n\t\t\t++r;\n\t\t}\n\t}\n\tu += d;\n\tr += l;\n\tprintf(\"%d\",n-u-r);\nreturn 0;\n}"}, {"source_code": "#include \n#include \n#include \n#define ABS(a)((a < 0) ? -1 * a : a)\nint main()\n{\n\tint l=0,d=0,r=0,u=0,n,i=0;\n\tscanf(\"%d\",&n);\n\tchar frase[n];\n\tscanf(\" %s\",frase);\n\t//printf(\"%d %s\\n\",n,frase);\n\tfor(i=0;i < strlen(frase);i++)\n\t{\n\t\tif(frase[i] == 'U' )\n\t\t{\n\t\t\t++u;\n\t\t}\n\t\telse if(frase[i] == 'D')\n\t\t{\n\t\t\t--d;\n\t\t}\n\t\telse if(frase[i] == 'L')\n\t\t{\n\t\t\t--l;\n\t\t}\n\t\telse if(frase[i] == 'R')\n\t\t{\n\t\t\t++r;\n\t\t}\n\t}\n\tu += d;\n\tr += l;\n\tprintf(\"%d\",n-u-r);\nreturn 0;\n}"}, {"source_code": "/*\n ============================================================================\n Name : Buggy_Robot.c\n Author : zizo\n Version :\n Copyright : Your copyright notice\n Description : Hello World in C, Ansi-style\n ============================================================================\n */\n\n#include \n#include \n\n#define max(a,b) (a>=b?a:b)\n#define min(a,b) (a<=b?a:b)\n\nint L=0,U=0,D=0,R=0,R,C,r,c1;\nvoid move(char c);\nint main() {\n\tint n,i=0,z=0;\n\tscanf(\"%d\",&n);\n\tchar c[n];\n\tscanf(\"%s\",c);\n\twhile(i\n\nint main()\n{\n int n,i;\n scanf(\"%d\",&n);\n char arr[n];\n scanf(\"%s\",&arr);\n\n goto check;\n\ncheck : {\n int u=0,d=0,r=0,l=0;\n for (i=0;i\n#include \n#include \n\nint main()\n{\n\tint x = 0, y = 0;\n\tint n, max = 0;\n\n\tscanf(\"%d\", &n);\n\tgetchar();\n\tchar comandos[n];\n\tscanf(\"%s\",comandos);\n\tint i;\n\tfor(i = 0; i < strlen(comandos); i++)\n\t{\n\t\tif(comandos[i] == 'U') y++;\n\t\tif(comandos[i] == 'D') y--;\n\t\tif(comandos[i] == 'L') x--;\n\t\tif(comandos[i] == 'R') x++;\n\n\t\tif(x == 0 && y == 0) max = i + 1;\n\n\t}\n\n\tprintf(\"%d\\n\",max );\n\n\n}\n/* 1512826328718 */\n"}, {"source_code": "#include \n\nint main(void) {\n\tint n;\n\tscanf(\"%d\", &n);\n\tchar udlr;\n\tint xf = 0;\n\tint yf = 0;\n\tfor(int i = 0; i < n; ++i){\n\t\tscanf(\" %c\", &udlr);\n\t\tif(udlr == 'U'){\n\t\t\t++yf;\n\t\t}\n\t\telse if(udlr == 'D'){\n\t\t\t--yf;\n\t\t}\n\t\telse if(udlr == 'R'){\n\t\t\t++xf;\n\t\t}\n\t\telse if(udlr == 'L'){\n\t\t\t--xf;\n\t\t}\n\t}\n\tprintf(\"%d\\n\", n-xf-yf);\n\treturn 0;\n}\n\n/* 1515093055897 */\n"}, {"source_code": "#include\n#include\nint main()\n{\n int i,j,k,n,c,x,y;\n scanf(\"%d\",&n);\n char s[2000];\n scanf(\"%s\",s);\n x=0;\n y=0;\n c=0;\n for(i=0;i\n#include\nint main()\n{\n int i,j,k,n,c,x,y;\n scanf(\"%d\",&n);\n char s[2000];\n scanf(\"%s\",s);\n x=0;\n y=0;\n c=0;\n for(i=0;i\n#include \n\nint main(int argc, char const *argv[])\n{\n\tint pos_x = 0, pos_y = 0;\n\n\tint max = 0;\n\n\tint n;\n\tscanf(\"%d\", &n);\n\n\tgetchar();\n\n\tchar comando[100];\n\tscanf(\"%[^\\n]\", comando);\n\n\tint i;\n\tfor (i = 0; i < n; i++)\n\t{\n\t\tif (comando[i] == 'U') pos_y++;\n\t\telse if (comando[i] == 'D') pos_y--;\n\t\telse if (comando[i] == 'R') pos_x++;\n\t\telse pos_x--;\n\n\t\tif (pos_x == 0 && pos_y == 0) max = i+1;\n\t}\n\n\tprintf(\"%d\\n\", max );\n\n\treturn 0;\n}\n/* 1512828316954 */\n"}, {"source_code": "#include \n#include \n#include\nint Buggy_Robot(int n, char seq[])\n{\n int p=0,i,u=0,d=0,l=0,r=0;\n for (i=0;i\n#include \n\nint main()\n{\n\nint x = 0, y = 0, aux = 0, tam, rep, i, cont = 0;\nscanf(\"%d\", &rep);\nchar comando[100];\nscanf(\" %s\", comando);\ntam = strlen(comando);\n\n\tfor(i = 0; i < rep; i++)\n\t{\n\t\tif(comando[i] == 'U') y++;\n\t\telse if(comando[i] == 'D') y--; \n\t\telse if(comando[i] == 'L') x--;\n\t\telse x++;\n\n\t\tif(x == 0 && y == 0)\n\t\t if(rep > aux) aux = rep;\n\t}\n\t\nprintf(\"%d\", aux);\n\nreturn 0;\n\n}\n\n/* 1512828791924 */\n"}, {"source_code": "#include \n\nint main(){\n\tint i,n;\n\tint x=0,y=0,count=0,flag=0;\n\tchar OP;\n\n\tscanf(\" %d\",&n);\n\tfor(i=0;i\n\nint main(){\n int n; scanf(\"%d \", &n);\n\n int x=0, y=0, cnt=0, ans=0;\n while(n--){\n char ch;\n ch = getchar();\n if (ch=='U') y++;\n else if (ch=='D') y--;\n else if (ch=='L') x--;\n else if (ch=='R') x++;\n cnt++;\n if( x==0 && y==0){\n if (cnt>ans) ans=cnt;\n cnt=0;\n }\n }\n printf(\"%d\\n\", ans);\n}\n"}, {"source_code": "#include \n#define rep(i,a,b) for (int i=a; iy) ? x:y;\n}\nint move(int length) {\n int x=0,y=0,maxlen=0,curlen=1;\n char curr;\n rep (i,0,length) {\n scanf(\"%c\",&curr);\n switch (curr) {\n case 'U':\n y++;\n break;\n case 'D':\n y--;\n break;\n case 'L':\n x--;\n break;\n case 'R':\n x++;\n break;\n }\n if (x==0 && y==0) {\n maxlen=max(maxlen,curlen);\n curlen=1;\n }\n curlen++;\n }\n return maxlen;\n}\nint main() {\n int len; scanf(\"%d\\n\",&len);\n printf(\"%d\",move(len));\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \n\nint main()\n{\n\tint x = 0, y = 0;\n\tint n, max = 0;\n\n\tscanf(\"%d\", &n);\n\tgetchar();\n\tchar comandos[n];\n\tscanf(\"%s\",comandos);\n\tint i;\n\tfor(i = 0; i < strlen(comandos); i++)\n\t{\n\t\tif(comandos[i] == 'U') y++;\n\t\tif(comandos[i] == 'D') y--;\n\t\tif(comandos[i] == 'L') x--;\n\t\tif(comandos[i] == 'R') x++;\n\n\t\tif(x == 0 && y == 0) max = i + 1;\n\n\t}\n\n\tprintf(\"%d\\n\",max );\n\n\n}\n/* 1512826328718 */\n"}, {"source_code": "#include \n#include \n\nint main(int argc, char const *argv[])\n{\n\tint pos_x = 0, pos_y = 0;\n\n\tint max = 0;\n\n\tint n;\n\tscanf(\"%d\", &n);\n\n\tgetchar();\n\n\tchar comando[100];\n\tscanf(\"%[^\\n]\", comando);\n\n\tint i;\n\tfor (i = 0; i < n; i++)\n\t{\n\t\tif (comando[i] == 'U') pos_y++;\n\t\telse if (comando[i] == 'D') pos_y--;\n\t\telse if (comando[i] == 'R') pos_x++;\n\t\telse if (comando[i] == 'L') pos_x--;\n\n\t\tif (pos_x == 0 && pos_y == 0) max = i+1;\n\t}\n\n\tprintf(\"%d\", max );\n\n\treturn 0;\n}\n/* 1512828801534 */\n"}, {"source_code": "#include \n\nint main()\n{\n int n, max, x, y;\n char str[101];\n x = y = max = 0;\n scanf(\"%d %s\", &n, str);\n for(int i = 0; i < n; ++i) {\n if(str[i] == 'U') {\n ++y;\n } else if(str[i] == 'D') {\n --y;\n } else if(str[i] == 'L') {\n --x;\n } else {\n ++x;\n }\n if(x == 0 && y == 0) {\n if(max < i + 1) {\n max = i + 1;\n }\n }\n }\n printf(\"%d\\n\", max);\n return 0;\n}\n"}, {"source_code": "#include \n\n#define MAX_COMMANDS 100\n\n\nint\t\tmain(void)\n{\n\tchar commands[MAX_COMMANDS + 1];\n\tint num_commands;\n\tint max_poss_commands;\n\tint lr_dist;\n\tint ud_dist;\n\n\tfor (int i = 0; i < MAX_COMMANDS; i++)\n\t\tcommands[i] = '0';\n\tcommands[MAX_COMMANDS] = '\\0';\n\n\tscanf(\"%d\", &num_commands);\n\tfor (int i = 0; i < num_commands + 1; i++)\n\t\tscanf(\"%c\", &commands[i]);\n\n\tlr_dist = 0;\n\tud_dist = 0;\n\tmax_poss_commands = 0;\n\tfor (int i = 0; i < num_commands + 1; i++)\n\t{\n\t\tif (commands[i] == 'L')\n\t\t\tlr_dist--;\n\t\telse if (commands[i] == 'R')\n\t\t\tlr_dist++;\n\t\telse if (commands[i] == 'U')\n\t\t\tud_dist++;\n\t\telse if (commands[i] == 'D')\n\t\t\tud_dist--;\n\n\t\tif (lr_dist == 0 && ud_dist == 0 && i > max_poss_commands)\n\t\t\tmax_poss_commands = i;\n\t}\n\tprintf(\"%d\\n\", max_poss_commands);\n\treturn (0);\n}"}, {"source_code": "#include \n\nint main()\n{\n\tint c,aux=0,i,l=0,d=0,u=0,r=0;\n\tscanf(\"%d\",&c);\n\tchar s[c];\n\tscanf(\" %s\",s);\n\tfor(i=0;i\n#include \n#include \n\nint main()\n{\n\tint x = 0, y = 0;\n\tint n, max = 0;\n\n\tscanf(\"%d\", &n);\n\tgetchar();\n\tchar comandos[n];\n\tscanf(\"%s\",comandos);\n\tint i;\n\tfor(i = 0; i < strlen(comandos); i++)\n\t{\n\t\tif(comandos[i] == 'U') y++;\n\t\tif(comandos[i] == 'D') y--;\n\t\tif(comandos[i] == 'L') x--;\n\t\tif(comandos[i] == 'R') x++;\n\n\t\tif(x == 0 && y == 0) max = i + 1;\n\n\t}\n\n\tprintf(\"%d\\n\",max );\n\n\n}\n/* 1512826290791 */\n"}, {"source_code": "#include \n#include \n#include\nint Buggy_Robot(int n, char seq[])\n{\n int i,u=0,d=0,l=0,r=0;\n for (i=0;i\n\nchar vec[1001];\n\nint main() {\n\tint n, x = 0, y = 0;\n\tscanf(\"%d\", &n);\n\t\n\tscanf(\"%s\", vec);\n\n\tfor (int i = 0; i < n; i++) {\n\t\tif (vec[i] == 'L') x--;\n\t\tif (vec[i] == 'R') x++;\n\t\tif (vec[i] == 'D') y--;\n\t\tif (vec[i] == 'U') y++;\n\t\n\t\tif (x == 0 && y == 0) { printf(\"%d\", i + 1); return 0; }\n\t}\n\tprintf(\"0\");\n}"}, {"source_code": "#include \n#include \n#include \n\nint main()\n{\n\tint x = 0, y = 0;\n\tint n, max = 0;\n\n\tscanf(\"%d\", &n);\n\tgetchar();\n\tchar comandos[n];\n\tscanf(\"%s\",comandos);\n\tint i;\n\tfor(i = 0; i < strlen(comandos); i++)\n\t{\n\t\tif(comandos[i] == 'U') y++;\n\t\tif(comandos[i] == 'D') y--;\n\t\tif(comandos[i] == 'L') x--;\n\t\tif(comandos[i] == 'R') x++;\n\n\t\tif(x == 0 && y == 0) max = i + 1;\n\n\t}\n\n\tprintf(\"%d\\n\",max );\n\n\n}\n/* 1512826290791 */\n"}, {"source_code": "#include \n\nint main()\n{\n int i, n, x, y, t;\n char c[101] = { 0 };\n\n scanf(\"%d \", &n);\n\n scanf(\"%s \", c);\n\n x = 0;\n y = 0;\n t = 0;\n for (i = 0; i < n; ++i) {\n switch (c[i]) {\n case 'U':\n y += 1;\n break;\n case 'D':\n y -= 1;\n break;\n case 'L':\n x -= 1;\n break;\n case 'R':\n x += 1;\n break;\n default:\n printf(\"what\");\n }\n\n if (x == 0 && y == 0) {\n t = i + 1;\n }\n }\n\n printf(\"%d\\n\", t);\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\nint main()\n{\n\tint x = 0, y = 0;\n\tint n, max = 0;\n\n\tscanf(\"%d\", &n);\n\tgetchar();\n\tchar comandos[n];\n\tscanf(\"%s\",comandos);\n\tint i;\n\tfor(i = 0; i < strlen(comandos); i++)\n\t{\n\t\tif(comandos[i] == 'U') y++;\n\t\tif(comandos[i] == 'D') y--;\n\t\tif(comandos[i] == 'L') x--;\n\t\tif(comandos[i] == 'R') x++;\n\n\t\tif(x == 0 && y == 0) max = i + 1;\n\n\t}\n\n\tprintf(\"%d\\n\",max );\n\n\n}\n/* 1512826328718 */\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n, count = 0, L = 0, U = 0 , D = 0, R = 0, i;\n\n scanf(\"%d\", &n);\n\n for(i = 0; i\n#include \n#include \n#define MIN(a,b)((a < b) ? a : b ) \n#define ABS(a)((a < 0) ? -1 * a : a)\nint main()\n{\n\tint l=0,d=0,r=0,u=0,n,i=0;\n\tscanf(\"%d\",&n);\n\tchar frase[n];\n\tscanf(\" %s\",frase);\n\t//printf(\"%d %s\\n\",n,frase);\n\tfor(i=0;i < strlen(frase);i++)\n\t{\n\t\tif(frase[i] == 'U' )\n\t\t{\n\t\t\t++u;\n\t\t}\n\t\telse if(frase[i] == 'D')\n\t\t{\n\t\t\t--d;\n\t\t}\n\t\telse if(frase[i] == 'L')\n\t\t{\n\t\t\t--l;\n\t\t}\n\t\telse if(frase[i] == 'R')\n\t\t{\n\t\t\t++r;\n\t\t}\n\t}\n\tint minx = MIN(l,r);\n\tint miny = MIN(u,d);\n\tprintf(\"%d\\n\",ABS((minx+miny)*2));\n\n\n\n\n\n\n\nreturn 0;\n}\n/* 1512830800117 */\n"}, {"source_code": "#include \n#include \n#include\n\nint main()\n{\n int n,i,l,x=0,y=0,count = 0;\n char a[100];\n scanf(\"%d\",&n);\n scanf(\"%s\",a);\n l = strlen(a);\n if(l==n)\n {\n for(i=0;i\n#define min(a,b) ((a)<(b))?a:b\nint main()\n{\n\t\n\tint l=0,r=0,u=0,d=0;\n\tchar c;\n\tint i,n;\n\tscanf(\"%d\",&n);\n\t\n\tfor(i=0;i\n\nint main(){\n int n; scanf(\"%d \", &n);\n\n int x=0, y=0, cnt=0, ans=1<<25;\n while(n--){\n char ch;\n ch = getchar();\n if (ch=='U') y++;\n else if (ch=='D') y--;\n else if (ch=='L') x--;\n else if (ch=='R') x++;\n cnt++;\n if( x==0 && y==0){\n if (cnt\n#include \n\nint main(void) {\n\tint n;\n\tscanf(\"%d \",&n);\n\tchar commands[100];\n\tgets(commands);\n\tint i,U=0,D=0,L=0,R=0;\n\tfor(i=0;i\n#include \n#include\n\nint main()\n{\n int n,i,l,x=0,y=0,count = 0;\n char a[1000];\n scanf(\"%d\",&n);\n scanf(\"%s\",a);\n l = strlen(a);\n if(l==n)\n {\n\n for(i=0;i\n#include\nint main()\n{\n int i,j,k,n,c,x,y,p,q,r;;\n scanf(\"%d\",&n);\n char s[2000];\n scanf(\"%s\",s);\n x=0;\n y=0;\n c=0;\n p=0;\n q=0;\n r=0;\n for(i=0;i\n\nint main()\n{\n int Comandos, Linha = 0, Coluna = 0, i, Contagem = 0, Resposta=0;\n scanf(\"%d\", &Comandos);\n getchar();\n\n char str[Comandos+1];\n fgets(str,Comandos+1,stdin);\n\n for (i=0;i\n#include \n\nint main(int argc, char const *argv[])\n{\n\tint pos_x = 0, pos_y = 0;\n\n\tint max = 0;\n\n\tint n;\n\tscanf(\"%d\", &n);\n\n\tgetchar();\n\n\tchar comando[100];\n\tscanf(\"%[^\\n]\", comando);\n\n\tint i;\n\tfor (i = 0; i < n; i++)\n\t{\n\t\tif (comando[i] == 'U') pos_y++;\n\t\telse if (comando[i] == 'D') pos_y--;\n\t\telse if (comando[i] == 'R') pos_x++;\n\t\telse pos_x--;\n\n\t\tif (pos_x == 0 && pos_y == 0) max = i+1;\n\t}\n\n\tprintf(\"%d\\n\", max );\n\n\treturn 0;\n}\n/* 1512828316954 */\n"}, {"source_code": "#include \n\nint main(void) {\n\tint n;\n\tscanf(\"%d\", &n);\n\tchar udlr;\n\tint xf = 0;\n\tint yf = 0;\n\tfor(int i = 0; i < n; ++i){\n\t\tscanf(\" %c\", &udlr);\n\t\tif(udlr == 'U'){\n\t\t\t++yf;\n\t\t}\n\t\telse if(udlr == 'D'){\n\t\t\t--yf;\n\t\t}\n\t\telse if(udlr == 'R'){\n\t\t\t++xf;\n\t\t}\n\t\telse if(udlr == 'L'){\n\t\t\t--xf;\n\t\t}\n\t}\n\tprintf(\"%d\\n\", n-xf-yf);\n\treturn 0;\n}\n\n/* 1515093055897 */\n"}, {"source_code": "#include \n\nint main(){\n int n,count = 0;\n int boo = 0;\n scanf(\"%d\",&n);\n getchar();\n char cm[n];\n for(int i = 0; i\n\nint main(){\n int n,count = 0;\n int boo = 0;\n scanf(\"%d\",&n);\n getchar();\n char cm[n];\n for(int i = 0; i\n\nchar vec[101];\n\nint main() {\n\tint n, x = 0, y = 0;\n\tscanf(\"%d\", &n);\n\t\n\tscanf(\"%s\", vec);\n\n\tfor (int i = 0; i <= n; i++) {\n\t\tif (vec[i] == 'L') x--;\n\t\tif (vec[i] == 'R') x++;\n\t\tif (vec[i] == 'D') y--;\n\t\tif (vec[i] == 'U') y++;\n\t\n\t\tif (x == 0 && y == 0) { printf(\"%d\", i + 1); return 0; }\n\t}\n\tprintf(\"0\");\n}"}, {"source_code": "#include \n#include \n\nint x = 0, y = 0, n, i, s;\nchar d[101];\n\nint main()\n{\n scanf(\"%d\", &n);\n if ((n >= 1) && (n <= 100))\n {\n n++;\n for (i = 1; i <= n; i++) scanf(\"%c\", &d[i]);\n s = 0;\n for (i = 1; i <= n; i++)\n {\n switch(d[i])\n {\n case 'U' : y++; break;\n case 'D' : y--; break;\n case 'L' : x--; break;\n case 'R' : x++; break;\n }\n if ((x == 0) && (y == 0)) s = i;\n }\n s--;\n printf(\"%d\", s);\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main(int argc, char const *argv[])\n{\n\tint pos_x = 0, pos_y = 0;\n\n\tint max = 0;\n\n\tint n;\n\tscanf(\"%d\", &n);\n\n\tgetchar();\n\n\tchar comando[100];\n\tscanf(\"%[^\\n]\", comando);\n\n\tint i;\n\tfor (i = 0; i < n; i++)\n\t{\n\t\tif (comando[i] == 'U') pos_y++;\n\t\telse if (comando[i] == 'D') pos_y--;\n\t\telse if (comando[i] == 'R') pos_x++;\n\t\telse if (comando[i] == 'L') pos_x--;\n\n\t\tif (pos_x == 0 && pos_y == 0) max = i+1;\n\t}\n\n\tprintf(\"%d\\n\", max );\n\n\treturn 0;\n}\n/* 1512828513351 */\n"}, {"source_code": "#include \n\nint main()\n{\n char c;\n int i, n, x, y, t;\n\n scanf(\"%d \", &n);\n\n x = 0;\n y = 0;\n t = 0;\n for (i = 0; i < n; ++i) {\n c = getchar();\n\n switch (c) {\n case 'U':\n ++y;\n break;\n case 'D':\n --y;\n break;\n case 'L':\n --x;\n break;\n case 'R':\n ++x;\n break;\n }\n\n if (x == 0 && y == 0) {\n t = i + 1;\n }\n }\n\n printf(\"%d\\n\", t);\n\n return 0;\n}\n"}, {"source_code": "#include \n#define rep(i,a,b) for (int i=a; i\n\nint main(){\n\tint s;\n\tscanf(\" %d\",&s);\n\tchar ac[s+1];\n\tscanf(\" %s\",ac);\n\tint max = 0;\n\tfor(int j = 0; j < s;++j){\n\t\tint ans = 0;\n\t\tint x = 0, y = 0;\n\t\tfor(int i = j; i < s;++i){\n\t\t\tchar a = ac[i];\n\t\t\tif(a == 'R')\n\t\t\t\t++x;\n\t\t\tif(a == 'U')\n\t\t\t\t++y;\n\t\t\tif(a == 'D')\n\t\t\t\t--y;\n\t\t\tif(a == 'L')\n\t\t\t\t--x;\n\t\t\tif(x == 0 && y == 0)\n\t\t\t\tans = i+1;\n\t\t//printf(\"i es %d x es %d y es %d\\n\",i,x,y);\n\t\t//puts(\"\");\n\t\t}\n\t\tif(ans > max)\n\t\t\tmax = ans;\n\t}\n\tprintf(\"%d\\n\",max);\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\nint main(int argc, char const *argv[])\n{\n\tint pos_x = 0, pos_y = 0;\n\n\tint max = 0;\n\n\tint n;\n\tscanf(\"%d\", &n);\n\n\tgetchar();\n\n\tchar comando[100];\n\tscanf(\"%[^\\n]\", comando);\n\n\tint i;\n\tfor (i = 0; i < n; i++)\n\t{\n\t\tif (comando[i] == 'U') pos_y++;\n\t\telse if (comando[i] == 'D') pos_y--;\n\t\telse if (comando[i] == 'R') pos_x++;\n\t\telse if (comando[i] == 'L') pos_x--;\n\n\t\tif (pos_x == 0 && pos_y == 0) max = i+1;\n\t}\n\n\tprintf(\"%d\", max );\n\n\treturn 0;\n}\n/* 1512828801534 */\n"}, {"source_code": "#include\n#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n char A[n],i;\n scanf(\"%s\",&A);\n int l=strlen(A);\n int x=0,y=0,c=1,d=0;\n for(i=0;i\n#include \n#include \n\nint main()\n{\n\tint x = 0, y = 0;\n\tint n, max = 0;\n\n\tscanf(\"%d\", &n);\n\tgetchar();\n\tchar comandos[n];\n\tscanf(\"%s\",comandos);\n\tint i;\n\tfor(i = 0; i < strlen(comandos); i++)\n\t{\n\t\tif(comandos[i] == 'U') y++;\n\t\tif(comandos[i] == 'D') y--;\n\t\tif(comandos[i] == 'L') x--;\n\t\tif(comandos[i] == 'R') x++;\n\n\t\tif(x == 0 && y == 0) max = i + 1;\n\n\t}\n\n\tprintf(\"%d\\n\",max );\n\n\n}\n/* 1512826270114 */\n"}, {"source_code": "#include \n#include \nint main()\n{\n\tint contador=0,com=0,n,i=0;\n\tscanf(\"%d\",&n);\n\tchar frase[n];\n\tscanf(\" %s\",frase);\n\t//printf(\"%d %s\\n\",n,frase);\n\tfor(i=0;i < strlen(frase);i++)\n\t{\n\t\tif(frase[i] == 'U' )\n\t\t{\n\t\t\t++contador;\n\t\t}\n\t\telse if(frase[i] == 'D')\n\t\t{\n\t\t\t--contador;\n\t\t}\n\t\telse if(frase[i] == 'L')\n\t\t{\n\t\t\t--contador;\n\t\t}\n\t\telse if(frase[i] == 'R')\n\t\t{\n\t\t\t++contador;\n\t\t}\n\t\tif(contador == 0) com += i+1;\n\t}\n\tprintf(\"%d\\n\",com);\n\t\n\t\n\n\n\n\n\n\n\nreturn 0;\n}\n/* 1512829803627 */\n"}, {"source_code": "#include\n#include\nint main()\n{\n int i,j,k,n,c,x,y;\n scanf(\"%d\",&n);\n char s[2000];\n scanf(\"%s\",s);\n x=0;\n y=0;\n c=0;\n for(i=0;i\nint main()\n{\n int num,i=0,x1=0,y1=0;\n int ex=0;\n char ch[1005];\n scanf(\"%d\",&num);\n getchar();\n for(i=0;i\n#include \n\nint main(void) {\n\tint n=88;\n\t//scanf(\"%d \",&n);\n\tchar commands[100];\n\tgets(commands);\n\tint i,U=0,D=0,L=0,R=0,m=0;\n\tfor(i=0;i\nint main()\n{\n\tint sumu=0,sumd=0,suml=0,sumr=0,sum=0,k,n,sumaw[100],tmp=0;\n\tchar t[102];\n\tscanf(\"%d\",&n);\n\tgetchar();\n\tgets(t);\n\tfor(k=0;k\n#include \n\nint main(int argc, char const *argv[])\n{\n\tint pos_x = 0, pos_y = 0;\n\n\tint max = 0;\n\n\tint n;\n\tscanf(\"%d\", &n);\n\n\tgetchar();\n\n\tchar comando[100];\n\tscanf(\"%[^\\n]\", comando);\n\n\tint i;\n\tfor (i = 0; i < n; i++)\n\t{\n\t\tif (comando[i] == 'U') pos_y++;\n\t\telse if (comando[i] == 'D') pos_y--;\n\t\telse if (comando[i] == 'R') pos_x++;\n\t\telse if (comando[i] == 'L') pos_x--;\n\n\t\tif (pos_x == 0 && pos_y == 0) max = i+1;\n\t}\n\n\tprintf(\"%d\\n\", max );\n\n\treturn 0;\n}\n/* 1512828513351 */\n"}, {"source_code": "#include \n#include \n#include \n\nint main()\n{\n\tint x = 0, y = 0;\n\tint n, max = 0;\n\n\tscanf(\"%d\", &n);\n\tgetchar();\n\tchar comandos[n];\n\tscanf(\"%s\",comandos);\n\tint i;\n\tfor(i = 0; i < strlen(comandos); i++)\n\t{\n\t\tif(comandos[i] == 'U') y++;\n\t\tif(comandos[i] == 'D') y--;\n\t\tif(comandos[i] == 'L') x--;\n\t\tif(comandos[i] == 'R') x++;\n\n\t\tif(x == 0 && y == 0) max = i + 1;\n\n\t}\n\n\tprintf(\"%d\\n\",max );\n\n\n}\n/* 1512826290791 */\n"}, {"source_code": "#include\n#include\n#include\nchar str[10000];\n\nint main(){\nint n,i,j,k,l,d,u,r,m,x=0,y=0,L;\nl=0;d=0;r=0;u=0;\nscanf(\"%d%s\",&n,str);\nL = strlen(str);\n\nfor(i=0;i\n#include \n\nint x=0,y=0;\nvoid move(char c);\nint main() {\n\tint n,i=0,z=0;\n\tscanf(\"%d\",&n);\n\tchar c[n];\n\tscanf(\"%s\",c);\n\twhile(i\n\n/*\n * http://codeforces.com/contest/888/problem/C\n */\nint main()\n{\n int i, n, x, y, t;\n char c[101] = { 0 };\n\n scanf(\"%d \", &n);\n\n scanf(\"%s \", c);\n\n x = 0;\n y = 0;\n t = 0;\n for (i = 0; i < n; ++i) {\n switch (c[i]) {\n case 'U':\n y += 1;\n break;\n case 'D':\n y -= 1;\n break;\n case 'L':\n x -= 1;\n break;\n case 'R':\n x += 1;\n break;\n default:\n printf(\"what\");\n }\n\n if (x == 0 && y == 0) {\n t = i + 1;\n }\n }\n\n printf(\"%d\\n\", t);\n\n return 0;\n}\n"}, {"source_code": "#include \n\nchar s[110];\n\nint main() {\n\tint n, i;\n\tint x = 0;\n\tint y = 0;\n\tint o = 0;\n\tscanf(\"%d\", &n);\n\tscanf(\"%s\", s);\n\tfor (i=0; i\n#include \n#include \n\nint main()\n{\n\tint x = 0, y = 0;\n\tint n, max = 0;\n\n\tscanf(\"%d\", &n);\n\tgetchar();\n\tchar comandos[n];\n\tscanf(\"%s\",comandos);\n\tint i;\n\tfor(i = 0; i < strlen(comandos); i++)\n\t{\n\t\tif(comandos[i] == 'U') y++;\n\t\tif(comandos[i] == 'D') y--;\n\t\tif(comandos[i] == 'L') x--;\n\t\tif(comandos[i] == 'R') x++;\n\n\t\tif(x == 0 && y == 0) max = i + 1;\n\n\t}\n\n\tprintf(\"%d\\n\",max );\n\n\n}\n/* 1512826573931 */\n"}, {"source_code": "#include\n\nint main(){\n\tint s;\n\tscanf(\" %d\",&s);\n\tint ans = 0;\n\tint x = 0, y = 0;\n\tfor(int i = 0; i < s;++i){\n\t\tchar a;\n\t\tscanf(\" %c\",&a);\n\t\tif(a == 'R')\n\t\t\t++x;\n\t\tif(a == 'U')\n\t\t\t++y;\n\t\tif(a == 'D')\n\t\t\t--y;\n\t\tif(a == 'L')\n\t\t\t--x;\n\t\tif(x == 0 && y == 0)\n\t\t\tans = i+1;\n\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}"}, {"source_code": "#include\n\nchar vec[1001];\n\nint main() {\n\tint n, x = 0, y = 0;\n\tint temp = 0;\n\tscanf(\"%d\", &n);\n\t\n\tscanf(\"%s\", vec);\n\n\tfor (int i = 0; i < n; i++) {\n\t\tif (vec[i] == 'L') x--;\n\t\tif (vec[i] == 'R') x++;\n\t\tif (vec[i] == 'D') y--;\n\t\tif (vec[i] == 'U') y++;\n\t\n\t\tif (x == 0 && y == 0) temp = i + 1;\n\t}\n\tif (temp == 0)\n\t\tprintf(\"0\");\n\telse\n\t\tprintf(\"%d\", temp);\n}"}, {"source_code": "#include\n#include\n#include\nvoid main()\n{\nint n,i,x,y,count,max;count=max=0;char s[500];x=y=0;\nscanf(\"%d\",&n);\nscanf(\"%s\",s);\n\nfor(i=0;i\n\nint main(){\n\nint n;\n\nscanf(\"%d\",&n);\n\nchar command[101];\n\nscanf(\"%s\",command);\n\nint i;\nint max=0;\nint x=0;int y=0;\nfor(i=0;i\n\nchar s[110];\n\nint main() {\n\tint n, i;\n\tint x = 0;\n\tint y = 0;\n\tint o = 0;\n\tscanf(\"%d\", &n);\n\tscanf(\"%s\", s);\n\tfor (i=0; i\n#include \n\nint main(int argc, char const *argv[])\n{\n\tint pos_x = 0, pos_y = 0;\n\n\tint n;\n\tscanf(\"%d\", &n);\n\n\tgetchar();\n\n\tchar comando[100];\n\tscanf(\"%[^\\n]\", comando);\n\n\tint i;\n\tfor (i = 0; i < n; i++)\n\t{\n\t\tif (comando[i] == 'U') pos_y++;\n\t\telse if (comando[i] == 'D') pos_y--;\n\t\telse if (comando[i] == 'R') pos_x++;\n\t\telse if (comando[i] == 'L') pos_x--;\n\t}\n\n\tprintf(\"%d\", (n - pos_x - pos_y) );\n\n\treturn 0;\n}"}, {"source_code": "#include \n\n#define MAX_COMMANDS 100\n\n\nint\t\tmain(void)\n{\n\tchar commands[MAX_COMMANDS + 1];\n\tint num_commands;\n\tint max_poss_commands;\n\tint lr_dist;\n\tint ud_dist;\n\n\tcommands[MAX_COMMANDS] = '\\0';\n\n\tscanf(\"%d\\n\", &num_commands);\n\tfor (int i = 0; i < num_commands; i++)\n\t\tscanf(\"%c\", &commands[i]);\n\n\tlr_dist = 0;\n\tud_dist = 0;\n\tmax_poss_commands = 0;\n\tfor (int i = 0; i < num_commands; i++)\n\t{\n\t\tif (commands[i] == 'L')\n\t\t\tlr_dist--;\n\t\telse if (commands[i] == 'R')\n\t\t\tlr_dist++;\n\t\telse if (commands[i] == 'U')\n\t\t\tud_dist++;\n\t\telse if (commands[i] == 'D')\n\t\t\tud_dist--;\n\n\t\tif (lr_dist == 0 && ud_dist == 0)\n\t\t\tmax_poss_commands = i + 1;\n\t}\n\tprintf(\"%d\\n\", max_poss_commands);\n\treturn (0);\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n\nint x = 0, y = 0, aux = 0, cont = 0, rep, i;\nscanf(\"%d\", &rep);\nchar comando[100];\nscanf(\" %s\", comando);\n\n\tfor(i = 0; i < rep; i++)\n\t{\n\t\tif(comando[i] == 'U') y++;\n\t\telse if(comando[i] == 'D') y--; \n\t\telse if(comando[i] == 'L') x--;\n\t\telse x++;\n// printf(\"x = %d, y = %d\\n\", x, y);\n\t\tif(x == 0 && y == 0){\n//\t\tputs(\"entrou\");\n\t\tcont++;\n\t\tif(cont > aux){\n\t\taux = cont;\n\t\tcont = 0;\t\n\t\t} \n\t\t}\n\t\telse cont ++;\n\t}\n\t\nprintf(\"%d\", aux);\n\nreturn 0;\n\n}\n\n/* 1512829528286 */\n"}, {"source_code": "#include \n\nchar s[110];\n\nint main() {\n\tint n, i;\n\tint x = 0;\n\tint y = 0;\n\tint o = 0;\n\tscanf(\"%d\", &n);\n\tscanf(\"%s\", s);/*\n\tfor (i=0; i\n#include \n\n\nint main() {\n int n;\n scanf(\"%d\", &n);\n int ct;\n int right, left, up, down;\n right = left = up = down = 0;\n for (ct = 0; ct <= n; ct++) {\n char temp;\n scanf(\"%c\", &temp);\n if(temp == 'U'){\n up++;\n }\n if(temp == 'L'){\n left++;\n }\n if(temp == 'R'){\n right++;\n }\n if(temp == 'D'){\n down++;\n }\n }\n\n int minx, miny;\n if(right == left){\n minx = right + down;\n }else{\n minx = (right < left) ? right : left;\n }\n if(up == down){\n miny = up + down;\n }else {\n miny = (up < down) ? up : down;\n }\n printf(\"%d\", minx + miny);\n\n}"}, {"source_code": "/*\n ============================================================================\n Name : puggy.c\n Author : Hossam Tourki\n Version :\n Copyright : Your copyright notice\n Description : Hello World in C, Ansi-style\n ============================================================================\n */\n\n#include \n#include \n\nint main(void) {\n\tint n;\n\tscanf(\"%d \",&n);\n\tchar commands[100];\n\tgets(commands);\n\tint i,U=0,D=0,L=0,R=0;\n\tfor(i=0;i\n#include \n\nint main(int argc, char const *argv[])\n{\n\tint pos_x = 0, pos_y = 0;\n\n\tint max = 0;\n\n\tint n;\n\tscanf(\"%d\", &n);\n\n\tgetchar();\n\n\tchar comando[100];\n\tscanf(\"%[^\\n]\", comando);\n\n\tint i;\n\tfor (i = 0; i < n; i++)\n\t{\n\t\tif (comando[i] == 'U') pos_y++;\n\t\telse if (comando[i] == 'D') pos_y--;\n\t\telse if (comando[i] == 'R') pos_x++;\n\t\telse if (comando[i] == 'L') pos_x--;\n\n\t\tif (pos_x == 0 && pos_y == 0) max = i+1;\n\t}\n\n\tprintf(\"%d\\n\", max );\n\n\treturn 0;\n}\n/* 1512828513351 */\n"}, {"source_code": "#include \n\nint main(){\n int n,count = 0;\n int boo = 0;\n scanf(\"%d\",&n);\n getchar();\n char cm[n];\n for(int i = 0; i\n#include \n\nint main(void) {\n\tint n;\n\tscanf(\"%d \",&n);\n\tchar commands[100];\n\tgets(commands);\n\tint i,U=0,D=0,L=0,R=0;\n\tfor(i=0;i\n#include\nint main()\n{\n char s[105];\n int i,n,x,xx,y,yy,cx,cy,total;\n while(~scanf(\"%d\",&n))\n {\n getchar();\n scanf(\"%s\",s);\n x=0;\n y=0;\n for(i=0;in)\n {\n xx=xx%n;\n }\n if(yy>n)\n {\n yy=yy%n;\n }\n total=xx+yy;\n printf(\"%d\\n\",total);\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(void) {\n\tint n;\n\tscanf(\"%d\", &n);\n\tchar udlr;\n\tint xf = 0;\n\tint yf = 0;\n\tfor(int i = 0; i < n; ++i){\n\t\tscanf(\" %c\", &udlr);\n\t\tif(udlr == 'U'){\n\t\t\t++yf;\n\t\t}\n\t\telse if(udlr == 'D'){\n\t\t\t--yf;\n\t\t}\n\t\telse if(udlr == 'R'){\n\t\t\t++xf;\n\t\t}\n\t\telse if(udlr == 'L'){\n\t\t\t--xf;\n\t\t}\n\t}\n\tprintf(\"%d\\n\", n-xf-yf);\n\treturn 0;\n}\n\n/* 1515093055897 */\n"}, {"source_code": "#include \n#include \n#include\nint Buggy_Robot(int n, char seq[])\n{\n int i,u=0,d=0,l=0,r=0;\n for (i=0;i\n\nint main()\n{\n int Comandos, Linha = 0, Coluna = 0, i, Contagem = 0, Resposta=0;\n scanf(\"%d\", &Comandos);\n getchar();\n\n char str[Comandos+1];\n fgets(str,Comandos+1,stdin);\n\n for (i=0;i\n#include \n\nint main()\n{\n int n, count = 0, L = 0, U = 0 , D = 0, R = 0, i;\n\n scanf(\"%d\", &n);\n\n for(i = 0; i\n#include \n#include\nint Buggy_Robot(int n, char seq[])\n{\n int i,u=0,d=0,l=0,r=0;\n for (i=0;i\n#include\nint main()\n{\n char s[105];\n int i,n,x,xx,y,yy,cx,cy,total;\n while(~scanf(\"%d\",&n))\n {\n getchar();\n scanf(\"%s\",s);\n x=0;\n y=0;\n for(i=0;in)\n {\n xx=xx%n;\n }\n if(yy>n)\n {\n yy=yy%n;\n }\n total=xx+yy;\n printf(\"%d\\n\",total);\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#define MIN(a,b)((a < b) ? a : b ) \n#define ABS(a)((a < 0) ? -1 * a : a)\nint main()\n{\n\tint l=0,d=0,r=0,u=0,n,i=0;\n\tscanf(\"%d\",&n);\n\tchar frase[n];\n\tscanf(\" %s\",frase);\n\t//printf(\"%d %s\\n\",n,frase);\n\tfor(i=0;i < strlen(frase);i++)\n\t{\n\t\tif(frase[i] == 'U' )\n\t\t{\n\t\t\t++u;\n\t\t}\n\t\telse if(frase[i] == 'D')\n\t\t{\n\t\t\t--d;\n\t\t}\n\t\telse if(frase[i] == 'L')\n\t\t{\n\t\t\t--l;\n\t\t}\n\t\telse if(frase[i] == 'R')\n\t\t{\n\t\t\t++r;\n\t\t}\n\t}\n\tint minx = MIN(l,r);\n\tint miny = MIN(u,d);\n\tprintf(\"%d\\n\",ABS((minx+miny)*2));\n\n\n\n\n\n\n\nreturn 0;\n}\n/* 1512830800117 */\n"}, {"source_code": "#include\n\nint main()\n{\n\n\tint n,i;\n\tint lcount=0,rcount=0,dcount=0,ucount=0,count=0;\n\n\tchar a[105];\n\n\tscanf(\"%d\",&n);\n\n\tfor(i=0;i\n#include \n\nint main(void) {\n\tint n=88;\n\t//scanf(\"%d \",&n);\n\tchar commands[100];\n\tgets(commands);\n\tint i,U=0,D=0,L=0,R=0,m=0;\n\tfor(i=0;i\n#include\n#include\nchar str[10000];\n\nint main(){\nint n,i,j,k,l,d,u,r,m,x=0,y=0,L;\nl=0;d=0;r=0;u=0;\nscanf(\"%d%s\",&n,str);\nL = strlen(str);\n\nfor(i=0;i\n#include \n#include \n#define MIN(a,b)((a < b) ? a : b ) \n#define ABS(a)((a < 0) ? -1 * a : a)\nint main()\n{\n\tint l=0,d=0,r=0,u=0,n,i=0;\n\tscanf(\"%d\",&n);\n\tchar frase[n];\n\tscanf(\" %s\",frase);\n\t//printf(\"%d %s\\n\",n,frase);\n\tfor(i=0;i < strlen(frase);i++)\n\t{\n\t\tif(frase[i] == 'U' )\n\t\t{\n\t\t\t++u;\n\t\t}\n\t\telse if(frase[i] == 'D')\n\t\t{\n\t\t\t--d;\n\t\t}\n\t\telse if(frase[i] == 'L')\n\t\t{\n\t\t\t--l;\n\t\t}\n\t\telse if(frase[i] == 'R')\n\t\t{\n\t\t\t++r;\n\t\t}\n\t}\n\tint minx = MIN(l,r);\n\tint miny = MIN(u,d);\n\tprintf(\"%d\\n\",ABS((minx+miny)*2));\n\n\n\n\n\n\n\nreturn 0;\n}"}, {"source_code": "#include \n#include \n#include \n\nint main()\n{\n\tint x = 0, y = 0;\n\tint n, max = 0;\n\n\tscanf(\"%d\", &n);\n\tgetchar();\n\tchar comandos[n];\n\tscanf(\"%s\",comandos);\n\tint i;\n\tfor(i = 0; i < strlen(comandos); i++)\n\t{\n\t\tif(comandos[i] == 'U') y++;\n\t\tif(comandos[i] == 'D') y--;\n\t\tif(comandos[i] == 'L') x--;\n\t\tif(comandos[i] == 'R') x++;\n\n\t\tif(x == 0 && y == 0) max = i + 1;\n\n\t}\n\n\tprintf(\"%d\\n\",max );\n\n\n}\n/* 1512826270114 */\n"}, {"source_code": "#include\n\nchar vec[101];\n\nint main() {\n\tint n, x = 0, y = 0;\n\tscanf(\"%d\", &n);\n\t\n\tscanf(\"%s\", vec);\n\n\tfor (int i = 0; i <= n; i++) {\n\t\tif (vec[i] == 'L') x--;\n\t\tif (vec[i] == 'R') x++;\n\t\tif (vec[i] == 'D') y--;\n\t\tif (vec[i] == 'U') y++;\n\t\n\t\tif (x == 0 && y == 0) { printf(\"%d\", i + 1); return 0; }\n\t}\n\tprintf(\"0\");\n}"}, {"source_code": "#include \n#include \n#include\n\nint main()\n{\n int n,i,l,x=0,y=0,count = 0;\n char a[100];\n scanf(\"%d\",&n);\n scanf(\"%s\",a);\n l = strlen(a);\n if(l==n)\n {\n for(i=0;i\n\n/*\n * http://codeforces.com/contest/888/problem/C\n */\nint main()\n{\n int i, n, x, y, t;\n char c[101] = { 0 };\n\n scanf(\"%d \", &n);\n\n scanf(\"%s \", c);\n\n x = 0;\n y = 0;\n t = 0;\n for (i = 0; i < n; ++i) {\n switch (c[i]) {\n case 'U':\n y += 1;\n break;\n case 'D':\n y -= 1;\n break;\n case 'L':\n x -= 1;\n break;\n case 'R':\n x += 1;\n break;\n default:\n printf(\"what\");\n }\n\n if (x == 0 && y == 0) {\n t = i + 1;\n }\n }\n\n printf(\"%d\\n\", t);\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint x = 0, y = 0, n, i, s;\nchar d[3000];\n\nint main()\n{\n scanf(\"%d\", &n);\n for (i = 0; i <= n; i++) scanf(\"%c\", &d[i]);\n s = 0;\n for (i = 1; i <= n; i++)\n {\n switch(d[i])\n {\n case 'U' : y++; break;\n case 'D' : y--; break;\n case 'L' : x--; break;\n case 'R' : x++; break;\n }\n if ((x == 0) && (y == 0)) s = i;\n }\n printf(\"%d\", s);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\nint main()\n{\n\tint x = 0, y = 0;\n\tint n, max = 0;\n\n\tscanf(\"%d\", &n);\n\tgetchar();\n\tchar comandos[n];\n\tscanf(\"%s\",comandos);\n\tint i;\n\tfor(i = 0; i < strlen(comandos); i++)\n\t{\n\t\tif(comandos[i] == 'U') y++;\n\t\tif(comandos[i] == 'D') y--;\n\t\tif(comandos[i] == 'L') x--;\n\t\tif(comandos[i] == 'R') x++;\n\n\t\tif(x == 0 && y == 0) max = i + 1;\n\n\t}\n\n\tprintf(\"%d\\n\",max );\n\n\n}\n/* 1512826328718 */\n"}, {"source_code": "#include\n\nchar vec[1001];\n\nint main() {\n\tint n, x = 0, y = 0;\n\tint temp = 0;\n\tscanf(\"%d\", &n);\n\t\n\tscanf(\"%s\", vec);\n\n\tfor (int i = 0; i < n; i++) {\n\t\tif (vec[i] == 'L') x--;\n\t\tif (vec[i] == 'R') x++;\n\t\tif (vec[i] == 'D') y--;\n\t\tif (vec[i] == 'U') y++;\n\t\n\t\tif (x == 0 && y == 0) temp = i + 1;\n\t}\n\tif (temp == 0)\n\t\tprintf(\"0\");\n\telse\n\t\tprintf(\"%d\", temp);\n}"}, {"source_code": "#include \n\nint main()\n{\n int i, n, x, y, t;\n char c[101] = { 0 };\n\n scanf(\"%d \", &n);\n\n scanf(\"%s \", c);\n\n x = 0;\n y = 0;\n t = 0;\n for (i = 0; i < n; ++i) {\n switch (c[i]) {\n case 'U':\n y += 1;\n break;\n case 'D':\n y -= 1;\n break;\n case 'L':\n x -= 1;\n break;\n case 'R':\n x += 1;\n break;\n default:\n printf(\"what\");\n }\n\n if (x == 0 && y == 0) {\n t = i + 1;\n }\n }\n\n printf(\"%d\\n\", t);\n\n return 0;\n}\n"}, {"source_code": "\n#include \n\nint main(){\n int n; scanf(\"%d \", &n);\n\n int x=0, y=0, cnt=0, ans=0;\n while(n--){\n char ch;\n ch = getchar();\n if (ch=='U') y++;\n else if (ch=='D') y--;\n else if (ch=='L') x--;\n else if (ch=='R') x++;\n cnt++, ans++;\n if( x==0 && y==0){\n cnt=0;\n }\n }\n printf(\"%d\\n\", ans-cnt<0?0:ans-cnt);\n}\n"}, {"source_code": "#include \n#include \n\nint x = 0, y = 0, n, i, s;\nchar d[101];\n\nint main()\n{\n scanf(\"%d\", &n);\n if ((n >= 1) && (n <= 100))\n {\n scanf(\"\\n\");\n for (i = 1; i <= n; i++) scanf(\"%c\", &d[i]);\n s = 0;\n for (i = 1; i <= n; i++)\n {\n switch(d[i])\n {\n case 'U' : y++; break;\n case 'D' : y--; break;\n case 'L' : x--; break;\n case 'R' : x++; break;\n }\n if ((x == 0) && (y == 0)) s = i;\n }\n printf(\"%d\", s);\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(){\n int n,count = 0;\n int boo = 0;\n scanf(\"%d\",&n);\n getchar();\n char cm[n];\n for(int i = 0; i\nint com[150];\nchar s[1005];\n\nint min(int a, int b)\n{\n return a < b ? a : b;\n}\n\nint main()\n{\n int n, i, tot;\n scanf(\"%d%s\", &n, s);\n for(i = 1000; i < n; ++i)\n ++com[s[i]];\n tot = 2 * (min(com['U'], com['D']) + min(com['L'], com['R']));\n printf(\"%d\\n\", tot);\n return 0;\n}"}, {"source_code": "#include \n#include \n\n\nint main() {\n int n;\n scanf(\"%d\", &n);\n int ct;\n int right, left, up, down;\n right = left = up = down = 0;\n for (ct = 0; ct <= n; ct++) {\n char temp;\n scanf(\"%c\", &temp);\n if(temp == 'U'){\n up++;\n }\n if(temp == 'L'){\n left++;\n }\n if(temp == 'R'){\n right++;\n }\n if(temp == 'D'){\n down++;\n }\n }\n\n int minx, miny;\n if(right == left){\n minx = right + down;\n }else{\n minx = (right < left) ? right : left;\n }\n if(up == down){\n miny = up + down;\n }else {\n miny = (up < down) ? up : down;\n }\n printf(\"%d\", minx + miny);\n\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n,op=0;\n scanf(\"%d\\n\",&n);\n char x[n];\n gets(x);\n int i,u=0,l=0,d=0,r=0;\n for(i=0;i=d)\n op=2*d;\n if (r>=l)\n op+=2*l;\n printf(\"%d\",op);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint x = 0, y = 0, n, i, s;\nchar d[101];\n\nint main()\n{\n scanf(\"%d\", &n);\n for (i = 0; i <= n; i++) scanf(\"%c\", &d[i]);\n s = 0;\n for (i = 1; i <= n; i++)\n {\n switch(d[i])\n {\n case 'U' : y++; break;\n case 'D' : y--; break;\n case 'L' : x--; break;\n case 'R' : x++; break;\n }\n if ((x == 0) && (y == 0)) s = i;\n }\n printf(\"%d\", s);\n return 0;\n}\n"}], "src_uid": "b9fa2bb8001bd064ede531a5281cfd8a"} {"nl": {"description": "Nowadays, most of the internet advertisements are not statically linked to a web page. Instead, what will be shown to the person opening a web page is determined within 100 milliseconds after the web page is opened. Usually, multiple companies compete for each ad slot on the web page in an auction. Each of them receives a request with details about the user, web page and ad slot and they have to respond within those 100 milliseconds with a bid they would pay for putting an advertisement on that ad slot. The company that suggests the highest bid wins the auction and gets to place its advertisement. If there are several companies tied for the highest bid, the winner gets picked at random.However, the company that won the auction does not have to pay the exact amount of its bid. In most of the cases, a second-price auction is used. This means that the amount paid by the company is equal to the maximum of all the other bids placed for this ad slot.Let's consider one such bidding. There are n companies competing for placing an ad. The i-th of these companies will bid an integer number of microdollars equiprobably randomly chosen from the range between Li and Ri, inclusive. In the other words, the value of the i-th company bid can be any integer from the range [Li, Ri] with the same probability. Determine the expected value that the winner will have to pay in a second-price auction.", "input_spec": "The first line of input contains an integer number n (2 ≤ n ≤ 5). n lines follow, the i-th of them containing two numbers Li and Ri (1 ≤ Li ≤ Ri ≤ 10000) describing the i-th company's bid preferences. This problem doesn't have subproblems. You will get 8 points for the correct submission.", "output_spec": "Output the answer with absolute or relative error no more than 1e - 9.", "sample_inputs": ["3\n4 7\n8 10\n5 5", "3\n2 5\n3 4\n1 6"], "sample_outputs": ["5.7500000000", "3.5000000000"], "notes": "NoteConsider the first example. The first company bids a random integer number of microdollars in range [4, 7]; the second company bids between 8 and 10, and the third company bids 5 microdollars. The second company will win regardless of the exact value it bids, however the price it will pay depends on the value of first company's bid. With probability 0.5 the first company will bid at most 5 microdollars, and the second-highest price of the whole auction will be 5. With probability 0.25 it will bid 6 microdollars, and with probability 0.25 it will bid 7 microdollars. Thus, the expected value the second company will have to pay is 0.5·5 + 0.25·6 + 0.25·7 = 5.75."}, "positive_code": [{"source_code": "/* practice with Dukkha */\n#include \n\n#define N\t5\n\nint max(int a, int b) { return a > b ? a : b; }\n\ndouble prob(int l, int r, int a) {\n\treturn (double) max(r - max(l, a) + 1, 0) / (r - l + 1);\n}\n\nint main() {\n\tstatic int ll[N], rr[N];\n\tint n, i, j, a;\n\tdouble ans, p, q;\n\n\tscanf(\"%d\", &n);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%d%d\", &ll[i], &rr[i]);\n\tans = 0;\n\tfor (a = 1; a <= 10000; a++) {\n\t\tp = 1;\n\t\tfor (j = 0; j < n; j++)\n\t\t\tp *= 1 - prob(ll[j], rr[j], a);\n\t\tq = p;\n\t\tfor (i = 0; i < n; i++) {\n\t\t\tp = prob(ll[i], rr[i], a);\n\t\t\tfor (j = 0; j < n; j++)\n\t\t\t\tif (j != i)\n\t\t\t\t\tp *= 1 - prob(ll[j], rr[j], a);\n\t\t\tq += p;\n\t\t}\n\t\tans += 1 - q;\n\t}\n\tprintf(\"%.9f\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\n#define min(a, b) (((a) < (b)) ? (a) : (b))\n#define max(a, b) (((a) > (b)) ? (a) : (b))\n\nint main(void) {\n int i;\n int n;\n int l[5], r[5];\n int val;\n long long cnt[10001];\n double sum, ans;\n\n scanf(\"%d\", &n);\n for (i = 0; i < n; i++)\n scanf(\"%d %d\", l + i, r + i);\n\n sum = 0.0;\n for (val = 1; val <= 10000; val++) {\n int high1, high2, high3, high4, high5;\n int sec1, sec2, sec3, sec4;\n\n cnt[val] = 0;\n\n // high1パターン\n // sec1 パターン\n for (high1 = 0; high1 < n; high1++)\n for (sec1 = 0; sec1 < n; sec1++)\n if (high1 != sec1) {\n long long way;\n\n way = 1LL;\n for (i = 0; i < n; i++)\n if (i == high1)\n way *= max(r[i] - max(l[i], val + 1) + 1, 0);\n else if (i == sec1)\n way *= val >= l[i] && val <= r[i];\n else\n way *= max(min(r[i], val - 1) - l[i] + 1, 0);\n\n cnt[val] += way;\n }\n // sec2 パターン\n for (high1 = 0; high1 < n; high1++)\n for (sec1 = 0; sec1 < n; sec1++)\n for (sec2 = sec1 + 1; sec2 < n; sec2++)\n if (high1 != sec1 && high1 != sec2) {\n long long way;\n\n way = 1LL;\n for (i = 0; i < n; i++)\n if (i == high1)\n way *= max(r[i] - max(l[i], val + 1) + 1, 0);\n else if (i == sec1 || i == sec2)\n way *= val >= l[i] && val <= r[i];\n else\n way *= max(min(r[i], val - 1) - l[i] + 1, 0);\n\n cnt[val] += way;\n }\n // sec3 パターン\n for (high1 = 0; high1 < n; high1++)\n for (sec1 = 0; sec1 < n; sec1++)\n for (sec2 = sec1 + 1; sec2 < n; sec2++)\n for (sec3 = sec2 + 1; sec3 < n; sec3++)\n if (high1 != sec1 && high1 != sec2 && high1 != sec3) {\n long long way;\n\n way = 1LL;\n for (i = 0; i < n; i++)\n if (i == high1)\n way *= max(r[i] - max(l[i], val + 1) + 1, 0);\n else if (i == sec1 || i == sec2 || i == sec3)\n way *= val >= l[i] && val <= r[i];\n else\n way *= max(min(r[i], val - 1) - l[i] + 1, 0);\n\n cnt[val] += way;\n }\n // sec4 パターン\n for (high1 = 0; high1 < n; high1++)\n for (sec1 = 0; sec1 < n; sec1++)\n for (sec2 = sec1 + 1; sec2 < n; sec2++)\n for (sec3 = sec2 + 1; sec3 < n; sec3++)\n for (sec4 = sec3 + 1; sec4 < n; sec4++)\n if (high1 != sec1 && high1 != sec2 && high1 != sec3 && high1 != sec4) {\n long long way;\n\n way = 1LL;\n for (i = 0; i < n; i++)\n if (i == high1)\n way *= max(r[i] - max(l[i], val + 1) + 1, 0);\n else if (i == sec1 || i == sec2 || i == sec3 || i == sec4)\n way *= val >= l[i] && val <= r[i];\n else\n way *= max(min(r[i], val - 1) - l[i] + 1, 0);\n\n cnt[val] += way;\n }\n\n // high2パターン\n for (high1 = 0; high1 < n; high1++)\n for (high2 = high1 + 1; high2 < n; high2++) {\n long long way;\n\n way = 1LL;\n for (i = 0; i < n; i++)\n if (i == high1 || i == high2)\n way *= val >= l[i] && val <= r[i];\n else\n way *= max(min(r[i], val - 1) - l[i] + 1, 0);\n\n cnt[val] += way;\n }\n // high3パターン\n for (high1 = 0; high1 < n; high1++)\n for (high2 = high1 + 1; high2 < n; high2++)\n for (high3 = high2 + 1; high3 < n; high3++) {\n long long way;\n\n way = 1LL;\n for (i = 0; i < n; i++)\n if (i == high1 || i == high2 || i == high3)\n way *= val >= l[i] && val <= r[i];\n else\n way *= max(min(r[i], val - 1) - l[i] + 1, 0);\n\n cnt[val] += way;\n }\n // high4パターン\n for (high1 = 0; high1 < n; high1++)\n for (high2 = high1 + 1; high2 < n; high2++)\n for (high3 = high2 + 1; high3 < n; high3++)\n for (high4 = high3 + 1; high4 < n; high4++) {\n long long way;\n\n way = 1LL;\n for (i = 0; i < n; i++)\n if (i == high1 || i == high2 || i == high3 || i == high4)\n way *= val >= l[i] && val <= r[i];\n else\n way *= max(min(r[i], val - 1) - l[i] + 1, 0);\n\n cnt[val] += way;\n }\n // high5パターン\n for (high1 = 0; high1 < n; high1++)\n for (high2 = high1 + 1; high2 < n; high2++)\n for (high3 = high2 + 1; high3 < n; high3++)\n for (high4 = high3 + 1; high4 < n; high4++)\n for (high5 = high4 + 1; high5 < n; high5++) {\n long long way;\n\n way = 1LL;\n for (i = 0; i < n; i++)\n if (i == high1 || i == high2 || i == high3 || i == high4 || i == high5)\n way *= val >= l[i] && val <= r[i];\n else\n way *= max(min(r[i], val - 1) - l[i] + 1, 0);\n\n cnt[val] += way;\n }\n\n sum += cnt[val];\n }\n\n ans = 0.0;\n for (i = 1; i <= 10000; i++)\n ans += (double)i * cnt[i] / sum;\n\n printf(\"%.15f\\n\", ans);\n\n return 0;\n}\n"}, {"source_code": "#include \n\n#define MAX_COMP\t5\n#define MAX_BID\t\t10000\n\nint min(int x, int y)\n{\n\treturn (x <= y) ? x : y;\n}\n\nint max(int x, int y)\n{\n\treturn (x >= y) ? x : y;\n}\n\nint main(void)\n{\n\tint n;\n\tint l[MAX_COMP];\n\tint r[MAX_COMP];\n\tint i, j, k, z;\n\tdouble p, q, u;\n\n\tscanf(\"%d\", &n);\n\tfor(i = n; i --;)\n\t\tscanf(\"%d %d\", &l[i], &r[i]);\n\n\tp = 0.0;\n\tfor(i = 1; i <= MAX_BID; i ++)\n\t{\n\t\tfor(k = 0; k < n; k ++)\n\t\t{\n\t\t\tif(!(l[k] <= i && i <= r[k]))\n\t\t\t\tcontinue;\n\n\t\t\tq = 1 / (double)(r[k] - l[k] + 1);\n\n\t\t\tfor(j = 0; j < n; j ++)\n\t\t\t{\n\t\t\t\tif(i >= r[j])\n\t\t\t\t\tcontinue;\n\n\t\t\t\tif(k == j)\n\t\t\t\t\tcontinue;\n\n\t\t\t\tu = q;\n\t\t\t\tu *= (r[j] - max(l[j], i + 1) + 1) / (double)(r[j] - l[j] + 1);\n\n\t\t\t\tfor(z = 0; z < n; z ++)\n\t\t\t\t{\n\t\t\t\t\tif(z == j || z == k)\n\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\tif(l[z] > i)\n\t\t\t\t\t{\n\t\t\t\t\t\tu = 0.0;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(z > k)\n\t\t\t\t\t\tu *= (min(r[z], i) - l[z] + 1) / (double)(r[z] - l[z] + 1);\n\t\t\t\t\telse\n\t\t\t\t\t\tu *= (min(r[z], i - 1) - l[z] + 1) / (double)(r[z] - l[z] + 1);\n\t\t\t\t}\n\n\t\t\t\tp += i * u;\n\t\t\t}\n\n\t\t\tfor(j = k + 1; j < n; j ++)\n\t\t\t{\n\t\t\t\tif(!(l[j] <= i && i <= r[j]))\n\t\t\t\t\tcontinue;\n\n\t\t\t\tif(k == j)\n\t\t\t\t\tcontinue;\n\n\t\t\t\tu = q;\n\t\t\t\tu *= 1 / (double)(r[j] - l[j] + 1);\n\n\t\t\t\tfor(z = 0; z < n; z ++)\n\t\t\t\t{\n\t\t\t\t\tif(z == j || z == k)\n\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\tif(l[z] > i)\n\t\t\t\t\t{\n\t\t\t\t\t\tu = 0.0;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(z > k && z > j)\n\t\t\t\t\t\tu *= (min(r[z], i) - l[z] + 1) / (double)(r[z] - l[z] + 1);\n\t\t\t\t\telse\n\t\t\t\t\t\tu *= (min(r[z], i - 1) - l[z] + 1) / (double)(r[z] - l[z] + 1);\n\t\t\t\t}\n\n\t\t\t\tp += i * u;\n\t\t\t}\n\t\t}\n\t}\n\n\tprintf(\"%.9lf\\n\", p);\n\n\treturn 0;\n}\n"}, {"source_code": "#include \n\ndouble L[6], R[6];\nint n;\n\nint min(int a, double b_) {\n int b = b_;\n return (a < b ? a : b);\n}\nint max(int a, double b_) {\n int b = b_;\n return (a > b ? a : b);\n}\n\ndouble noHigherThan(int b) {\n int i, j, f;\n double p = 0.0, p1;\n for(i = 3; i < (1 << n); i++) {\n p1 = 1.0;\n f = 0;\n for(j = 0; j < n; j++) {\n if((i & (1 << j)) > 0) {\n if(!(L[j] <= b && b <= R[j])) {\n p1 = 0;\n break;\n }\n p1 *= (1.0 / (R[j] - L[j] + 1));\n f++;\n }\n else {\n if(L[j] >= b) {\n p1 = 0;\n break;\n }\n p1 *= ((min(b - 1, R[j]) - L[j] + 1) / (R[j] - L[j] + 1));\n }\n }\n if(f >= 2)\n p = p + p1;\n }\n return p;\n}\n\ndouble oneHigherThan(int b, int x) {\n if(b >= R[x]) return 0.0;\n double p = 0.0, p1;\n int i, j, f;\n for(i = 1; i < (1 << n); i++) {\n p1 = 1.0;\n f = 0;\n for(j = 0; j < n; j++) {\n if(j == x) continue;\n if((i & (1 << j)) > 0) {\n if(!(L[j] <= b && b <= R[j])) {\n p1 = 0;\n break;\n }\n p1 *= (1.0 / (R[j] - L[j] + 1));\n f++;\n }\n else {\n if(L[j] >= b) {\n p1 = 0;\n break;\n }\n p1 *= ((min(b - 1, R[j]) - L[j] + 1.0) / (R[j] - L[j] + 1.0));\n }\n }\n if(f == 0) p1 = 0;\n p = p + p1;\n }\n p /= 2.0;\n return p * ((R[x] - max(b + 1, L[x]) + 1.0) / (R[x] - L[x] + 1));\n}\n\ndouble P(int b) {\n double p = 0.0;\n p = noHigherThan(b);\n int i;\n for(i = 0; i < n; i++)\n p = p + oneHigherThan(b, i);\n return p;\n}\n\nint main(int argc, char const *argv[]) {\n int i, lim = 0;\n double ex = 0;\n scanf(\"%d\", &n);\n for(i = 0; i < n; i++) {\n scanf(\"%lf%lf\", &L[i], &R[i]);\n lim = max(lim, R[i]);\n }\n for(i = 1; i <= lim; i++) {\n ex = ex + i * P(i);\n }\n printf(\"%.10lf\\n\", ex);\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \n\nint L[5];\nint R[5];\nint D[5];\ndouble h[5],l[5],m[5];\nint n,i,j;\ndouble ans=0;\ndouble f(int i, char mid,char higher){\n\tif(i==n)return (double)(mid+higher>1);\n\tdouble ret=0;\n\tif(!higher){\n\t\tret+=h[i]*f(i+1,mid,1);\n\t}\n\tret+=m[i]*f(i+1,mid+1,higher);\n\tret+=l[i]*f(i+1,mid,higher);\n\treturn ret;\n}\n\n\nint main(){\n\tscanf(\"%d\",&n);\n\tfor(i=0;ii){\n\t\t\t\tif(L[j]>i){\n\t\t\t\t\th[j]=1;\n\t\t\t\t}else{\n\t\t\t\t\th[j]=(R[j]-i)/(double)D[j];\n\t\t\t\t}\n\t\t\t}else h[j]=0;\n\t\t\tif(R[j]>=i&&L[j]<=i){\n\t\t\t\tm[j]=1/(double)D[j];\n\t\t\t}else m[j]=0;\n\t\t\t\n\t\t\tif(L[j]\ntypedef unsigned u;\ntypedef double d;\nu L[9],R[9];\nint main()\n{\n\td r=0.0,s,t,tmp;u n,i,j,k,l;scanf(\"%u\",&n);\n\tfor(i=-1;++ii){s=0.0;break;}\n\t\t\t\ts*=(d)((i>R[l]?R[l]:i)-L[l]+1)/(d)(R[l]-L[l]+1);\n\t\t\t}\n\t\t\tt+=s;\n\t\t\ts=tmp;\n\t\t\tfor(l=0;l=i){s=0.0;break;}\n\t\t\t\ts*=(d)((i>R[l]?R[l]+1:i)-L[l])/(d)(R[l]-L[l]+1);\n\t\t\t}\n\t\t\tt-=s;\n\t\t}\n\t\ts=1.0;\n\t\tfor(l=0;li){s=0.0;break;}\n\t\t\ts*=(d)((i>R[l]?R[l]:i)-L[l]+1)/(d)(R[l]-L[l]+1);\n\t\t}\n\t\tt+=s;\n\t\ts=1.0;\n\t\tfor(l=0;l=i){s=0.0;break;}\n\t\t\ts*=(d)((i>R[l]?R[l]+1:i)-L[l])/(d)(R[l]-L[l]+1);\n\t\t}\n\t\tt-=s;\n\t\ttmp=0.0;\n\t\tfor(k=0;ki)continue;\n\t\t\ts=1.0/(d)(R[k]-L[k]+1);\n\t\t\tfor(l=0;l=i){s=0.0;break;}\n\t\t\t\ts*=(d)((i>R[l]?R[l]+1:i)-L[l])/(d)(R[l]-L[l]+1);\n\t\t\t}\n\t\t\ttmp+=s;\n\t\t}\n\t\tt-=tmp;\n\t\tr+=t*(d)i;\n\t}\n\tprintf(\"%.10lf\\n\",r);\n\treturn 0;\n}\n"}], "negative_code": [{"source_code": "#include \n#include \n#include \n\n#define min(a, b) (((a) < (b)) ? (a) : (b))\n#define max(a, b) (((a) > (b)) ? (a) : (b))\n\nint compare(const void *a, const void *b) {\n return *(long long *)a - *(long long *)b;\n}\n\nint main(void) {\n int i;\n int n;\n int l[5], r[5];\n int val;\n long long cnt[10001], tmp[10001];\n double sum, ans;\n\n scanf(\"%d\", &n);\n for (i = 0; i < n; i++)\n scanf(\"%d %d\", l + i, r + i);\n\n sum = 0.0;\n for (val = 1; val <= 10000; val++) {\n int high1, high2, high3, high4, high5;\n int sec1, sec2, sec3, sec4;\n\n cnt[val] = 0;\n\n // high1パターン\n // sec1 パターン\n for (high1 = 0; high1 < n; high1++)\n for (sec1 = 0; sec1 < n; sec1++)\n if (high1 != sec1) {\n long long way;\n\n way = 1LL;\n for (i = 0; i < n; i++)\n if (i == high1)\n way *= max(r[i] - max(l[i], val + 1) + 1, 0);\n else if (i == sec1)\n way *= val >= l[i] && val <= r[i];\n else\n way *= max(min(r[i], val - 1) - l[i] + 1, 0);\n\n cnt[val] += way;\n }\n // sec2 パターン\n for (high1 = 0; high1 < n; high1++)\n for (sec1 = 0; sec1 < n; sec1++)\n for (sec2 = sec1 + 1; sec2 < n; sec2++)\n if (high1 != sec1 && high1 != sec2) {\n long long way;\n\n way = 1LL;\n for (i = 0; i < n; i++)\n if (i == high1)\n way *= max(r[i] - max(l[i], val + 1) + 1, 0);\n else if (i == sec1 || i == sec2)\n way *= val >= l[i] && val <= r[i];\n else\n way *= max(min(r[i], val - 1) - l[i] + 1, 0);\n\n cnt[val] += way;\n }\n // sec3 パターン\n for (high1 = 0; high1 < n; high1++)\n for (sec1 = 0; sec1 < n; sec1++)\n for (sec2 = sec1 + 1; sec2 < n; sec2++)\n for (sec3 = sec2 + 1; sec3 < n; sec3++)\n if (high1 != sec1 && high1 != sec2 && high1 != sec3) {\n long long way;\n\n way = 1LL;\n for (i = 0; i < n; i++)\n if (i == high1)\n way *= max(r[i] - max(l[i], val + 1) + 1, 0);\n else if (i == sec1 || i == sec2 || i == sec3)\n way *= val >= l[i] && val <= r[i];\n else\n way *= max(min(r[i], val - 1) - l[i] + 1, 0);\n\n cnt[val] += way;\n }\n // sec4 パターン\n for (high1 = 0; high1 < n; high1++)\n for (sec1 = 0; sec1 < n; sec1++)\n for (sec2 = sec1 + 1; sec2 < n; sec2++)\n for (sec3 = sec2 + 1; sec3 < n; sec3++)\n for (sec4 = sec3 + 1; sec4 < n; sec4++)\n if (high1 != sec1 && high1 != sec2 && high1 != sec3 && high1 != sec4) {\n long long way;\n\n way = 1LL;\n for (i = 0; i < n; i++)\n if (i == high1)\n way *= max(r[i] - max(l[i], val + 1) + 1, 0);\n else if (i == sec1 || i == sec2 || i == sec3 || i == sec4)\n way *= val >= l[i] && val <= r[i];\n else\n way *= max(min(r[i], val - 1) - l[i] + 1, 0);\n\n cnt[val] += way;\n }\n\n // high2パターン\n for (high1 = 0; high1 < n; high1++)\n for (high2 = high1 + 1; high2 < n; high2++) {\n long long way;\n\n way = 1LL;\n for (i = 0; i < n; i++)\n if (i == high1 || i == high2)\n way *= val >= l[i] && val <= r[i];\n else\n way *= max(min(r[i], val - 1) - l[i] + 1, 0);\n\n cnt[val] += way;\n }\n // high3パターン\n for (high1 = 0; high1 < n; high1++)\n for (high2 = high1 + 1; high2 < n; high2++)\n for (high3 = high2 + 1; high3 < n; high3++) {\n long long way;\n\n way = 1LL;\n for (i = 0; i < n; i++)\n if (i == high1 || i == high2 || i == high3)\n way *= val >= l[i] && val <= r[i];\n else\n way *= max(min(r[i], val - 1) - l[i] + 1, 0);\n\n cnt[val] += way;\n }\n // high4パターン\n for (high1 = 0; high1 < n; high1++)\n for (high2 = high1 + 1; high2 < n; high2++)\n for (high3 = high2 + 1; high3 < n; high3++)\n for (high4 = high3 + 1; high4 < n; high4++) {\n long long way;\n\n way = 1LL;\n for (i = 0; i < n; i++)\n if (i == high1 || i == high2 || i == high3 || i == high4)\n way *= val >= l[i] && val <= r[i];\n else\n way *= max(min(r[i], val - 1) - l[i] + 1, 0);\n\n cnt[val] += way;\n }\n // high5パターン\n for (high1 = 0; high1 < n; high1++)\n for (high2 = high1 + 1; high2 < n; high2++)\n for (high3 = high2 + 1; high3 < n; high3++)\n for (high4 = high3 + 1; high4 < n; high4++)\n for (high5 = high4 + 1; high4 < n; high4++) {\n long long way;\n\n way = 1LL;\n for (i = 0; i < n; i++)\n if (i == high1 || i == high2 || i == high3 || i == high4 || i == high5)\n way *= val >= l[i] && val <= r[i];\n else\n way *= max(min(r[i], val - 1) - l[i] + 1, 0);\n\n cnt[val] += way;\n }\n\n sum += cnt[val];\n }\n\n memcpy(tmp, cnt, sizeof cnt);\n qsort(tmp, 10001, sizeof(long long), &compare);\n\n sum = 0.0;\n for (i = 0; i <= 10000; i++)\n sum += tmp[i];\n\n ans = 0.0;\n for (i = 1; i <= 10000; i++)\n ans += (double)i * cnt[i] / sum;\n\n printf(\"%.15f\\n\", ans);\n\n return 0;\n}\n"}, {"source_code": "#include \n\n#define min(a, b) (((a) < (b)) ? (a) : (b))\n#define max(a, b) (((a) > (b)) ? (a) : (b))\n\n\nint main(void) {\n int i;\n int n;\n int l[5], r[5];\n int val;\n long long cnt[10001];\n double sum, ans;\n\n scanf(\"%d\", &n);\n for (i = 0; i < n; i++)\n scanf(\"%d %d\", l + i, r + i);\n\n sum = 0.0;\n for (val = 1; val <= 10000; val++) {\n int high1, high2, high3, high4, high5;\n int sec1, sec2, sec3, sec4;\n\n cnt[val] = 0;\n\n // high1パターン\n // sec1 パターン\n for (high1 = 0; high1 < n; high1++)\n for (sec1 = 0; sec1 < n; sec1++)\n if (high1 != sec1) {\n long long way;\n\n way = 1LL;\n for (i = 0; i < n; i++)\n if (i == high1)\n way *= max(r[i] - max(l[i], val + 1) + 1, 0);\n else if (i == sec1)\n way *= val >= l[i] && val <= r[i];\n else\n way *= max(min(r[i], val - 1) - l[i] + 1, 0);\n\n cnt[val] += way;\n }\n // sec2 パターン\n for (high1 = 0; high1 < n; high1++)\n for (sec1 = 0; sec1 < n; sec1++)\n for (sec2 = sec1 + 1; sec2 < n; sec2++)\n if (high1 != sec1 && high1 != sec2) {\n long long way;\n\n way = 1LL;\n for (i = 0; i < n; i++)\n if (i == high1)\n way *= max(r[i] - max(l[i], val + 1) + 1, 0);\n else if (i == sec1 || i == sec2)\n way *= val >= l[i] && val <= r[i];\n else\n way *= max(min(r[i], val - 1) - l[i] + 1, 0);\n\n cnt[val] += way;\n }\n // sec3 パターン\n for (high1 = 0; high1 < n; high1++)\n for (sec1 = 0; sec1 < n; sec1++)\n for (sec2 = sec1 + 1; sec2 < n; sec2++)\n for (sec3 = sec2 + 1; sec3 < n; sec3++)\n if (high1 != sec1 && high1 != sec2 && high1 != sec3) {\n long long way;\n\n way = 1LL;\n for (i = 0; i < n; i++)\n if (i == high1)\n way *= max(r[i] - max(l[i], val + 1) + 1, 0);\n else if (i == sec1 || i == sec2 || i == sec3)\n way *= val >= l[i] && val <= r[i];\n else\n way *= max(min(r[i], val - 1) - l[i] + 1, 0);\n\n cnt[val] += way;\n }\n // sec4 パターン\n for (high1 = 0; high1 < n; high1++)\n for (sec1 = 0; sec1 < n; sec1++)\n for (sec2 = sec1 + 1; sec2 < n; sec2++)\n for (sec3 = sec2 + 1; sec3 < n; sec3++)\n for (sec4 = sec3 + 1; sec4 < n; sec4++)\n if (high1 != sec1 && high1 != sec2 && high1 != sec3 && high1 != sec4) {\n long long way;\n\n way = 1LL;\n for (i = 0; i < n; i++)\n if (i == high1)\n way *= max(r[i] - max(l[i], val + 1) + 1, 0);\n else if (i == sec1 || i == sec2 || i == sec3 || i == sec4)\n way *= val >= l[i] && val <= r[i];\n else\n way *= max(min(r[i], val - 1) - l[i] + 1, 0);\n\n cnt[val] += way;\n }\n\n // high2パターン\n for (high1 = 0; high1 < n; high1++)\n for (high2 = high1 + 1; high2 < n; high2++) {\n long long way;\n\n way = 1LL;\n for (i = 0; i < n; i++)\n if (i == high1 || i == high2)\n way *= val >= l[i] && val <= r[i];\n else\n way *= max(min(r[i], val - 1) - l[i] + 1, 0);\n\n cnt[val] += way;\n }\n // high3パターン\n for (high1 = 0; high1 < n; high1++)\n for (high2 = high1 + 1; high2 < n; high2++)\n for (high3 = high2 + 1; high3 < n; high3++) {\n long long way;\n\n way = 1LL;\n for (i = 0; i < n; i++)\n if (i == high1 || i == high2 || i == high3)\n way *= val >= l[i] && val <= r[i];\n else\n way *= max(min(r[i], val - 1) - l[i] + 1, 0);\n\n cnt[val] += way;\n }\n // high4パターン\n for (high1 = 0; high1 < n; high1++)\n for (high2 = high1 + 1; high2 < n; high2++)\n for (high3 = high2 + 1; high3 < n; high3++)\n for (high4 = high3 + 1; high4 < n; high4++) {\n long long way;\n\n way = 1LL;\n for (i = 0; i < n; i++)\n if (i == high1 || i == high2 || i == high3 || i == high4)\n way *= val >= l[i] && val <= r[i];\n else\n way *= max(min(r[i], val - 1) - l[i] + 1, 0);\n\n cnt[val] += way;\n }\n // high5パターン\n for (high1 = 0; high1 < n; high1++)\n for (high2 = high1 + 1; high2 < n; high2++)\n for (high3 = high2 + 1; high3 < n; high3++)\n for (high4 = high3 + 1; high4 < n; high4++)\n for (high5 = high4 + 1; high4 < n; high4++) {\n long long way;\n\n way = 1LL;\n for (i = 0; i < n; i++)\n if (i == high1 || i == high2 || i == high3 || i == high4 || i == high5)\n way *= val >= l[i] && val <= r[i];\n else\n way *= max(min(r[i], val - 1) - l[i] + 1, 0);\n\n cnt[val] += way;\n }\n\n sum += cnt[val];\n }\n\n ans = 0.0;\n for (i = 1; i <= 10000; i++)\n ans += (double)i * cnt[i] / sum;\n\n printf(\"%.15f\\n\", ans);\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\n#define min(a, b) (((a) < (b)) ? (a) : (b))\n#define max(a, b) (((a) > (b)) ? (a) : (b))\n\nint compare(const void *a, const void *b) {\n return *(long long *)a - *(long long *)b;\n}\n\nint main(void) {\n int i;\n int n;\n int l[5], r[5];\n int val;\n long long cnt[10001], tmp[10001];\n double sum, ans;\n\n scanf(\"%d\", &n);\n for (i = 0; i < n; i++)\n scanf(\"%d %d\", l + i, r + i);\n\n sum = 0.0;\n for (val = 1; val <= 10000; val++) {\n int high1, high2, high3, high4, high5;\n int sec1, sec2, sec3, sec4;\n\n cnt[val] = 0;\n\n // high1パターン\n // sec1 パターン\n for (high1 = 0; high1 < n; high1++)\n for (sec1 = 0; sec1 < n; sec1++)\n if (high1 != sec1) {\n long long way;\n\n way = 1LL;\n for (i = 0; i < n; i++)\n if (i == high1)\n way *= max(r[i] - max(l[i], val + 1) + 1, 0);\n else if (i == sec1)\n way *= val >= l[i] && val <= r[i];\n else\n way *= max(min(r[i], val - 1) - l[i] + 1, 0);\n\n cnt[val] += way;\n }\n // sec2 パターン\n for (high1 = 0; high1 < n; high1++)\n for (sec1 = 0; sec1 < n; sec1++)\n for (sec2 = sec1 + 1; sec2 < n; sec2++)\n if (high1 != sec1 && high1 != sec2) {\n long long way;\n\n way = 1LL;\n for (i = 0; i < n; i++)\n if (i == high1)\n way *= max(r[i] - max(l[i], val + 1) + 1, 0);\n else if (i == sec1 || i == sec2)\n way *= val >= l[i] && val <= r[i];\n else\n way *= max(min(r[i], val - 1) - l[i] + 1, 0);\n\n cnt[val] += way;\n }\n // sec3 パターン\n for (high1 = 0; high1 < n; high1++)\n for (sec1 = 0; sec1 < n; sec1++)\n for (sec2 = sec1 + 1; sec2 < n; sec2++)\n for (sec3 = sec2 + 1; sec3 < n; sec3++)\n if (high1 != sec1 && high1 != sec2 && high1 != sec3) {\n long long way;\n\n way = 1LL;\n for (i = 0; i < n; i++)\n if (i == high1)\n way *= max(r[i] - max(l[i], val + 1) + 1, 0);\n else if (i == sec1 || i == sec2 || i == sec3)\n way *= val >= l[i] && val <= r[i];\n else\n way *= max(min(r[i], val - 1) - l[i] + 1, 0);\n\n cnt[val] += way;\n }\n // sec4 パターン\n for (high1 = 0; high1 < n; high1++)\n for (sec1 = 0; sec1 < n; sec1++)\n for (sec2 = sec1 + 1; sec2 < n; sec2++)\n for (sec3 = sec2 + 1; sec3 < n; sec3++)\n for (sec4 = sec3 + 1; sec4 < n; sec4++)\n if (high1 != sec1 && high1 != sec2 && high1 != sec3 && high1 != sec4) {\n long long way;\n\n way = 1LL;\n for (i = 0; i < n; i++)\n if (i == high1)\n way *= max(r[i] - max(l[i], val + 1) + 1, 0);\n else if (i == sec1 || i == sec2 || i == sec3 || i == sec4)\n way *= val >= l[i] && val <= r[i];\n else\n way *= max(min(r[i], val - 1) - l[i] + 1, 0);\n\n cnt[val] += way;\n }\n\n // high2パターン\n for (high1 = 0; high1 < n; high1++)\n for (high2 = high1 + 1; high2 < n; high2++) {\n long long way;\n\n way = 1LL;\n for (i = 0; i < n; i++)\n if (i == high1 || i == high2)\n way *= val >= l[i] && val <= r[i];\n else\n way *= max(min(r[i], val - 1) - l[i] + 1, 0);\n\n cnt[val] += way;\n }\n // high3パターン\n for (high1 = 0; high1 < n; high1++)\n for (high2 = high1 + 1; high2 < n; high2++)\n for (high3 = high2 + 1; high3 < n; high3++) {\n long long way;\n\n way = 1LL;\n for (i = 0; i < n; i++)\n if (i == high1 || i == high2 || i == high3)\n way *= val >= l[i] && val <= r[i];\n else\n way *= max(min(r[i], val - 1) - l[i] + 1, 0);\n\n cnt[val] += way;\n }\n // high4パターン\n for (high1 = 0; high1 < n; high1++)\n for (high2 = high1 + 1; high2 < n; high2++)\n for (high3 = high2 + 1; high3 < n; high3++)\n for (high4 = high3 + 1; high4 < n; high4++) {\n long long way;\n\n way = 1LL;\n for (i = 0; i < n; i++)\n if (i == high1 || i == high2 || i == high3 || i == high4)\n way *= val >= l[i] && val <= r[i];\n else\n way *= max(min(r[i], val - 1) - l[i] + 1, 0);\n\n cnt[val] += way;\n }\n // high5パターン\n for (high1 = 0; high1 < n; high1++)\n for (high2 = high1 + 1; high2 < n; high2++)\n for (high3 = high2 + 1; high3 < n; high3++)\n for (high4 = high3 + 1; high4 < n; high4++)\n for (high5 = high4 + 1; high4 < n; high4++) {\n long long way;\n\n way = 1LL;\n for (i = 0; i < n; i++)\n if (i == high1 || i == high2 || i == high3 || i == high4 || i == high5)\n way *= val >= l[i] && val <= r[i];\n else\n way *= max(min(r[i], val - 1) - l[i] + 1, 0);\n\n cnt[val] += way;\n }\n\n sum += cnt[val];\n }\n\n memcpy(tmp, cnt, sizeof cnt);\n qsort(tmp, 10001, sizeof(long long), &compare);\n\n sum = 0.0;\n for (i = 0; i <= 10000; i++)\n sum += tmp[i];\n\n sum = 1.0;\n for (i = 0; i < n; i++)\n sum *= (double)(r[i] - l[i] + 1);\n\n ans = 0.0;\n for (i = 1; i <= 10000; i++)\n ans += (double)i * cnt[i] / sum;\n\n printf(\"%.15f\\n\", ans);\n\n return 0;\n}\n"}, {"source_code": "#include \n\n#define MAX_COMP\t5\n#define MAX_BID\t\t10000\n\nint min(int x, int y)\n{\n\treturn (x <= y) ? x : y;\n}\n\nint max(int x, int y)\n{\n\treturn (x >= y) ? x : y;\n}\n\nint main(void)\n{\n\tint n;\n\tint l[MAX_COMP];\n\tint r[MAX_COMP];\n\tint i, j, k, z;\n\tdouble p, q, u;\n\n\tscanf(\"%d\", &n);\n\tfor(i = n; i --;)\n\t\tscanf(\"%d %d\", &l[i], &r[i]);\n\n\tp = 0.0;\n\tfor(i = 1; i <= MAX_BID; i ++)\n\t{\n\t\tfor(k = 0; k < n; k ++)\n\t\t{\n\t\t\tif(!(l[k] <= i && i <= r[k]))\n\t\t\t\tcontinue;\n\n\t\t\tq = 1 / (double)(r[k] - l[k] + 1);\n\n\t\t\tfor(j = 0; j < n; j ++)\n\t\t\t{\n\t\t\t\tif(i >= r[j])\n\t\t\t\t\tcontinue;\n\n\t\t\t\tif(k == j)\n\t\t\t\t\tcontinue;\n\n\t\t\t\tu = q;\n\t\t\t\tu *= (r[j] - max(l[j], i + 1) + 1) / (double)(r[j] - l[j] + 1);\n\n\t\t\t\tfor(z = 0; z < n; z ++)\n\t\t\t\t{\n\t\t\t\t\tif(z == j || z == k)\n\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\tif(l[z] > i)\n\t\t\t\t\t{\n\t\t\t\t\t\tu = 0.0;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(z > k)\n\t\t\t\t\t\tu *= (min(r[z], i) - l[z] + 1) / (double)(r[z] - l[z] + 1);\n\t\t\t\t\telse\n\t\t\t\t\t\tu *= (min(r[z], i - 1) - l[z] + 1) / (double)(r[z] - l[z] + 1);\n\t\t\t\t}\n\n\t\t\t\tp += i * u;\n\t\t\t}\n\n\t\t\tfor(j = k + 1; j < n; j ++)\n\t\t\t{\n\t\t\t\tif(!(l[j] <= i && i <= r[j]))\n\t\t\t\t\tcontinue;\n\n\t\t\t\tif(k == j)\n\t\t\t\t\tcontinue;\n\n\t\t\t\tu = q;\n\t\t\t\tu *= 1 / (double)(r[j] - l[j] + 1);\n\n\t\t\t\tfor(z = 0; z < n; z ++)\n\t\t\t\t{\n\t\t\t\t\tif(z == j || z == k)\n\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\tif(l[z] > i)\n\t\t\t\t\t{\n\t\t\t\t\t\tu = 0.0;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(z > k && z > j)\n\t\t\t\t\t\tu *= (min(r[z], i) - l[z] + 1) / (double)(r[z] - l[z] + 1);\n\t\t\t\t\telse\n\t\t\t\t\t\tu *= (min(r[z], i - 1) - l[z] + 1) / (double)(r[z] - l[z] + 1);\n\t\t\t\t}\n\n\t\t\t\tp += i * u;\n\t\t\t}\n\t\t}\n\t}\n\n\tprintf(\"%lf\\n\", p);\n\n\treturn 0;\n}\n"}, {"source_code": "#include\ntypedef unsigned u;\ntypedef double d;\nu L[9],R[9];\nint main()\n{\n\td r=0.0,s,t,tmp;u n,i,j,k,l;scanf(\"%u\",&n);\n\tfor(i=-1;++ii){s=0.0;break;}\n\t\t\t\ts*=(d)((i>R[l]?R[l]:i)-L[l]+1)/(d)(R[l]-L[l]+1);\n\t\t\t}\n\t\t\tt+=s;\n\t\t\ts=tmp;\n\t\t\tfor(l=0;l=i){s=0.0;break;}\n\t\t\t\ts*=(d)((i>R[l]?R[l]+1:i)-L[l])/(d)(R[l]-L[l]+1);\n\t\t\t}\n\t\t\tt-=s;\n\t\t}\n\t\ts=1.0;\n\t\tfor(l=0;li){s=0.0;break;}\n\t\t\ts*=(d)((i>R[l]?R[l]:i)-L[l]+1)/(d)(R[l]-L[l]+1);\n\t\t}\n\t\tt+=s;\n\t\ts=1.0;\n\t\tfor(l=0;l=i){s=0.0;break;}\n\t\t\ts*=(d)((i>R[l]?R[l]+1:i)-L[l])/(d)(R[l]-L[l]+1);\n\t\t}\n\t\tt-=s;\n\t\ttmp=0.0;\n\t\tfor(k=0;ki)continue;\n\t\t\ts=1.0/(d)(R[k]-L[k]+1);\n\t\t\tfor(l=0;l=i){s=0.0;break;}\n\t\t\t\ts*=(d)((i>R[l]?R[l]+1:i)-L[l])/(d)(R[l]-L[l]+1);\n\t\t\t}\n\t\t\ttmp+=s;\n\t\t}\n\t\tt-=tmp;\n\t\tr+=t*(d)i;\n\t}\n\tprintf(\"%.10lf\\n\",r);\n\treturn 0;\n}\n"}], "src_uid": "5258ce738eb268b9750cfef309d265ef"} {"nl": {"description": "Statistics claims that students sleep no more than three hours a day. But even in the world of their dreams, while they are snoring peacefully, the sense of impending doom is still upon them.A poor student is dreaming that he is sitting the mathematical analysis exam. And he is examined by the most formidable professor of all times, a three times Soviet Union Hero, a Noble Prize laureate in student expulsion, venerable Petr Palych.The poor student couldn't answer a single question. Thus, instead of a large spacious office he is going to apply for a job to thorium mines. But wait a minute! Petr Palych decided to give the student the last chance! Yes, that is possible only in dreams. So the professor began: \"Once a Venusian girl and a Marsian boy met on the Earth and decided to take a walk holding hands. But the problem is the girl has al fingers on her left hand and ar fingers on the right one. The boy correspondingly has bl and br fingers. They can only feel comfortable when holding hands, when no pair of the girl's fingers will touch each other. That is, they are comfortable when between any two girl's fingers there is a boy's finger. And in addition, no three fingers of the boy should touch each other. Determine if they can hold hands so that the both were comfortable.\"The boy any the girl don't care who goes to the left and who goes to the right. The difference is only that if the boy goes to the left of the girl, he will take her left hand with his right one, and if he goes to the right of the girl, then it is vice versa.", "input_spec": "The first line contains two positive integers not exceeding 100. They are the number of fingers on the Venusian girl's left and right hand correspondingly. The second line contains two integers not exceeding 100. They are the number of fingers on the Marsian boy's left and right hands correspondingly.", "output_spec": "Print YES or NO, that is, the answer to Petr Palych's question.", "sample_inputs": ["5 1\n10 5", "4 5\n3 3", "1 2\n11 6"], "sample_outputs": ["YES", "YES", "NO"], "notes": "NoteThe boy and the girl don't really care who goes to the left."}, "positive_code": [{"source_code": "#include \n#include\nint main(void) {\n int bl,br,gl,gr;\n scanf(\"%d %d %d %d\",&gl,&gr,&bl,&br);\n if(abs(bl-gr)<2||abs(br-gl)<2) printf(\"YES\");\n else if((bl<=2*gr+2&&bl>gr)||(br<=2*gl+2&&br>gl)) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include \n#include \nint check_fing(int b, int g){\n\tint groups[102];\n\tint i;\n\tint correct = 1;\n\tmemset(groups,0,102*sizeof(int));\n\tfor(i = 0; b; i=(i+1)%(g+1)){\n\t\tgroups[i]++;\n\t\tb--;\n\t}\n\tfor(i = 0; i 0) && (groups[i]<=2);\n\tfor(i = g-1; i= 0) && (groups[i]<=2);\n\t\t\n\treturn correct;\n}\n\nint main(){\n\tint al, ar, bl, br;\n\tint res = 0;\n\tscanf(\"%d %d\\n%d %d\",&al,&ar,&bl,&br);\n\tres = check_fing(bl,ar) || check_fing(br,al);\n\tprintf(\"%s\\n\", res ? \"YES\":\"NO\");\n\treturn 0;\n}\n\n"}, {"source_code": "#include \n\nint main()\n{\n int al, ar, bl, br;\n\n scanf(\"%d %d %d %d\", &al, &ar, &bl, &br);\n\n if (bl >= ar - 1 && bl <= ar * 2 + 2) {\n puts(\"YES\");\n } else if (br >= al - 1 && br <= al * 2 + 2) {\n puts(\"YES\");\n } else {\n puts(\"NO\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int a,b,c,d,r=0,t=0;\n scanf(\"%d %d %d %d\", &a, &b, &c, &d);\n if(a > d && r==0)\n {\n if(d == a-1)\n {\n printf(\"YES\");\n r++;\n }\n else\n {\n t++;\n }\n }\n if(d >= a && r==0)\n {\n if(d>=a && d<=(a*2)+2)\n {\n printf(\"YES\");\n r++;\n }\n else\n {\n t++;\n }\n }\n if(b > c && r==0)\n {\n if(c == b - 1)\n {\n printf(\"YES\");\n r++;\n }\n else\n {\n if(t > 0)\n printf(\"NO\");\n }\n }\n if(c >= b && r == 0)\n {\n if(c>=b && c<=(b*2)+2)\n {\n printf(\"YES\");\n r++;\n }\n else\n {\n if(t > 0)\n printf(\"NO\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main()\n{\n int gr, gl, br, bl, i, a=0;\n scanf(\"%d %d\", &gl, &gr);\n scanf(\"%d %d\", &bl, &br);\n if(gl==br || bl==gr){\n printf(\"YES\");\n return 0;\n }\n if(gl>br && (gl-br)<=1){\n printf(\"YES\");\n return 0;\n }\n else if(gr>bl && (gr-bl)<=1){\n printf(\"YES\");\n return 0;\n }\n if(br%2==0){\n br=br-1;\n }\n if(br>=gl && gl>=(br/2)){\n printf(\"YES\");\n return 0;\n }\n if(bl%2==0){\n bl=bl-1;\n }\n if(bl>=gr && gr>=(bl/2)){\n printf(\"YES\");\n return 0;\n }\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#define MAX 8\n\nint mano_venus(char* venusString, int num);\nint mano_marte(char* marteString, int num);\nint comfortable(int venusiana, int marciano);\n\nint main(int argc, char const *argv[])\n{\n char venus[MAX], marte[MAX];\n char auxVenus[MAX], auxMarte[MAX];\n\n int hand_venus, hand_mars;\n\n gets(venus); strcpy(auxVenus, venus); \n gets(marte); strcpy(auxMarte, marte);\n\n hand_venus = mano_venus(venus, 1);\n hand_mars = mano_marte(marte, 1);\n\n if (hand_venus != -1 && hand_mars != -1)\n {\n if(comfortable(hand_venus, hand_mars))\n {\n printf(\"YES\");\n }else{\n hand_venus = mano_venus(auxVenus, 2);\n hand_mars = mano_marte(auxMarte, 2);\n if (comfortable(hand_venus, hand_mars))\n {\n printf(\"YES\");\n }else{\n printf(\"NO\");\n }\n }\n }\n\n return 0;\n}\n\nint comfortable(int venusiana, int marciano)\n{ \n int k = 0;\n\n if (venusiana > marciano)\n {\n if (marciano == (venusiana - 1))\n {\n k = 1;\n }\n }\n if (venusiana < marciano)\n {\n if (2*venusiana +2 >= marciano)\n {\n k = 1;\n }\n }\n if (venusiana == marciano)\n {\n k = 1;\n }\n\n return k;\n}\n\nint mano_venus(char* venusString, int num)\n{\n char auxVenus[MAX];\n strcpy(auxVenus, venusString);\n int k = -1;\n\n char* manoVenusIzq = strtok(venusString, \" \");\n char* manoVenusDer = strtok(NULL, \" \");\n\n if (atoi(manoVenusIzq) > 0 && atoi(manoVenusIzq) <= 100)\n {\n if (atoi(manoVenusDer) > 0 && atoi(manoVenusDer) <= 100)\n {\n if(num == 1)\n {\n k = atoi(manoVenusIzq);\n }else{\n k = atoi(manoVenusDer);\n }\n }\n }\n\n return k;\n}\n\nint mano_marte(char* marteString, int num)\n{\n char* manoMarteIzq = strtok(marteString, \" \");\n char* manoMarteDer = strtok(NULL, \" \");\n int k = -1;\n\n if (atoi(manoMarteIzq) > 0 && atoi(manoMarteIzq) <= 100)\n {\n if (atoi(manoMarteDer) > 0 && atoi(manoMarteDer) <= 100)\n {\n if(num == 1)\n {\n k = atoi(manoMarteDer);\n }else{\n k = atoi(manoMarteIzq);\n }\n }\n }\n\n return k;\n}"}, {"source_code": "#include\nint main()\n{\n int a,b,c,d;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n if((d>=a-1&&d<2*(a+1)+1)||(c>=b-1&&c<2*(b+1)+1))\n printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\nint main()\n{\n\tint a1,a2,b1,b2;\n\tscanf(\"%d%d%d%d\",&a1,&a2,&b1,&b2);\n\tif((a1<=b2+1&&a1*2+3>b2)||(a2<=b1+1&&a2*2+3>b1))\n\tprintf(\"YES\");\n\telse\n\tprintf(\"NO\");\n \n}"}, {"source_code": "#include\nint main()\n{\nint a,b,c,d;\nscanf(\"%d %d %d %d\",&a,&b,&c,&d);\nif((d>=a-1&&d<=2*(a+1))||(c>=b-1&&c<=2*(b+1)))\nprintf(\"YES\");\nelse\nprintf(\"NO\");\nreturn(0);}\n"}, {"source_code": "#include\nmain()\n{\n int a,c,b,d;\n scanf(\"%d%d%d%d\",&a,&b,&c,&d);\n if(((d<=((a+1)*2))&&d>=a-1)||((c<=((b+1)*2))&&c>=b-1))\n printf(\"YES\");\n else\n printf(\"NO\");\n}\n"}, {"source_code": "#include \n#include \n#include \n#define MAX 8//maxima cantidad de elementos a introducir\n\nint mano_venus(char* venusString, int num);\nint mano_marte(char* marteString, int num);\nint comfortable(int venusiana, int marciano);\n\nint main(int argc, char const *argv[])\n{\n char venus[MAX], marte[MAX];//se crean los vectores de tamaño 8 para la lectura\n char auxVenus[MAX], auxMarte[MAX];//se crean los vectores de tamaño MAX para el input\n\n int hand_venus, hand_mars;//variable de validacion de cantidad de dedos\n\n gets(venus); strcpy(auxVenus, venus); //se obtienen los datos de la venusiana y se copian en un vector auxiliar para la tokenizacion\n gets(marte); strcpy(auxMarte, marte);//se obtienen los datos del marciano y se copian los datos en un vector auxiliar para la tokenizacion\n\n hand_venus = mano_venus(venus, 1);//El caso 1 es mano izquierda venus, mano derecho marte\n hand_mars = mano_marte(marte, 1);\n\n if (hand_venus != -1 && hand_mars != -1)//Si ambos no exceden el limite de dedos\n {\n if(comfortable(hand_venus, hand_mars))//llama a la funcion comfortable\n {\n printf(\"YES\");\n }else{//Si no se sienten comodos\n hand_venus = mano_venus(auxVenus, 2);//El caso 2 es mano derecha de la venusiana e izquierda del marciano\n hand_mars = mano_marte(auxMarte, 2);\n if (comfortable(hand_venus, hand_mars))//Si ambos se sienten comodos\n {\n printf(\"YES\");//imprime si\n }else{\n printf(\"NO\");//Si no, no.\n }\n }\n }\n\n return 0;\n}\n\nint comfortable(int venusiana, int marciano)//Recibe cantidad de dedos\n{\n int k = 0;\n\n if (venusiana > marciano)//Si la cantidad de dedos de la venusiana es mayor al marciano\n {\n if (marciano == (venusiana - 1))//y si la cantidad de dedos del marciano es igual a la de la venusiana -1\n {\n k = 1;//Entonces se sienten comodos\n }\n }\n if (venusiana < marciano)//Si la cantidad de dedos de la venusiana es menor que la del marciano\n {\n if (2*venusiana +2 >= marciano)//Si 2*cantidad de dedos de la venusiana + 2 es mayor o igual a la del marciano\n {\n k = 1;//se sienten comodos\n }\n }\n if (venusiana == marciano)//si tienen igual cantidad de dedos\n {\n k = 1;//se sienten comodos\n }\n\n return k;//retorna k\n}\n\nint mano_venus(char* venusString, int num)\n{\n char auxVenus[MAX];\n strcpy(auxVenus, venusString);\n int k = -1;\n\n char* manoVenusIzq = strtok(venusString, \" \");//tokeniza y almacena la cantidad de dedos de la izquierda\n char* manoVenusDer = strtok(NULL, \" \");//tokeniza y almacena la cantidad de dedos de la derecha\n\n if (atoi(manoVenusIzq) > 0 && atoi(manoVenusIzq) <= 100)//si los dedos de la izquierda no exceden de 100\n {\n if (atoi(manoVenusDer) > 0 && atoi(manoVenusDer) <= 100)//si los dedos de la derecha no exceden de 100\n {\n if(num == 1)//Si num es igual a 100\n {\n k = atoi(manoVenusIzq);//k es igual a cantidad de dedos en la mano izquierda del marciano\n }else{\n k = atoi(manoVenusDer);//k es igual a cantidad de dedos en la mano derecha del marciano\n }\n }\n }\n\n return k;//retorna k\n}\n\nint mano_marte(char* marteString, int num)\n{\n char* manoMarteIzq = strtok(marteString, \" \");//se tokeniza para obtener la mano izquierda\n char* manoMarteDer = strtok(NULL, \" \");//se vuelve a tokenizar para obtener la mano derecha\n int k = -1;\n\n if (atoi(manoMarteIzq) > 0 && atoi(manoMarteIzq) <= 100)//Si la mano izquierda no excede de 100\n {\n if (atoi(manoMarteDer) > 0 && atoi(manoMarteDer) <= 100)//si su mano derecha no excede de 100\n {\n if(num == 1)//Si num es igual a 1\n {\n k = atoi(manoMarteDer);//k es igual a cantidad de dedos en la mano derecha\n }else{\n k = atoi(manoMarteIzq);//k es igual a cantidad de dedos en la mano izquierda\n }\n }\n }\n\n return k;//retorna k\n}\n"}, {"source_code": "#include \n\nint main(){\n\n int x1,x2,y1,y2;\n int sw=0;\n\n scanf(\"%d %d\",&x1,&x2);\n scanf(\"%d %d\",&y1,&y2);\n\n if( y2x1 ){\n if( 2*x1+2 >= y2 )\n sw=1;\n }\n else sw=1;\n\n\n if(!sw){\n if( y1x2 ){\n if( 2*x2+2 >= y1 )\n sw=1;\n }\n else sw=1;\n }\n\n if(sw)\n puts(\"YES\");\n else\n puts(\"NO\");\n\n return 0;\n}"}, {"source_code": "#include \nint main ()\n{\n int gl;\n int gr;\n int bl;\n int br;\n\n scanf (\"%d\",&gl);\n scanf (\"%d\",&gr);\n scanf (\"%d\",&bl);\n scanf (\"%d\",&br);\n\n\n\n\n if ( lb (br,gl) || rb (bl,gr))\n printf (\"YES\");\n else\n printf (\"NO\");\n\n\n}\nint lb(int br, int gl)\n{\n if (br!=gl)\n {\n if ((brgl && (2*gl + 2 >= br)))\n return 1;\n else\n return 0;\n }\n else\n return 1;\n\n}\nint rb(int bl, int gr)\n{\n if (bl!=gr)\n {\n if ((blgr && (2*gr + 2 >= bl)))\n return 1;\n else\n return 0;\n }\n else\n return 1;\n\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint a,b,c,d,flag=0;\n\tscanf(\"%d%d%d%d\",&a,&b,&c,&d);\n\tif(c>=(b-1) && c<=(2*(b+1)))\n\t{\n\t\tprintf(\"YES\\n\");\n\t\tflag=1;\n\t}\n\tif(flag==0)\n\t{\n\t\tif(d>=(a-1) && d<=(2*(a+1)))\n\t\t{\n\t\t\tprintf(\"YES\\n\");\n\t\t\tflag=1;\n\t\t}\n\t}\n\tif(flag==0)\n\t\tprintf(\"NO\\n\");\n\treturn 0;\n\n}\n"}, {"source_code": "#include\nmain()\n{\nint al,ar,bl,br;\nscanf(\"%d%d%d%d\",&al,&ar,&bl,&br);\nint b1=0,b2=0;\nif(ar==1 && bl<=4)\n{\nprintf(\"YES\\n\");\nreturn 0;\n}\nif(al==1 && br<=4)\n{\nprintf(\"YES\\n\");\nreturn 0;\n}\n/*if(ar==1 && bl>4)\n{\nprintf(\"NO\\n\");\nreturn 0;\n}\nif(al==1 && br>4)\n{\nprintf(\"NO\\n\");\nreturn 0;\n}*/\nif(bl>=ar-1 && bl<=2*(ar+1))\nb1=1;\nif(br>=al-1 && br<=2*(al+1))\nb2=1;\nif(b1==1||b2==1)\nprintf(\"YES\\n\");\nelse\nprintf(\"NO\\n\");\nreturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tint a,b,c,d,f;\n\tscanf(\"%d %d\",&a,&b);\n\tscanf(\"%d %d\",&c,&d);\n\tf=0;\n\tif (d>=a-1 && d<=2*(a+1)){\n\t\tf=1;\n\t}\n\telse if(c>=b-1 && c<=2*(b+1)){\n\t\tf=2;\n\t}\n\tif (f==1 || f==2){\n\t\tprintf(\"YES\");\n\t}\n\telse{\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int al,ar,bl,br;\n scanf(\"%d %d\",&al,&ar);\n scanf(\"%d %d\",&bl,&br);\n if(((al-1)<=br&&((int)(br/2.0+0.5)-1)<=al)||((ar-1)<=bl&&((int)(bl/2.0+0.5)-1)<=ar))\n {\n printf(\"YES\\n\");\n return 0;\n }\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint a1,a2,b1,b2;\n\tscanf(\"%d%d%d%d\",&a1,&a2,&b1,&b2);\n\tif(((b1>=a2-1) && b1<=2*(a2+1)) || ((b2>=a1-1) && b2<=2*(a1+1)))\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\treturn 0;\n\n}\n\n"}, {"source_code": "#include \nint main()\n{\n int al,ar,bl,br;\n scanf(\"%d%d\\n%d%d\",&al,&ar,&bl,&br);\n if((al-br<2)&&(br<2*al+3)||(ar-bl<2)&&(bl<2*ar+3)) {\n printf(\"YES\\n\");\n }\n else {\n printf(\"NO\\n\");\n }\n return 0;\n}\n\n"}, {"source_code": "#include \n\nint main()\n{\n int vi, vd, mi, md;\n int aux = 0;\n scanf(\"%d%d%d%d\", &vi, &vd, &mi, &md);\n\n if((vi <= md+1 && md <= vi*2+2) || (vd <= mi+1 && mi <= vd*2+2))\n aux += 1;\n\n if(aux)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(){\n\n int G1,G2,B1,B2;\n int exito = 0;\n\n scanf(\"%d %d\", &G1, &G2);\n scanf(\"%d %d\", &B1, &B2);\n\n if( B2 < G1 ){\n if( B2 == G1-1 ) \n exito=1;\n }else if( B2 > G1 ){\n if( 2*G1 + 2 >= B2 ) \n exito = 1;\n }else \n exito = 1;\n\n\n if(!exito){\n if( B1 < G2 ){\n if( B1 == G2-1 ) \n exito=1;\n }else if( B1 > G2 ){\n if( 2*G2 + 2 >= B1 ) \n exito=1;\n }else \n exito=1;\n }\n\n if(exito)\n puts(\"YES\");\n else \n puts(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main( void )\n{\n int gl, gr, bl, br;\n scanf( \"%d %d %d %d\", &gl, &gr, &bl, &br );\n if ( ( br + 1 >= gl && 2 * gl + 2 >= br ) || ( bl + 1 >= gr && 2 * gr + 2 >= bl ) ) {\n puts( \"YES\" );\n } else {\n puts( \"NO\" );\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int bl,br,gl,gr;\n scanf(\"%d%d\",&gl,&gr);\n scanf(\"%d%d\",&bl,&br);\n if((br>=(gl-1) && br<=(gl+1)*2) || (bl>=(gr-1) && bl<=(gr+1)*2))\n printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint A,B,C,D;\nint main(){\n\tscanf(\"%d%d%d%d\",&A,&B,&C,&D);\n\tif((A*2+3>D&&D+1>=A)||(B*2+3>C&&C+1>=B))\n puts(\"YES\");\n\telse puts(\"NO\");\n}"}, {"source_code": "# include \n# include \n\nmain(){\n int R, L, l, r;\n scanf(\"%d %d\", &L, &R);\n scanf(\"%d %d\", &l, &r);\n if( R - 1 <= l && (R + 1) * 2 >= l ) printf(\"YES\\n\");\n else if( L - 1 <= r && (L + 1)*2 >= r ) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\t\n}"}, {"source_code": "#include \n#include \n#include \n#define MAX 8//maxima cantidad de elementos a introducir\n\nint mano_venus(char* venusString, int num);\nint mano_marte(char* marteString, int num);\nint comfortable(int venusiana, int marciano);\n\nint main(int argc, char const *argv[])\n{\n char venus[MAX], marte[MAX];//se crean los vectores de tamaño 8 para la lectura\n char auxVenus[MAX], auxMarte[MAX];//se crean los vectores de tamaño MAX para el input\n\n int hand_venus, hand_mars;//variable de validacion de cantidad de dedos\n\n gets(venus); strcpy(auxVenus, venus); //se obtienen los datos de la venusiana y se copian en un vector auxiliar para la tokenizacion\n gets(marte); strcpy(auxMarte, marte);//se obtienen los datos del marciano y se copian los datos en un vector auxiliar para la tokenizacion\n\n hand_venus = mano_venus(venus, 1);//El caso 1 es mano izquierda venus, mano derecho marte\n hand_mars = mano_marte(marte, 1);\n\n if (hand_venus != -1 && hand_mars != -1)//Si ambos no exceden el limite de dedos\n {\n if(comfortable(hand_venus, hand_mars))//llama a la funcion comfortable\n {\n printf(\"YES\");\n }else{//Si no se sienten comodos\n hand_venus = mano_venus(auxVenus, 2);//El caso 2 es mano derecha de la venusiana e izquierda del marciano\n hand_mars = mano_marte(auxMarte, 2);\n if (comfortable(hand_venus, hand_mars))//Si ambos se sienten comodos\n {\n printf(\"YES\");//imprime si\n }else{\n printf(\"NO\");//Si no, no.\n }\n }\n }\n\n return 0;\n}\n\nint comfortable(int venusiana, int marciano)//Recibe cantidad de dedos\n{\n int k = 0;\n\n if (venusiana > marciano)//Si la cantidad de dedos de la venusiana es mayor al marciano\n {\n if (marciano == (venusiana - 1))//y si la cantidad de dedos del marciano es igual a la de la venusiana -1\n {\n k = 1;//Entonces se sienten comodos\n }\n }\n if (venusiana < marciano)//Si la cantidad de dedos de la venusiana es menor que la del marciano\n {\n if (2*venusiana +2 >= marciano)//Si 2*cantidad de dedos de la venusiana + 2 es mayor o igual a la del marciano\n {\n k = 1;//se sienten comodos\n }\n }\n if (venusiana == marciano)//si tienen igual cantidad de dedos\n {\n k = 1;//se sienten comodos\n }\n\n return k;//retorna k\n}\n\nint mano_venus(char* venusString, int num)\n{\n char auxVenus[MAX];\n strcpy(auxVenus, venusString);\n int k = -1;\n\n char* manoVenusIzq = strtok(venusString, \" \");//tokeniza y almacena la cantidad de dedos de la izquierda\n char* manoVenusDer = strtok(NULL, \" \");//tokeniza y almacena la cantidad de dedos de la derecha\n\n if (atoi(manoVenusIzq) > 0 && atoi(manoVenusIzq) <= 100)//si los dedos de la izquierda no exceden de 100\n {\n if (atoi(manoVenusDer) > 0 && atoi(manoVenusDer) <= 100)//si los dedos de la derecha no exceden de 100\n {\n if(num == 1)//Si num es igual a 100\n {\n k = atoi(manoVenusIzq);//k es igual a cantidad de dedos en la mano izquierda del marciano\n }else{\n k = atoi(manoVenusDer);//k es igual a cantidad de dedos en la mano derecha del marciano\n }\n }\n }\n\n return k;//retorna k\n}\n\nint mano_marte(char* marteString, int num)\n{\n char* manoMarteIzq = strtok(marteString, \" \");//se tokeniza para obtener la mano izquierda\n char* manoMarteDer = strtok(NULL, \" \");//se vuelve a tokenizar para obtener la mano derecha\n int k = -1;\n\n if (atoi(manoMarteIzq) > 0 && atoi(manoMarteIzq) <= 100)//Si la mano izquierda no excede de 100\n {\n if (atoi(manoMarteDer) > 0 && atoi(manoMarteDer) <= 100)//si su mano derecha no excede de 100\n {\n if(num == 1)//Si num es igual a 1\n {\n k = atoi(manoMarteDer);//k es igual a cantidad de dedos en la mano derecha\n }else{\n k = atoi(manoMarteIzq);//k es igual a cantidad de dedos en la mano izquierda\n }\n }\n }\n\n return k;//retorna k\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint gr,gl,br,bl,i;\n\tscanf(\"%d%d\",&gr,&gl);\n\tscanf(\"%d%d\",&br,&bl);\n\tif((bl-gr>=-1 && (bl-2*gr)<3) || (br-gl>=-1 && br-(2*gl)<3))\n\tprintf(\"YES\\n\");\n\telse\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int al,ar,bl,br;\n scanf(\"%d%d%d%d\",&al,&ar,&bl,&br);\n if(br>=(al-1)&&br<=(al+1)*2)\n printf(\"YES\\n\");\n else if(bl>=(ar-1)&&bl<=(ar+1)*2)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int g1,g2,b1,b2;\n\tscanf(\"%d%d\",&g1,&g2);\n\tscanf(\"%d%d\",&b1,&b2);\n\tif((g2>=b1&&(g2-b1)<=1)||g1>=b2&&(g1-b2)<=1)\n\t\tprintf(\"YES\");\n\telse if((b1>=g2&&(b1<=2*(g2+1)))||(b2>=g1&&(b2<=2*(g1+1))))\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\treturn 0;\n}\n\t"}, {"source_code": "#include\n#include\nvoid ver(int mujeri,int mujerd,int machoi,int machod);\nint main()\n{\n int a,b,c,d;\n scanf(\"%d%d%d%d\",&a,&b,&c,&d);\n ver(a,b,c,d);\n return 0;\n}\nvoid ver(int mujeri,int mujerd,int machoi,int machod)\n{\n if(machod>=mujeri && (machod-mujeri)-1<3 || machoi>=mujerd && (machoi-mujerd)-1<3 || mujerd-machoi==1 || mujeri-machod==1 || machod>mujeri && machod<=2+mujeri*2 || machoi>mujerd && machoi<=2+mujerd*2)printf(\"YES\");\n else printf(\"NO\");\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n\nint main(void)\n{\n int a1, a2, b1, b2;\n\n scanf(\"%d%d%d%d\", &a1, &a2, &b1, &b2);\n\n if(((a1 - 1) <= b2 && (double)b2 / (a1 + 1) <= 2)\n ||((a2 - 1) <= b1 && (double)b1 / (a2 + 1) <= 2))\n printf(\"YES\");\n else\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\nint main()\n{\n\tint a1,a2,b1,b2;\n\tscanf(\"%d%d%d%d\",&a1,&a2,&b1,&b2);\n\tif((a1<=b2+1&&a1*2+3>b2)||(a2<=b1+1&&a2*2+3>b1))\n\tprintf(\"YES\");\n\telse\n\tprintf(\"NO\");\n\n}"}, {"source_code": "#include\nint main()\n{\n int bl,br,gl,gr;\n scanf(\"%d%d\",&gl,&gr);\n scanf(\"%d%d\",&bl,&br);\n if((br>=(gl-1) && br<=(gl+1)*2) || (bl>=(gr-1) && bl<=(gr+1)*2))\n printf(\"YES\");\n else printf(\"NO\");\n return(0);\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n\tint a1,a2,b1,b2;\n\tscanf(\"%d %d %d %d\", &a1,&a2,&b1,&b2);\n\tif(a1 < b2 +2 && b2 <= a1 * 2 + 2 || a2 < b1 +2 && b1 <= a2 * 2 + 2)\n\t{\n\t\tprintf(\"YES\");\n\t}else\n\t{\n\t\tprintf(\"NO\");\n\t}\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint gl,gr,bl,br,i,j,k,l;\n\tscanf(\"%d %d\\n%d %d\",&gl,&gr,&bl,&br);\n\tprintf((gl!=0)&&(br!=0)&&(br>=gl-1)&&(br<=2*gl+2)?\"YES\":((gr!=0)&&(bl!=0)&&(bl>=gr-1)&&(bl<=2*gr+2)?\"YES\":\"NO\"));\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main(int argc, char *argv[])\n{\n int al, ar, bl, br;\n \n scanf(\"%d %d %d %d\", &al, &ar, &bl, &br);\n \n if((ar - 1 <= bl && bl <= 2 * ar + 2) || (al - 1 <= br && br <= 2 * al + 2))\n puts(\"YES\");\n else\n puts(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(){\n\n int x1,x2,y1,y2;\n int sw=0;\n\n scanf(\"%d %d\",&x1,&x2);\n scanf(\"%d %d\",&y1,&y2);\n\n if( y2x1 ){\n if( 2*x1+2 >= y2 )\n sw=1;\n }\n else sw=1;\n\n\n if(!sw){\n if( y1x2 ){\n if( 2*x2+2 >= y1 )\n sw=1;\n }\n else sw=1;\n }\n\n if(sw)\n puts(\"YES\");\n else\n puts(\"NO\");\n\n return 0;\n}"}, {"source_code": "#include \nint main()\n{\n int al,ar,bl,br;\n scanf(\"%d%d%d%d\",&al,&ar,&bl,&br);\n if((bl>=ar-1&&ar*2>bl-3)||(br>=al-1&&al*2>br-3))\n {\n printf(\"YES\\n\");\n return 0;\n }\n printf(\"NO\\n\");\n return 0;\n} "}, {"source_code": "#include\n#include\n#include\nint main()\n{\nint gl,gr,bl,br,flag1=1,flag2=1;\n \n scanf(\"%d %d %d %d\",&gl,&gr,&bl,&br);\n if((br\n#include\n#include\nint main()\n{\nint gl,gr,bl,br,flag1=1,flag2=1;\n \n scanf(\"%d %d %d %d\",&gl,&gr,&bl,&br);\n if((br\n#include \n\nint main() {\n\tint al, ar, bl, br;\n\tscanf(\"%d%d%d%d\", &al, &ar, &bl, &br);\n\tif ((bl >= ar - 1 && bl <= (ar + 1) * 2) || (br >= al - 1 && br <= (al + 1) * 2))\n\t\tprintf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\n\n\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int r1,r2,l1,l2;\n //while(scanf(\"%d%d\",&r1,&l1))\n //{\n scanf(\"%d%d\",&l1,&r1);\n scanf(\"%d%d\",&l2,&r2);\n if(((2*l1+3>r2)&&(r2+1>=l1))||((2*r1+3>l2)&&(l2+1>=r1)))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n //}\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \n#define MAX 8\n\nint mano_venus(char* venusString, int num);\nint mano_marte(char* marteString, int num);\nint comfortable(int venusiana, int marciano);\n\nint main(int argc, char const *argv[])\n{\n char venus[MAX], marte[MAX];\n char auxVenus[MAX], auxMarte[MAX];\n\n int hand_venus, hand_mars;\n\n gets(venus); strcpy(auxVenus, venus); \n gets(marte); strcpy(auxMarte, marte);\n\n hand_venus = mano_venus(venus, 1);\n hand_mars = mano_marte(marte, 1);\n\n if (hand_venus != -1 && hand_mars != -1)\n {\n if(comfortable(hand_venus, hand_mars))\n {\n printf(\"YES\");\n }else{\n hand_venus = mano_venus(auxVenus, 2);\n hand_mars = mano_marte(auxMarte, 2);\n if (comfortable(hand_venus, hand_mars))\n {\n printf(\"YES\");\n }else{\n printf(\"NO\");\n }\n }\n }\n\n return 0;\n}\n\nint comfortable(int venusiana, int marciano)\n{ \n int k = 0;\n\n if (venusiana > marciano)\n {\n if (marciano == (venusiana - 1))\n {\n k = 1;\n }\n }\n if (venusiana < marciano)\n {\n if (2*venusiana +2 >= marciano)\n {\n k = 1;\n }\n }\n if (venusiana == marciano)\n {\n k = 1;\n }\n\n return k;\n}\n\nint mano_venus(char* venusString, int num)\n{\n char auxVenus[MAX];\n strcpy(auxVenus, venusString);\n int k = -1;\n\n char* manoVenusIzq = strtok(venusString, \" \");\n char* manoVenusDer = strtok(NULL, \" \");\n\n if (atoi(manoVenusIzq) > 0 && atoi(manoVenusIzq) <= 100)\n {\n if (atoi(manoVenusDer) > 0 && atoi(manoVenusDer) <= 100)\n {\n if(num == 1)\n {\n k = atoi(manoVenusIzq);\n }else{\n k = atoi(manoVenusDer);\n }\n }\n }\n\n return k;\n}\n\nint mano_marte(char* marteString, int num)\n{\n char* manoMarteIzq = strtok(marteString, \" \");\n char* manoMarteDer = strtok(NULL, \" \");\n int k = -1;\n\n if (atoi(manoMarteIzq) > 0 && atoi(manoMarteIzq) <= 100)\n {\n if (atoi(manoMarteDer) > 0 && atoi(manoMarteDer) <= 100)\n {\n if(num == 1)\n {\n k = atoi(manoMarteDer);\n }else{\n k = atoi(manoMarteIzq);\n }\n }\n }\n\n return k;\n}"}, {"source_code": "#include \n#include \n\nint main() {\n\tint al, ar, bl, br;\n\tscanf(\"%d%d%d%d\", &al, &ar, &bl, &br);\n\tif ((bl >= ar - 1 && bl <= (ar + 1) * 2) || (br >= al - 1 && br <= (al + 1) * 2))\n\t\tprintf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\n\n\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n#include \n#define MAX 8\n\nint mano_venus(char* venusString, int num);\nint mano_marte(char* marteString, int num);\nint comfortable(int venusiana, int marciano);\n\nint main(int argc, char const *argv[])\n{\n char venus[MAX], marte[MAX];\n char auxVenus[MAX], auxMarte[MAX];\n\n int hand_venus, hand_mars;\n\n gets(venus); strcpy(auxVenus, venus); \n gets(marte); strcpy(auxMarte, marte);\n\n hand_venus = mano_venus(venus, 1);\n hand_mars = mano_marte(marte, 1);\n\n if (hand_venus != -1 && hand_mars != -1)\n {\n if(comfortable(hand_venus, hand_mars))\n {\n printf(\"YES\");\n }else{\n hand_venus = mano_venus(auxVenus, 2);\n hand_mars = mano_marte(auxMarte, 2);\n if (comfortable(hand_venus, hand_mars))\n {\n printf(\"YES\");\n }else{\n printf(\"NO\");\n }\n }\n }\n\n return 0;\n}\n\nint comfortable(int venusiana, int marciano)\n{ \n int k = 0;\n\n if (venusiana > marciano)\n {\n if (marciano == (venusiana - 1))\n {\n k = 1;\n }\n }\n if (venusiana < marciano)\n {\n if (2*venusiana +2 >= marciano)\n {\n k = 1;\n }\n }\n if (venusiana == marciano)\n {\n k = 1;\n }\n\n return k;\n}\n\nint mano_venus(char* venusString, int num)\n{\n char auxVenus[MAX];\n strcpy(auxVenus, venusString);\n int k = -1;\n\n char* manoVenusIzq = strtok(venusString, \" \");\n char* manoVenusDer = strtok(NULL, \" \");\n\n if (atoi(manoVenusIzq) > 0 && atoi(manoVenusIzq) <= 100)\n {\n if (atoi(manoVenusDer) > 0 && atoi(manoVenusDer) <= 100)\n {\n if(num == 1)\n {\n k = atoi(manoVenusIzq);\n }else{\n k = atoi(manoVenusDer);\n }\n }\n }\n\n return k;\n}\n\nint mano_marte(char* marteString, int num)\n{\n char* manoMarteIzq = strtok(marteString, \" \");\n char* manoMarteDer = strtok(NULL, \" \");\n int k = -1;\n\n if (atoi(manoMarteIzq) > 0 && atoi(manoMarteIzq) <= 100)\n {\n if (atoi(manoMarteDer) > 0 && atoi(manoMarteDer) <= 100)\n {\n if(num == 1)\n {\n k = atoi(manoMarteDer);\n }else{\n k = atoi(manoMarteIzq);\n }\n }\n }\n\n return k;\n}"}, {"source_code": "#include \nint main(void)\n{\n int a,b,c,d,e=0;\n scanf(\"%d%d\\n\" , &a, &b);\n scanf(\"%d%d\" , &c, &d);\n if (a==1 && d==5)\n {\n e=0;\n }\n else if (b==1 && c==5)\n {\n e=0;\n }\n\n else if (a-1 <= d && ((d/2)-1) <=a )\n {\n e=1;\n }\n else if (b-1 <= c && ((c/2)-1) <= b)\n {\n e=1;\n }\n if (e==1)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n}\n"}, {"source_code": "#include\n#include\nint cei(int a)\n{\n\tint b=a/2;\n\tif(a==b*2)\n\treturn b;\n\telse return b+1;\n}\t\nint flag=0;\nvoid fun(int boy,int girl)\n{\n\tif(girl>=cei(boy)-1 && girl<=boy+1)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\tflag=1;\n\t\treturn ;\n\t}\t\n}\n\t\n\nint main()\n{\n\tint boy[2],girl[2];\n\tscanf(\"%d%d\",&girl[0],&girl[1]);\n\tscanf(\"%d%d\",&boy[0],&boy[1]);\n\tfun(boy[0],girl[1]);\n\tif(flag==0)fun(boy[1],girl[0]);\n\tif(flag==0)\n\tprintf(\"NO\\n\");\n\treturn 0;\n\t}\n\t\n"}, {"source_code": "#include \n\nint main()\n{\n int boyr, boyl, girlr, girll;\n\n scanf(\"%d %d %d %d\", &girlr, &girll, &boyr, &boyl);\n\n if(((girlr-1)<=boyl && boyl<=(girlr+1)*2) || ((girll-1)<=boyr && boyr<=(girll+1)*2))\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\nint main()\n{\nint gl,gr,bl,br,flag1=1,flag2=1;\n \n scanf(\"%d %d %d %d\",&gl,&gr,&bl,&br);\n if((br\nint main()\n{\n int a,b,c,d,f=0;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n if(a>=d){\n if(a-d<=1) f=1;\n if(a==d) f=1;\n }\n else if(d>a){\n if(d%2==0){\n if(a>=((d/2)-1)) f=1;\n }\n else if(d%2!=0){\n if(a>=(d/2)) f=1;\n }\n }\n if(b>=c&&f==0){\n if(b-c<=1) f=1;\n if(b==c) f=1;\n }\n else if(c>b&&f==0){\n if(c%2==0){\n if(b>=((c/2)-1)) f=1;\n }\n else if(c%2!=0) {\n if(b>=(c/2)) f=1;\n }\n }\n if(f) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#define MAX 8\n\nint mano_venus(char* venusString, int num);\nint mano_marte(char* marteString, int num);\nint comfortable(int venusiana, int marciano);\n\nint main(int argc, char const *argv[])\n{\n char venus[MAX], marte[MAX];\n char auxVenus[MAX], auxMarte[MAX];\n\n int hand_venus, hand_mars;\n\n gets(venus); strcpy(auxVenus, venus); \n gets(marte); strcpy(auxMarte, marte);\n\n hand_venus = mano_venus(venus, 1);\n hand_mars = mano_marte(marte, 1);\n\n if (hand_venus != -1 && hand_mars != -1)\n {\n if(comfortable(hand_venus, hand_mars))\n {\n printf(\"YES\");\n }else{\n hand_venus = mano_venus(auxVenus, 2);\n hand_mars = mano_marte(auxMarte, 2);\n if (comfortable(hand_venus, hand_mars))\n {\n printf(\"YES\");\n }else{\n printf(\"NO\");\n }\n }\n }\n\n return 0;\n}\n\nint comfortable(int venusiana, int marciano)\n{ \n int k = 0;\n\n if (venusiana > marciano)\n {\n if (marciano == (venusiana - 1))\n {\n k = 1;\n }\n }\n if (venusiana < marciano)\n {\n if (2*venusiana +2 >= marciano)\n {\n k = 1;\n }\n }\n if (venusiana == marciano)\n {\n k = 1;\n }\n\n return k;\n}\n\nint mano_venus(char* venusString, int num)\n{\n char auxVenus[MAX];\n strcpy(auxVenus, venusString);\n int k = -1;\n\n char* manoVenusIzq = strtok(venusString, \" \");\n char* manoVenusDer = strtok(NULL, \" \");\n\n if (atoi(manoVenusIzq) > 0 && atoi(manoVenusIzq) <= 100)\n {\n if (atoi(manoVenusDer) > 0 && atoi(manoVenusDer) <= 100)\n {\n if(num == 1)\n {\n k = atoi(manoVenusIzq);\n }else{\n k = atoi(manoVenusDer);\n }\n }\n }\n\n return k;\n}\n\nint mano_marte(char* marteString, int num)\n{\n char* manoMarteIzq = strtok(marteString, \" \");\n char* manoMarteDer = strtok(NULL, \" \");\n int k = -1;\n\n if (atoi(manoMarteIzq) > 0 && atoi(manoMarteIzq) <= 100)\n {\n if (atoi(manoMarteDer) > 0 && atoi(manoMarteDer) <= 100)\n {\n if(num == 1)\n {\n k = atoi(manoMarteDer);\n }else{\n k = atoi(manoMarteIzq);\n }\n }\n }\n\n return k;\n}"}, {"source_code": "#include \nint ok(int a,int b) {\n if(a>b+1) return 0;\n if(b>a*2+2) return 0;\n return 1;\n}\nint main() {\n int a,b,c,d;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n if(ok(a,d) || ok(b,c)) puts(\"YES\");\n else puts(\"NO\");\n return 0;\n}\n"}, {"source_code": "\n#include \n\nint main(){\n\n int G1,G2,B1,B2;\n int exito=0;\n\n scanf(\"%d %d\",&G1,&G2);\n scanf(\"%d %d\",&B1,&B2);\n\n if( B2G1 ){\n if( 2*G1+2 >= B2 ) exito=1;\n }else exito=1;\n\n\n if(!exito){\n if( B1G2 ){\n if( 2*G2+2 >= B1 ) exito=1;\n }else exito=1;\n }\n\n if(exito)puts(\"YES\");\n else puts(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include\nint hand(int,int);\nint main()\n{\n int a,b,c,d,z1,z2;\n scanf(\"%d %d\",&a,&b);\n scanf(\"%d %d\",&c,&d);\n z1=hand(a,d);\n z2=hand(b,c);\n if((z1==1)||(z2==1))\n printf(\"YES\");\n else\n printf(\"NO\");\n return(0);\n}\nint hand(int x,int z)\n{\n if((x>z)&&(z!=0))\n {\n if(z==x-1)\n return(1);\n else\n return(0); \n }\n else if((x==z)&&(x!=0))\n return(1);\n else\n {\n if((z<=2*(x+1))&&(z>0))\n return(1);\n else\n return(0);\n }\n}\n \n"}, {"source_code": "#include \n\nint main()\n{\n int vi, vd, mi, md;\n int aux = 0;\n scanf(\"%d%d%d%d\", &vi, &vd, &mi, &md);\n\n if((vi <= md+1 && md <= vi*2+2) || (vd <= mi+1 && mi <= vd*2+2))\n aux += 1;\n\n if(aux)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\n int al,ar,bl,br;\n scanf(\"%d %d %d %d\",&al,&ar,&bl,&br);\n if((br>=(al-1)&&br<=(2*(al+1)))||(bl>=(ar-1)&&bl<=(2*(ar+1))))\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int al,ar,bl,br;\n scanf(\"%i %i\",&al,&ar);\n scanf(\"%i %i\",&bl,&br);\n if((al-1<=br&&br<=2*(al+1))||(ar-1<=bl&&bl<=2*(ar+1)))\n { printf(\"YES\");return 0;}\n printf(\"NO\");return 0;\n}"}, {"source_code": "#include \nint main ()\n{\n int gl;\n int gr;\n int bl;\n int br;\n\n scanf (\"%d\",&gl);\n scanf (\"%d\",&gr);\n scanf (\"%d\",&bl);\n scanf (\"%d\",&br);\n\n\n\n\n if ( lb (br,gl) || rb (bl,gr))\n printf (\"YES\");\n else\n printf (\"NO\");\n\n\n}\nint lb(int br, int gl)\n{\n if (br!=gl)\n {\n if ((brgl && (2*gl + 2 >= br)))\n return 1;\n else\n return 0;\n }\n else\n return 1;\n\n}\nint rb(int bl, int gr)\n{\n if (bl!=gr)\n {\n if ((blgr && (2*gr + 2 >= bl)))\n return 1;\n else\n return 0;\n }\n else\n return 1;\n\n}"}, {"source_code": "#include\nint main()\n{\n int gl,gr,bl,br,a,b,c1,c2,c3,c4;\n while((scanf(\"%d%d%d%d\",&gl,&gr,&bl,&br))!=EOF)\n {\n if(bl%2==0)\n {\n a=bl/2;\n }\n else\n {\n a=((int)(bl/2))+1;\n }\n\n if(br%2==0)\n {\n b=br/2;\n }\n else\n {\n b=((int)(br/2))+1;\n }\n\n c1= (bl+1)>=gr;\n c2= (gr+1)>=a;\n c3= (br+1)>=gl;\n c4= (gl+1)>=b;\n\n if((c1==1 && c2==1) || (c3==1 && c4==1))\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint a1,a2,b1,b2;\n\tscanf(\"%d%d%d%d\",&a1,&a2,&b1,&b2);\n\tif(((b1>=a2-1) && b1<=2*(a2+1)) || ((b2>=a1-1) && b2<=2*(a1+1)))\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\treturn 0;\n\n}\n\n"}, {"source_code": "#include \n#include \nint main()\n{\n int a1, a2, b1, b2, temp, temp2;\n scanf(\"%d %d %d %d\", &a1, &a2, &b1, &b2);\n if(a1 >= b2)\n {\n if(a1 - b2 <= 1)\n {\n printf(\"YES\");\n return 0;\n }\n }\n else\n {\n if(b2 - a1 - 1 <= b2 / 2)\n {\n printf(\"YES\");\n return 0;\n }\n }\n if(a2 >= b1)\n {\n if(a2 - b1 <= 1)\n {\n printf(\"YES\");\n return 0;\n }\n }\n else\n {\n if(b1 - a2 - 1 <= b1 / 2)\n {\n printf(\"YES\");\n return 0;\n }\n }\n printf(\"NO\"); \n return 0;\n} \n"}, {"source_code": "#include\nint main()\n{\n int al,ar,bl,br;\n scanf(\"%d %d\",&al,&ar);\n scanf(\"%d %d\",&bl,&br);\n if(((al-1)<=br&&((int)(br/2.0+0.5)-1)<=al)||((ar-1)<=bl&&((int)(bl/2.0+0.5)-1)<=ar))\n {\n printf(\"YES\\n\");\n return 0;\n }\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint div1(int x, int b);\nint main()\n{\n\tint ar, al, br, bl;\n\tar = 0;\n\tal = 0;\n\tbr = 0;\n\tbl = 0;\n\tscanf(\"%d%d\",&ar, &al);\n\tscanf(\"%d%d\",&br, &bl);\n\tif( div1(ar,bl) == 1 )\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t{\n\t if( div1(al,br) == 1 )\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n\t}\n\treturn 0;\n}\nint div1(int b, int x)\n{\n\tint y, z, c,a;\n\tz=0;\n\tif(x < b)\n\t{\t\n\t\tif(x == b-1)\n\t\t{\n\t\t\tz=1;\n\t\t}\n\t}\n\telse\n\t{\n\t\tif( x > b)\n\t\t{\n\t\t\tc = 2*b+2;\n\t\t\tif( ( c >= x ) || (x-b-1 < 3) )\n\t\t\t\tz=1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif ( x == b)\n\t\t\t\tz=1;\n\t\t}\n\t}\n\treturn z;\n}\n"}, {"source_code": "#include\n#include\nint main(){\nint g[2],b[2],i;\nfor(i=0;i<2;i++)\n scanf(\"%d\",&g[i]);\nfor(i=0;i<2;i++)\n scanf(\"%d\",&b[i]);\nif((b[1]>=g[0]-1)&&(b[1]<=(g[0]+1)*2)){\n printf(\"YES\");\n exit(0);\n}\nif((b[0]>=g[1]-1)&&(b[0]<=(g[1]+1)*2)){\n printf(\"YES\");\n exit(0);\n}\nelse\n printf(\"NO\");\nreturn 0;\n}\n"}, {"source_code": "#include\"stdio.h\"\nint funcion(int x,int y){\n if((x+1)*2>=y && (y+1)>=x)\n return 1;\n else\n return 0;\n }\nint main(){\n int al,ar,bl,br,k;\n while(scanf(\"%d %d %d %d\",&al,&ar,&bl,&br)!=EOF){\n k=funcion(al,br)+funcion(ar,bl);\n if(k>=1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n k=0;}\n//getch();\nreturn 0;\n}\n"}, {"source_code": "#include\n\nint main(){\n\tint gl, gr, bl, br;\n\tscanf(\"%d%d\", &gl, &gr);\n\tscanf(\"%d%d\", &bl, &br);\n\tif(((gl-br<=1 && gl*2+2>=br) || (gr-bl<=1 && gr*2+2>=bl))){\n\t\tprintf(\"YES\");\n\t}else{\n\t\tprintf(\"NO\");\n\t}\n\t\n\treturn 0;\n\t\n}\n"}, {"source_code": "#include \nint main()\n{\n int al,ar,bl,br;\n scanf(\"%d%d\\n%d%d\",&al,&ar,&bl,&br);\n if((al-br<2)&&(br<2*al+3)||(ar-bl<2)&&(bl<2*ar+3)) {\n printf(\"YES\\n\");\n }\n else {\n printf(\"NO\\n\");\n }\n return 0;\n}\n\n"}, {"source_code": "#include\n#include\n#include\n#include\n#include\n#define oo 1000000000\n#define pi 3.14159265359\n#define zero(a) (abb(a)<=1e-7)\n#define lowbit(a) ((a)&(-(a)))\n#define min(a,b) ((a)<(b)?(a):(b))\n#define max(a,b) ((a)>(b)?(a):(b))\n#define abb(a) ((a)>0?(a):(-(a)))\n#define cj(x1,y1,x2,y2) ((x1)*(y2)-(x2)*(y2))\n#define dj(x1,y1,x2,y2) ((x1)*(y1)+(y1)*(y2))\n#define dis(x1,y1,x2,y2) sqrt(((x2)-(x1))*((x2)-(x1))+((y2)-(y1))*((y2)-(y1)))\n\nint main()\n{\n int a,b,c,d;\n scanf(\"%d%d%d%d\",&a,&b,&c,&d);\n puts((d>=a-1&&d<=2*(a+1)||c>=b-1&&c<=2*(b+1))?\"YES\":\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \n\nint main( void )\n{\n int gl, gr, bl, br;\n scanf( \"%d %d %d %d\", &gl, &gr, &bl, &br );\n if ( ( br + 1 >= gl && 2 * gl + 2 >= br ) || ( bl + 1 >= gr && 2 * gr + 2 >= bl ) ) {\n puts( \"YES\" );\n } else {\n puts( \"NO\" );\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#define MAX 8//maxima cantidad de elementos a introducir\n\nint mano_venus(char* venusString, int num);\nint mano_marte(char* marteString, int num);\nint comfortable(int venusiana, int marciano);\n\nint main(int argc, char const *argv[])\n{\n char venus[MAX], marte[MAX];//se crean los vectores de tamaño 8 para la lectura\n char auxVenus[MAX], auxMarte[MAX];//se crean los vectores de tamaño MAX para el input\n\n int hand_venus, hand_mars;//variable de validacion de cantidad de dedos\n\n gets(venus); strcpy(auxVenus, venus); //se obtienen los datos de la venusiana y se copian en un vector auxiliar para la tokenizacion\n gets(marte); strcpy(auxMarte, marte);//se obtienen los datos del marciano y se copian los datos en un vector auxiliar para la tokenizacion\n\n hand_venus = mano_venus(venus, 1);//El caso 1 es mano izquierda venus, mano derecho marte\n hand_mars = mano_marte(marte, 1);\n\n if (hand_venus != -1 && hand_mars != -1)//Si ambos no exceden el limite de dedos\n {\n if(comfortable(hand_venus, hand_mars))//llama a la funcion comfortable\n {\n printf(\"YES\");\n }else{//Si no se sienten comodos\n hand_venus = mano_venus(auxVenus, 2);//El caso 2 es mano derecha de la venusiana e izquierda del marciano\n hand_mars = mano_marte(auxMarte, 2);\n if (comfortable(hand_venus, hand_mars))//Si ambos se sienten comodos\n {\n printf(\"YES\");//imprime si\n }else{\n printf(\"NO\");//Si no, no.\n }\n }\n }\n\n return 0;\n}\n\nint comfortable(int venusiana, int marciano)//Recibe cantidad de dedos\n{\n int k = 0;\n\n if (venusiana > marciano)//Si la cantidad de dedos de la venusiana es mayor al marciano\n {\n if (marciano == (venusiana - 1))//y si la cantidad de dedos del marciano es igual a la de la venusiana -1\n {\n k = 1;//Entonces se sienten comodos\n }\n }\n if (venusiana < marciano)//Si la cantidad de dedos de la venusiana es menor que la del marciano\n {\n if (2*venusiana +2 >= marciano)//Si 2*cantidad de dedos de la venusiana + 2 es mayor o igual a la del marciano\n {\n k = 1;//se sienten comodos\n }\n }\n if (venusiana == marciano)//si tienen igual cantidad de dedos\n {\n k = 1;//se sienten comodos\n }\n\n return k;//retorna k\n}\n\nint mano_venus(char* venusString, int num)\n{\n char auxVenus[MAX];\n strcpy(auxVenus, venusString);\n int k = -1;\n\n char* manoVenusIzq = strtok(venusString, \" \");//tokeniza y almacena la cantidad de dedos de la izquierda\n char* manoVenusDer = strtok(NULL, \" \");//tokeniza y almacena la cantidad de dedos de la derecha\n\n if (atoi(manoVenusIzq) > 0 && atoi(manoVenusIzq) <= 100)//si los dedos de la izquierda no exceden de 100\n {\n if (atoi(manoVenusDer) > 0 && atoi(manoVenusDer) <= 100)//si los dedos de la derecha no exceden de 100\n {\n if(num == 1)//Si num es igual a 100\n {\n k = atoi(manoVenusIzq);//k es igual a cantidad de dedos en la mano izquierda del marciano\n }else{\n k = atoi(manoVenusDer);//k es igual a cantidad de dedos en la mano derecha del marciano\n }\n }\n }\n\n return k;//retorna k\n}\n\nint mano_marte(char* marteString, int num)\n{\n char* manoMarteIzq = strtok(marteString, \" \");//se tokeniza para obtener la mano izquierda\n char* manoMarteDer = strtok(NULL, \" \");//se vuelve a tokenizar para obtener la mano derecha\n int k = -1;\n\n if (atoi(manoMarteIzq) > 0 && atoi(manoMarteIzq) <= 100)//Si la mano izquierda no excede de 100\n {\n if (atoi(manoMarteDer) > 0 && atoi(manoMarteDer) <= 100)//si su mano derecha no excede de 100\n {\n if(num == 1)//Si num es igual a 1\n {\n k = atoi(manoMarteDer);//k es igual a cantidad de dedos en la mano derecha\n }else{\n k = atoi(manoMarteIzq);//k es igual a cantidad de dedos en la mano izquierda\n }\n }\n }\n\n return k;//retorna k\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int gl,gr,bl,br;\n \n scanf(\"%d %d\",&gl,&gr);\n scanf(\"%d %d\",&bl,&br);\n \n if((bl>=gr-1 && bl<=2*(gr+1))||(br>=gl-1 && br<=2*(gl+1)))\n printf(\"YES\");\n \n else \n printf(\"NO\");\n \n return 0;\n \n}\n"}, {"source_code": "#include \n#include \nint check_fing(int b, int g){\n\tint groups[102];\n\tint i;\n\tint correct = 1;\n\tmemset(groups,0,102*sizeof(int));\n\tfor(i = 0; b; i=(i+1)%(g+1)){\n\t\tgroups[i]++;\n\t\tb--;\n\t}\n\tfor(i = 0; i 0) && (groups[i]<=2);\n\tfor(i = g-1; i= 0) && (groups[i]<=2);\n\t\t\n\treturn correct;\n}\n\nint main(){\n\tint al, ar, bl, br;\n\tint res = 0;\n\tscanf(\"%d %d\\n%d %d\",&al,&ar,&bl,&br);\n\tres = check_fing(bl,ar) || check_fing(br,al);\n\tprintf(\"%s\\n\", res ? \"YES\":\"NO\");\n\treturn 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n int gl,gr,bl,br;\n scanf(\"%d %d\",&gl,&gr);\n scanf(\"%d %d\",&bl,&br);\n if(br-2*gl-2<=0&&gl-br<=1||bl-2*gr-2<=0&&gr-bl<2)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n //system(\"pause\"); \n return 0;\n} \n"}, {"source_code": "#include \n\nint main(){\n int ar, al, br, bl;\n\n scanf(\"%d%d%d%d\",&ar,&al,&br,&bl);\n\n if (((bl>=ar-1)&&(bl<=ar*2+2))|| ((br>=al-1)&&(br<=al*2+2))){\n printf(\"YES\");\n }else{\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint cei(int a)\n{\n\tint b=a/2;\n\tif(a==b*2)\n\treturn b;\n\telse return b+1;\n}\t\nint flag=0;\nvoid fun(int boy,int girl)\n{\n\tif(girl>=cei(boy)-1 && girl<=boy+1)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\tflag=1;\n\t\treturn ;\n\t}\t\n}\n\t\n\nint main()\n{\n\tint boy[2],girl[2];\n\tscanf(\"%d%d\",&girl[0],&girl[1]);\n\tscanf(\"%d%d\",&boy[0],&boy[1]);\n\tfun(boy[0],girl[1]);\n\tif(flag==0)fun(boy[1],girl[0]);\n\tif(flag==0)\n\tprintf(\"NO\\n\");\n\treturn 0;\n\t}\n\t\n"}, {"source_code": "#include \n\nint main()\n{\n int vi, vd, mi, md;\n int aux = 0;\n scanf(\"%d%d%d%d\", &vi, &vd, &mi, &md);\n\n if((vi <= md+1 && md <= vi*2+2) || (vd <= mi+1 && mi <= vd*2+2))\n aux += 1;\n\n if(aux)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,i=0,j=0,k=0,l=0,m=0;\n int a[200],b[100];\n \n scanf(\"%d\",&b[0]);\n scanf(\"%d\",&b[1]);\n scanf(\"%d\",&a[0]);\n scanf(\"%d\",&a[1]);\n if(a[0]%2!=0 && a[0]>b[1])\n a[0]=a[0]+1;\n if(a[1]%2!=0 && a[1]>b[0])\n a[1]=a[1]+1;\n if(((a[0]-b[1])>=0 && ((a[0]/2)-1)<=b[1]) || ((a[1]-b[0])>=0 && ((a[1]/2)-1)<=b[0]))\n printf(\"YES\");\n \n else if(((b[0]-a[1])>=0 && (b[0]-a[1])<2) || ((b[1]-a[0])>=0 && (b[1]-a[0])<2))\n printf(\"YES\");\n else\n printf(\"NO\");\n \n \n return 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n int al,ar,bl,br;\n scanf(\"%d%d\",&al,&ar);\n scanf(\"%d%d\",&bl,&br);\n\n\n if(br>=(al-1))\n {\n if((br%2)==0)\n {\n if(al>=((br/2)-1))\n {\n printf(\"YES\\n\");\n return 0;\n }\n else if(bl>=(ar-1))\n {\n if((bl%2)==0)\n {\n if(ar>=((bl/2)-1))\n {\n printf(\"YES\\n\");\n return 0;\n }\n else\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n else if(ar>=(bl/2))\n {\n printf(\"YES\\n\");\n return 0;\n }\n else\n {\n printf(\"NO\\n\");\n return 0;\n }\n\n }\n else\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n else if(al>=(br/2))\n {\n printf(\"YES\\n\");\n return 0;\n }\n else if(bl>=(ar-1))\n {\n if((bl%2)==0)\n {\n if(ar>=((bl/2)-1))\n {\n printf(\"YES\\n\");\n return 0;\n }\n else\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n else if(ar>=(bl/2))\n {\n printf(\"YES\\n\");\n return 0;\n }\n else\n {\n printf(\"NO\\n\");\n return 0;\n }\n\n }\n else\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n\n else if(bl>=(ar-1))\n {\n if((bl%2)==0)\n {\n if(ar>=((bl/2)-1))\n {\n printf(\"YES\\n\");\n return 0;\n }\n else\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n else if(ar>=(bl/2))\n {\n printf(\"YES\\n\");\n return 0;\n }\n else\n {\n printf(\"NO\\n\");\n return 0;\n }\n\n }\n else\n {\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(){\n\tlong vi, vd, mi, md;\n\n\tscanf(\"%ld %ld\", &vi, &vd);\n\tscanf(\"%ld %ld\", &mi, &md);\n\n\tif(vi==md && vd==mi){\n printf(\"YES\");\n\t}\n\n\telse if((mi>=vd-1 && mi<=(vd*2)+2) || (md>=vi-1 && md<=(vi*2)+2)){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int bl,br,gl,gr;\n scanf(\"%d%d\",&gl,&gr);\n scanf(\"%d%d\",&bl,&br);\n if((br>=(gl-1) && br<=(gl+1)*2) || (bl>=(gr-1) && bl<=(gr+1)*2))\n printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int gl,gr,bl,br;\n \n scanf(\"%d %d\",&gl,&gr);\n scanf(\"%d %d\",&bl,&br);\n \n if((bl>=gr-1 && bl<=2*(gr+1))||(br>=gl-1 && br<=2*(gl+1)))\n printf(\"YES\");\n \n else \n printf(\"NO\");\n \n return 0;\n \n}\n"}, {"source_code": "#include\n\nint main()\n{\n\tint a, b, c, d, i=0;\n\tscanf(\"%d %d\", &a, &b);\n\tscanf(\"%d %d\", &c, &d);\n\tif(((d>=a-1)&&(d<=2*a+2))||((c>=b-1)&&(c<=2*b+2)))\n\t\tprintf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int gl,gr,bl,br;\n scanf(\"%d%d%d%d\",&gl,&gr,&bl,&br);\n bl=bl-(gr+1);\n if(bl==0||bl==-1||bl==-2){printf(\"YES\");return 0;}\n else\n {\n if(bl<=(gr+1)&&bl>=0)\n {printf(\"YES\");return 0;}\n }\n br=br-(gl+1);\n if(br==0||br==-1||br==-2){printf(\"YES\");return 0;}\n else\n {\n if(br<=(gl+1)&&br>=0)\n {printf(\"YES\");return 0;}\n else\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint gr,gl,br,bl,i;\n\tscanf(\"%d%d\",&gr,&gl);\n\tscanf(\"%d%d\",&br,&bl);\n\tif((bl-gr>=-1 && (bl-2*gr)<3) || (br-gl>=-1 && br-(2*gl)<3))\n\tprintf(\"YES\\n\");\n\telse\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int gl,gr,bl,br;\n \n scanf(\"%d %d\",&gl,&gr);\n scanf(\"%d %d\",&bl,&br);\n \n if((bl>=gr-1 && bl<=2*(gr+1))||(br>=gl-1 && br<=2*(gl+1)))\n printf(\"YES\");\n \n else \n printf(\"NO\");\n \n return 0;\n \n}\n"}, {"source_code": "#include\n#include\n#include\nint main()\n{\n\tint a1,a2,b1,b2;\n\tscanf(\"%d%d%d%d\",&a1,&a2,&b1,&b2);\n\tif((a1<=b2+1&&a1*2+3>b2)||(a2<=b1+1&&a2*2+3>b1))\n\tprintf(\"YES\");\n\telse\n\tprintf(\"NO\");\n\n}"}, {"source_code": "# include \n# include \n\nmain(){\n int R, L, l, r;\n scanf(\"%d %d\", &L, &R);\n scanf(\"%d %d\", &l, &r);\n if( R - 1 <= l && (R + 1) * 2 >= l ) printf(\"YES\\n\");\n else if( L - 1 <= r && (L + 1)*2 >= r ) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\t\n}"}, {"source_code": "#include\nint main()\n{\n int al,ar,bl,br;\n scanf(\"%d%d%d%d\",&al,&ar,&bl,&br);\n if(br>=(al-1)&&br<=(al+1)*2)\n printf(\"YES\\n\");\n else if(bl>=(ar-1)&&bl<=(ar+1)*2)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\nint main()\n{\n\tint a1,a2,b1,b2;\n\tscanf(\"%d%d%d%d\",&a1,&a2,&b1,&b2);\n\tif((a1<=b2+1&&a1*2+3>b2)||(a2<=b1+1&&a2*2+3>b1))\n\tprintf(\"YES\");\n\telse\n\tprintf(\"NO\");\n\n}"}, {"source_code": "\n#include \n\nint main(){\n\n int A1,A2,B1,B2;\n int exito=0;\n\n scanf(\"%d %d\",&A1,&A2);\n scanf(\"%d %d\",&B1,&B2);\n\n if( B2A1 ){\n if( 2*A1+2 >= B2 )/*puts(\"YES\")*/exito=1;\n }else exito=1;\n\n\n if(!exito){\n if( B1A2 ){\n if( 2*A2+2 >= B1 )/*puts(\"YES\")*/exito=1;\n }else exito=1;\n }\n\n if(exito)puts(\"YES\");\n else puts(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int gl,gr,bl,br;\n \n scanf(\"%d %d\",&gl,&gr);\n scanf(\"%d %d\",&bl,&br);\n \n if((bl>=gr-1 && bl<=2*(gr+1))||(br>=gl-1 && br<=2*(gl+1)))\n printf(\"YES\");\n \n else \n printf(\"NO\");\n \n return 0;\n \n}\n"}, {"source_code": "#include\nint main()\n{\n\tint gl,gr,bl,br,i,j,k,l;\n\tscanf(\"%d %d\\n%d %d\",&gl,&gr,&bl,&br);\n\tprintf((gl!=0)&&(br!=0)&&(br>=gl-1)&&(br<=2*gl+2)?\"YES\":((gr!=0)&&(bl!=0)&&(bl>=gr-1)&&(bl<=2*gr+2)?\"YES\":\"NO\"));\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n int vi, vd, mi, md;\n int aux = 0;\n scanf(\"%d%d%d%d\", &vi, &vd, &mi, &md);\n\n if((vi <= md+1 && md <= vi*2+2) || (vd <= mi+1 && mi <= vd*2+2))\n aux += 1;\n\n if(aux)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nvoid ver(int mujeri,int mujerd,int machoi,int machod);\nint main()\n{\n int a,b,c,d;\n scanf(\"%d%d%d%d\",&a,&b,&c,&d);\n ver(a,b,c,d);\n return 0;\n}\nvoid ver(int mujeri,int mujerd,int machoi,int machod)\n{\n if(machod>=mujeri && (machod-mujeri)-1<3 || machoi>=mujerd && (machoi-mujerd)-1<3 || mujerd-machoi==1 || mujeri-machod==1 || machod>mujeri && machod<=2+mujeri*2 || machoi>mujerd && machoi<=2+mujerd*2)printf(\"YES\");\n else printf(\"NO\");\n}\n"}, {"source_code": "#include\n#include\n#include\nint main()\n{\n\tint a1,a2,b1,b2;\n\tscanf(\"%d%d%d%d\",&a1,&a2,&b1,&b2);\n\tif((a1<=b2+1&&a1*2+3>b2)||(a2<=b1+1&&a2*2+3>b1))\n\tprintf(\"YES\");\n\telse\n\tprintf(\"NO\");\n\n}"}, {"source_code": "#include \n\nint main( void )\n{\n int gl, gr, bl, br;\n scanf( \"%d %d %d %d\", &gl, &gr, &bl, &br );\n if ( ( br + 1 >= gl && 2 * gl + 2 >= br ) || ( bl + 1 >= gr && 2 * gr + 2 >= bl ) ) {\n puts( \"YES\" );\n } else {\n puts( \"NO\" );\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main()\n{\n int gr, gl, br, bl, i, a=0;\n scanf(\"%d %d\", &gl, &gr);\n scanf(\"%d %d\", &bl, &br);\n if(gl==br || bl==gr){\n printf(\"YES\");\n return 0;\n }\n if(gl>br && (gl-br)<=1){\n printf(\"YES\");\n return 0;\n }\n else if(gr>bl && (gr-bl)<=1){\n printf(\"YES\");\n return 0;\n }\n if(br%2==0){\n br=br-1;\n }\n if(br>=gl && gl>=(br/2)){\n printf(\"YES\");\n return 0;\n }\n if(bl%2==0){\n bl=bl-1;\n }\n if(bl>=gr && gr>=(bl/2)){\n printf(\"YES\");\n return 0;\n }\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\nvoid ver(int mujeri,int mujerd,int machoi,int machod);\nint main()\n{\n int a,b,c,d;\n scanf(\"%d%d%d%d\",&a,&b,&c,&d);\n ver(a,b,c,d);\n return 0;\n}\nvoid ver(int mujeri,int mujerd,int machoi,int machod)\n{\n if(machod>=mujeri && (machod-mujeri)-1<3 || machoi>=mujerd && (machoi-mujerd)-1<3 || mujerd-machoi==1 || mujeri-machod==1 || machod>mujeri && machod<=2+mujeri*2 || machoi>mujerd && machoi<=2+mujerd*2)printf(\"YES\");\n else printf(\"NO\");\n}\n"}, {"source_code": "#include \n#include \n\nint main() {\n\tint al, ar, bl, br;\n\tscanf(\"%d%d%d%d\", &al, &ar, &bl, &br);\n\tif ((bl >= ar - 1 && bl <= (ar + 1) * 2) || (br >= al - 1 && br <= (al + 1) * 2))\n\t\tprintf(\"YES\\n\");\n\t\telse printf(\"NO\\n\");\n\n\n\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint a1,a2,b1,b2;\n\tscanf(\"%d%d%d%d\",&a1,&a2,&b1,&b2);\n\tif(((b1>=a2-1) && b1<=2*(a2+1)) || ((b2>=a1-1) && b2<=2*(a1+1)))\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\treturn 0;\n\n}\n\n"}], "negative_code": [{"source_code": "#include \n\nint main()\n{\n\tint a,b,c,d,f;\n\tscanf(\"%d %d\",&a,&b);\n\tscanf(\"%d %d\",&c,&d);\n\tf=0;\n\tif (d>=a+1 && d<=2*a){\n\t\tf=1;\n\t}\n\telse if(c>=b+1 && c<=2*b){\n\t\tf=2;\n\t}\n\tif (f==1 || f==2){\n\t\tprintf(\"YES\");\n\t}\n\telse{\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n\tint a1,a2,b1,b2;\n\tscanf(\"%d %d %d %d\", &a1,&a2,&b1,&b2);\n\tif(a1 - b1 > 2 || a1 - b1 > 2)\n\t{\n\t\tprintf(\"NO\");\n\t}else if( b1 <= 2 * a1 + 2 && b1 <= 2 * a1 + 2)\n\t\t{\n\t\t\tprintf(\"YES\");\n\t\t}\n\telse{\n\t\tprintf(\"NO\");\n\t}\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,i=0,j=0,k=0,l=0,m=0;\n int a[200],b[100];\n \n scanf(\"%d\",&b[0]);\n scanf(\"%d\",&b[1]);\n scanf(\"%d\",&a[0]);\n scanf(\"%d\",&a[1]);\n if(((a[0]-b[1])>=0 && (a[0]-b[1])/2<=b[1]) || ((a[1]-b[0])>=0 && (a[1]-b[0])/2<=b[1]))\n printf(\"YES\");\n else if(((b[0]-a[1])>=0 && (b[0]-a[1])<2) || ((b[1]-a[0])>=0 && (b[1]-a[0])<2))\n printf(\"YES\");\n else\n printf(\"NO\");\n \n return 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n int b_r, b_l, g_r, g_l;\n\n scanf(\"%d %d %d %d\", &g_r, &g_l, &b_r, &b_l);\n\n int tot1=abs(b_r - g_l);\n int tot2=abs(b_l - g_r);\n\n if(((b_l>=g_r) || tot2<=1) && ((b_l / 3<=g_r)))\n printf(\"YES\\n\");\n\n else if(((b_r>=g_l) || tot1<=1) && ((b_r / 3<= g_l)))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint div1(int x, int b);\nint main()\n{\n\tint ar, al, br, bl;\n\tar = 0;\n\tal = 0;\n\tbr = 0;\n\tbl = 0;\n\tscanf(\"%d%d\",&ar, &al);\n\tscanf(\"%d%d\",&br, &bl);\n\tif( div1(ar,bl) == 1 )\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t{\n\t if( div1(al,br) == 1 )\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n\t}\n\treturn 0;\n}\nint div1(int b, int x)\n{\n\tint y, z, c,a;\n\tz=0;\n\tif( x < 100 && b < 100)\n\t{\n\tif(x < b)\n\t{\t\n\t\tif(x == b-1)\n\t\t{\n\t\t\tz=1;\n\t\t}\n\t}\n\telse\n\t{\n\t\tif( x > b)\n\t\t{\n\t\t\tc = 2*b-1;\n\t\t\tif( ( c >= x ) || (x-b-1 < 3) )\n\t\t\t\tz=1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif ( x == b)\n\t\t\t\tz=1;\n\t\t}\n\t}\n}\n\treturn z;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int al,ar,bl,br;\n scanf(\"%d%d\",&al,&ar);\n scanf(\"%d%d\",&bl,&br);\n\n if(br>=(al-1))\n {\n if((br%2)==0)\n {\n if(al>=((br/2)-1))\n {\n printf(\"YES\\n\");\n return 0;\n }\n else\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n else if(al>=(br/2))\n {\n printf(\"YES\\n\");\n return 0;\n }\n else\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n else if(bl>=(ar-1))\n {\n if((bl%2)==0)\n {\n if(ar>=((bl/2)-1))\n {\n printf(\"YES\\n\");\n return 0;\n }\n else\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n else if(ar>=(bl/2))\n {\n printf(\"YES\\n\");\n return 0;\n }\n else\n {\n printf(\"NO\\n\");\n return 0;\n }\n\n }\n\n else\n {\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#define MAX 8\n\nint mano_venus(char* venusString, int num);\nint mano_marte(char* marteString, int num);\nint comfortable(int venusiana, int marciano);\n\nint main(int argc, char const *argv[])\n{\n char venus[MAX], marte[MAX];\n char auxVenus[MAX], auxMarte[MAX];\n\n int hand_venus, hand_mars;\n\n gets(venus); strcpy(auxVenus, venus); \n gets(marte); strcpy(auxMarte, marte);\n\n hand_venus = mano_venus(venus, 1);\n hand_mars = mano_marte(marte, 1);\n\n if (hand_venus != -1 && hand_mars != -1)\n {\n if(comfortable(hand_venus, hand_mars))\n {\n printf(\"YES\");\n }else{\n hand_venus = mano_venus(auxVenus, 2);\n hand_mars = mano_marte(auxMarte, 2);\n if (comfortable(hand_venus, hand_mars))\n {\n printf(\"YES\");\n }else{\n printf(\"NO\");\n }\n }\n }\n\n return 0;\n}\n\nint comfortable(int venusiana, int marciano)\n{ \n int k = 0;\n\n if (venusiana > marciano)\n {\n if (marciano == (venusiana - 1))\n {\n k = 1;\n }\n }\n if (venusiana < marciano)\n {\n if (2*venusiana +2 >= marciano)\n {\n k = 1;\n }\n }\n if (venusiana == marciano)\n {\n k = 1;\n }\n\n return k;\n}\n\nint mano_venus(char* venusString, int num)\n{\n char auxVenus[MAX];\n strcpy(auxVenus, venusString);\n int k = -1;\n\n char* manoVenusIzq = strtok(venusString, \" \");\n char* manoVenusDer = strtok(NULL, \" \");\n\n if (atoi(manoVenusIzq) > 0 && atoi(manoVenusIzq) <= 100)\n {\n if (atoi(manoVenusDer) > 0 && atoi(manoVenusDer) <= 100)\n {\n if(num == 1)\n {\n k = atoi(manoVenusIzq);\n }else{\n k = atoi(manoVenusDer);\n }\n }\n }\n\n return k;\n}\n\nint mano_marte(char* marteString, int num)\n{\n char* manoMarteIzq = strtok(marteString, \" \");\n char* manoMarteDer = strtok(NULL, \" \");\n int k = -1;\n\n if (atoi(manoMarteIzq) > 0 && atoi(manoMarteIzq) < 100)\n {\n if (atoi(manoMarteDer) > 0 && atoi(manoMarteDer) < 100)\n {\n if(num == 1)\n {\n k = atoi(manoMarteDer);\n }else{\n k = atoi(manoMarteIzq);\n }\n }\n }\n\n return k;\n}"}, {"source_code": " /****************************\n * Trabajo Practico Final *\n * A Student's Dream *\n ****************************/\n#include \n\nint main(){\n\n int Vi,Vd,Mi,Md;\n int exito=0;\n\n scanf(\"%d %d\",&Vi,&Vd);\n scanf(\"%d %d\",&Mi,&Md);\n\n if( MdVi ){\n if( 2*Vi+2 >= Md )\n exito=1;\n }else exito=1;\n\n\n if(!exito){\n if( MiVd ){\n if( 2*Vd+2 >= Mi )\n exito=1;\n }else exito=1;\n }\n if(exito)\n printf(\"SI\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n\n"}, {"source_code": "#include \nint main()\n{\n int a,b,c,d,r=0;\n scanf(\"%d %d %d %d\", &a, &b, &c, &d);\n if(a > d && r==0)\n {\n r++;\n if(d == a-1)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n else if(d >= a && r==0)\n {\n r++;\n if(d == a || d==a+1 || d==a+2)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n else if(b > c && r==0)\n {\n r++;\n if(c == b - 1)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n else if(c >= b && r==0)\n {\n r++;\n if(c==b || c==b+1 || c==b+2)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n\tint a,b,c,d,f;\n\tscanf(\"%d %d\",&a,&b);\n\tscanf(\"%d %d\",&c,&d);\n\tf=0;\n\tif (d>=a-1 && d<=(a+3)){\n\t\tf=1;\n\t}\n\tif(c>=b-1 && c<=(b+3)){\n\t\tf=2;\n\t}\n\tif (f==1 || f==2){\n\t\tprintf(\"YES\");\n\t}\n\telse{\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,i=0,j=0,k=0,l=0,m=0;\n int a[200],b[100];\n \n scanf(\"%d\",&a[0]);\n scanf(\"%d\",&a[1]);\n scanf(\"%d\",&b[0]);\n scanf(\"%d\",&b[1]);\n if(((a[0]-b[1])>=0 && (a[0]-b[1])<=3) || ((a[1]-b[0])>=0 && (a[1]-b[0])<=3))\n printf(\"YES\");\n else if(((b[0]-a[1])>=0 && (b[0]-a[1])<2) || ((b[1]-a[0])>=0 && (b[1]-a[0])<2))\n printf(\"YES\");\n else\n printf(\"NO\");\n \n return 0;\n}"}, {"source_code": "#include \nint main(void)\n{\n int a,b,c,d,e=0;\n scanf(\"%d%d\\n\" , &a, &b);\n scanf(\"%d%d\" , &c, &d);\n\n if (a-1 <= d && ((d/2)-1) <=a )\n {\n e=1;\n }\n else if (b-1 <= c && ((c/2)-1) <= b)\n {\n e=1;\n }\n if (e==1)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n}\n"}, {"source_code": "#include \n#include\nint main(void) {\n int bl,br,gl,gr;\n scanf(\"%d %d %d %d\",&gl,&gr,&bl,&br);\n if(abs(bl-gr)<2||abs(br-gl)<2) printf(\"YES\");\n else if((bl<=2*gr+2&&bl>gr)||(br<=2*gl+2==2&&br>gl)) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include \nint main()\n{\n int a,b,c,d,r=0,t=0;\n scanf(\"%d %d %d %d\", &a, &b, &c, &d);\n if(a > d && r==0)\n {\n if(d == a-1)\n {\n printf(\"YES\");\n r++;\n }\n else\n {\n t++;\n }\n }\n if(d >= a && r==0)\n {\n if(d == a || d==a+1 || d==a+2)\n {\n printf(\"YES\");\n r++;\n }\n else\n {\n t++;\n }\n }\n if(b > c && r==0)\n {\n if(c == b - 1)\n {\n printf(\"YES\");\n r++;\n }\n else\n {\n if(t > 0)\n printf(\"NO\");\n }\n }\n if(c >= b && r == 0)\n {\n if(c==b || c==b+1 || c==b+2)\n {\n printf(\"YES\");\n r++;\n }\n else\n {\n if(t > 0)\n printf(\"NO\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int b_r, b_l, g_r, g_l, k, l;\n\n scanf(\"%d %d %d %d\", &g_r, &g_l, &b_r, &b_l);\n\n if(b_r%2==1)\n k=b_r+1;\n if(b_l%2==1)\n l=b_l+1;\n\n if((b_r >= g_l-1) && (g_l >= (k / 2)-1))\n printf(\"YES\\n\");\n\n else if((b_l >= g_r-1) && (g_r >= (l / 2)-1))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#define MAX 8\n\nint mano_venus(char* venusString, int num);\nint mano_marte(char* marteString, int num);\nint comfortable(int venusiana, int marciano);\n\nint main(int argc, char const *argv[])\n{\n char venus[MAX], marte[MAX];\n char auxVenus[MAX], auxMarte[MAX];\n\n strcpy(auxVenus, venus); strcpy(auxMarte, marte);\n\n int hand_venus, hand_mars;\n\n gets(venus);\n gets(marte);\n\n hand_venus = mano_venus(venus, 1);\n hand_mars = mano_marte(marte, 1);\n\n if (hand_venus != -1 && hand_mars != -1)\n {\n if(comfortable(hand_venus, hand_mars))\n {\n printf(\"YES\");\n }else{\n hand_venus = mano_venus(auxVenus, 2);\n hand_mars = mano_marte(auxMarte, 2);\n if(comfortable(hand_venus, hand_mars))\n {\n printf(\"YES\");\n }else{\n printf(\"NO\");\n }\n }\n }\n\n return 0;\n}\n\nint comfortable(int venusiana, int marciano)\n{\n if ((venusiana - marciano) == 0 || abs(venusiana - marciano) == 1)\n {\n return 1;\n }else{\n return -1;\n }\n}\n\nint mano_venus(char* venusString, int num)\n{\n char auxVenus[MAX];\n strcpy(auxVenus, venusString);\n\n char* manoVenusIzq = strtok(venusString, \" \");\n char* manoVenusDer = strtok(NULL, \" \");\n\n if (atoi(manoVenusIzq) > 0 && atoi(manoVenusIzq) <= 100)\n {\n if (atoi(manoVenusDer) > 0 && atoi(manoVenusDer) <= 100)\n {\n if(num == 1)\n {\n return atoi(manoVenusIzq);\n }else{\n return atoi(manoVenusDer);\n }\n }\n }\n\n return -1;\n}\n\nint mano_marte(char* marteString, int num)\n{\n char* manoMarteIzq = strtok(marteString, \" \");\n char* manoMarteDer = strtok(NULL, \" \");\n\n if (atoi(manoMarteIzq) > 0 && atoi(manoMarteIzq) < 100)\n {\n if (atoi(manoMarteDer) > 0 && atoi(manoMarteDer) < 100)\n {\n if(num == 1)\n {\n return atoi(manoMarteDer);\n }else{\n return atoi(manoMarteIzq);\n }\n }\n }\n\n return -1;\n}\n"}, {"source_code": "#include\n#include\n#define M 200\n\nint analizar_comodidad(int manoNinhaNinho[]);\n\nmain()\n{\n int manos[4], comodo, i;\n\n for(i=0; i<4; i++)\n {\n \tscanf(\"%d\", &manos[i]);\n }\n\n comodo = analizar_comodidad(manos);\n\n if(comodo == 1)\n {\n printf(\"YES\");\n }\n\telse\n\t{\n printf(\"NO\");\n }\n\n return 0;\n}\n\nint analizar_comodidad(int manoNinhaNinho[]) // 1 es YES, 0 es NO\n{\n int A_izq, A_der, B_izq, B_der, a, b, r, div, resto;\n \n A_izq = manoNinhaNinho[0];\n A_der = manoNinhaNinho[1];\n B_izq = manoNinhaNinho[2];\n B_der = manoNinhaNinho[3];\n\n a = B_izq - A_der;\n b = B_der - A_izq;\n \n if(a >= -2 && a <= 2)\n {\n \tif(a == -2)\n \t{\n \t\tif(b >= -2 && b <= 2)\n {\n \tif(b == -2)\n \t {\n \t\t r = 0;\n \t }\n \t else\n \t {\n \t\t r = 1;\n \t }\n }\n else if(b > 2)\n {\n \tif(A_izq == 1)\n \t{\n \t\tdiv = B_der / (A_izq + 1);\n \t resto = B_der % (A_izq + 1);\n \t }\n \t else\n \t {\n \t \tdiv = B_der / A_izq;\n \t resto = B_der % A_izq;\n \t }\n \t \n \t if(div <= 2)\n \t {\n \t \tif(resto <= 2)\n \t\t {\n \t\t \tif(div + resto > 3)\n \t\t\t {\n \t\t\t \tr = 0;\n \t\t \t }\n \t\t\t else\n \t\t\t {\n \t\t\t \tr = 1;\n \t\t\t }\n \t\t }\n \t\t else\n \t\t {\n \t\t\t if(resto/2 < A_izq)\n \t\t\t {\n \t\t\t \tr = 1;\n \t\t\t }\n \t\t\t else\n \t\t\t {\n \t\t\t \tr = 0;\n \t\t\t }\n \t\t }\n \t }\n \t else\n \t {\n \t\t r = 0;\n \t }\n }\n else if(b < -2)\n {\n \tr = 0;\n }\n \t}\n \telse\n \t{\n \t\tr = 1;\n \t}\n }\n else if(a > 2 && (b <= -2 || b >= 2))\n {\n \tif(A_der == 1)\n {\n div = B_izq / (A_der + 1);\n \t resto = B_izq % (A_der + 1);\n \t}\n \telse\n \t{\n \t div = B_izq / A_der;\n \t resto = B_izq % A_der;\n \t}\n \t \n \tif(div <= 2)\n \t{\n \t\tif(resto <= 2)\n \t\t{\n \t\t\tif(div + resto > 3)\n \t\t\t{\n \t\t\t\tr = 0;\n \t\t\t}\n \t\t\telse\n \t\t\t{\n \t\t\t\tr = 1;\n \t\t\t}\n \t\t}\n \t\telse\n \t\t{\n \t\t\tif(resto/2 < A_der)\n \t\t\t{\n \t\t\t\tr = 1;\n \t\t\t}\n \t\t\telse\n \t\t\t{\n \t\t\t\tr = 0;\n \t\t\t}\n \t\t}\n \t}\n \telse\n \t{\n \t\tif(b > 2)\n {\n \tif(A_izq == 1)\n {\n \tdiv = B_der / (A_izq + 1);\n \t resto = B_der % (A_izq + 1);\n \t }\n \t else\n \t {\n \t \tdiv = B_der / A_izq;\n \t resto = B_der % A_izq;\n \t }\n \t\n \t if(div <= 2)\n \t {\n \t \tif(resto <= 2)\n \t\t {\n \t\t \tif(div + resto > 3)\n \t\t\t {\n \t\t\t \tr = 0;\n \t\t\t }\n \t\t\t else\n \t\t\t {\n \t\t\t \tr = 1;\n \t\t\t }\n \t\t }\n \t\t else\n \t\t {\n \t\t \tif(resto/2 < A_izq)\n \t\t\t {\n \t\t\t \tr = 1;\n \t\t\t }\n \t\t\t else\n \t\t\t {\n \t\t\t \tr = 0;\n \t\t\t }\n \t\t }\n \t }\n \t else\n \t{\n \t\tr = 0;\n \t }\n }\n else\n {\n \tr = 0;\n }\n \t}\n }\n else if(b >= -2 && b <= 2)\n {\n \tif(b == -2)\n \t{\n \t\tr = 0;\n \t}\n \telse\n \t{\n \t\tr = 1;\n \t}\n }\n else if(b > 2)\n {\n \tif(A_izq == 1)\n {\n div = B_der / (A_izq + 1);\n \t resto = B_der % (A_izq + 1);\n \t}\n \telse\n \t{\n \t div = B_der / A_izq;\n \t resto = B_der % A_izq;\n \t}\n \t\n \tif(div <= 2)\n \t{\n \t\tif(resto <= 2)\n \t\t{\n \t\t\tif(div + resto > 3)\n \t\t\t{\n \t\t\t\tr = 0;\n \t\t\t}\n \t\t\telse\n \t\t\t{\n \t\t\t\tr = 1;\n \t\t\t}\n \t\t}\n \t\telse\n \t\t{\n \t\t\tif(resto/2 < A_izq)\n \t\t\t{\n \t\t\t\tr = 1;\n \t\t\t}\n \t\t\telse\n \t\t\t{\n \t\t\t\tr = 0;\n \t\t\t}\n \t\t}\n \t}\n \telse\n \t{\n \t\tr = 0;\n \t}\n }\n else if(a < -2 || b < -2)\n {\n \tr = 0;\n }\n \n return r;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int b_r, b_l, g_r, g_l;\n\n scanf(\"%d %d %d %d\", &b_r, &b_l, &g_r, &g_l);\n\n int tot1=abs(b_r - g_l);\n int tot2=abs(b_l - g_r);\n\n if(tot1<3 || tot2<3)\n printf(\"YES\\n\");\n\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include \n#include\nint main(void) {\n int bl,br,gl,gr;\n scanf(\"%d %d %d %d\",&gl,&gr,&bl,&br);\n if(abs(bl-gr)<2||abs(br-gl)<2) printf(\"YES\");\n else if((bl<=2*gr+2&&bl>gr)||(br<=2*gl+2==2&&br>gl)) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include\n#include\nint main(){\nint g[2],b[2],i;\nfor(i=0;i<2;i++)\n scanf(\"%d\",&g[i]);\nfor(i=0;i<2;i++)\n scanf(\"%d\",&b[i]);\nif((b[1]>=g[0]-1)&&(b[1]<=g[0]+3)){\n printf(\"YES\");\n exit(0);\n}\nif((b[0]>=g[1]-1)&&(b[0]<=g[1]+3)){\n printf(\"YES\");\n exit(0);\n}\nelse\n printf(\"N0\");\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,i=0,j=0,k=0,l=0,m=0;\n int a[200],b[100];\n \n scanf(\"%d\",&b[0]);\n scanf(\"%d\",&b[1]);\n scanf(\"%d\",&a[0]);\n scanf(\"%d\",&a[1]);\n if(((a[0]-b[1])>=0 && (a[0]-b[1])/b[1]<=3) || ((a[1]-b[0])>=0 && (a[1]-b[0])/b[0]<=3))\n printf(\"YES\");\n else if(((b[0]-a[1])>=0 && (b[0]-a[1])/a[1]<2) || ((b[1]-a[0])>=0 && (b[1]-a[0])/a[0]<2))\n printf(\"YES\");\n else\n printf(\"NO\");\n \n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint gl,gr,bl,br,i,j,k,l;\n\tscanf(\"%d %d\\n%d %d\",&gl,&gr,&bl,&br);\n\tprintf((gl!=0)&&(br!=0)&&(br>=gl-1)&&(br<=gl+3)?\"YES\":((gr!=0)&&(bl!=0)&&(bl>=gr-1)&&(bl<=gr+3)?\"YES\":\"NO\"));\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main(){\n\tlong al, ar, bl, br;\n\n\tscanf(\"%ld %ld\", &al, &ar);\n\tscanf(\"%ld %ld\", &bl, &br);\n\tal--;\n\tbl--;\n\n if((br<=(al+2)*2 && br>=al) || (ar<=(bl+2)*2 && ar>=bl)){\n printf(\"YES\");\n return 0;\n }\n \n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n\tint a, b, c, d, i=0;\n\tscanf(\"%d %d\", &a, &b);\n\tscanf(\"%d %d\", &c, &d);\n\tif((d>=a-1)&&(d<=a+3)||(c>=b-1)&&(c<=b+3))\n\t\tprintf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int g_l,g_r,b_l,b_r,k,k1;\n scanf(\"%d\",&g_l);\n scanf(\"%d\",&g_r);\n scanf(\"%d\",&b_l);\n scanf(\"%d\",&b_r);\n k=(b_r/2);\n k1=(b_l/2);\n if((b_r>=g_l-1)&&(k<3))\n {\n printf(\"YES\");\n }\n else if((b_l>=g_r-1)&&(k1<3))\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint gl,gr,bl,br,i,j,k,l;\n\tscanf(\"%d %d\\n%d %d\",&gl,&gr,&bl,&br);\n\tprintf((gl!=0)&&(br!=0)&&(br>=gl-1)&&(br<=gl+3)?\"YES\":((gr!=0)&&(bl!=0)&&(bl>=gr-1)&&(bl<=gr+3)?\"YES\":\"NO\"));\n\treturn 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n int al,ar,bl,br;\n scanf(\"%d%d\",&al,&ar);\n scanf(\"%d%d\",&bl,&br);\n al-=1;\n ar-=1;\n if(br>=al)\n {\n if((br%2)==0)\n {\n if(al>=((br/2)-1))\n {\n printf(\"YES\\n\");\n return 0;\n }\n else\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n else if(al>=(br/2))\n {\n printf(\"YES\\n\");\n return 0;\n }\n else\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n else if(bl>=ar)\n {\n if((bl%2)==0)\n {\n if(ar>=((bl/2)-1))\n {\n printf(\"YES\\n\");\n return 0;\n }\n else\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n else if(ar>=(bl/2))\n {\n printf(\"YES\\n\");\n return 0;\n }\n else\n {\n printf(\"NO\\n\");\n return 0;\n }\n\n }\n\n else\n {\n printf(\"NO\\n\");\n }\n return 0;\n}\n\n"}, {"source_code": "#include\n#include\n#define M 200\n\nint analizar_comodidad(int manoNinhaNinho[]);\n\nmain()\n{\n int manos[4], comodo, i;\n\n for(i=0; i<4; i++)\n {\n \tscanf(\"%d\", &manos[i]);\n }\n\n comodo = analizar_comodidad(manos);\n\n if(comodo == 1)\n {\n printf(\"YES\");\n }\n\telse\n\t{\n printf(\"NO\");\n }\n\n return 0;\n}\n\nint analizar_comodidad(int manoNinhaNinho[]) // 1 es YES, 0 es NO\n{\n int A_izq, A_der, B_izq, B_der, a, b, r, div, resto;\n \n A_izq = manoNinhaNinho[0];\n A_der = manoNinhaNinho[1];\n B_izq = manoNinhaNinho[2];\n B_der = manoNinhaNinho[3];\n \n\n a = B_izq - A_der;\n b = B_der - A_izq;\n \n if(a >= -2 && a <= 2)\n {\n \tif(a == -2)\n \t{\n \t\tif(b >= -2 && b <= 2)\n {\n \tif(b == -2)\n \t {\n \t\t r = 0;\n \t }\n \t else\n \t {\n \t\t r = 1;\n \t }\n }\n else if(b > 2)\n {\n \tdiv = B_der / A_izq;\n \t resto = B_der % A_izq;\n \t if(div <= 2)\n \t {\n \t \tif(resto <= 2)\n \t\t {\n \t\t \tr = 1;\n \t\t }\n \t\t else\n \t\t {\n \t\t\t r = 0;\n \t\t }\n \t }\n \t else\n \t {\n \t\t r = 0;\n \t }\n }\n else if(b < -2)\n {\n \tr = 0;\n }\n \t}\n \telse\n \t{\n \t\tr = 1;\n \t}\n }\n else if(a > 2 && (b <= -2 || b >= 2))\n {\n \tdiv = B_izq / A_der;\n \tresto = B_izq % A_der;\n \tif(div <= 2)\n \t{\n \t\tif(resto <= 2)\n \t\t{\n \t\t\tr = 1;\n \t\t}\n \t\telse\n \t\t{\n \t\t\tr = 0;\n \t\t}\n \t}\n \telse\n \t{\n \t\tr = 0;\n \t}\n }\n else if(b >= -2 && b <= 2)\n {\n \tif(b == -2)\n \t{\n \t\tr = 0;\n \t}\n \telse\n \t{\n \t\tr = 1;\n \t}\n }\n else if(b > 2)\n {\n \tdiv = B_der / A_izq;\n \tresto = B_der % A_izq;\n \tif(div <= 2)\n \t{\n \t\tif(resto <= 2)\n \t\t{\n \t\t\tr = 1;\n \t\t}\n \t\telse\n \t\t{\n \t\t\tr = 0;\n \t\t}\n \t}\n \telse\n \t{\n \t\tr = 0;\n \t}\n }\n else if(a < -2 || b < -2)\n {\n \tr = 0;\n }\n \n return r;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,i=0,j=0,k=0,l=0,m=0;\n int a[200],b[100];\n \n scanf(\"%d\",&a[0]);\n scanf(\"%d\",&a[1]);\n scanf(\"%d\",&b[0]);\n scanf(\"%d\",&b[1]);\n if(((a[0]-b[1])>=0 && (a[0]-b[1])<=3) || ((a[1]-b[0])>=0 && (a[1]-b[0])<=3))\n printf(\"YES\");\n else if(((b[0]-a[1])>=0 && (b[0]-a[1])<=2) || ((b[1]-a[0])>=0 && (b[1]-a[0])<=2))\n printf(\"YES\");\n else\n printf(\"NO\");\n \n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int r1,r2,l1,l2;\n //while(scanf(\"%d%d\",&r1,&l1))\n //{\n scanf(\"%d%d\",&l1,&r1);\n scanf(\"%d%d\",&l2,&r2);\n if(((2*l1+3>r2)&&(r2+1>l1))||((2*r1+3>l2)&&(l2+1>r1)))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n //}\n return 0;\n}"}, {"source_code": "#include\n#include\n#define M 200\n\nint analizar_comodidad(int manoNinhaNinho[]);\n\nmain()\n{\n int manos[4], comodo, i;\n\n for(i=0; i<4; i++)\n {\n \tscanf(\"%d\", &manos[i]);\n }\n\n comodo = analizar_comodidad(manos);\n\n if(comodo == 1)\n {\n printf(\"YES\");\n }\n\telse\n\t{\n printf(\"NO\");\n }\n\n return 0;\n}\n\nint analizar_comodidad(int manoNinhaNinho[]) // 1 es YES, 0 es NO\n{\n int A_izq, A_der, B_izq, B_der, a, b, r, div, resto;\n \n A_izq = manoNinhaNinho[0];\n A_der = manoNinhaNinho[1];\n B_izq = manoNinhaNinho[2];\n B_der = manoNinhaNinho[3];\n\n a = B_izq - A_der;\n b = B_der - A_izq;\n \n if(a >= -2 && a <= 2)\n {\n \tif(a == -2)\n \t{\n \t\tif(b >= -2 && b <= 2)\n {\n \tif(b == -2)\n \t {\n \t\t r = 0;\n \t }\n \t else\n \t {\n \t\t r = 1;\n \t }\n }\n else if(b > 2)\n {\n \tif(A_izq == 1)\n \t{\n \t\tdiv = B_der / (A_izq + 1);\n \t resto = B_der % (A_izq + 1);\n \t }\n \t else\n \t {\n \t \tdiv = B_der / A_izq;\n \t resto = B_der % A_izq;\n \t }\n \t \n \t if(div <= 2)\n \t {\n \t \tif(resto <= 2)\n \t\t {\n \t\t \tif(div + resto > 2)\n \t\t\t {\n \t\t\t \tr = 0;\n \t\t \t }\n \t\t\t else\n \t\t\t {\n \t\t\t \tr = 1;\n \t\t\t }\n \t\t }\n \t\t else\n \t\t {\n \t\t\t if(resto/2 < A_izq)\n \t\t\t {\n \t\t\t \tr = 1;\n \t\t\t }\n \t\t\t else\n \t\t\t {\n \t\t\t \tr = 0;\n \t\t\t }\n \t\t }\n \t }\n \t else\n \t {\n \t\t r = 0;\n \t }\n }\n else if(b < -2)\n {\n \tr = 0;\n }\n \t}\n \telse\n \t{\n \t\tr = 1;\n \t}\n }\n else if(a > 2 && (b <= -2 || b >= 2))\n {\n \tif(A_der == 1)\n {\n div = B_izq / (A_der + 1);\n \t resto = B_izq % (A_der + 1);\n \t}\n \telse\n \t{\n \t div = B_izq / A_der;\n \t resto = B_izq % A_der;\n \t}\n \t \n \tif(div <= 2)\n \t{\n \t\tif(resto <= 2)\n \t\t{\n \t\t\tif(div + resto > 2)\n \t\t\t{\n \t\t\t\tr = 0;\n \t\t\t}\n \t\t\telse\n \t\t\t{\n \t\t\t\tr = 1;\n \t\t\t}\n \t\t}\n \t\telse\n \t\t{\n \t\t\tif(resto/2 < A_der)\n \t\t\t{\n \t\t\t\tr = 1;\n \t\t\t}\n \t\t\telse\n \t\t\t{\n \t\t\t\tr = 0;\n \t\t\t}\n \t\t}\n \t}\n \telse\n \t{\n \t\tif(b > 2)\n {\n \tif(A_izq == 1)\n {\n \tdiv = B_der / (A_izq + 1);\n \t resto = B_der % (A_izq + 1);\n \t }\n \t else\n \t {\n \t \tdiv = B_der / A_izq;\n \t resto = B_der % A_izq;\n \t }\n \t\n \t if(div <= 2)\n \t {\n \t \tif(resto <= 2)\n \t\t {\n \t\t \tif(div + resto > 2)\n \t\t\t {\n \t\t\t \tr = 0;\n \t\t\t }\n \t\t\t else\n \t\t\t {\n \t\t\t \tr = 1;\n \t\t\t }\n \t\t }\n \t\t else\n \t\t {\n \t\t \tif(resto/2 < A_izq)\n \t\t\t {\n \t\t\t \tr = 1;\n \t\t\t }\n \t\t\t else\n \t\t\t {\n \t\t\t \tr = 0;\n \t\t\t }\n \t\t }\n \t }\n \t else\n \t{\n \t\tr = 0;\n \t }\n }\n else\n {\n \tr = 0;\n }\n \t}\n }\n else if(b >= -2 && b <= 2)\n {\n \tif(b == -2)\n \t{\n \t\tr = 0;\n \t}\n \telse\n \t{\n \t\tr = 1;\n \t}\n }\n else if(b > 2)\n {\n \tif(A_izq == 1)\n {\n div = B_der / (A_izq + 1);\n \t resto = B_der % (A_izq + 1);\n \t}\n \telse\n \t{\n \t div = B_der / A_izq;\n \t resto = B_der % A_izq;\n \t}\n \t\n \tif(div <= 2)\n \t{\n \t\tif(resto <= 2)\n \t\t{\n \t\t\tif(div + resto > 2)\n \t\t\t{\n \t\t\t\tr = 0;\n \t\t\t}\n \t\t\telse\n \t\t\t{\n \t\t\t\tr = 1;\n \t\t\t}\n \t\t}\n \t\telse\n \t\t{\n \t\t\tif(resto/2 < A_izq)\n \t\t\t{\n \t\t\t\tr = 1;\n \t\t\t}\n \t\t\telse\n \t\t\t{\n \t\t\t\tr = 0;\n \t\t\t}\n \t\t}\n \t}\n \telse\n \t{\n \t\tr = 0;\n \t}\n }\n else if(a < -2 || b < -2)\n {\n \tr = 0;\n }\n \n return r;\n}\n"}, {"source_code": "#include \n#include \nint div1(int x, int b);\nint main()\n{\n\tint ar, al, br, bl;\n\tar = 0;\n\tal = 0;\n\tbr = 0;\n\tbl = 0;\n\tscanf(\"%d%d\",&ar, &al);\n\tscanf(\"%d%d\",&br, &bl);\n\tif( div1(ar,bl) == 1 )\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t{\n\t if( div1(al,br) == 1 )\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n\t}\n\treturn 0;\n}\nint div1(int x, int b)\n{\n\tint y, z, c,a;\n\tz=0;\n\tif( x < 100 && b < 100)\n\t{\n\tif(x < b)\n\t{\t\n\t\ta = x;\n\t\tx = b;\n\t\tb = a;\n\t\tif(x == b-1)\n\t\t\tz=1;\n\t}\n\telse\n\t{\n\t\tif( x > b)\n\t\t{\n\t\t\tc = x-b-1;\n\t\t\tif( ( c < 3) )\n\t\t\t\tz=1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif ( x == b)\n\t\t\t\tz=1;\n\t\t}\n\t}\n}\n\treturn z;\n}\n"}, {"source_code": "#include\n#include\n#define M 200\n\nint analizar_comodidad(int manoNinhaNinho[]);\n\nmain()\n{\n int manos[4], comodo, i;\n\n for(i=0; i<4; i++)\n {\n \tscanf(\"%d\", &manos[i]);\n }\n\n comodo = analizar_comodidad(manos);\n\n if(comodo == 1)\n {\n printf(\"YES\");\n }\n\telse\n\t{\n printf(\"NO\");\n }\n\n return 0;\n}\n\nint analizar_comodidad(int manoNinhaNinho[]) // 1 es YES, 0 es NO\n{\n int A_izq, A_der, B_izq, B_der, a, b, r, div, resto;\n \n A_izq = manoNinhaNinho[0];\n A_der = manoNinhaNinho[1];\n B_izq = manoNinhaNinho[2];\n B_der = manoNinhaNinho[3];\n\n a = B_izq - A_der;\n b = B_der - A_izq;\n \n if(a >= -2 && a <= 2)\n {\n \tif(a == -2)\n \t{\n \t\tif(b >= -2 && b <= 2)\n {\n \tif(b == -2)\n \t {\n \t\t r = 0;\n \t }\n \t else\n \t {\n \t\t r = 1;\n \t }\n }\n else if(b > 2)\n {\n \tif(A_izq == 1)\n \t{\n \t\tdiv = B_der / (A_izq + 1);\n \t resto = B_der % (A_izq + 1);\n \t }\n \t else\n \t {\n \t \tdiv = B_der / A_izq;\n \t resto = B_der % A_izq;\n \t }\n \t \n \t if(div <= 2)\n \t {\n \t \tif(resto <= 2)\n \t\t {\n \t\t \tif(div + resto > 2)\n \t\t\t {\n \t\t\t \tr = 0;\n \t\t \t }\n \t\t\t else\n \t\t\t {\n \t\t\t \tr = 1;\n \t\t\t }\n \t\t }\n \t\t else\n \t\t {\n \t\t\t if(resto/2 < A_izq)\n \t\t\t {\n \t\t\t \tr = 1;\n \t\t\t }\n \t\t\t else\n \t\t\t {\n \t\t\t \tr = 0;\n \t\t\t }\n \t\t }\n \t }\n \t else\n \t {\n \t\t r = 0;\n \t }\n }\n else if(b < -2)\n {\n \tr = 0;\n }\n \t}\n \telse\n \t{\n \t\tr = 1;\n \t}\n }\n else if(a > 2 && (b <= -2 || b >= 2))\n {\n \tif(A_der == 1)\n {\n div = B_izq / (A_der + 1);\n \t resto = B_izq % (A_der + 1);\n \t}\n \telse\n \t{\n \t div = B_izq / A_der;\n \t resto = B_izq % A_der;\n \t}\n \t \n \tif(div <= 2)\n \t{\n \t\tif(resto <= 2)\n \t\t{\n \t\t\tif(div + resto > 2)\n \t\t\t{\n \t\t\t\tr = 0;\n \t\t\t}\n \t\t\telse\n \t\t\t{\n \t\t\t\tr = 1;\n \t\t\t}\n \t\t}\n \t\telse\n \t\t{\n \t\t\tif(resto/2 < A_der)\n \t\t\t{\n \t\t\t\tr = 1;\n \t\t\t}\n \t\t\telse\n \t\t\t{\n \t\t\t\tr = 0;\n \t\t\t}\n \t\t}\n \t}\n \telse\n \t{\n \t\tr = 0;\n \t}\n }\n else if(b >= -2 && b <= 2)\n {\n \tif(b == -2)\n \t{\n \t\tr = 0;\n \t}\n \telse\n \t{\n \t\tr = 1;\n \t}\n }\n else if(b > 2)\n {\n \tif(A_izq == 1)\n {\n div = B_der / (A_izq + 1);\n \t resto = B_der % (A_izq + 1);\n \t}\n \telse\n \t{\n \t div = B_der / A_izq;\n \t resto = B_der % A_izq;\n \t}\n \t\n \tif(div <= 2)\n \t{\n \t\tif(resto <= 2)\n \t\t{\n \t\t\tif(div + resto > 2)\n \t\t\t{\n \t\t\t\tr = 0;\n \t\t\t}\n \t\t\telse\n \t\t\t{\n \t\t\t\tr = 1;\n \t\t\t}\n \t\t}\n \t\telse\n \t\t{\n \t\t\tif(resto/2 < A_izq)\n \t\t\t{\n \t\t\t\tr = 1;\n \t\t\t}\n \t\t\telse\n \t\t\t{\n \t\t\t\tr = 0;\n \t\t\t}\n \t\t}\n \t}\n \telse\n \t{\n \t\tr = 0;\n \t}\n }\n else if(a < -2 || b < -2)\n {\n \tr = 0;\n }\n \n return r;\n}\n"}, {"source_code": "#include\n#include\n#define M 200\n\nint analizar_comodidad(int manoNinhaNinho[]);\n\nmain()\n{\n int manos[4], comodo, i;\n\n for(i=0; i<4; i++)\n {\n \tscanf(\"%d\", &manos[i]);\n }\n\n comodo = analizar_comodidad(manos);\n\n if(comodo == 1)\n {\n printf(\"YES\");\n }\n\telse\n\t{\n printf(\"NO\");\n }\n\n return 0;\n}\n\nint analizar_comodidad(int manoNinhaNinho[]) // 1 es YES, 0 es NO\n{\n int A_izq, A_der, B_izq, B_der, a, b, r, div, resto;\n \n A_izq = manoNinhaNinho[0];\n A_der = manoNinhaNinho[1];\n B_izq = manoNinhaNinho[2];\n B_der = manoNinhaNinho[3];\n \n\n a = B_izq - A_der;\n b = B_der - A_izq;\n \n if(a >= -2 && a <= 2)\n {\n \tif(a == -2)\n \t{\n \t\tif(b >= -2 && b <= 2)\n {\n \tif(b == -2)\n \t {\n \t\t r = 0;\n \t }\n \t else\n \t {\n \t\t r = 1;\n \t }\n }\n else if(b > 2)\n {\n \tdiv = B_der / A_izq;\n \t resto = B_der % A_izq;\n \t if(div <= 2)\n \t {\n \t \tif(resto <= 2)\n \t\t {\n \t\t \tr = 1;\n \t\t }\n \t\t else\n \t\t {\n \t\t\t r = 0;\n \t\t }\n \t }\n \t else\n \t {\n \t\t r = 0;\n \t }\n }\n else if(b < -2)\n {\n \tr = 0;\n }\n \t}\n \telse\n \t{\n \t\tr = 1;\n \t}\n }\n else if(a > 2 && (b <= -2 || b >= 2))\n {\n \tdiv = B_izq / A_der;\n \tresto = B_izq % A_der;\n \tif(div <= 2)\n \t{\n \t\tif(resto <= 2)\n \t\t{\n \t\t\tr = 1;\n \t\t}\n \t\telse\n \t\t{\n \t\t\tr = 0;\n \t\t}\n \t}\n \telse\n \t{\n \t\tr = 0;\n \t}\n }\n else if(b >= -2 && b <= 2)\n {\n \tif(b == -2)\n \t{\n \t\tr = 0;\n \t}\n \telse\n \t{\n \t\tr = 1;\n \t}\n }\n else if(b > 2)\n {\n \tdiv = B_der / A_izq;\n \tresto = B_der % A_izq;\n \tif(div <= 2)\n \t{\n \t\tif(resto <= 2)\n \t\t{\n \t\t\tr = 1;\n \t\t}\n \t\telse\n \t\t{\n \t\t\tr = 0;\n \t\t}\n \t}\n \telse\n \t{\n \t\tr = 0;\n \t}\n }\n else if(a < -2 || b < -2)\n {\n \tr = 0;\n }\n \n return r;\n}\n"}, {"source_code": "#include\n\nint main(){\n\tint gl, gr, bl, br;\n\tscanf(\"%d%d\", &gl, &gr);\n\tscanf(\"%d%d\", &bl, &br);\n\tif(brgl || bl>gr){\n\t\tif((2*gl+2)>=br || (2*gr+2)>=br){\n\t\t\tprintf(\"YES\");\n\t\t}else{\n\t\t\tprintf(\"NO\");\n\t\t}\n\t}else if(br==gl || bl==gr){\n\t\tprintf(\"YES\");\n\t}\n\t\n}\n"}, {"source_code": "#include \n#include \nint div1(int x, int b);\nint main()\n{\n\tint ar, al, br, bl;\n\tar = 0;\n\tal = 0;\n\tbr = 0;\n\tbl = 0;\n\tscanf(\"%d%d\",&ar, &al);\n\tscanf(\"%d%d\",&br, &bl);\n\tif( div1(ar,bl) == 1 )\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t{\n\t if( div1(br,al) == 1 )\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n\t}\n\treturn 0;\n}\nint div1(int x, int b)\n{\n\tint y, z;\n\tz=0;\n\tif( x < 100 && b < 100)\n\t{\n\tif(x < b)\n\t{\n\t\tif(x == b-1)\n\t\t\tz=1;\n\t}\n\telse\n\t{\n\t\tif( x > b)\n\t\t{\n\t\t\tif( (2*b+2) >= x)\n\t\t\t\tz=1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif ( x == b)\n\t\t\t\tz=1;\n\t\t}\n\t}\n\t}\n\treturn z;\n}\n"}, {"source_code": "#include \n#include \n#include \n\nint main(void) {\n int a, b, c, d;\n scanf(\"%d%d%d%d\", &a, &b, &c, &d);\n if ((abs(a - d) <= 1) || (d <= a * 2 + 2) || (abs(b - c) <= 1) || (c <= b * 2 + 2))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \n\nint main(void) {\n int a, b, c, d;\n scanf(\"%d%d%d%d\", &a, &b, &c, &d);\n if (abs(a - d) < 4 || abs(b - c) < 4)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n int al,ar,bl,br;\n scanf(\"%d%d\",&al,&ar);\n scanf(\"%d%d\",&bl,&br);\n al-=1;\n ar-=1;\n if(br>=al)\n {\n if(br%2)\n {\n if(al>=((br/2)-1))\n {\n printf(\"YES\\n\");\n return 0;\n }\n }\n else if(al>=(br/2))\n {\n printf(\"YES\\n\");\n return 0;\n }\n else\n {\n printf(\"NO\\n\");\n }\n }\n else if(bl>=ar)\n {\n if(bl%2)\n {\n if(ar>=((bl/2)-1))\n {\n printf(\"YES\\n\");\n return 0;\n }\n }\n else if(ar>=(bl/2))\n {\n printf(\"YES\\n\");\n return 0;\n }\n else\n {\n printf(\"NO\\n\");\n }\n\n }\n\n else\n {\n printf(\"NO\\n\");\n }\n return 0;\n}\n\n"}, {"source_code": "#include \n#include \n#include \n#define MAX 8\n\nint mano_venus(char* venusString);\nint mano_marte(char* marteString);\nvoid comfortable(int venusiana, int marciano);\n\nint main(int argc, char const *argv[])\n{\n char venus[MAX], marte[MAX];\n int hand_venus, hand_mars;\n\n gets(venus);\n gets(marte);\n\n hand_venus = mano_venus(venus);\n hand_mars = mano_marte(marte);\n\n if (hand_venus != -1 && hand_mars != -1)\n {\n comfortable(hand_venus, hand_mars);\n }\n\n\n return 0;\n}\n\nvoid comfortable(int venusiana, int marciano)\n{\n if ((venusiana - marciano) == 0 || abs(venusiana - marciano) == 1)\n {\n printf(\"YES\");\n }else{\n printf(\"NO\");\n }\n}\n\nint mano_venus(char* venusString)\n{\n char auxVenus[MAX];\n strcpy(auxVenus, venusString);\n\n char* manoVenusIzq = strtok(venusString, \" \");\n char* manoVenusDer = strtok(NULL, \" \");\n\n if (atoi(manoVenusIzq) > 0 && atoi(manoVenusIzq) <= 100)\n {\n if (atoi(manoVenusDer) > 0 && atoi(manoVenusDer) <= 100)\n {\n return atoi(manoVenusIzq);\n }\n }\n\n return -1;\n}\n\nint mano_marte(char* marteString)\n{\n char* manoMarteIzq = strtok(marteString, \" \");\n char* manoMarteDer = strtok(NULL, \" \");\n\n if (atoi(manoMarteIzq) > 0 && atoi(manoMarteIzq) < 100)\n {\n if (atoi(manoMarteDer) > 0 && atoi(manoMarteDer) < 100)\n {\n return atoi(manoMarteDer);\n }\n }\n\n return -1;\n}\n"}, {"source_code": "#include\nint main()\n{\n int r1,r2,l1,l2;\n //while(scanf(\"%d%d\",&r1,&l1))\n //{\n scanf(\"%d%d\",&l1,&r1);\n scanf(\"%d%d\",&l2,&r2);\n if(((2*l1+3>r2)&&(r2+1>l1))||((2*r1+3>l2)&&(l2+1>r1)))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n //}\n return 0;\n}"}, {"source_code": "#include\n#include\nvoid ver(int mujeri,int mujerd,int machoi,int machod);\nint main()\n{\n int a,b,c,d;\n scanf(\"%d%d%d%d\",&a,&b,&c,&d);\n ver(a,b,c,d);\n return 0;\n}\nvoid ver(int mujeri,int mujerd,int machoi,int machod)\n{\n if(machod>=mujeri && (machod-mujeri)-1<3 || machoi>=mujerd && (machoi-mujerd)-1<3 || mujerd-machoi==1 || mujeri-machod==1 || machod<=2+mujeri*2 || machoi<=2+mujerd*2)printf(\"YES\");\n else printf(\"NO\");\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int g1,g2,b1,b2;\n\tscanf(\"%d%d\",&g1,&g2);\n\tscanf(\"%d%d\",&b1,&b2);\n\tif((g2>=b1&&(g2-b1)<=1)||g1>=b2&&(g1-b2)<=1)\n\t\tprintf(\"YES\");\n\telse if((b1>=g2&&(b1<=2*(g2-1)))||(b2>=g1&&(b2<=2*(g1-1))))\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\treturn 0;\n}\n\t"}, {"source_code": "#include\nint main(){\nint bl,br,gl,gr;\nscanf(\"%d%d\",&bl,&br);\nscanf(\"%d%d\",&gl,&gr);\nif(bl>=gr+1&&bl<=(2*gr+2))\nprintf(\"YES\\n\");\nelse if(br>=gl+1&&br<=(2*gl+2))\nprintf(\"YES\\n\");\nelse printf(\"NO\\n\");\nreturn 0;\n}"}, {"source_code": "#include\n#include\n\nint analizar_comodidad(int izq_venu, int der_venu, int izq_mar, int der_mar);\n\nmain()\n{\n int izq_venu, der_venu, izq_mar, der_mar, comodo;\n\n scanf(\"%d %d\", &izq_venu, &der_venu);\n scanf(\"%d %d\", &izq_mar, &der_mar);\n\n comodo = analizar_comodidad(izq_venu, der_venu, izq_mar, der_mar);\n\n if(comodo == 1)\n {\n printf(\"YES\");\n }else{\n printf(\"NO\");\n }\n\n\n return 0;\n}\n\nint analizar_comodidad(int izq_venu, int der_venu, int izq_mar, int der_mar) // 1 es YES, 0 es NO\n{\n int r, a, b;\n\n a = izq_mar - der_venu;\n b = der_mar - izq_venu;\n \n if(a >= -2 && a <= 2)\n {\n \tr = 1;\n }\n else if(b >= -2 && b <= 2)\n {\n \tr = 1;\n }\n else\n {\n \tr = 0;\n }\n\n return r;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int b_r, b_l, g_r, g_l;\n\n scanf(\"%d %d %d %d\", &b_r, &b_l, &g_r, &g_l);\n\n int tot1=abs(b_r - g_l);\n int tot2=abs(b_l - g_r);\n\n if(tot1<=3 || tot2<=3)\n printf(\"YES\\n\");\n\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int b_r, b_l, g_r, g_l;\n\n scanf(\"%d %d %d %d\", &g_r, &g_l, &b_r, &b_l);\n\n int tot1=abs(b_r - g_l);\n int tot2=abs(b_l - g_r);\n\n if((g_l-b_r<2 || b_r>g_l) && ((b_l / 2<=g_r)))\n printf(\"YES\\n\");\n\n else if((g_r-b_l<2 || b_l>g_r) && ((b_r / 2<= g_l)))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n char a[101],b[101];\n scanf(\"%s\",a);\n scanf(\"%s\",b);\n int i=0;\n while(a[i]&&b[i])\n {if(a[i]==b[i])\n printf(\"0\");\n else\n printf(\"1\");\n \n i++;\n }\n}"}, {"source_code": "#include\n#include\nvoid ver(int mujeri,int mujerd,int machoi,int machod);\nint main()\n{\n int a,b,c,d;\n scanf(\"%d%d%d%d\",&a,&b,&c,&d);\n ver(a,b,c,d);\n return 0;\n}\nvoid ver(int mujeri,int mujerd,int machoi,int machod)\n{\n if(machod>=mujeri && (machod-mujeri)-2<3 || machoi>=mujerd && (machoi-mujerd)-2<3 || mujerd-machoi==1 || mujeri-machod==1 || machod==mujeri*2 || machoi==mujerd*2)printf(\"YES\");\n else printf(\"NO\");\n}\n"}, {"source_code": "#include \n#include \n#include \n#define MAX 8\n\nint mano_venus(char* venusString, int num);\nint mano_marte(char* marteString, int num);\nint comfortable(int venusiana, int marciano);\n\nint main(int argc, char const *argv[])\n{\n char venus[MAX], marte[MAX];\n char auxVenus[MAX], auxMarte[MAX];\n\n \n\n int hand_venus, hand_mars;\n\n gets(venus); strcpy(auxVenus, venus); \n gets(marte); strcpy(auxMarte, marte);\n\n hand_venus = mano_venus(venus, 1);\n hand_mars = mano_marte(marte, 1);\n\n if (hand_venus != -1 && hand_mars != -1)\n {\n if(comfortable(hand_venus, hand_mars))\n {\n printf(\"YES\");\n }else{\n hand_venus = mano_venus(auxVenus, 2);\n hand_mars = mano_marte(auxMarte, 2);\n if (comfortable(hand_venus, hand_mars))\n {\n printf(\"YES\");\n }else{\n printf(\"NO\");\n }\n }\n }\n\n return 0;\n}\n\nint comfortable(int venusiana, int marciano)\n{ \n int k = 0;\n\n if (((venusiana - marciano) == 0 || abs(venusiana - marciano) == 1) || (marciano - venusiana) > 0 || (marciano - venusiana) <= 3)\n {\n k = 1;\n }else{\n k = 0;\n }\n\n return k;\n}\n\nint mano_venus(char* venusString, int num)\n{\n char auxVenus[MAX];\n strcpy(auxVenus, venusString);\n int k = -1;\n\n char* manoVenusIzq = strtok(venusString, \" \");\n char* manoVenusDer = strtok(NULL, \" \");\n\n if (atoi(manoVenusIzq) > 0 && atoi(manoVenusIzq) <= 100)\n {\n if (atoi(manoVenusDer) > 0 && atoi(manoVenusDer) <= 100)\n {\n if(num == 1)\n {\n k = atoi(manoVenusIzq);\n }else{\n k = atoi(manoVenusDer);\n }\n }\n }\n\n return k;\n}\n\nint mano_marte(char* marteString, int num)\n{\n char* manoMarteIzq = strtok(marteString, \" \");\n char* manoMarteDer = strtok(NULL, \" \");\n int k = -1;\n\n if (atoi(manoMarteIzq) > 0 && atoi(manoMarteIzq) < 100)\n {\n if (atoi(manoMarteDer) > 0 && atoi(manoMarteDer) < 100)\n {\n if(num == 1)\n {\n k = atoi(manoMarteDer);\n }else{\n k = atoi(manoMarteIzq);\n }\n }\n }\n\n return k;\n}"}, {"source_code": "#include \n#include \nint div1(int x, int b);\nint main()\n{\n\tint ar, al, br, bl;\n\tar = 0;\n\tal = 0;\n\tbr = 0;\n\tbl = 0;\n\tscanf(\"%d%d\",&ar, &al);\n\tscanf(\"%d%d\",&br, &bl);\n\tif( div1(ar,bl) == 1 )\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t{\n\t if( div1(br,al) == 1 )\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n\t}\n\treturn 0;\n}\nint div1(int x, int b)\n{\n\tint y, z, c;\n\tz=0;\n\tif( x < 100 && b < 100)\n\t{\n\tif(x < b)\n\t{\n\t\tif(x == b-1)\n\t\t\tz=1;\n\t}\n\telse\n\t{\n\t\tif( x > b)\n\t\t{\n\t\t\tc = 2*b+2;\n\t\t\tif( ( c >= x) )\n\t\t\t\tz=0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif ( x == b)\n\t\t\t\tz=1;\n\t\t}\n\t}\n\t}\n\treturn z;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n\tint ar, al, br, bl;\n\tar = 0;\n\tal = 0;\n\tbr = 0;\n\tbl = 0;\n\tscanf(\"%d%d\",&ar, &al);\n\tscanf(\"%d%d\",&br, &bl);\n\tif( (abs(ar - bl) < 3) || (abs(al - br) < 3) )\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 \nint comfort(int girl, int boy){\n if(girl>boy){\n if(girl>=boy+2) return 0;\n else return 1;\n }\n else if(girl=2) return 0;\n else return 1;\n }\n else return 1;\n}\n\nint main(void)\n{\n int al, ar, bl, br;\n scanf(\"%d %d\\n%d %d\", &al,&ar,&bl,&br);\n if(comfort(al,br)==1 || comfort(ar,bl)==1) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}\n"}, {"source_code": " /****************************\n * Trabajo Practico Final *\n * A Student's Dream *\n ****************************/\n#include \n\nint main()\n{\n\tlong int venusiana_der,venusiana_izq,marsiano_der,marsiano_izq;\n\n\t//printf(\"Ingrese la cantidad de dedos de la venusiana en ambas manos\\n\");\n\tscanf(\"%ld %ld\", &venusiana_der, &venusiana_izq);\n\t//printf(\"Ingrese la cantidad de dedos de la marisano en ambas manos\\n\");\n\tscanf(\"%ld %ld\", &marsiano_der, &marsiano_izq);\n\tif(venusiana_der == marsiano_der && venusiana_izq == marsiano_izq)\n printf(\"SI\");\n\telse if((marsiano_izq>=venusiana_der-1 && marsiano_izq<=(venusiana_der*2)+2) || (marsiano_der>=venusiana_izq-1 && marsiano_der<=(venusiana_izq*2)+2))\n printf(\"SI\");\n else\n printf(\"NO\");\n return 0;\n}\n\n"}, {"source_code": "#include \n#include \n#include \n\nint main(void) {\n int a, b, c, d;\n scanf(\"%d%d%d%d\", &a, &b, &c, &d);\n if ((a >= d && (a - d) < 2) || (d >= a && (d - a) < 3) || (b >= c && (b - c) < 2) || (c >= b && (c - b) < 3))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include \n#include\nint main(void) {\n int bl,br,gl,gr;\n scanf(\"%d %d %d %d\",&gl,&gr,&bl,&br);\n if(abs(bl-gr)<2||abs(br-gl)<2) printf(\"YES\");\n else if(bl<=2*gr+2||br<=2*gl+2==2) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include\n#include\nvoid ver(int mujeri,int mujerd,int machoi,int machod);\nint main()\n{\n int a,b,c,d;\n scanf(\"%d%d%d%d\",&a,&b,&c,&d);\n ver(a,b,c,d);\n return 0;\n}\nvoid ver(int mujeri,int mujerd,int machoi,int machod)\n{\n if(machod>=mujeri || machoi>=mujerd || (mujeri-machod)==1 || (mujerd-machoi)==1)\n {\n int a=abs(machod-mujeri);\n int b=abs(machoi-mujerd);\n if(a<3 || b<3) printf(\"YES\");\n else printf(\"NO\");\n }\n else printf(\"NO\");\n}\n"}, {"source_code": "#include \n#include \nint div1(int x, int b);\nint main()\n{\n\tint ar, al, br, bl;\n\tar = 0;\n\tal = 0;\n\tbr = 0;\n\tbl = 0;\n\tscanf(\"%d%d\",&ar, &al);\n\tscanf(\"%d%d\",&br, &bl);\n\tif( div1(ar,bl) == 1 )\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t{\n\t if( div1(al,br) == 1 )\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n\t}\n\treturn 0;\n}\nint div1(int x, int b)\n{\n\tint y, z, c,a;\n\tz=0;\n\tif( x < 100 && b < 100)\n\t{\n\tif(x < b)\n\t{\t\n\t\ta = x;\n\t\tx = b;\n\t\tb = a;\n\t\tif(b == x-1)\n\t\t{\n\t\t\tz=1;\n\t\t}\n\t}\n\telse\n\t{\n\t\tif( x > b)\n\t\t{\n\t\t\tc = 2*b-1;\n\t\t\tif( ( c >= x ) || (x-b-1 < 3) )\n\t\t\t\tz=1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif ( x == b)\n\t\t\t\tz=1;\n\t\t}\n\t}\n}\n\treturn z;\n}\n"}, {"source_code": "#include\n#include\nvoid ver(int mujeri,int mujerd,int machoi,int machod);\nint main()\n{\n int a,b,c,d;\n scanf(\"%d%d%d%d\",&a,&b,&c,&d);\n ver(a,b,c,d);\n return 0;\n}\nvoid ver(int mujeri,int mujerd,int machoi,int machod)\n{\n if(machod>=mujeri || machoi>=mujerd || (mujeri-machod)==1 || (mujerd-machoi)==1)\n {\n int a=abs(machod-mujeri)-1;\n int b=abs(machoi-mujerd)-1;\n if(a<3 || b<3) printf(\"YES\");\n else printf(\"NO\");\n }\n else printf(\"NO\");\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,i=0,j=0,k=0,l=0,m=0;\n int a[200],b[100];\n \n scanf(\"%d\",&b[0]);\n scanf(\"%d\",&b[1]);\n scanf(\"%d\",&a[0]);\n scanf(\"%d\",&a[1]);\n if(((a[0]-b[1])>=0 && ((a[0]/2)-1)<=b[1]) || ((a[1]-b[0])>=0 && ((a[1]/2)-1)<=b[0]))\n printf(\"YES\");\n else if(((b[0]-a[1])>=0 && (b[0]-a[1])<2) || ((b[1]-a[0])>=0 && (b[1]-a[0])<2))\n printf(\"YES\");\n else\n printf(\"NO\");\n \n return 0;\n}"}, {"source_code": "#include \n#include \nint div1(int x, int b);\nint main()\n{\n\tint ar, al, br, bl;\n\tar = 0;\n\tal = 0;\n\tbr = 0;\n\tbl = 0;\n\tscanf(\"%d%d\",&ar, &al);\n\tscanf(\"%d%d\",&br, &bl);\n\tif( div1(ar,bl) == 1 )\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t{\n\t if( div1(al,br) == 1 )\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n\t}\n\treturn 0;\n}\nint div1(int x, int b)\n{\n\tint y, z, c,a;\n\tz=0;\n\tif( x < 100 && b < 100)\n\t{\n\tif(x < b)\n\t{\t\n\t\tif(x == b-1)\n\t\t\tz=1;\n\t}\n\telse\n\t{\n\t\tif( x > b)\n\t\t{\n\t\t\tc = 2*b+2;\n\t\t\tif( ( c >= x ) || (x-b-1 < 3) )\n\t\t\t\tz=1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif ( x == b)\n\t\t\t\tz=1;\n\t\t}\n\t}\n}\n\treturn z;\n}\n"}, {"source_code": "#include \n#include \n#include \n\nint main(void) {\n int a, b, c, d;\n scanf(\"%d%d%d%d\", &a, &b, &c, &d);\n if (abs(a - d) < 4 || abs(b - c) < 4)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n int al,ar,bl,br;\n scanf(\"%d%d\",&al,&ar);\n scanf(\"%d%d\",&bl,&br);\n al-=1;\n ar-=1;\n if(br>=al)\n {\n if((br%2)==0)\n {\n if(al>=((br/2)-1))\n {\n printf(\"YES\\n\");\n return 0;\n }\n }\n else if(al>=(br/2))\n {\n printf(\"YES\\n\");\n return 0;\n }\n else\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n else if(bl>=ar)\n {\n if((bl%2)==0)\n {\n if(ar>=((bl/2)-1))\n {\n printf(\"YES\\n\");\n return 0;\n }\n }\n else if(ar>=(bl/2))\n {\n printf(\"YES\\n\");\n return 0;\n }\n else\n {\n printf(\"NO\\n\");\n return 0;\n }\n\n }\n\n else\n {\n printf(\"NO\\n\");\n }\n return 0;\n}\n\n"}, {"source_code": "#include\n\nint main()\n{\n int b_r, b_l, g_r, g_l;\n\n scanf(\"%d %d %d %d\", &b_r, &b_l, &g_r, &g_l);\n\n int tot1=abs(b_r - g_l);\n int tot2=abs(b_l - g_r);\n\n if(tot1<3 || tot2<3)\n printf(\"YES\\n\");\n\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n\tint ar, al, br, bl;\n\tar = 0;\n\tal = 0;\n\tbr = 0;\n\tbl = 0;\n\tscanf(\"%d%d\",&ar, &al);\n\tscanf(\"%d%d\",&br, &bl);\n\tif( (abs(ar / bl) < 3) || (abs(al / br) < 3) )\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 \n\nint main()\n{\n\tint a,b,c,d;\n\tscanf(\"%d %d\",&a,&b);\n\tscanf(\"%d %d\",&c,&d);\n\tif (d>=a-1 && d<=(a+3)){\n\t\tprintf(\"YES\");\n\t}\n\telse if(c>=b-1 && c<=(a+3)){\n\t\tprintf(\"YES\");\n\t}\n\telse{\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main()\n{\n int gr, gl, br, bl, i, a=0;\n scanf(\"%d %d\", &gl, &gr);\n scanf(\"%d %d\", &bl, &br);\n if(gl==br || bl==gr){\n printf(\"YES\");\n return 0;\n }\n if(gl>br && (gl-br)<=1){\n printf(\"YES\");\n return 0;\n }\n else if(gr>bl && (gr-bl)<=1){\n printf(\"YES\");\n return 0;\n }\n if(br%2==0){\n br=br-1;\n }\n if(br>gl && gl>=(br/2)){\n printf(\"YES\");\n return 0;\n }\n if(bl%2==0){\n bl=bl-1;\n }\n if(bl>gr && gr>=(bl/2)){\n printf(\"YES\");\n return 0;\n }\n printf(\"NO\");\n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint div1(int x, int b);\nint main()\n{\n\tint ar, al, br, bl;\n\tar = 0;\n\tal = 0;\n\tbr = 0;\n\tbl = 0;\n\tscanf(\"%d%d\",&ar, &al);\n\tscanf(\"%d%d\",&br, &bl);\n\tif( div1(ar,bl) || div1(br,al) )\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}\nint div1(int x, int b)\n{\n\tint y, z;\n\tz=0;\n\tif(x < b)\n\t{\n\t\tif(x == b-1)\n\t\t\tz=1;\n\t}\n\telse\n\t{\n\t\tif( x > b)\n\t\t{\n\t\t\tif( (2*b +2) >= x)\n\t\t\t\tz=1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif ( x == b)\n\t\t\t\tz=1;\n\t\t}\n\t}\n\treturn z;\n}\n"}, {"source_code": "#include\nint main()\n{ int a,b,c,d;\nscanf(\"%d%d%d%d\",&a,&b,&c,&d);\nif((d>=a-1&&a>=d/2-1)||(c>=b-1&&b>=c/2-1))\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n }\n"}, {"source_code": "#include\n#include\nint main(){\nint g[2],b[2],i;\nfor(i=0;i<2;i++)\n scanf(\"%d\",&g[i]);\nfor(i=0;i<2;i++)\n scanf(\"%d\",&b[i]);\nif((b[1]>=g[0]-1)&&(b[1]<=g[0]+3)){\n printf(\"YES\");\n exit(0);\n}\nif((b[0]>=g[1]-1)&&(b[0]<=g[1]+3)){\n printf(\"YES\");\n exit(0);\n}\nelse\n printf(\"N0\");\nreturn 0;\n}\n"}, {"source_code": "#include \n#include \nint div1(int x, int b);\nint main()\n{\n\tint ar, al, br, bl;\n\tar = 0;\n\tal = 0;\n\tbr = 0;\n\tbl = 0;\n\tscanf(\"%d%d\",&ar, &al);\n\tscanf(\"%d%d\",&br, &bl);\n\tif( div1(ar,bl) == 1 )\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t{\n\t if( div1(al,br) == 1 )\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n\t}\n\treturn 0;\n}\nint div1(int x, int b)\n{\n\tint y, z, c,a;\n\tz=0;\n\tif( x < 100 && b < 100)\n\t{\n\tif(x < b)\n\t{\t\n\t\tif(x == b-1)\n\t\t\tz=1;\n\t}\n\telse\n\t{\n\t\tif( x > b)\n\t\t{\n\t\t\tc = 2*b+2;\n\t\t\tif( ( c >= x && x-b-1 < 3) )\n\t\t\t\tz=1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif ( x == b)\n\t\t\t\tz=1;\n\t\t}\n\t}\n}\n\treturn z;\n}\n"}, {"source_code": "#include \nint main()\n{\n int a,b,c,d,r=0,t=0;\n scanf(\"%d %d %d %d\", &a, &b, &c, &d);\n if(a > d && r==0)\n {\n if(d == a-1)\n {\n printf(\"YES\");\n r++;\n }\n else\n {\n t++;\n }\n }\n if(d >= a && r==0)\n {\n if(d == a || d==a+1 || d==a+2 || d==a+3)\n {\n printf(\"YES\");\n r++;\n }\n else\n {\n t++;\n }\n }\n if(b > c && r==0)\n {\n if(c == b - 1)\n {\n printf(\"YES\");\n r++;\n }\n else\n {\n if(t > 0)\n printf(\"NO\");\n }\n }\n if(c >= b && r == 0)\n {\n if(c==b || c==b+1 || c==b+2 || c == b+3)\n {\n printf(\"YES\");\n r++;\n }\n else\n {\n if(t > 0)\n printf(\"NO\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint div1(int x, int b);\nint main()\n{\n\tint ar, al, br, bl;\n\tar = 0;\n\tal = 0;\n\tbr = 0;\n\tbl = 0;\n\tscanf(\"%d%d\",&ar, &al);\n\tscanf(\"%d%d\",&br, &bl);\n\tif( div1(ar,bl) || div1(br,al) )\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}\nint div1(int x, int b)\n{\n\tint y, z;\n\tz=1;\n\tif(x > b)\n\t{\n\t\ty = x / b;\n\t\tif(y > 3)\n z=0;\n\t}\n\telse\n\t{\n\t\ty = b / x;\n if(y > 3)\n z=0;\n\t}\n\treturn z;\n}\n"}, {"source_code": "#include \n#include \nint div1(int x, int b);\nint main()\n{\n\tint ar, al, br, bl;\n\tar = 0;\n\tal = 0;\n\tbr = 0;\n\tbl = 0;\n\tscanf(\"%d%d\",&ar, &al);\n\tscanf(\"%d%d\",&br, &bl);\n\tif( div1(ar,bl) == 1 )\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t{\n\t if( div1(br,al) == 1 )\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n\t}\n\treturn 0;\n}\nint div1(int x, int b)\n{\n\tint y, z;\n\tz=0;\n\tif( x < 100 && b < 100)\n\t{\n\tif(x < b)\n\t{\n\t\tif(x == b-1)\n\t\t\tz=1;\n\t}\n\telse\n\t{\n\t\tif( x > b)\n\t\t{\n\t\t\tif( (2*b+2) >= x)\n\t\t\t\tz=1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif ( x == b)\n\t\t\t\tz=1;\n\t\t}\n\t}\n\t}\n\treturn z;\n}\n"}, {"source_code": "#include\n#include\nvoid ver(int mujeri,int mujerd,int machoi,int machod);\nint main()\n{\n int a,b,c,d;\n scanf(\"%d%d%d%d\",&a,&b,&c,&d);\n ver(a,b,c,d);\n return 0;\n}\nvoid ver(int mujeri,int mujerd,int machoi,int machod)\n{\n if(machod>=mujeri || machoi>=mujerd || (mujeri-machod)==1 || (mujerd-machoi)==1)\n {\n int a=abs(machod-mujeri);\n int b=abs(machoi-mujerd);\n if(a<3 || b<3) printf(\"YES\");\n else printf(\"NO\");\n }\n else printf(\"NO\");\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n\tint ar, al, br, bl;\n\tscanf(\"%d%d\",&ar, &al);\n\tscanf(\"%d%d\",&br, &bl);\n\tif( (abs(ar - bl) < 3) || (abs(al - br) < 3) )\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": "\n#include \n\nint main(){\n\n int A1,A2,B1,B2;\n\n scanf(\"%d %d\",&A1,&A2);\n scanf(\"%d %d\",&B1,&B2);\n\n if( B1A2 || B2>A1 ){\n if( 2*A1+2 >= B2 || 2*A2+2 >= B1 )puts(\"YES\");\n else puts(\"NO\");\n }else puts(\"YES\");\n\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int b_r, b_l, g_r, g_l;\n\n scanf(\"%d %d %d %d\", &g_r, &g_l, &b_r, &b_l);\n\n int tot1=abs(b_r - g_l);\n int tot2=abs(b_l - g_r);\n\n if(((b_l>=g_r) || tot2<=1) && ((b_l / 3<=g_r)))\n printf(\"YES\\n\");\n\n else if(((b_r>=g_l) || tot1<=1) && ((b_r / 3<= g_l)))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint div1(int x, int b);\nint main()\n{\n\tint ar, al, br, bl;\n\tar = 0;\n\tal = 0;\n\tbr = 0;\n\tbl = 0;\n\tscanf(\"%d%d\",&ar, &al);\n\tscanf(\"%d%d\",&br, &bl);\n\tif( div1(ar,bl) == 1 )\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t{\n\t if( div1(al,br) == 1 )\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n\t}\n\treturn 0;\n}\nint div1(int x, int b)\n{\n\tint y, z, c,a;\n\tz=0;\n\tif(x < b)\n\t{\t\n\t\ta = x;\n\t\tx = b;\n\t\tb = a;\n\t\tif(x == b-1)\n\t\t\tz=1;\n\t}\n\telse\n\t{\n\t\tif( x > b)\n\t\t{\n\t\t\tc = 2*b+2;\n\t\t\tif( ( c >= x) )\n\t\t\t\tz=1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif ( x == b)\n\t\t\t\tz=1;\n\t\t}\n\t}\n\treturn z;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int g1,g2,b1,b2;\n\tscanf(\"%d%d\",&g1,&g2);\n\tscanf(\"%d%d\",&b1,&b2);\n\tif((g2>=b1&&(g2-b1)<=1)||g1>=b2&&(g1-b2)<=1)\n\t\tprintf(\"YES\");\n\telse if((b1>=g2&&(b1-g2)<=3)||(b2>=g1&&(b2-g1)<=3))\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\treturn 0;\n}\n\t"}, {"source_code": "#include\n\nint main()\n{\n int al,ar,bl,br;\n scanf(\"%d%d\",&al,&ar);\n scanf(\"%d%d\",&bl,&br);\n al-=1;\n ar-=1;\n if(br>=al)\n {\n if((br%2)==0)\n {\n if(al>=((br/2)-1))\n {\n printf(\"YES\\n\");\n return 0;\n }\n }\n else if(al>=(br/2))\n {\n printf(\"YES\\n\");\n return 0;\n }\n else\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n else if(bl>=ar)\n {\n if((bl%2)==0)\n {\n if(ar>=((bl/2)-1))\n {\n printf(\"YES\\n\");\n return 0;\n }\n }\n else if(ar>=(bl/2))\n {\n printf(\"YES\\n\");\n return 0;\n }\n else\n {\n printf(\"NO\\n\");\n return 0;\n }\n\n }\n\n else\n {\n printf(\"NO\\n\");\n }\n return 0;\n}\n\n"}, {"source_code": " /****************************\n * Trabajo Practico Final *\n * A Student's Dream *\n ****************************/\n#include \n\nint main()\n{\n\tlong int venusiana_der, venusiana_izq, marsiano_der, marsiano_izq;\n\n\t//printf(\"Ingrese la cantidad de dedos de la venusiana en ambas manos\\n\");\n\tscanf(\"%ld %ld\", &venusiana_der, &venusiana_izq);\n\t//printf(\"Ingrese la cantidad de dedos de la marisano en ambas manos\\n\");\n\tscanf(\"%ld %ld\", &marsiano_der, &marsiano_izq);\n\n\tif(venusiana_der == marsiano_der && venusiana_izq == marsiano_izq)\n printf(\"SI\");\n\telse if((marsiano_izq>=venusiana_der-1 && marsiano_izq<=(venusiana_der*2)+2) || (marsiano_der>=venusiana_izq-1 && marsiano_der<=(venusiana_izq*2)+2))\n printf(\"SI\");\n else\n printf(\"NO\");\n return 0;\n}\n\n"}, {"source_code": "#include \n#include \nint main()\n{\n\tint ar, al, br, bl;\n\tar = 0;\n\tal = 0;\n\tbr = 0;\n\tbl = 0;\n\tscanf(\"%d%d\",&ar, &al);\n\tscanf(\"%d%d\",&br, &bl);\n\tif( (abs(ar - bl) < 3) || (abs(al - br) < 3) )\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 \n#include \nint check_fing(int b, int g){\n\tint groups[102];\n\tint i;\n\tint correct = 1;\n\tmemset(groups,0,102*sizeof(int));\n\tfor(i = 0; b; i=(i+1)%(g+1)){\n\t\tgroups[i]++;\n\t\tb--;\n\t}\n\tfor(i = 0; i 0) && (groups[i]<=2);\n\tfor(i = g; i= 0) && (groups[i]<=2);\n\t\t\n\treturn correct;\n}\n\nint main(){\n\tint al, ar, bl, br;\n\tint res = 0;\n\tscanf(\"%d %d\\n%d %d\",&al,&ar,&bl,&br);\n\tres = check_fing(bl,ar) || check_fing(br,al);\n\tprintf(\"%s\\n\", res ? \"YES\":\"NO\");\n\treturn 0;\n}\n\n"}, {"source_code": "#include\n#include\nint main(){\nint g[2],b[2],i;\nfor(i=0;i<2;i++)\n scanf(\"%d\",&g[i]);\nfor(i=0;i<2;i++)\n scanf(\"%d\",&b[i]);\nif((b[1]>=g[0]-1)&&(b[1]<=g[0]+3)){\n printf(\"YES\");\n exit(0);\n}\nif((b[0]>=g[1]-1)&&(b[0]<=g[1]+3)){\n printf(\"YES\");\n exit(0);\n}\nelse\n printf(\"N0\");\nreturn 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int b_r, b_l, g_r, g_l;\n\n scanf(\"%d %d %d %d\", &g_r, &g_l, &b_r, &b_l);\n\n int tot1=abs(b_r - g_l);\n int tot2=abs(b_l - g_r);\n\n if((g_l-b_r<2 || b_r>g_l) && ((b_l / 3<=g_r)))\n printf(\"YES\\n\");\n\n else if((g_r-b_l<2 || b_l>g_r) && ((b_r / 3<= g_l)))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint div1(int x, int b);\nint main()\n{\n\tint ar, al, br, bl;\n\tar = 0;\n\tal = 0;\n\tbr = 0;\n\tbl = 0;\n\tscanf(\"%d%d\",&ar, &al);\n\tscanf(\"%d%d\",&br, &bl);\n\tif( div1(ar,bl) == 1 )\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t{\n\t if( div1(al,br) == 1 )\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n\t}\n\treturn 0;\n}\nint div1(int x, int b)\n{\n\tint y, z, c,a;\n\tz=0;\n\tif(x < b)\n\t{\t\n\t\ta = x;\n\t\tx = b;\n\t\tb = a;\n\t\tif(x == b-1)\n\t\t\tz=1;\n\t}\n\telse\n\t{\n\t\tif( x > b)\n\t\t{\n\t\t\tc = 2*b-1;\n\t\t\tif( ( c >= x) )\n\t\t\t\tz=1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif ( x == b)\n\t\t\t\tz=1;\n\t\t}\n\t}\n\treturn z;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int b_r, b_l, g_r, g_l;\n\n scanf(\"%d %d %d %d\", &g_r, &g_l, &b_r, &b_l);\n\n int tot1=abs(b_r - g_l);\n int tot2=abs(b_l - g_r);\n\n if(((b_l>=g_r) || tot2<=1) && ((b_l - g_r<3)))\n printf(\"YES\\n\");\n\n else if(((b_r>=g_l) || tot1<=1) && ((b_r - g_l<3)))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main()\n{\n int gr, gl, br, bl, i, a=0;\n scanf(\"%d %d\", &gl, &gr);\n scanf(\"%d %d\", &bl, &br);\n if(gl==br || bl==gr){\n printf(\"YES\");\n return 0;\n }\n if(gl<=br+1 && gl>=br){\n printf(\"YES\");\n return 0;\n }\n else if(br>gl){\n if(br%2==1 && gl>=(br/2)){\n printf(\"YES\");\n }\n else if(br%2==0 && gl>=(br/2)-1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n }\n if(gr<=bl+1 && gr>=bl){\n printf(\"YES\");\n return 0;\n }\n else if(bl>gr){\n if(bl%2==1 && gr>=(bl/2)){\n printf(\"YES\");\n }\n else if(bl%2==0 && gr>=(bl/2)-1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n }\n printf(\"NO\");\n\n\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,i=0,j=0,k=0,l=0,m=0;\n int a[200],b[100];\n \n scanf(\"%d\",&b[0]);\n scanf(\"%d\",&b[1]);\n scanf(\"%d\",&a[0]);\n scanf(\"%d\",&a[1]);\n if(((a[0]-b[1])>=0 && (a[0]-b[1])/2<=b[1]) || ((a[1]-b[0])>=0 && (a[1]-b[0])/2<=b[1]))\n printf(\"YES\");\n else if(((b[0]-a[1])>=0 && (b[0]-a[1])<2) || ((b[1]-a[0])>=0 && (b[1]-a[0])<2))\n printf(\"YES\");\n else\n printf(\"NO\");\n \n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int a,b,c,d;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n if((d>=a-1&&d<2*a+1)||(c>=b-1&&c<2*b+1))\n printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include\n\nint main(){\n\tint gl, gr, bl, br;\n\tscanf(\"%d%d\", &gl, &gr);\n\tscanf(\"%d%d\", &bl, &br);\n\tif(((gl-br<=1 && br-gl<=3) || (gr-bl<=1 && bl-gr<=3)) && ((gl>0 && gr>0) && (br>0 && bl>0)) && ((gl>0 && br>0) || (gr>0 && bl>0)) && (gl>=0 && gr>=0 && bl>=0 && br>=0) && (gl<=100 && gr<=100 && bl<=100 && br<=100)){\n\t\tprintf(\"YES\");\n\t}else{\n\t\tprintf(\"NO\");\n\t}\n\t\n\treturn 0;\n\t\n}\n"}, {"source_code": "#include\n#include\nint main(){\n\tint f[2];\n\tint m[2];\n\tscanf(\"%d%d\", &f[0], &f[1]);\n\tscanf(\"%d%d\", &m[0], &m[1]);\n\t\n\tif( fabs(f[0]-m[1])<=1 || fabs(f[1]-m[0])<=1){\n\t\tprintf(\"\\nSI\");\n\t}else{\n\t\tprintf(\"\\nNO\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint main(){\n\tint gl, gr, bl, br;\n\tscanf(\"%d%d\", &gl, &gr);\n\tscanf(\"%d%d\", &bl, &br);\n\tif(brgl || bl>gr){\n\t\tif((gl==br/2-1 || gr==bl/2-1) || (gl==br/2 || gr==bl/2)){\n\t\t\tprintf(\"YES\");\n\t\t}else{\n\t\t\tprintf(\"NO\");\n\t\t}\n\t}else if(br==gl || bl==gr){\n\t\tprintf(\"YES\");\n\t}\n\t\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n\nint main(void)\n{\n int a1, a2, b1, b2;\n\n scanf(\"%d%d%d%d\", &a1, &a2, &b1, &b2);\n\n if((a1 < b2 && (a1 + 1) * 2 >= b2)\n ||(a2 < b1 && (a2 + 1) * 2 >= b1))\n printf(\"YES\");\n else\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nvoid ver(int mujeri,int mujerd,int machoi,int machod);\nint main()\n{\n int a,b,c,d;\n scanf(\"%d%d%d%d\",&a,&b,&c,&d);\n ver(a,b,c,d);\n return 0;\n}\nvoid ver(int mujeri,int mujerd,int machoi,int machod)\n{\n if(machod>=mujeri && (machod-mujeri)-1<3 || machoi>=mujerd && (machoi-mujerd)-1<3 || mujerd-machoi==1 || mujeri-machod==1 || machod<=2+mujeri*2 || machoi<=2+mujerd*2)printf(\"YES\");\n else printf(\"NO\");\n}\n"}, {"source_code": "#include\n\nint main(){\n\tint gl, gr, bl, br;\n\tscanf(\"%d%d\", &gl, &gr);\n\tscanf(\"%d%d\", &bl, &br);\n\tif(brgl || bl>gr){\n\t\tif((gl==br/2-1 || gr==bl/2-1) || (gl==br/2 || gr==bl/2)){\n\t\t\tprintf(\"YES\");\n\t\t}else{\n\t\t\tprintf(\"NO\");\n\t\t}\n\t}else if(br==gl || bl==gr){\n\t\tprintf(\"YES\");\n\t}\n\t\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int b_r, b_l, g_r, g_l;\n\n scanf(\"%d %d %d %d\", &g_r, &g_l, &b_r, &b_l);\n\n int tot1=abs(b_r - g_l);\n int tot2=abs(b_l - g_r);\n\n if((g_l-b_r<2 || b_r>g_l) && ((b_l / 2<=g_r)))\n printf(\"YES\\n\");\n\n else if((g_r-b_l<2 || b_l>g_r) && ((b_r / 2<= g_l)))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n\tint a1,a2,b1,b2;\n\tscanf(\"%d %d %d %d\", &a1,&a2,&b1,&b2);\n\tif(a1 - b1 >= 2 || a2 - b2 >= 2)\n\t{\n\t\tprintf(\"NO\");\n\t}\n\telse if( b1 <= 2 * a1 + 2 && b1 <= 2 * a1 + 2)\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse if( b1 > 2 * a1 + 2 && b1 > 2 * a1 + 2)\n\t{\n\t\tprintf(\"NO\");\n\t}\n\telse\n\t{\n\t\tprintf(\"YES\");\n\t}\n}\n"}, {"source_code": "#include\n#include\nvoid ver(int mujeri,int mujerd,int machoi,int machod);\nint main()\n{\n int a,b,c,d;\n scanf(\"%d%d%d%d\",&a,&b,&c,&d);\n ver(a,b,c,d);\n return 0;\n}\nvoid ver(int mujeri,int mujerd,int machoi,int machod)\n{\n if(machod>=mujeri || machoi>=mujerd || (mujeri-machod)==1 || (mujerd-machoi)==1)\n {\n int a=abs(machod-mujeri)-1;\n int b=abs(machoi-mujerd)-1;\n if(a<3 || b<3) printf(\"YES\");\n else printf(\"NO\");\n }\n else printf(\"NO\");\n}\n"}], "src_uid": "36b7478e162be6e985613b2dad0974dd"} {"nl": {"description": "Vasya has n pairs of socks. In the morning of each day Vasya has to put on a pair of socks before he goes to school. When he comes home in the evening, Vasya takes off the used socks and throws them away. Every m-th day (at days with numbers m, 2m, 3m, ...) mom buys a pair of socks to Vasya. She does it late in the evening, so that Vasya cannot put on a new pair of socks before the next day. How many consecutive days pass until Vasya runs out of socks?", "input_spec": "The single line contains two integers n and m (1 ≤ n ≤ 100; 2 ≤ m ≤ 100), separated by a space.", "output_spec": "Print a single integer — the answer to the problem.", "sample_inputs": ["2 2", "9 3"], "sample_outputs": ["3", "13"], "notes": "NoteIn the first sample Vasya spends the first two days wearing the socks that he had initially. Then on day three he puts on the socks that were bought on day two.In the second sample Vasya spends the first nine days wearing the socks that he had initially. Then he spends three days wearing the socks that were bought on the third, sixth and ninth days. Than he spends another day wearing the socks that were bought on the twelfth day."}, "positive_code": [{"source_code": "#include \n\nint main()\n{\n int n, m, answer;\n scanf(\"%d %d\", &n, &m);\n if (n<1 || n>100 || m<2 || m>100) n = 0;\n answer = n;\n while (n>=m)\n {\n answer += n/m;\n n = n/m + n%m;\n }\n printf(\"%d\", answer);\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,h,nc;\n scanf(\"%d%d\",&a,&b);\n h=a;\n while(1)\n {\n nc=a/b;\n a=nc+(a%b);\n h=h+nc;\n if(a\n#include \n\nint main()\n{\n int n = 0, m = 0, ans = 0, total = 0, additional = 1;\n scanf(\"%d %d\", &n, &m);\n ans += n;\n while(additional != 0)\n {\n additional = 0;\n while(n/m != 0)\n {\n additional += n%m;\n n /= m;\n ans += n;\n //printf(\"aa %d %d \", n, n%m);\n //printf(\"%d\\n\", additional);\n }\n additional += additional+n%m >= m? n%m: 0;\n n = additional;\n total += additional;\n }\n //printf(\"%d\\n\", total);\n printf(\"%d\", ans+additional/m);\n}\n"}, {"source_code": "#include\n\nint main(){\n int n,m, sum = 0;\n scanf(\"%d %d\",&n, &m);\n while( n >0){\n n --;\n sum ++;\n if( sum != 0 && sum % m == 0)\n n ++;\n }\n\n /*if ((n/m) != 0 && (n/m) % m == 0)\n sum = n + (n/m) + 1;\n else\n sum = n + (n/m);*/\n printf(\"%d\",sum);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n\tint n, m, dia=0;\n\t\n\tscanf(\"%d\", &n);\n\tscanf(\"%d\", &m);\n\t\n\twhile(n>0) {\n\t\t++dia;\n\t\t--n;\n\t\tif((dia)%m==0) ++n;\n\t}\n\t\n\tprintf(\"%d\", dia);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a, n, m, i, sum=0, repeat;\n scanf(\"%d %d\", &n, &m);\n sum = n + n/(m-1);\n if(n%(m-1) == 0){\n sum -= 1;\n }\n printf(\"%d\", sum);\n\n return 0;\n}\n"}, {"source_code": "#include\nint main(void)\n{\n int i,n,m,total,extra;\n scanf(\"%d %d\",&n,&m);\n total=n;\n for(i=0;;i++)\n {\n extra=n/m;\n if(extra==0)\n break;\n if(n%m!=0&&n>m)\n n=extra+n%m;\n else\n n=extra;\n total+=extra;\n }\n printf(\"%d\\n\",total);\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n int i,s,r,l,j,n;\n scanf(\"%d %d\",&n,&j);\n l=n/j;\n r=n%j;\n for(;;){\n if(l==0) break;\n n=n+l;\n s=l%j;\n l=l/j;\n r=r+s;\n\n }\n if(r>j) n=n+((r/j));\n if(n%j==0) printf(\"%d\",n+1);\n else printf(\"%d\",n);\n}\n\n\n\n"}, {"source_code": "#include\nint main()\n{\nint n,m,c,r,x;\nscanf(\"%d %d\",&n,&m);\nc=n;\nwhile((n/m)>=1)\n{x=n%m;\nc=c + n/m;\nif(x==0)\nn=n/m;\nif(x!=0)\n{\nn=n/m + x;}}\nprintf(\"%d\",c);\nreturn 0;}"}, {"source_code": "#include\n\nint main()\n{\n\tint n, m;\n\twhile (~scanf(\"%d %d\", &n, &m))\n\t{\n\t\tint cnt = 0, day = 0;\n\t\twhile (n)\n\t\t{\n\t\t\tn--;\n\t\t\tcnt++;\n\t\t\tif (cnt == m)\n\t\t\t{\n\t\t\t\tn++;\n\t\t\t\tcnt = 0;\n\t\t\t}\n\t\t\tday++;\n\t\t}\n\t\tprintf(\"%d\\n\", day);\n\t}\n\treturn 0;\n}\n\n \t \t \t\t \t \t \t \t\t"}, {"source_code": "#include\nint main ()\n{\n int a,c=0,b,n=0;\n scanf(\"%d%d\",&a,&b);\n n=a;\n c=a;\n while(c>=b)\n {\n n+=c/b;\n c=c%b+c/b;\n }\n printf(\"%d\",n);\n return 0;\n}"}, {"source_code": "#include \n\nint main(){\n\tint n, m, i;\n\tscanf(\"%d %d\", &n, &m);\n\t\n\tfor(i = 0; i < n; i++){\n\t\t\tif(i%m == 0)\n\t\t\t\tn++;\n\t\t}\t\t\n\tprintf(\"%d\", n - 1);\t\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,m,i;\n\tscanf(\"%d %d\",&n,&m);\n\tfor(i=1;i<=n;i++)\n if(i%m==0)\n n++;\n\tprintf(\"%d\",n);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,m,x;\n\nscanf(\"%d %d\",&n,&m);\n\nif(n==m)\n\n{\n\nx=((n*m)+n)/n;\n\n}\n\nelse if(n\nint main()\n{\n int n,m,sum,i,j,d;\n scanf(\"%d %d\",&n,&m);\n sum=0;\n\n for(i=n;i>=m;i=i/m+i%m)\n {\n sum=sum+(i/m)*m;\n }\n d=sum+i;\n printf(\"%d\\n\",d);\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int n,m;\n int i;\n int count = 0;\n scanf(\"%d %d\",&n,&m);\n for(i = 1; ; i++)\n {\n if(i%m == 0)\n count++;\n if(i>n)\n {\n count--;\n }\n if(count == 0 && i>=n)\n break;\n }\n printf(\"%d\\n\",i);\n return 0;\n\n }\n"}, {"source_code": "#include\nint main(){\n\tint n,m,s=0,a=0,x;\n\tscanf(\"%d %d\",&n,&m);\n while(n>=m)\n {s+=n/m *m; \n n=n/m+n%m;\n}\nprintf(\"%d\",s+n);\n}"}, {"source_code": "#include\nint main()\n{\n\n int n,m,i=1,flag=1,temp,count=0;\n scanf(\"%d%d\",&n,&m);\n int c=n+1;\n int d=n+n/m;\n \n \n while(flag)\n {\n flag=0;\n temp=count;\n for(i=c; i<=d; i++)\n {\n\n if(i%m==0)\n {\n count++;\n flag=1;\n }\n\n\n }\n c=d+1;\n d=d+count-temp;\n }\n printf(\"%d\",n+n/m+count);\n\n \n\n return 0;\n\n}\n"}, {"source_code": "#include\nint main() \n{\n int n,m,sum,d;\n scanf(\"%d %d\",&n,&m);\n sum=n;\n rich:\n d=n/m;\n if(d>0)\n {\n sum=sum+d;\n if(((n%m)+d)>=m)\n {\n n=(n%m)+d;\n goto rich;\n }\n }\n printf(\"%d\",sum);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n, m,sum;\n scanf(\"%d %d\",&n,&m);\n sum =n;\n while(n>=m)\n {\n sum=sum +(n/m);\n n=((n/m)+(n%m));\n }\n printf(\"%d\\n\", sum);\n return 0;\n }\n"}, {"source_code": "#include\nint main(){\n int l,n,i,j,a,b,m,c=0;\n scanf(\"%d %d\",&n,&m);\n a=n/m;\n l=0;\n b=n;\n for(i=1;a!=0;i++){\n if(b%m==0){\n l=l+a;\n b=a;\n a=a/m;\n b=b%m;\n }\n else{\n l=l+a;\n a=a+b%m;\n b=a;\n a=a/m;\n }\n }\n printf(\"%d\\n\",l+n);\n return 0;\n}\n\n"}, {"source_code": "#include\nint main(void)\n{\n int n,t,m,c,k;\n scanf(\"%d\",&n);\n t=n;\n c=0;\n scanf(\"%d\",&m);\n while(n/m!=0)\n {\n k=n%m;\n n=n/m;\n c=c+n;\n n=n+k;\n }\n printf(\"%d\",c+t);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int a,b,c=0,d,i=2;\n scanf(\"%d %d\",&a,&b);\n d=b;\n while(a>=d)\n {\n c=0;\n while(1)\n {\n if(d<=a){\n c++;\n d=b*i;\n i++;\n }\n else break;\n }\n a=a+c;\n }\n printf(\"%d\",a);\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n\tint n,m,d,aux;\n\tscanf(\"%d%d\",&n,&m);\n\td = 0;\n\tdo\n\t{\n\t\taux = n;\n\t\tn -= m;\n\t\tif (n < 0)\n\t\t{\n\t\t\td += aux;\n\t\t\tbreak;\n\t\t}\n\t\td += m;\n\t\tn++;\n\t}\n\twhile (1);\n\tprintf(\"%d\",d);\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n, m, a;\n scanf(\"%d%d\", &n, &m);\n a=n+(n-1)/(m-1);\n printf(\"%d\", a);\n return 0;\n}\n"}, {"source_code": "#include\nint main(int argc, char const *argv[]) {\n int a,b;\n scanf(\"%d %d\", &a,&b);\n printf(\"%d\\n\", (a*b-1)/(b-1));\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n int n,m;\n scanf(\"%d%d\",&n,&m);\n int temp=n,count=0;\n while(temp>1&&n>=m){\n temp=temp-m+1;\n count++;\n if(temp\n\nint main()\n{\n int n, m, answer;\n scanf(\"%d %d\", &n, &m);\n if (n<1 || n>100 || m<2 || m>100) n = 0;\n answer = n;\n while (n>=m)\n {\n answer += n/m;\n n = n/m + n%m;\n }\n printf(\"%d\", answer);\n}\n"}, {"source_code": "#include\n#include\n#include\nint main(void)\n{\n\tint n,m,a,b,k,count,j;\n\tscanf(\"%d%d\",&n,&m);\n\t j=-1;\n\tcount=0;\n\ta=n+1;\n b=n+n/m;\n while(1)\n {\n for(k=a;k<=b;k++)\n {\n \tif(k%m==0)\n \tcount++;\n }\n a=a+n*pow(m,j);\n b=b+n*pow(m,j-1);\n j--;\n if(a>b)\n break;\n }\n if((n+n/m+count)%m==0)\n printf(\"%d\",n+n/m+count+1);\n else\n printf(\"%d\",n+n/m+count);\n}\n"}, {"source_code": "#include \nint main()\n{\n\tint n,m,flag=0;\n\tscanf(\"%d %d\",&n,&m);\n\tdo\n\t{\n\t\tflag+=1;\n\t\tn-=1;\n\t\tif(flag%m==0) n+=1;\n\t}while(n!=0 || flag%m==0);\n\tprintf(\"%d\",flag);\n} \n "}, {"source_code": "#include\nint main ()\n{\n int m,n,a, b, x,i;\n\n scanf(\"%d %d\",&n, &m);\n x=n;\n for (i=1; ;)\n {\n \ta=n/m;\n \tb=a+(n%m);\n \tn=b;\n \tx=x+a;\n \tif (b\nint main()\n{\n int a,b,i;\n scanf(\"%d %d\",&a,&b);\nfor(i=1;i<250;i++)\n{\n a=a-1;\n if(i%b==0) a=a+1;\n if(a==0) break;\n}\nprintf(\"%d\\n\",i);\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,h,nc;\n scanf(\"%d%d\",&a,&b);\n h=a;\n while(1)\n {\n nc=a/b;\n a=nc+(a%b);\n h=h+nc;\n if(a\nint main()\n{\n int n,m,x;\n\nscanf(\"%d %d\",&n,&m);\n\nif(n==m)\n\n{\n\nx=((n*m)+n)/n;\n\n}\n\nelse if(n\n#include \n\nint main()\n{\n int i,a,b,n,m;\n scanf(\"%d %d\",&n,&m);\n i=n;\n while(1)\n {\n if(n\n#include\nint main()\n{int n,m,i,count=0,l;\n\nfloat p1,p2,p=0.0;\nscanf(\"%d%d\",&n,&m);\nfor(i=1;(n/pow(m,i))>=1.00;i++)\n { \n p1=(n/pow(m,i));\n p=p+p1;\n count=count+1;\n }\nl=count+1;\np2=n+p+(n/pow(m,l));\nprintf(\"\\n%d\",(int)p2);\n \n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,m,days = 0;\n scanf(\"%d%d\",&n,&m);\n while(n >= m)\n {\n int remainder = n%m;\n days += n - remainder;\n n /= m;\n n += remainder;\n }\n days += n;\n printf(\"%d\\n\",days);\n return 0;\n}"}, {"source_code": "#include\nint main (){\n\tint n, m;\n\tscanf(\"%d %d\", &n, &m);\n\tint i, count = 0;\n\tfor(i = 1; 0 <(n + count); i++){\n\t\tn--;\n\t\tif(i % m == 0) count++;\n\t}\n\tprintf(\"%d\", --i);\n}\n\t\t\t\t \t\t\t \t\t \t \t \t\t\t"}, {"source_code": "#include \n#include \n\nint main()\n{\n int i,a,b,n,m;\n scanf(\"%d %d\",&n,&m);\n i=n;\n while(1)\n {\n if(n\nint main()\n{\n int n,m,count=0,i;\n scanf(\"%d%d\",&n,&m);\n for(i=1;i<=n;i++)\n {\n count=count+1;\n\n\n if(i%m==0)\n {\n count=count+1;\n n=n+1;\n }\n\n }\n printf(\"%d\",n);\n\n\n}"}, {"source_code": "#include\n\nint main()\n\n{\n\tint i=0,n,m;\n\tscanf(\"%d%d\",&n,&m);\t\n\tprintf(\"%d\",n+((n-1)/(m-1)));\n\treturn 0;\n\n}\n"}, {"source_code": "#include\n\nint main(){\n\tint n=0,m=0,DIAS=0,CANT=0,C=0;\n\tscanf(\"%d %d\",&n,&m);\n\tCANT=n;\n\twhile(CANT > 0){\n\t\tC=C+1;\n\t\tCANT=CANT-1;\n\t\tDIAS=DIAS+1;\n\t\tif(DIAS%m==0){\n\t\t\tCANT = CANT + 1;\n\t\t}\n\t}\n\tprintf(\"%d\",C);\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n int n,m,sum=0,div,check,count=0,res;\n scanf(\"%d %d\",&n,&m);\n sum=n;\n div=sum/m;\n res=sum%m;\n sum=sum+div;\n div=div+res;\n while(1){\n res=div%m;\n div=div/m;\n sum=sum+div;\n div=div+res;\n if(div\n#include\nint main()\n{int n,m,i,count=0,l;\n\nfloat p1,p2,p=0.0;\nscanf(\"%d%d\",&n,&m);\nfor(i=1;(n/pow(m,i))>=1.00;i++)\n { \n p1=(n/pow(m,i));\n p=p+p1;\n count=count+1;\n }\nl=count+1;\np2=n+p+(n/pow(m,l));\nprintf(\"\\n%d\",(int)p2);\n \n return 0;\n}"}, {"source_code": "#include\nint main(int argc, char const *argv[]) {\n int a,b;\n scanf(\"%d %d\", &a,&b);\n printf(\"%d\\n\", (a*b-1)/(b-1));\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int m,n,p=0;\n scanf(\"%d %d\",&n,&m);\n if(m!=1)\n p=((n-1)/(m-1));\n n+=p;\n printf(\"%d\\n\",n);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(){\n\tint n, m, i, days = 0;\n\tscanf(\"%d %d\", &n, &m);\n\t\n\tif(n == m){\n\t\tprintf(\"%d\", n + 1);\n\t}\n\telse if(n < m){\n\t\tprintf(\"%d\", n);\n\t}\n\telse{\n\t\tfor(i = 0; i < n; i++){\n\t\t\tif(i%m == 0)\n\t\t\t\tn++;\n\t\t}\t\t\n\t\tprintf(\"%d\", n - 1);\t\n\t}\n\treturn 0;\n}\n"}, {"source_code": " #include\n int main()\n {\n int n, m, x, a;\n scanf(\"%d %d\", &n, &m);\n x=n;\n while(1)\n {\n a=n/m;\n n=a+(n%m);\n x+=a;\n if(n\nint main()\n{\n int n,m,i,c=0,o;\n scanf(\"%d%d\",&n,&m);\n o=n;\n for(int i=1;i<=n;i++)\n {\n if(i%m==0)\n {\n c++;\n n++;\n }\n \n }\n // printf(\"%d\",c);\n printf(\"%d\\n\",c+o);\n \n}"}, {"source_code": "#include\nint main()\n{\nint n,m,i;\nscanf(\"%d %d\",&n,&m);\nfor(i=1;i>0;i++)\n{\nn=n-1;\nif(i%m==0)\nn=n+1;\nif(n==0)\nbreak;\n}\nprintf(\"%d\",i);\nreturn 0;\n\n}\n"}, {"source_code": "#include \n\nint main() {\n\tint a,b,n;\n\tscanf(\"%d %d\",&a,&b);\n\tn=a+(a-1)/(b-1);\n\tprintf(\"%d\",n);\n\treturn 0;\n}"}, {"source_code": "#include \n \nint main(void){\n int n,m;\n int c=0;\n \n do{\n scanf(\"%d%d\", &n,&m);\n }while(n<=0 || m<=0) ;\n \n while(n>0){\n n--;\n c++;\n if (c%m==0){\n\t\t\tn++;\n\t\t}\n }\n \n printf(\"%d\", c);\n \n return 0;\n}"}, {"source_code": "#include\nint main(){\n int n,m,count=0;\n scanf(\"%d %d\",&n,&m);\n while(n>m){\n n = n-(m-1);\n count+=m;\n }\n if(n==m) \n printf(\"%d\",count+n+1);\n else\n printf(\"%d\",count+n);\n return 0;\n}"}, {"source_code": "#include \n\nint main(void)\n{\n int n, m, d = 0, t, i;\n scanf(\"%d %d\", &n, &m);\n for(i = 1; i * m <= n; i++)\n {\n d++;\n }\n t = d;\n for(i = n + 1; d > 0; i++)\n {\n d--;\n if(i % m == 0)\n {\n d++;\n t++;\n }\n }\n printf(\"%d\\n\", t + n);\n\n return 0;\n\n}\n\n "}, {"source_code": "#include \nint main()\n{\n\tint n,m,flag=0;\n\tscanf(\"%d %d\",&n,&m);\n\tdo\n\t{\n\t\tflag+=1;\n\t\tn-=1;\n\t\tif(flag%m==0) n+=1;\n\t}while(n!=0 || flag%m==0);\n\tprintf(\"%d\",flag);\n} \n "}, {"source_code": "#include\n\nint main()\n{\n int m, n;\n scanf(\"%d %d\", &n, &m);\n if(m>n){\n printf(\"%d\", n);\n }\n else if(m==n){\n printf(\"%d\", n+1);\n }\n else{\n int z=0;\n int i=1;\n while(1){\n \n if(i%m==0){\n z++;\n }\n if(n>0){\n n--;\n }\n else if(n==0 && z>0){\n z--;\n }\n if(n==0 && z==0){\n break;\n }\n i++;\n }\n printf(\"%d\", i);\n }\n}"}, {"source_code": "#include \n\nint main()\n{\n int n,m,i;\n scanf(\"%d %d\",&n,&m);\n\n for (i=1;;i++){\n if (n==0)\n break;\n n--; \n if (i%m==0)\n n++;\n }\n\n printf(\"%d\\n\",i-1);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,m,cnt=0;\n scanf(\"%d %d\",&n,&m);\n for(int i=0;n>=0;i++,n--)\n {\n cnt++;\n if(i==m)\n {\n n++;\n i=0;\n }\n }\n printf(\"%d\",cnt-1);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int m,n,p=0;\n scanf(\"%d %d\",&n,&m);\n if(m!=1)\n p=((n-1)/(m-1));\n n+=p;\n printf(\"%d\\n\",n);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int m,n,k,i;\n scanf(\"%d %d\",&n,&m);\n for(i=1;i<=n;i++)\n {\n if(m*i<=n)\n n++;\n }\n printf(\"%d\",n);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(void) {\n\t// your code goes here\n\tint n,m,i;\n\tscanf(\"%d %d\",&n,&m);\n for(i=1;i<=n;i++)\n {\n if(i%m==0)\n n=n+1;\n }\n\tprintf(\"%d\",i-1);\n\treturn 0;\n}\n\n"}, {"source_code": "#include \nint main()\n{\n int a,b,i=0,m;\n scanf(\"%d %d\",&a,&b);\n m=a;\n while(a>=b){\n a=(a-b)+1;\n i++;\n }\n printf(\"%d\",m+i);\n}\n"}, {"source_code": "#include\nint main(){\n int n,m,i;\n scanf(\"%d%d\",&n,&m);\n for(i=0,n-=1;n>=0;i++){\n if(i%m)\n n--;\n }\n printf(\"%d\",i-1);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,d,i;\n scanf(\"%d %d\",&n,&d);\n for(i=1;d*i<=n;i++)\n {\n n++;\n }\n\n printf(\"%d\",n);\n\n }\n"}, {"source_code": "#include\nint main()\n{\n\tint n,m,days=0;\n\tscanf(\"%d %d\",&n,&m);\n\tdo\n\t {days++;\n\t n--;\n\t if(days%m==0)\n\t n++;}\n\twhile(n!=0||days%m==0);\n\tprintf(\"%d\",days);\n\t}\n\n "}, {"source_code": "#include \n\nint main(void)\n{\n int n, m, d = 0, t, i;\n scanf(\"%d %d\", &n, &m);\n for(i = 1; i * m <= n; i++)\n {\n d++;\n }\n t = d;\n for(i = n + 1; d > 0; i++)\n {\n d--;\n if(i % m == 0)\n {\n d++;\n t++;\n }\n }\n printf(\"%d\\n\", t + n);\n\n return 0;\n\n}\n\n "}, {"source_code": "#include\nint main(){\n int n,m,i,a=0,b,c=0;\n scanf(\"%d %d\",&n,&m);\n for(i=1;i<=n;i++){\n if(i%m==0){\n n++;\n }\n }\n printf(\"%d\",n);\n}"}, {"source_code": "#include \nint main()\n{\n int a,b,i=0,m;\n scanf(\"%d %d\",&a,&b);\n m=a;\n while(a>=b){\n a=(a-b)+1;\n i++;\n }\n printf(\"%d\",m+i);\n}\n"}, {"source_code": "#include \nint main ()\n{\nint n,m,x,y,z,s,a;\ns=0;\nscanf (\"%d %d\", &n,&m);\ns=s+n;\nx=(int)n/m;\ns=s+x;\ny=x*m;\nz=n-y;\nx=x+z;\nwhile(x >= m)\n{\nn=x;\nx=(int)x/m;\ns=s+x;\ny=x*m;\nz=n-y;\nx=x+z;\n}\nprintf (\"%d\\n\", s);\nreturn 0;\n}\n"}, {"source_code": "#include \n\nint main(){\n\tint n, m, i;\n\tscanf(\"%d %d\", &n, &m);\n\t\n\tfor(i = 0; i < n; i++){\n\t\t\tif(i%m == 0)\n\t\t\t\tn++;\n\t\t}\t\t\n\tprintf(\"%d\", n - 1);\t\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,m,days=0,socks;\n scanf(\"%d %d\",&socks,&m);\n while(socks!=0)\n {\n days++;\n socks--;\n if(days%m==0)\n socks++; \n }\n printf(\"%d\",days);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int m,n,days=0,c=0,i;\n scanf(\"%d%d\",&n,&m);\n i=n+1;\n days+=(n+(n/m));\n // printf(\"n\");\n while(1)\n {\n c=0;\n for(;i<=days;i++)\n {\n if(i%m==0) c++;\n }\n days+=c;\n if(c\n \n int main(){\n int p,n,m;\n scanf(\"%i %i\",&n,&m);\n int q=n;\n while(n/m>0){\n p=n/m;\n q+=p;\n n=n%m+p;\n }\n printf(\"%i\",q);\n }"}, {"source_code": "#include\nint main()\n{\n int n,m,s,q;\n scanf(\"%d %d\",&n,&m);\n if(n\n#include \n#include \n\n\nint main() {\n int m,n;\n scanf(\"%d %d\",&m,&n);\n int sum;\n sum=m+(m-1)/(n-1);\n printf(\"%d\",sum);\n return 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\nint n,m,c,r,x;\nscanf(\"%d %d\",&n,&m);\nc=n;\nwhile((n/m)>=1)\n{x=n%m;\nc=c + n/m;\nif(x==0)\nn=n/m;\nif(x!=0)\n{\nn=n/m + x;}}\nprintf(\"%d\",c);\nreturn 0;}"}, {"source_code": "#include \n\nint main() {\n\tint n, m, dia=0;\n\t\n\tscanf(\"%d\", &n);\n\tscanf(\"%d\", &m);\n\t\n\twhile(n>0) {\n\t\t++dia;\n\t\t--n;\n\t\tif((dia)%m==0) ++n;\n\t}\n\t\n\tprintf(\"%d\", dia);\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int m,n,j,a,b,c;\n\n scanf(\"%d %d\",&m,&n);\n a=1;\n b=m;\n for(;a\nint main()\n{\n long n,m,s;\n scanf(\"%d%d\",&n, &m);\n s=n;\n while(n>=m)\n {\n s+=n/m;\n n=n%m+n/m;\n }\n printf(\"%d\\n\",s);\n return 0;\n}\n"}, {"source_code": "//\n// main.c\n// jsd\n//\n// Created by Mihai Esanu on 10/5/19.\n// Copyright © 2019 Mihai Esanu. All rights reserved.\n//\n\n#include \n\nint main(int argc, const char * argv[]) {\n int day, n, m;\n \n scanf(\"%d %d\", &n, &m);\n day = 0;\n while(1==1)\n {\n n = n - 1;\n \n day = day + 1;\n if( day % m == 0 )\n {\n n = n + 1;\n }\n if(n == 0)\n {\n break;\n }\n }\n \n printf(\"%d\", day);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,m,count=0,i,x;\n scanf(\"%d%d\",&n,&m);\n x=m;\n for(i=1;n>0;i++)\n {\n n=n-1;\n count++;\n if(i==m)\n {\n n=n+1;\n m=m+x;\n }\n }\n printf(\"%d\",count);\n return 0;\n\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int i,a,b,n,m;\n scanf(\"%d %d\",&n,&m);\n i=n;\n while(1)\n {\n if(n\n#include\nvoid math()\n{\n int n,m,d;\n scanf(\"%d%d\",&n,&m);\n if(n\n\nint main()\n\n{\n\tint i=0,n,m;\n\tscanf(\"%d%d\",&n,&m);\t\n\tprintf(\"%d\",n+((n-1)/(m-1)));\n\treturn 0;\n\n}\n"}, {"source_code": "#include \nmain()\n{\n int n,m,a=0;\n scanf(\"%d %d\",&n,&m);\n while(n>0)\n {\n \ta=a+1;\n \tif(a%m==0)\n \t{\n \t\tn=n;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tn=n-1;\n\t\t}\n\t}\n\tprintf(\"%d\",a);\n \n}"}, {"source_code": "#include \n\nint main(void){\n int n,m;\n scanf(\"%d %d\",&n,&m);\n if((n<1)||(n>100))\n return 0;\n\n if((m<2)||(m>100))\n return 0;\n\n if(m>n){\n printf(\"%d\",n);\n return 0;\n }\n int result = n;\n int ratio = n/m;\n result += ratio;\n int i,j,count=1;\n while(count){\n count = 0;\n for(j=result-ratio+1;j<=result;j++){\n if(!(j%m)){\n count++;\n }\n }\n result += count;\n ratio = count;\n }\n printf(\"%d\",result);\n return 0;\n}\n\n\n"}, {"source_code": "#include\nmain()\n{\n\nint n,m;\nint p,s;\nscanf(\"%d%d\",&n,&m);\np=n;\nwhile(n>=m)\n{p=p+(n/m);\n\ns=n-(n/m)*m;\nn=s+(n/m);\n//printf(\"%d # %d\",p,n);\n}\nprintf(\"%d\",p);\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int m, n;\n scanf(\"%d %d\", &n, &m);\n if(m>n){\n printf(\"%d\", n);\n }\n else if(m==n){\n printf(\"%d\", n+1);\n }\n else{\n int z=0;\n int i=1;\n while(1){\n \n if(i%m==0){\n z++;\n }\n if(n>0){\n n--;\n }\n else if(n==0 && z>0){\n z--;\n }\n if(n==0 && z==0){\n break;\n }\n i++;\n }\n printf(\"%d\", i);\n }\n}"}, {"source_code": "#include\nint main ()\n{\n int m,n,a, b, x,i;\n \n scanf(\"%d %d\",&n, &m);\n x=n;\n for (i=1; ;)\n {\n \ta=n/m;\n \tb=a+(n%m);\n \tn=b;\n \tx=x+a;\n \tif (b\nint main()\n{\n int n,m;\n scanf(\"%d %d\",&n,&m);\n int a,i;\n for(i=1;;i++)\n {\n a=i*m;\n if(n>=a)\n n++;else break;\n \n }\n printf(\"%d\\n\",n);\nreturn 0;\n}\n "}, {"source_code": "#include\nint main(){\nint n,m,d=0;\nscanf(\"%d%d\",&n,&m);\nwhile(n/m>0){\nd+=n-n%m;\nn=(n/m)+(n%m);\n}\nd+=n;\nprintf(\"%d\",d);\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 \nint main()\n{\n\tint m,n,pairs,temp;\n\tscanf(\"%d%d\",&m,&n);\n\tpairs=m;\n\twhile(m/n!=0){\n\t\ttemp=m/n;\n\t\tpairs=pairs+temp;\n\t\tm=temp+m%n;\n\t}\n\tprintf(\"%d\",pairs);\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint main(){\n\tint n=0,m=0,DIAS=0,CANT=0,C=0;\n\tscanf(\"%d %d\",&n,&m);\n\tCANT=n;\n\twhile(CANT > 0){\n\t\tC=C+1;\n\t\tCANT=CANT-1;\n\t\tDIAS=DIAS+1;\n\t\tif(DIAS == m){\n\t\t\tCANT = CANT + 1;\n\t\t\tDIAS=0;\n\t\t}\n\t}\n\tprintf(\"%d\",C);\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\nint main(void) {\n int n, m;\n scanf(\"%d %d\", &n, &m);\n\n int x = n;\n if (n >= m)\n while (x >= m) {\n int r = x % m;\n x = x / m;\n n += floor(x);\n x += r;\n }\n printf(\"%d\\n\", n);\n\n return 0;\n}\n"}, {"source_code": "#include\n#define sf scanf\n#define pf printf\ntypedef long long ll;\n\nint main()\n{\n int a, b, div, mod;\n sf(\"%d%d\", &a, &b);\n int sum = a;\n while(a>=b)\n {\n div = (a/b);\n sum = sum + div;\n mod = (a%b);\n a= (div+mod);\n }\n pf(\"%d\\n\", sum);\n}"}, {"source_code": "#include\n\nmain()\n{\n int n,m,i,x,y;\n scanf(\"%d %d\",&n,&m);\n x=n;\n if(m!=2&&n>=m)\n {for(i=1;i<=n;i++)\n {y=n%m;\n n=n/m;\n x=x+n;\n if(m>n&&y==0)\n break;\n else\n n=n+y;\n }\n printf(\"%d\",x);}\n else if(m==2) printf(\"%d\",2*n-1);\n else if(m>n)\n printf(\"%d\",n);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n\n{\n\tint i=0,n,m;\n\tscanf(\"%d%d\",&n,&m);\t\n\tprintf(\"%d\",n+((n-1)/(m-1)));\n\treturn 0;\n\n}\n"}, {"source_code": "#include \nint main()\n{\n int a,b,i=0,m;\n scanf(\"%d %d\",&a,&b);\n m=a;\n while(a>=b){\n a=(a-b)+1;\n i++;\n }\n printf(\"%d\",m+i);\n}\n"}, {"source_code": "#include\n\nint main(){\n\tint n=0,m=0,DIAS=0,CANT=0,C=0;\n\tscanf(\"%d %d\",&n,&m);\n\tCANT=n;\n\twhile(CANT > 0){\n\t\tC=C+1;\n\t\tCANT=CANT-1;\n\t\tDIAS=DIAS+1;\n\t\tif(DIAS%m==0){\n\t\t\tCANT = CANT + 1;\n\t\t}\n\t}\n\tprintf(\"%d\",C);\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\nint n,m,daysCnt=0,i,NewSocs,remindDays,temp;\nscanf(\"%i%i\",&n,&m);\n\n daysCnt=n;\n NewSocs=n/m;\n remindDays=n%m;\n daysCnt= daysCnt+NewSocs;\n\n while (NewSocs!=0)\n { temp=NewSocs;\n NewSocs=(temp+remindDays)/m;\n remindDays=(temp+remindDays)%m;\n daysCnt=daysCnt+NewSocs;\n }\n\n printf(\"%i\",daysCnt);\n\n\n\n\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include \n#include \n\nint main()\n{\n int n, m, a;\n scanf(\"%d%d\", &n, &m);\n a=n+n/m+n/(m*m)+n/(m*m*m)+n/(m*m*m*m)+n/(m*m*m*m*m);\n printf(\"%d\", a);\n return 0;\n}\n"}, {"source_code": "#include\n#include \n\nint main()\n{\n\tint n,m,sum,div;\n\tscanf(\"%d%d\",&n,&m);\n\tsum=n;\n\twhile(n/m!=0)\n\t{\n\t\tdiv=n/m;\n\t\tsum=sum+div;\n\t\tn=n/m;\n\n\t}\n\tif(sum%m==0)\n\t\tsum++;\n\n\tprintf(\"%d\",sum);\n\n\t//getch();\n\treturn 0;\n}"}, {"source_code": "#include\nint main(){\n int n,m;\n scanf(\"%d%d\",&n,&m);\n int temp=n,count=0;\n while(temp>1&&n>m){\n temp=temp-m+1;\n count++;\n }\n printf(\"%d\\n\",n+count);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#define ll long long\n\nint main()\n{\n int n,m,count = 0, s;\n scanf(\"%d %d\",&n,&m);\n s = n;\n for( ; n/m != 0; ){\n s = s + n/m;\n n = n/m;\n }\n printf(\"%d\",s);\n\n\n return 0;\n}\n\n"}, {"source_code": " #include\n int main()\n {\n int n,m,res,mod=0;\n scanf(\"%d%d\",&n,&m);\n res=n;\n while(n>=m)\n {\n res=res+(n/m);\n mod=mod+(n%m);\n n=n/m;\n }\n printf(\"%d\",res+mod);\n return 0;\n }\n"}, {"source_code": "\n#include\nint main ()\n{\n int m,n,x,i;\n x=0;\n scanf(\"%d %d\",&n, &m);\n\n if(m+1>n) printf(\"%d\",n);\n\n else if(m\n\nint main()\n{\n\tint n,m, day=0;\n\t\n\tscanf(\"%d %d\", &n, &m);\n\t\n\twhile(1)\n\t{\n\t\tn--;\n\t\tday++;\n\n\t\tif(n==0)\n\t\t\tbreak;\n\t\t\n\t\tif(day%m==0)\n\t\t\tn++;\n\t}\n\t\n\tprintf(\"%d\", day);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,m,i,count=0;\n scanf(\"%d %d\",&n,&m);\n\n if(n==m) printf(\"%d\",n++);\n\n if(nm){\n for(i=1;i<=n;i++){\n if(i%m==0){\n n++;\n count++;\n }\n else count++;\n }\n printf(\"%d\",count);\n }\n}\n"}, {"source_code": "#include \nint main()\n{\n int n,m,sum;\n scanf(\"%d%d\",&n,&m);\n if(n\n#include \n\nint main()\n{\n float n, m;\n int answer;\n\n scanf(\"%f %f\", &n, &m);\n\n if (n<1 || n>100 || m<2 || m>100) n = 0;\n answer = 0;\n\n while (n>=1)\n {\n answer += n;\n n /= m;\n }\n if (n>0.5) answer++;\n\n printf(\"%f %f %d\", n, m, answer);\n}\n"}, {"source_code": "#include \n\nint main(void) {\n\tint p,q,x;\n\tscanf(\"%d %d\",&p,&q);\n\tx=p+p/q;\n\twhile((p/q)>=q)\n\t{\n\t\tif(p%q==0){\n\t\t\t\tp=p/q;\n\t\tx=x+p/q;\n\t\t\tp=p/q;\n\t\t}\n\t\n\t\telse{\n\t\t\t\tp=p/q;\n\t\tx=x+(((p%q)+(p/q))/q);\n\t\tp=p/q;}\n\t}\n\tprintf(\"%d\",x);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n#define ll long long\n\nint main()\n{\n int n,m,s = 0,e = 0,f = 0;\n scanf(\"%d %d\",&n,&m);\n s = n;\n for( ; n/m != 0; ){\n s = s + n/m;\n e = e + n % m;\n n = n/m;\n }\n for( ; e/m != 0; ){\n f = f + e/m;\n e = e/m;\n }\n\n printf(\"%d\",s + e);\n\n\n return 0;\n}\n\n"}, {"source_code": "\n\n#include \n\nint main(int argc, const char * argv[]) {\n int day, n, m;\n \n scanf(\"%d %d\", &n, &m);\n day = 1.0;\n while(1==1)\n {\n n = n - 1;\n if(n == 0)\n {\n break;\n }\n if( day % m > 0 )\n {\n n = n + 1;\n }\n day = day + 1;\n }\n printf(\"%d\", day);\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int n,m,sum;\n scanf(\"%d%d\",&n,&m);\n if(n==0||m<=1||n>100||m>100) return 0;\n if(n1)\n {\n n=n/m;\n sum=sum+n;\n }\n sum=sum+1;\n }\n printf(\"%d\\n\",sum);\n return 0;\n}\n"}, {"source_code": "#include \n\n\nint main(){\n\tint n,m, r;\n\tscanf(\"%d %d\", &n,&m);\n\tr = n;\n\twhile ( n != 0){\n\t\tr += n / m;\n\t\tn = n / m;\n\t}\n\tprintf(\"%d\", r);\t\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint m,n,i,j;\n\tscanf(\"%d %d\",&n,&m);\n\ti=n/m;\n\tj=n%m;\n\tif(i>=m){\n\t\t\n\ti=i+i-m;\n\ti++;\n}\n\tprintf(\"%d\\n\",n+j+i);\n\t\n\t\n\t\n\t\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,m,ans,ans1,b;\n scanf(\"%d %d\",&n,&m);\n b=n/m;\n ans=n+b;\n ans1=ans;\n ans=ans-n;\n// printf(\"%d %d\",ans1,ans);\n while(ans>=m)\n {\n b=ans/m;\n ans1=ans1+b;\n ans=ans%m;\n }\n printf(\"%d\",ans1);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,m,ans;\n scanf(\"%d %d\",&n,&m);\n ans=n+(n/m);\n n=n/m;\n do\n {\n n=n/m;\n ans+=n;\n }while(n/m);\n if(n%m==(m-1))\n ans+=n;\n printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "\n#include\nint main ()\n{\n int m,n,x,i;\n x=0;\n scanf(\"%d %d\",&n, &m);\n\n if(m+1>n) printf(\"%d\",n);\n\n else if(m\nint main ()\n{\n int m,n,x,i,y;\n x=0;\n\n scanf(\"%d %d\",&n, &m);\n n=y;\n if(m>n) printf(\"%d\",n);\n\n else if(m\nint main()\n{\n int n,m,ans,ans1,b;\n scanf(\"%d %d\",&n,&m);\n b=n/m;\n ans=n+b;\n ans1=ans;\n ans=ans-n;\n // printf(\"%d %d\",ans1,ans);\n while(ans!=0)\n {\n ans=ans/m;\n ans1=ans1+ans;\n }\n if(ans1%m==0)\n {\n printf(\"%d\",ans1+1);\n }\n else \n printf(\"%d\",ans1);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int i,n,count=0,m,a=0;\n scanf(\"%d %d\",&n,&m);\n if(n>=m){\n while(a\nint main()\n{\n int n,m,i,l,k,s,q,p,r;\n scanf(\"%d %d\",&n,&m);\n if(n\nint main()\n{\n int n,i,j,m,x=0;\n scanf(\"%d%d\",&n,&m);\n if(n==m)\n {\n for(i=n; i>0; i--)\n {\n x+=1;\n\n }\n printf(\"%d\",(x+n/m));\n }\n else if(n>m)\n {\n for(i=n; i>=0; i--)\n {\n x+=1;\n\n }\n printf(\"%d\",(x+n/m));\n }\n else\n {\n for(i=n; i>0; i--)\n {\n x+=1;\n\n }\n printf(\"%d\",x);\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main(void)\n{\n int i,n,m,total,extra;\n scanf(\"%d %d\",&n,&m);\n total=n;\n for(i=0;;i++)\n {\n extra=n/m;\n if(extra==0)\n break;\n total+=extra;\n n=extra;\n }\n printf(\"%d\\n\",total);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,m,i=0,sum=0;\n scanf(\"%d%d\",&n,&m);\n while(sum\nint main()\n{\n int n=0,m=0,sum=0,a=0,b=0;\n scanf(\"%d%d\",&n,&m);\n if(n>=m)\n {\n a=n;\n sum=n;\n while(a!=0)\n {\n b=a%m;\n a=a/m;\n if(a==0||a==1)\n {\n sum=sum+a;\n }\n else\n {\n sum=sum+a+b;\n }\n }\n }\n else\n {\n sum=n;\n }\n printf(\"%d\",sum);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,m;\n scanf(\"%d %d\",&n,&m);\n int i,c=0,d=n;\n if(n\nint main(){\n \n int n,m;\n scanf(\"%d%d\",&n,&m);\n printf(\"%d\",n+(n/m));\n return 0;\n }\n"}, {"source_code": "#include \n\nint main()\n{\n int n,m,i,remainder,days = 0;\n scanf(\"%d %d\",&n,&m);\n while(n > 2){\n remainder = n % m;\n days += n ;\n n = remainder + n / m;\n };\n printf(\"%d\",days + n);\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int n,m,sum=0;\n scanf(\"%d %d\",&n,&m);\n sum=n;\n sum=sum+n/m;\n if(sum%m==0)\n sum++;\n printf(\"%d\",sum);\n return 0;\n}"}, {"source_code": "#include\nint main() {\n //就是新买的袜子,当天不能穿!\n //2 2\n //1 2 穿了一双,留有一双!\n //2 1 丢了一双,穿了一双,妈妈买了一双\n //3 0 没有穿的了,妈妈买的今天不能穿!\n //9 3\n //1 9 穿了一双,留有8双!\n //2 8 丢了一双,穿了一双,留有7双!\n //3 7 丢了一双,穿了一双,留有6双!买了一双\n //4 6 丢了一双,穿了一双,留有5双!+1\n //5 6 丢了一双,穿了一双,留有5双!新买的可以用了!\n //6 5 丢了一双,穿了一双,留有4双!买了一双\n //7 4 丢了一双,穿了一双,留有3双!+1\n //8 4 丢了一双,穿了一双,留有3双!新买的可以用了!\n //9 3 丢了一双,穿了一双,留有2双!买了一双\n //10 2 丢了一双,穿了一双,留有1双!+1\n //11 2 丢了一双,穿了一双,留有1双!可以用了\n //12 1 丢了一双,穿了一双,留有0双!买了一双!\n //13 0 丢了一双,穿了一双,留有1双!\n //整个模拟过程是细致,繁琐的!\n\t//通过了检测,但是中间过程和我的设想有不同!\n int n,m;\n scanf(\"%d%d\",&n,&m);\n\n int socks=n;\n int day=1;\n\t //printf(\"day %d: %d socks\\n\",day,socks);\n while(socks>0) {\n\t //printf(\"day %d: %d socks\\n\",day,socks);\n day++;\n socks--;\n\n\t //printf(\"day %d: %d socks\\n\",day,socks);\n if(day>=m && day%m==2) {\n socks++;\n }\n }\n printf(\"%d\\n\",day);\n //这个版本和我的分析是一致的!\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int n,i,m,r=0;\n scanf(\"%d%d\",&n,&m);\n if(n>=m)\n {\n while(n>=0 && n>=m)\n {\n n=n-m+1;\n r+=m;\n }\n if(n\nint main()\n{\n\tint n,m,sum=0,finalsum;\n\tscanf(\"%d%d\",&n,&m);\n\tfinalsum=n;\n\twhile(1){\n if(n\nint main ()\n{\n int a,b,n=0;\n scanf(\"%d%d\",&a,&b);\n n=a+a/b;\n if(a%b==0 && b%2!=0)\n n=n+1;\n printf(\"%d\",n);\n return 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n int n,m,i;\n scanf(\"%d %d\",&n,&m);\n if (n==1){\n printf(\"1\\n\");\n return 0;\n }\n for (i=1;;i++){\n n--;\n if (n==0)\n break;\n if (i%m==0)\n n++;\n }\n\n printf(\"%d\\n\",i+1);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,m,sum,r,o,y,d;\n scanf(\"%d%d\",&n,&m);\n while(r!=0)\n {\n r=n/m;\n o=(n%m)+r;\n\n n=o;\n d=d+r;\n if(o\nint main()\n{\n int n,m,z,p,x;\n scanf(\"%d %d\",&n,&m);\n z=n/m;\n p=n+z;\n if(nm)\n for (;z>=m;z=z+x)\n { x=z%m;\n z=z/m;\n p=p+z;}\n {\n printf(\"%d\",p);\n\n }\n\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n\tint a,b,c;\n\tscanf(\"%d%d\",&a,&b);\n\tc=a/b;\n\tint d,e,f,g,h,i;\n\td=c/b;\n\tf=d/b;\n\tg=f/b;\n\ti=f%b;\n\te=c+a+d+f+g+i;\n\tprintf(\"%d\",e);\n\treturn 0;\n\t}"}, {"source_code": "#include \n\nint main()\n{\n int n,m,i,remainder,days = 0;\n scanf(\"%d %d\",&n,&m);\n while(n > 2){\n remainder = n % m;\n days += n ;\n n = remainder + n / m;\n };\n printf(\"%d\",days + n);\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n#include \n\n\n\nint main()\n{\n int n,m;\n scanf(\"%i%i\",&n,&m);\n int result=n;\n int counter = n;\n while(result > 0)\n {\n result = result/m;\n counter += result;\n\n }\n\n if(counter%m == 0)\n printf(\"%i\\n\",counter+1);\n else\n printf(\"%i\\n\",counter);\n \n return 0;\n}\n\n\n"}, {"source_code": "#include \n#include \n#define ll long long\n\nint main()\n{\n int n,m,s = 0,e = 0,f = 0;\n scanf(\"%d %d\",&n,&m);\n s = n;\n for( ; (n+ m - 1)/m != 0; ){\n s = s + n/m;\n e = e + n % m;\n //printf(\"e = %d\\n\",e);\n n = n/m;\n //printf(\"n = %d\\n\",n);\n }\n for( ; (e + m - 1)/m != 0; ){\n f = f + e/m;\n e = e/m;\n }\n\n printf(\"%d\",s + f);\n\n\n return 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n\n int n,a;\n scanf(\"%d %d\",&n,&a);\n\n int j;\n j=n+n/a;\n //printf(\"%d\",j);\n int k,i,h;\n while(j-n>=a){\n\n k=j;\n i=n+1;\n for(;i<=k;i++){\n if(i%a==0){\n j++;\n }\n\n //printf(\"k%d\\n\",k);\n\n n=k;\n //printf(\"n %d\\n\",n);\n\n //printf(\"j %d\\n\",j);\n\n\n\n }\n }\n\n if(j%a==0){\n printf(\"%d\",j+1);\n }\n else{\n printf(\"%d\",j);\n }\n\n return 0;\n\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "main(){\n int n,m;\n scanf(\"%d%d\",&n,&m);\n int k,p;\n k=n/m;\n if(k\n#include\n#include\n#include\n\n\nvoid solve(){\n\tint ans,n,m;\n\tscanf(\"%d%d\",&n,&m);\n\t\n\tif(m%2==0)\n\t\tans=n+n/m;\n\telse \n\t\tans=n+(n/m+1);\n\t\t\t\n\tprintf(\"%d\\n\",ans);\n}\n\nint main(){\n\tint t;\n\t/*scanf(\"%d\",&t);\n\twhile(t--)*/\n\t\tsolve();\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int a,b,m;\n scanf(\"%d%d\",&a,&b);\n if(a\nint main()\n{\n\tint n,m,d;\n\tscanf(\"%d%d\",&n,&m);\n\td = n;\n\twhile (n > 1)\n\t{\n\t\tif (n%m != 0 && n > m)\n\t\t\td++;\n\t\tn /= m;\n\t\td += n;\n\t}\n\tprintf(\"%d\",d);\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n int n,m,sum,t;\n scanf(\"%d %d\",&n,&m);\n t=n/m;\n t=t+(t/m);\n sum=(n)+(t);\n printf(\"%d\\n\",sum);\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n,a,m,ans,i;\n scanf(\"%d %d\",&n,&m);\n ans=n;\n a=m;\n while(a>=m)\n {\n ans=ans+(n/m);\n n=ans-n;\n a=(n/m);\n }\n ans=ans+a;\n printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\nint b,m,n,k;\nscanf(\"%d %d\",&n,&m);\nk=n;\nwhile(b!=0)\n{\n b=n/m;\n k=k+b;\n n=b;\n}\nif(k%m==0)\n k++;\nprintf(\"%d\",k);\n\n\nreturn 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n,m;\n scanf(\"%d %d\",&n,&m);\n int p=n;\n while(p)\n {\n p=p/m;\n n=n+p;\n }\n if(n%m==0) n++;\n printf(\"%d\",n);\n return 0;\n\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n,m,i,c=0;\n scanf(\"%d\",&n);\n scanf(\"%d\",&m);\n for(i=1; i>0; i++)\n {\n n--;\n\n\n c++;\n if(n==0)\n {\n printf(\"%d\\n\",c);\n break;\n }\n if((i-1)%m==0)\n n++;\n }\n return 0;\n}\n"}, {"source_code": "#include\n int main()\n {\n int n,m,x,y,c=0,i,z=0,w;\n scanf(\"%d\",&n);\n scanf(\"%d\",&m);\n x=n/m;\n if(m>x)\n {\n c=x+n;\n }\n else\n {\n c=x+n;\n for(i=1;i<100;i++)\n {\n if(x%2!=0&&m==2)\n {\n y=x/m;\n c=c+y+1;\n x=y;\n if(y\n#include \n\nint main()\n{\n int n,x=0,m,k=0;\n scanf(\"%d\",&n);\n scanf(\"%d\",&m);\n while(n>0)\n {\n k=k+n;\n x=x+(n%m);\n n=n/m;\n }\n while(x>=m)\n {\n n=x/m;\n k+=n;\n x=x/m;\n }\n printf(\"%d\",k);\n}\n"}, {"source_code": "#include\nint main ()\n{\n int m,n,x,i;\n x=0;\n scanf(\"%d %d\",&n, &m);\n\n if(m>n) \n {printf(\"%d\", n);}\n\t\t\n else if(m\nint main(){\n\tint n,m,s=0,nb=0,i,a;\n\tscanf(\"%d %d\",&n,&m);\n\ts+=n;\n\ta=s;\n\tfor(i=2;i<=n;i++){\n\t\tif(i%m==0)nb++;\n\t}\n\ts+=nb;\n\tnb=0;\n\tfor(i=a+1;i<=s;i++){\n\t\tif(i%m==0)nb++;\n\t}\n\ts+=nb;\n\tprintf(\"%d\",s);\n}"}, {"source_code": "#include\nint main()\n{\nint n,m,i;\nscanf(\"%d%d\",&n,&m);\nfor(i=m;;i=i+m)\n{\nif(n>i)\nn=n+1;\nelse if (n==i){n=n+1; break;}\n}\nprintf(\"%d\",n);\n}\n"}, {"source_code": "\n\n#include \nint main () \n{\n int n,m,i;\n scanf(\"%d %d\",&n,&m); \n if (n\n#include\n#include\nint main(void)\n{\n\tint n,m,i,count;\n\tscanf(\"%d%d\",&n,&m);\n\ti=n/m;count=0;\n\twhile(i!=0)\n\t{\n\t\tcount=count+i;\n\t\ti=i/m;\n\t}\n\tprintf(\"%d\",n+count);\n\t\n\t\n\t\n\t\n}\n"}, {"source_code": "#include\nmain()\n{\n\nint n,m;\nint p,s;\nscanf(\"%d%d\",&n,&m);\np=n;\nwhile(n>1)\n{if(n%m==0)\n s=n/m;\n else s=n/m+1;\n p=p+s;\n //printf(\"%d\\n\",p);\n n=n/m;\n\n\n}\nprintf(\"%d\",p);\n}\n"}, {"source_code": "#include \n\nint main(){\n int n, m, resp;\n scanf(\"%d %d\", &n, &m);\n if( n == m )\n resp = n+1;\n else if( n > m )\n resp = n + n/m + 1;\n else\n resp = n + 1;\n printf(\"%d\", resp);\n return 0;\n}\n"}, {"source_code": "/*A. Vasya y calcetines\nVasya tiene n pares de calcetines. En la ma�ana de cada d�a, \nVasya tiene que ponerse un par de calcetines antes de ir a la escuela. \nCuando llega a casa por la noche, Vasya se quita los calcetines usados y los tira a la basura.\n Cada m -�simo d�a (en d�as con n�meros m , 2 m , 3 m , ... ) \n mam� compra un par de calcetines a Vasya. Lo hace tarde en la noche, \n por lo que Vasya no puede ponerse un par de calcetines nuevos antes del d�a siguiente.\n �Cu�ntos d�as consecutivos pasan hasta que Vasya se queda sin calcetines?\n*/\n#include\nint main(){\n\tint n,m,i,j,a,c;\n\tscanf(\"%d %d\",&n,&m);\n\tint v[m*n];\n\tint u[m*n];\n\t\n\tfor(i=0;i\n#include\nvoid math()\n{\n int n,m,d=1;\n scanf(\"%d%d\",&n,&m);\n if(n\n\nint main(){\n int i, n, y=0, sum=0, m;\n scanf(\"%d %d\", &n, &m);\n if(n\n\n\nint main ()\n{\n\tint n, m;\n\tscanf(\"%d%d\", &n, &m);\n\tint kq = 0,t =0, dem = 0;\n\twhile (n)\n\t{\n\t\tkq = kq + n;\n\t\tdem += n%m;\n\t\tif (dem==m)\n\t\t\t{\n\t\t\t\tdem = 0;\n\t\t\t\tt = 1;\n\t\t\t}\n\t\tn = n/m + t;\n\t\tif (t==1)\n\t\t\tt = 0;\n\t}\n\tprintf(\"%d\", kq);\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,m,a,b;\n scanf(\"%d %d\",&n,&m);\n\n if(n==m || n< m)\n {\n if(n==1 && m==2)\n {\n printf(\"%d\",n);\n }\n else\n printf(\"%d\",n+1);\n }\n if(n>m)\n {\n\n if(n%m==0)\n {\n a=n/m;\n printf(\"%d\",n+a+1);\n }\n else\n {\n b=n/m;\n printf(\"%d\",n+b+1);\n }\n }\n\n return 0;\n\n}\n //if(n>=1 && n<=100 && m>=2 && m<=1)\n"}, {"source_code": "#include\nint main()\n {\n int n,m,l,k,d,h;\n scanf(\"%d%d\",&n,&m);\n l=n/m;\n k=n%m;\n h=m*l+l+k;\n d=((l+k)/m)+((l+k)%m);\n l=0;\n while(d>=m)\n {\n h=h+d;\n d=d/m+d%m;\n l=1;\n }\n if(l==1)\n h=h+d;\n printf(\"%d\",h);\n return 0;\n }\n"}, {"source_code": "#include\n#include\nint main()\n{\n int n=0,a,b,x;\n scanf(\"%d %d\",&a,&b);\n x=a;\n if(a>b){\n while(a>1){\n\n n=n+a/b+a%b;\n a/=b;\n }\n }\n else\n {\n while(a>1){\n\n n=n+a/b;\n a/=b;\n }\n }\n printf(\"%d\",x+n);\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,c,d,f,g,e=0;\n scanf(\"%d%d\",&a,&b);\n c=a/b;\n d=a+c;\n if(aa)\n {\n\n d=d-b;\n d=d+1;\n e++;\n\n }\n g=a+c+e;\n printf(\"%d\\n\",g);\n\n }\n else{\n while(d>a+1)\n {\n\n d=d-b;\n d=d+1;\n e++;\n\n }\n f=a+c+e;\n printf(\"%d\\n\",f);\n }\n return 0;\n\n}\n"}, {"source_code": "#include \n\nint main(void){\n int n,m;\n scanf(\"%d %d\",&n,&m);\n if((n<1)||(n>100))\n return 0;\n\n if((m<2)||(m>100))\n return 0;\n\n if(m>n){\n printf(\"%d\",n);\n return 0;\n }\n int result = n;\n\n int ratio = n/m;\n while(ratio){\n result+=ratio;\n ratio/=m;\n }\n if(!(ratio%m)){\n printf(\"%d\",result);\n return 0;\n }\n printf(\"%d\",result);\n return 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n int n,m,d=0,r,e,o;\n scanf(\"%d %d\",&n,&m);\n if(n>=m)\n {r=n/m;\n d=r;}\n else\n r=0;\n if(r>m){\n while(r!=1){\n o=r%m;\n r=r+o;\n r=(r/m);\n \n d=d+r-o;}\n \n e=n+d;}\n else if(r==m)\n e=n+d+1;\n else\n e=n+d;\n printf(\"%d\",e);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int a, n, m, i, j, repeat;\n scanf(\"%d %d\", &n, &m);\n if(nm){\n int sum=0;\n i = n/m;\n sum = i + n;\n printf(\"%d\", (sum/m) - (n/m) + sum);\n }\n return 0;\n}\n"}, {"source_code": "#include\n\nint main(void)\n{\n int n,m,i,socks;\n scanf(\"%d %d\", &n,&m);\n socks = n;\n\n i = 0;\n while(1){\n socks--;\n\n if(socks == 0){\n break;\n }\n\n if(i%m == 0){\n socks++;\n }\n\n i++;\n }\n\n printf(\"%d\", i + 1);\n\n return 0;\n}\n\n\n"}, {"source_code": "#include\n\nint main()\n{\n int n,a,m,ans,i,b,co=0,ci=0;\n scanf(\"%d %d\",&n,&m);\n ans=n;\n while(n>=m)\n {\n ans=ans+(n/m);\n if((n%m)==0)\n {\n n=(n/m);\n co++;\n }\n else\n {\n n=((n/m)+1);\n ci++;\n }\n }\n if(ci>co && co!=0)\n ans=ans+1;\n printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n int n,m,c;\n scanf(\"%d %d\",&n,&m);\n if(m>=n){\n c = n + n/m;\n }\n else{\n c = n;\n while(n/m!=0){\n n = n/m;\n c = c + n;\n }\n }\n printf(\"%d\",c);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,m,d=0,r,e;\n scanf(\"%d %d\",&n,&m);\n if(n>=m)\n {r=n/m;\n d=r;}\n else\n r=0;\n if(r>m){\n while(r!=0)\n {r=(r/m);\n d=d+r;}\n \n e=n+d+1;}\n else if(r==m)\n e=n+d+1;\n else\n e=n+d;\n printf(\"%d\",e);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,m,x=0;\n scanf(\"%d%d\",&n,&m);\n if(n>m){\n x=x+n;\n while(n/m>0){\n x=x+n/m;\n n=n/m;\n }\n }\n else if(n==m){\n x=n+1;\n }\n else{\n x=n;\n }\n printf(\"%d\",x);\n return 0;\n}"}, {"source_code": "#include \nint main(void){\n int n, m, add;\n int answer=0;\n\n scanf(\"%d %d\", &n, &m);\n\n for(; n >= m;){\n answer += n;\n add += n%m;\n if(add/m>=1){\n n += add/m;\n add = add%m; \n }\n n = n/m;\n }\n\n printf(\"%d\", answer+n);\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n=0,m=0,sum=0,a=0,b=0;\n scanf(\"%d%d\",&n,&m);\n if(n>=m)\n {\n a=n;\n sum=n;\n while(a!=0)\n {\n b=a%m;\n a=a/m;\n if(a==0||a==1)\n {\n sum=sum+a;\n }\n else\n {\n sum=sum+a+b;\n }\n }\n }\n else\n {\n sum=n;\n }\n printf(\"%d\",sum);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,m,temp,k,sum=0,z,tot=0;\n scanf(\"%d%d\",&n,&m);\n temp=n;\n do{\n k=temp/m;\n if(k!=1){\n z=k%m;\n tot+=z;\n }\n sum+=k;\n temp=k;\n\n }\n while(temp!=0);\n printf(\"%d\\n\",n+sum+tot);\n return 0;\n}\n"}, {"source_code": "#include\nint main() {\n //就是新买的袜子,当天不能穿!\n //2 2\n //1 2 穿了一双,留有一双!\n //2 1 丢了一双,穿了一双,妈妈买了一双\n //3 0 没有穿的了,妈妈买的今天不能穿!\n //9 3\n //1 9 穿了一双,留有8双!\n //2 8 丢了一双,穿了一双,留有7双!\n //3 7 丢了一双,穿了一双,留有6双!买了一双\n //4 6 丢了一双,穿了一双,留有5双!+1\n //5 6 丢了一双,穿了一双,留有5双!新买的可以用了!\n //6 5 丢了一双,穿了一双,留有4双!买了一双\n //7 4 丢了一双,穿了一双,留有3双!+1\n //8 4 丢了一双,穿了一双,留有3双!新买的可以用了!\n //9 3 丢了一双,穿了一双,留有2双!买了一双\n //10 2 丢了一双,穿了一双,留有1双!+1\n //11 2 丢了一双,穿了一双,留有1双!可以用了\n //12 1 丢了一双,穿了一双,留有0双!买了一双!\n //13 0 丢了一双,穿了一双,留有1双!\n //整个模拟过程是细致,繁琐的!\n //通过了检测,但是中间过程和我的设想有不同!\n int n,m;\n scanf(\"%d%d\",&n,&m);\n\n int socks=n;\n int day=1;\n //printf(\"day %d: %d socks\\n\",day,socks);\n while(socks>0) {\n //printf(\"day %d: %d socks\\n\",day,socks);\n socks--;\n day++;\n //printf(\"day %d: %d socks\\n\",day,socks);\n if(day>=m && day%m==2) {\n socks++;\n }\n }\n if(n==1) {\n\t printf(\"%d\\n\",1);\n } else {\n\t printf(\"%d\\n\",day);\n }\n //这个版本和我的分析是一致的!\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int a,b,m;\n scanf(\"%d%d\",&a,&b);\n if(a\nint main()\n {\n int n,m,l,k,d,h;\n scanf(\"%d%d\",&n,&m);\n l=n/m;\n k=n%m;\n h=m*l+l+k;\n d=((l+k)/m)+((l+k)%m);\n l=0;\n while(d>=m)\n {\n h=h+d;\n d=d/m+d%m;\n l=1;\n }\n if(l==1)\n h=h+d;\n printf(\"%d\",h);\n return 0;\n }\n"}, {"source_code": "#include\nint main()\n{\n int n,m,i,k,l,s;\n scanf(\"%d %d\",&n,&m);\n i=n/m;\n l=i+n;\n k=l/m;\n s=n+k;\n printf(\"%d\",s);\n}\n"}, {"source_code": "#include\nint main()\n{\n int m,n,x,y;\n scanf(\"%d%d\",&n,&m);\n x=n;\n y=n;\n while(x!=0)\n {\n x=x/m;\n y=y+x;\n }\n printf(\"%d\\n\",y);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\nint n;\nint r;\nint m;\nscanf(\"%d%d\",&n,&m);\nif(n>m)\nr=n%m;\nif(r==0)\nn=n+(n/m)+1;\nelse\nn=n+(n/m);\nprintf(\"%d\",n);\nreturn 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n,m,temp=0;\n \n scanf(\"%d\",&n);\n scanf(\"%d\",&m);\n \n while(n>0)\n { \n if(n%m == 0)\n { \n temp+=n;\n n=n/m;\n }\n else\n {\n if((m-(n%m)) > n)\n {\n\ttemp+=n;\n\tprintf(\"%d \\n\",temp);\n\treturn 0;\n }\n if((m-(n%m)) == n)\t\n {\n\ttemp+=n;\n \tprintf(\"%d\\n\",temp);\n\treturn 0;\n }\n else{\n temp +=n;\t\n \tn = (n - (m-(n%m)))/m+1;\n }\n }\n }\t\n }\n"}, {"source_code": "#include\n\nint main(){\n\n int n,m,sum=0,i,l,p=0,h;\n \n scanf(\"%d %d\",&n,&m);\n \n if(n==99 && m==2) h=197;\n \n else {\n for(i=n;n>0;i++){\n sum=sum+n;\n \n l=n%m;\n n=n/m;\n \n p=p+l;\n // printf(\"%d \",l);\n \n }\n h=sum+p/m;\n // printf(\"%d \",p);\n }\n printf(\"%d\\n\",h);\n\n \n}"}, {"source_code": "#include\nint main()\n{\nint n,m,c=0;\nscanf(\"%d %d\",&n,&m);\nc=n;\nwhile(n>1)\n{\nc=c + n/m;\nn=n/m;}\nprintf(\"%d\",c);\nreturn 0;}"}, {"source_code": "#include\nint main()\n{\n int n,m,i,sum;\n scanf(\"%d%d\",&n,&m);\n sum = n;\n while(n>0)\n {\n sum+=(n/m);\n n/=m;\n }\n printf(\"%d\\n\",sum);\n return 0;\n}"}, {"source_code": "#include\nint main(){\n int l,n,i,j,a,b,m,c;\n scanf(\"%d %d\",&n,&m);\n a=n/m;\n if(a\nint main()\n{\n int n,m;\n scanf(\"%d %d\",&n,&m);\n if(n==2 && m==2)\n {\n printf(\"3\");\n }\n else if(n==1 && m==2)\n {\n printf(\"1\");\n }\n else\n {\n printf(\"%d\",(n+(n/m)+1));\n }\n}"}, {"source_code": "#include\nint main()\n{\n\tint m,n,i,j;\n\tscanf(\"%d %d\",&n,&m);\n\ti=n/m;\n\tj=i%m;\n\tif(i>=m){\n\t\t\n\ti=i+i-m;\n\ti++;\n}\n\tprintf(\"%d\\n\",n+j+i);\n\t\n\t\n\t\n\t\n\treturn 0;\n}"}, {"source_code": "#include \n#include \nint main()\n{\n int a,b,x,y;\n scanf(\"%d %d\",&a,&b);\n printf(\"%d\",(a+(a/b)+(a/b)/b));\n}\n\n\n\n\n"}, {"source_code": "#include\nint main()\n{\n\tint n,m;\n\tscanf(\"%d %d\",&n,&m);\n\tint ans=n+(n/m);\n\tif((m/n)%n==0)\n\tans++;\n\tprintf(\"%d\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int n,m,sum=0,set=0,count=0;\n int a,b;\n scanf(\"%d %d\",&n,&m);\n sum =n;\n a=n;\n while(1){\n a=a/m;\n if(a>1)\n set++;\n else\n break;\n }\n printf(\"%d\",sum+n/m+set*2);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int a,b,sum=0,x,y;\n scanf(\"%d%d\",&a,&b);\n x=a/b;\n y=a/b;\n while(x>=b)\n {\n x=x/b;\n sum=sum+x;\n }\n printf(\"%d\",(a+y+sum));\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,m,count,sum=0;\n scanf(\"%d %d\",&n,&m);\n if(n>=m)\n {\n count=n;\n while(count!=0)\n {\n count=count/m;\n sum=sum+count;\n }\n printf(\"%d\",n+sum);\n\n\n }\n else if(n\nint main ()\n{\nint n,m,x,y,z,s,a;\ns=0;\nscanf (\"%d %d\", &n,&m);\ns=s+n;\nx=(int)n/m;\ns=s+x;\nwhile(x >= m)\n{\ny=x*m;\nz=n-y;\nx=x+z;\nn=x;\nx=(int)x/m;\ns=s+x;\n}\nprintf (\"%d\\n\", s);\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,x,d,sum=0;\n scanf(\"%d %d\",&a,&b);\n x=a;\n while(x!=0)\n {\n x=x/b;\n sum=sum+x;\n }\n d=(a+sum)/b;\n printf(\"%d\",a+d);\n return 0;\n\n}\n"}], "src_uid": "42b25b7335ec01794fbb1d4086aa9dd0"} {"nl": {"description": "A sequence of integers $$$b_1, b_2, \\ldots, b_m$$$ is called good if $$$max(b_1, b_2, \\ldots, b_m) \\cdot min(b_1, b_2, \\ldots, b_m) \\ge b_1 + b_2 + \\ldots + b_m$$$.A sequence of integers $$$a_1, a_2, \\ldots, a_n$$$ is called perfect if every non-empty subsequence of $$$a$$$ is good.YouKn0wWho has two integers $$$n$$$ and $$$M$$$, $$$M$$$ is prime. Help him find the number, modulo $$$M$$$, of perfect sequences $$$a_1, a_2, \\ldots, a_n$$$ such that $$$1 \\le a_i \\le n + 1$$$ for each integer $$$i$$$ from $$$1$$$ to $$$n$$$.A sequence $$$d$$$ is a subsequence of a sequence $$$c$$$ if $$$d$$$ can be obtained from $$$c$$$ by deletion of several (possibly, zero or all) elements.", "input_spec": "The first and only line of the input contains two space-separated integers $$$n$$$ and $$$M$$$ ($$$1 \\le n \\le 200$$$; $$$10^8 \\le M \\le 10^9$$$). It is guaranteed that $$$M$$$ is prime.", "output_spec": "Print a single integer  — the number of perfect sequences modulo $$$M$$$.", "sample_inputs": ["2 998244353", "4 100000007", "69 999999937"], "sample_outputs": ["4", "32", "456886663"], "notes": "NoteIn the first test case, the perfect sequences are $$$[2, 2]$$$, $$$[2, 3]$$$, $$$[3, 2]$$$ and $$$[3, 3]$$$.In the second test case, some of the perfect sequences are $$$[3, 4, 3, 5]$$$, $$$[4, 5, 4, 4]$$$, $$$[4, 5, 5, 5]$$$ etc. One example of a sequence which is not perfect is $$$[2, 3, 3, 4]$$$, because, for example, the subsequence $$$[2, 3, 4]$$$ is not an good as $$$2 \\cdot 4 < 2 + 3 + 4$$$."}, "positive_code": [{"source_code": "// O(1) solution due to whatshisbucket\n#include \n#define ull unsigned long long\n\nconst unsigned ans[201][13] = {{},{2},{4},{11},{32},{97},{295},{940},{3148},{10901},{38324},{135313},{478989},{1704939},{6120951},{22187311},{81129556},{298715961},{1105546606},{4107686743},{2426959363,3},{1411039897,13},{4172194186,49},{3689174689,187},{43344991,708},{2441471173,2674},{2801489501,10124},{260107736,38400},{2954951606,145893},{606296452,555183},{1899297838,2115855},{3084773566,8075123},{234294028,30859921},{691111333,118085088},{2180959654,452401618},{1792754283,1735233324},{2132034018,2368089356,1},{1709961728,4137532123,5},{177031067,4063007484,22},{994451568,1625053238,88},{3917739273,3065624025,340},{1540443642,2939324613,1314},{2048043699,924465791,5077},{1535675300,4143681610,19623},{1508306498,2169966175,75908},{3628011891,3750388408,293847},{690756141,2273958850,1138333},{3186013409,1633929753,4412841},{3713415519,2737515922,17118132},{1580819397,2755090312,66446442},{3380663546,3219914187,258079131},{4204882545,2751845304,1002972229},{2671126449,3985320580,3900042842},{1549923635,2321666527,2288550180,3},{3206088422,3837458666,3229658027,13},{468076678,684189096,2394878431,53},{317846743,2409125435,2929850439,208},{2292706160,2431336997,2081275227,813},{3980228298,3870290811,2271141075,3172},{2281921514,2428712631,3857202388,12377},{1410084376,2665199272,1218646022,48313},{1725477252,938399815,2490820090,188650},{96934866,3021873877,4292106543,736911},{3976807065,4196403427,2309669478,2879607},{381043316,3742984064,581598293,11256562},{75998957,558211513,3386244876,44017760},{2481446098,3420110131,878568493,172184876},{2998084519,2760121094,3693315328,673755597},{1152419028,2385275115,2073185204,2637216508},{2854085154,4023337502,2033791001,1735803802,2},{923550706,4030810318,3175452562,1786539181,9},{971375603,1399426681,1063836258,3816608870,36},{2026326245,317960303,107930394,2395208751,144},{3032216567,1211669851,2768624282,2750243364,566},{962635926,2853748285,932538563,3069568420,2221},{929452190,980373970,1397224474,1107065389,8713},{3844112081,2178623972,365972575,3179860998,34180},{2309493692,3520537616,437394707,1605782278,134118},{2212877625,2922712134,95698419,3521874850,526378},{3552645532,3742906242,3849668270,299359034,2066376},{1938082639,329182225,3901861703,3461124247,8113696},{1135006092,3990987912,565559913,3870994863,31865765},{3496777998,2726710279,3456622192,1473857377,125176826},{726284190,554922189,1177992859,2941984575,491830434},{1174922238,3146728744,935205998,249307383,1932843670},{1927883506,2548886969,3104826080,2071924719,3302449968,1},{552744259,966302059,593280121,3357489715,4099236778,6},{4057737811,3172120154,3385034438,3377497541,1487985982,27},{1120930094,52594514,1676802786,854221959,2375555749,107},{1038179455,2469373338,1067790354,815292734,357146485,423},{3401792308,639953706,455471950,2389477057,2540495932,1664},{814342077,1190616845,1267241187,3067979529,1675977447,6550},{2621993594,2832313139,1127278177,3805827021,746798329,25781},{1714067937,4219985196,3969544797,136803453,2317603907,101487},{4152787624,3611142829,843196231,3916033443,3079218285,399572},{3461864546,3893743275,2900292828,1608204305,1869768837,1573441},{3003514123,3308980254,3534417324,1621178584,481241785,6196916},{2679664471,1996930534,318652848,2268304523,3541589603,24410101},{185152026,3138914840,1871119221,1559019881,2206013312,96168136},{3737829797,1320722003,1895671615,3178554427,3061812461,378930161},{203925008,3794021407,2579620510,3431217976,3019797624,1493317916},{2468134907,3475974877,3086405423,1142109993,4005905823,1590884110,1},{180449137,547269777,665325677,2842676501,2144395769,1727357320,5},{1617684553,878842739,3960341086,1281770673,1738535346,1282366575,21},{123339094,1072406502,1883229773,1124342891,720266287,4222745088,83},{3205877069,1493036374,4168832930,361101124,1207377007,869413080,331},{30245458,166380545,1871598255,2461437325,1132735956,1418272557,1306},{4075272123,2038959813,655609662,3492982470,3995427741,486078374,5153},{608326718,1107150586,1686622377,947478086,1489690413,1051457018,20330},{4136754916,2162103160,1723971343,3979622104,220587964,3441819447,80217},{2175296377,2687555805,2858485317,2068680116,2714338065,3815351148,316557},{941177009,2263937754,4286501999,592569842,2476199853,2077265316,1249363},{72166211,744371576,1452653805,2742004280,2576941298,3652970668,4931474},{3013494591,2372455071,534269120,1360461613,3759274278,3238915720,19467772},{508737026,2615515531,1184239988,3149494987,3669012804,3205495324,76861038},{4046190885,1049147236,347431385,615864993,3013055269,783975557,303491052},{895896758,1263297489,2129431640,4200962499,4253682392,2227802501,1198489786},{862593958,4076271219,471546334,831422713,3429802533,2758946637,438405932,1},{1558843359,3239232053,4200145856,1332916817,3018622542,3909986823,1516372374,4},{3604235363,2959047772,1884763672,3716891921,127819947,2316365163,841289782,17},{2148016453,2600462985,3400301264,3261250221,3339364795,3609467668,4019991120,67},{2057336361,3281406422,2001356007,305233474,2662253073,3418788389,1817744880,268},{1281508345,928813361,2816581598,2007723331,2740688108,4273224708,2920853098,1060},{3426260777,1763297880,1175966776,3062570720,731743090,2726359719,3082793264,4191},{3210960410,3752915728,459191299,128440564,2984187704,97991247,4030488828,16566},{224166267,2234372978,753139562,3865891512,1486162002,1307841019,3762849709,65483},{260505741,545447754,3027390222,3521038051,2886878098,3868240693,2774668015,258861},{3445525626,4221229308,1386534263,2297987493,4173116713,4207227667,4141018726,1023390},{4142247892,2446668656,2319675620,965790995,3309615310,2135638134,1728304023,4046274},{2796886765,2836129926,4105771002,1871082482,3736667518,147213948,2633468854,15999570},{445505098,42453983,2107373830,2161264577,3236071391,3845846548,2434224601,63270306},{3838187199,490614644,3657555088,4103603341,1344831810,990431249,3994847387,250224339},{1047857076,2176168119,682300933,1335570400,3705580851,2101545607,4139870456,989684043},{3026384570,2242942353,2616680991,3487926651,3956283706,1869088125,2484171217,3914717263},{1071498200,3773154979,1706585509,742961663,3077446206,215191244,2514290529,2601141681,3},{2872507125,1304608611,2805013961,3835527537,489570676,3914819730,1656827998,1135993546,14},{3155154964,780193390,2193623906,1209128819,1418105045,725432432,3669496663,1878768769,56},{253659020,3880096607,144011870,1507161628,1464179160,2378916704,1158684783,1341570611,223},{2212582435,445734981,3630891622,2426151389,3122490297,2334190077,1744231515,2896978552,883},{2142647548,3600176835,2830071678,2961075988,1714835724,2925612276,3820302557,339695552,3497},{4294886677,3361034647,906607836,1269791512,1220171111,1544351226,1002394444,2129097500,13840},{501822294,1725262855,3183461603,2954658854,2164388124,640674278,3687166976,244870596,54781},{810510306,323305484,3430675847,1333959229,3023582709,4122725661,4162215479,3998267249,216840},{2066497053,2791669159,1066700710,2401391628,2204319308,382832680,452636133,892117603,858388},{795280433,3187355406,2545609941,3296708892,338474730,3457915698,49592690,624245225,3398266},{1581357444,3332957275,3991329316,1823248956,3664649114,3049475936,1436313055,108314556,13454320},{2890310043,2645865047,96602101,1985398087,2830455143,2769232370,3231689536,3016839684,53271680},{3673691692,78846736,745302479,838402949,1165410335,1692653857,3976907779,1367965842,210940949},{295563602,975450609,3170861384,1205290655,658762743,4047422421,2054553,2367895997,835323744},{2508957223,2683160723,401608967,3574638073,2537772230,3214369508,3288302812,4058536503,3308093533},{3776557089,1460840502,3147310815,2456004160,3562408518,3775964939,3388939830,427668466,216849571,3},{3728035062,1926856823,1177012130,3575198692,2209903221,113586407,3333408737,3712521410,353438384,12},{2607331913,4283270230,3600202517,876899479,1796104827,817161666,294106662,2136843986,3686222256,47},{3314615494,2761020062,2280369741,3898619731,3911823627,1182841733,921495705,1987759554,2490255816,189},{2590245496,3473058917,1492013628,624914759,3628302063,1440754051,3417778275,1003682760,106726210,751},{2633783210,2706506985,3094738545,828125704,2671377987,626840589,3752738738,3900703516,1656794022,2975},{28448344,2669463898,1385628852,1136650614,2118617121,813824129,3389598254,193974302,2158698592,11788},{759262343,302349887,3002808773,3528037846,3942292190,2970558354,2489204802,2262249038,4058358874,46708},{3335417267,309921878,334820301,2461381894,3006674440,3130341194,1757099604,976305824,1192497803,185083},{1960107932,45317162,829795120,2938679609,1321490743,813033324,901851337,2388825974,3085146788,733431},{806769803,4249618887,2322214279,268106502,2400608845,3705101671,1006868560,1555518405,1473524019,2906546},{3016024504,2109541762,302478533,3002549037,3359936194,4230216640,1792321929,1405771399,3338048212,11519126},{405528202,3152747679,1869032290,1022171990,2330178010,2440852913,3340825247,2702598955,1813170149,45654784},{392072299,1470040061,1345165237,334840075,4161634659,3723030012,396217175,2217547197,4143434417,180957739},{1432108212,1114744425,1018959253,2618969148,4172016277,4104617249,229313722,1461796977,1676488993,717285187},{3917524871,829882129,3501994447,4017135301,3074069020,2694309690,2684793248,2587840425,3290780412,2843348555},{1944206482,1442962768,2769991002,137897471,3987464733,1155485997,2536824880,2998553209,2648147189,2681821845,2},{3344805947,411892603,4126656246,2211517675,2444913124,957967558,1038021382,4082245269,1767355398,1736798769,10},{3802521073,3267053531,1313646101,2324872666,878940337,3215631351,2931920803,4200923446,324319828,1073506513,41},{2654567614,1568808025,1803729542,2143384822,1658736425,192485054,1968155916,2580905691,2996803246,2366165782,163},{2560754697,2732109758,2650989258,3065464363,1119140648,1320459588,2818622314,274089733,1416601562,2113969709,648},{1429470319,2031880934,3023721394,1497346884,3095305271,698965458,2481352053,4125722246,3087616259,1941794290,2571},{1184856486,1823601604,2177114912,1188216408,321207596,4169904552,1298722721,2792835748,1750494046,137661912,10197},{593626344,3685718606,932835303,4281953533,3355177948,15176347,4132811439,1667095290,2027158372,348096588,40438},{2762201132,270311472,1739761745,3323556446,1688792644,4252294308,98283754,45888612,1013106595,4157530014,160371},{3538598781,1630328471,2324233659,2623719054,3542209653,833501619,3225441426,2426749849,342949796,919573965,636044},{618700117,1847361613,2568402629,3402135662,4069406530,3440726719,1961879249,1816107549,1163097643,861392142,2522707},{2616807824,290482935,4008503304,2827388725,3398823662,41448142,888703054,2313506850,1710980580,1436672924,10006146},{905330484,1850737061,1755710640,293093431,2890512416,1845155700,4293226377,1367354510,759724617,2153923292,39690547},{2000560120,887237321,1040273567,1259018161,97219236,4276904417,1725515412,2870030510,2879450930,3189702845,157444445},{863642990,954603462,536622170,3252710478,3940502922,1729125146,1554480730,1290181440,1973587814,248555840,624579026},{1697327337,2918819084,150398406,3763881191,2636440703,4265356736,2157835805,1468367803,3848765537,59446342,2477804464},{2446323117,1333533671,2168747137,2854032017,3081391650,4183505187,3650047026,188779407,526016429,2761793340,1240348821,2},{1300231750,3902915121,1981986679,3427190560,3237911263,3291691015,562702363,3149480449,2579229057,19020837,347055068,9},{3657932198,488720328,1446344547,3834564368,1480352990,2827046885,2880609475,697749222,2257195171,3354404202,127861599,36},{3397923977,2798002524,301001927,2304309288,1687826763,2483601671,1779363633,1352057091,713809587,2696685452,4127204450,142},{4028816566,2408052650,1213680384,4256359194,3002614222,1364230970,783390155,4126636361,832523803,2282722679,1171138251,567},{1736176841,397389969,1228600389,1516725449,2895163479,2150566846,2811167753,294595860,3564441822,1721701828,205228753,2251},{2429761274,984698965,4108659942,1199674335,293635739,625424232,948286406,3972991993,1611407721,1500862,4154934097,8932},{3222210919,690114320,50448257,2804373465,1017961958,2039183893,489159216,1151280382,158773765,2768634720,2995763167,35450},{375716695,3859193991,896415991,2993529817,3509832398,1871422233,1586062355,668318591,3165286699,495636988,3108898623,140692},{3085768643,3180394296,2124249810,1205857906,3158086867,3386222583,3793549621,3819173062,3911540842,1904718767,287398360,558388},{3435903375,4291098692,493489606,406838170,2190529579,2074994943,759798382,4196166923,3215154043,3785784988,2520590895,2216246},{3359148995,1436143251,1921872544,3037272504,3281484062,2051801502,1168216991,762202114,1408033153,2299479341,378749039,8796650},{2192988308,3067744296,1930751395,548234159,829700582,3436686196,2247851925,784563272,3717975929,908149877,1580872919,34916738},{3007043623,975843659,2616296461,3737306179,3684324109,3267538666,421308555,1472776780,1635862811,1071292237,1068791155,138601192},{2821316210,1748725430,2412011903,2527125975,948281510,391305600,772588344,3276862062,1944460202,2748703689,856637215,550195511},{4052977779,3163937748,3036712795,1138645612,501033727,4264799249,1380676331,3187355932,1832139079,645165555,1337462030,2184156409},{4201727360,2754890041,1042005963,1322883592,245155897,3538921510,886161692,1902765029,2170171535,1392634951,192228728,81019411,2},{1199257909,273544693,1994261149,3010295901,1839507415,77097517,1408801718,459303161,1544392329,3025296585,2726440504,64657343,8},{2102743037,2393063500,876912794,2198839926,3912872240,4095736174,2637471038,2384888107,503769424,4041934301,2348599738,3528755911,31}};\n\nint main () {\n int n, M;\n scanf(\"%d %d\", &n, &M);\n ull v = 0;\n for (int j = 12; j >= 0; j--) {\n v = (v<<32)|ans[n][j];\n v %= M;\n }\n printf(\"%lld\\n\", v);\n}\n"}, {"source_code": "// O(1) solution due to whatshisbucket\n#include \n#define ull unsigned long long\n\nconst unsigned ans[201][70] = {{},{2},{4},{11},{32},{97},{295},{940},{3148},{10901},{38324},{135313},{478989},{1704939},{6120951},{22187311},{81129556},{298715961},{1105546606},{4107686743},{2426959363,3},{1411039897,13},{4172194186,49},{3689174689,187},{43344991,708},{2441471173,2674},{2801489501,10124},{260107736,38400},{2954951606,145893},{606296452,555183},{1899297838,2115855},{3084773566,8075123},{234294028,30859921},{691111333,118085088},{2180959654,452401618},{1792754283,1735233324},{2132034018,2368089356,1},{1709961728,4137532123,5},{177031067,4063007484,22},{994451568,1625053238,88},{3917739273,3065624025,340},{1540443642,2939324613,1314},{2048043699,924465791,5077},{1535675300,4143681610,19623},{1508306498,2169966175,75908},{3628011891,3750388408,293847},{690756141,2273958850,1138333},{3186013409,1633929753,4412841},{3713415519,2737515922,17118132},{1580819397,2755090312,66446442},{3380663546,3219914187,258079131},{4204882545,2751845304,1002972229},{2671126449,3985320580,3900042842},{1549923635,2321666527,2288550180,3},{3206088422,3837458666,3229658027,13},{468076678,684189096,2394878431,53},{317846743,2409125435,2929850439,208},{2292706160,2431336997,2081275227,813},{3980228298,3870290811,2271141075,3172},{2281921514,2428712631,3857202388,12377},{1410084376,2665199272,1218646022,48313},{1725477252,938399815,2490820090,188650},{96934866,3021873877,4292106543,736911},{3976807065,4196403427,2309669478,2879607},{381043316,3742984064,581598293,11256562},{75998957,558211513,3386244876,44017760},{2481446098,3420110131,878568493,172184876},{2998084519,2760121094,3693315328,673755597},{1152419028,2385275115,2073185204,2637216508},{2854085154,4023337502,2033791001,1735803802,2},{923550706,4030810318,3175452562,1786539181,9},{971375603,1399426681,1063836258,3816608870,36},{2026326245,317960303,107930394,2395208751,144},{3032216567,1211669851,2768624282,2750243364,566},{962635926,2853748285,932538563,3069568420,2221},{929452190,980373970,1397224474,1107065389,8713},{3844112081,2178623972,365972575,3179860998,34180},{2309493692,3520537616,437394707,1605782278,134118},{2212877625,2922712134,95698419,3521874850,526378},{3552645532,3742906242,3849668270,299359034,2066376},{1938082639,329182225,3901861703,3461124247,8113696},{1135006092,3990987912,565559913,3870994863,31865765},{3496777998,2726710279,3456622192,1473857377,125176826},{726284190,554922189,1177992859,2941984575,491830434},{1174922238,3146728744,935205998,249307383,1932843670},{1927883506,2548886969,3104826080,2071924719,3302449968,1},{552744259,966302059,593280121,3357489715,4099236778,6},{4057737811,3172120154,3385034438,3377497541,1487985982,27},{1120930094,52594514,1676802786,854221959,2375555749,107},{1038179455,2469373338,1067790354,815292734,357146485,423},{3401792308,639953706,455471950,2389477057,2540495932,1664},{814342077,1190616845,1267241187,3067979529,1675977447,6550},{2621993594,2832313139,1127278177,3805827021,746798329,25781},{1714067937,4219985196,3969544797,136803453,2317603907,101487},{4152787624,3611142829,843196231,3916033443,3079218285,399572},{3461864546,3893743275,2900292828,1608204305,1869768837,1573441},{3003514123,3308980254,3534417324,1621178584,481241785,6196916},{2679664471,1996930534,318652848,2268304523,3541589603,24410101},{185152026,3138914840,1871119221,1559019881,2206013312,96168136},{3737829797,1320722003,1895671615,3178554427,3061812461,378930161},{203925008,3794021407,2579620510,3431217976,3019797624,1493317916},{2468134907,3475974877,3086405423,1142109993,4005905823,1590884110,1},{180449137,547269777,665325677,2842676501,2144395769,1727357320,5},{1617684553,878842739,3960341086,1281770673,1738535346,1282366575,21},{123339094,1072406502,1883229773,1124342891,720266287,4222745088,83},{3205877069,1493036374,4168832930,361101124,1207377007,869413080,331},{30245458,166380545,1871598255,2461437325,1132735956,1418272557,1306},{4075272123,2038959813,655609662,3492982470,3995427741,486078374,5153},{608326718,1107150586,1686622377,947478086,1489690413,1051457018,20330},{4136754916,2162103160,1723971343,3979622104,220587964,3441819447,80217},{2175296377,2687555805,2858485317,2068680116,2714338065,3815351148,316557},{941177009,2263937754,4286501999,592569842,2476199853,2077265316,1249363},{72166211,744371576,1452653805,2742004280,2576941298,3652970668,4931474},{3013494591,2372455071,534269120,1360461613,3759274278,3238915720,19467772},{508737026,2615515531,1184239988,3149494987,3669012804,3205495324,76861038},{4046190885,1049147236,347431385,615864993,3013055269,783975557,303491052},{895896758,1263297489,2129431640,4200962499,4253682392,2227802501,1198489786},{862593958,4076271219,471546334,831422713,3429802533,2758946637,438405932,1},{1558843359,3239232053,4200145856,1332916817,3018622542,3909986823,1516372374,4},{3604235363,2959047772,1884763672,3716891921,127819947,2316365163,841289782,17},{2148016453,2600462985,3400301264,3261250221,3339364795,3609467668,4019991120,67},{2057336361,3281406422,2001356007,305233474,2662253073,3418788389,1817744880,268},{1281508345,928813361,2816581598,2007723331,2740688108,4273224708,2920853098,1060},{3426260777,1763297880,1175966776,3062570720,731743090,2726359719,3082793264,4191},{3210960410,3752915728,459191299,128440564,2984187704,97991247,4030488828,16566},{224166267,2234372978,753139562,3865891512,1486162002,1307841019,3762849709,65483},{260505741,545447754,3027390222,3521038051,2886878098,3868240693,2774668015,258861},{3445525626,4221229308,1386534263,2297987493,4173116713,4207227667,4141018726,1023390},{4142247892,2446668656,2319675620,965790995,3309615310,2135638134,1728304023,4046274},{2796886765,2836129926,4105771002,1871082482,3736667518,147213948,2633468854,15999570},{445505098,42453983,2107373830,2161264577,3236071391,3845846548,2434224601,63270306},{3838187199,490614644,3657555088,4103603341,1344831810,990431249,3994847387,250224339},{1047857076,2176168119,682300933,1335570400,3705580851,2101545607,4139870456,989684043},{3026384570,2242942353,2616680991,3487926651,3956283706,1869088125,2484171217,3914717263},{1071498200,3773154979,1706585509,742961663,3077446206,215191244,2514290529,2601141681,3},{2872507125,1304608611,2805013961,3835527537,489570676,3914819730,1656827998,1135993546,14},{3155154964,780193390,2193623906,1209128819,1418105045,725432432,3669496663,1878768769,56},{253659020,3880096607,144011870,1507161628,1464179160,2378916704,1158684783,1341570611,223},{2212582435,445734981,3630891622,2426151389,3122490297,2334190077,1744231515,2896978552,883},{2142647548,3600176835,2830071678,2961075988,1714835724,2925612276,3820302557,339695552,3497},{4294886677,3361034647,906607836,1269791512,1220171111,1544351226,1002394444,2129097500,13840},{501822294,1725262855,3183461603,2954658854,2164388124,640674278,3687166976,244870596,54781},{810510306,323305484,3430675847,1333959229,3023582709,4122725661,4162215479,3998267249,216840},{2066497053,2791669159,1066700710,2401391628,2204319308,382832680,452636133,892117603,858388},{795280433,3187355406,2545609941,3296708892,338474730,3457915698,49592690,624245225,3398266},{1581357444,3332957275,3991329316,1823248956,3664649114,3049475936,1436313055,108314556,13454320},{2890310043,2645865047,96602101,1985398087,2830455143,2769232370,3231689536,3016839684,53271680},{3673691692,78846736,745302479,838402949,1165410335,1692653857,3976907779,1367965842,210940949},{295563602,975450609,3170861384,1205290655,658762743,4047422421,2054553,2367895997,835323744},{2508957223,2683160723,401608967,3574638073,2537772230,3214369508,3288302812,4058536503,3308093533},{3776557089,1460840502,3147310815,2456004160,3562408518,3775964939,3388939830,427668466,216849571,3},{3728035062,1926856823,1177012130,3575198692,2209903221,113586407,3333408737,3712521410,353438384,12},{2607331913,4283270230,3600202517,876899479,1796104827,817161666,294106662,2136843986,3686222256,47},{3314615494,2761020062,2280369741,3898619731,3911823627,1182841733,921495705,1987759554,2490255816,189},{2590245496,3473058917,1492013628,624914759,3628302063,1440754051,3417778275,1003682760,106726210,751},{2633783210,2706506985,3094738545,828125704,2671377987,626840589,3752738738,3900703516,1656794022,2975},{28448344,2669463898,1385628852,1136650614,2118617121,813824129,3389598254,193974302,2158698592,11788},{759262343,302349887,3002808773,3528037846,3942292190,2970558354,2489204802,2262249038,4058358874,46708},{3335417267,309921878,334820301,2461381894,3006674440,3130341194,1757099604,976305824,1192497803,185083},{1960107932,45317162,829795120,2938679609,1321490743,813033324,901851337,2388825974,3085146788,733431},{806769803,4249618887,2322214279,268106502,2400608845,3705101671,1006868560,1555518405,1473524019,2906546},{3016024504,2109541762,302478533,3002549037,3359936194,4230216640,1792321929,1405771399,3338048212,11519126},{405528202,3152747679,1869032290,1022171990,2330178010,2440852913,3340825247,2702598955,1813170149,45654784},{392072299,1470040061,1345165237,334840075,4161634659,3723030012,396217175,2217547197,4143434417,180957739},{1432108212,1114744425,1018959253,2618969148,4172016277,4104617249,229313722,1461796977,1676488993,717285187},{3917524871,829882129,3501994447,4017135301,3074069020,2694309690,2684793248,2587840425,3290780412,2843348555},{1944206482,1442962768,2769991002,137897471,3987464733,1155485997,2536824880,2998553209,2648147189,2681821845,2},{3344805947,411892603,4126656246,2211517675,2444913124,957967558,1038021382,4082245269,1767355398,1736798769,10},{3802521073,3267053531,1313646101,2324872666,878940337,3215631351,2931920803,4200923446,324319828,1073506513,41},{2654567614,1568808025,1803729542,2143384822,1658736425,192485054,1968155916,2580905691,2996803246,2366165782,163},{2560754697,2732109758,2650989258,3065464363,1119140648,1320459588,2818622314,274089733,1416601562,2113969709,648},{1429470319,2031880934,3023721394,1497346884,3095305271,698965458,2481352053,4125722246,3087616259,1941794290,2571},{1184856486,1823601604,2177114912,1188216408,321207596,4169904552,1298722721,2792835748,1750494046,137661912,10197},{593626344,3685718606,932835303,4281953533,3355177948,15176347,4132811439,1667095290,2027158372,348096588,40438},{2762201132,270311472,1739761745,3323556446,1688792644,4252294308,98283754,45888612,1013106595,4157530014,160371},{3538598781,1630328471,2324233659,2623719054,3542209653,833501619,3225441426,2426749849,342949796,919573965,636044},{618700117,1847361613,2568402629,3402135662,4069406530,3440726719,1961879249,1816107549,1163097643,861392142,2522707},{2616807824,290482935,4008503304,2827388725,3398823662,41448142,888703054,2313506850,1710980580,1436672924,10006146},{905330484,1850737061,1755710640,293093431,2890512416,1845155700,4293226377,1367354510,759724617,2153923292,39690547},{2000560120,887237321,1040273567,1259018161,97219236,4276904417,1725515412,2870030510,2879450930,3189702845,157444445},{863642990,954603462,536622170,3252710478,3940502922,1729125146,1554480730,1290181440,1973587814,248555840,624579026},{1697327337,2918819084,150398406,3763881191,2636440703,4265356736,2157835805,1468367803,3848765537,59446342,2477804464},{2446323117,1333533671,2168747137,2854032017,3081391650,4183505187,3650047026,188779407,526016429,2761793340,1240348821,2},{1300231750,3902915121,1981986679,3427190560,3237911263,3291691015,562702363,3149480449,2579229057,19020837,347055068,9},{3657932198,488720328,1446344547,3834564368,1480352990,2827046885,2880609475,697749222,2257195171,3354404202,127861599,36},{3397923977,2798002524,301001927,2304309288,1687826763,2483601671,1779363633,1352057091,713809587,2696685452,4127204450,142},{4028816566,2408052650,1213680384,4256359194,3002614222,1364230970,783390155,4126636361,832523803,2282722679,1171138251,567},{1736176841,397389969,1228600389,1516725449,2895163479,2150566846,2811167753,294595860,3564441822,1721701828,205228753,2251},{2429761274,984698965,4108659942,1199674335,293635739,625424232,948286406,3972991993,1611407721,1500862,4154934097,8932},{3222210919,690114320,50448257,2804373465,1017961958,2039183893,489159216,1151280382,158773765,2768634720,2995763167,35450},{375716695,3859193991,896415991,2993529817,3509832398,1871422233,1586062355,668318591,3165286699,495636988,3108898623,140692},{3085768643,3180394296,2124249810,1205857906,3158086867,3386222583,3793549621,3819173062,3911540842,1904718767,287398360,558388},{3435903375,4291098692,493489606,406838170,2190529579,2074994943,759798382,4196166923,3215154043,3785784988,2520590895,2216246},{3359148995,1436143251,1921872544,3037272504,3281484062,2051801502,1168216991,762202114,1408033153,2299479341,378749039,8796650},{2192988308,3067744296,1930751395,548234159,829700582,3436686196,2247851925,784563272,3717975929,908149877,1580872919,34916738},{3007043623,975843659,2616296461,3737306179,3684324109,3267538666,421308555,1472776780,1635862811,1071292237,1068791155,138601192},{2821316210,1748725430,2412011903,2527125975,948281510,391305600,772588344,3276862062,1944460202,2748703689,856637215,550195511},{4052977779,3163937748,3036712795,1138645612,501033727,4264799249,1380676331,3187355932,1832139079,645165555,1337462030,2184156409},{4201727360,2754890041,1042005963,1322883592,245155897,3538921510,886161692,1902765029,2170171535,1392634951,192228728,81019411,2},{1199257909,273544693,1994261149,3010295901,1839507415,77097517,1408801718,459303161,1544392329,3025296585,2726440504,64657343,8},{2102743037,2393063500,876912794,2198839926,3912872240,4095736174,2637471038,2384888107,503769424,4041934301,2348599738,3528755911,31}};\n\nint main () {\n int n, M;\n scanf(\"%d %d\", &n, &M);\n ull v = 0;\n for (int j = 69; j >= 0; j--) {\n v = (v<<32)|ans[n][j];\n v %= M;\n }\n printf(\"%lld\\n\", v);\n}\n"}, {"source_code": "#include \n#include \n\n#define N\t202\n\nint min(int a, int b) { return a < b ? a : b; }\nint max(int a, int b) { return a > b ? a : b; }\n\nint vv[N + 1], ff[N + 1], gg[N + 1];\n\nvoid init(int md) {\n\tint i;\n\n\tff[0] = gg[0] = 1;\n\tfor (i = 1; i <= N; i++) {\n\t\tvv[i] = i == 1 ? 1 : (long long) vv[i - md % i] * (md / i + 1) % md;\n\t\tff[i] = (long long) ff[i - 1] * i % md;\n\t\tgg[i] = (long long) gg[i - 1] * vv[i] % md;\n\t}\n}\n\nint main() {\n\tstatic int dp[N + 1][N + 1];\n\tint n, md, a, b, k, l, s, ans;\n\n\tscanf(\"%d%d\", &n, &md), init(md);\n\tans = 0;\n\tfor (a = 1; a <= n + 1; a++) {\n\t\tfor (k = 0; k <= n; k++)\n\t\t\tmemset(dp[k], 0, (a + 1) * sizeof *dp[k]);\n\t\tdp[0][0] = 1;\n\t\tfor (b = a; b <= n + 1; b++) {\n\t\t\tfor (k = n; k >= 0; k--)\n\t\t\t\tfor (s = 0; s + (n - k) * (b - a) <= a && s + k * a <= a * (b - 1); s++) {\n\t\t\t\t\tint x = dp[k][s], k_, s_, lower, upper;\n\n\t\t\t\t\tif (x == 0)\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t/* l >= 1\n\t\t\t\t\t * k + l <= n\n\t\t\t\t\t * s + l * (b - a) + (n - (k + l)) * (b + 1 - a) <= a\n\t\t\t\t\t * s + l * (b - a) + (k + l) * a <= a * b\n\t\t\t\t\t *\n\t\t\t\t\t * l >= 1\n\t\t\t\t\t * l <= n - k\n\t\t\t\t\t * l >= s + (n - k) * (b + 1 - a) - a\n\t\t\t\t\t * l <= (a * b - s - k * a) / b\n\t\t\t\t\t */\n\t\t\t\t\tlower = max(1, s + (n - k) * (b + 1 - a) - a);\n\t\t\t\t\tupper = min(n - k, (a * b - s - k * a) / b);\n\t\t\t\t\tfor (l = lower; l <= upper; l++) {\n\t\t\t\t\t\tk_ = k + l, s_ = s + l * (b - a);\n\t\t\t\t\t\tdp[k_][s_] = (dp[k_][s_] + (long long) dp[k][s] * gg[l]) % md;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tif (b == a)\n\t\t\t\tdp[0][0] = 0;\n\t\t}\n\t\tfor (s = 0; s <= a; s++)\n\t\t\tans = (ans + (long long) dp[n][s] * ff[n]) % md;\n\t}\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n"}], "negative_code": [{"source_code": "#include \n#include \n\n#define N\t200\n\nint min(int a, int b) { return a < b ? a : b; }\nint max(int a, int b) { return a > b ? a : b; }\n\nint vv[N + 1], ff[N + 1], gg[N + 1];\n\nvoid init(int md) {\n\tint i;\n\n\tff[0] = gg[0] = 1;\n\tfor (i = 1; i <= N; i++) {\n\t\tvv[i] = i == 1 ? 1 : (long long) vv[i - md % i] * (md / i + 1) % md;\n\t\tff[i] = (long long) ff[i - 1] * i % md;\n\t\tgg[i] = (long long) gg[i - 1] * vv[i] % md;\n\t}\n}\n\nint main() {\n\tstatic int dp[N + 1][N + 1];\n\tint n, md, a, b, k, l, s, ans;\n\n\tscanf(\"%d%d\", &n, &md), init(md);\n\tans = 0;\n\tfor (a = 1; a\t<= n + 1; a++) {\n\t\tfor (k = 0; k <= n; k++)\n\t\t\tmemset(dp[k], 0, (a + 1) * sizeof *dp[k]);\n\t\tdp[0][0] = 1;\n\t\tfor (b = a; b <= n + 1; b++) {\n\t\t\tfor (k = n; k >= 0; k--)\n\t\t\t\tfor (s = 0; s + (n - k) * (b - a) <= a && s + k * a <= a * (b - 1); s++) {\n\t\t\t\t\tint x = dp[k][s], k_, s_, lower, upper;\n\n\t\t\t\t\tif (x == 0)\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t/* l >= 1\n\t\t\t\t\t * k + l <= n\n\t\t\t\t\t * s + l * (b - a) + (n - (k + l)) * (b + 1 - a) <= a\n\t\t\t\t\t * s + l * (b - a) + (k + l) * a <= a * b\n\t\t\t\t\t *\n\t\t\t\t\t * l >= 1\n\t\t\t\t\t * l <= n - k\n\t\t\t\t\t * l >= s + (n - k) * (b + 1 - a) - a\n\t\t\t\t\t * l <= (a * b - s - k * a) / b\n\t\t\t\t\t */\n\t\t\t\t\tlower = max(1, s + (n - k) * (b + 1 - a) - a);\n\t\t\t\t\tupper = min(n - k, (a * b - s - k * a) / b);\n\t\t\t\t\tfor (l = lower; l <= upper; l++) {\n\t\t\t\t\t\tk_ = k + l, s_ = s + l * (b - a);\n\t\t\t\t\t\tdp[k_][s_] = (dp[k_][s_] + (long long) dp[k][s] * gg[l]) % md;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tif (b == a)\n\t\t\t\tdp[0][0] = 0;\n\t\t}\n\t\tfor (s = 0; s <= a; s++)\n\t\t\tans = (ans + (long long) dp[n][s] * ff[n]) % md;\n\t}\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n"}], "src_uid": "cf57508de47d80bc983861f70bb5f3d6"} {"nl": {"description": "On the Literature lesson Sergei noticed an awful injustice, it seems that some students are asked more often than others.Seating in the class looks like a rectangle, where n rows with m pupils in each. The teacher asks pupils in the following order: at first, she asks all pupils from the first row in the order of their seating, then she continues to ask pupils from the next row. If the teacher asked the last row, then the direction of the poll changes, it means that she asks the previous row. The order of asking the rows looks as follows: the 1-st row, the 2-nd row, ..., the n - 1-st row, the n-th row, the n - 1-st row, ..., the 2-nd row, the 1-st row, the 2-nd row, ...The order of asking of pupils on the same row is always the same: the 1-st pupil, the 2-nd pupil, ..., the m-th pupil.During the lesson the teacher managed to ask exactly k questions from pupils in order described above. Sergei seats on the x-th row, on the y-th place in the row. Sergei decided to prove to the teacher that pupils are asked irregularly, help him count three values: the maximum number of questions a particular pupil is asked, the minimum number of questions a particular pupil is asked, how many times the teacher asked Sergei. If there is only one row in the class, then the teacher always asks children from this row.", "input_spec": "The first and the only line contains five integers n, m, k, x and y (1 ≤ n, m ≤ 100, 1 ≤ k ≤ 1018, 1 ≤ x ≤ n, 1 ≤ y ≤ m).", "output_spec": "Print three integers: the maximum number of questions a particular pupil is asked, the minimum number of questions a particular pupil is asked, how many times the teacher asked Sergei. ", "sample_inputs": ["1 3 8 1 1", "4 2 9 4 2", "5 5 25 4 3", "100 100 1000000000000000000 100 100"], "sample_outputs": ["3 2 3", "2 1 1", "1 1 1", "101010101010101 50505050505051 50505050505051"], "notes": "NoteThe order of asking pupils in the first test: the pupil from the first row who seats at the first table, it means it is Sergei; the pupil from the first row who seats at the second table; the pupil from the first row who seats at the third table; the pupil from the first row who seats at the first table, it means it is Sergei; the pupil from the first row who seats at the second table; the pupil from the first row who seats at the third table; the pupil from the first row who seats at the first table, it means it is Sergei; the pupil from the first row who seats at the second table; The order of asking pupils in the second test: the pupil from the first row who seats at the first table; the pupil from the first row who seats at the second table; the pupil from the second row who seats at the first table; the pupil from the second row who seats at the second table; the pupil from the third row who seats at the first table; the pupil from the third row who seats at the second table; the pupil from the fourth row who seats at the first table; the pupil from the fourth row who seats at the second table, it means it is Sergei; the pupil from the third row who seats at the first table; "}, "positive_code": [{"source_code": "#include\nint turn(int x)\n{\n if(x==1) return 2;\n else return 1;\n}\nint main()\n{\n int m,n,x,y,flag=0;\n long long int k,row,rec,ans[102]={0},other[102]={0};\n long long int maxv=0,minv,ser;\n scanf(\"%d%d%lld%d%d\",&n,&m,&k,&x,&y);\n row=k/m;rec=k%m;\n if(n>2)\n {\n if(row>0)\n {\n long long int note=(row-1)/(n-1);\n int left=(row-1)%(n-1);\n ans[1]=note/2+1;\n if(note>0) ans[n]=(note-1)/2+1;\n for(int i=2;imaxv) maxv=tem;\n }\n minv=maxv;\n for(int i=1;i<=n;i++)\n if(ans[i]maxv)\n maxv=note[i][0]+note[i][1];\n minv=maxv;\n for(int i=1;i<3;i++)\n if(note[i][0]\n#include \n\nint64_t max(int64_t x, int64_t y)\n{\n if (x > y)\n return x;\n else\n return y;\n}\n\n#define div(a, b, c) ( ((a)-(b)-1) / (c) + ((b) < (a)))\n\nint64_t count(int64_t n, int64_t m, int64_t k, int64_t x, int64_t y)\n{\n if (n != 1) {\n if (x == 0 || x == n - 1)\n //return div(k - y - x*m, 2*(n-1)*m);\n return div(k, x*m+y, 2*(n-1)*m);\n else\n //return div(k - y - x*m, 2*(n-1)*m) + div(k - y - m*(2*n - 2 - x), 2*(n-1)*m);\n return div(k, x*m+y, 2*(n-1)*m) + div(k, (2*n-2-x)*m+y, 2*(n-1)*m);\n } else {\n //return div(k - y - x*m, n*m);\n return div(k, y, n*m);\n }\n}\n\nint\nmain()\n{\n int64_t n, m, k, x, y;\n scanf(\"%\"SCNd64\"%\"SCNd64\"%\"SCNd64\"%\"SCNd64\"%\"SCNd64, &n, &m, &k, &x, &y);\n x--; y--;\n if (n == 1)\n printf(\"%\"PRId64\" %\"PRId64\" %\"PRId64\"\\n\", \n count(n, m, k, 0, 0), \n count(n, m, k, 0, m-1), \n count(n, m, k, x, y));\n else\n printf(\"%\"PRId64\" %\"PRId64\" %\"PRId64\"\\n\", \n max(max(count(n, m, k, 0, 0), count(n, m, k, 1, 0)), count(n, m, k, n-2, 0)), \n -max(-count(n, m, k, 0, m-1), -count(n, m, k, n-1, m-1)), \n count(n, m, k, x, y));\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,m,x,y;\n long long int k,p,min,max,cur,g;\n scanf(\"%d %d %I64d %d %d\",&n,&m,&k,&x,&y);\n if(n==1)\n {\n p=k/m;\n g=k%(long long)m;\n min=p;\n if(g>0)\n max=p+1;\n else\n max=p;\n if(g>=y)\n cur=p+1;\n else\n cur=p;\n }\n else if(n==2)\n {\n p=k/((long long)m);\n g=k%((long long)m);\n if(p%2==0)\n {\n if(g>0)\n max=p/2+1;\n else\n max=p/2;\n min=p/2;\n if(x==1)\n {\n if(g>=y)\n cur=p/2+1;\n else\n cur=p/2;\n }\n else if(x==2)\n {\n cur=p/2;\n }\n }\n else\n {\n max=p/2+1;\n min=p/2;\n if(x==1)\n {\n cur=p/2+1;\n }\n else if(x==2)\n {\n if(g>=y)\n cur=p/2+1;\n else\n cur=p/2;\n }\n }\n }\n else\n {\n p=k/((long long)((n-1)*m));\n g=k%((long long)((n-1)*m));\n if(p==0)\n {\n max=1;\n min=0;\n if(g>=(x-1)*m+y)\n cur=1;\n else\n cur=0;\n }\n else if(p%2==0)\n {\n if(g>m)\n max=p+1;\n else\n max=p;\n min=p/2;\n if(x==1)\n {\n if(g>=y)\n cur=p/2+1;\n else\n cur=p/2;\n }\n else if(x==n)\n {\n if(g>=(n-1)*m+y)\n cur=p/2+1;\n else\n cur=p/2;\n }\n else\n {\n if(g>=(x-1)*m+y)\n cur=p+1;\n else\n cur=p;\n }\n }\n else\n {\n if(g>=m)\n min=p/2+1;\n else\n min=p/2;\n if(g>m)\n max=p+1;\n else\n max=p;\n if(x==1)\n {\n if(g>=(n-1)*m+y)\n cur=p/2+2;\n else\n cur=p/2+1;\n }\n else if(x==n)\n {\n if(g>=y)\n cur=p/2+1;\n else\n cur=p/2;\n }\n else\n {\n if(g>=(n-x)*m+y)\n cur=p+1;\n else\n cur=p;\n }\n }\n }\n printf(\"%I64d %I64d %I64d\",max,min,cur);\n}\n"}, {"source_code": "#include \n//using namespace std;\n\nint main() {\n\t//code\n\tint n,m,x1,y1;\n\tlong long int k;\n\tscanf(\"%d %d %lld %d %d\",&n,&m,&k,&x1,&y1);\n\tint t;\n\tif(n==1){\n\t t=m;\n\t}\n\telse{\n\tt=n*m+(n-2)*m;\n\t}\n\t\n\tlong long int x=k/t;\n\t//cout<0;i--){\n\t if(flag==1){\n\t break;\n\t }\n\t for(j=0;jmax){\n\t max=weight[i][j];\n\t }\n\t }\n\t}\n\tprintf(\"%lld %lld %lld\",max,min,weight[x1-1][y1-1]);\n\t\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\nint main() {\n uint16_t n, m, x, y;\n uint64_t k;\n scanf(\"%hu %hu %I64u %hu %hu\", &n, &m, &k, &x, &y);\n uint64_t t, seryo, mini, maxi;\n if (n == 1) {\n t = k / m;\n mini = t;\n k -= t * m;\n maxi = t + (k > 0);\n seryo = t + (k >= y);\n goto END;\n }\n if (n == 2) {\n t = k / (2 * m);\n mini = t;\n k -= t * 2 * m;\n maxi = t + (k > 0);\n seryo = t + (k >= (x - 1) * m + y);\n goto END;\n }\n t = k / ((n - 1) * m);\n k -= t * (n - 1) * m;\n uint64_t mid_row = t;\n uint64_t first_row = (t + 1) / 2;\n uint64_t last_row = t / 2;\n mini = last_row;\n maxi = (t == 0) ? (k > 0) : mid_row + (k > m);\n if (x == 1)\n seryo = first_row;\n else if (x == n)\n seryo = last_row;\n else\n seryo = mid_row;\n if (t % 2 == 0) /* then we start counting from first row */\n seryo += (k >= (x - 1) * m + y);\n else { \n mini += (k >= m);\n seryo += (k >= (n - x) * m + y);\n }\nEND:\n printf(\"%I64u %I64u %I64u\\n\", maxi, mini, seryo);\n return 0;\n}\n"}, {"source_code": "#include\nlong long k,round,min,max,val,tmp;\nint n,m,x,y,rem,tmpx,tmpy;//xΪ������yΪ���� \nint a[110][110];\nint main(){\n\tscanf(\"%d%d%lld%d%d\",&n,&m,&k,&x,&y);\n\tif(n>1){\n\t\tround=k/(m*(2*n-2));\n\t rem=k%(m*(2*n-2));\n\t int dir=1;\n\t tmpx=1;tmpy=1;\n\t while(rem>0){\n\t \ta[tmpx][tmpy]++;\n\t \trem--;\n\t \tif(tmpyn||tmpx+dir<1)dir=-dir;\n\t\t\t tmpx=tmpx+dir;\n\t\t\t tmpy=1;\n\t\t\t}\n\t\t}\n\t\tint i,j;\n\t\t\n\t\tmax=0;min=k;\n\t\tfor(i=1;i<=n;i++)\n\t\t for(j=1;j<=m;j++){\n\t\t \t if(i==1||i==n)tmp=round+a[i][j];\n\t\t \t else tmp=round*2+a[i][j];\n\t\t \t if(tmp>max)max=tmp;\n\t\t \t if(tmp0){\n\t\t\tmax=round+1;\n\t\t\tmin=round;\n\t\t\tif(rem>=y)val=round+1;\n\t\t\telse val=round;\t \n\t\t}\n\t\telse{\n\t\t\tmax=round;\n\t\t\tmin=round;\n\t\t\tval=round;\n\t\t}\n\t}\n\tprintf(\"%lld %lld %lld\",max,min,val);\n\treturn 0;\n} \n"}, {"source_code": "#include\n#include\ntypedef long long unsigned llu;\ntypedef unsigned u;\nllu C[111][111];\nint main()\n{\n\tu x,y,i,j,a,b,c,m;llu n,d,mx=0,mn=-1llu;\n\tscanf(\"%u%u%I64u%u%u\",&x,&y,&n,&i,&j);\n\ta=x*y;--i;--j;\n\tif(x>1)a+=(x-2)*y;\n\td=n/a;m=n%a;--x;\n\tfor(a=0;++aC[a][b])mn=C[a][b];\n\t}\n\tprintf(\"%I64u %I64u %I64u\\n\",mx,mn,C[i][j]);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint n,m,X,Y;\nlong long K;\n\nlong long ans[110][110];\n\nint main()\n{\n int i,j,t;\n long long mn = 1e18, mx = 0;\n \n scanf(\"%d%d%I64d%d%d\",&n,&m,&K,&X,&Y);\n t = (n > 1 ? (2*n-2)*m : m);\n for(i=2;i 0)\n ans[i][j]++, K--;\n for(i=n-1;i>1;i--) for(j=1;j<=m;j++) if(K > 0)\n ans[i][j]++, K--;\n \n for(i=1;i<=n;i++) for(j=1;j<=m;j++)\n {\n mn = (mn < ans[i][j] ? mn : ans[i][j]);\n mx = (mx > ans[i][j] ? mx : ans[i][j]);\n }\n printf(\"%I64d %I64d %I64d\",mx,mn,ans[X][Y]);\n return 0;\n}"}, {"source_code": "//今天晚上没有BUG!!!\n//今天晚上没有BUG!!!\n//今天晚上没有BUG!!!\n#include\n#include\n#include\n#include\nlong long a[105][105];\nint main()\n{\n int n,m,x,y;\n long long k;\n scanf(\"%d %d %lld %d %d\",&n,&m,&k,&x,&y);\n long long shang,yushu;\n int numb1=(n-1)*m;\n if (n==1)\n {\n shang=k/(n*m);\n yushu=k%(n*m);\n int mm,jj;\n for (mm=1;mm<=m;mm++)\n a[1][mm]=shang;\n for (mm=1;mm<=yushu;mm++)\n a[1][mm]++;\n long long maxx=0,minn=1000000000000000000;\n for (jj=1;jj<=m;jj++)\n {\n maxx=maxx>a[1][jj]? maxx:a[1][jj];\n minn=minn0&&(shang%2==0))//先后顺序\n {\n for (j=1;j<=m;j++)\n {\n if (yushu>0)\n {\n a[i][j]++;\n yushu--;\n }\n }\n i++;\n }\n i=n;\n while (yushu>0&&(shang%2!=0))//先后顺序\n {\n for (j=1;j<=m;j++)\n {\n if (yushu>0)\n {\n a[i][j]++;\n yushu--;\n }\n }\n i--;\n }\n long long maxx=0,minn=1000000000000000000;\n for (i=1;i<=n;i++)\n {\n for (j=1;j<=m;j++)\n {\n maxx=maxx>a[i][j]? maxx:a[i][j];\n minn=minn\n\n#define INF 100000000000000000L\n\ntypedef long long INT64;\n\nint main(void) {\n INT64 i = 0, j = 0, n = 0, m = 0, k = 0;\n INT64 x = 0, y = 0, arr[101] = {0, }, cnt = 0;\n INT64 serg = 0, max = 0, min = -1;\n \n scanf(\"%lld %lld %lld %lld %lld\", &n, &m, &k, &x, &y);\n INT64 q = k / m;\n INT64 r = k % m;\n if (n == 1) { \n if (y <= r) {\n serg = q + 1;\n } else {\n serg = q;\n }\n \n min = q;\n \n if (r == 0) {\n max = q;\n } else {\n max = q + 1;\n }\n } else {\n cnt = q / (2 * (n - 1));\n arr[1] = arr[n] = cnt;\n k -= (2 * (n - 1)) * cnt * m;\n for (i=2;i<=n-1;i++) {\n arr[i] = 2 * cnt;\n }\n \n for (i=1;i<=n;i++) {\n if (k < m) {\n break;\n }\n \n arr[i]++;\n k -= m;\n }\n \n if (i > n) {\n for (i=n-1;i>1;i--) {\n if (k < m) {\n break;\n }\n \n arr[i]++;\n k -= m;\n }\n }\n \n if (k != 0) {\n arr[i]++;\n }\n \n min = INF;\n \n for (j=1;j<=n;j++) {\n if (arr[j] > max) {\n max = arr[j];\n }\n \n if (arr[j] <= min) {\n if (j == i) {\n if (k == 0) {\n min = arr[j];\n } else {\n min = arr[j] - 1;\n }\n } else {\n min = arr[j];\n }\n }\n }\n \n if (x != i) {\n serg = arr[x];\n } else {\n if (k == 0 || y <= k) {\n serg = arr[i];\n } else {\n serg = arr[i] - 1;\n }\n }\n }\n\n printf(\"%lld %lld %lld\\n\", max, min, serg);\n \n return 0;\n}"}, {"source_code": "#include\n\nlong long int min(long long int a,long long int b)\n{\n if(ab)\n return a;\n\n else\n return b;\n}\n\nint main()\n{\n long long int questions,n,m,x,y,period,maximum,minimum,sergei_questions,last_x,last_y,remaining_questions,temp,j;\n\n scanf(\"%lld %lld %lld %lld %lld\",&n,&m,&questions,&x,&y);\n\n if(n==1 || n==2)\n {\n period=n*m;\n\n if(questions%period==0)\n printf(\"%lld %lld %lld\\n\",questions/period,questions/period,questions/period);\n\n else\n {\n maximum=questions/period+1;\n minimum=questions/period;\n\n last_x=(questions%period)/m;\n last_y=(questions%period)%m;\n\n if(last_y!=0)\n last_x++;\n\n else\n last_y=m;\n\n if(x0)\n {\n arr[i]++;\n temp=temp-m;\n i++;\n }\n }\n\n else\n {\n for(i=1;i0)\n {\n arr[i]++;\n temp=temp-m;\n i--;\n }\n }\n\n last_x=remaining_questions/m;\n last_y=remaining_questions%m;\n\n if(last_y!=0)\n last_x++;\n\n else\n last_y=m;\n\n if(last_x>n)\n last_x=2*n-last_x;\n\n minimum=arr[1];\n\n if(remaining_questionslast_y)\n sergei_questions--;\n\n printf(\"%lld %lld %lld\\n\",maximum,minimum,sergei_questions);\n\n }\n }\n\nreturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nlong long int k,i,j,max,min,S;\n\nint main()\n{\n int n,m,x,y;\n \n scanf(\"%d%d%lld%d%d\",&n,&m,&k,&x,&y);\n \n if(n*m > k)\n {\n max = 1;\n min = 0;\n if((x-1)*m+y <= k)S = 1;\n else S = 0;\n }\n else if(n <= 2)\n {\n min = k/(m*n);\n max = (k%(m*n) == 0)?min:min + 1;\n \n if(max == min)S = max;\n else\n {\n if(n == 1)\n {\n if(k%m >= y)S = max;\n else S = min;\n }\n else\n {\n j = k%(m*n);\n if(j > m)\n {\n if(x == 2 && j-m < y)S = min;\n else S = max;\n }\n else\n {\n if(x == 1 && j >= y)S = max;\n else S = min;\n }\n }\n }\n }\n else\n {\n i = k/(m*(2*n-2));\n j = k%(m*(2*n-2));\n max = i*2;\n min = i;\n if(j == 0)\n {\n if(x == 1 || x == n)S = min;\n else S = max;\n }\n else\n {\n if(j <= m)\n {\n if(x == 1)\n {\n if(y > j)S = min;\n else S = min+1;\n }\n else if(x == n)S = min;\n else S = max;\n }\n else if(j <= m*(n-1))\n {\n max++;\n if(x == 1)S = min+1;\n else if(x == n)S = min;\n else \n {\n if((x-1)*m+y <= j)S = max;\n else S = max-1;\n }\n }\n else if(j <= m*n)\n {\n max++;\n if(j == m*n)min++;\n if(x == 1)S = i+1;\n else if(x == n)\n {\n if(y <= j%m || j%m == 0)S = i+1;\n else S = i;\n }\n else S = max;\n }\n else\n {\n max+=2;\n min++;\n if(x == 1)S = i+1;\n else if(x == n)S = i+1;\n else\n {\n S = i*2+1;\n j-=m*n;\n if(j%m == 0)\n {\n if(x + j/m > (n-2))S++;\n }\n else\n {\n if(x + j/m > (n-1))S++;\n else if(x + j/m == (n-1))\n {\n if(j%m >= y||j%m == 0)S++;\n }\n }\n }\n }\n }\n }\n \n printf(\"%lld %lld %lld\\n\",max,min,S);\n}"}, {"source_code": "#include \n\nint n,m,X,Y;\nlong long K;\n\nlong long ans[210][110];\n\nint main()\n{\n int i,j,t;\n long long mn = 1e18, mx = 0;\n \n scanf(\"%d%d%I64d%d%d\",&n,&m,&K,&X,&Y);\n if(n == 1)\n {\n t = m;\n for(j=1;j<=m;j++) ans[1][j] = K/t;\n }\n else\n {\n t = (2*n-2)*m;\n for(i=2*n-2;i;i--) for(j=1;j<=m;j++) ans[i][j] = K/t;\n }\n K %= t;\n \n for(i=1;K>0;i++) for(j=1;j<=m && K>0;j++)\n ans[i][j]++, K--;\n for(i=2;i ans[i][j] ? mx : ans[i][j]);\n }\n printf(\"%I64d %I64d %I64d\",mx,mn,ans[X][Y]);\n return 0;\n}"}, {"source_code": "#include \n\nint n, m;\n\nlong long count(int x, int y, long long k) {\n\tlong long z;\n\n\tif (n <= 2) {\n\t\tz = k / (n * m);\n\t\tk %= n * m;\n\t\tif ((x - 1) * m + y <= k)\n\t\t\tz++;\n\t} else {\n\t\tz = k / ((n + n - 2) * m);\n\t\tif (x > 1 && x < n)\n\t\t\tz *= 2;\n\t\tk %= (n + n - 2) * m;\n\t\tif ((x - 1) * m + y <= k)\n\t\t\tz++;\n\t\tif (x > 1 && x < n && (n - 1 - x) * m + y <= k - n * m)\n\t\t\tz++;\n\t}\n\treturn z;\n}\n\nlong long max2(long long a, long long b) {\n\treturn a > b ? a : b;\n}\n\nlong long min2(long long a, long long b) {\n\treturn a < b ? a : b;\n}\n\nint main() {\n\tint x, y;\n\tlong long k, max, min, ser;\n\n\tscanf(\"%d%d%lld%d%d\", &n, &m, &k, &x, &y);\n\tmax = n <= 2 ? count(1, 1, k) : max2(max2(count(1, 1, k), count(2, 1, k)), max2(count(n - 1, 1, k), count(n, 1, k)));\n\tmin = n <= 2 ? count(n, m, k) : min2(min2(count(1, m, k), count(2, m, k)), min2(count(n - 1, m, k), count(n, m, k)));\n\tser = count(x, y, k);\n\tprintf(\"%lld %lld %lld\\n\", max, min, ser);\n\treturn 0;\n}\n"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include \n#define dll unsigned long long\n\n#define SIZE 105\n\nint n, m, x, y;\ndll k, ans[SIZE][SIZE];\n\nint main()\n{\n\tint i, j;\n\tdll max = 0, min = 18446744073709551615, full_come, total_comes;\n\n\tscanf(\"%d %d %I64u %d %d\", &n, &m, &k, &x, &y);\n\n\tfull_come = n * m;\n\tif (n > 2)\n\t\tfull_come += (n - 2) * m;\n\n\ttotal_comes = k / full_come;\n\n\tk %= full_come;\n\n\tfor (i = 0; i < n; i++)\n\t\tfor (j = 0; j < m; j++)\n\t\t{\n\t\t\tans[i][j] += total_comes;\n\t\t\tif (i > 0 && i < n - 1)\n\t\t\t\tans[i][j] += total_comes;\n\t\t}\n\n\n\tfor (i = 0; k > 0 && i < n; i++)\n\t\tfor (j = 0; j < m && k > 0; j++)\n\t\t{\n\t\t\tans[i][j]++;\n\t\t\tk--;\n\t\t}\n\n\tfor (i = n - 2; k > 0 && i > 0; i--)\n\t\tfor (j = 0; j < m && k > 0; j++)\n\t\t{\n\t\t\tans[i][j]++;\n\t\t\tk--;\n\t\t}\n\n\tfor (i = 0; i < n; i++)\n\t\tfor (j = 0; j < m; j++)\n\t\t{\n\t\t\tif (ans[i][j] > max)\n\t\t\t\tmax = ans[i][j];\n\t\t\tif (ans[i][j] < min)\n\t\t\t\tmin = ans[i][j];\n\t\t}\n\n\n\n\tprintf(\"%I64u %I64u %I64u\", max, min, ans[x - 1][y - 1]);\n\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nint main(){\n\tint n,m,x,y;\n\tlong long int k;\n\tscanf(\"%d %d %I64d %d %d\",&n,&m,&k,&x,&y);\n\t\n\tlong long int max=0,min=k;\n\tlong long int asked_cnt[n][m];\n\tint i,j;\n\t\n\tif(n==1){\n\t\tfor(j=0;j0;j++){\n\t\t\tasked_cnt[0][j]++;\n\t\t\tk--;\n\t\t}\n\t}else{\n\t\n\tlong long int fullAsked = k / (m*(2*n-2));\n\t\n\t\n\tfor(i=0;i0;i++){\n\t\tfor(j=0;j0;j++){\n\t\t\tasked_cnt[i][j]++;\n\t\t\tk--;\n\t\t}\n\t}\n\t\n\tfor(i=n-2;i>0 && k>0 ;i--){\n\t\tfor(j=0;j0;j++){\n\t\t\tasked_cnt[i][j]++;\n\t\t\tk--;\n\t\t}\n\t}\n\t}\n\t\n\tfor(i=0;imax){\n\t\t\t\tmax=asked_cnt[i][j];\n\t\t\t}\n\t\t\tif(asked_cnt[i][j]\nint main()\n{\n int n,m,x,y;\n long long int k,p,min,max,cur,g;\n scanf(\"%d %d %I64d %d %d\",&n,&m,&k,&x,&y);\n if(n==1)\n {\n p=k/m;\n g=k%(long long)m;\n min=p;\n if(g>0)\n max=p+1;\n else\n max=p;\n if(g>=y)\n cur=p+1;\n else\n cur=p;\n }\n else if(n==2)\n {\n p=k/((long long)m);\n g=k%((long long)m);\n if(p%2==0)\n {\n if(g>0)\n max=p/2+1;\n else\n max=p/2;\n min=p/2;\n if(x==1)\n {\n if(g>=y)\n cur=p/2+1;\n else\n cur=p/2;\n }\n else if(x==2)\n {\n cur=p/2;\n }\n }\n else\n {\n max=p/2+1;\n min=p/2;\n if(x==1)\n {\n cur=p/2+1;\n }\n else if(x==2)\n {\n if(g>=y)\n cur=p/2+1;\n else\n cur=p/2;\n }\n }\n }\n else\n {\n p=k/((long long)((n-1)*m));\n g=k%((long long)((n-1)*m));\n if(p==0)\n {\n max=1;\n min=0;\n if(g>=(x-1)*m+y)\n cur=1;\n else\n cur=0;\n }\n else if(p%2==0)\n {\n if(g>m)\n max=p+1;\n else\n max=p;\n min=p/2;\n if(x==1)\n {\n if(g>=y)\n cur=p/2+1;\n else\n cur=p/2;\n }\n else if(x==n)\n {\n if(g>=(n-1)*m+y)\n cur=p/2+1;\n else\n cur=p/2;\n }\n else\n {\n if(g>=(x-1)*m+y)\n cur=p+1;\n else\n cur=p;\n }\n }\n else\n {\n if(g>=m)\n min=p/2+1;\n else\n min=p/2;\n if(g>m)\n max=p+1;\n else\n max=p;\n if(x==1)\n {\n if(g>=(n-1)*m+y)\n cur=p/2+2;\n else\n cur=p/2+1;\n }\n else if(x==n)\n {\n if(g>=y)\n cur=p/2+1;\n else\n cur=p/2;\n }\n else\n {\n if(g>=(n-x)*m+y)\n cur=p+1;\n else\n cur=p;\n }\n }\n }\n printf(\"%I64d %I64d %I64d\",max,min,cur);\n}\n"}, {"source_code": "#include\n#include\n#include\n\nint main()\n{\n long long j,i,count,n,m,k,x,y,a[110]={0},ans,max,min;\n scanf(\"%lld%lld%lld%lld%lld\",&n,&m,&k,&x,&y);\n if(n==1)\n {\n if(y<=k%m)\n ans=k/m+1;\n else\n ans=k/m;\n if(k%m!=0)\n printf(\"%lld %lld %lld\\n\",k/m+1,k/m,ans);\n else\n printf(\"%lld %lld %lld\\n\",k/m,k/m,k/m);\n return 0;\n }\n count=((k/m)/(2*n-2));\n a[1]=count;\n a[n]=count;\n k=k-(2*n-2)*count*m;\n for(i=2;i<=n-1;i++)\n a[i]=2*count;\n for(i=1;i<=n;i++)\n {\n if(k1;i--)\n {\n if(k=max)\n max=a[i];\n if(a[i]<=min)\n {\n if(i==j)\n {\n if(k==0)\n min=a[i];\n else\n min=a[i]-1;\n }\n else\n min=a[i];\n }\n }\n if(x!=j)\n ans=a[x];\n else\n {\n if(k==0)\n ans=a[j];\n else if(y<=k)\n ans=a[j];\n else\n ans=a[j]-1;\n }\n printf(\"%lld %lld %lld\\n\",max,min,ans);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\nint main()\n{\n long long j,i,count,n,m,k,x,y,a[110]={0},ans,max,min;\n scanf(\"%lld%lld%lld%lld%lld\",&n,&m,&k,&x,&y);\n if(n==1)\n {\n if(y<=k%m)\n ans=k/m+1;\n else\n ans=k/m;\n if(k%m!=0)\n printf(\"%lld %lld %lld\\n\",k/m+1,k/m,ans);\n else\n printf(\"%lld %lld %lld\\n\",k/m,k/m,k/m);\n return 0;\n }\n\n count=((k/m)/(2*n-2));\n a[1]=count;\n a[n]=count;\n k=k-(2*n-2)*count*m;\n for(i=2;i<=n-1;i++)\n a[i]=2*count;\n for(i=1;i<=n;i++)\n {\n if(k1;i--)\n {\n if(k=max)\n max=a[i];\n if(a[i]<=min)\n {\n if(i==j)\n {\n if(k==0)\n min=a[i];\n else\n min=a[i]-1;\n }\n else\n min=a[i];\n }\n }\n if(x!=j)\n ans=a[x];\n else\n {\n if(k==0)\n ans=a[j];\n else if(y<=k)\n ans=a[j];\n else\n ans=a[j]-1;\n }\n printf(\"%lld %lld %lld\\n\",max,min,ans);\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \n\n#define MAX 1000010\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nlong long len, n, m, k, x, y;\nlong long X[MAX], Y[MAX], counter[1010][1010];\n\nint main(){\n long long i, j, v, min_v, max_v;\n\n while (scanf(\"%lld %lld %lld %lld %lld\", &n, &m, &k, &x, &y) != EOF){\n len = 0;\n clr(counter);\n for (i = 1; i < n; i++){\n for (j = 1; j <= m; j++){\n X[len] = i, Y[len++] = j;\n }\n }\n for (i = n; i > 1; i--){\n for (j = 1; j <= m; j++){\n X[len] = i, Y[len++] = j;\n }\n }\n\n if (n == 1){\n for (i = 1; i <= m; i++) X[len] = 1, Y[len++] = i;\n }\n\n for (i = 0; i < len; i++) counter[X[i]][Y[i]] += (k / len);\n k %= len;\n for (i = 0; i < k; i++) counter[X[i]][Y[i]]++;\n\n min_v = max_v = counter[1][1];\n for (i = 1; i <= n; i++){\n for (j = 1; j <= m; j++){\n if (counter[i][j] < min_v) min_v = counter[i][j];\n if (counter[i][j] > max_v) max_v = counter[i][j];\n }\n }\n\n printf(\"%lld %lld %lld\\n\", max_v, min_v, counter[x][y]);\n }\n return 0;\n}\n"}, {"source_code": "#include\nlong long a[200][200];\nint main()\n{\n long long n, m, k, x, y, i, j, p, ma=0, mi=9.223372e+18;\n scanf(\"%I64d %I64d %I64d %I64d %I64d\", &n, &m, &k, &x, &y);\n p=(2*n-2)*m; if(!p) p=m;\n for(i=1; i<=n; i++) {\n for(j=1; j<=m; j++) {\n if(i==1 || i==n) a[i][j]=k/p;\n else a[i][j]=k/p*2;\n }\n }\n k%=p;\n i=j=1;\n int kk=1;\n while(k) {\n a[i][j]++;\n if(i==n && j==m) kk=-kk;\n j++; k--;\n if(j>m) j=1, i+=kk;\n }\n for(i=1; i<=n; i++) {\n for(j=1; j<=m; j++) {\n if(maa[i][j]) mi=a[i][j];\n }\n }\n printf(\"%I64d %I64d %I64d\", ma, mi, a[x][y]);\n}\n"}, {"source_code": "#include \nint main()\n{\n int m,n,x,y;\n long long int k,min=0,max=0,q=0;\n scanf(\"%d %d %lld %d %d\",&n,&m,&k,&x,&y);\n if(n==1)\n {\n min=k/m;\n k%=m;\n max=min;\n q=max;\n if(k)\n {\n ++max;\n if(k>=y)\n {\n ++q;\n }\n }\n }\n else if(n==2)\n {\n min=k/(2*m);\n k%=(2*m);\n max=min;\n q=max;\n if(k)\n {\n ++max;\n if(k>=((x-1)*m)+y)\n {\n ++q;\n }\n }\n }\n else\n {\n min=k/((m*n)+(m*(n-2)));\n max=2*min;\n k%=((m*n)+(m*(n-2)));\n if(x==n ||x==1)\n {\n q=min;\n }\n else\n {\n q=max;\n }\n if(k)\n {\n if(k<=m && min==0)\n {\n ++max;\n }\n if(k>m && km*n)\n {\n max+=2;\n ++min;\n }\n if(x==1)\n {\n if(k>=y)\n {\n ++q;\n }\n }\n else if(x==n)\n {\n if(k>=(m*(n-1))+y)\n {\n ++q;\n }\n }\n else\n {\n if(k>=(m*(x-1))+y)\n {\n ++q;\n k-=(m*(x-1))+y;\n if(k>=(2*m*(n-x)))\n {\n ++q;\n }\n }\n }\n }\n }\n printf(\"%lld %lld %lld\",max,min,q);\n return 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n\tlong long n,m,x,y,a; \n\tlong long k;\n scanf(\"%I64d %I64d %I64d %I64d %I64d\",&n,&m,&k,&x,&y);\n a=n*m+(n-2)*m;\n long long sb1,sb2;\n long long s,h;\n if(n<3)\n {\n \ts=k/(n*m);\n \th=k%(n*m);\n \tsb1=(x-1)*m+y;\n \tsb2=(n-x)*m+y;\n \tif(h==0)\n \tprintf(\"%I64d %I64d %I64d\",s,s,s);\n \telse if(h>=sb1)\n \tprintf(\"%I64d %I64d %I64d\",s+1,s,s+1);\n \telse if(h=sb1)\n \t\tprintf(\"%I64d %I64d %I64d\",s+1,s,s+1);\n \t\telse\n \t\tprintf(\"%I64d %I64d %I64d\",s+1,s,s);\n\t\t}\n\t\telse if(s%2==1)\n\t\t{\n\t\t if(h>=sb2)\n \t \tprintf(\"%I64d %I64d %I64d\",s+1,s,s+1);\n \t\telse\n \t\tprintf(\"%I64d %I64d %I64d\",s+1,s,s);\n\t\t} */\n\t}\n else\n {\n \tsb1=(x-1)*m+y;\n sb2=(n-x-1)*m+y;\n s=k/a,h=k%a;\n if(s!=0)\n {\n if(x==1||x==n)\n {\n \tif(h==0)\n printf(\"%I64d %I64d %I64d\",2*s,s,s);\n else if(x==1)\n {\n \tif(h=y&&h<=m)\n \tprintf(\"%I64d %I64d %I64d\",2*s,s,s+1);\n \telse if(h>=y&&hn*m)\n printf(\"%I64d %I64d %I64d\",2*s+2,s+1,s+1);\n\t\t}\n\t\telse if(x==n)\n\t\t{\n\t\t\tif(h<=m)\n\t\t\tprintf(\"%I64d %I64d %I64d\",2*s,s,s);\n\t\t\telse if(h<(n-1)*m+y)\n\t\t\tprintf(\"%I64d %I64d %I64d\",2*s+1,s,s);\n\t\t\telse if(h>=(n-1)*m+y&&hn*m)\n printf(\"%I64d %I64d %I64d\",2*s+2,s+1,s+1);\n\t\t}\n\t}\n\telse\n\t{\n if(h==0)\n printf(\"%I64d %I64d %I64d\",2*s,s,2*s);\n else if(h==n*m)\n printf(\"%I64d %I64d %I64d\",2*s+1,s+1,2*s+1);\n else if(hm&&h=sb1)\n \t printf(\"%I64d %I64d %I64d\",2*s+1,s,2*s+1);\n }\n else if(h>n*m)\n {\n \th=h-n*m;\n \tif(h=sb2)\n \t printf(\"%I64d %I64d %I64d\",2*s+2,s+1,2*s+2);\n }\n }\n }\n else\n {\n \tif(h==0)\n \tprintf(\"0 0 0\");\n \tif(h==n*m)\n \tprintf(\"1 1 1\");\n //\tif(n>=3)\n //\t{\n \telse if(x==1||x==n)\n \t{\n \t\tif(x==1)\n \t\t{\n \t\t\tif(h=y&&hn*m)\n \t\t\tprintf(\"2 1 1\");\n \t\t\t\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(h<(n-1)*m+y)\n\t\t\t\tprintf(\"1 0 0\");\n\t\t\t\telse if(h>=(n-1)*m+y&&hn*m)\n\t\t\t\tprintf(\"2 1 1\");\n\t\t\t}\n\t\t}\n \telse if(h>n*m&&(h-n*m)<(n-x-1)*m+y)\n \tprintf(\"2 1 1\");\n\t\telse if(h>n*m&&(h-n*m)>=(n-x-1)*m+y)\n \tprintf(\"2 1 2\");\n \telse if(h=(x-1)*m+y)\n \tprintf(\"1 0 1\");\n \telse if(h<(x-1)*m+y)\n \tprintf(\"1 0 0\");\n // }\n //else//n<3\n //{\n \t\n\t\t//}\n\t}\n }\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long n,m,ans,f,x,y,max=1,min=0,sergei=0;\n scanf(\"%lld %lld %lld %lld %lld\",&n,&m,&f,&x,&y);\n if(n==1){\n max = f/(m); min = max; sergei = max;\n if(f%m!=0){\n max++; if(y <= (f%m))sergei ++;\n }\n printf(\"%lld %lld %lld\\n\",max, min, sergei);\n }\n else{\n if(f<=(n*m)){\n if(f == (n*m))\n min = 1;\n if(f>=((x-1)*m + y))\n sergei = 1;\n printf(\"%lld %lld %lld\\n\",max, min, sergei);\n }\n\n else{\n\n f -= n*m;\n if(((f/((n-1)*m))%2)==0){\n min = (f/((n-1)*m))/2 + 1;\n if(n==2)\n max = min;\n else\n max = (f/((n-1)*m)) + 1;\n if((x==1)||(x==n))\n sergei = min;\n else\n sergei = max;\n if((f%((n-1)*m))!=0){\n max ++;\n if(((f%((n-1)*m))>=((n - x - 1)*m + y))&&(x!=n))\n sergei++;\n }\n }\n\n else{\n min = (f/((n-1)*m))/2 + 1;\n max = (f/((n-1)*m)) + 1;\n if(n == 2)\n max = (f/((n-1)*m)) - (f/((n-1)*m))/2 + 1;\n if(x == 1)\n sergei = (f/((n-1)*m)) - (f/((n-1)*m))/2 + 1;\n else if(x == n)\n sergei = min;\n else\n sergei = max;\n if((f%((n-1)*m))!=0){\n if(n!=2)\n max++;\n if(((f%((n-1)*m))>=((x - 2)*m + y))&&(x!=1))\n sergei++;\n }\n }\n printf(\"%lld %lld %lld\\n\",max, min, sergei);\n }\n }\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include\nint turn(int x)\n{\n if(x==1) return 2;\n else return 1;\n}\nint main()\n{\n int m,n,x,y,flag=0;\n long long int k,row,rec,ans[102]={0},other[102]={0};\n long long int maxv=0,minv,ser;\n scanf(\"%d%d%lld%d%d\",&n,&m,&k,&x,&y);\n row=k/m;rec=k%m;\n if(n>2)\n {\n long long int note=(row-1)/(n-1);\n int left=(row-1)%(n-1);\n if(note>0) ans[1]=note/2+1;\n if(note>0) ans[n]=(note-1)/2+1;\n for(int i=2;imaxv) maxv=tem;\n }\n minv=maxv;\n for(int i=1;i<=n;i++)\n if(ans[i]maxv)\n maxv=note[i][0]+note[i][1];\n minv=maxv;\n for(int i=1;i<3;i++)\n if(note[i][0]\nint turn(int x)\n{\n if(x==1) return 2;\n else return 1;\n}\nint main()\n{\n int m,n,x,y,flag=0;\n long long int k,row,rec,ans[102]={0},other[102]={0};\n long long int maxv=0,minv,ser;\n scanf(\"%d%d%lld%d%d\",&n,&m,&k,&x,&y);\n row=k/m;rec=k%m;\n if(n>2)\n {\n if(row>0)\n {\n long long int note=(row-1)/(n-1);\n int left=(row-1)%(n-1);\n if(note>0) ans[1]=note/2+1;\n if(note>0) ans[n]=(note-1)/2+1;\n for(int i=2;imaxv) maxv=tem;\n }\n minv=maxv;\n for(int i=1;i<=n;i++)\n if(ans[i]maxv)\n maxv=note[i][0]+note[i][1];\n minv=maxv;\n for(int i=1;i<3;i++)\n if(note[i][0]\nint turn(int x)\n{\n if(x==1) return 2;\n else return 1;\n}\nint main()\n{\n int m,n,x,y,flag=0;\n long long int k,row,ans[102]={0},other[102]={0},rec;\n long long int maxv=0,minv,ser;\n scanf(\"%d%d%lld%d%d\",&n,&m,&k,&x,&y);\n row=k/m;rec=k%m;\n if(n>2)\n {\n long long int note=(row-1)/(n-1);\n int left=(row-1)%(n-1);\n ans[1]=note/2+1;\n ans[n]=(note-1)/2+1;\n for(int i=2;imaxv) maxv=tem;\n }\n minv=maxv;\n for(int i=1;i<=n;i++)\n if(ans[i]maxv)\n maxv=note[i][0]+note[i][1];\n minv=maxv;\n for(int i=1;i<3;i++)\n if(note[i][0]\nint turn(int x)\n{\n if(x==1) return 2;\n else return 1;\n}\nint main()\n{\n int m,n,x,y,flag=0;\n long long int k,row,ans[102]={0},other[102]={0},rec;\n long long int maxv=0,minv,ser;\n scanf(\"%d%d%lld%d%d\",&n,&m,&k,&x,&y);\n row=k/m;rec=k%m;\n if(n>2)\n {\n long long int note=(row-1)/(n-1);\n int left=(row-1)%(n-1);\n ans[1]=note/2+1;\n ans[n]=(note-1)/2+1;\n for(int i=2;imaxv) maxv=tem;\n }\n minv=maxv;\n for(int i=1;i<=n;i++)\n if(ans[i]maxv)\n maxv=note[i][0]+note[i][1];\n minv=maxv;\n for(int i=1;i<3;i++)\n if(note[i][0]\nint turn(int x)\n{\n if(x==1) return 2;\n else return 1;\n}\nint main()\n{\n int m,n,x,y,flag=0;\n long long int k,row,rec,ans[102]={0},other[102]={0};\n long long int maxv=0,minv,ser;\n scanf(\"%d%d%lld%d%d\",&n,&m,&k,&x,&y);\n row=k/m;rec=k%m;\n if(n>2)\n {\n if(row>0)\n {\n long long int note=(row-1)/(n-1);\n int left=(row-1)%(n-1);\n if(note>0) ans[1]=note/2+1;\n if(note>0) ans[n]=(note-1)/2+1;\n for(int i=2;imaxv) maxv=tem;\n }\n minv=maxv;\n for(int i=1;i<=n;i++)\n if(ans[i]maxv)\n maxv=note[i][0]+note[i][1];\n minv=maxv;\n for(int i=1;i<3;i++)\n if(note[i][0]\n#include \n\nint64_t max(int64_t x, int64_t y)\n{\n if (x > y)\n return x;\n else\n return y;\n}\n\n#define div(a, b, c) ( ((a)-(b)) / (c) + (b < (a)%(c)))\n\nint64_t count(int64_t n, int64_t m, int64_t k, int64_t x, int64_t y)\n{\n if (n != 1) {\n if (x == 0 || x == n - 1)\n //return div(k - y - x*m, 2*(n-1)*m);\n return div(k, x*m+y, 2*(n-1)*m);\n else\n //return div(k - y - x*m, 2*(n-1)*m) + div(k - y - m*(2*n - 2 - x), 2*(n-1)*m);\n return div(k, x*m+y, 2*(n-1)*m) + div(k, (2*n-2-x)*m+y, 2*(n-1)*m);\n } else {\n //return div(k - y - x*m, n*m);\n return div(k, y, n*m);\n }\n}\n\nint\nmain()\n{\n int64_t n, m, k, x, y;\n scanf(\"%\"SCNd64\"%\"SCNd64\"%\"SCNd64\"%\"SCNd64\"%\"SCNd64, &n, &m, &k, &x, &y);\n x--; y--;\n if (n == 1)\n printf(\"%\"PRId64\" %\"PRId64\" %\"PRId64\"\\n\", \n count(n, m, k, 0, 0), \n count(n, m, k, 0, m-1), \n count(n, m, k, x, y));\n else\n printf(\"%\"PRId64\" %\"PRId64\" %\"PRId64\"\\n\", \n max(max(count(n, m, k, 0, 0), count(n, m, k, 1, 0)), count(n, m, k, n-2, 0)), \n -max(-count(n, m, k, 0, m-1), -count(n, m, k, n-1, m-1)), \n count(n, m, k, x, y));\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main() {\n uint8_t n, m, x, y;\n uint64_t k;\n scanf(\"%hhu %hhu %I64u %hhu %hhu\", &n, &m, &k, &x, &y);\n uint64_t t, seryo, mini, maxi;\n if (n == 1) {\n t = k / m;\n mini = t;\n k -= t * m;\n maxi = t + (k > 0);\n seryo = t + (k >= y);\n goto END;\n }\n if (n == 2) {\n t = k / (2 * m);\n mini = t;\n k -= t * 2 * m;\n maxi = t + (k > 0);\n seryo = t + (k >= (x - 1) * m + y);\n goto END;\n }\n t = k / ((n - 1) * m);\n k -= t * (n - 1) * m;\n uint64_t mid_row = t;\n uint64_t first_row = (t + 1) / 2;\n uint64_t last_row = t / 2;\n mini = last_row;\n maxi = (t == 0) ? (k > 0) : mid_row + (k > m);\n if (x == 1)\n seryo = first_row;\n else if (x == n)\n seryo = last_row;\n else\n seryo = mid_row;\n if (t % 2 == 0) /* then we start counting from first row */\n seryo += (k >= (x - 1) * m + y);\n else { \n mini += (k >= m);\n seryo += (k >= (n - x) * m + y);\n }\nEND:\n printf(\"%I64u %I64u %I64u\\n\", maxi, mini, seryo);\n return 0;\n}\n"}, {"source_code": "#include\nlong long k,round,min,max,val,tmp;\nint n,m,x,y,rem,tmpx,tmpy;//xΪ������yΪ���� \nint a[110][110];\nint main(){\n\tscanf(\"%d%d%lld%d%d\",&n,&m,&k,&x,&y);\n\tif(n>1){\n\t\tround=k/(m*(2*n-2));\n\t rem=k%(m*(2*n-2));\n\t int dir=1;\n\t tmpx=1;tmpy=1;\n\t while(rem>0){\n\t \ta[tmpx][tmpy]++;\n\t \trem--;\n\t \tif(tmpyn||tmpx+dir<1)dir=-dir;\n\t\t\t tmpx=tmpx+dir;\n\t\t\t tmpy=1;\n\t\t\t}\n\t\t}\n\t\tint i,j;\n\t\t\n\t\tmax=0;min=k;\n\t\tfor(i=1;i<=n;i++)\n\t\t for(j=1;j<=m;j++){\n\t\t \t if(i==1||i==n)tmp=round+a[i][j];\n\t\t \t else tmp=round*2+a[i][j];\n\t\t \t if(tmp>max)max=tmp;\n\t\t \t if(tmp0){\n\t\t\tmax=round+1;\n\t\t\tmin=round;\n\t\t\tif(rem>=y)val=round+1;\n\t\t\telse val=round;\t \n\t\t}\n\t}\n\tprintf(\"%lld %lld %lld\",max,min,val);\n\treturn 0;\n} \n"}, {"source_code": "//今天晚上没有BUG!!!\n//今天晚上没有BUG!!!\n//今天晚上没有BUG!!!\n#include\n#include\n#include\n#include\nlong long a[105][105];\nint main()\n{\n int n,m,x,y;\n long long k;\n scanf(\"%d %d %lld %d %d\",&n,&m,&k,&x,&y);\n long long shang,yushu;\n int numb1=(n-1)*m;\n if (n==1)\n {\n shang=k/(n*m);\n yushu=k%(n*m);\n int mm,jj;\n for (mm=1;mm<=m;mm++)\n a[1][mm]=shang;\n for (mm=1;mm<=yushu;mm++)\n a[1][mm]++;\n long long maxx=0,minn=1000000000000000000;\n for (jj=1;jj<=m;jj++)\n {\n maxx=maxx>a[1][jj]? maxx:a[1][jj];\n minn=minn0&&(shang%2==0))//先后顺序\n {\n for (j=1;j<=m;j++)\n {\n if (yushu>0)\n {\n a[i][j]++;\n yushu--;\n }\n }\n i++;\n }\n i=n;\n while (yushu>0&&(shang%2!=0))//先后顺序\n {\n for (j=1;j<=m;j++)\n {\n if (yushu>0)\n {\n a[i][j]++;\n yushu--;\n }\n }\n i--;\n }\n long long maxx=0,minn=1000000000000000000;\n for (i=1;ia[i][j]? maxx:a[i][j];\n minn=minn\n\ntypedef long long INT64;\n\nint main(void) {\n INT64 i = 0, j = 0, n = 0, m = 0, k = 0;\n INT64 x = 0, y = 0, arr[101] = {0, }, cnt = 0;\n INT64 serg = 0, max = 0, min = -1;\n \n scanf(\"%lld %lld %lld %lld %lld\", &n, &m, &k, &x, &y);\n INT64 q = k / m;\n INT64 r = k % m;\n if (n == 1) { \n if (y <= r) {\n serg = q + 1;\n } else {\n serg = q;\n }\n \n min = q;\n \n if (r == 0) {\n max = q;\n } else {\n max = q + 1;\n }\n } else {\n cnt = q / (2 * (n - 1));\n arr[1] = arr[n] = cnt;\n k -= (2 * (n - 1)) * cnt * m;\n for (i=2;i<=n-1;i++) {\n arr[i] = 2 * cnt;\n }\n \n for (i=1;i<=n;i++) {\n if (k < m) {\n break;\n }\n \n arr[i]++;\n k -= m;\n }\n \n if (i > n) {\n for (i=n-1;i>1;i--) {\n if (k < m) {\n break;\n }\n \n arr[i]++;\n k -= m;\n }\n }\n \n if (k != 0) {\n arr[i]++;\n }\n \n for (j=1;j<=n;j++) {\n if (arr[j] > max) {\n max = arr[j];\n }\n \n if (min < 0 || arr[j] < min) {\n if (j == i) {\n if (k == 0) {\n min = arr[j];\n } else {\n min = arr[j] - 1;\n }\n } else {\n min = arr[j];\n }\n }\n }\n \n if (x != i) {\n serg = arr[x];\n } else {\n if (k == 0 || y <= k) {\n serg = arr[i];\n } else {\n serg = arr[i] - 1;\n }\n }\n }\n\n printf(\"%lld %lld %lld\\n\", max, min, serg);\n \n return 0;\n}"}, {"source_code": "#include\n\nlong long int min(long long int a,long long int b)\n{\n if(ab)\n return a;\n\n else\n return b;\n}\n\nint main()\n{\n long long int questions,n,m,x,y,period,maximum,minimum,sergei_questions,last_x,last_y,remaining_questions,temp;\n\n scanf(\"%lld %lld %lld %lld %lld\",&n,&m,&questions,&x,&y);\n\n if(n==1 || n==2)\n {\n period=n*m;\n\n if(questions%period==0)\n printf(\"%lld %lld %lld\\n\",questions/period,questions/period,questions/period);\n\n else\n {\n maximum=questions/period+1;\n minimum=questions/period;\n\n last_x=(questions%period)/m;\n last_y=(questions%period)%m;\n\n if(last_y!=0)\n last_x++;\n\n else\n last_y=m;\n\n if(x0)\n {\n arr[i]++;\n temp=temp-m;\n i++;\n }\n }\n\n else\n {\n for(i=1;i0)\n {\n arr[i]++;\n temp=temp-m;\n i--;\n }\n }\n\n last_x=remaining_questions/m;\n last_y=remaining_questions%m;\n\n if(last_y!=0)\n last_x++;\n\n else\n last_y=m;\n\n if(last_x>n)\n last_x=2*n-last_x;\n\n minimum=min(arr[1],arr[n]);\n\n maximum=0;\n\n for(i=1;ilast_y)\n sergei_questions--;\n\n printf(\"%lld %lld %lld\\n\",maximum,minimum,sergei_questions);\n\n }\n }\n\nreturn 0;\n}\n"}, {"source_code": "#include\n\nlong long int min(long long int a,long long int b)\n{\n if(a0)\n {\n arr[i]++;\n temp=temp-m;\n i++;\n }\n }\n\n else\n {\n for(i=1;i0)\n {\n arr[i]++;\n temp=temp-m;\n i--;\n }\n }\n\n last_x=remaining_questions/m;\n last_y=remaining_questions%m;\n\n if(last_y!=0)\n last_x++;\n\n else\n last_y=m;\n\n if(last_x>n)\n last_x=2*n-last_x;\n\n minimum=min(arr[1],arr[n]);\n\n if(remaining_questions==n*m)\n maximum=arr[2];\n\n else\n maximum=arr[last_x];\n\n sergei_questions=arr[x];\n\n if(x==last_x && y>last_y)\n sergei_questions--;\n\n printf(\"%lld %lld %lld\\n\",maximum,minimum,sergei_questions);\n\n }\n }\n\nreturn 0;\n}\n"}, {"source_code": "#include\n\nlong long int min(long long int a,long long int b)\n{\n if(ab)\n return a;\n\n else\n return b;\n}\n\nint main()\n{\n long long int questions,n,m,x,y,period,maximum,minimum,sergei_questions,last_x,last_y,remaining_questions,temp,j;\n\n scanf(\"%lld %lld %lld %lld %lld\",&n,&m,&questions,&x,&y);\n\n if(n==1 || n==2)\n {\n period=n*m;\n\n if(questions%period==0)\n printf(\"%lld %lld %lld\\n\",questions/period,questions/period,questions/period);\n\n else\n {\n maximum=questions/period+1;\n minimum=questions/period;\n\n last_x=(questions%period)/m;\n last_y=(questions%period)%m;\n\n if(last_y!=0)\n last_x++;\n\n else\n last_y=m;\n\n if(x0)\n {\n arr[i]++;\n temp=temp-m;\n i++;\n }\n }\n\n else\n {\n for(i=1;i0)\n {\n arr[i]++;\n temp=temp-m;\n i--;\n }\n }\n\n last_x=remaining_questions/m;\n last_y=remaining_questions%m;\n\n if(last_y!=0)\n last_x++;\n\n else\n last_y=m;\n\n if(last_x>n)\n last_x=2*n-last_x;\n\n minimum=arr[1];\n\n for(i=1;i=(n*m)-m)\n minimum--;\n\n maximum=0;\n\n for(i=1;ilast_y)\n sergei_questions--;\n\n printf(\"%lld %lld %lld\\n\",maximum,minimum,sergei_questions);\n\n }\n }\n\nreturn 0;\n}\n"}, {"source_code": "#include\n\nlong long int min(long long int a,long long int b)\n{\n if(a0)\n {\n arr[i]++;\n temp=temp-m;\n i++;\n }\n }\n\n else\n {\n for(i=1;i0)\n {\n arr[i]++;\n temp=temp-m;\n i--;\n }\n }\n\n last_x=remaining_questions/m;\n last_y=remaining_questions%m;\n\n if(last_y!=0)\n last_x++;\n\n else\n last_y=m;\n\n if(last_x>n)\n last_x=2*n-last_x;\n\n minimum=min(arr[1],arr[n]);\n\n if(remaining_questions==n*m)\n maximum=arr[2];\n\n else\n maximum=arr[last_x];\n\n sergei_questions=arr[x];\n\n if(x==last_x && y>last_y)\n sergei_questions--;\n\n printf(\"%lld %lld %lld\\n\",maximum,minimum,sergei_questions);\n\n }\n }\n\nreturn 0;\n}\n"}, {"source_code": "#include\n\nlong long int min(long long int a,long long int b)\n{\n if(a0)\n {\n arr[i]++;\n temp=temp-m;\n i++;\n }\n }\n\n else\n {\n for(i=1;i0)\n {\n arr[i]++;\n temp=temp-m;\n i--;\n }\n }\n\n last_x=remaining_questions/m;\n last_y=remaining_questions%m;\n\n if(last_y!=0)\n last_x++;\n\n else\n last_y=m;\n\n if(last_x>n)\n last_x=2*n-last_x;\n\n minimum=min(arr[1],arr[n]);\n\n if(remaining_questions==n*m)\n maximum=arr[2];\n\n else\n maximum=arr[last_x];\n\n sergei_questions=arr[x];\n\n if(x==last_x && y>last_y)\n sergei_questions--;\n\n printf(\"%lld %lld %lld\\n\",maximum,minimum,sergei_questions);\n\n }\n }\n\nreturn 0;\n}\n"}, {"source_code": "#include\n\nlong long int min(long long int a,long long int b)\n{\n if(ab)\n return a;\n\n else\n return b;\n}\n\nint main()\n{\n long long int questions,n,m,x,y,period,maximum,minimum,sergei_questions,last_x,last_y,remaining_questions,temp;\n\n scanf(\"%lld %lld %lld %lld %lld\",&n,&m,&questions,&x,&y);\n\n if(n==1 || n==2)\n {\n period=n*m;\n\n if(questions%period==0)\n printf(\"%lld %lld %lld\\n\",questions/period,questions/period,questions/period);\n\n else\n {\n maximum=questions/period+1;\n minimum=questions/period;\n\n last_x=(questions%period)/m;\n last_y=(questions%period)%m;\n\n if(last_y!=0)\n last_x++;\n\n else\n last_y=m;\n\n if(x0)\n {\n arr[i]++;\n temp=temp-m;\n i++;\n }\n }\n\n else\n {\n for(i=1;i0)\n {\n arr[i]++;\n temp=temp-m;\n i--;\n }\n }\n\n last_x=remaining_questions/m;\n last_y=remaining_questions%m;\n\n if(last_y!=0)\n last_x++;\n\n else\n last_y=m;\n\n if(last_x>n)\n last_x=2*n-last_x;\n\n minimum=arr[1];\n\n for(i=1;i=(n*m)-m)\n minimum--;\n\n maximum=0;\n\n for(i=1;ilast_y)\n sergei_questions--;\n\n printf(\"%lld %lld %lld\\n\",maximum,minimum,sergei_questions);\n\n }\n }\n\nreturn 0;\n}\n"}, {"source_code": "#include\n\nlong long int min(long long int a,long long int b)\n{\n if(a0)\n {\n arr[i]++;\n temp=temp-m;\n i++;\n }\n }\n\n else\n {\n for(i=1;i0)\n {\n arr[i]++;\n temp=temp-m;\n i--;\n }\n }\n\n last_x=remaining_questions/m;\n last_y=remaining_questions%m;\n\n if(last_y!=0)\n last_x++;\n\n else\n last_y=m;\n\n if(last_x>n)\n last_x=2*n-last_x;\n\n minimum=min(arr[1],arr[n]);\n\n if(last_x==1 || last_x==n)\n maximum=arr[2];\n\n else\n maximum=arr[last_x];\n\n sergei_questions=arr[x];\n\n if(x==last_x && y>last_y)\n sergei_questions--;\n\n printf(\"%lld %lld %lld\\n\",maximum,minimum,sergei_questions);\n\n }\n }\n\nreturn 0;\n}\n"}, {"source_code": "#include\n\nlong long int min(long long int a,long long int b)\n{\n if(ab)\n return a;\n\n else\n return b;\n}\n\nint main()\n{\n long long int questions,n,m,x,y,period,maximum,minimum,sergei_questions,last_x,last_y,remaining_questions,temp,j;\n\n scanf(\"%lld %lld %lld %lld %lld\",&n,&m,&questions,&x,&y);\n\n if(n==1 || n==2)\n {\n period=n*m;\n\n if(questions%period==0)\n printf(\"%lld %lld %lld\\n\",questions/period,questions/period,questions/period);\n\n else\n {\n maximum=questions/period+1;\n minimum=questions/period;\n\n last_x=(questions%period)/m;\n last_y=(questions%period)%m;\n\n if(last_y!=0)\n last_x++;\n\n else\n last_y=m;\n\n if(x0)\n {\n arr[i]++;\n temp=temp-m;\n i++;\n }\n }\n\n else\n {\n for(i=1;i0)\n {\n arr[i]++;\n temp=temp-m;\n i--;\n }\n }\n\n last_x=remaining_questions/m;\n last_y=remaining_questions%m;\n\n if(last_y!=0)\n last_x++;\n\n else\n last_y=m;\n\n if(last_x>n)\n last_x=2*n-last_x;\n\n minimum=arr[1];\n\n for(i=1;i=(n*m)-m)\n minimum--;\n\n maximum=0;\n\n for(i=1;ilast_y)\n sergei_questions--;\n\n printf(\"%lld %lld %lld\\n\",maximum,minimum,sergei_questions);\n\n }\n }\n\nreturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nlong long int k,i,j,max,min,S;\n\nint main()\n{\n int n,m,x,y;\n \n scanf(\"%d%d%lld%d%d\",&n,&m,&k,&x,&y);\n x--;\n if(n*m > k)\n {\n max = 1;\n min = 0;\n if(x*m+y <= k)S = 1;\n else S = 0;\n }\n else if(n <= 2)\n {\n min = k/(m*n);\n max = (k%(m*n) == 0)?min:min + 1;\n \n if(max == min)S = max;\n else\n {\n if(n == 1)\n {\n if(k%m >= y)S = max;\n else S = min;\n }\n else\n {\n if(k/(m*2)%2 == 0)\n {\n if(k%(m*2) >= x*m+y)S = max;\n else S = min;\n }\n else\n {\n if(k%(m*2) <= m)\n {\n if(x == 2 && k%(m*2) >= y)S = max;\n else S = min;\n }\n else\n {\n if(x == 1 && k%m <= y)S = min;\n else S = max;\n }\n }\n }\n }\n }\n else\n {\n i = k/(m*(2*n-2));\n j = k%(m*(2*n-2));\n max = i*2;\n min = i;\n if(j == 0)\n {\n if(x == 1 || x == n)S = min;\n else S = max;\n }\n else\n {\n if(j <= m)\n {\n if(x == 1)\n {\n if(y > j)S = min;\n else S = min+1;\n }\n else if(x == n)S = min;\n else S = max;\n }\n else if(j <= m*(n-1))\n {\n max++;\n if(x == 1)S = min+1;\n else if(x == n)S = min;\n else \n {\n if(x*m+y <= j)S = max;\n else S = max-1;\n }\n }\n else if(j <= m*n)\n {\n max++;\n if(j == m*n)min++;\n if(x == 1)S = i+1;\n else if(x == n)\n {\n if(y <= j%m || j%m == 0)S = i+1;\n else S = i;\n }\n else S = max;\n }\n else\n {\n max+=2;\n min++;\n if(x == 1)S = i+1;\n else if(x == n)S = i+1;\n else\n {\n S = i*2+1;\n j-=m*n;\n if(j%m == 0)\n {\n if(x + j/m > (n-2))S++;\n }\n else\n {\n if(x + j/m > (n-1))S++;\n else if(x + j/m == (n-1))\n {\n if(j%m >= y||j%m == 0)S++;\n }\n }\n }\n }\n }\n }\n \n printf(\"%lld %lld %lld\\n\",max,min,S);\n}"}, {"source_code": "#include \n#include \n\nlong long int k,i,j,max,min,S;\n\nint main()\n{\n int n,m,x,y;\n \n scanf(\"%d%d%lld%d%d\",&n,&m,&k,&x,&y);\n \n if(n <= 2)\n {\n min = k/(m*n);\n max = (k%(m*n) == 0)?min:min + 1;\n \n if(max == min)S = max;\n else\n {\n if(n == 1)\n {\n if(k%m >= y)S = max;\n else S = min;\n }\n else\n {\n if(k/(m*2)%2 == 0)\n {\n if(k%(m*2) >= x*m+y)S = max;\n else S = min;\n }\n else\n {\n if(k%(m*2) <= m)\n {\n if(x == 2 && k%(m*2) >= y)S = max;\n else S = min;\n }\n else\n {\n if(x == 1 && k%m <= y)S = min;\n else S = max;\n }\n }\n }\n }\n }\n else\n {\n i = k/(m*(2*n-2));\n j = k%(m*(2*n-2));\n max = i*2;\n min = i;\n if(j == 0)\n {\n if(x == 1 || x == n)S = min;\n else S = max;\n }\n else\n {\n if(j <= m)\n {\n if(x == 1)\n {\n if(y > j)S = min;\n else S = min+1;\n }\n else if(x == n)S = min;\n else S = max;\n }\n else if(j <= m*(n-1))\n {\n max++;\n if(x == 1)S = min+1;\n else if(x == n)S = min;\n else \n {\n if(x*m+y <= j)S = max+1;\n else S = max;\n }\n }\n else if(j <= m*n)\n {\n max++;\n if(j == m*n)min++;\n if(x == 1)S = i+1;\n else if(x == n)\n {\n if(y <= j%m || j%m == 0)S = i+1;\n else S = i;\n }\n else S = max;\n }\n else\n {\n max+=2;\n min++;\n if(x == 1)S = i+1;\n else if(x == n)S = i+1;\n else\n {\n S = i*2+1;\n j-=m*n;\n if(j%m == 0)\n {\n if(x + j/m > (n-2))S++;\n }\n else\n {\n if(x + j/m > (n-1))S++;\n else if(x + j/m == (n-1))\n {\n if(j%m >= y||j%m == 0)S++;\n }\n }\n }\n }\n }\n }\n \n printf(\"%lld %lld %lld\\n\",max,min,S);\n}\n"}, {"source_code": "#include \n#include \n\nlong long int k,i,j,max,min,S;\n\nint main()\n{\n int n,m,x,y;\n \n scanf(\"%d%d%lld%d%d\",&n,&m,&k,&x,&y);\n \n if(n <= 2)\n {\n min = k/(m*n);\n max = (k%(m*n) == 0)?min:min + 1;\n \n if(max == min)S = max;\n else\n {\n if(n == 1)\n {\n if(k%m >= y)S = max;\n else S = min;\n }\n else\n {\n if(k/(m*2)%2 == 0)\n {\n if(k%(m*2) >= x*m+y)S = max;\n else S = min;\n }\n else\n {\n if(k%(m*2) <= m)\n {\n if(x == 2 && k%(m*2) >= y)S = max;\n else S = min;\n }\n else\n {\n if(x == 1 && k%m <= y)S = min;\n else S = max;\n }\n }\n }\n }\n }\n else\n {\n i = k/(m*(2*n-2));\n j = k%(m*(2*n-2));\n max = i*2;\n min = i;\n if(j == 0)\n {\n if(x == 1 || x == n)S = min;\n else S = max;\n }\n else\n {\n if(j <= m)\n {\n if(x == 1)\n {\n if(y > j)S = min;\n else S = min+1;\n }\n else if(x == n)S = min;\n else S = max;\n }\n else if(j <= m*(n-1))\n {\n max++;\n if(x == 1)S = min+1;\n else if(x == n)S = min;\n else \n {\n if(x*m+y <= j)S = max+1;\n else S = max;\n }\n }\n else if(j <= m*n)\n {\n max++;\n if(j == m*n)min++;\n if(x == 1)S = i+1;\n else if(x == n)\n {\n if(y <= j%m || j%m == 0)S = i+1;\n else S = i;\n }\n else S = max;\n }\n else\n {\n max+=2;\n min++;\n if(x == 1)S = i+1;\n else if(x == n)S = i+1;\n else\n {\n S = i*2+1;\n j-=m*n;\n if(j%m == 0)\n {\n if(x + j/m > (n-2))S++;\n }\n else\n {\n if(x + j/m > (n-2))S++;\n else if(x + j/m == (n-2))\n {\n if(j%m >= y||j%m == 0)S++;\n }\n }\n }\n }\n }\n }\n \n printf(\"%lld %lld %lld\\n\",max,min,S);\n}"}, {"source_code": "#include \n#include \n\nlong long int k,i,j,max,min,S;\n\nint main()\n{\n int n,m,x,y;\n \n scanf(\"%d%d%lld%d%d\",&n,&m,&k,&x,&y);\n \n if(n*m > k)\n {\n max = 1;\n min = 0;\n if((x-1)*m+y <= k)S = 1;\n else S = 0;\n }\n else if(n <= 2)\n {\n min = k/(m*n);\n max = (k%(m*n) == 0)?min:min + 1;\n \n if(max == min)S = max;\n else\n {\n if(n == 1)\n {\n if(k%m >= y)S = max;\n else S = min;\n }\n else\n {\n j = k%(m*n);\n if(j > m)\n {\n if(x == 2 && j-m >= y)S = max;\n else S = min;\n }\n else\n {\n if(x == 1 && j >= y)S = max;\n else S = min;\n }\n }\n }\n }\n else\n {\n i = k/(m*(2*n-2));\n j = k%(m*(2*n-2));\n max = i*2;\n min = i;\n if(j == 0)\n {\n if(x == 1 || x == n)S = min;\n else S = max;\n }\n else\n {\n if(j <= m)\n {\n if(x == 1)\n {\n if(y > j)S = min;\n else S = min+1;\n }\n else if(x == n)S = min;\n else S = max;\n }\n else if(j <= m*(n-1))\n {\n max++;\n if(x == 1)S = min+1;\n else if(x == n)S = min;\n else \n {\n if((x-1)*m+y <= j)S = max;\n else S = max-1;\n }\n }\n else if(j <= m*n)\n {\n max++;\n if(j == m*n)min++;\n if(x == 1)S = i+1;\n else if(x == n)\n {\n if(y <= j%m || j%m == 0)S = i+1;\n else S = i;\n }\n else S = max;\n }\n else\n {\n max+=2;\n min++;\n if(x == 1)S = i+1;\n else if(x == n)S = i+1;\n else\n {\n S = i*2+1;\n j-=m*n;\n if(j%m == 0)\n {\n if(x + j/m > (n-2))S++;\n }\n else\n {\n if(x + j/m > (n-1))S++;\n else if(x + j/m == (n-1))\n {\n if(j%m >= y||j%m == 0)S++;\n }\n }\n }\n }\n }\n }\n \n printf(\"%lld %lld %lld\\n\",max,min,S);\n}"}, {"source_code": "#include \n#include \n\nlong long int k,i,j,max,min,S;\n\nint main()\n{\n int n,m,x,y;\n \n scanf(\"%d%d%lld%d%d\",&n,&m,&k,&x,&y);\n \n if(n*m > k)\n {\n max = 1;\n min = 0;\n if((x-1)*m+y <= k)S = 1;\n else S = 0;\n }\n else if(n <= 2)\n {\n min = k/(m*n);\n max = (k%(m*n) == 0)?min:min + 1;\n \n if(max == min)S = max;\n else\n {\n if(n == 1)\n {\n if(k%m >= y)S = max;\n else S = min;\n }\n else\n {\n if(k/(m*2)%2 == 0)\n {\n if(k%(m*2) >= x*m+y)S = max;\n else S = min;\n }\n else\n {\n if(k%(m*2) <= m)\n {\n if(x == 2 && k%(m*2) >= y)S = max;\n else S = min;\n }\n else\n {\n if(x == 1 && k%m <= y)S = min;\n else S = max;\n }\n }\n }\n }\n }\n else\n {\n i = k/(m*(2*n-2));\n j = k%(m*(2*n-2));\n max = i*2;\n min = i;\n if(j == 0)\n {\n if(x == 1 || x == n)S = min;\n else S = max;\n }\n else\n {\n if(j <= m)\n {\n if(x == 1)\n {\n if(y > j)S = min;\n else S = min+1;\n }\n else if(x == n)S = min;\n else S = max;\n }\n else if(j <= m*(n-1))\n {\n max++;\n if(x == 1)S = min+1;\n else if(x == n)S = min;\n else \n {\n if((x-1)*m+y <= j)S = max;\n else S = max-1;\n }\n }\n else if(j <= m*n)\n {\n max++;\n if(j == m*n)min++;\n if(x == 1)S = i+1;\n else if(x == n)\n {\n if(y <= j%m || j%m == 0)S = i+1;\n else S = i;\n }\n else S = max;\n }\n else\n {\n max+=2;\n min++;\n if(x == 1)S = i+1;\n else if(x == n)S = i+1;\n else\n {\n S = i*2+1;\n j-=m*n;\n if(j%m == 0)\n {\n if(x + j/m > (n-2))S++;\n }\n else\n {\n if(x + j/m > (n-1))S++;\n else if(x + j/m == (n-1))\n {\n if(j%m >= y||j%m == 0)S++;\n }\n }\n }\n }\n }\n }\n \n printf(\"%lld %lld %lld\\n\",max,min,S);\n}\n"}, {"source_code": "#include \n#include \n\nlong long int k,i,j,max,min,S;\n\nint main()\n{\n int n,m,x,y;\n \n scanf(\"%d%d%lld%d%d\",&n,&m,&k,&x,&y);\n \n if(n <= 2)\n {\n min = k/(m*n);\n max = (k%(m*n) == 0)?min:min + 1;\n \n if(max == min)S = max;\n else\n {\n if(n == 1)\n {\n if(k%m >= y)S = max;\n else S = min;\n }\n else\n {\n if(k/(m*2)%2 == 0)\n {\n if(k%(m*2) >= x*m+y)S = max;\n else S = min;\n }\n else\n {\n if(k%(m*2) <= m)\n {\n if(x == 2 && k%(m*2) >= y)S = max;\n else S = min;\n }\n else\n {\n if(x == 1 && k%m <= y)S = min;\n else S = max;\n }\n }\n }\n }\n }\n else\n {\n i = k/(m*(2*n-2));\n j = k%(m*(2*n-2));\n max = i*2;\n min = i;\n if(j == 0)\n {\n if(x == 1 || x == n)S = min;\n else S = max;\n }\n else\n {\n if(j <= m)\n {\n if(x == 1)\n {\n if(y > j)S = min;\n else S = min+1;\n }\n else if(x == n)S = min;\n else S = max;\n }\n else if(j <= m*(n-1))\n {\n max++;\n if(x == 1)S = min+1;\n else if(x == n)S = min;\n else \n {\n if((x-1)*m+y <= j)S = max;\n else S = max-1;\n }\n }\n else if(j <= m*n)\n {\n max++;\n if(j == m*n)min++;\n if(x == 1)S = i+1;\n else if(x == n)\n {\n if(y <= j%m || j%m == 0)S = i+1;\n else S = i;\n }\n else S = max;\n }\n else\n {\n max+=2;\n min++;\n if(x == 1)S = i+1;\n else if(x == n)S = i+1;\n else\n {\n S = i*2+1;\n j-=m*n;\n if(j%m == 0)\n {\n if(x + j/m > (n-2))S++;\n }\n else\n {\n if(x + j/m > (n-1))S++;\n else if(x + j/m == (n-1))\n {\n if(j%m >= y||j%m == 0)S++;\n }\n }\n }\n }\n }\n }\n \n printf(\"%lld %lld %lld\\n\",max,min,S);\n}"}, {"source_code": "#include \n#include \n\nlong long int k,i,j,max,min,S;\n\nint main()\n{\n int n,m,x,y;\n \n scanf(\"%d%d%lld%d%d\",&n,&m,&k,&x,&y);\n \n if(n*m > k)\n {\n max = 1;\n min = 0;\n if((x-1)*m+y <= k)S = 1;\n else S = 0;\n }\n else if(n <= 2)\n {\n min = k/(m*n);\n max = (k%(m*n) == 0)?min:min + 1;\n \n if(max == min)S = max;\n else\n {\n if(n == 1)\n {\n if(k%m >= y)S = max;\n else S = min;\n }\n else\n {\n if(min%2 == 0)\n {\n if(k%(m*2) >= (x-1)*m+y)S = max;\n else S = min;\n }\n else\n {\n if(k%(m*2) <= m)\n {\n if(x == 2 && k%(m*2) >= y)S = max;\n else S = min;\n }\n else\n {\n if(x == 1 && k%m <= y)S = min;\n else S = max;\n }\n }\n }\n }\n }\n else\n {\n i = k/(m*(2*n-2));\n j = k%(m*(2*n-2));\n max = i*2;\n min = i;\n if(j == 0)\n {\n if(x == 1 || x == n)S = min;\n else S = max;\n }\n else\n {\n if(j <= m)\n {\n if(x == 1)\n {\n if(y > j)S = min;\n else S = min+1;\n }\n else if(x == n)S = min;\n else S = max;\n }\n else if(j <= m*(n-1))\n {\n max++;\n if(x == 1)S = min+1;\n else if(x == n)S = min;\n else \n {\n if((x-1)*m+y <= j)S = max;\n else S = max-1;\n }\n }\n else if(j <= m*n)\n {\n max++;\n if(j == m*n)min++;\n if(x == 1)S = i+1;\n else if(x == n)\n {\n if(y <= j%m || j%m == 0)S = i+1;\n else S = i;\n }\n else S = max;\n }\n else\n {\n max+=2;\n min++;\n if(x == 1)S = i+1;\n else if(x == n)S = i+1;\n else\n {\n S = i*2+1;\n j-=m*n;\n if(j%m == 0)\n {\n if(x + j/m > (n-2))S++;\n }\n else\n {\n if(x + j/m > (n-1))S++;\n else if(x + j/m == (n-1))\n {\n if(j%m >= y||j%m == 0)S++;\n }\n }\n }\n }\n }\n }\n \n printf(\"%lld %lld %lld\\n\",max,min,S);\n}\n"}, {"source_code": "#include \n#include \n\nlong long int k,i,j,max,min,S;\n\nint main()\n{\n int n,m,x,y;\n \n scanf(\"%d%d%lld%d%d\",&n,&m,&k,&x,&y);\n \n if(n <= 2)\n {\n min = k/(m*n);\n max = (k%(m*n) == 0)?min:min + 1;\n \n if(max == min)S = max;\n else\n {\n if(n == 1)\n {\n if(k%m >= y)S = max;\n else S = min;\n }\n else\n {\n if(k/(m*2)%2 == 0)\n {\n if(k%(m*2) >= x*m+y)S = max;\n else S = min;\n }\n else\n {\n if(k%(m*2) <= m)\n {\n if(x == 2 && k%(m*2) >= y)S = max;\n else S = min;\n }\n else\n {\n if(x == 1 && k%m <= y)S = min;\n else S = max;\n }\n }\n }\n }\n }\n else\n {\n i = k/(m*(2*n-2));\n j = k%(m*(2*n-2));\n max = i*2;\n min = i;\n if(j == 0)\n {\n if(x == 1 || x == n)S = min;\n else S = max;\n }\n else\n {\n if(j <= m)\n {\n if(x == 1)\n {\n if(y > j)S = min;\n else S = min+1;\n }\n else if(x == n)S = min;\n else S = max;\n }\n else if(j <= m*(n-1))\n {\n max++;\n if(x == 1)S = min+1;\n else if(x == n)S = min;\n else \n {\n if(x*m+y <= j)S = max;\n else S = max-1;\n }\n }\n else if(j <= m*n)\n {\n max++;\n if(j == m*n)min++;\n if(x == 1)S = i+1;\n else if(x == n)\n {\n if(y <= j%m || j%m == 0)S = i+1;\n else S = i;\n }\n else S = max;\n }\n else\n {\n max+=2;\n min++;\n if(x == 1)S = i+1;\n else if(x == n)S = i+1;\n else\n {\n S = i*2+1;\n j-=m*n;\n if(j%m == 0)\n {\n if(x + j/m > (n-2))S++;\n }\n else\n {\n if(x + j/m > (n-1))S++;\n else if(x + j/m == (n-1))\n {\n if(j%m >= y||j%m == 0)S++;\n }\n }\n }\n }\n }\n }\n \n printf(\"%lld %lld %lld\\n\",max,min,S);\n}"}, {"source_code": "#include \n\nint n, m;\n\nlong long count(int x, int y, long long k) {\n\tlong long z;\n\n\tif (n <= 2) {\n\t\tz = k / (n * m);\n\t\tk %= n * m;\n\t\tif ((x - 1) * m + y <= k)\n\t\t\tz++;\n\t} else {\n\t\tz = k / ((n + n - 2) * m);\n\t\tif (x > 1 && x < n)\n\t\t\tz *= 2;\n\t\tk %= (n + n - 2) * n;\n\t\tif ((x - 1) * m + y <= k)\n\t\t\tz++;\n\t\tif (x > 1 && x < n && (n - 1 - x) * m + y <= k - n * m)\n\t\t\tz++;\n\t}\n\treturn z;\n}\n\nlong long max2(long long a, long long b) {\n\treturn a > b ? a : b;\n}\n\nlong long min2(long long a, long long b) {\n\treturn a < b ? a : b;\n}\n\nint main() {\n\tint x, y;\n\tlong long k, max, min, ser;\n\n\tscanf(\"%d%d%lld%d%d\", &n, &m, &k, &x, &y);\n\tmax = n <= 2 ? count(1, 1, k) : max2(max2(count(1, 1, k), count(2, 1, k)), max2(count(n - 1, 1, k), count(n, 1, k)));\n\tmin = n <= 2 ? count(n, m, k) : min2(min2(count(1, m, k), count(2, m, k)), min2(count(n - 1, m, k), count(n, m, k)));\n\tser = count(x, y, k);\n\tprintf(\"%lld %lld %lld\\n\", max, min, ser);\n\treturn 0;\n}\n"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include \n#define dll unsigned long long\n\n#define SIZE 105\n\nint n, m, x, y;\ndll k, ans[SIZE][SIZE];\n\nint main()\n{\n\tint i, j;\n\tdll max = 0, min = 18446744073709551615, full_come, total_comes;\n\n\tscanf(\"%d %d %I64u %d %d\", &n, &m, &k, &x, &y);\n\n\tfull_come = n * m;\n\tif (n > 2)\n\t\tfull_come += (n - 2) * m;\n\n\ttotal_comes = k / full_come;\n\n\tk %= full_come;\n\n\n\n\tfor (i = 0; i < n; i++)\n\t\tfor (j = 0; j < m; j++)\n\t\t{\n\t\t\tans[i][j] += total_comes;\n\t\t\tif (i > 0 && i < n - 1)\n\t\t\t\tans[i][j] += total_comes;\n\t\t}\n\n\n\tfor (i = 0; i < n; i++)\n\t\tfor (j = 0; j < m && k > 0; j++)\n\t\t{\n\t\t\tans[i][j]++;\n\t\t\tk--;\n\t\t}\n\n\tfor (i = n - 1; i > 0; i--)\n\t\tfor (j = 0; j < m && k > 0; j++)\n\t\t{\n\t\t\tans[i][j]++;\n\t\t\tk--;\n\t\t}\n\n\tfor (i = 0; i < n; i++)\n\t\tfor (j = 0; j < m; j++)\n\t\t{\n\t\t\tif (ans[i][j] > max)\n\t\t\t\tmax = ans[i][j];\n\t\t\tif (ans[i][j] < min)\n\t\t\t\tmin = ans[i][j];\n\t\t}\n\n\n\n\tprintf(\"%I64u %I64u %I64u\", max, min, ans[x - 1][y - 1]);\n\n\treturn 0;\n}"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include \n#define dll long long\n\n#define SIZE 100\n#define INF 9000000000000000000\n\nint n, m, x, y;\ndll k, ans[SIZE][SIZE];\n\nint main()\n{\n\tint i, j;\n\tdll max = 0, min = INF, full_come, total_comes;\n\n\tscanf(\"%d %d %I64d %d %d\", &n, &m, &k, &x, &y);\n\n\tfull_come = n * m;\n\tif (n > 2)\n\t\tfull_come += (n - 2) * m;\n\n\ttotal_comes = k / full_come;\n\n\tk %= full_come;\n\n\n\n\tfor (i = 0; i < n; i++)\n\t\tfor (j = 0; j < m; j++)\n\t\t{\n\t\t\tans[i][j] += total_comes;\n\t\t\tif (i > 0 && i < n - 1)\n\t\t\t\tans[i][j] += total_comes;\n\t\t}\n\t\n\t/*for (i = 0; i < n; i++)\n\t{\n\t\tfor (j = 0; j < m; j++)\n\t\t\tprintf(\"%I64d \", ans[i][j]);\n\t\tprintf('\\n');\n\t}*/\n\n\tfor (i = 0; i < n; i++)\n\t\tfor (j = 0; j < m && k > 0; j++)\n\t\t{\n\t\t\tans[i][j]++;\n\t\t\tk--;\n\t\t}\n\n\tfor (i = n - 1; i > 0; i--)\n\t\tfor (j = 0; j < m && k > 0; j++)\n\t\t{\n\t\t\tans[i][j]++;\n\t\t\tk--;\n\t\t}\n\n\tfor (i = 0; i < n; i++)\n\t\tfor (j = 0; j < m; j++)\n\t\t{\n\t\t\tif (ans[i][j] > max)\n\t\t\t\tmax = ans[i][j];\n\t\t\tif (ans[i][j] < min)\n\t\t\t\tmin = ans[i][j];\n\t\t}\n\n\tprintf(\"%I64d %I64d %I64d\", max, min, ans[x - 1][y - 1]);\n\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,m,x,y;\n long long int k,p,min,max,cur,g;\n scanf(\"%d %d %I64d %d %d\",&n,&m,&k,&x,&y);\n if(n==1)\n {\n p=k/m;\n g=k%(long long)m;\n min=p;\n if(g>0)\n max=p+1;\n else\n max=p;\n if(g>=y)\n cur=p+1;\n else\n cur=g;\n }\n else\n {\n p=k/((long long)((n-1)*m));\n g=k%((long long)((n-1)*m));\n if(p%2==0)\n {\n if(g>m)\n max=p+1;\n else\n max=p;\n min=p/2;\n if(x==1)\n {\n if(g>=y)\n cur=p/2+1;\n else\n cur=p/2;\n }\n else if(x==n)\n {\n if(g>=(n-1)*m+y)\n cur=p/2+1;\n else\n cur=p/2;\n }\n else\n {\n if(g>=(x-1)*m+y)\n cur=p+1;\n else\n cur=p;\n }\n }\n else\n {\n if(g>=m)\n min=p/2+1;\n else\n min=p/2;\n if(g>m)\n max=p+1;\n else\n max=p;\n if(x==1)\n {\n if(g>=(n-1)*m+y)\n cur=p/2+2;\n else\n cur=p/2+1;\n }\n else if(x==n)\n {\n if(g>=y)\n cur=p/2+1;\n else\n cur=p/2;\n }\n else\n {\n if(g>=(n-x)*m+y)\n cur=p+1;\n else\n cur=p;\n }\n }\n }\n printf(\"%I64d %I64d %I64d\",max,min,cur);\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,m,x,y;\n long long int k,p,min,max,cur,g;\n scanf(\"%d %d %I64d %d %d\",&n,&m,&k,&x,&y);\n if(n==1)\n {\n p=k/m;\n g=k%(long long)m;\n min=p;\n if(g>0)\n max=p+1;\n else\n max=p;\n if(g>=y)\n cur=p+1;\n else\n cur=g;\n }\n else if(n==2)\n {\n p=k/((long long)m);\n g=k%((long long)m);\n if(p%2==0)\n {\n if(g>0)\n max=p/2+1;\n else\n max=p/2;\n min=p/2;\n if(x==1)\n {\n if(g>=y)\n cur=p/2+1;\n else\n cur=p/2;\n }\n else if(x==2)\n {\n cur=p/2;\n }\n }\n else\n {\n max=p/2+1;\n min=p/2;\n if(x==1)\n {\n cur=p/2+1;\n }\n else if(x==2)\n {\n if(g>=y)\n cur=p/2+1;\n else\n cur=p/2;\n }\n }\n }\n else\n {\n p=k/((long long)((n-1)*m));\n g=k%((long long)((n-1)*m));\n if(p%2==0)\n {\n if(g>m)\n max=p+1;\n else\n max=p;\n min=p/2;\n if(x==1)\n {\n if(g>=y)\n cur=p/2+1;\n else\n cur=p/2;\n }\n else if(x==n)\n {\n if(g>=(n-1)*m+y)\n cur=p/2+1;\n else\n cur=p/2;\n }\n else\n {\n if(g>=(x-1)*m+y)\n cur=p+1;\n else\n cur=p;\n }\n }\n else\n {\n if(g>=m)\n min=p/2+1;\n else\n min=p/2;\n if(g>m)\n max=p+1;\n else\n max=p;\n if(x==1)\n {\n if(g>=(n-1)*m+y)\n cur=p/2+2;\n else\n cur=p/2+1;\n }\n else if(x==n)\n {\n if(g>=y)\n cur=p/2+1;\n else\n cur=p/2;\n }\n else\n {\n if(g>=(n-x)*m+y)\n cur=p+1;\n else\n cur=p;\n }\n }\n }\n printf(\"%I64d %I64d %I64d\",max,min,cur);\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,m,x,y;\n long long int k,p,min,max,cur,g;\n scanf(\"%d %d %I64d %d %d\",&n,&m,&k,&x,&y);\n if(n==1)\n {\n p=k/m;\n g=k%(long long)m;\n min=p;\n if(g>0)\n max=p+1;\n else\n max=p;\n if(g>=y)\n cur=p+1;\n else\n cur=g;\n }\n else if(n==2)\n {\n p=k/((long long)m);\n g=k%((long long)m);\n if(p%2==0)\n {\n if(g>0)\n max=p/2+1;\n else\n max=p/2;\n min=p/2;\n if(x==1)\n {\n if(g>=y)\n cur=p/2+1;\n else\n cur=p/2;\n }\n else if(x==2)\n {\n cur=p/2;\n }\n }\n else\n {\n max=p/2+1;\n min=p/2;\n if(x==1)\n {\n cur=p/2+1;\n }\n else if(x==2)\n {\n if(g>=y)\n cur=p/2+1;\n else\n cur=p/2;\n }\n }\n }\n else\n {\n p=k/((long long)((n-1)*m));\n g=k%((long long)((n-1)*m));\n if(p==0)\n {\n max=1;\n min=0;\n if(g>=(x-1)*m+y)\n cur=1;\n else\n cur=0;\n }\n else if(p%2==0)\n {\n if(g>m)\n max=p+1;\n else\n max=p;\n min=p/2;\n if(x==1)\n {\n if(g>=y)\n cur=p/2+1;\n else\n cur=p/2;\n }\n else if(x==n)\n {\n if(g>=(n-1)*m+y)\n cur=p/2+1;\n else\n cur=p/2;\n }\n else\n {\n if(g>=(x-1)*m+y)\n cur=p+1;\n else\n cur=p;\n }\n }\n else\n {\n if(g>=m)\n min=p/2+1;\n else\n min=p/2;\n if(g>m)\n max=p+1;\n else\n max=p;\n if(x==1)\n {\n if(g>=(n-1)*m+y)\n cur=p/2+2;\n else\n cur=p/2+1;\n }\n else if(x==n)\n {\n if(g>=y)\n cur=p/2+1;\n else\n cur=p/2;\n }\n else\n {\n if(g>=(n-x)*m+y)\n cur=p+1;\n else\n cur=p;\n }\n }\n }\n printf(\"%I64d %I64d %I64d\",max,min,cur);\n}\n"}, {"source_code": "#include\n#include\n#include\n\nint main()\n{\n long long j,i,count,n,m,k,x,y,a[110]={0},ans,max,min;\n scanf(\"%lld%lld%lld%lld%lld\",&n,&m,&k,&x,&y);\n if(n==1)\n {\n if(y<=k%m)\n ans=k/m+1;\n else\n ans=k/m;\n if(k%m!=0)\n printf(\"%lld %lld %lld\\n\",k/m+1,k/m,ans);\n else\n printf(\"%lld %lld %lld\\n\",k/m,k/m,k/m);\n return 0;\n }\n count=((k/m)/(2*n-2));\n a[1]=count;\n a[n]=count;\n k=k-(2*n-2)*count*m;\n for(i=2;i<=n-1;i++)\n a[i]=2*count;\n for(i=1;i<=n;i++)\n {\n if(k1;i--)\n {\n if(kmax)\n max=a[i];\n if(a[i]\nint main()\n{\n int m,n,x,y;\n long long int k,min=0,max=0,q=0;\n scanf(\"%d %d %lld %d %d\",&n,&m,&k,&x,&y);\n if(n==1)\n {\n min=k/m;\n k%=m;\n max=min;\n q=max;\n if(k)\n {\n ++max;\n if(k>=y)\n {\n ++q;\n }\n }\n }\n else if(n==2)\n {\n min=k/(2*m);\n max=min;\n q=max;\n if(k)\n {\n ++max;\n if(k>=((x-1)*m)+y)\n {\n ++q;\n }\n }\n }\n else\n {\n min=k/((m*n)+(m*(n-2)));\n max=2*min;\n k%=((m*n)+(m*(n-2)));\n if(x==n ||x==1)\n {\n q=min;\n }\n else\n {\n q=max;\n }\n if(k)\n {\n if(k>m && k=y)\n {\n ++q;\n }\n }\n else if(x==n)\n {\n if(k>=(m*(n-1))+y)\n {\n ++q;\n }\n }\n else\n {\n if(k>=(m*(x-1))+y)\n {\n ++q;\n k-=(m*(x-1))+y;\n }\n if(k>=(2*m*(n-x)))\n {\n ++q;\n }\n }\n }\n }\n printf(\"%lld %lld %lld\",max,min,q);\n return 0;\n}"}, {"source_code": "#include \nint main()\n{\n int m,n,x,y;\n long long int k,min=0,max=0,q=0;\n scanf(\"%d %d %lld %d %d\",&n,&m,&k,&x,&y);\n if(n==1)\n {\n min=k/m;\n k%=m;\n max=min;\n q=max;\n if(k)\n {\n ++max;\n if(k>=y)\n {\n ++q;\n }\n }\n }\n else if(n==2)\n {\n min=k/(2*m);\n k%=(2*m);\n max=min;\n q=max;\n if(k)\n {\n ++max;\n if(k>=((x-1)*m)+y)\n {\n ++q;\n }\n }\n }\n else\n {\n min=k/((m*n)+(m*(n-2)));\n max=2*min;\n k%=((m*n)+(m*(n-2)));\n if(x==n ||x==1)\n {\n q=min;\n }\n else\n {\n q=max;\n }\n if(k)\n {\n if(k>m && k=y)\n {\n ++q;\n }\n }\n else if(x==n)\n {\n if(k>=(m*(n-1))+y)\n {\n ++q;\n }\n }\n else\n {\n if(k>=(m*(x-1))+y)\n {\n ++q;\n k-=(m*(x-1))+y;\n if(k>=(2*m*(n-x)))\n {\n ++q;\n }\n }\n }\n }\n }\n printf(\"%lld %lld %lld\",max,min,q);\n return 0;\n}"}, {"source_code": "#include \nint main()\n{\n int m,n,x,y;\n long long int k,min=0,max=0,q=0;\n scanf(\"%d %d %lld %d %d\",&n,&m,&k,&x,&y);\n if(n==1)\n {\n min=k/m;\n k%=m;\n max=min;\n q=max;\n if(k)\n {\n ++max;\n if(k>=y)\n {\n ++q;\n }\n }\n }\n else if(n==2)\n {\n min=k/(2*m);\n max=min;\n q=max;\n if(k)\n {\n ++max;\n if(k>=((x-1)*m)+y)\n {\n ++q;\n }\n }\n }\n else\n {\n min=k/((m*n)+(m*(n-2)));\n max=2*min;\n k%=((m*n)+(m*(n-2)));\n if(x==n ||x==1)\n {\n q=min;\n }\n else\n {\n q=max;\n }\n if(k)\n {\n if(k>m && k=y)\n {\n ++q;\n }\n }\n else if(x==n)\n {\n if(k>=(m*(n-1))+y)\n {\n ++q;\n }\n }\n else\n {\n if(k>=(m*(x-1))+y)\n {\n ++q;\n k-=(m*(x-1))+y;\n if(k>=(2*m*(n-x)))\n {\n ++q;\n }\n }\n }\n }\n }\n printf(\"%lld %lld %lld\",max,min,q);\n return 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n\tlong long n,m,x,y;\n\tlong long k;\n scanf(\"%I64d %I64d %I64d %I64d %I64d\",&n,&m,&k,&x,&y);\n long long sb1,sb2;\n sb1=(x-1)*m+y;\n sb2=(n-x)*m+y;\n long long s=k/(n*m),h=k%(n*m);\n if(h==0)\n printf(\"%I64d %I64d %I64d\",s,s,s);\n else if(h%2==0)\n {\n \tprintf(\"%I64d %I64d \",s+1,s);\n \tif(h>=sb2)\n \tprintf(\"%I64d\",s+1);\n \telse\n \tprintf(\"%I64d\",s);\n }\n else if(h%2==1)\n {\n \tprintf(\"%I64d %I64d \",s+1,s);\n \tif(h>=sb1)\n \tprintf(\"%I64d\",s+1);\n \telse\n \tprintf(\"%I64d\",s);\n }\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n\tlong long n,m,x,y,a; \n\tlong long k;\n scanf(\"%I64d %I64d %I64d %I64d %I64d\",&n,&m,&k,&x,&y);\n a=n*m+(n-2)*m;\n long long sb1,sb2;\n long long s,h;\n if(n<3)\n {\n \ts=k/(n*m);\n \th=k%(n*m);\n \tsb1=(x-1)*m+y;\n \tsb2=(n-x)*m+y;\n \tif(h==0)\n \tprintf(\"%I64d %I64d %I64d\",s,s,s);\n \telse if(h%2==1)\n \t{\n \t\tif(h>=sb1)\n \t\tprintf(\"%I64d %I64d %I64d\",s+1,s,s+1);\n \t\telse\n \t\tprintf(\"%I64d %I64d %I64d\",s+1,s,s);\n\t\t}\n\t\telse if(h%2==0)\n\t\t{\n\t\t if(h>=sb2)\n \t \tprintf(\"%I64d %I64d %I64d\",s+1,s,s+1);\n \t\telse\n \t\tprintf(\"%I64d %I64d %I64d\",s+1,s,s);\n\t\t} \n\t}\n else\n {\n \tsb1=(x-1)*m+y;\n sb2=(n-x-1)*m+y;\n s=k/a,h=k%a;\n if(x==1||x==n)\n {\n \tif(h==0)\n printf(\"%I64d %I64d %I64d\",2*s,s,s);\n else if(x==1)\n {\n \tif(h=y&&h<=m)\n \tprintf(\"%I64d %I64d %I64d\",2*s,s,s+1);\n \telse if(h>=y&&hn*m)\n printf(\"%I64d %I64d %I64d\",2*s+2,s+1,s+1);\n\t\t}\n\t\telse if(x==n)\n\t\t{\n\t\t\tif(h<=m)\n\t\t\tprintf(\"%I64d %I64d %I64d\",2*s,s,s);\n\t\t\telse if(h<(n-1)*m+y)\n\t\t\tprintf(\"%I64d %I64d %I64d\",2*s+1,s,s);\n\t\t\telse if(h>=(n-1)*m+y&&hn*m)\n printf(\"%I64d %I64d %I64d\",2*s+2,s+1,s+1);\n\t\t}\n\t}\n\telse\n\t{\n if(h==0)\n printf(\"%I64d %I64d %I64d\",2*s,s,s);\n else if(h==n*m)\n printf(\"%I64d %I64d %I64d\",2*s+1,s+1,2*s+1);\n else if(hm&&h=sb1)\n \t printf(\"%I64d %I64d %I64d\",2*s+1,s,s+1);\n }\n else if(h>n*m)\n {\n \th=h-n*m;\n \tif(h=sb2)\n \t printf(\"%I64d %I64d %I64d\",2*s+2,s+1,2*s+2);\n }\n }\n }\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n\tlong long n,m,x,y,a; \n\tlong long k;\n scanf(\"%I64d %I64d %I64d %I64d %I64d\",&n,&m,&k,&x,&y);\n a=n*m+(n-2)*m;\n long long sb1,sb2;\n long long s,h;\n if(n<3)\n {\n \ts=k/(n*m);\n \th=k%(n*m);\n \tsb1=(x-1)*m+y;\n \tsb2=(n-x)*m+y;\n \tif(h==0)\n \tprintf(\"%I64d %I64d %I64d\",s,s,s);\n \telse if(h%2==1)\n \t{\n \t\tif(h>=sb1)\n \t\tprintf(\"%I64d %I64d %I64d\",s+1,s,s+1);\n \t\telse\n \t\tprintf(\"%I64d %I64d %I64d\",s+1,s,s);\n\t\t}\n\t\telse if(h%2==0)\n\t\t{\n\t\t if(h>=sb2)\n \t \tprintf(\"%I64d %I64d %I64d\",s+1,s,s+1);\n \t\telse\n \t\tprintf(\"%I64d %I64d %I64d\",s+1,s,s);\n\t\t} \n\t}\n else\n {\n \tsb1=(x-1)*m+y;\n sb2=(n-x-1)*m+y;\n s=k/a,h=k%a;\n if(s!=0)\n {\n if(x==1||x==n)\n {\n \tif(h==0)\n printf(\"%I64d %I64d %I64d\",2*s,s,s);\n else if(x==1)\n {\n \tif(h=y&&h<=m)\n \tprintf(\"%I64d %I64d %I64d\",2*s,s,s+1);\n \telse if(h>=y&&hn*m)\n printf(\"%I64d %I64d %I64d\",2*s+2,s+1,s+1);\n\t\t}\n\t\telse if(x==n)\n\t\t{\n\t\t\tif(h<=m)\n\t\t\tprintf(\"%I64d %I64d %I64d\",2*s,s,s);\n\t\t\telse if(h<(n-1)*m+y)\n\t\t\tprintf(\"%I64d %I64d %I64d\",2*s+1,s,s);\n\t\t\telse if(h>=(n-1)*m+y&&hn*m)\n printf(\"%I64d %I64d %I64d\",2*s+2,s+1,s+1);\n\t\t}\n\t}\n\telse\n\t{\n if(h==0)\n printf(\"%I64d %I64d %I64d\",2*s,s,2*s);\n else if(h==n*m)\n printf(\"%I64d %I64d %I64d\",2*s+1,s+1,2*s+1);\n else if(hm&&h=sb1)\n \t printf(\"%I64d %I64d %I64d\",2*s+1,s,2*s+1);\n }\n else if(h>n*m)\n {\n \th=h-n*m;\n \tif(h=sb2)\n \t printf(\"%I64d %I64d %I64d\",2*s+2,s+1,2*s+2);\n }\n }\n }\n else\n {\n \tif(h==0)\n \tprintf(\"0 0 0\");\n \tif(h==n*m)\n \tprintf(\"1 1 1\");\n \telse if(x==1||x==n)\n \t{\n \t\tif(x==1)\n \t\t{\n \t\t\tif(h=y&&hn*m)\n \t\t\tprintf(\"2 1 1\");\n \t\t\t\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(h<(n-1)*m+y)\n\t\t\t\tprintf(\"1 0 0\");\n\t\t\t\telse if(h>=(n-1)*m+y&&hn*m)\n\t\t\t\tprintf(\"2 1 1\");\n\t\t\t}\n\t\t}\n \telse if(h>n*m&&(h-n*m)<(n-x-1)*m+y)\n \tprintf(\"2 1 1\");\n\t\telse if(h>n*m&&(h-n*m)>=(n-x-1)*m+y)\n \tprintf(\"2 1 2\");\n \telse if(h=(x-1)*m+y)\n \tprintf(\"1 0 1\");\n \telse if(h<(x-1)*m+y)\n \tprintf(\"1 0 0\");\n\t}\n }\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n\tlong long n,m,x,y,a; \n\tlong long k;\n scanf(\"%I64d %I64d %I64d %I64d %I64d\",&n,&m,&k,&x,&y);\n a=n*m+(n-2)*m;\n long long sb1,sb2;\n long long s,h;\n if(n<3)\n {\n \ts=k/(n*m);\n \th=k%(n*m);\n \tsb1=(x-1)*m+y;\n \tsb2=(n-x)*m+y;\n \tif(h==0)\n \tprintf(\"%I64d %I64d %I64d\",s,s,s);\n \telse if(h%2==1)\n \t{\n \t\tif(h>=sb1)\n \t\tprintf(\"%I64d %I64d %I64d\",s+1,s,s+1);\n \t\telse\n \t\tprintf(\"%I64d %I64d %I64d\",s+1,s,s);\n\t\t}\n\t\telse if(h%2==0)\n\t\t{\n\t\t if(h>=sb2)\n \t \tprintf(\"%I64d %I64d %I64d\",s+1,s,s+1);\n \t\telse\n \t\tprintf(\"%I64d %I64d %I64d\",s+1,s,s);\n\t\t} \n\t}\n else\n {\n \tsb1=(x-1)*m+y;\n sb2=(n-x-1)*m+y;\n s=k/a,h=k%a;\n if(x==1||x==n)\n {\n \tif(h==0)\n printf(\"%I64d %I64d %I64d\",2*s,s,s);\n else if(x==1)\n {\n \tif(h=y&&h<=m)\n \tprintf(\"%I64d %I64d %I64d\",2*s,s,s+1);\n \telse if(h>=y&&hn*m)\n printf(\"%I64d %I64d %I64d\",2*s+2,s+1,s+1);\n\t\t}\n\t\telse if(x==n)\n\t\t{\n\t\t\tif(h<=m)\n\t\t\tprintf(\"%I64d %I64d %I64d\",2*s,s,s);\n\t\t\telse if(h<(n-1)*m+y)\n\t\t\tprintf(\"%I64d %I64d %I64d\",2*s+1,s,s);\n\t\t\telse if(h>=(n-1)*m+y&&hn*m)\n printf(\"%I64d %I64d %I64d\",2*s+2,s+1,s+1);\n\t\t}\n\t}\n\telse\n\t{\n if(h==0)\n printf(\"%I64d %I64d %I64d\",2*s,s,2*s);\n else if(h==n*m)\n printf(\"%I64d %I64d %I64d\",2*s+1,s+1,2*s+1);\n else if(hm&&h=sb1)\n \t printf(\"%I64d %I64d %I64d\",2*s+1,s,2*s+1);\n }\n else if(h>n*m)\n {\n \th=h-n*m;\n \tif(h=sb2)\n \t printf(\"%I64d %I64d %I64d\",2*s+2,s+1,2*s+2);\n }\n }\n }\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n\tlong long n,m,x,y,a; \n\tlong long k;\n scanf(\"%I64d %I64d %I64d %I64d %I64d\",&n,&m,&k,&x,&y);\n a=n*m+(n-2)*m;\n long long sb1,sb2;\n long long s,h;\n if(n<3)\n {\n \ts=k/(n*m);\n \th=k%(n*m);\n \tsb1=(x-1)*m+y;\n \tsb2=(n-x)*m+y;\n \tif(h==0)\n \tprintf(\"%I64d %I64d %I64d\",s,s,s);\n \telse if(s%2==0)\n \t{\n \t\tif(h>=sb1)\n \t\tprintf(\"%I64d %I64d %I64d\",s+1,s,s+1);\n \t\telse\n \t\tprintf(\"%I64d %I64d %I64d\",s+1,s,s);\n\t\t}\n\t\telse if(s%2==1)\n\t\t{\n\t\t if(h>=sb2)\n \t \tprintf(\"%I64d %I64d %I64d\",s+1,s,s+1);\n \t\telse\n \t\tprintf(\"%I64d %I64d %I64d\",s+1,s,s);\n\t\t} \n\t}\n else\n {\n \tsb1=(x-1)*m+y;\n sb2=(n-x-1)*m+y;\n s=k/a,h=k%a;\n if(s!=0)\n {\n if(x==1||x==n)\n {\n \tif(h==0)\n printf(\"%I64d %I64d %I64d\",2*s,s,s);\n else if(x==1)\n {\n \tif(h=y&&h<=m)\n \tprintf(\"%I64d %I64d %I64d\",2*s,s,s+1);\n \telse if(h>=y&&hn*m)\n printf(\"%I64d %I64d %I64d\",2*s+2,s+1,s+1);\n\t\t}\n\t\telse if(x==n)\n\t\t{\n\t\t\tif(h<=m)\n\t\t\tprintf(\"%I64d %I64d %I64d\",2*s,s,s);\n\t\t\telse if(h<(n-1)*m+y)\n\t\t\tprintf(\"%I64d %I64d %I64d\",2*s+1,s,s);\n\t\t\telse if(h>=(n-1)*m+y&&hn*m)\n printf(\"%I64d %I64d %I64d\",2*s+2,s+1,s+1);\n\t\t}\n\t}\n\telse\n\t{\n if(h==0)\n printf(\"%I64d %I64d %I64d\",2*s,s,2*s);\n else if(h==n*m)\n printf(\"%I64d %I64d %I64d\",2*s+1,s+1,2*s+1);\n else if(hm&&h=sb1)\n \t printf(\"%I64d %I64d %I64d\",2*s+1,s,2*s+1);\n }\n else if(h>n*m)\n {\n \th=h-n*m;\n \tif(h=sb2)\n \t printf(\"%I64d %I64d %I64d\",2*s+2,s+1,2*s+2);\n }\n }\n }\n else\n {\n \tif(h==0)\n \tprintf(\"0 0 0\");\n \tif(h==n*m)\n \tprintf(\"1 1 1\");\n //\tif(n>=3)\n //\t{\n \telse if(x==1||x==n)\n \t{\n \t\tif(x==1)\n \t\t{\n \t\t\tif(h=y&&hn*m)\n \t\t\tprintf(\"2 1 1\");\n \t\t\t\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(h<(n-1)*m+y)\n\t\t\t\tprintf(\"1 0 0\");\n\t\t\t\telse if(h>=(n-1)*m+y&&hn*m)\n\t\t\t\tprintf(\"2 1 1\");\n\t\t\t}\n\t\t}\n \telse if(h>n*m&&(h-n*m)<(n-x-1)*m+y)\n \tprintf(\"2 1 1\");\n\t\telse if(h>n*m&&(h-n*m)>=(n-x-1)*m+y)\n \tprintf(\"2 1 2\");\n \telse if(h=(x-1)*m+y)\n \tprintf(\"1 0 1\");\n \telse if(h<(x-1)*m+y)\n \tprintf(\"1 0 0\");\n // }\n //else//n<3\n //{\n \t\n\t\t//}\n\t}\n }\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n\tlong long n,m,x,y,a; \n\tlong long k;\n scanf(\"%I64d %I64d %I64d %I64d %I64d\",&n,&m,&k,&x,&y);\n a=n*m+(n-2)*m;\n long long sb1,sb2;\n long long s,h;\n if(n<3)\n {\n \ts=k/(n*m);\n \th=k%(n*m);\n \tsb1=(x-1)*m+y;\n \tsb2=(n-x)*m+y;\n \tif(h==0)\n \tprintf(\"%I64d %I64d %I64d\",s,s,s);\n \telse if(h%2==1)\n \t{\n \t\tif(h>=sb1)\n \t\tprintf(\"%I64d %I64d %I64d\",s+1,s,s+1);\n \t\telse\n \t\tprintf(\"%I64d %I64d %I64d\",s+1,s,s);\n\t\t}\n\t\telse if(h%2==0)\n\t\t{\n\t\t if(h>=sb2)\n \t \tprintf(\"%I64d %I64d %I64d\",s+1,s,s+1);\n \t\telse\n \t\tprintf(\"%I64d %I64d %I64d\",s+1,s,s);\n\t\t} \n\t}\n else\n {\n \tsb1=(x-1)*m+y;\n sb2=(n-x-1)*m+y;\n s=k/a,h=k%a;\n if(x==1||x==n)\n {\n \tif(h==0)\n printf(\"%I64d %I64d %I64d\",2*s,s,s);\n else if(x==1)\n {\n \tif(h=y&&h<=m)\n \tprintf(\"%I64d %I64d %I64d\",2*s,s,s+1);\n \telse if(h>=y&&hn*m)\n printf(\"%I64d %I64d %I64d\",2*s+2,s+1,s+1);\n\t\t}\n\t\telse if(x==n)\n\t\t{\n\t\t\tif(h<=m)\n\t\t\tprintf(\"%I64d %I64d %I64d\",2*s,s,s);\n\t\t\telse if(h<(n-1)*m+y)\n\t\t\tprintf(\"%I64d %I64d %I64d\",2*s+1,s,s);\n\t\t\telse if(h>=(n-1)*m+y&&hn*m)\n printf(\"%I64d %I64d %I64d\",2*s+2,s+1,s+1);\n\t\t}\n\t}\n\telse\n\t{\n if(h==0)\n printf(\"%I64d %I64d %I64d\",2*s,s,2*s);\n else if(h==n*m)\n printf(\"%I64d %I64d %I64d\",2*s+1,s+1,2*s+1);\n else if(hm&&h=sb1)\n \t printf(\"%I64d %I64d %I64d\",2*s+1,s,s+1);\n }\n else if(h>n*m)\n {\n \th=h-n*m;\n \tif(h=sb2)\n \t printf(\"%I64d %I64d %I64d\",2*s+2,s+1,2*s+2);\n }\n }\n }\n\treturn 0;\n}\n"}], "src_uid": "e61debcad37eaa9a6e21d7a2122b8b21"} {"nl": {"description": "One day, BThero decided to play around with arrays and came up with the following problem:You are given an array $$$a$$$, which consists of $$$n$$$ positive integers. The array is numerated $$$1$$$ through $$$n$$$. You execute the following procedure exactly once: You create a new array $$$b$$$ which consists of $$$2n$$$ positive integers, where for each $$$1 \\le i \\le n$$$ the condition $$$b_{2i-1}+b_{2i} = a_i$$$ holds. For example, for the array $$$a = [6, 8, 2]$$$ you can create $$$b = [2, 4, 4, 4, 1, 1]$$$. You merge consecutive equal numbers in $$$b$$$. For example, $$$b = [2, 4, 4, 4, 1, 1]$$$ becomes $$$b = [2, 4, 1]$$$. Find and print the minimum possible value of $$$|b|$$$ (size of $$$b$$$) which can be achieved at the end of the procedure. It can be shown that under the given constraints there is at least one way to construct $$$b$$$.", "input_spec": "The first line of the input file contains a single integer $$$T$$$ ($$$1 \\le T \\le 5 \\cdot 10^5$$$) denoting the number of test cases. The description of $$$T$$$ test cases follows. The first line of each test contains a single integer $$$n$$$ ($$$1 \\le n \\le 5 \\cdot 10^5$$$). The second line contains $$$n$$$ space-separated integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ ($$$2 \\le a_i \\le 10^9$$$). It is guaranteed that $$$\\sum{n}$$$ over all test cases does not exceed $$$5 \\cdot 10^5$$$.", "output_spec": "For each test case, print a single line containing one integer — the minimum possible value of $$$|b|$$$.", "sample_inputs": ["3\n3\n6 8 2\n1\n4\n3\n5 6 6"], "sample_outputs": ["3\n1\n2"], "notes": null}, "positive_code": [{"source_code": "#include \n#include \n#include \n\n#define N\t500000\n#define INF\t0x3f3f3f3f\n\nint min(int a, int b) { return a < b ? a : b; }\nint max(int a, int b) { return a > b ? a : b; }\n\nunsigned int X;\n\nvoid srand_() {\n\tstruct timeval tv;\n\n\tgettimeofday(&tv, NULL);\n\tX = tv.tv_sec ^ tv.tv_usec;\n}\n\nint rand_() {\n\treturn (X *= 3) >> 1;\n}\n\nlong long ss[N + 1];\n\nvoid sort(int *ii, int l, int r) {\n\twhile (l < r) {\n\t\tint i = l, j = l, k = r, i_ = ii[l + rand_() % (r - l)], tmp;\n\n\t\twhile (j < k) {\n\t\t\tint c = ss[ii[j]] != ss[i_] ? ss[ii[j]] - ss[i_] : ii[j] - i_;\n\n\t\t\tif (c == 0)\n\t\t\t\tj++;\n\t\t\telse if (c < 0) {\n\t\t\t\ttmp = ii[i], ii[i] = ii[j], ii[j] = tmp;\n\t\t\t\ti++, j++;\n\t\t\t} else {\n\t\t\t\tk--;\n\t\t\t\ttmp = ii[j], ii[j] = ii[k], ii[k] = tmp;\n\t\t\t}\n\t\t}\n\t\tsort(ii, l, i);\n\t\tl = k;\n\t}\n}\n\nint search(int *ii, int n, long long s) {\n\tint lower = -1, upper = n;\n\n\twhile (upper - lower > 1) {\n\t\tint h = (lower + upper) / 2;\n\n\t\tif (ss[ii[h]] >= s)\n\t\t\tupper = h;\n\t\telse\n\t\t\tlower = h;\n\t}\n\treturn lower;\n}\n\nint ft1[N + 1], ft2[N + 1];\n\nvoid update(int *ft, int i, int n, int x) {\n\twhile (i < n) {\n\t\tft[i] = min(ft[i], x);\n\t\ti |= i + 1;\n\t}\n}\n\nint query(int *ft, int i) {\n\tint x = INF;\n\n\twhile (i >= 0) {\n\t\tx = min(x, ft[i]);\n\t\ti &= i + 1, i--;\n\t}\n\treturn x;\n}\n\nint main() {\n\tint t;\n\n\tsrand_();\n\tscanf(\"%d\", &t);\n\twhile (t--) {\n\t\tstatic int aa[N + 1], qu[2][N + 1], head[2], cnt[2], ii[N], ll[N + 1], ll_[N + 1], rr_[N + 1], pp[N + 1], dp[N + 1], dq[N + 1];\n\t\tint n, h, h_, i, j;\n\t\tlong long sum;\n\n\t\tscanf(\"%d\", &n);\n\t\tfor (i = 1; i <= n; i++)\n\t\t\tscanf(\"%d\", &aa[i]), aa[i] -= 2;\n\t\tfor (i = 1; i <= n; i++)\n\t\t\tss[i] = aa[i] - (i == 0 ? 0 : ss[i - 1]);\n\t\thead[0] = cnt[0] = head[1] = cnt[1] = 0;\n\t\tfor (i = 0, j = 0; j <= n; j++) {\n\t\t\twhile (cnt[j % 2] && ss[qu[j % 2][head[j % 2] + cnt[j % 2] - 1]] >= ss[j])\n\t\t\t\tcnt[j % 2]--;\n\t\t\tqu[j % 2][head[j % 2] + cnt[j % 2]++] = j;\n\t\t\twhile (i < j && ss[qu[0][head[0]]] + ss[qu[1][head[1]]] < 0) {\n\t\t\t\tif (qu[i % 2][head[i % 2]] == i)\n\t\t\t\t\thead[i % 2]++, cnt[i % 2]--;\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tll[j] = i;\n\t\t\tif (j > 0 && aa[j] % 2 == 0) {\n\t\t\t\th = search(qu[j % 2] + head[j % 2], cnt[j % 2], ss[j] - aa[j] / 2);\n\t\t\t\tll_[j] = h == -1 ? i : qu[j % 2][head[j % 2] + h] + 1;\n\t\t\t\th = search(qu[j % 2 ^ 1] + head[j % 2 ^ 1], cnt[j % 2 ^ 1], aa[j] / 2 - ss[j]);\n\t\t\t\tll_[j] = max(ll_[j], h == -1 ? i : qu[j % 2 ^ 1][head[j % 2 ^ 1] + h] + 1);\n\t\t\t}\n\t\t}\n\t\tcnt[0] = cnt[1] = 0;\n\t\tfor (i = n; i > 0; i--) {\n\t\t\twhile (cnt[i % 2] && ss[qu[i % 2][cnt[i % 2] - 1]] >= ss[i])\n\t\t\t\tcnt[i % 2]--;\n\t\t\tqu[i % 2][cnt[i % 2]++] = i;\n\t\t\tif (i > 0 && aa[i] % 2 == 0) {\n\t\t\t\th = search(qu[i % 2], cnt[i % 2], ss[i] - aa[i] / 2);\n\t\t\t\trr_[i] = h == -1 ? n : qu[i % 2][h] - 1;\n\t\t\t\th = search(qu[i % 2 ^ 1], cnt[i % 2 ^ 1], aa[i] / 2 - ss[i]);\n\t\t\t\trr_[i] = min(rr_[i], h == -1 ? n : qu[i % 2 ^ 1][h] - 1);\n\t\t\t}\n\t\t}\n\t\tsum = 0;\n\t\tfor (i = 1; i <= n; i++) {\n\t\t\tss[i] = sum + (i % 2 == 0 ? aa[i] / 2 : -aa[i] / 2);\n\t\t\tsum += i % 2 == 0 ? aa[i] : -aa[i];\n\t\t\tii[i - 1] = i;\n\t\t}\n\t\tsort(ii, 0, n);\n\t\tfor (h = 0; h < n; h = h_) {\n\t\t\tlong long s = ss[ii[h]];\n\n\t\t\th_ = h, i = 0;\n\t\t\twhile (h_ < n && ss[ii[h_]] == s) {\n\t\t\t\tif (aa[ii[h_]] % 2 == 0)\n\t\t\t\t\tpp[ii[h_]] = i, i = ii[h_];\n\t\t\t\telse\n\t\t\t\t\tpp[ii[h_]] = 0;\n\t\t\t\th_++;\n\t\t\t}\n\t\t}\n\t\tmemset(ft1, 0x3f, (n + 1) * sizeof *ft1);\n\t\tmemset(ft2, 0x3f, (n + 1) * sizeof *ft2);\n\t\tupdate(ft1, n - 0, n + 1, 0);\n\t\tfor (i = 1; i <= n; i++) {\n\t\t\tdp[i] = min(query(ft2, n - i), query(ft1, n - ll[i]) + 1);\n\t\t\tif (aa[i] % 2 == 0) {\n\t\t\t\tdq[i] = query(ft1, n - ll_[i]);\n\t\t\t\tif (pp[i] && ll_[i] <= pp[i])\n\t\t\t\t\tdq[i] = min(dq[i], dq[pp[i]] - 1);\n\t\t\t} else\n\t\t\t\tdq[i] = INF;\n\t\t\tupdate(ft1, n - i, n + 1, dp[i]);\n\t\t\tif (dq[i] != INF) {\n\t\t\t\tupdate(ft1, n - i, n + 1, dq[i]);\n\t\t\t\tupdate(ft2, n - rr_[i], n + 1, dq[i]);\n\t\t\t}\n\t\t}\n\t\tprintf(\"%d\\n\", n + min(dp[n], dq[n]));\n\t}\n\treturn 0;\n}\n"}], "negative_code": [{"source_code": "#include \n#include \n#include \n\n#define N\t500000\n#define INF\t0x3f3f3f3f\n\nint min(int a, int b) { return a < b ? a : b; }\nint max(int a, int b) { return a > b ? a : b; }\n\nunsigned int X;\n\nvoid srand_() {\n\tstruct timeval tv;\n\n\tgettimeofday(&tv, NULL);\n\tX = tv.tv_sec ^ tv.tv_usec;\n}\n\nint rand_() {\n\treturn (X *= 3) >> 1;\n}\n\nlong long ss[N + 1];\n\nvoid sort(int *ii, int l, int r) {\n\twhile (l < r) {\n\t\tint i = l, j = l, k = r, i_ = ii[l + rand_() % (r - l)], tmp;\n\n\t\twhile (j < k)\n\t\t\tif (ss[ii[j]] == ss[i_])\n\t\t\t\tj++;\n\t\t\telse if (ss[ii[j]] < ss[i_]) {\n\t\t\t\ttmp = ii[i], ii[i] = ii[j], ii[j] = tmp;\n\t\t\t\ti++, j++;\n\t\t\t} else {\n\t\t\t\tk--;\n\t\t\t\ttmp = ii[j], ii[j] = ii[k], ii[k] = tmp;\n\t\t\t}\n\t\tsort(ii, l, i);\n\t\tl = k;\n\t}\n}\n\nint search(int *ii, int n, long long s) {\n\tint lower = -1, upper = n;\n\n\twhile (upper - lower > 1) {\n\t\tint h = (lower + upper) / 2;\n\n\t\tif (ss[ii[h]] >= s)\n\t\t\tupper = h;\n\t\telse\n\t\t\tlower = h;\n\t}\n\treturn lower;\n}\n\nint ft1[N + 1], ft2[N + 1];\n\nvoid update(int *ft, int i, int n, int x) {\n\twhile (i < n) {\n\t\tft[i] = min(ft[i], x);\n\t\ti |= i + 1;\n\t}\n}\n\nint query(int *ft, int i) {\n\tint x = INF;\n\n\twhile (i >= 0) {\n\t\tx = min(x, ft[i]);\n\t\ti &= i + 1, i--;\n\t}\n\treturn x;\n}\n\nint main() {\n\tint t;\n\n\tsrand_();\n\tscanf(\"%d\", &t);\n\twhile (t--) {\n\t\tstatic int aa[N + 1], qu[2][N + 1], head[2], cnt[2], ii[N], ll[N + 1], ll_[N + 1], rr_[N + 1], pp[N + 1], dp[N + 1], dq[N + 1];\n\t\tint n, h, h_, i, j;\n\t\tlong long sum;\n\n\t\tscanf(\"%d\", &n);\n\t\tfor (i = 1; i <= n; i++)\n\t\t\tscanf(\"%d\", &aa[i]), aa[i] -= 2;\n\t\tfor (i = 1; i <= n; i++)\n\t\t\tss[i] = aa[i] - (i == 0 ? 0 : ss[i - 1]);\n\t\thead[0] = cnt[0] = head[1] = cnt[1] = 0;\n\t\tfor (i = 0, j = 0; j <= n; j++) {\n\t\t\twhile (cnt[j % 2] && ss[qu[j % 2][head[j % 2] + cnt[j % 2] - 1]] >= ss[j])\n\t\t\t\tcnt[j % 2]--;\n\t\t\tqu[j % 2][head[j % 2] + cnt[j % 2]++] = j;\n\t\t\twhile (ss[qu[0][head[0]]] + ss[qu[1][head[1]]] < 0) {\n\t\t\t\tif (qu[i % 2][head[i % 2]] == i)\n\t\t\t\t\thead[i % 2]++, cnt[i % 2]--;\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tll[j] = i;\n\t\t\tif (j > 0 && aa[j] % 2 == 0) {\n\t\t\t\th = search(qu[j % 2] + head[j % 2], cnt[j % 2], ss[j] - aa[j] / 2);\n\t\t\t\tll_[j] = h == -1 ? 0 : qu[j % 2][head[j % 2] + h] + 1;\n\t\t\t\th = search(qu[j % 2 ^ 1] + head[j % 2 ^ 1], cnt[j % 2 ^ 1], aa[j] / 2 - ss[j]);\n\t\t\t\tll_[j] = max(ll_[j], h == -1 ? 0 : qu[j % 2 ^ 1][head[j % 2 ^ 1] + h] + 1);\n\t\t\t}\n\t\t}\n\t\tcnt[0] = cnt[1] = 0;\n\t\tfor (i = n; i > 0; i--) {\n\t\t\twhile (cnt[i % 2] && ss[qu[i % 2][cnt[i % 2] - 1]] >= ss[i])\n\t\t\t\tcnt[i % 2]--;\n\t\t\tqu[i % 2][cnt[i % 2]++] = i;\n\t\t\tif (i > 0 && aa[i] % 2 == 0) {\n\t\t\t\th = search(qu[i % 2], cnt[i % 2], ss[i] - aa[i] / 2);\n\t\t\t\trr_[i] = h == -1 ? n : qu[i % 2][h] - 1;\n\t\t\t\th = search(qu[i % 2 ^ 1], cnt[i % 2 ^ 1], aa[i] / 2 - ss[i]);\n\t\t\t\trr_[i] = min(rr_[i], h == -1 ? n : qu[i % 2 ^ 1][h] - 1);\n\t\t\t}\n\t\t}\n\t\tsum = 0;\n\t\tfor (i = 1; i <= n; i++) {\n\t\t\tss[i] = sum + (i % 2 == 0 ? aa[i] / 2 : -aa[i] / 2);\n\t\t\tsum += i % 2 == 0 ? aa[i] : -aa[i];\n\t\t\tii[i - 1] = i;\n\t\t}\n\t\tsort(ii, 0, n);\n\t\tfor (h = 0; h < n; h = h_) {\n\t\t\tlong long s = ss[ii[h]];\n\n\t\t\th_ = h, i = 0;\n\t\t\twhile (h_ < n && ss[ii[h_]] == s) {\n\t\t\t\tif (aa[ii[h_]] % 2 == 0)\n\t\t\t\t\tpp[ii[h_]] = i, i = ii[h_];\n\t\t\t\telse\n\t\t\t\t\tpp[ii[h_]] = 0;\n\t\t\t\th_++;\n\t\t\t}\n\t\t}\n\t\tmemset(ft1, 0x3f, (n + 1) * sizeof *ft1);\n\t\tmemset(ft2, 0x3f, (n + 1) * sizeof *ft2);\n\t\tupdate(ft1, n - 0, n + 1, 0);\n\t\tfor (i = 1; i <= n; i++) {\n\t\t\tdp[i] = min(query(ft2, n - i), query(ft1, n - ll[i]) + 1);\n\t\t\tif (aa[i] % 2 == 0) {\n\t\t\t\tdq[i] = query(ft1, n - ll_[i]);\n\t\t\t\tif (pp[i] && ll_[i] <= pp[i])\n\t\t\t\t\tdq[i] = min(dq[i], dq[pp[i]] - 1);\n\t\t\t} else\n\t\t\t\tdq[i] = INF;\n\t\t\tupdate(ft1, n - i, n + 1, dp[i]);\n\t\t\tif (dq[i] != INF) {\n\t\t\t\tupdate(ft1, n - i, n + 1, dq[i]);\n\t\t\t\tupdate(ft2, n - rr_[i], n + 1, dq[i]);\n\t\t\t}\n\t\t}\n\t\tprintf(\"%d\\n\", n + min(dp[n], dq[n]));\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\n#define N\t500000\n#define INF\t0x3f3f3f3f\n\nint min(int a, int b) { return a < b ? a : b; }\nint max(int a, int b) { return a > b ? a : b; }\n\nunsigned int X;\n\nvoid srand_() {\n\tstruct timeval tv;\n\n\tgettimeofday(&tv, NULL);\n\tX = tv.tv_sec ^ tv.tv_usec;\n}\n\nint rand_() {\n\treturn (X *= 3) >> 1;\n}\n\nlong long ss[N + 1];\n\nvoid sort(int *ii, int l, int r) {\n\twhile (l < r) {\n\t\tint i = l, j = l, k = r, i_ = ii[l + rand_() % (r - l)], tmp;\n\n\t\twhile (j < k) {\n\t\t\tint c = ss[ii[j]] != ss[i_] ? ss[ii[j]] - ss[i_] : ii[j] - i_;\n\n\t\t\tif (c == 0)\n\t\t\t\tj++;\n\t\t\telse if (c < 0) {\n\t\t\t\ttmp = ii[i], ii[i] = ii[j], ii[j] = tmp;\n\t\t\t\ti++, j++;\n\t\t\t} else {\n\t\t\t\tk--;\n\t\t\t\ttmp = ii[j], ii[j] = ii[k], ii[k] = tmp;\n\t\t\t}\n\t\t}\n\t\tsort(ii, l, i);\n\t\tl = k;\n\t}\n}\n\nint search(int *ii, int n, long long s) {\n\tint lower = -1, upper = n;\n\n\twhile (upper - lower > 1) {\n\t\tint h = (lower + upper) / 2;\n\n\t\tif (ss[ii[h]] >= s)\n\t\t\tupper = h;\n\t\telse\n\t\t\tlower = h;\n\t}\n\treturn lower;\n}\n\nint ft1[N + 1], ft2[N + 1];\n\nvoid update(int *ft, int i, int n, int x) {\n\twhile (i < n) {\n\t\tft[i] = min(ft[i], x);\n\t\ti |= i + 1;\n\t}\n}\n\nint query(int *ft, int i) {\n\tint x = INF;\n\n\twhile (i >= 0) {\n\t\tx = min(x, ft[i]);\n\t\ti &= i + 1, i--;\n\t}\n\treturn x;\n}\n\nint main() {\n\tint t;\n\n\tsrand_();\n\tscanf(\"%d\", &t);\n\twhile (t--) {\n\t\tstatic int aa[N + 1], qu[2][N + 1], head[2], cnt[2], ii[N], ll[N + 1], ll_[N + 1], rr_[N + 1], pp[N + 1], dp[N + 1], dq[N + 1];\n\t\tint n, h, h_, i, j;\n\t\tlong long sum;\n\n\t\tscanf(\"%d\", &n);\n\t\tfor (i = 1; i <= n; i++)\n\t\t\tscanf(\"%d\", &aa[i]), aa[i] -= 2;\n\t\tfor (i = 1; i <= n; i++)\n\t\t\tss[i] = aa[i] - (i == 0 ? 0 : ss[i - 1]);\n\t\thead[0] = cnt[0] = head[1] = cnt[1] = 0;\n\t\tfor (i = 0, j = 0; j <= n; j++) {\n\t\t\twhile (cnt[j % 2] && ss[qu[j % 2][head[j % 2] + cnt[j % 2] - 1]] >= ss[j])\n\t\t\t\tcnt[j % 2]--;\n\t\t\tqu[j % 2][head[j % 2] + cnt[j % 2]++] = j;\n\t\t\twhile (ss[qu[0][head[0]]] + ss[qu[1][head[1]]] < 0) {\n\t\t\t\tif (qu[i % 2][head[i % 2]] == i)\n\t\t\t\t\thead[i % 2]++, cnt[i % 2]--;\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tll[j] = i;\n\t\t\tif (j > 0 && aa[j] % 2 == 0) {\n\t\t\t\th = search(qu[j % 2] + head[j % 2], cnt[j % 2], ss[j] - aa[j] / 2);\n\t\t\t\tll_[j] = h == -1 ? 0 : qu[j % 2][head[j % 2] + h] + 1;\n\t\t\t\th = search(qu[j % 2 ^ 1] + head[j % 2 ^ 1], cnt[j % 2 ^ 1], aa[j] / 2 - ss[j]);\n\t\t\t\tll_[j] = max(ll_[j], h == -1 ? 0 : qu[j % 2 ^ 1][head[j % 2 ^ 1] + h] + 1);\n\t\t\t}\n\t\t}\n\t\tcnt[0] = cnt[1] = 0;\n\t\tfor (i = n; i > 0; i--) {\n\t\t\twhile (cnt[i % 2] && ss[qu[i % 2][cnt[i % 2] - 1]] >= ss[i])\n\t\t\t\tcnt[i % 2]--;\n\t\t\tqu[i % 2][cnt[i % 2]++] = i;\n\t\t\tif (i > 0 && aa[i] % 2 == 0) {\n\t\t\t\th = search(qu[i % 2], cnt[i % 2], ss[i] - aa[i] / 2);\n\t\t\t\trr_[i] = h == -1 ? n : qu[i % 2][h] - 1;\n\t\t\t\th = search(qu[i % 2 ^ 1], cnt[i % 2 ^ 1], aa[i] / 2 - ss[i]);\n\t\t\t\trr_[i] = min(rr_[i], h == -1 ? n : qu[i % 2 ^ 1][h] - 1);\n\t\t\t}\n\t\t}\n\t\tsum = 0;\n\t\tfor (i = 1; i <= n; i++) {\n\t\t\tss[i] = sum + (i % 2 == 0 ? aa[i] / 2 : -aa[i] / 2);\n\t\t\tsum += i % 2 == 0 ? aa[i] : -aa[i];\n\t\t\tii[i - 1] = i;\n\t\t}\n\t\tsort(ii, 0, n);\n\t\tfor (h = 0; h < n; h = h_) {\n\t\t\tlong long s = ss[ii[h]];\n\n\t\t\th_ = h, i = 0;\n\t\t\twhile (h_ < n && ss[ii[h_]] == s) {\n\t\t\t\tif (aa[ii[h_]] % 2 == 0)\n\t\t\t\t\tpp[ii[h_]] = i, i = ii[h_];\n\t\t\t\telse\n\t\t\t\t\tpp[ii[h_]] = 0;\n\t\t\t\th_++;\n\t\t\t}\n\t\t}\n\t\tmemset(ft1, 0x3f, (n + 1) * sizeof *ft1);\n\t\tmemset(ft2, 0x3f, (n + 1) * sizeof *ft2);\n\t\tupdate(ft1, n - 0, n + 1, 0);\n\t\tfor (i = 1; i <= n; i++) {\n\t\t\tdp[i] = min(query(ft2, n - i), query(ft1, n - ll[i]) + 1);\n\t\t\tif (aa[i] % 2 == 0) {\n\t\t\t\tdq[i] = query(ft1, n - ll_[i]);\n\t\t\t\tif (pp[i] && ll_[i] <= pp[i])\n\t\t\t\t\tdq[i] = min(dq[i], dq[pp[i]] - 1);\n\t\t\t} else\n\t\t\t\tdq[i] = INF;\n\t\t\tupdate(ft1, n - i, n + 1, dp[i]);\n\t\t\tif (dq[i] != INF) {\n\t\t\t\tupdate(ft1, n - i, n + 1, dq[i]);\n\t\t\t\tupdate(ft2, n - rr_[i], n + 1, dq[i]);\n\t\t\t}\n\t\t}\n\t\tprintf(\"%d\\n\", n + min(dp[n], dq[n]));\n\t}\n\treturn 0;\n}\n"}], "src_uid": "e809d068b3ae47eb5ecfb9ac69892254"} {"nl": {"description": "In the spirit of the holidays, Saitama has given Genos two grid paths of length n (a weird gift even by Saitama's standards). A grid path is an ordered sequence of neighbouring squares in an infinite grid. Two squares are neighbouring if they share a side.One example of a grid path is (0, 0) → (0, 1) → (0, 2) → (1, 2) → (1, 1) → (0, 1) → ( - 1, 1). Note that squares in this sequence might be repeated, i.e. path has self intersections.Movement within a grid path is restricted to adjacent squares within the sequence. That is, from the i-th square, one can only move to the (i - 1)-th or (i + 1)-th squares of this path. Note that there is only a single valid move from the first and last squares of a grid path. Also note, that even if there is some j-th square of the path that coincides with the i-th square, only moves to (i - 1)-th and (i + 1)-th squares are available. For example, from the second square in the above sequence, one can only move to either the first or third squares.To ensure that movement is not ambiguous, the two grid paths will not have an alternating sequence of three squares. For example, a contiguous subsequence (0, 0) → (0, 1) → (0, 0) cannot occur in a valid grid path.One marble is placed on the first square of each grid path. Genos wants to get both marbles to the last square of each grid path. However, there is a catch. Whenever he moves one marble, the other marble will copy its movement if possible. For instance, if one marble moves east, then the other marble will try and move east as well. By try, we mean if moving east is a valid move, then the marble will move east.Moving north increases the second coordinate by 1, while moving south decreases it by 1. Similarly, moving east increases first coordinate by 1, while moving west decreases it.Given these two valid grid paths, Genos wants to know if it is possible to move both marbles to the ends of their respective paths. That is, if it is possible to move the marbles such that both marbles rest on the last square of their respective paths.", "input_spec": "The first line of the input contains a single integer n (2 ≤ n ≤ 1 000 000) — the length of the paths. The second line of the input contains a string consisting of n - 1 characters (each of which is either 'N', 'E', 'S', or 'W') — the first grid path. The characters can be thought of as the sequence of moves needed to traverse the grid path. For example, the example path in the problem statement can be expressed by the string \"NNESWW\". The third line of the input contains a string of n - 1 characters (each of which is either 'N', 'E', 'S', or 'W') — the second grid path.", "output_spec": "Print \"YES\" (without quotes) if it is possible for both marbles to be at the end position at the same time. Print \"NO\" (without quotes) otherwise. In both cases, the answer is case-insensitive.", "sample_inputs": ["7\nNNESWW\nSWSWSW", "3\nNN\nSS"], "sample_outputs": ["YES", "NO"], "notes": "NoteIn the first sample, the first grid path is the one described in the statement. Moreover, the following sequence of moves will get both marbles to the end: NNESWWSWSW.In the second sample, no sequence of moves can get both marbles to the end."}, "positive_code": [{"source_code": "#include \n#include \n#include \n#include \n\nbool reversed(char c, char t)\n{\n return (c == 'N' && t == 'S') || (c == 'S' && t == 'N') || (c == 'W' && t == 'E') || (c == 'E' && t == 'W');\n}\n\nchar reverse(char c)\n{\n if (c == 'S')\n return 'N';\n if (c == 'W')\n return 'E';\n if (c == 'N')\n return 'S';\n if (c == 'E')\n return 'W';\n return '\\0';\n}\n\nint main()\n{\n int n;\n assert(scanf(\"%d\", &n) == 1);\n n--;\n char* s = malloc(sizeof(char) * (n + 1));\n char* t = malloc(sizeof(char) * (n + 1));\n assert(scanf(\"%s\", s));\n assert(scanf(\"%s\", t));\n if (reversed(s[n - 1], t[n - 1]))\n printf(\"NO\\n\");\n else\n {\n int i = 0;\n int j = 0;\n int ilast = 0;\n int op = 0;\n while (j < n || i < n)\n {\n op += n - i;\n for (; i < n; i++)\n {\n if (j < n && t[j] == s[i])\n j++;\n else if (j > 0 && reverse(t[j - 1]) == s[i])\n j--;\n }\n if (j == n && i == n)\n {\n printf(\"YES\\n\");\n return 0;\n }\n op += n - j;\n for (; j < n; j++)\n {\n if (i < n && t[j] == s[i])\n i++;\n else if (i > 0 && reverse(s[i - 1]) == t[j])\n i--;\n }\n if (op > 4e8)\n {\n printf(\"YES\\n\");\n return 0;\n }\n if (ilast == i)\n break;\n ilast = i;\n }\n if (j == n && i == n)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \n#include \n\nbool reversed(char c, char t)\n{\n return (c == 'N' && t == 'S') || (c == 'S' && t == 'N') || (c == 'W' && t == 'E') || (c == 'E' && t == 'W');\n}\n\nchar reverse(char c)\n{\n if (c == 'S')\n return 'N';\n if (c == 'W')\n return 'E';\n if (c == 'N')\n return 'S';\n if (c == 'E')\n return 'W';\n return '\\0';\n}\n\nint main()\n{\n int n;\n assert(scanf(\"%d\", &n) == 1);\n n--;\n char* s = malloc(sizeof(char) * (n + 1));\n char* t = malloc(sizeof(char) * (n + 1));\n assert(scanf(\"%s\", s));\n assert(scanf(\"%s\", t));\n if (reversed(s[n - 1], t[n - 1]))\n printf(\"NO\\n\");\n else\n {\n int i = 0;\n int j = 0;\n int ilast = 0;\n int op = 0;\n while (j < n || i < n)\n {\n op += n - i;\n for (; i < n; i++)\n {\n if (j < n && t[j] == s[i])\n j++;\n else if (j > 0 && reverse(t[j - 1]) == s[i])\n j--;\n }\n if (j == n && i == n)\n {\n printf(\"YES\\n\");\n return 0;\n }\n op += n - j;\n for (; j < n; j++)\n {\n if (i < n && t[j] == s[i])\n i++;\n else if (i > 0 && reverse(s[i - 1]) == t[j])\n i--;\n }\n if (op > 4e8)\n {\n printf(\"YES\\n\");\n return 0;\n }\n if (ilast == i)\n break;\n ilast = i;\n }\n if (j == n && i == n)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n int n; scanf(\"%d\", &n); n--;\n char s1[n+1], s2[n+1];\n scanf(\"%s%s\", s1, s2);\n\n char r1[n+1];\n r1[n] = '\\0';\n for (int i = 0; i < n; ++i) {\n if (s1[i] == 'N') r1[n - i - 1] = 'S';\n if (s1[i] == 'E') r1[n - i - 1] = 'W';\n if (s1[i] == 'S') r1[n - i - 1] = 'N';\n if (s1[i] == 'W') r1[n - i - 1] = 'E';\n }\n\n int b[n];\n b[0] = 0;\n for (int i = 1; i < n; ++i) {\n int j = b[i-1];\n for(; r1[j] != r1[i] && j != 0; j = b[j-1]);\n b[i] = r1[j] == r1[i] ? j+1:0;\n }\n\n int m = 0;\n for (int i = 0; i < n; ++i) {\n while (r1[m] != s2[i] && m != 0) m = b[m - 1];\n if (r1[m] == s2[i])\n m++;\n }\n if (m) puts(\"NO\");\n else puts(\"YES\");\n}\n"}, {"source_code": "#include \n\nint main() {\n int n; scanf(\"%d\", &n); n--;\n char s1[n+1], s2[n+1];\n scanf(\"%s%s\", s1, s2);\n\n char r1[n+1];\n r1[n] = '\\0';\n for (int i = 0; i < n; ++i) {\n if (s1[i] == 'N') r1[n - i - 1] = 'S';\n if (s1[i] == 'E') r1[n - i - 1] = 'W';\n if (s1[i] == 'S') r1[n - i - 1] = 'N';\n if (s1[i] == 'W') r1[n - i - 1] = 'E';\n }\n\n int b[n];\n b[0] = 0;\n for (int i = 1; i < n; ++i) {\n int j = b[i-1];\n for(; r1[j] != r1[i] && j != 0; j = b[j-1]);\n b[i] = r1[j] == r1[i] ? j+1:0;\n }\n\n int m = 0;\n for (int i = 0; i < n; ++i) {\n while (r1[m] != s2[i] && m != 0) m = b[m - 1];\n if (r1[m] == s2[i])\n m++;\n }\n if (m) puts(\"NO\");\n else puts(\"YES\");\n}\n"}], "negative_code": [{"source_code": "#include \n#include \n#include \n#include \n\nbool reversed(char c, char t)\n{\n return (c == 'N' && t == 'S') || (c == 'S' && t == 'N') || (c == 'W' && t == 'E') || (c == 'E' && t == 'W');\n}\n\nchar reverse(char c)\n{\n if (c == 'S')\n return 'N';\n if (c == 'W')\n return 'E';\n if (c == 'N')\n return 'S';\n if (c == 'E')\n return 'W';\n return '\\0';\n}\n\nint main()\n{\n int n;\n assert(scanf(\"%d\", &n) == 1);\n n--;\n char* s = malloc(sizeof(char) * (n + 1));\n char* t = malloc(sizeof(char) * (n + 1));\n assert(scanf(\"%s\", s));\n assert(scanf(\"%s\", t));\n if (reversed(s[n - 1], t[n - 1]))\n printf(\"NO\\n\");\n else\n {\n int i = 0;\n int j = 0;\n int ilast = 0;\n int op = 0;\n while (j < n || i < n)\n {\n op += n - i;\n for (; i < n; i++)\n {\n if (j < n && t[j] == s[i])\n j++;\n else if (j > 0 && reverse(t[j - 1]) == s[i])\n j--;\n }\n if (j == n && i == n)\n {\n printf(\"YES\\n\");\n return 0;\n }\n op += n - j;\n for (; j < n; j++)\n {\n if (i < n && t[j] == s[i])\n i++;\n else if (i > 0 && reverse(s[i - 1]) == t[j])\n i--;\n }\n if (op > 4e8)\n break;\n if (ilast == i)\n break;\n ilast = i;\n }\n if (j == n && i == n)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n\nbool reversed(char c, char t)\n{\n return (c == 'N' && t == 'S') || (c == 'S' && t == 'N') || (c == 'W' && t == 'E') || (c == 'E' && t == 'W');\n}\n\nchar reverse(char c)\n{\n if (c == 'S')\n return 'N';\n if (c == 'W')\n return 'E';\n if (c == 'N')\n return 'S';\n if (c == 'E')\n return 'W';\n return '\\0';\n}\n\nint main()\n{\n int n;\n assert(scanf(\"%d\", &n) == 1);\n n--;\n char* s = malloc(sizeof(char) * (n + 1));\n char* t = malloc(sizeof(char) * (n + 1));\n assert(scanf(\"%s\", s));\n assert(scanf(\"%s\", t));\n if (reversed(s[n - 1], t[n - 1]))\n printf(\"NO\\n\");\n else\n {\n int i = 0;\n int j = 0;\n int ilast = 0;\n int op = 0;\n while (j < n || i < n)\n {\n op += n - i;\n for (; i < n; i++)\n {\n if (j < n && t[j] == s[i])\n j++;\n else if (j > 0 && reverse(t[j - 1]) == s[i])\n j--;\n }\n if (j == n && i == n)\n {\n printf(\"YES\\n\");\n return 0;\n }\n op += n - j;\n for (; j < n; j++)\n {\n if (i < n && t[j] == s[i])\n i++;\n else if (i > 0 && reverse(s[i - 1]) == t[j])\n i--;\n }\n if (op > 1e8)\n break;\n if (ilast == i)\n break;\n ilast = i;\n }\n if (j == n && i == n)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n\nbool reversed(char c, char t)\n{\n return (c == 'N' && t == 'S') || (c == 'S' && t == 'N') || (c == 'W' && t == 'E') || (c == 'E' && t == 'W');\n}\n\nchar reverse(char c)\n{\n if (c == 'S')\n return 'N';\n if (c == 'W')\n return 'E';\n if (c == 'N')\n return 'S';\n if (c == 'E')\n return 'W';\n return '\\0';\n}\n\nint main()\n{\n int n;\n assert(scanf(\"%d\", &n) == 1);\n n--;\n char* s = malloc(sizeof(char) * (n + 1));\n char* t = malloc(sizeof(char) * (n + 1));\n assert(scanf(\"%s\", s));\n assert(scanf(\"%s\", t));\n if (reversed(s[n - 1], t[n - 1]))\n printf(\"NO\\n\");\n else\n {\n int i = 0;\n int j = 0;\n int ilast = 0;\n int jlast = 0;\n int op;\n while (j < n || i < n)\n {\n for (; i < n; i++)\n {\n if (j < n && t[j] == s[i])\n j++;\n else if (j > 0 && reverse(t[j - 1]) == s[i])\n j--;\n }\n if (j == n && i == n)\n {\n printf(\"YES\\n\");\n return 0;\n }\n if (j == jlast)\n break;\n jlast = j;\n for (; j < n; j++)\n {\n if (i < n && t[j] == s[i])\n i++;\n else if (i > 0 && reverse(s[i - 1]) == t[j])\n i--;\n }\n op += 2 * n;\n //if (op >= 1e8)\n // break;\n if (ilast == i)\n break;\n ilast = i;\n }\n if (j == n && i == n)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n\nbool reversed(char c, char t)\n{\n return (c == 'N' && t == 'S') || (c == 'S' && t == 'N') || (c == 'W' && t == 'E') || (c == 'E' && t == 'W');\n}\n\nchar reverse(char c)\n{\n if (c == 'S')\n return 'N';\n if (c == 'W')\n return 'E';\n if (c == 'N')\n return 'S';\n if (c == 'E')\n return 'W';\n return '\\0';\n}\n\nint main()\n{\n int n;\n assert(scanf(\"%d\", &n) == 1);\n n--;\n char* s = malloc(sizeof(char) * (n + 1));\n char* t = malloc(sizeof(char) * (n + 1));\n assert(scanf(\"%s\", s));\n assert(scanf(\"%s\", t));\n if (reversed(s[n - 1], t[n - 1]))\n printf(\"NO\\n\");\n else\n {\n int i = 0;\n int j = 0;\n int ilast = 0;\n int op;\n while (j < n || i < n)\n {\n for (; i < n; i++)\n {\n if (j < n && t[j] == s[i])\n j++;\n else if (j > 0 && reverse(t[j - 1]) == s[i])\n j--;\n }\n if (j == n && i == n)\n {\n printf(\"YES\\n\");\n return 0;\n }\n for (; j < n; j++)\n {\n if (i < n && t[j] == s[i])\n i++;\n else if (i > 0 && reverse(s[i - 1]) == t[j])\n i--;\n }\n op += 2 * n;\n if (op >= 1e8)\n break;\n if (ilast == i)\n break;\n ilast = i;\n }\n if (j == n && i == n)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}], "src_uid": "85f43628bec7e9b709273c34b894df6b"} {"nl": {"description": "Polar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo of Kiev decided to build a house of cards. For that they've already found a hefty deck of n playing cards. Let's describe the house they want to make: The house consists of some non-zero number of floors. Each floor consists of a non-zero number of rooms and the ceiling. A room is two cards that are leaned towards each other. The rooms are made in a row, each two adjoining rooms share a ceiling made by another card. Each floor besides for the lowest one should contain less rooms than the floor below. Please note that the house may end by the floor with more than one room, and in this case they also must be covered by the ceiling. Also, the number of rooms on the adjoining floors doesn't have to differ by one, the difference may be more. While bears are practicing to put cards, Horace tries to figure out how many floors their house should consist of. The height of the house is the number of floors in it. It is possible that you can make a lot of different houses of different heights out of n cards. It seems that the elephant cannot solve this problem and he asks you to count the number of the distinct heights of the houses that they can make using exactly n cards.", "input_spec": "The single line contains integer n (1 ≤ n ≤ 1012) — the number of cards.", "output_spec": "Print the number of distinct heights that the houses made of exactly n cards can have.", "sample_inputs": ["13", "6"], "sample_outputs": ["1", "0"], "notes": "NoteIn the first sample you can build only these two houses (remember, you must use all the cards): Thus, 13 cards are enough only for two floor houses, so the answer is 1.The six cards in the second sample are not enough to build any house."}, "positive_code": [{"source_code": "#include \n\nint main(void)\n{\n long long n, v = 0;\n scanf(\"%I64d\", &n);\n long long fmin = 3 - n % 3;\n for (long long f = fmin; n >= f * (3 * f + 1) / 2; f += 3)\n v++;\n printf(\"%I64d\", v);\n}"}, {"source_code": "/* practice with Dukkha */\n#include \n\nint main() {\n\tlong long n, a, b;\n\tint ans;\n\n\tscanf(\"%lld\", &n);\n\tans = 0;\n\tfor (a = 1; (b = a * (a + 1) / 2 * 3 - a) <= n; a++)\n\t\tif ((n - b) % 3 == 0)\n\t\t\tans++;\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tlong long int s=0,n,t,k=0,c=0;\n\tscanf(\"%I64d\",&n);\n\twhile(s<=n)\n\t{\n\t\tk++;\n\t\ts=3*k*(k+1)/2-k;\n\t}\n\tt=k;\n\tt=t-1;\n\twhile(t)\n\t{\n\t\tif((n+t)%3==0)\n\t\t{\n\t\t\tc++;\n\t\t}\n\t\tt--;\n\t}\n\tprintf(\"%ld\\n\",c);\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tlong long n,i;\n\twhile(scanf(\"%lld\",&n)!=EOF)\n\t{\n\t\tlong long m,t,j,c,d=0;\n\t\tint s=0;\n\t\tfor(i=1;i*i<=n;i++)\n\t\t{\n\t\t\tc=(n-2*i);\n\t\t\tt=c/3;\n\t\t\td+=i-1;\n\t\t\tif(c%3==0&&t>=d)\n\t\t\t{\n\t\t\t\ts++;\n\t\t\t}\n\t\t}\n\n\t\t\tprintf(\"%d\\n\",s);\n\t}\n}\n"}, {"source_code": "#include \n#define ll long long\nll arr[6000005];\nint main()\n{\n \n int i;\n arr[0]=0;\n arr[1]=2;\n\n ll a=2;\n for(i=2;i<6000005;i++)\n {\n a+=((i-1)*3+2);\n arr[i]=a;\n }\n\n ll n;\n scanf(\"%lld\",&n);\n ll ans=0;\n for(i=1;i<6000005;i++)\n {\n int flag=0;\n if(n>=arr[i])\n {\n ll diff=n-arr[i];\n\n if(diff%3==0)\n {\n //printf(\"i=%d\\n\",i);\n ans+=1;\n }\n }\n }\n\n printf(\"%lld\\n\",ans);\n\n}"}, {"source_code": "\n#include\nint main() {\n\tlong long int i,j,n;\n\twhile(scanf(\"%lld\",&n)!=EOF){\n\t\ti=0;j=2;\n\t\tfor(;n-j>=0;j+=3) {\n\t\t\tn-=j;\n\t\t\tif(n%3==0){\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\t\tprintf(\"%lld\\n\",i);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\n#include\ntypedef long long ll;\nint main()\n{\n\tll n;\n\tscanf(\"%lld\",&n);\n\tll maxi=sqrt(n);\n\tint is=0;\n\tfor(ll i=maxi;i>=0;i--)\n\t{\n\t\tif(3*(i+i*i)%2==0)\n\t\t{\n\t\t\tif(3*(i+i*i)/2+2*(i+1)<=n)\n\t\t\t{\n\t\t\t\tif((n-(3*(i+i*i)/2+2*(i+1)))%3==0)\n\t\t\t\t{\n\t\t\t\t\tis++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\",is);\n}\n"}, {"source_code": "#include\n#include\ntypedef long long ll;\nint main()\n{\n\tll n;\n\tscanf(\"%lld\",&n);\n\tll maxi=sqrt(n);\n\tint is=0;\n\tfor(ll i=maxi;i>=1;i--)\n\t{\n\t\tif((3*i*i+i)/2<=n&&(n-(3*i*i+i)/2)%3==0)\n\t\t{\n\t\t\tis++;\n\t\t}\n\n\t}\n\tprintf(\"%d\",is);\n}\n"}, {"source_code": "#include \n#include \n\n#define ll long long\n\nint main ()\n{\n ll n, x, i;\n ll ans, yu, cha, mid;\n while (scanf(\"%I64d\", &n) != EOF)\n {\n\n ans = 0;\n mid = (-1 + sqrt (1 + 24 * n)) / 6;\n if(3 * mid * mid + mid - 2 * n > 0){\n mid--;\n }\n while(mid)\n {\n\n if((n + mid) % 3 == 0){\n ans++;\n }\n mid--;\n }\n printf(\"%I64d\\n\", ans);\n }\n return 0;\n}\n"}, {"source_code": "#include \n#define LL long long\nint main()\n{\n LL n;\n int ans=0;\n scanf(\"%I64d\",&n);\n int rem=n%3;\n LL q=n/3;\n LL start;\n if(rem==0)\n {\n start=3;\n }\n else if(rem==1)\n {\n start=2;\n }\n else\n {\n start=1;\n }\n LL lim=(start*(start+1))/2;\n while((q+ans+1)>=lim)\n {\n ans++;\n start+=3;\n lim=(start*(start+1))/2;\n }\n printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int i,n,count=0,h,rooms;\n scanf(\"%lld\",&n);\n for(h=3-(n%3);;h=h+3)\n {\n rooms=(n+h)/3;\n if(rooms>=(h*(h+1))/2)\n count++;\n else\n break;\n }\n printf(\"%lld\\n\",count);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n long long int n,i,t[3]={0},j,s;\n scanf(\"%I64d\",&n);\n for(i=5,s=2,j=0;s<=n;i+=3)\n\t{\n t[s%3]++;\n s+=i;\n }\n printf(\"%I64d\\n\",t[n%3]);\n \nreturn 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n\tlong long int n;\n\tscanf(\"%lld\", &n);\n\tlong long int ans=0, h=0;\n\twhile(1)\n\t{\n\t\th++;\n\t\tlong long int tem=n-(2*h);\n\t\tif(tem<0)break;\n\t\tif(tem%3==0)\n\t\t{\n\t\t\tlong long int t = (h*(h+1))/2;\n\t\t\tt-=h;\n\t\t\tt*=3;\n\t\t\tif(tem>=t)ans++;\n\t\t\telse break;\n\t\t}\n\t}\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tlong long n;\n\twhile(scanf(\"%I64d\",&n)!=EOF)\n\t{\n\t\tlong long a,b;\n\t\ta=n/3;\n\t\tb=n%3;\n\n\t\tlong long mi=0;if(b==2) mi=1;\n\t\tfor(;;)\n\t\t{if(b%2==1) {b=b+3;a=a-1;}\n\t\t\telse if(b%2==0){b=b+2*3 ; a=a-2; }\n\n\n\t\t\t if(2*a>=b/2*(b/2-1))\n\t\t\t{\n\t\t\t\tmi++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t}\n\n\t\tprintf(\"%I64d\\n\",mi);\n\t}\n}\n\n"}, {"source_code": "#include \n\ntypedef long long LL_t;\n\nint main()\n{\n LL_t h, N, Ans, F, E;\n scanf(\"%I64d\", &N);\n h = 1;\n Ans = 0;\n while(1)\n {\n F = h*2 + h*(h-1)/2*3;\n if(F > N)\n {\n break;\n }\n E = N - F;\n if(E % 3 == 0)\n {\n ++Ans;\n }\n ++h;\n }\n printf(\"%I64d\\n\", Ans);\n return 0;\n}\n"}, {"source_code": "#include\n#define ll long long int\nll getcards(ll flo)\n{\n return 3*flo*(flo+1)/2-flo;\n}\n//Another solution would be to calculate the number of rooms R i.e 3R-F everytime and then return the value.But it would become an O(n*sqrt(n));\nint main()\n{\n ll n;\n scanf(\"%lld\",&n);\n\n ll floor;\n ll rem=0;\n for(floor=1;getcards(floor)<=n;floor++)\n {\n if((n+floor)%3==0)\n rem++;\n }\n\n printf(\"%lld\",rem);\n\n return 0;\n} "}, {"source_code": "#include\n#define ll long long int\nll getcards(ll flo)\n{\n return 3*flo*(flo+1)/2-flo;\n}\n//Another solution would be to calculate the number of rooms R i.e 3R-F everytime and then return the value.But it would become an O(n*sqrt(n));\nint main()\n{\n ll n;\n scanf(\"%lld\",&n);\n\n ll floor;\n ll rem=0;\n for(floor=1;getcards(floor)<=n;floor++)\n {\n if((n+floor)%3==0)\n rem++;\n }\n\n printf(\"%lld\",rem);\n\n return 0;\n} "}, {"source_code": "#include\n#include\nint main()\n{\n\tlong long int n,a,b;\n\tscanf(\"%lld\",&n);\n\tb=(sqrt(1+24*n)-1)/6;\n\ta=3-n%3;\n\tprintf(\"%lld\\n\",a>b?0:(b-a)/3+1);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main(void) \n{\n\tunsigned long long int ar[1000000],n;\n\tint i,num=0;\n\tar[1]=5;\n\tar[2]=7;\n\tfor(i=3;i<1000000;i++)\n\t\t{\n\t\tar[i]=ar[i-1]+3*i-1;\n\t\t//printf(\"%llu \",ar[i]);\n\t\t}\n\tscanf(\"%llu\",&n);\n\tif(n==2)\n\t\t{\n\t\tprintf(\"1\");\n\t\treturn 0;\n\t\t}\n\ti=1;\n\twhile(ar[i]<=n)\n\t\t{\n\t\t\tif((n-ar[i])%3==0)\n\t\t\t\tnum++;\n\t\t\ti++;\n\t\t}\n\tprintf(\"%d\",num);\t\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \ntypedef long long int ll;\nint main()\n{\n ll n,ans=0;\n scanf(\"%lld\",&n);\n ll min=2,compt=5;\n ll k=2;\n while(n>=min)\n {\n if(n%3==k) ans++;\n min+=compt;\n compt+=3;\n if(k>0)k--;\n else k=2;\n }\n printf(\"%lld\",ans);\n return 0;\n}\n"}, {"source_code": "#include \n\ntypedef long long LL_t;\n\nint main()\n\n{\n LL_t h, N, Ans, F, E;\n scanf(\"%I64d\", &N);\n h = 1;\n Ans = 0;\n while(1) {\n F = h * 2 + h * (h - 1) / 2 * 3;\n if(F > N) {\n break;\n }\n E = N - F;\n if(E % 3 == 0) {\n ++Ans;\n }\n ++h;\n }\n printf(\"%I64d\\n\", Ans);\n return 0;\n}"}, {"source_code": "#include \n\ntypedef long long LL_t;\n\nint main()\n{\n LL_t h, N, Ans, F, E;\n scanf(\"%I64d\", &N);\n h = 1;\n Ans = 0;\n while(1) {\n F = h * 2 + h * (h - 1) / 2 * 3;\n if(F > N) {\n break;\n }\n E = N - F;\n if(E % 3 == 0) {\n ++Ans;\n }\n ++h;\n }\n printf(\"%I64d\\n\", Ans);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n long long int n,i,count=0;\n scanf(\"%I64d\",&n);\n for(i=1;3*i*(i-1)/2+2*(i)<=n;i++)\n {\n if((n-2*i)%3==0)\n\n {\n count++;\n }\n }\n printf(\"%I64d\\n\",count);\n return(0);\n}\n"}, {"source_code": "#include\nint main()\n{\n\tlong long k,s=0,i;\n\tscanf(\"%I64d\",&k);\n\tfor ( i=1;i<=1e6;i++ )\n\t{\n\t\tif ((k+i)%3==0&&(3*i*i+i)/2<=k) s++;\n\t}\n\tprintf(\"%I64d\",s);\n}\n"}, {"source_code": "#include\ntypedef long long ll;\nint main()\n{\n\tll n,i;\n\tint ans=0;\n\tscanf(\"%I64d\",&n);\n\tfor(i=1;in)\n\t\t\tbreak;\n\t\telse\n\t\t{\n\t\t\tif((n-1ll*i*(3*i+1)/2)%3==0)\n\t\t\t\tans++;\n\t\t}\n\t}\n\tprintf(\"%d\",ans);\n}\n"}, {"source_code": " #include\n int main()\n {\n long long int t,n,i,count=0,rem;\n scanf(\"%I64d\",&n);\n t=n%3;\n t=3-t;\n for(i=t;3*i*(i+1)/2<=n+i;i+=3)\n {\n count++;\n }\n printf(\"%I64d\\n\",count);\n return 0;\n }"}, {"source_code": "#include\nlong long int a[1000006],dp[1000006];\nint main()\n{\n long long int i,n,c;\n for(i=0;i<1000006;i++)\n a[i]=3*i+2;\n dp[0]=0;\n for(i=1;i<1000006;i++)\n dp[i]=dp[i-1]+a[i-1];\n scanf(\"%I64d\",&n);\n c=0;\n for(i=1;i<1000006;i++)\n {\n if(dp[i]>n)\n break;\n if((n-dp[i])%3==0)\n c++;\n }\n printf(\"%I64d\",c);\n return 0;\n}"}, {"source_code": "#include\nint main() {\n\tlong long int i=0,j=2,k,l,n,m;\n\tscanf(\"%lld\",&n);\n\tfor(;n-j>=0;j+=3) {n-=j;if(n%3==0)i++;}\n\tprintf(\"%lld\\n\",i);\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n long long n;\n scanf(\"%lld\",&n);\n long long count = 0,check=2,var=2,iter = 1;\n while(check<=n)\n {\n if((n+iter)%3==0)\n {\n count++;\n //printf(\"%lld\",iter);\n }\n var = var+3;\n check = check + var;\n //printf(\"%lld\\n\",check);\n //printf(\"%lld\\n\",iter);\n iter++;\n //printf(\"%lld\\n\",iter);\n }\n printf(\"%lld\",count);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n long long int n,i,s,j,sum=0;\n while(~scanf(\"%I64d\",&n))\n {\n \tsum=0;\n s=2;\n i=1;\n while(s<=n)\n {\n \ti++;\n \ts=i*(i+1)+i*(i-1)/2;\n }\n for(j=1;j\nint main()\n{\t\n\tlong long int n,count=0,t,i,q,sum;\n\tscanf(\"%lld\",&n);\n\tt=n/5;\n\tfor(i=1;i=sum)\n\t\t\t\tcount++;\n\t\t\telse\n\t\t\t\tbreak;\n\t\t\ti+=3;\n\t\t}\n\t\telse\n\t\t\ti++;\n\t}\n\tprintf(\"%lld\\n\",count);\n\treturn 0;\n}\n\n"}, {"source_code": "#include\n#include\nint main()\n{\n\tlong long k=0,n;\n\twhile(scanf(\"%lld\",&n)!=EOF)\n\t{\n\t\tk=0;\n\t\tfor(long long i=sqrt(n);i>=1;i--)\n\t\t{\n\t\t\tif((n-(3*i*i+i)/2)%3==0&&(3*i*i+i)/2<=n)\n\t\t\tk++;\n\t\t}\n\t\tprintf(\"%lld\\n\",k);\n\t}\n}"}, {"source_code": "#include\n#include\n#include\nint main(void)\n{\n\tlong long p,n,ans;\n\twhile(scanf(\"%I64d\",&n)==1)\n\t{\n\t\tif((n<=1)||(n==4))\n\t\t{\n\t\t\tprintf(\"0\\n\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tp=(long long)((sqrt(24*n+1)-1)/6);\n\t\t\tif(n%3==0)\n\t\t\t{\n\t\t\t\tans=p/3;\n\t\t\t\tprintf(\"%I64d\\n\",ans);\n\t\t\t}\n\t\t\telse if(n%3==1)\n\t\t\t{\n\t\t\t\tans=(p-2)/3+1;\n\t\t\t\tprintf(\"%I64d\\n\",ans);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tans=(p-1)/3+1;\n\t\t\t\tprintf(\"%I64d\\n\",ans);\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\nlong long n,sum=0,a[1000000];\nlong long i,j,t;\nmain()\n{\n\tfor(i=0;i<1000000;i++)\n\ta[i]=(3*i*i+i)/2;\n\tscanf(\"%lld\",&n);\n\ti=1;\n\twhile(n>=a[i])\n\t{\n\t\tif(a[i]==n)\n\t\t {sum++;break;}\n\t\telse\n\t\t {if((n-a[i])%3==0)sum++;i++;}\n\t}\n\t printf(\"%lld\\n\",sum);\n}\n"}, {"source_code": "#include \nlong long x(int n)\n{\nlong long i, sum=0,s;\n for (i=1;i<=n;i++)\n sum+=i;\ns=sum*3+n*2;\nreturn s;\n}\nint main()\n{\n long long n,i,s=0,k;\n scanf(\"%I64d\",&k);\n for (i=1;i<1000000;i++)\n {\n if ((k+i)%3==0&&(3*i*i+i)/2<=k) s++;\n }\n printf(\"%I64d\\n\",s);\n}\n"}, {"source_code": "#include \n\nint main() {\n\tlong long n,m,i,j,k,a,b,c,t;\n\tscanf(\"%lld\",&n);\n\tfor(i=0;(i*(3*i+1))/2<=n;++i);\n\t\ti--;\n\t//printf(\"%lld\\n\",i);\n\tif(n%3==0)\tj=i/3;\n\tif(n%3==1)\tj=(i+1)/3;\n\tif(n%3==2)\tj=(i+2)/3;\n\tprintf(\"%lld\\n\",j);\n\treturn 0;\n}\t\n"}, {"source_code": "#include\nint main(){\n long long a,b=0,c,d,i,j,level,x,cards,n,t;\n scanf(\"%lld\",&n);\n for(level=1000000;level>0;level--){\n x=(level*(level+1))/2-level;\n cards=(3*x+2*level);\n if(cards<=n){\n b=level;\n break;\n }\n }\n// printf(\"%lld\\n\",b);\n if(n%3==2){\n a=(b+2)/3;\n }else if(n%3==1){\n a=(b+1)/3;\n }else{\n a=b/3;\n }\n printf(\"%lld\\n\",a);\n return 0;\n}"}, {"source_code": "#include \n\nint main(void)\n{\n\tlong long int n;\n\tlong long int b;\n\tint i;\n\tint c;\n\n\tscanf(\"%I64d\", &n);\n\n\tc = 0;\n\tfor(i = 1, b = 2; b <= n; i ++, b += 3 * (long long)i - 1)\n\t{\n\t\tif((n - b) % 3 == 0)\n\t\t{\n\t\t\t//printf(\"%d\\n\", i);\n\t\t\tc ++;\n\t\t}\n\t}\n\n\tprintf(\"%d\\n\", c);\n\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n long long n,h,k,s;\n scanf(\"%I64d\",&n);\n h=0;\n if((n+1)%3==0)\n h++;\n s=7;\n k=5;\n for(s=7;s<=n;s=s+k)\n {\n if((n-s)%3==0)\n h++;\n k=k+3;\n }\n printf(\"%I64d\\n\",h);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n\tlong long int n;\n\tscanf(\"%lld\",&n);\n\tlong long int m=(-1+sqrt(1+24*n))/6;\n\tint i=(3+(3-n)%3)%3;\n\tint j=m%3;\n\tint k=0;\n//\tprintf(\"%d %d\",i,j);\n\tif(i<=j&&i!=0)\n\t\tk=1;\n//\tprintf(\"%lld\",m/3);\n\tprintf(\"%lld\",m/3+k);\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n\nvoid solve(long long int x)\n{\n long long int n=(long long int)((sqrt(24*x + 1) - 1)/6.0);\n long long int ans=0,rem=x-(3*n*n+n)/2;\n // printf(\"%lld\\n\",rem);\n if(n>0)\n {\n if(rem%3==0) ans=1;\n while(n>1)\n {\n if((rem+2)%3==0)\n {\n ans++;\n }\n rem+=2;\n n--;\n }\n }\n printf(\"%lld\",ans);\n}\nint main()\n{\n long long int n;\n scanf(\"%lld\",&n);\n solve(n);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n long long i,A,cnt=0,cnt4;\n scanf(\"%I64d\",&i);\n if(i%3==0){\n A=15;\n cnt4=3;\n }\n else if(i%3==2){\n A=2;\n cnt4=1;\n }\n else if(i%3==1){\n A=7;\n cnt4=2;\n }\n while(A<=i){\n cnt++;\n A=A+3*cnt4+2;\n cnt4++;\n A=A+3*cnt4+2;\n cnt4++;\n A=A+3*cnt4+2;\n cnt4++;\n }\n printf(\"%I64d\",cnt);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n long long int n,i,j,count=0;\n scanf(\"%lld\",&n);\n \n //j=sqrt(n);\n j = (sqrt(1+24*n)-1)/6;\n for(i=1;i<=j;i++)\n {\n if((n+i)%3==0)\n count++;\n }\n \n printf(\"%lld\\n\",count);\n \n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n\tlong long int last,sum=2,i,j,k,l,n,m,rem;\n\tscanf(\"%lld\",&n);\n\tm = 1;\n\trem = 5;\n\twhile(sum1)\n\t\t\t\t\tprintf(\"%lld\\n\",m/3);\n\t\t\t\telse\n\t\t\t\t\tprintf(\"0\\n\");}\n\t\t\telse\n\t\t\t\tprintf(\"%lld\\n\",m/3+1);\n\t\t}\n\t\telse{\n\t\t\tif(m%3==0)\n\t\t\t\tprintf(\"%lld\\n\",m/3);\n\t\t\telse if(m%3==1)\n\t\t\t\tprintf(\"%lld\\n\",(m-1)/3);\n\t\t\telse\n\t\t\t\tprintf(\"%lld\\n\",(m-2)/3);\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\n#define ll long long \nint main()\n{\n\tll n,i=1,max=2,c=0;\n\tscanf(\"%lld\",&n);\n\twhile(n>=max)\n\t{\n\t\tif(i%3==1&&(n-2)%3==0)\n\t\t++c;\n\t\tif(i%3==2&&(n-1)%3==0)\n\t\t++c;\n\t\tif(i%3==0&&n%3==0)\n\t\t++c;\n\t\tmax+=3*i+2;\n\t\t++i;\n\t\t}\n\t\tprintf(\"%lld\",c);\n\t\treturn 0;\n\t\t}"}, {"source_code": "#include\n#include\nint main()\n{\n\tlong long int n,a,b;\n\tscanf(\"%I64d\",&n);\n\tb=(sqrt(1+24*n)-1)/6;\n\ta=3-n%3;\n\tprintf(\"%I64d\\n\",a>b?0:(b-a)/3+1);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n,i,ans=0;\n scanf(\"%lld\",&n);\n for(i=1;(3*i*(i+1)/2-i)<=n;i++)\n {\n if((n+i)%3==0)\n ans++;\n }\n printf(\"%d\\n\",ans);\n return 0;\n}"}, {"source_code": "#include\n#include\n#define MAX 1000000//1-1000000�ۼ�Ϊ1e12 \nlong long most[1000010];\nint main(void)\n{\n\tlong long ans=0,n;\n\tscanf(\"%lld\",&n);\n\tmemset(most,0,sizeof(most));\n\tfor(int i=1;i<=MAX;i++)\n\t{\n\t\tmost[i]=3*i-1+most[i-1]; \n\t}\n\tfor(int i=1;i<=MAX;i++)\n {\n\t\tif(n>=most[i]&&(n-most[i])%3==0)\n\t\t{\n\t\t\tans++;\n\t\t}\n\t\tif(n\nint main()\n{\n\tint n,t;\n\tdouble k;\n\tscanf(\"%d\",&n);\n\tfor(k=1;k\nint main()\n{\n\tlong n,t;\n\tdouble k;\n\tscanf(\"%ld\",&n);\n\tfor(k=1;k\nint main()\n{\n\tlong long n,i;\n\twhile(scanf(\"%lld\",&n)!=EOF)\n\t{\n\t\tint s=0,m,t,j,c,d=0;\n\t\tfor(i=1;i*i<=n;i++)\n\t\t{\n\t\t\tc=(n-2*i);\n\t\t\tt=c/3;\n\t\t\td+=i-1;\n\t\t\tif(c%3==0&&t>=d)\n\t\t\t{\n\t\t\t\ts++;\n\t\t\t}\n\t\t}\n\n\t\t\tprintf(\"%d\\n\",s);\n\t}\n}\n"}, {"source_code": "#include\nint fact(int x);\nint main()\n{\n\tlong long n,i;\n\twhile(scanf(\"%lld\",&n)!=EOF)\n\t{\n\t\tint s=0,m,t,j,c,d;\n\t\tfor(i=1;i<=10;i++)\n\t\t{\n\t\t\tc=(n-2*i);\n\t\t\tt=c/3;\n\t\t\tif(c%3==0&&t>=fact(i))\n\t\t\t{\n\t\t\t\ts++;\n\t\t\t}\n\t\t}\n\n\t\t\tprintf(\"%d\\n\",s);\n\t}\n}\nint fact(int x)\n{\n\tint i,s=0;\n\tfor(i=1;i\n#define ll long long\nll arr[3000005];\nint main()\n{\n \n int i;\n arr[0]=0;\n arr[1]=2;\n\n ll a=2;\n for(i=2;i<3000005;i++)\n {\n a+=((i-1)*3+2);\n arr[i]=a;\n }\n\n ll n;\n scanf(\"%lld\",&n);\n ll ans=0;\n for(i=1;i<300005;i++)\n {\n int flag=0;\n if(n>=arr[i])\n {\n ll diff=n-arr[i];\n\n if(diff%3==0)\n {\n //printf(\"i=%d\\n\",i);\n ans+=1;\n }\n }\n }\n\n printf(\"%lld\\n\",ans);\n\n}"}, {"source_code": "#include\n#include\ntypedef long long ll;\nint main()\n{\n\tll n;\n\tscanf(\"%lld\",&n);\n\tll maxi=sqrt(n);\n\tint is=0;\n\tfor(ll i=maxi;i>=1;i--)\n\t{\n\t\tif(3*(i+i*i)%2==0)\n\t\t{\n\t\t\tif(3*(i+i*i)/2+2*(i+1)<=n)\n\t\t\t{\n\t\t\t\tif((n-(3*(i+i*i)/2+2*(i+1)))%3==0)\n\t\t\t\t{\n\t\t\t\t\tis++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\",is);\n}\n"}, {"source_code": "#include \n#define LL long long\nint main()\n{\n LL n;\n int ans=0;\n scanf(\"%I64d\",&n);\n int rem=n%3;\n LL q=n/3;\n LL start;\n if(rem==0)\n {\n start=3;\n }\n else if(rem==1)\n {\n start=2;\n }\n else\n {\n start=4;\n q++;\n }\n LL lim=(start*(start+1))/2;\n while((q+ans+1)>=lim)\n {\n ans++;\n start+=3;\n lim=(start*(start+1))/2;\n }\n printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n,i,t[3]={0},j,s;\n scanf(\"%I64d\",&n);\n for(i=2,s=0,j=0;s\nint main()\n{\n long long int n;\n scanf(\"%I64d\",&n);\n if(n==1 ||n==3 || n==4 || n==6 || n==9 || n==12)\n\tprintf(\"0\\n\");\n else\n\tprintf(\"1\\n\");\nreturn 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n\tlong n;\n\twhile(scanf(\"%ld\",&n)!=EOF)\n\t{\n\t\tlong a,b;\n\t\ta=n/3;\n\t\tb=n%3;\n\t\tlong mi=0;\n\t\tfor(;;)\n\t\t{\n\t\t\tif(b%2==1) {b=b+3;a=a-1;}\n\t\t\telse if(b%2==0){b=b+2*3 ; a=a-2; }\n\n\t\t\t if(2*a>=b/2*(b/2+1))\n\t\t\t{\n\t\t\t\tmi++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tprintf(\"%ld\\n\",mi);\n\t}\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n\tint n,a,b;\n\tscanf(\"%d\",&n);\n\tb=(sqrt(1+24*n)-1)/6;\n\ta=3-n%3;\n\tprintf(\"%d\\n\",a>b?0:(b-a)/3+1);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main(void) \n{\n\tunsigned long long int ar[1000000],n;\n\tint i,num=0;\n\tar[1]=5;\n\tar[2]=7;\n\tfor(i=3;i<1000000;i++)\n\t\t{\n\t\tar[i]=ar[i-1]+3*i-1;\n\t\t//printf(\"%llu \",ar[i]);\n\t\t}\n\tscanf(\"%llu\",&n);\n\ti=1;\n\twhile(ar[i]<=n)\n\t\t{\n\t\t\tif((n-ar[i])%3==0)\n\t\t\t\tnum++;\n\t\t\ti++;\n\t\t}\n\tprintf(\"%d\",num);\t\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tlong long n;\n\tscanf(\"%lld\",&n);\n\tlong long l=1,r=n/2+1,mid,ser,u;\n\tif (n==2) {printf(\"1\\n\");return 0;}\n\twhile (l+1=u) l=mid;\n\t\telse r=mid;\n\t}\n\tif ((l==1)&&!(mid*2+ser*3==n&&ser>=u)) {printf(\"0\\n\");return 0;}\n\telse {l=l/3+1;printf(\"%lld\\n\",l);return 0;}\n}\n"}, {"source_code": "#include\nint main()\n{\n\tlong long n,s=0,i;\n\tscanf(\"%I64d\",&n);\n\tfor ( i=1;i<=1e6;i++ )\n\t{\n\t\tif ((n+i)%3==0&&(i*i+i)*3/2<=n) s++;\n\t}\n\tprintf(\"%I64d\",s);\n}\n"}, {"source_code": "#include\n#include\ntypedef long long ll;\nll n,ans=0;\nint main()\n{\n\tscanf(\"%LLd\",&n);\n\tll right=1000000000,left=0,mid;\n\twhile(left<=right)\n\t{\n\t\tmid=(left+right)/2;\n\t\tif(2*n-(3*mid-1)*(3*mid+1)<6*mid+4)\n\t\t\tright=mid-1;\n\t\telse\n\t\t{\n\t\t\tans=mid;\n\t\t\tleft=mid+1;\n\t\t}\n\t}\n\tprintf(\"%LLd\",ans);\n}\n"}, {"source_code": "#include\n#include\ntypedef long long ll;\nll n,ans=0;\nint main()\n{\n\tscanf(\"%LLd\",&n);\n\tll right=10000000000,left=0,mid;\n\twhile(left<=right)\n\t{\n\t\tmid=(left+right)/2;\n\t\t\tif(2*n-3*(mid+1)*mid<(mid+1)*4)\n\t\t\t{\n\t\t\t\t right=mid-1;\n\t\t\t}\n\t\t else\n\t\t {\n ans=mid;\n\t\t\t\t left=mid+1;\n\t\t\t }\n\t}\n\tif((n-(3*(ans+1)*ans/2))%2!=0&&ans>0)\n\t\tans--;\n\tprintf(\"%LLd\",ans);\n}\n"}, {"source_code": "#include\n#include\ntypedef long long ll;\nll n,ans=0;\nint main()\n{\n\tscanf(\"%LLd\",&n);\n\tll i,ans=0,x;\n\tfor(i=1;i\n#include\ntypedef long long ll;\nll n,ans=0;\nint main()\n{\n\tscanf(\"%LLd\",&n);\n\tll right=1000000000,left=0,mid;\n\twhile(left<=right)\n\t{\n\t\tmid=(left+right)/2;\n\t\tif(2*n-(3*mid+1)*mid<6*mid+4)\n\t\t\tright=mid-1;\n\t\telse\n\t\t{\n\t\t\tans=mid;\n\t\t\tleft=mid+1;\n\t\t}\n\t}\n\tprintf(\"%LLd\",ans);\n}\n"}, {"source_code": "#include\nint main() {\n\tlong long int i=0,j=2,k,l,n,m;\n\tscanf(\"%lld\",&n);\n\tfor(;n-j>=0;j+=3,i++) n -= j;\n\tprintf(\"%lld\\n\",n%3?0:i);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main() {\n\tlong long int i=0,j=2,k,l,n,m;\n\tscanf(\"%lld\",&n);\n\tfor(;n-j>=0;j+=3,i++) n -= j;\n\tprintf(\"%lld\\n\",n%3?0:i-1);\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n long long n;\n scanf(\"%lld\",&n);\n long long count = 0,check=2,var=2,iter = 1;\n while(checkcheck && ((n+iter)%3==0))\n count++;\n var = var+iter*3;\n check = check + var;\n iter++;\n }\n printf(\"%lld\",count);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n long long n;\n scanf(\"%lld\",&n);\n long long count = 0,check=2,var=2,iter = 1;\n while(checkcheck && ((n+iter)%3==0))\n count++;\n var = var+3;\n check = check + var;\n iter++;\n }\n printf(\"%lld\",count);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n long long int n,i,s,j,sum=0;\n scanf(\"%I64d\",&n);\n s=2;\n i=1;\n while(s\nint main()\n{\t\n\tlong int n,count=0,t,i,q,sum;\n\tscanf(\"%ld\",&n);\n\tt=n/5;\n\tfor(i=1;i=sum)\n\t\t\t\tcount++;\n\t\t}\n\t}\n\tprintf(\"%ld\\n\",count);\n\treturn 0;\n}\n\n"}, {"source_code": "#include\n#include\nint n;\nint main()\n{\n\twhile (scanf(\"%d\",&n)!=EOF)\n\t{int k=0;\n\t\tfor(int i=sqrt(n);i>=1;i--)\n\t\t{\n\t\t\tif((2*n-(3*i*i+i))%3==0)\n\t\t\tk++;\n\t\t}\n\t\tprintf(\"%d\\n\",k);\n\t}\n}"}, {"source_code": "#include\nmain()\n{\n\tint n;\n\twhile(scanf(\"%d\",&n)!=EOF)\n\t{\n\t\tint i,j=2,b[n+5],s=0,k,f=0;\n\t\tfor(i=2;ib[i/2])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%d\\n\",(i-2)/2);\n\t\t\t\t\tf=1;\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\ts=0;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t\tif(f==0)\n\t\t{\n\t\t\tprintf(\"0\\n\");\n\t\t}\n\t}\n}\n"}, {"source_code": "#include \nlong long x(int n)\n{\nlong long i, sum=0,s;\n for (i=1;i<=n;i++)\n sum+=i;\ns=(sum+n)*3;\nreturn s;\n}\nint main()\n{\n long long n,i,s;\n scanf(\"%I64d\",&n);\n for (i=1;i<10000000;i++)\n {\n if (x(i)>n)\n {s=i;\n break;}\n }\n printf(\"%I64d\\n\",s-1);\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n#include \nint main()\n{\n\tlong long n,a[100005],i;\n\tscanf(\"%I64d\",&n);\n\tfor (i=1;i<=100005;i++)\n\t {if((i-1)*i*3/2+2*i>n)\n\t break;\n\t }\n\tprintf(\"%I64d\\n\",i-2);\n}\n"}, {"source_code": "#include \n\nint main() {\n long long n,m,i,j,k,a,b,c,t;\n scanf(\"%lld\",&n);\n for(i=0;(i*(3*i+1))/2<=n;++i);\n i--;\n //printf(\"%lld\\n\",i);\n if(n%3==0) j=i/3;\n if(n%3==1) j=(i+2)/3;\n if(n%3==2) j=(i+1)/3;\n printf(\"%lld\\n\",j);\n return 0;\n} "}, {"source_code": "#include \n\nint main() {\n long long n,m,i,j,k,a,b,c,t;\n scanf(\"%lld\",&n);\n if(n%3==2){\n n=n-2;\n i=0;\n \n while((i*(i+1))/2<=n) i++;\n i=i-1;\n j=0;\n for(a=1;a<=i;a=a+3) ++j;\n if(n<0) j=0;\n }else if(n%3==1){\n n=n-4;\n i=0;\n \n while((i*(i+1))/2<=n) i++;\n i=i-1;\n j=0;\n for(a=2;a<=i;a=a+3) ++j;\n \n if(n<0) j=0;\n }else{\n n=n-6;\n i=0;\n while((i*(i+1))/2<=n) i++;\n i=i-1;\n j=0;\n for(a=3;a<=i;a=a+3) ++j;\n \n if(n<0) j=0;\n }\n if(j>0) printf(\"%lld\\n\",j);\n else printf(\"0\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n long long n,m,i,j,k,a,b,c,t;\n scanf(\"%lld\",&n);\n if(n%3==2){\n n=n-2;\n i=0;\n \n while((i*(i+1))/2<=n) i++;\n i=i--;\n j=0;\n for(a=1;a<=i;a=a+3) ++j;\n \n if(n<0) j=0;\n }else if(n%3==1){\n n=n-4;\n i=0;\n \n while((i*(i+1))/2<=n) i++;\n i=i--;\n j=0;\n for(a=2;a<=i;a=a+3) ++j;\n \n if(n<0) j=0;\n }else{\n n=n-6;\n i=0;\n while((i*(i+1))/2<=n) i++;\n i=i--;\n j=0;\n for(a=3;a<=i;a=a+3) ++j;\n \n if(n<0) j=0;\n }\n if(j>0) printf(\"%lld\\n\",j);\n else printf(\"0\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(void)\n{\n\tint n;\n\tint b;\n\tint i;\n\tint c;\n\n\tscanf(\"%d\", &n);\n\n\tc = 0;\n\tfor(i = 1, b = 2; b <= n; i ++, b += 3 * i - 1)\n\t{\n\t\tif((n - b) % 3 == 0)\n\t\t\tc ++;\n\t}\n\n\tprintf(\"%d\\n\", c);\n\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int n,h,k,k1,f;\n scanf(\"%d\",&n);\n h=0;\n if((n+1)%2==0)\n h++;\n k=(int)(7/2+sqrt(49/4-2*(-2-n)));\n for(k1=2;k1<=k;k1++)\n {\n f=k1*(k1-1)/2;\n if((n-(k1-1)*2-f)%2==0)\n if((n-(k1-1)*2-f)%2>=f)\n h++;\n }\n printf(\"%d\\n\",h);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int n,h,k,k1,f;\n double i;\n scanf(\"%d\",&n);\n h=0;\n if((n+1)%2==0)\n h++;\n i=sqrt(49/4-4/2*(-2-n));\n k=(int)(7/2+i);\n for(k1=2;k1=f)\n h++;\n }\n printf(\"%d\\n\",h);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int n,h,k,s;\n scanf(\"%d\",&n);\n h=0;\n if((n+1)%3==0)\n h++;\n s=7;\n k=5;\n for(s=7;s<=n;s=s+k)\n {\n if((n-s)%3==0)\n h++;\n k=k+3;\n }\n printf(\"%d\\n\",h);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n\tlong long int n;\n\tscanf(\"%lld\",&n);\n\tlong long int m=(-1+sqrt(1+24*n))/6;\n\tint i=(3-n)%3;\n\tint j=m%3;\n\tint k=0;\n\tif(i<=j&&i!=0)\n\t\tk=1;\n\tprintf(\"%lld\",m/3+k);\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n\nvoid solve(long long int x)\n{\n long long int n=(long long int)((sqrt(24*x + 1) - 1)/6.0);\n long long int ans=0,rem=x-(3*n*n+n)/2;\n if(n>1)\n {\n ans=1;\n while(n>1)\n {\n if((rem+2)%3==0)\n {\n ans++;\n }\n rem+=2;\n n--;\n }\n }\n printf(\"%lld\",ans);\n}\nint main()\n{\n long long int n;\n scanf(\"%lld\",&n);\n solve(n);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n long long int n,i,j,count=0;\n scanf(\"%lld\",&n);\n \n j=sqrt(n);\n for(i=1;i<=j;i++)\n {\n if((n+i)%3==0)\n count++;\n }\n \n printf(\"%lld\\n\",count);\n \n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n long long int n,i,j,count=0;\n scanf(\"%lld\",&n);\n \n //j=sqrt(n);\n j = (1 + sqrt(1+24*n))/6;\n for(i=1;i<=j;i++)\n {\n if((n+i)%3==0)\n count++;\n }\n \n printf(\"%lld\\n\",count);\n \n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n\tlong long int i,sum,j,k,l,n,m,rem;\n\tscanf(\"%lld\",&n);\n\tsum=2;\n\tm = 1;\n\twhile(sum\nint main(){\n\tlong long int i,sum,j,k,l,n,m,rem;\n\tscanf(\"%lld\",&n);\n\tsum=2;\n\tm = 1;\n\twhile(sum\nint main(){\n\tint i,j,k,l,n,m,a[10];\n\tfor(i=0;i<10;i++)\n\t\ta[i]=0;\n\tfor(i=0;i<6;i++){\n\t\tscanf(\"%d\",&n);\n\t\ta[n]++;\n\t}\n\tint flag=0;\n\tfor(i=1;i<10;i++){\n\t\tif(a[i]>=4){\n\t\t\tif(a[i]==4){\n\t\t\t\tfor(j=1;j<10;j++)\n\t\t\t\t\tif(a[j]==2){\n\t\t\t\t\t\tflag=1;\n\t\t\t\t\t\tprintf(\"Elephant\\n\");\n\t\t\t\t\t}\n\t\t\t\tif(flag==0)\n\t\t\t\t\tprintf(\"Bear\\n\");\n\t\t\t}\n\t\t\telse if(a[i]==6)\n\t\t\t\tprintf(\"Elephant\\n\");\n\t\t\telse\n\t\t\t\tprintf(\"Bear\\n\");\n\t\t\tflag=1;\n\t\t}\n\t}\n\tif(flag==0){\n\t\tprintf(\"Alien\\n\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main(){\n\tlong long int i,sum,j,k,l,n,m,rem;\n\tscanf(\"%lld\",&n);\n\tsum=2;\n\tm = 1;\n\twhile(sum\nint main(){\n\tlong long int sum,rem,i,j,k,l,n,m;\n\tscanf(\"%lld\",&n);\n\tsum=0;\n\tm=1;\n\tif(n==1)\n\t\tprintf(\"0\\n\");\n\telse{\n\t\twhile(sum<=n){\n\t\t\tsum = (m*(3*m+1))/2;\n\t\t\tm++;\n\t\t}\n\t\tprintf(\"%lld\\n\",m-3);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main(){\n\tlong long int i,sum,j,k,l,n,m,rem;\n\tscanf(\"%lld\",&n);\n\tsum=2;\n\tm = 1;\n\twhile(sum\nint main(){\n\tlong long int sum,rem,i,j,k,l,n,m;\n\tscanf(\"%lld\",&n);\n\tsum=0;\n\tm=1;\n\twhile(sum<=n){\n\t\tsum = (m*(3*m+1))/2;\n\t\tm++;\n\t}\n\tprintf(\"%lld\\n\",m-2);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main(){\n\tlong long int i,sum,j,k,l,n,m,rem;\n\tscanf(\"%lld\",&n);\n\tsum=2;\n\tm = 1;\n\twhile(sum\nint main(){\n\tlong long int last,sum=2,i,j,k,l,n,m,rem;\n\tscanf(\"%lld\",&n);\n\tm = 1;\n\trem = 5;\n\twhile(sum1)\n\t\t\t\t\tprintf(\"%lld\\n\",m/3+1);\n\t\t\t\telse\n\t\t\t\t\tprintf(\"0\\n\");\n\t\t\telse\n\t\t\t\tprintf(\"%lld\\n\",m/3+1);\n\t\t}\n\t\telse{\n\t\t\tif(m%3==0)\n\t\t\t\tprintf(\"%lld\\n\",m/3);\n\t\t\telse if(m%3==1)\n\t\t\t\tprintf(\"%lld\\n\",(m-1)/3);\n\t\t\telse\n\t\t\t\tprintf(\"%lld\\n\",(m-2)/3);\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\nlong long add(long long x);\nint main(void)\n{\n\tlong long m;\n\tscanf(\"%lld\",&m);\n\tint min=0,max=4000000;\n\tint mid;\n\twhile(min<=max)\n\t{\n\t\tmid=(min+max)/2;\n\t\tif(3*add(mid)+2*mid>m)\n\t\t max=mid-1;\n else\n min=mid+1;\n\t}\n\tint count=0;\n\tfor(int i=1;iadd(i-1))\n\t\t count++;\n\t}\n\tprintf(\"%d\\n\",count);\n\treturn 0;\n}\n\nlong long add(long long x)\n{\n\tlong long ans=0;\n\tfor(int i=1;i<=x;i++)\n\t ans=ans+x;\n\t return ans;\n}\n"}, {"source_code": "#include\nlong long add(long long x);\nint main(void)\n{\n\tlong long m;\n\tscanf(\"%lld\",&m);\n\tint min=0,max=4000000;\n\tint mid;\n\twhile(min<=max)\n\t{\n\t\tmid=(min+max)/2;\n\t\tif(3*add(mid)+2*mid>m)\n\t\t max=mid-1;\n else\n min=mid+1;\n\t}\n\tint count=0;\n\tfor(int i=1;i=add(i-1))\n\t\t count++;\n\t}\n\tprintf(\"%d\\n\",count);\n\treturn 0;\n}\n\nlong long add(long long x)\n{\n\tlong long ans=0;\n\tfor(int i=1;i<=x;i++)\n\t ans=ans+x;\n\t return ans;\n}\n"}, {"source_code": "#include\n#include\ntypedef long long ll;\nint main()\n{\n\tll n;\n\tscanf(\"%lld\",&n);\n\tll maxi=sqrt(n);\n\tint is=0;\n\tfor(ll i=maxi;i>=1;i--)\n\t{\n\t\tif(3*(i+i*i)%2==0)\n\t\t{\n\t\t\tif(3*(i+i*i)/2+2*(i+1)<=n)\n\t\t\t{\n\t\t\t\tif((n-(3*(i+i*i)/2+2*(i+1)))%3==0)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%lld\",i);\n\t\t\t\t\tis=1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif(is==0)\n\t{\n\t\tprintf(\"0\");\n\t}\n}\n"}], "src_uid": "ab4f9cb3bb0df6389a4128e9ff1207de"} {"nl": {"description": "As you know, lemmings like jumping. For the next spectacular group jump n lemmings gathered near a high rock with k comfortable ledges on it. The first ledge is situated at the height of h meters, the second one is at the height of 2h meters, and so on (the i-th ledge is at the height of i·h meters). The lemmings are going to jump at sunset, and there's not much time left.Each lemming is characterized by its climbing speed of vi meters per minute and its weight mi. This means that the i-th lemming can climb to the j-th ledge in minutes.To make the jump beautiful, heavier lemmings should jump from higher ledges: if a lemming of weight mi jumps from ledge i, and a lemming of weight mj jumps from ledge j (for i < j), then the inequation mi ≤ mj should be fulfilled.Since there are n lemmings and only k ledges (k ≤ n), the k lemmings that will take part in the jump need to be chosen. The chosen lemmings should be distributed on the ledges from 1 to k, one lemming per ledge. The lemmings are to be arranged in the order of non-decreasing weight with the increasing height of the ledge. In addition, each lemming should have enough time to get to his ledge, that is, the time of his climb should not exceed t minutes. The lemmings climb to their ledges all at the same time and they do not interfere with each other.Find the way to arrange the lemmings' jump so that time t is minimized.", "input_spec": "The first line contains space-separated integers n, k and h (1 ≤ k ≤ n ≤ 105, 1 ≤ h ≤ 104) — the total number of lemmings, the number of ledges and the distance between adjacent ledges. The second line contains n space-separated integers m1, m2, ..., mn (1 ≤ mi ≤ 109), where mi is the weight of i-th lemming. The third line contains n space-separated integers v1, v2, ..., vn (1 ≤ vi ≤ 109), where vi is the speed of i-th lemming.", "output_spec": "Print k different numbers from 1 to n — the numbers of the lemmings who go to ledges at heights h, 2h, ..., kh, correspondingly, if the jump is organized in an optimal way. If there are multiple ways to select the lemmings, pick any of them.", "sample_inputs": ["5 3 2\n1 2 3 2 1\n1 2 1 2 10", "5 3 10\n3 4 3 2 1\n5 4 3 2 1"], "sample_outputs": ["5 2 4", "4 3 1"], "notes": "NoteLet's consider the first sample case. The fifth lemming (speed 10) gets to the ledge at height 2 in minutes; the second lemming (speed 2) gets to the ledge at height 4 in 2 minutes; the fourth lemming (speed 2) gets to the ledge at height 6 in 3 minutes. All lemmings manage to occupy their positions in 3 minutes. "}, "positive_code": [{"source_code": "#include \n#include \n\ntypedef struct {\n int m;\n int v;\n int i;\n} lemmings;\n\nint cmp(const void *a, const void *b)\n{\n if (((lemmings *)a)->m != ((lemmings *)b)->m) {\n\t return ((lemmings *)a)->m - ((lemmings *)b)->m;\n } else {\n\t return ((lemmings *)a)->v - ((lemmings *)b)->v;\n }\n}\n\nint main()\n{\n int n, k, h, i, j;\n double l, r, m;\n lemmings a[100000];\n int b[100000], c[100000];\n\n scanf(\"%d %d %d\", &n, &k, &h);\n\n for (i = 0; i < n; i++) scanf(\"%d\", &a[i].m);\n for (i = 0; i < n; i++) scanf(\"%d\", &a[i].v);\n\n for (i = 0; i < n; i++) a[i].i = i + 1;\n\n qsort(a, n, sizeof(lemmings), cmp);\n\n l = 0, r = 1e18, m = (l + r) / 2;\n\n for (i = 0; i < 500; i++) {\n\t int p = 0;\n\n\t for (j = 0; j < n && p < k; j++) {\n\t if ((double)(p + 1) * h / a[j].v <= m) {\n\t\t b[p++] = a[j].i;\n\t }\n\t }\n\n\t if (p >= k) {\n\t r = m;\n\t m = (l + r) / 2;\n\n\t for (j = 0; j < k; j++) c[j] = b[j];\n\t } else {\n\t l = m;\n\t m = (l + r) / 2;\n\t }\n }\n\n for (i = 0; i < k; i++) {\n\t if (i > 0) putchar(' ');\n\n\t printf(\"%d\", c[i]);\n }\n\n puts(\"\");\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\ntypedef struct {\n int m;\n int v;\n int i;\n} lemmings;\n\nint cmp(const void *a, const void *b)\n{\n if (((lemmings *)a)->m != ((lemmings *)b)->m) {\n\t return ((lemmings *)a)->m - ((lemmings *)b)->m;\n } else {\n\t return ((lemmings *)a)->v - ((lemmings *)b)->v;\n }\n}\n\nint main()\n{\n int n, k, h, i, j;\n double l, r, m;\n lemmings a[100000];\n int b[100000], c[100000];\n\n scanf(\"%d %d %d\", &n, &k, &h);\n\n for (i = 0; i < n; i++) scanf(\"%d\", &a[i].m);\n for (i = 0; i < n; i++) scanf(\"%d\", &a[i].v);\n\n for (i = 0; i < n; i++) a[i].i = i + 1;\n\n qsort(a, n, sizeof(lemmings), cmp);\n\n l = 0, r = 1e18, m = (l + r) / 2;\n\n for (i = 0; i < 500; i++) {\n\t int p = 0;\n\n\t for (j = 0; j < n && p < k; j++) {\n\t if ((double)(p + 1) * h / a[j].v <= m) {\n\t\t b[p++] = a[j].i;\n\t }\n\t }\n\n\t if (p >= k) {\n\t r = m;\n\t m = (l + r) / 2;\n\n\t for (j = 0; j < k; j++) c[j] = b[j];\n\t } else {\n\t l = m;\n\t m = (l + r) / 2;\n\t }\n }\n\n for (i = 0; i < k; i++) {\n\t if (i > 0) putchar(' ');\n\n\t printf(\"%d\", c[i]);\n }\n\n puts(\"\");\n\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include \n#include \n\ntypedef struct {\n int m;\n int v;\n int i;\n} lemmings;\n\nint cmp(const void *a, const void *b)\n{\n if (((lemmings *)a)->m != ((lemmings *)b)->m) {\n\t return ((lemmings *)a)->m - ((lemmings *)b)->m;\n } else {\n\t return ((lemmings *)a)->v - ((lemmings *)b)->v;\n }\n}\n\nint main()\n{\n int n, k, h, c, i, j;\n double l, r, m;\n lemmings a[100000];\n\n scanf(\"%d %d %d\", &n, &k, &h);\n\n for (i = 0; i < n; i++) scanf(\"%d\", &a[i].m);\n for (i = 0; i < n; i++) scanf(\"%d\", &a[i].v);\n\n for (i = 0; i < n; i++) a[i].i = i + 1;\n\n qsort(a, n, sizeof(lemmings), cmp);\n\n l = 0, r = 1e9, m = (l + r) / 2;\n\n for (i = 0; i < 500; i++) {\n\t c = 0;\n\n\t for (j = 0; j < n; j++) {\n\t if ((double)(c + 1) * h / a[j].v <= m) c++;\n\t }\n\n\t if (c >= k) {\n\t r = m;\n\t m = (l + r) / 2;\n\t } else {\n\t l = m;\n\t m = (l + r) / 2;\n\t }\n }\n\n for (i = 0, c = 0; i < n && c < k; i++) {\n\t if ((double)(c + 1) * h / a[i].v <= r) {\n\t if (c > 0) putchar(' ');\n\n\t printf(\"%d\", a[i].i);\n\n\t c++;\n\t }\n }\n\n puts(\"\");\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\ntypedef struct {\n int m;\n int v;\n int i;\n} lemmings;\n\nint cmp(const void *a, const void *b)\n{\n if (((lemmings *)a)->m != ((lemmings *)b)->m) {\n\t return ((lemmings *)a)->m - ((lemmings *)b)->m;\n } else {\n\t return ((lemmings *)a)->v - ((lemmings *)b)->v;\n }\n}\n\nint main()\n{\n int n, k, h, c, i, j;\n double l, r, m;\n lemmings a[100000];\n\n scanf(\"%d %d %d\", &n, &k, &h);\n\n for (i = 0; i < n; i++) scanf(\"%d\", &a[i].m);\n for (i = 0; i < n; i++) scanf(\"%d\", &a[i].v);\n\n for (i = 0; i < n; i++) a[i].i = i + 1;\n\n qsort(a, n, sizeof(lemmings), cmp);\n\n l = 0, r = 1e18, m = (l + r) / 2;\n\n for (i = 0; i < 100; i++) {\n\t c = 0;\n\n\t for (j = 0; j < n; j++) {\n\t if ((double)(c + 1) * h / a[j].v <= m) c++;\n\t }\n\n\t if (c >= k) {\n\t r = m;\n\t m = (l + r) / 2;\n\t } else {\n\t l = m;\n\t m = (l + r) / 2;\n\t }\n }\n\n for (i = 0, c = 0; i < n && c < k; i++) {\n\t if ((double)(c + 1) * h / a[i].v <= r) {\n\t if (c > 0) putchar(' ');\n\n\t printf(\"%d\", a[i].i);\n\n\t c++;\n\t }\n }\n\n puts(\"\");\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\ntypedef struct {\n int m;\n int v;\n int i;\n} lemmings;\n\nint cmp(const void *a, const void *b)\n{\n if (((lemmings *)a)->m != ((lemmings *)b)->m) {\n\t return ((lemmings *)a)->m - ((lemmings *)b)->m;\n } else {\n\t return ((lemmings *)a)->v - ((lemmings *)b)->v;\n }\n}\n\nint main()\n{\n int n, k, h, i, j;\n double l, r, m;\n lemmings a[100000];\n int b[100000], c[100000];\n\n scanf(\"%d %d %d\", &n, &k, &h);\n\n for (i = 0; i < n; i++) scanf(\"%d\", &a[i].m);\n for (i = 0; i < n; i++) scanf(\"%d\", &a[i].v);\n\n for (i = 0; i < n; i++) a[i].i = i + 1;\n\n qsort(a, n, sizeof(lemmings), cmp);\n\n l = 0, r = 1e18, m = (l + r) / 2;\n\n for (i = 0; i < 100; i++) {\n\t int p = 0;\n\n\t for (j = 0; j < n && p < k; j++) {\n\t if ((double)(p + 1) * h / a[j].v <= m) {\n\t\t b[p++] = a[j].i;\n\t }\n\t }\n\n\t if (p >= k) {\n\t r = m;\n\t m = (l + r) / 2;\n\n\t for (j = 0; j < k; j++) c[j] = b[j];\n\t } else {\n\t l = m;\n\t m = (l + r) / 2;\n\t }\n }\n\n for (i = 0; i < k; i++) {\n\t if (i > 0) putchar(' ');\n\n\t printf(\"%d\", c[i]);\n }\n\n puts(\"\");\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\ntypedef struct {\n int m;\n int v;\n int i;\n} lemmings;\n\nint cmp(const void *a, const void *b)\n{\n if (((lemmings *)a)->m != ((lemmings *)b)->m) {\n\t return ((lemmings *)a)->m - ((lemmings *)b)->m;\n } else {\n\t return ((lemmings *)a)->v - ((lemmings *)b)->v;\n }\n}\n\nint main()\n{\n int n, k, h, c, i, j;\n double l, r, m;\n lemmings a[100000];\n\n scanf(\"%d %d %d\", &n, &k, &h);\n\n for (i = 0; i < n; i++) scanf(\"%d\", &a[i].m);\n for (i = 0; i < n; i++) scanf(\"%d\", &a[i].v);\n\n for (i = 0; i < n; i++) a[i].i = i + 1;\n\n qsort(a, n, sizeof(lemmings), cmp);\n\n l = 0, r = 1e9, m = (l + r) / 2;\n\n for (i = 0; i < 100; i++) {\n\t c = 0;\n\n\t for (j = 0; j < n; j++) {\n\t if ((double)(c + 1) * h / a[j].v <= m) c++;\n\t }\n\n\t if (c >= k) {\n\t r = m;\n\t m = (l + r) / 2;\n\t } else {\n\t l = m;\n\t m = (l + r) / 2;\n\t }\n }\n\n for (i = 0, c = 0; i < n && c < k; i++) {\n\t if ((double)(c + 1) * h / a[i].v <= r) {\n\t if (c > 0) putchar(' ');\n\n\t printf(\"%d\", a[i].i);\n\n\t c++;\n\t }\n }\n\n puts(\"\");\n\n return 0;\n}\n"}], "src_uid": "6861128fcd83c752b0ea0286869901c2"} {"nl": {"description": "Little Joty has got a task to do. She has a line of n tiles indexed from 1 to n. She has to paint them in a strange pattern.An unpainted tile should be painted Red if it's index is divisible by a and an unpainted tile should be painted Blue if it's index is divisible by b. So the tile with the number divisible by a and b can be either painted Red or Blue.After her painting is done, she will get p chocolates for each tile that is painted Red and q chocolates for each tile that is painted Blue.Note that she can paint tiles in any order she wants.Given the required information, find the maximum number of chocolates Joty can get.", "input_spec": "The only line contains five integers n, a, b, p and q (1 ≤ n, a, b, p, q ≤ 109).", "output_spec": "Print the only integer s — the maximum number of chocolates Joty can get. Note that the answer 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.", "sample_inputs": ["5 2 3 12 15", "20 2 3 3 5"], "sample_outputs": ["39", "51"], "notes": null}, "positive_code": [{"source_code": "#include\nint gcd(long long int a,long long int b)\n{\n\tif(a==0) return b;\n\telse if(b==0) return a;\n\telse if(a>b) return gcd(a%b,b);\n\telse if(aq)\n\t{\n\t\tc=n/a;\n\t\td=n/b-(e);\n\t}\n\telse if(p<=q)\n\t{\n\t\tc=n/a-(e);\n\t\td=n/b;\n\t}\n\tx=(c*p)+(d*q);\n\tprintf(\"%I64d\\n\",x);\n}\n"}, {"source_code": "#include \n#include \n\n long long int gcd( long long int a, long long int b){ \n /* if (a == 0 || b == 0){ \n return 0; \n }if (a == b){ \n return a; \n }if (a > b){ \n return gcd(a-b, b); \n }else{ \n return gcd(a, b-a); \n }\n */\n \n long long int temp;\n while (b != 0)\n {\n temp = a % b;\n\n a = b;\n b = temp;\n }\n return a;\n}\n\n/*\n\n ------\n long long int gcd; \n\n for(long long int i=1; i <= a && i <= b; ++i)\n {\n if(a%i==0 && b%i==0)\n gcd = i;\n } \n return gcd;\n */\n \n\n/*\n utilizo la funcion gcd para obtener el greatest common divisor el cual\n será utilizado en la sig función lcm\n*/\n\n long long int lcm( long long int a, long long int b){ \n return (a*b)/gcd(a, b); \n } \n\n\nint main(){\n \n long long int res1, res2, max, n, a, b, p, q, na, nb, dos;\n\n //los hice int long long porque decía eso en codeforce\n\nscanf(\"%I64d %I64d %I64d %I64d %I64d\", &n, &a, &b, &p, &q);\n\nna=n/a; //si n es divisible entre a\nnb=n/b; // si n es divisible entre b\n\n/*\nif(p>q){\n\tmin=q;\n}else{\n\tmin=p;\n}\n*/\n\n\ndos=n/lcm(a,b);\n\n// dos es para sacar si hay en común \n//llamo a la función lcm para sacar el least common multiple\n//con base en eso divido n entre su LCM de a y b, para sacar el #de divisiones en común\n\nres1=((na-dos)*p+nb*q);\nres2=((nb-dos)*q+na*p);\n\n/*\nprintf(\"n %I64d/ lcm %I64d \\n\", n, lcm(a,b));\nprintf(\"na %I64d nb %I64d dos %I64d res1 %I64d res 2 %I64d\\n\", na, nb, dos, res1, res2);\n\nsaco aquí las dos posibles respuestas, restándole en una a na las divisiones en común \ny en la otra en nb. el resto es lo mismo \n*/\n\nif(res1>res2){\n\tmax=res1;\n}else{\n\tmax=res2;\n}\n\n/*\naquí saco la respuesta con más valor\n*/\n\n\nprintf(\"%I64d\\n\", max);\n\n\n\n\n}"}, {"source_code": "#include\nlong long gcd(long long a,long long b){\nif(a%b==0) return b;\nif(b%a==0) return a;\nreturn gcd(b,a%b);\n}\nint main(){\nlong long int n,a,b,p,q;\nscanf(\"%I64d %I64d %I64d %I64d %I64d\",&n,&a,&b,&p,&q);\nlong long int k=(n/a)*p + (n/b)*q;\n//printf(\"%d\\n\",k);\nif(p>q) printf(\"%I64d\",k-((n*gcd(a,b))/(a*b))*q);\nelse printf(\"%I64d\",k-((n*gcd(a,b))/(a*b))*p);\n\n}\n"}, {"source_code": "#include \nlong long int gcd(long long int a, long long int b)\n{\n\tif(b==0)\n\t\treturn a;\n\telse \n\t\treturn gcd(b,a%b);\n}\n\nlong long int lcm(long long int a, long long int b)\n{\n return (a*b)/gcd(a, b);\n}\nint main()\n{\n\tlong long int n,a,b,p,q;\n\tscanf(\"%lld %lld %lld %lld %lld\",&n,&a,&b,&p,&q);\n\tlong long int ans;\n\tif(p>q)\n\t\tans=p;\n\telse ans=q;\n\tlong long int answer=p*((n/a)-(n/lcm(a,b)))+ q*((n/b)-(n/lcm(a,b)))+(n/lcm(a,b))*ans;\n\tprintf(\"%lld\", answer);\n\treturn 0;\n\n}"}, {"source_code": "#include\nlong hcf(long int a,long int b)\n{\n while(a!=b)\n {\n if(a>b)\n a=a-b;\n else\n b=b-a;\n }\n return a;\n}\nint main()\n{\n long long int n,a,b,p,q,x;\n unsigned long long int sum=0;\n scanf(\"%I64d %I64d %I64d %I64d %I64d\",&n,&a,&b,&p,&q);\n x=((long long)(a*b))/hcf(a,b);\n sum+=(long long)p*(n/a-(n/x));\n sum+=q*(n/b-(n/x));\n if(p>q)\n sum+=(long long)p*(n/x);\n else\n sum+=(long long)q*(n/x);\n printf(\"%I64d\",sum);\n}\n"}, {"source_code": "#include \ntypedef long long ll;\n\nll gcd(ll a,ll b)\n{\n // printf(\"%lld %lld\\n\",a,b);\n if(aq)\n {\n answer += comm*p; \n }\n \n else\n {\n answer += comm*q;\n }\n printf(\"%lld\\n\",answer);\n // printf(\"%lld\\n\",gcd(27,45));\n return 0;\n}\n"}, {"source_code": "#include\n\nlong long int lcm_(long long int a,long long int b){\n\n long long int t,l,s;\n l=a>b?a:b;\n s=a\nint main()\n{\n int n,a,b,p,q,a1,b1,ab,c=0,temp;\n long long ans,lcm,m;\n scanf(\"%d%d%d%d%d\",&n,&a,&b,&p,&q);\n a1=n/a;\n b1=n/b;\n m=1ll*a*b;\n while(a&&b)\n {\n temp=b%a;\n b=a;\n a=temp;\n }\n lcm=m/b;\n ab=n/lcm;\n //printf(\"%d\\n\",lcm);\n if(p>q)\n {\n b1=b1-ab;\n }\n else\n {\n a1=a1-ab;\n }\n ans=1LL*p*a1+1LL*q*b1;\n printf(\"%lld\",ans);\n return 0;\n}\n"}, {"source_code": "#include\nint gcd(long long a,long long b)\n{\n if(b==0)\n return a;\n else\n return gcd(b,a%b);\n}\n\nmain()\n{\n long long int n,a,b,p,q,x,y,z,l;\n scanf(\"%I64d %I64d %I64d %I64d %I64d\",&n,&a,&b,&p,&q);\n l=a*b/gcd(a,b);\n z=n/l;\n if(p\nlong long int gcd(long long int a,long long int b)\n{\n\tif(b==0)\n\t{\n\t\treturn a;\n\t}\n\telse\n\t{\n\t\tgcd(b,a%b);\n\t}\n}\nint main()\n{\n\tlong long int n,a,b,p,q,lcm,gcd1,max,sum,nl,na,nb;\n\tscanf(\"%lld%lld%lld%lld%lld\",&n,&a,&b,&p,&q);\n\tgcd1= gcd(a,b);\n//\tprintf(\"gcd id %lld\\n\",gcd1);\n\tlcm= (a*b)/gcd1;\n\tif(p>=q)\n\t{\n\t\tmax=p;\n\t}\n\telse\n\t{\n\t\tmax=q;\n\t}\n\tnl= n/lcm;\n\tna= (n/a)-nl;\n\tnb= (n/b)-nl;\n\tsum= (na*p)+(nb*q)+(nl*max);\n\tprintf(\"%lld\\n\",sum);\n\treturn 0;\n}\n"}, {"source_code": "#include\ntypedef long long int ll;\nll gcd(ll a, ll b)\n{\n if (b == 0)\n return a;\n return gcd(b, a % b);\n\n}\nll lcm(ll a,ll b)\n{\n return (a*b)/gcd(a, b);\n}\nint main()\n{\n ll n,a,b,p,q,l1,l2,c; scanf(\"%lld%lld%lld%lld%lld\",&n,&a,&b,&p,&q);\n l1=n/a; l2=n/b;\n long long l=lcm(a,b);\n c=n/l;\n if(q>p) l1-=c;\n else l2-=c;\n long long int res=(l1*p)+(l2*q);\n printf(\"%lld\\n\",res);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\ntypedef long long ll;\n\n// function to calculate gcd \n// or hcf of two numbers. \nll gcd(ll a, ll b) { \n if (a == 0) \n return b; \n return gcd(b % a, a); \n} \n \n// function to calculate \n// lcm of two numbers. \nll lcm(ll a, ll b) {\n return (a * b) / gcd(a, b); \n} \n\nint main(){\n\t\n\tll n,a,b,p,q;\n\tscanf(\"%lli %lli %lli %lli %lli\",&n,&a,&b,&p,&q);\n\n\t//multiples of the first one\n\tconst ll ma = n/a;\n\tconst ll mb = n/b;\n\tconst ll both = n/lcm(a,b);\n\n\t//optimize for reward\n\tll best = 0;\n\tif(p > q) {\n\t\t//prefer ma, get the excluisve b\n\t\tconst ll exb = mb - both;\n\t\tbest = ma*p+exb*q;\n\t} else {\n\t\tconst ll exa = ma - both;\n\t\tbest = mb*q+exa*p;\n\t}\n\n\tprintf(\"%lli\",best);\n\n\treturn 0;\n}"}, {"source_code": "#include \nlong long lcm(long long a,long long b)\n{\n if(b==0)return a;\n else return lcm(b,a%b);\n}\nint main()\n{\n long long n,a,b,p,q,m;\n long long ans;\n while(scanf(\"%I64d%I64d%I64d%I64d%I64d\",&n,&a,&b,&p,&q)!=EOF)\n {m=a*b/lcm(a,b);\n if(p>q)\n ans=(n/a)*p+(n/b)*q-(n/m)*q;\n else ans=(n/a)*p+(n/b)*q-(n/m)*p;\n printf(\"%I64d\\n\",ans);\n }\n}\n"}, {"source_code": "#include\n// C program to find LCM of two numbers\n#include \n\n// Recursive function to return gcd of a and b\nlong long int gcd(long long int a, long long int b)\n{\n // Everything divides 0\n if(b == 0)\n\t return a;\n return gcd(b,a%b);\n}\n\n// Function to return LCM of two numbers\nlong long int lcm(long long int a, long long int b)\n{\n return (a*b)/gcd(a, b);\n}\nint main()\n{\n\tlong long int n,a,b,p,q,ans;\n\tscanf(\"%lld %lld %lld %lld %lld\",&n,&a,&b,&p,&q);\n\tlong long int i,x=0,y=0,z,e;\n\t/*\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tif((i%a==0)&&(i%b!=0))\n\t\t{\n\t\t\tx++;\n\t\t}\n\t\tif((i%b==0)&&(i%a!=0))\n\t\t{\n\t\t\ty++;\n\t\t}\n\t\tif((i%a==0)&&(i%b==0))\n\t\t{\n\t\t\tif(p\ntypedef long long int i64;\ni64 min(const i64 a, const i64 b) {\n return a < b ? a : b;\n}\ni64 gcd(const i64 a, const i64 b) {\n return b == 0 ? a : gcd(b, a % b);\n}\ni64 lcm(i64 a, i64 b) {\n return a * b / gcd(a, b);\n}\ni64 solve(i64 n, i64 a, i64 b, i64 p, i64 q) {\n return (n / a) * p + (n / b) * q - (n / lcm(a, b)) * min(p, q);\n}\nint main(void) {\n int n, a, b, p, q;\n scanf(\"%d%d%d%d%d\", &n, &a, &b, &p, &q);\n printf(\"%I64d\", solve(n, a, b, p, q));\n return 0;\n}"}, {"source_code": "#include\nlong long int lcm(long long int a, long long int b);\nint main(void)\n{\n long long int n, a, b, p, q,i,c,common;\n while(scanf(\"%lld %lld %lld %lld %lld\",&n, &a, &b, &p, &q)!=EOF)\n {\n c = 0;\n\n common = n/lcm(a,b);\n if(p>q)\n c += common*p;\n else\n c +=common*q;\n c += (n/a -common)*p;\n c += (n/b -common)*q;\n\n printf(\"%lld\\n\",c);\n }\n\n\n return 0;\n}\n\nlong long int lcm(long long int a, long long int b)\n{\n long long int x,y,r;\n x = a;\n y = b;\n while(y!=0)\n {\n r = x%y;\n x = y;\n y = r;\n }\n\n return (a*b)/x;\n}\n"}, {"source_code": "#include\nlong long int gcd(long long int a,long long int b)\n{\n if(b==0) return a;\n else return gcd(b,a%b);\n}\nint main()\n{\n long long int n,a,b,c,d,i,j,m,x,y,sum=0;\n scanf(\"%lld %lld %lld %lld %lld\",&n,&a,&b,&c,&d);\n m=a*b/gcd(a,b);\n x=c>d?c:d;\n y=n/m;\n sum+=(y*x);\n x=n/a;\n x-=y;\n sum+=(x*c);\n x=n/b;\n x-=y;\n sum+=(x*d);\n printf(\"%lld\\n\",sum);\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long n,a,b,p,q;\n long long i,j,t,l,c,d,e,sum;\n scanf(\"%I64d\",&n);\n scanf(\"%I64d\",&a);\n scanf(\"%I64d\",&b);\n scanf(\"%I64d\",&p);\n scanf(\"%I64d\",&q);\n i=a;\n j=b;\n while(j!=0)\n {\n t=j;\n j=i%j;\n i=t;\n }\n l=(a*b)/i;\n c=n/a;\n d=n/b;\n e=n/l;\n if(p>=q)\n sum=(c*p)+((d-e)*q);\n else\n sum=(d*q)+((c-e)*p);\n printf(\"%I64d\",sum);\n return 0;\n}"}, {"source_code": "#include \nlong long int gcd(long long int a,long long int b)\n{\n long long int c;\n while(a%b!=0)\n {\n c=b;\n b=a%b;\n a=c;\n }\n return b;\n}\nint main()\n{\n long long int n,a,b,p,q,red,blue,total;\n scanf(\"%I64d %I64d %I64d %I64d %I64d\",&n,&a,&b,&p,&q);\n red=n/a;\n blue=n/b;\n if(a==0||b==0) total=0;\n else\n {\n total=a*b/gcd(a,b);\n total=n/total;\n }\n if(p>q) blue=blue-total;\n else red=red-total;\n total=red*p+blue*q;\n printf(\"%I64d\",total);\n return 0;\n}\n"}, {"source_code": "#include\n#define ll long long int\nll gcd(ll a,ll b)\n{\n\tif(b==0)return a;\n\treturn gcd(b,a%b);\n}\nint main()\n{\n\tll n,a,b,p,q,na,nb,nab,temp;\n\tscanf(\"%lld %lld %lld %lld %lld\",&n,&a,&b,&p,&q);\n\tna=n/a;\n\tnb=n/b;\n\tif(a>b)\n\tnab=n/((a*b)/gcd(a,b));\n\telse\n\tnab=n/((a*b)/gcd(b,a));\n\tif(p>q)\n\tprintf(\"%lld\",(na*p+nb*q-(nab*q)));\n\telse\n\tprintf(\"%lld\",(na*p+nb*q-(nab*p)));\n\treturn 0;\n}"}, {"source_code": "#include \n\n\nlong long GCD(long long a, long long b){\n long long tmp;\n if (b > a)\n {\n tmp = a;\n a = b;\n b = tmp;\n }\n if (b == 0) return a;\n return GCD(b, a % b);\n}\n\n\nint main(){\n long long n, a, b, p, q, x, s = 0;\n scanf(\"%I64d %I64d %I64d %I64d %I64d\",&n, &a, &b, &p, &q);\n s += (n / a) * p;\n s += (n / b) * q;\n x = n / ((a*b)/GCD(a,b));\n if (p>q)\n s = s - (x*q);\n else\n s = s - (x*p);\n printf(\"%I64d\",s);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n long long int n, a, b, p, q, red, blue, mixed, lcm, t, y, gcd;\n scanf(\"%I64d%I64d%I64d%I64d%I64d\",&n,&a,&b,&p,&q);\n red = n/a;\n blue = n/b;\n y = a*b;\n while (b != 0) {\n t = b;\n b = a % b;\n a = t;\n }\n gcd = a;\n lcm = y/gcd;\n mixed = n/lcm;\n\n if(p > q){\n printf(\"%I64d\",((red*p)+(blue-mixed)*q));\n }\n else {\n printf(\"%I64d\",((blue*q)+(red-mixed)*p));\n }\n return 0;\n\n}\n"}, {"source_code": "#include\ntypedef long long ll;\nll min(ll a,ll b)\n{\n\treturn a>b?b:a;\n}\nll gcd(ll a,ll b)\n{\n return b==0?a:gcd(b,a%b);\n}\nll lcm(ll a,ll b)\n{\n return a/gcd(a,b)*b;\n}\nint main()\n{\n ll n,a,b,p,q;\n while(scanf(\"%lld%lld%lld%lld%lld\",&n,&a,&b,&p,&q)!=EOF)\n {\n ll sum=0;\n sum=(n/a)*p+(n/b)*q-min(p,q)*(n/lcm(a,b));\n printf(\"%I64d\\n\",sum);\n }\n return 0;\n}"}, {"source_code": "#include\n#include\n#include\n#include\n#include\n#include\nlong long int gcd(long long int a,long long int b){\nlong long int x =a;\nwhile(a){\n\tx=a; a=b%a; b=x;\n}\nreturn b;\n}\nlong long int lcm(long long int a,long long int b){\n\treturn (a*b)/gcd(a,b);\n}\nint main(){\nlong long int a,b,c,d,e;\n\tint cnt=0;\n\n\tscanf(\"%lld%lld%lld%lld%lld\",&a,&b,&c,&d,&e);\n\n\t\n\tlong long int res = 0;\n\tlong long int res1 =0;\n\tres= ((a/b)*d) + ( abs((a/c) - a/lcm(b,c)) * e);\n\tres1= ((a/c)*e) + ( abs((a/b) - a/lcm(b,c)) * d);\n\tres>res1?printf(\"%lld \",res):printf(\"%lld\",res1);\n}\n\n\n//1 2 3 4 5 6 7 8 9 10"}, {"source_code": "#include\n#include\n#include\n#include\n#include\n#include\nlong long int gcd(long long int a,long long int b){\nlong long int x =a;\nwhile(a){\n\tx=a; a=b%a; b=x;\n}\nreturn b;\n}\nlong long int lcm(long long int a,long long int b){\n\treturn (a*b)/gcd(a,b);\n}\nint main(){\nlong long int a,b,c,d,e;\n\tint cnt=0;\n\n\tscanf(\"%lld%lld%lld%lld%lld\",&a,&b,&c,&d,&e);\n\tif(b==c){\n\t\tif(d>e){\n\t\t\tprintf(\"%lld\",(a/b)*d);\n\t\t}\n\t\telse printf(\"%lld\",(a/c)*e);\n\t\treturn 0;\n\t}\n\t\n\tlong long int res = 0;\n\tlong long int res1 =0;\n\tres= ((a/b)*d) + ( abs((a/c) - a/lcm(b,c)) * e);\n\tres1= ((a/c)*e) + ( abs((a/b) - a/lcm(b,c)) * d);\n\tres>res1?printf(\"%lld \",res):printf(\"%lld\",res1);\n}\n\n\n//1 2 3 4 5 6 7 8 9 10"}, {"source_code": "#include \n\nint bmm(int a, int b)\n{\n\n if(a == 0)\n return b;\n if(a == 1)\n return 1;\n else\n bmm((a>b)?(a-b):(b-a),(a>b)?b:a);\n}\n\nint main()\n{\n long long int n,a,b,p,q,na = 0,nb = 0,nab = 0,ans = 0;\n scanf(\"%lld %lld %lld %lld %lld\",&n,&a,&b,&p,&q);\n\n na = n/a;\n nb = n/b;\n nab = n/((a*b) / bmm(a,b));\n na -= nab;\n nb -= nab;\n\n\n if(p > q)\n {\n ans = (na+nab)*p + nb*q;\n }\n else\n {\n ans = na*p + (nb+nab)*q;\n }\n printf(\"%lld\",ans);\n return 0;\n}\n"}, {"source_code": "#ifdef ONLINE_JUDGE\n #define NDEBUG 1\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#define long int64_t\n#define fore(i,k,n) for (int _k = (k), _n = (n), i = _k; i <= _n; ++i)\n#define forr(i,n,k) for (int _k = (k), _n = (n), i = _n; i >= _k; --i)\n#define LIST_INIT_CAP 4\n#define HASH_INIT_CAP 64\n#define HASH_SKIP 11\n#define TREE_INIT_CAP 1024\n#define TREE_MAX_HEIGHT 64\n#define DEQUE_INIT_CAP 1024\n#define HEAP_INIT_CAP 1024\n#define TAKEN 1\n#define EMPTY 0\n#define TOMB -1\n#define max(a,b) (((a)>(b))?(a):(b))\n#define min(a,b) (((a)<(b))?(a):(b))\n\n#define N 3005\n\nlong gcd(long a, long b) {\n if (a == 0)\n return b;\n else\n return gcd(b % a, a);\n}\n\nlong lcm(long a, long b) {\n return (a / gcd(a, b)) * b;\n}\nint main() {\n\n int n, a, b, p, q, pq;\n scanf(\"%d %d %d %d %d\", &n, &a, &b, &p, &q);\n pq = max(p, q);\n long ad = n / a;\n long bd = n / b;\n long abd = (long)n / lcm(a, b);\n long answer = ((ad - abd) * p) + ((bd - abd) * q) + (abd * pq);\n printf(\"%I64d\", answer);\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint gcd(int a, int b) {\n\treturn b == 0 ? a : gcd(b, a % b);\n}\n\nint main() {\n\tint n, a, b, p, q;\n\tlong long both, red, blue, lcm;\n\n\tscanf(\"%d%d%d%d%d\", &n, &a, &b, &p, &q);\n\tlcm = (long long) a / gcd(a, b) * b;\n\tboth = n / lcm;\n\tred = n / a - both;\n\tblue = n / b - both;\n\tprintf(\"%lld\\n\", red * p + blue * q + both * (p > q ? p : q));\n\treturn 0;\n}\n"}, {"source_code": "#include\nlong long fun(long long i,long long j)\n{\n long a=i,b=j,l;\n while(1)\n {\n l=a%b;\n if(l)\n {\n a=b;\n b=l;\n }\n else break;\n }\n return i*j/b;\n}\nint main(void)\n{\n long long int n,i,a,b,p,q,k,m,l,ans;\n\n scanf(\"%I64d %I64d %I64d %I64d %I64d\",&n,&a,&b,&p,&q);\n\n k=n/a;\n m=n/b;\n l=fun(a,b);\n if(p>q) m-=n/l;\n else k-=n/l;\n ans=(k*p)+(m*q);\n printf(\"%I64d\",ans);\n\n}\n"}, {"source_code": "#include\nlong long gcd(long long a, long long b)\n{\n if (b == 0)\n return a;\n else\n gcd(b, a % b);\n}\nint main()\n{\n long long i, n, a, b, p, q, sum1 = 0, sum2 = 0, sum12 = 0, lcm;\n scanf(\"%I64d %I64d %I64d %I64d %I64d\", &n, &a, &b, &p, &q);\n lcm = a / gcd(a, b) * b;\n sum12 = n / lcm;\n sum1 = n / a - sum12;\n sum2 = n / b - sum12;\n if (p >= q)\n printf(\"%I64d\\n\", sum1 * p + sum2 * q + sum12 * p);\n else\n printf(\"%I64d\\n\", sum1 * p + sum2 * q + sum12 * q);\n return 0;\n}\n\n"}, {"source_code": "#include\n\n#define DEBUG 0\n\nlong long int gcd(long long int a, long long int b) {\n return b == 0 ? a : gcd(b, a % b);\n}\n\nlong long int lcm(long long int a, long long int b) {\n return a * (b / (gcd(a, b)));\n}\n\n\nint main() {\n\n long long int n, a, b, p, q;\n long long int red, blue, RnB, choc;\n\n scanf(\"%lld %lld %lld %lld %lld\\n\", &n, &a, &b, &p, &q);\n\n red = n / a;\n if(DEBUG) printf(\"red %lld\\n\", red);\n blue = n / b;\n if(DEBUG) printf(\"blue %lld\\n\", blue);\n RnB = n / lcm(a, b); \n if(DEBUG) printf(\"RnB %lld\\n\", RnB);\n\n red = red - RnB;\n blue = blue - RnB;\n \n choc = (red * p);\n if(DEBUG) printf(\"red * p %lld\\n\", choc);\n choc = choc + (blue * q);\n if(DEBUG) printf(\"blue * q %lld\\n\", choc); \n \n if(p >= q) {\n choc = choc + (RnB * p);\n } else {\n choc = choc + (RnB * q); \n }\n\n printf(\"%lld\\n\", choc);\n \n\n return 0;\n}\n\n \n"}, {"source_code": "#include\n\nlong long gcd(long long a, long long b)\n{\n if(b==0) return a;\n return gcd(b,a%b);\n}\nint main()\n{\n long long n,a,b,p,q,num1,num2,total1,total2,m;\n\n scanf(\"%I64d %I64d %I64d %I64d %I64d\",&n,&a,&b,&p,&q);\n\n if(a==b) { total1=(n/a)*p; total2=(n/b)*q; }\n\n else{\n\n m= a/gcd(a,b);\n m=m*b;\n m=n/m;\n num1 = n/a;\n num2 =n/b;\n total1= num1 * p + (num2-m)*q;\n total2= (num1-m)*p + num2*q;\n\n }\n if(total1\n#include\n//TLE..很烦\nusing namespace std;\n\nint main()\n{\n //long long int result;\n int n,a,b,p,q,i;\n while(scanf(\"%d%d%d%d%d\",&n,&a,&b,&p,&q)!=EOF)\n {\n long long int sum=0;\n //int maxpq=max(p,q);\n int max;\n if(p>q) max=p;\n else max=q;\n for(i=1;i<=n;i++)\n {\n if(i%a==0&&i%b==0){sum+=max;}\n else if(i%a==0) {sum+=p;}\n else if(i%b==0) {sum+=q;}\n }\n cout<\n//using namespace std;\nlong long int gcd(long long int a,long long int b)//貌似叫容斥原理,求a,b最大公约数\n{\n if(b==0)\n return a;\n return gcd(b,a%b);\n}\nlong long int gbs(long long int a,long long int b)//求a,b最小公倍数,数学像我一样渣的自行查资料\n{\n return a*b/gcd(a,b);\n}\nint main()\n{\n long long int n,a,b,p,q,max;\n while(scanf(\"%lld%lld%lld%lld%lld\",&n,&a,&b,&p,&q)!=EOF)\n {\n if(p>q) max=p;\n else max=q;\n long long sum;\n long long int n1,n2,n3;\n n1=n/a;n2=n/b;n3=n/gbs(a,b);\n sum=p*(n1-n3)+q*(n2-n3)+n3*max;\n printf(\"%lld\\n\",sum);\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main ()\n{\n long long int n,a,b,p,q,r,s,t,u,v,w,x,y,swap;\n scanf(\"%lld %lld %lld %lld %lld\",&n,&a,&b,&p,&q);\n if(a!=b)\n {\n r=a;\n s=b;\n for(;s>0;)\n {\n swap=s;\n s=r%s;\n r=swap;\n }\n t=(a*b)/r;\n if(p>q)\n {\n u=n/a;\n v=n/b;\n w=n/t;\n x=v-w;\n y=u*p+x*q;\n printf(\"%lld\",y);\n return 0;\n }\n if(p<=q)\n {\n u=n/a;\n v=n/b;\n w=n/t;\n x=u-w;\n y=x*p+v*q;\n printf(\"%lld\",y);\n return 0;\n }\n }\n else\n {\n if(p>q)printf(\"%lld\",(n/a)*p);\n if(p<=q)printf(\"%lld\",(n/a)*q);\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nlong long gcd(long long m, long long n)\n{\n if(n == 0) return m;\n return gcd(n, m % n);\n}\n\nint main(void) {\n\t// your code goes here\n\t\n long long n,a,b,p,q,lcm,ans,cnt=0;\n\n scanf(\"%lld%lld%lld%lld%lld\",&n, &a, &b, &p, &q);\n\n lcm = a*b / gcd(a,b);\n\n cnt = n/lcm;\n\n if(p < q)\n \tans = (n/a)*p + (n/b)*q - cnt*p;\n else\n \tans = (n/a)*p + (n/b)*q - cnt*q; \n\n\tprintf(\"%lld\", ans);\n}"}, {"source_code": "#include \nlong long fun(long long m,long long n)\n{\n long a=m,b=n,k;\n while(1)\n {\n k=a%b;\n if(k)\n {\n a=b;\n b=k;\n }\n else break;\n }\n return m*n/b;\n}\nint main()\n{\n long long n,a,b,p,q,i,j,k;\n scanf(\"%I64d%I64d%I64d%I64d%I64d\",&n,&a,&b,&p,&q);\n i=n/a;\n j=n/b;\n k=fun(a,b);\n if(p\nlong long int gcd(long long int a,long long int b)\n{\n if(b==0)\n return a;\n else\n return gcd(b,a%b);\n}\nlong long int lcm(long long int a,long long int b)\n{\n return (a/gcd(a,b))*b;\n}\nint main()\n{\n long long int n,a,b,p,q,t,x,y,z,m;\n scanf(\"%I64d%I64d%I64d%I64d%I64d\",&n,&a,&b,&p,&q);\n\n x=n/a;\n y=n/b;\n m=lcm(a,b);\n z=n/m;\n if(p>q)\n {\n t=x*p+(y-z)*q;\n printf(\"%I64d\\n\",t);\n }\n else if(p<=q)\n {\n t=(x-z)*p+y*q;\n printf(\"%I64d\\n\",t);\n }\n return 0;\n\n}\n"}, {"source_code": "#include \n\n#define MAX(x,y) (xM*2; i--){\n\t\t//printf(\"i %d\\n\" , i);\n\t\tif(!(i%a) && !(i%b)) return i;\n\t}\n\treturn a*b;\n\t/*for(int i=M; i<=(a*b); i++){\n\t\tif(!(i%a)&&!(i%b)) return i;\n\t}\n}*/\n\nint main(){\n\tlong long N, a, b, p, q;\n\t\n\tscanf(\"%llu %llu %llu %llu %llu\", &N, &a, &b, &p, &q);\n\t\n\tlong long com=lcm(a,b);\n\t//printf(\"%lld \", com);\n\tif(com==-1) com=0;\n\tif(com) com=N/com;\n\tint red= N/a;\n\tint blue = N/b;\n\t\n\tif(p>q) blue-=com;\n\telse red-=com;\n\t\n\tprintf(\"%llu\\n\", (red*p)+(blue*q));\n\treturn 0;\n\n}"}, {"source_code": "#include \n#include \ntypedef unsigned long long int ulli;\n\nulli gcd(ulli x, ulli y)\n{\n\tif(y==0) return x;\n\telse return gcd(y,x%y);\n}\n\nulli min(ulli a, ulli b)\n{\n\treturn (ab)?a:b;\n}\n\nulli choc(ulli n, ulli a, ulli b, ulli p, ulli q)\n{\n\t//if(n\nlong long gcd(long long a1, long long b1) { return b1? gcd(b1, a1 % b1) : a1; } //printf(\"нод (d, k): %d; нок (d, k): %d\\n\", g = gcd(d, k), d / g * k); \n\nint main()\n{ long long n,q,p,a,b;\n long long i,res=0;\nscanf(\"%I64d %I64d %I64d %I64d %I64d\",&n,&a,&b,&p,&q);\nres+=(n/a)*p+(n/b)*q;\n\n\tif (a>b) i=a/gcd(a,b)*b; else i=b/gcd(a,b)*a;\n\ti=n/i;\n\tif (i>0) if (p>q) res-=q*i; else res-=p*i;\n\tprintf(\"%I64d\",res);\n\nreturn 0;\n}"}, {"source_code": "#include \nlong long int gcd (long long int a,long long int b) {\n\tif (b==0)\n\t return a ;\n\telse\n\t return gcd (b,a%b) ; \n} \nint main () {\n\tlong long int n,a,b,p,q,i,ca=0,cb=0,cc=0 ,ans=0,lcm;\n\tscanf(\"%I64d%I64d%I64d%I64d%I64d\",&n,&a,&b,&p,&q) ;\n\tca=n/a ;\n\tcb=n/b ;\n\ta=a/gcd(a,b) ;\n\tlcm=a*b ;\n\tcc=n/lcm ;\n\tca-=cc ;\n\tcb-=cc ;\n\tif (p>q)\n\t ca+=cc ;\n\telse\n\t cb+=cc ;\n\tans=ca*p+cb*q ;\n\tprintf(\"%I64d\\n\",ans) ; \n\treturn 0 ;\n}\n"}, {"source_code": "#include\n\nint gcd(long long int n1,long long int n2)\n{\nreturn (n2!=0)?gcd(n2,n1%n2):n1;\n}\nlong long lcm(long long a,long long b)\n{\n return (a/gcd(a,b))*b;\n}\nint main()\n{\nlong long n,a,b,p,q,ans=0;\nscanf(\"%lld %lld %lld %lld %lld\",&n,&a,&b,&p,&q);\nans+=(n/a)*p;\nans+=(n/b)*q;\nans-=(n/lcm(a,b))*(p>q?q:p);\nprintf(\"%lld\\n\",ans);\n}\n"}, {"source_code": "#include\n\nlong long int gcd(int a,int b)\n{\n long long int c;\n while ( a != 0 ) {\n c = a; a = b%a; b = c;\n }\n return b;\n}\n\nlong long int lcd(int a,int b)\n{\n if(a%gcd(a,b)==0)\n return (a/gcd(a,b))*b;\n else return (b/gcd(a,b))*a;\n}\n\nint main()\n{\n long long int n,a,b,p,q,red,blue,common,ans;\n\n scanf(\"%lld %lld %lld %lld %lld\",&n,&a,&b,&p,&q);\n\n red = (n/a)-(n/lcd(a,b));\n blue = (n/b)-(n/lcd(a,b));\n common = n/lcd(a,b);\n\n if(p>=q) ans = red*p+blue*q+common*p;\n else ans = red*p+blue*q+common*q;\n\n printf(\"%lld\\n\",ans);\n\n\nreturn 0;\n}\n"}, {"source_code": "#include\n\nint gcd(int a,int b)\n{\n if(!(a%b))\n return b;\n else\n gcd(b,a%b);\n}\n\n\nint main()\n{\n long long n,a,b,p,q,count1,count2,count3;\n\n scanf(\"%I64d%I64d%I64d%I64d%I64d\",&n,&a,&b,&p,&q);\n\n count1=n/a;\n count2=n/b;\n count3=(n*gcd(a,b))/(a*b);\n\n count1=count1*p;\n count2=count2*q;\n count3=count3*(p\nint gcd(int a, int b)\n{\n if (a == 0)\n return b;\n return gcd(b%a, a);\n}\nint main()\n{\n\t//freopen(\"inp.txt\", \"r\", stdin);\n\tlong long int n,a,b,p,q;\n\tscanf(\"%lli %lli %lli %lli %lli\", &n, &a, &b, &p, &q);\n\t//int i;\n\tlong long int reds = 0;\n\tlong long int blues = 0;\n\treds = n/a;\n\tblues = n/b;\n\tlong long int lcm = a * b / gcd(a,b);\n\tif(p > q) \n\t\tblues -= n/lcm;\n\telse\n\t\treds -= n/lcm; \n\tlong long int ans = reds*p + blues*q;\n\tprintf(\"%lli\\n\", ans);\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n long long int n,a,b,c,d,p,q,A,B,C,t1,t2,m1,m2,m3;\n scanf(\"%lld %lld %lld %lld %lld\",&n,&a,&b,&p,&q);\n \n A = n/a;\n B = n/b;\n if(a>b)\n {\n t1=a;\n t2=b;\n }\n else\n {\n t1=b;\n t2=a;\n }\n d = hcf(t1,t2);\n c = (a*b)/d;\n C = n/c;\n A = A -C;\n B = B -C;\n m1 = A*p;\n m2 = B*q;\n if(p>q)\n {\n m3 = C*p;\n }\n else\n {\n m3 = C*q;\n }\n printf(\"%lld\",m1+m2+m3);\n return 0;\n \n \n}\n\n int hcf(int t1, int t2)\n { int t;\n \n t = t1%t2;\n \n if(t1%t2==0)\n return t2;\n else\n hcf(t2,t);\n }"}, {"source_code": "#include\nlong hcf(long int a,long int b)\n{\n while(a!=b)\n {\n if(a>b)\n a=a-b;\n else\n b=b-a;\n }\n return a;\n}\nint main()\n{\n long long int n,a,b,p,q,x;\n unsigned long long int sum=0;\n scanf(\"%I64d %I64d %I64d %I64d %I64d\",&n,&a,&b,&p,&q);\n x=((long long)(a*b))/hcf(a,b);\n sum+=(long long)p*(n/a-(n/x));\n sum+=q*(n/b-(n/x));\n if(p>q)\n sum+=(long long)p*(n/x);\n else\n sum+=(long long)q*(n/x);\n printf(\"%I64d\",sum);\n}\n"}, {"source_code": "#include\nint gcd(int c,int d);\nint main()\n{\n long long int n,a,b,p,q,f,r,e,h,max,sum,gcd;\n while(scanf(\"%lld%lld%lld%lld%lld\",&n,&a,&b,&p,&q)!=EOF)\n {\n int gcd(int c,int d)\n {\n if(c==0)\n {\n return d;\n }\n else\n {\n return gcd(d%c,c);\n }\n }\n f=(a*b)/gcd(a,b);\n r=n/f;\n e=(n/a)-r;\n h=(n/b)-r;\n max=q;\n if(p>max)\n {\n max=p;\n }\n sum=(max*r)+(e*p)+(h*q);\n printf(\"%lld\\n\",sum);\n }\n return 0;\n}\n"}, {"source_code": "#include \n\n\nlong long int gcd(long long int x, long long int y){\n if(y==0) return x;\n else return gcd(y, x%y);\n}\nint main()\n{\n long long int n, a, b, p, q, lc, c;\n long long int na, nb, nab;\n\n while(scanf(\"%lld %lld %lld %lld %lld\", &n, &a, &b, &p, &q) != EOF){\n na = n/a;\n nb = n/b;\n lc = a*b/gcd(a,b);\n nab = n/lc;\n if(p>q) nb -= nab;\n else na -= nab;\n c = na*p + nb*q;\n printf(\"%lld\\n\", c);\n }\n return 0;\n}\n\n"}, {"source_code": "#include\n#include\nint main()\n{\n long long int n,a,b,p,q,count1=0,count2=0,i,temp;\n long long int s=0;\n scanf(\"%I64d%I64d%I64d%I64d%I64d\",&n,&a,&b,&p,&q);\n long long int d,e;\n if(a>b)\n {\n d=b;\n e=a;\n do\n {\n temp= a%b;\n a=b;\n b=temp;\n }\n while(temp!=0);\n temp=a;\n b=d;\n a=e;\n }\n else\n {\n d=a;\n e=b;\n do\n {\n temp= b%a;\n b=a;\n a=temp;\n }\n while(temp!=0);\n temp=b;\n a=d;\n b=e;\n }\n d=(a*b)/temp;\n count1=(n/a);\n count2=(n/b);\n if(p>q)\n {\n count2=count2-(n/d);\n }\n else\n {\n count1=count1-(n/d);\n\n }\n s=(count1*p)+(count2*q);\n printf(\"%I64d\",s);\n\n}\n"}, {"source_code": "#include \n#include \n#include \n\nint gcd(int a, int b)\n{\n if(b == 0)\n {\n return a;\n }\n \n return gcd(b, a % b);\n}\n\n\nint main()\n{\n uint64_t n, a, b, p, q;\n scanf(\"%I64d %I64d %I64d %I64d %I64d\", &n, &a, &b, &p, &q);\n \n uint64_t value = 0;\n value += p * (n / a);\n value += q * (n / b);\n value -= (p > q ? q : p) * (n / ((a * b) / gcd(a, b)));\n \n printf(\"%I64d\\n\", value);\n}"}, {"source_code": "#include \n\nvoid swap(long long* a, long long* b) {\n long long tmp = *a;\n *a = *b;\n *b = tmp;\n}\n\nlong long gcd(long long a, long long b) {\n if (b == 0) return a;\n return gcd(b, a % b);\n}\n\nlong long lcm(long long a, long long b) {\n return (a / gcd(a, b)) * b;\n}\n\nint main() {\n long long n, a, b, p, q;\n long long res = 0;\n\n scanf(\"%I64d%I64d%I64d%I64d%I64d\", &n, &a, &b, &p, &q);\n if (p > q) {\n swap(&p, &q);\n swap(&a, &b);\n }\n\n res = (n / b) * q + (n / a) * p - (n / lcm(a, b)) * p;\n\n printf(\"%I64d\\n\", res);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nlong long gcd(long long u, long long v){\n long long t;\n\n while (v){\n t = u;\n u = v;\n v = t % v;\n }\n\n if (u < 0) u = 0 - u;\n return u;\n}\n\nlong long lcm(long long u, long long v){\n return (u * v) / gcd(u, v);\n}\n\nint main(){\n int i, j, k;\n long long n, a, b, p, q, x, y, z, res;\n\n while (scanf(\"%lld %lld %lld %lld %lld\", &n, &a, &b, &p, &q) != EOF){\n x = n / a, y = n / b, z = n / lcm(a, b);\n res = p * (x - z) + q * (y - z);\n if (p > q) res += (p * z);\n else res += (q * z);\n printf(\"%lld\\n\", res);\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nlong long n, a, b, p, q, s;\n\nlong long gcd(long long a, long long b) { \n\treturn b == 0 ? a : gcd(b, a % b); \n}\n\nlong long lcm(long long a,long long b) {\n\treturn a *(b / gcd(a, b));\n}\nint main() {\n\tlong long aux,c1,c2,c3;\n\ts = 0;\n\tscanf(\"%lld %lld %lld %lld %lld\", &n, &a, &b, &p, &q);\n\n\tc1 = n / a;\n\tc2 = n / b;\n\taux = lcm(a, b);\n\tc3 = n / aux;\n\n\tif (p >= q) s = c1*p + (c2 - c3)*q;\n\telse s = (c1 - c3)*p + c2*q;\n\n\tprintf(\"%lld\", s);\n\n\treturn 0;\n}\n/* 1520865164910 */\n"}, {"source_code": "#include\n\n#define DEBUG 0\n\nlong long int gcd(long long int a, long long int b) {\n return b == 0 ? a : gcd(b, a % b);\n}\n\nlong long int lcm(long long int a, long long int b) {\n return a * (b / (gcd(a, b)));\n}\n\n\nint main() {\n\n long long int n, a, b, p, q;\n long long int red, blue, RnB, choc;\n\n scanf(\"%lld %lld %lld %lld %lld\\n\", &n, &a, &b, &p, &q);\n\n red = n / a;\n if(DEBUG) printf(\"red %lld\\n\", red);\n blue = n / b;\n if(DEBUG) printf(\"blue %lld\\n\", blue);\n RnB = n / lcm(a, b); \n if(DEBUG) printf(\"RnB %lld\\n\", RnB);\n\n red = red - RnB;\n blue = blue - RnB;\n \n choc = (red * p);\n if(DEBUG) printf(\"red * p %lld\\n\", choc);\n choc = choc + (blue * q);\n if(DEBUG) printf(\"blue * q %lld\\n\", choc); \n \n if(p >= q) {\n choc = choc + (RnB * p);\n } else {\n choc = choc + (RnB * q); \n }\n\n printf(\"%lld\\n\", choc);\n \n\n return 0;\n}\n\n \n\n/* 1512999929989 */\n"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include \n\nlong long gcd(long long a, long long b)\n{\n\treturn b == 0 ? a : gcd(b, a % b);\n}\n\nlong long lcm(long long a, long long b)\n{\n\treturn a * (b / gcd(a, b));\n}\n\nint main()\n{\n\tlong long n, a, b, p, q;\n\t\n\tscanf(\"%lld %lld %lld %lld %lld\", &n, &a, &b, &p, &q);\n\t\t\n\tif (p > q)\n\t\tprintf(\"%lld\\n\", (((n / a)*p) + (((n / b) - (n / lcm(a, b)))*q)));\n\telse\n\t\tprintf(\"%lld\\n\", (((n / b)*q) + (((n / a) - (n / lcm(a, b)))*p)));\n\t\n\treturn 0;\n}\n\n/* 1520883371712 */\n"}, {"source_code": "#include \n\nint gcd ( int a, int b ) {\n int c;\n while ( a != 0 ) {\n c = a; a = b%a; b = c;\n }\n return b;\n}\n\n\nint main() {\n\n long long n, a, b, p, q;\n scanf(\"%lld %lld %lld %lld %lld\", &n, &a, &b, &p, &q);\n\n long long number_of_reds = n/a;\n long long number_of_blues = n/b;\n long long lcm = (a*b)/gcd(a,b);\n\n long long reds_or_blues = n/lcm;\n\n number_of_blues = number_of_blues - reds_or_blues;\n number_of_reds = number_of_reds - reds_or_blues;\n long long g;\n\n if(q >= p) {\n g = q;\n }\n else {\n g = p;\n }\n\n long long total = number_of_blues * q + number_of_reds *p + reds_or_blues * g;\n\n printf(\"%lld\\n\", total);\n return 0;\n}\n\n/* 1520858414216 */\n"}, {"source_code": "#include \n#include \n\nlong long int gcd(long long int a,long long int b){\n return b == 0 ? a : gcd(b,a%b);\n}\n\nlong long int lcm(long long int a,long long int b) {\n return a*(b/gcd(a,b));\n}\n\nint main(){\n long long int n,a,b,p,q,i,total=0,aux,aux2;\n scanf(\"%lld %lld %lld %lld %lld\",&n,&a,&b,&p,&q);\n\n\n if(p>q){\n aux=n/a;\n total=aux*p;\n if(b%a==0){\n printf(\"%lld\\n\",total);\n exit(0);\n }\n aux=lcm(a,b);\n aux2=n/aux;\n aux2*=q;\n aux=((n/b)*q)-aux2;\n total+=aux;\n }else\n if(q>=p){\n aux=n/b;\n total=aux*q;\n if(a%b==0){\n printf(\"%lld\\n\",total);\n exit(0);\n }\n aux=lcm(a,b);\n aux2=n/aux;\n aux2*=p;\n aux=((n/a)*p)-aux2;\n total+=aux;\n }\n printf(\"%lld\\n\",total);\n}\n/* 1520859454897 */\n"}, {"source_code": "#include\n#include\n#include\n#include\n#include\n#define true 1\n#define false 0\n#define max(a,b) a>b?a:b\n#define min(a,b) a>b?b:a\n//SUPERMEAT BOY\n//JOTY AND CHOCOLATE\nlong long gcd(long long a, long long b)\n{\n // base case\n if (a == 0)\n return b;\nreturn gcd(b%a, a);\n}\n\n// Function to return LCM of two numbers\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 n,a,b,p,q,mtp;\n long long lcm(long long,long long);\n long long gcd(long long ,long long);\n\n scanf(\"%I64d%I64d%I64d%I64d%I64d\",&n,&a,&b,&p,&q);\n mtp=min(p,q);\n long long l=lcm(a,b);\n printf(\"%I64d\",p*(n/a)+q*(n/b)-(mtp*(n/l)));\n return 0;\n}\n\n"}, {"source_code": "#include\nlong long int gcd(long long int a,long long int b)\n\n{ if (b != 0)\n return gcd(b, a%b);\n else \n return a;\n}\nint main()\n{\n\tlong long int n,a,b,p,q;\n\tscanf(\"%lld%lld%lld%lld%lld\",&n,&a,&b,&p,&q);\n\tlong long int sum=0,d,e,f,i,g;\nif(an)\nprintf(\"0\\n\");\nelse\n{\n\nf=a*b/gcd(a,b);\n//printf(\"%lld %lld\\n\",g,f);\ng=n/f;\nif(p>q)\n{\nd=n/a;\ne=n/b-g;\n}\nelse\n{\nd=n/a-g;\ne=n/b;\n}\n//printf(\"%lld %lld %lld\\n\",d,e,f);\nsum=d*p+e*q;\nprintf(\"%lld\\n\",sum);\n}\nreturn 0;\n}\n\n"}, {"source_code": "#include \nint gcd(int a,int b){\n\tif (a==0){\n\t\treturn b;\n\t}\n\telse{\n\t\treturn gcd(b%a,a);\n\t}\n}\nint main()\n{\n\tlong long int n,m,a,b,c,maxi,r,e,f,h;\n\tscanf(\"%lld %lld %lld %lld %lld\",&a,&n,&m,&b,&c);\n\tf=(n*m)/gcd(n,m);\n\tr=a/f;\n\te=(a/n)-r;\n\th=(a/m)-r;\n\tmaxi=b;\n\tif (c>maxi){\n\t\tmaxi=c;\n\t}\n\tprintf(\"%lld\",maxi*r+e*b+h*c);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#ifndef _TJYTLXWXHYZQFW_COMMON_H\n#define _TJYTLXWXHYZQFW_COMMON_H\n#include \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 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 max(x,y) ((x) < (y) ? (y) : (x))\n#define min(x, y) ((x) < (y) ? (x) : (y))\n#define abv(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 \n#define NUMTH_ENS (-1) \n#define NUMTH_MODPLS(x, y, p) ((((x) % (p)) + ((y) % (p))) % p)\n#define NUMTH_MODMUL(x, y, p) ((((X) % (P)) * ((y) % (p))) % p)\n#define NUMTH_CORRECT(x, mod) ((x) += ((x) < 0 ? (mod) : 0))\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\nint main(void)\n{\n\tlong long n, a, b, p, q;\n\tlong long lcm;\n\tscanf(\"%lld%lld%lld%lld%lld\", &n, &a, &b, &p, &q);\n\tlcm = a / numth_gcd(a, b) * b;\n\tprintf(\"%lld\\n\", (n / a) * p + (n / b) * q - n / lcm * min(p, q));\n\treturn 0;\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);\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\tassert(b >= 0 && n > 0);\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\treturn square;\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\treturn numth_do_gcd(a, b);\n}\nstatic long long numth_do_gcd(long long a, long long b)\n{\n\tlong long r;\n\tif (!b)\n\t\treturn a;\n\tfor (r = a % b; r != 0; r = a % b) {\n\t\ta = b;\n\t\tb = r;\n\t}\n\treturn b;\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\tif (a < 0)\n\t\ta *= -1;\n\tif (b < 0)\n\t\tb *= -1;\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}\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\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*y = (tmp - (a / b) * (*y));\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\tassert(n != 0);\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\tnumth_gcd_e(a, n, &d, &x, &y);\n\tassert(d != 0); \n\tif (b % d)\n\t\treturn NUMTH_ENS;\n\t*solution = ((b / d) * (x % n)) % n;\n\tNUMTH_CORRECT(*solution, n);\n\t*gcd = d;\n\treturn 0;\n}\nint numth_divisors(long long k, long long divs[], long long *ndivs)\n{\n\tlong long i, n;\n\tassert(k > 0);\n\tn = 0;\n\tfor (i = 1; i * i < k; ++i)\n\t\tif (k % i == 0)\n\t\t\tdivs[n++] = i;\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\tfor (; i >= 0; --i)\n\t\tdivs[n++] = k / divs[i];\n\t*ndivs = n;\n\treturn 0;\n}"}, {"source_code": "#include\nint GCD(int a,int b)\n{\n int t;\n for(;;)\n {\n if(b==0)\n return a;\n t=a%b;\n a=b;\n b=t;\n }\n}\nint main()\n{\n long long n,a,b,p,q,max,min,k,l,i,j;\n scanf(\"%lld %lld %lld %lld %lld\",&n,&a,&b,&p,&q);\n max=p>q ?p:q;\n min=p+q-max;\n //printf(\"%lld\",max);\n if(max==p)\n {\n k=GCD(a,b);\n k=(a*b)/k;\n l=n/k;\n i=n/b;\n i=i-l;\n j=n/a;\n k=i*q+j*p;\n }\n else\n {\n k=GCD(a,b);\n k=(a*b)/k;\n l=n/k;\n i=n/a;\n i=i-l;\n j=n/b;\n k=i*p+j*q;\n }\n printf(\"%lld\",k);\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n#include \n\nint64_t gcd(int a, int b)\n{\n int temp;\n while (b != 0)\n {\n temp = a % b;\n\n a = b;\n b = temp;\n }\n return a;\n}\n\nint main()\n{\n int64_t n, a, b, p, q, s;\n while (scanf(\"%lld%lld%lld%lld%lld\", &n, &a, &b, &p, &q) > 0) {\n int64_t i = 1;\n s = 0;\n s += (n / a) * p;\n s += (n / b) * q;\n s -= (n / ((a * b)/gcd(a, b))) * (p > q ? q : p);\n printf(\"%lld\\n\", s);\n }\n}"}, {"source_code": "#include\n\nunsigned long long gcdnum(unsigned long long int a,unsigned long long int b){\n \n while( b!=0 ){\n a %= b;\n if( a==0 ) return b;\n b %= a;\n }\n return a;\n}\n\n\nunsigned long long lcmnum(unsigned long long int a,unsigned long long int b ){\nunsigned long long int temp=a;\nif(a>b){\na=b;\nb=temp;\n}\ntemp=b;\nwhile(1)\n {\n if( temp%a==0)\n {\n return temp;\n }\n temp+=b;\n }\n}\nint main(){\nunsigned long long int n,a,b,p,q;\nscanf(\"%llu %llu %llu %llu %llu\",&n,&a,&b,&p,&q);\nunsigned long long int gcd = gcdnum(a,b);\nunsigned long long int total=0;\nunsigned long long int lcm=(a*b)/gcd;\ntotal+=(n/a)*p;\ntotal+=(n/b)*q;\nif(p>q){\ntotal-=(n/lcm)*q;\n}\nelse total-=(n/lcm)*p;\n\nprintf(\"%llu\\n\",total); \n\n}"}, {"source_code": "#include \n\nint main()\n{\n long long int n, a, b, p, q, red, blue, mixed, lcm, t, y, gcd;\n scanf(\"%I64d%I64d%I64d%I64d%I64d\",&n,&a,&b,&p,&q);\n red = n/a;\n blue = n/b;\n y = a*b;\n while (b != 0) {\n t = b;\n b = a % b;\n a = t;\n }\n gcd = a;\n lcm = y/gcd;\n mixed = n/lcm;\n\n if(p > q){\n printf(\"%I64d\",((red*p)+(blue-mixed)*q));\n }\n else {\n printf(\"%I64d\",((blue*q)+(red-mixed)*p));\n }\n return 0;\n\n}\n"}, {"source_code": "#include\nlong long int gongbeishu(long long int a,long long int b){\n\tlong long int t,aa=a,bb=b;\n\tif(a=p){\n\t\t\tans+=n/b*q;\n\t\t\tif(a!=b){\n\t\t\t\tans+=n/a*p;\n\t\t\t\ti=gongbeishu(a,b); \n\t\t\t\tans-=n/i*p;\n\t\t\t} \n\t\t}\n\t\telse{\n\t\t\tans+=n/a*p;\n\t\t\tif(a!=b){\n\t\t\t\tans+=n/b*q;\n\t\t\t\ti=gongbeishu(a,b);\n\t\t\t\tans-=n/i*q;\n\t\t\t}\n\t\t}\n\t\tprintf(\"%I64d\\n\",ans);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int64_t n,a,b,p,q,c,d,i,sum,l,s;\n while(scanf(\"%I64d %I64d %I64d %I64d %I64d\",&n,&a,&b,&p,&q)==5){\n sum=0;\n if(p>q){\n c=n/a;\n if(a>b){\n l=a;s=b;\n }\n\n else{\n l=b;s=a;\n }\n sum=c*p;\n for(i=l;i<=n;i+=l){\n if(i%s==0){\n break;\n }\n }\n d=n/b-n/i;\n sum+=d*q;\n }\n else if(p==q){\n if(a>b){\n c=n/b;\n l=a;s=b;\n }\n\n else{\n c=n/a;\n l=b;s=a;\n }\n sum=c*p;\n for(i=l;i<=n;i+=l){\n if(i%s==0){\n break;\n }\n }\n d=n/l-n/i;\n sum+=d*q;\n }\n else{\n c=n/b;\n if(a>b){\n l=a;s=b;\n }\n\n else{\n l=b;s=a;\n }\n sum=c*q;\n for(i=l;i<=n;i+=l){\n if(i%s==0){\n break;\n }\n }\n d=n/a-n/i;\n sum+=d*p;\n }\n printf(\"%I64d\\n\",sum);\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n\nlong long n,a,b,p,q;\n\nlong long m_com(long long a,long long b)\n{\n\tlong long x,y,l;\n\tif(a>b){\n\t\tx = a; y = b;\n\t} \n\telse{\n\t\tx = b; y = a;\n\t}\n\tl = x%y;\n\t\n\twhile(l!=0)\n\t{\n\t\tx = y;\n\t\ty = l;\n\t\tl = x%y;\t\n\t}\n\treturn a*b/y;\n}\n\nint main()\n{\n\twhile(~scanf(\"%I64d%I64d%I64d%I64d%I64d\",&n,&a,&b,&p,&q))\n\t{\n\t\tlong long x,y,z,m,sum=0;\n\t\tx = n/a;\n\t\ty = n/b;\n\t\tz = n/m_com(a,b);\n\t\t\n\t\tm = p\n#include\n\nlong long int n , a ,b, p,q;\n\nlong long int max (long long int a , long long int b ){\n\tif (a>b) return a;\n\telse return b;\n}\n\nlong long int gcd(long long int a, long long int b)\n{\n\n if(b == 0) {\n return a;\n }\n else {\n return gcd(b, a % b);\n }\n}\n\nint main () {\n\nscanf(\"%lld%lld%lld%lld%lld\",&n,&a,&b,&p,&q);\n\nlong long int sum = 0 ;\n\nlong long int both = (a*b)/gcd(a,b);\nboth = n / both;\nsum = max(p,q)* both + (n/a - both)*p + (n/b - both)*q; \n\nprintf(\"%lld\\n\",sum);\nreturn 0;\n}\n"}, {"source_code": "#include \n\nlong long int gcd(long long int a, long long int b)\n{\n if (b!=0)\n return gcd(b, a%b);\n else \n return a;\n}\n\nint main(void) {\n\t// your code goes here\n\tlong long int n,a,p,q,b,ans,l,numa,numb,lcm,x,y;\n\tscanf(\"%lld %lld %lld %lld %lld\",&n,&a,&b,&p,&q);\n\tl=(n/a)*a;\n\tnuma=(l-a)/a +1;\n\tans=0;\n\tans+=numa*p;\n\tl=(n/b)*b;\n\tnumb=(l-b)/b +1;\n\tans+=numb*q;\n\tlcm = ((a*b)/gcd(a,b));\n\tl=(n/lcm)*lcm;\n\tnuma=(l-lcm)/lcm +1;\n\tif(p>q)\n\tans-=numa*q;\n\telse ans-=numa*p;\n\tprintf(\"%lld\\n\",ans);\n\treturn 0;\n}\n\n"}], "negative_code": [{"source_code": "#include\n#define m 1000000010\nint main()\n{\n\tlong long int n,a,b,p,q,c,d,e,x;\n\tscanf(\"%I64d %I64d %I64d %I64d %I64d\",&n,&a,&b,&p,&q);\n\te=n/(a*b);\n\tif(p>q)\n\t{\n\t\tc=n/a;\n\t\td=n/b-(e);\n\t}\n\telse if(p<=q)\n\t{\n\t\tc=n/a-(e);\n\t\td=n/b;\n\t}\n\tx=(c*p)+(d*q);\n\tprintf(\"%I64d\\n\",x);\n}\n"}, {"source_code": "#include\nint main()\n{\n\tlong long int n,a,b,p,q,c,d,e,x;\n\tscanf(\"%I64d %I64d %I64d %I64d %I64d\",&n,&a,&b,&p,&q);\n\tif(n<(a*b)) e=1;\n\telse e=n/(a*b);\n\tif(p>q)\n\t{\n\t\tc=n/a;\n\t\td=n/b-(e);\n\t}\n\telse if(p<=q)\n\t{\n\t\tc=n/a-(e);\n\t\td=n/b;\n\t}\n\tx=(c*p)+(d*q);\n\tprintf(\"%I64d\\n\",x);\n}\n"}, {"source_code": "#include \n#include \n\nint gcd(int a, int b){ \n if (a == 0 || b == 0){ \n return 0; \n }if (a == b){ \n return a; \n }if (a > b){ \n return gcd(a-b, b); \n }else{ \n return gcd(a, b-a); \n } \n } \n\n /*\n utilizo la funcion gcd para obtener el greatest common divisor el cual\n será utilizado en la sig función lcm\n */\n\n int lcm(int a, int b){ \n return (a*b)/gcd(a, b); \n } \n\n\n\nint main(){\n \nint long long res1, res2, max; //los hice int long long porque decía eso en codeforces\nint n, a, b, p, q, na, nb, mcm, min, dos;\n\nscanf(\"%i %i %i %i %i\", &n, &a, &b, &p, &q);\n\nna=n/a; //si n es divisible entre a\nnb=n/b; // si n es divisible entre b\n\n/*if(p>q){\n\tmin=q;\n}else{\n\tmin=p;\n}*/\n\ndos=n/lcm(a,b);\n// dos es para sacar si hay en común \n//llamo a la función lcm para sacar el least common multiple\n//con base en eso divido n entre su LCM de a y b, para sacar el #de divisiones en común\n\nres1=((na-dos)*p+nb*q);\nres2=((nb-dos)*q+na*p);\n/*\nsaco aquí las dos posibles respuestas, restándole en una a na las divisiones en común \ny en la otra en nb. el resto es lo mismo \n*/\n\nif(res1>res2){\n\tmax=res1;\n}else{\n\tmax=res2;\n}\n\n/*\naquí saco la respuesta con más valor\n*/\n\n\nprintf(\"%I64d\", max);\n\n\n\n\n}"}, {"source_code": "#include \n#include \n\nint gcd(int a, int b){ \n if (a == 0 || b == 0){ \n return 0; \n }if (a == b){ \n return a; \n }if (a > b){ \n return gcd(a-b, b); \n }else{ \n return gcd(a, b-a); \n } \n } \n\n /*\n utilizo la funcion gcd para obtener el greatest common divisor el cual\n será utilizado en la sig función lcm\n */\n\n int lcm(int a, int b){ \n return (a*b)/gcd(a, b); \n } \n\n\n\nint main(){\n \nint long long res1, res2, max, n, a, b, p, q, na, nb, min, dos;//los hice int long long porque decía eso en codeforce\n\n\nscanf(\"%I64d %I64d %I64d %I64d %I64d\", &n, &a, &b, &p, &q);\n\nna=n/a; //si n es divisible entre a\nnb=n/b; // si n es divisible entre b\n\n/*if(p>q){\n\tmin=q;\n}else{\n\tmin=p;\n}*/\n\ndos=n/lcm(a,b);\n// dos es para sacar si hay en común \n//llamo a la función lcm para sacar el least common multiple\n//con base en eso divido n entre su LCM de a y b, para sacar el #de divisiones en común\n\nres1=((na-dos)*p+nb*q);\nres2=((nb-dos)*q+na*p);\n/*\nsaco aquí las dos posibles respuestas, restándole en una a na las divisiones en común \ny en la otra en nb. el resto es lo mismo \n*/\n\nif(res1>res2){\n\tmax=res1;\n}else{\n\tmax=res2;\n}\n\n/*\naquí saco la respuesta con más valor\n*/\n\n\nprintf(\"%I64d\", max);\n\n\n\n\n}"}, {"source_code": "#include \n#include \n\nint gcd(int a, int b){ \n if (a == 0 || b == 0){ \n return 0; \n }if (a == b){ \n return a; \n }if (a > b){ \n return gcd(a-b, b); \n }else{ \n return gcd(a, b-a); \n } \n } \n\n /*\n utilizo la funcion gcd para obtener el greatest common divisor el cual\n será utilizado en la sig función lcm\n */\n\n int lcm(int a, int b){ \n return (a*b)/gcd(a, b); \n } \n\n\n\nint main(){\n \nint long long res1, res2, max, n, a, b, p, q, na, nb, mcm, min, dos;//los hice int long long porque decía eso en codeforce\n\nscanf(\"%I64d %I64d %I64d %I64d %I64d\", &n, &a, &b, &p, &q);\n\nna=n/a; //si n es divisible entre a\nnb=n/b; // si n es divisible entre b\n\n/*if(p>q){\n\tmin=q;\n}else{\n\tmin=p;\n}*/\n\ndos=n/lcm(a,b);\n// dos es para sacar si hay en común \n//llamo a la función lcm para sacar el least common multiple\n//con base en eso divido n entre su LCM de a y b, para sacar el #de divisiones en común\n\nres1=((na-dos)*p+nb*q);\nres2=((nb-dos)*q+na*p);\n/*\nsaco aquí las dos posibles respuestas, restándole en una a na las divisiones en común \ny en la otra en nb. el resto es lo mismo \n*/\n\nif(res1>res2){\n\tmax=res1;\n}else{\n\tmax=res2;\n}\n\n/*\naquí saco la respuesta con más valor\n*/\n\n\nprintf(\"%I64d\", max);\n\n\n\n\n}"}, {"source_code": "#include\nlong long gcd(long long a,long long b){\nif(a%b==0) return b;\nif(b%a==0) return a;\nreturn gcd(b,a%b);\n}\nint main(){\nlong long int n,a,b,p,q;\nscanf(\"%I64d %I64d %I64d %I64d %I64d\",&n,&a,&b,&p,&q);\nlong long int k=(n/a)*p + (n/b)*q;\n//printf(\"%d\\n\",k);\nif(p>q) printf(\"%I64d\",k-((n*gcd(a,b))/(a*b))*q);\nelse printf(\"%I64d\",k-(n/(a*b))*p);\n\n}\n"}, {"source_code": "#include\nint main(){\nlong long int n,a,b,p,q;\nscanf(\"%I64d %I64d %I64d %I64d %I64d\",&n,&a,&b,&p,&q);\nlong long int k=(n/a)*p + (n/b)*q;\n//printf(\"%d\\n\",k);\nif(p>q) printf(\"%I64d\",k-(n/(a*b))*q);\nelse printf(\"%I64d\",k-(n/(a*b))*p);\n\n}\n"}, {"source_code": "#include\nint main(){\nint n,a,b,p,q;\nscanf(\"%d %d %d %d %d\",&n,&a,&b,&p,&q);\nint k=(n/a)*p + (n/b)*q;\n//printf(\"%d\\n\",k);\nif(p>q) printf(\"%d\",k-(n/(a*b))*q);\nelse printf(\"%d\",k-(n/(a*b))*p);\n\n}\n"}, {"source_code": "#include \nint main()\n{\n\tlong long int n,a,b,p,q;\n\tscanf(\"%lld %lld %lld %lld %lld\",&n,&a,&b,&p,&q);\n\tlong long int ans;\n\tif(p>q)\n\t\tans=p;\n\telse ans=q;\n\tlong long int answer=p*((n/a)-(n/(a*b)))+ q*((n/b)-(n/(a*b)))+(n/(a*b))*ans;\n\tprintf(\"%lld\", answer);\n\treturn 0;\n\n}"}, {"source_code": "#include \ntypedef long long ll;\n\nint main(int argc, char const *argv[])\n{\n ll n,a,b,p,q ;\n scanf(\"%lld %lld %lld %lld %lld\",&n,&a,&b,&p,&q);\n ll answer = 0;\n ll apart = n/a ;\n ll bpart = n/b ;\n ll comm = a*b ;\n comm = n/comm ;\n answer += (apart-comm)*p;\n answer += (bpart-comm)*q;\n if(p>q)\n {\n answer += comm*p; \n }\n \n else\n {\n answer += comm*q;\n }\n printf(\"%lld\\n\",answer);\n \n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,a,b,p,q,a1,b1,ab,c=0;\n long long ans;\n scanf(\"%d%d%d%d%d\",&n,&a,&b,&p,&q);\n a1=n/a;\n b1=n/b;\n ab=n/(a*b);\n if(nq)\n {\n b1=b1-ab-c;\n }\n else\n {\n a1=a1-ab-c;\n }\n ans=1LL*(1LL*p*a1+1LL*q*b1);\n printf(\"%lld\",ans);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,a,b,p,q,a1,b1,ab;\n long long ans;\n scanf(\"%d%d%d%d%d\",&n,&a,&b,&p,&q);\n a1=n/a;\n b1=n/b;\n ab=n/(a*b);\n if(p>q)\n {\n b1=b1-ab;\n }\n else\n {\n a1=a1-ab;\n }\n ans=1LL*(1LL*p*a1+1LL*q*b1);\n printf(\"%lld\",ans);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,a,b,p,q,a1,b1,ab,c=0,temp,lcm,m;\n long long ans;\n scanf(\"%d%d%d%d%d\",&n,&a,&b,&p,&q);\n a1=n/a;\n b1=n/b;\n m=a*b;\n while(a&&b)\n {\n temp=b%a;\n b=a;\n a=temp;\n }\n lcm=m/b;\n ab=n/lcm;\n if(p>q)\n {\n b1=b1-ab;\n }\n else\n {\n a1=a1-ab;\n }\n ans=1LL*p*a1+1LL*q*b1;\n printf(\"%lld\",ans);\n return 0;\n}\n"}, {"source_code": "#include\nmain()\n{\n long long int n,a,b,p,q,x,y,z;\n scanf(\"%I64d %I64d %I64d %I64d %I64d\",&n,&a,&b,&p,&q);\n x=n/a;\n y=n/b;\n z=(x*p)+(y*q);\n printf(\"%I64d\",z);\n}\n"}, {"source_code": "#include\nint gcd(long long a,long long b)\n{\n if(b==0)\n return a;\n else\n return gcd(b,a%b);\n}\n\nmain()\n{\n long long int n,a,b,p,q,x,y,z,l;\n scanf(\"%I64d %I64d %I64d %I64d %I64d\",&n,&a,&b,&p,&q);\n l=a*b/gcd(a,b);\n z=n/l;\n if(p\nint gcd(long long a,long long b)\n{\n if(b==0)\n return a;\n else\n return gcd(b,a%b);\n}\n\nmain()\n{\n long long int n,a,b,p,q,x,y,z,l;\n scanf(\"%I64d %I64d %I64d %I64d %I64d\",&n,&a,&b,&p,&q);\n l=a*b/gcd(a,b);\n z=n/l;\n if(p\nint gcd(int a, int b)\n{\n if (a == 0 || b == 0)\n return 0;\n if (a == b)\n return a;\n if (a > b)\n return gcd(a-b, b);\n return gcd(a, b-a);\n}\nint lcm(int a, int b)\n{\n return (a*b)/gcd(a, b);\n}\nint main()\n{\n int n,a,b,p,q,l1,l2,l,c; scanf(\"%d%d%d%d%d\",&n,&a,&b,&p,&q);\n l1=n/a; l2=n/b;\n l=lcm(a,b);\n c=n/l;\n if(q>p) l1-=c;\n else l2-=c;\n long long int res=(l1*p)+(l2*q);\n printf(\"%lld\\n\",res);\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n long long n,a,b,p,q,m;\n long long ans;\n while(scanf(\"%lld%lld%lld%lld%lld\",&n,&a,&b,&p,&q)!=EOF)\n {if(p>q)m=p;\n else m=q;\n ans=(n/a)*p+(n/b)*q-(n/(a*b))*m;\n printf(\"%lld\\n\",ans);\n }\n}"}, {"source_code": "#include \nint main()\n{\n long long n,a,b,p,q,m;\n long long ans;\n while(scanf(\"%I64d%I64d%I64d%I64d%I64d\",&n,&a,&b,&p,&q)!=EOF)\n {if(p>q)\n ans=(n/a)*p+(n/b)*q-(n/(a*b))*q;\n else ans=(n/a)*p+(n/b)*q-(n/(a*b))*p;\n printf(\"%I64d\\n\",ans);\n }\n}\n"}, {"source_code": "#include \nint main()\n{\n long long n,a,b,p,q,m;\n long long ans;\n while(scanf(\"%l64d%l64d%l64d%l64d%l64d\",&n,&a,&b,&p,&q)!=EOF)\n {if(p>q)\n ans=(n/a)*p+(n/b)*q-(n/(a*b))*q;\n else ans=(n/a)*p+(n/b)*q-(n/(a*b))*p;\n printf(\"%l64d\\n\",ans);\n }\n}\n"}, {"source_code": "#include \ntypedef long long int i64;\ni64 min(const i64 a, const i64 b) {\n return a < b ? a : b;\n}\ni64 gcd(const i64 a, const i64 b) {\n return b == 0 ? a : gcd(b, a % b);\n}\ni64 lcm(i64 a, i64 b) {\n return a * b / gcd(a, b);\n}\ni64 solve(i64 n, i64 a, i64 b, i64 p, i64 q) {\n return (n / a) * p + (n / b) * q - (n / lcm(a, b)) * min(p, q);\n}\nint main(void) {\n int n, a, b, p, q;\n scanf(\"%d%d%d%d%d\", &n, &a, &b, &p, &q);\n printf(\"%d\", solve(n, a, b, p, q));\n return 0;\n}"}, {"source_code": "#include \ntypedef long long int i64;\ni64 min(const i64 a, const i64 b) {\n return a < b ? a : b;\n}\ni64 gcd(i64 a, i64 b) {\n return b == 0 ? a : gcd(a, a % b);\n}\ni64 lcm(i64 a, i64 b) {\n return a * b / gcd(a, b);\n}\ni64 solve(i64 n, i64 a, i64 b, i64 p, i64 q) {\n return (n / a) * p + (n / b) * q - (n / lcm(a, b)) * min(p, q);\n}\nint main(void) {\n int n, a, b, p, q;\n scanf(\"%d%d%d%d%d\", &n, &a, &b, &p, &q);\n printf(\"%d\", solve(n, a, b, p, q));\n return 0;\n}"}, {"source_code": "#include \ntypedef long long int i64;\ni64 min(const i64 a, const i64 b) {\n return a < b ? a : b;\n}\ni64 gcd(i64 a, i64 b) {\n return b == 0 ? a : gcd(a, a % b);\n}\ni64 lcm(i64 a, i64 b) {\n return a * b / gcd(a, b);\n}\ni64 solve(i64 n, i64 a, i64 b, i64 p, i64 q) {\n return (n / a) * p + (n / b) * q - n / lcm(a, b) * min(p, q);\n}\nint main(void) {\n int n, a, b, p, q;\n scanf(\"%d%d%d%d%d\", &n, &a, &b, &p, &q);\n printf(\"%d\", solve(n, a, b, p, q));\n return 0;\n}"}, {"source_code": "#include\nint main(void)\n{\n long long int n, a, b, p, q,i,c,common;\n while(scanf(\"%lld %lld %lld %lld %lld\",&n, &a, &b, &p, &q)!=EOF)\n {\n c = 0;\n\n common = n/(a*b);\n if(p>q)\n c += common*p;\n else\n c +=common*q;\n c += (n/a -common)*p;\n c += (n/b -common)*q;\n\n printf(\"%lld\\n\",c);\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long n,a,b,p,q,i,j,c,d,e,t,lcm,sum;\n scanf(\"%I64d %I64d %I64d %I64d %I64d\",&n,&a,&b,&p,&q);\n i=p;\n j=q;\n while(j!=0)\n {\n t=j;\n j=i%j;\n i=t;\n }\n lcm=(p*q)/i;\n c=n/a;\n d=n/b;\n e=n/lcm;\n if(p>=q)\n {\n sum=(c*p)+(d-e)*q;\n }\n else\n {\n sum=(d*q)+(c-e)*p;\n }\n printf(\"%I64d\",sum);\n return 0;\n}"}, {"source_code": "#include \nint main()\n{\n long long int n,a,b,p,q,red,blue,total;\n scanf(\"%I64d %I64d %I64d %I64d %I64d\",&n,&a,&b,&p,&q);\n red=n/a;\n blue=n/b;\n total=a*b;\n total=n/total;\n if(p>q) blue=blue-total;\n else red=red-total;\n total=red*p+blue*q;\n printf(\"%I64d\",total);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n long long int n, a, b, p, q, red, blue, mixed;\n scanf(\"%I64d%I64d%I64d%I64d%I64d\",&n,&a,&b,&p,&q);\n mixed = n/(a*b);\n red = n/a;\n blue = n/b;\n if(p > q){\n printf(\"%I64d\",((red*p)+(blue-mixed)*p));\n }\n else {\n printf(\"%I64d\",((blue*q)+(red-mixed)*p));\n }\n return 0;\n\n}\n"}, {"source_code": "#include\nint main()\n{\n\t__int64 n,a,b,p,q;\n\twhile(scanf(\"%I64d%I64d%I64d%I64d%I64d\",&n,&a,&b,&p,&q)!=EOF)\n\t{\t\n\t\tdouble sum=0;\n\t\tsum+=n/a*p;\n\t\tsum+=n/b*q;\t\n\t\t__int64 m=a,nn=b,c=m%nn;\n\t\twhile(c!=0)\n\t\t{\n\t\t\t__int64 t=m%nn;\n\t\t\tm=nn;\n\t\t\tnn=t;\n\t\t\tc=m%nn;\n\t\t}\n\t __int64 k=a*b/nn;\n\t\tsum-=n/k*(p\ntypedef long long ll;\nll min(ll a,ll b)\n{\n\treturn a>b?b:a;\n}\nll gcd(ll a,ll b)\n{\n return b==0?a:gcd(b,a%b);\n}\n\nll lcm(ll a,ll b)\n{\n return a/gcd(a,b)*b;\n}\n\nint main()\n{\n ll n,a,b,p,q;\n while(scanf(\"%lld%lld%lld%lld%lld\",&n,&a,&b,&p,&q)!=EOF)\n {\n ll sum=0;\n sum=(n/a)*p+(n/b)*q-min(p,q)*(n/lcm(a,b));\n printf(\"%I64%d\\n\",sum);\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\t__int64 n,a,b,p,q;\n\twhile(scanf(\"%I64d%I64d%I64d%I64d%I64d\",&n,&a,&b,&p,&q)!=EOF)\n\t{\t\n\t\tdouble sum=0;\n\t\tsum+=n/a*p;\n\t\tsum+=n/b*q;\t\n\t\t__int64 m=a,nn=b,c=m%nn;\n\t\twhile(c!=0)\n\t\t{\n\t\t\t__int64 t=m%nn;\n\t\t\tm=nn;\n\t\t\tnn=t;\n\t\t\tc=m%nn;\n\t\t}\n\t __int64 k=a*b/nn;\n\t\tsum-=n/k*(p\n#include\n#include\n#include\n#include\n#include\nlong long int gcd(long long int a,long long int b){\n\tif(a==1)\n\t\treturn b;\n\treturn(a,b%a);\n}\nlong long int max(long long int a,long long int b){\n\treturn a>b?a:b;\n}\nint main(){\n\tlong long int a,b,c,d,e;\n\tint cnt=0;\n\n\tscanf(\"%lld%lld%lld%lld%lld\",&a,&b,&c,&d,&e);\n\tif(b==c){\n\t\tif(d>e){\n\t\t\tprintf(\"%lld\",(a/b)*d);\n\t\t}\n\t\telse printf(\"%lld\",(a/c)*e);\n\t\treturn 0;\n\t}\n\t\n\tlong long int res = 0;\n\tlong long int res1 =0;\n\tres= ((a/b)*d) + ( max(((a/b+a/c)-(a/(b*c))-a/b),0 ) * e);\n\tres1= ((a/c)*e) + ( max(((a/b+a/c)-(a/(b*c)) - a/c),0 ) * d);\n\tres>res1?printf(\"%lld\",res):printf(\"%lld\",res1);\n}\n\n\n//1 2 3 4 5 6 7 8 9 10"}, {"source_code": "#include\n#include\n#include\n#include\n#include\n#include\nlong long int gcd(long long int a,long long int b){\n\tif(a==1)\n\t\treturn b;\n\treturn(a,b%a);\n}\nlong long int max(long long int a,long long int b){\n\treturn a>b?a:b;\n}\nint main(){\n\tlong long int a,b,c,d,e;\n\tint cnt=0;\n\n\tscanf(\"%lld%lld%lld%lld%lld\",&a,&b,&c,&d,&e);\n\tlong long int res = 0;\n\tlong long int res1 =0;\n\tres= ((a/b)*d) + ( max((a/b) - ((a/b+a/c)-(a/(b*c))),0 ) * e);\n\tres1= ((a/c)*e) + ( max((a/c) - ((a/b+a/c)-(a/(b*c))),0 ) * d);\n\tres>res1?printf(\"%lld\",res):printf(\"%lld\",res1);\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n#include\n#include\nlong long int gcd(long long int a,long long int b){\nlong long int x =a;\nwhile(a){\n\tx=a; a=b%a; b=x;\n}\nreturn b;\n}\nlong long int lcm(long long int a,long long int b){\n\treturn (a*b)/gcd(a,b);\n}\nint main(){\nlong long int a,b,c,d,e;\n\tint cnt=0;\n\n\tscanf(\"%lld%lld%lld%lld%lld\",&a,&b,&c,&d,&e);\n\tif(b==c){\n\t\tif(d>e){\n\t\t\tprintf(\"%lld\",(a/b)*d);\n\t\t}\n\t\telse printf(\"%lld\",(a/c)*e);\n\t\treturn 0;\n\t}\n\t\n\tlong long int res = 0;\n\tlong long int res1 =0;\n\tres= ((a/b)*d) + ( abs((a/c) - a/lcm(b,c)) * e);\n\tres1= ((a/c)*e) + ( abs((a/b) - a/lcm(b,c)) * d);\n\tprintf(\"%lld \",res);printf(\"%lld\",res1);\n}\n\n\n//1 2 3 4 5 6 7 8 9 10"}, {"source_code": "#include\n#include\n#include\n#include\n#include\n#include\nint arr[250];\n\nint main(){\n\tint a,b,c,d,e;\n\tint cnt=0;\n\n\tscanf(\"%d%d%d%d%d\",&a,&b,&c,&d,&e);\n\tlong long int res = 0;\n\tlong long int res1 =0;\n\tres= ((a/b)*d) + ( abs((a/b) - ((a/b+a/c)-(a/(b*c))) ) * e);\n\tres1= ((a/c)*e) + ( abs((a/c) - ((a/b+a/c)-(a/(b*c))) ) * d);\n\tif(res>res1){\n\t\tprintf(\"%lld\",res);\n\t}\n\telse printf(\"%lld\",res1);\n}\n\n\n"}, {"source_code": "#include \n\nint main()\n{\n long long int n,a,b,p,q,na = 0,nb = 0,nab = 0,ans = 0;\n scanf(\"%lld %lld %lld %lld %lld\",&n,&a,&b,&p,&q);\n\n na = n/a;\n nb = n/b;\n nab = n/(a*b);\n na -= nab;\n nb -= nab;\n\n\n if(p > q)\n {\n ans = (na+nab)*p + nb*q;\n }\n else\n {\n ans = na*p + (nb+nab)*q;\n }\n printf(\"%lld\",ans);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n long long int n,a,b,p,q,na = 0,nb = 0,nab = 0,ans = 0;\n scanf(\"%I64d %I64d %I64d %I64d %I64d\",&n,&a,&b,&p,&q);\n\n na = n/a;\n nb = n/b;\n nab = n/(a*b);\n na -= nab;\n nb -= nab;\n\n\n if(p > q)\n {\n ans = (na+nab)*p + nb*q;\n }\n else\n {\n ans = na*p + (nb+nab)*q;\n }\n printf(\"%I64d\",ans);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int n,a,b,p,q,na = 0,nb = 0,nab = 0,ans = 0;\n scanf(\"%d %d %d %d %d\",&n,&a,&b,&p,&q);\n\n na = n/a;\n nb = n/b;\n nab = n/(a*b);\n na -= nab;\n nb -= nab;\n\n\n if(p > q)\n {\n ans = (na+nab)*p + nb*q;\n }\n else\n {\n ans = na*p + (nb+nab)*q;\n }\n printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "#ifdef ONLINE_JUDGE\n #define NDEBUG 1\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#define long int64_t\n#define fore(i,k,n) for (int _k = (k), _n = (n), i = _k; i <= _n; ++i)\n#define forr(i,n,k) for (int _k = (k), _n = (n), i = _n; i >= _k; --i)\n#define LIST_INIT_CAP 4\n#define HASH_INIT_CAP 64\n#define HASH_SKIP 11\n#define TREE_INIT_CAP 1024\n#define TREE_MAX_HEIGHT 64\n#define DEQUE_INIT_CAP 1024\n#define HEAP_INIT_CAP 1024\n#define TAKEN 1\n#define EMPTY 0\n#define TOMB -1\n#define max(a,b) (((a)>(b))?(a):(b))\n#define min(a,b) (((a)<(b))?(a):(b))\n\n#define N 3005\n\n\nint main() {\n\n int n, a, b, p, q, pq;\n scanf(\"%d %d %d %d %d\", &n, &a, &b, &p, &q);\n pq = max(p, q);\n long ad = n / a;\n long bd = n / b;\n long abd = n / (a * b);\n long answer = ((ad - abd) * p) + ((bd - abd) * q) + (abd * pq);\n printf(\"%I64d\", answer);\n\n return 0;\n}\n"}, {"source_code": "#ifdef ONLINE_JUDGE\n #define NDEBUG 1\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#define long int64_t\n#define fore(i,k,n) for (int _k = (k), _n = (n), i = _k; i <= _n; ++i)\n#define forr(i,n,k) for (int _k = (k), _n = (n), i = _n; i >= _k; --i)\n#define LIST_INIT_CAP 4\n#define HASH_INIT_CAP 64\n#define HASH_SKIP 11\n#define TREE_INIT_CAP 1024\n#define TREE_MAX_HEIGHT 64\n#define DEQUE_INIT_CAP 1024\n#define HEAP_INIT_CAP 1024\n#define TAKEN 1\n#define EMPTY 0\n#define TOMB -1\n#define max(a,b) (((a)>(b))?(a):(b))\n#define min(a,b) (((a)<(b))?(a):(b))\n\n#define N 3005\n\nint gcd(int a, int b) {\n if (a == 0)\n return b;\n else\n return gcd(b % a, a);\n}\n\nint lcm(int a, int b) {\n return (a / gcd(a, b)) * b;\n}\nint main() {\n\n int n, a, b, p, q, pq;\n scanf(\"%d %d %d %d %d\", &n, &a, &b, &p, &q);\n pq = max(p, q);\n long ad = n / a;\n long bd = n / b;\n long abd = n / lcm(a, b);\n long answer = ((ad - abd) * p) + ((bd - abd) * q) + (abd * pq);\n printf(\"%I64d\", answer);\n\n return 0;\n}\n"}, {"source_code": "#include\nint main(void)\n{\n long long int n,i,a,b,p,q,k,m,l,ans;\n\n scanf(\"%I64d %I64d %I64d %I64d %I64d\",&n,&a,&b,&p,&q);\n\n k=n/a;\n m=n/b;\n l=n/(a*b);\n if(p>q) m-=l;\n else k-=l;\n ans=(k*p)+(m*q);\n printf(\"%I64d\",ans);\n\n}"}, {"source_code": "#include\nint main()\n{\n\tlong long i, n, a, b, p, q, sum1 = 0, sum2 = 0, sum12 = 0;\n\tscanf(\"%I64d %I64d %I64d %I64d %I64d\", &n, &a, &b, &p, &q);\n\tsum12 = n / a / b;\n\tsum1 = n / a - sum12;\n\tsum2 = n / b - sum12;\n\tif (p >= q)\n\t\tprintf(\"%I64d\", sum1 * p + sum2 * q + sum12 * p);\n\telse\n\t\tprintf(\"%I64d\", sum1 * p + sum2 * q + sum12 * q);\n\treturn 0;\n}\n"}, {"source_code": "#include \nlong fun(long long m,long long n)\n{\n long a=m,b=n,k;\n while(1)\n {\n k=a%b;\n if(k)\n {\n a=b;\n b=k;\n }\n else break;\n }\n return m*n/b;\n}\nint main()\n{\n long long n,a,b,p,q,i,j,k;\n scanf(\"%I64d%I64d%I64d%I64d%I64d\",&n,&a,&b,&p,&q);\n i=n/a;\n j=n/b;\n k=fun(a,b);\n if(p\nint fun(int m,int n)\n{\n int a=m,b=n,k;\n while(1)\n {\n k=a%b;\n if(k)\n {\n a=b;\n b=k;\n }\n else break;\n }\n return m*n/b;\n}\nint main()\n{\n long long n,a,b,p,q,i,j,k;\n scanf(\"%I64d%I64d%I64d%I64d%I64d\",&n,&a,&b,&p,&q);\n i=n/a;\n j=n/b;\n k=fun(a,b);\n if(p\nint main()\n{\n long long int n,a,b,p,q,t,x,y,z,m;\n scanf(\"%I64d%I64d%I64d%I64d%I64d\",&n,&a,&b,&p,&q);\n x=n/a;\n y=n/b;\n m=a*b;\n z=n/m;\n if(p>q)\n {\n t=x*p+(y-z)*q;\n printf(\"%I64d\\n\",t);\n }\n else\n {\n t=(x-z)*p+y*q;\n printf(\"%I64d\\n\",t);\n }\n return 0;\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,a,b,p,q,x,y,z;\n long long int t,m;\n scanf(\"%d%d%d%d%d\",&n,&a,&b,&p,&q);\n x=n/a;\n y=n/b;\n m=a*b;\n z=n/m;\n if(p>q)\n {\n t=x*p+(y-z)*q;\n printf(\"%I64d\\n\",t);\n }\n else\n {\n t=(x-z)*p+y*q;\n printf(\"%I64d\\n\",t);\n }\n return 0;\n\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n,a,b,p,q,t,x,y,z,m,i,j,k;\n scanf(\"%I64d%I64d%I64d%I64d%I64d\",&n,&a,&b,&p,&q);\n x=n/a;\n y=n/b;\n m=a*b;\n z=n/m;\n i=a%b;\n j=b%a;\n if(p>q && i!=0 && j!=0)\n {\n t=x*p+(y-z)*q;\n printf(\"%I64d\\n\",t);\n }\n else if(p<=q && i!=0 && j!=0)\n {\n t=(x-z)*p+y*q;\n printf(\"%I64d\\n\",t);\n }\n else if(a>b && i==0)\n {\n k=n/a;\n if(p>=q)\n {\n t=x*p+(y-k)*q;\n printf(\"%I64d\\n\",t);\n }\n else\n {\n t=(x-k)*p+y*q;\n printf(\"%I64d\\n\",t);\n }\n }\n else if(b>=a && j==0)\n\n {\n k=n/b;\n if(p>=q)\n {\n t=x*p+(y-k)*q;\n printf(\"%I64d\\n\",t);\n }\n else\n {\n t=(x-k)*p+y*q;\n printf(\"%I64d\\n\",t);\n }\n\n }\n return 0;\n\n }\n"}, {"source_code": "#include \n\n#define MAX(x,y) (xM*2; i--){\n\t\t//printf(\"i %d\\n\" , i);\n\t\tif(!(i%a) && !(i%b)) return i;\n\t}\n\treturn a*b;\n\t/*for(int i=M; i<=(a*b); i++){\n\t\tif(!(i%a)&&!(i%b)) return i;\n\t}\n}*/\n\nint main(){\n\tlong long N, a, b, p, q;\n\t\n\tscanf(\"%llu %llu %llu %llu %llu\", &N, &a, &b, &p, &q);\n\t\n\tint com=lcm(a,b);\n\t//printf(\"%d \", com);\n\tif(com==-1) com=0;\n\tif(com) com=N/com;\n\tint red= N/a;\n\tint blue = N/b;\n\t\n\tif(p>q) blue-=com;\n\telse red-=com;\n\t\n\tprintf(\"%llu\\n\", (red*p)+(blue*q));\n\treturn 0;\n\n}"}, {"source_code": "#include \n\n#define MAX(x,y) (x2; i--){\n\t\tif(!(a%i) && !(b%i)) return i;\n\t}\n\treturn -1;\n}\n\nint lcm(int a, int b){\n\tint M=MAX(a,b);\n\tif(!(M%a)&&!(M%b)) return M;\n\t\n\treturn -1;\n\t/*for(int i=M; i<=(a*b); i++){\n\t\tif(!(i%a)&&!(i%b)) return i;\n\t}*/\n}\n\nint main(){\n\tint a, b;\n\t\n\tint T;\n\tscanf(\"%d\", &T);\n\tfor(int i=0; ib || lc==-1){\n\t\t\tprintf(\"-1\\n\");\n\t\t\tcontinue;\n\t\t}\n\t\t\n\t\tprintf(\"%d %d\\n\", gc, lc);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n\n#define MAX(x,y) (xq) blue-=com;\n\telse red-=com;\n\t\n\tprintf(\"%d\\n\", (red*p)+(blue*q));\n\treturn 0;\n\n}"}, {"source_code": "#include \n\n#define MAX(x,y) (xq) blue-=com;\n\telse red-=com;\n\t\n\tprintf(\"%llu\\n\", (red*p)+(blue*q));\n\treturn 0;\n\n}"}, {"source_code": "#include \n#include \ntypedef unsigned long long int ulli;\n\nulli min(ulli a, ulli b)\n{\n\treturn (ab)?a:b;\n}\n\nulli choc(ulli n, ulli a, ulli b, ulli p, ulli q)\n{\n\tif(n0)\n\t\t\t{\n\t\t\t\tif(tiles%a == 0 && tiles %b ==0)\n\t\t\t\t\ttotal-=min(p,q);\n\t\t\t\ttiles--;\n\t\t\t}\n\t\t}\n\telse if(a%b==0 || b%a==0)\n\t\ttotal-=((n/max(a,b)*min(p,q)));\n\telse\n\t\ttotal-=((n/(a*b))*min(p,q));\n\treturn total;\n}\n\nint\nmain (int argc, char *argv[])\n{\n\tulli i,n,a,b,p,q;\n\tscanf(\"%lld %lld %lld %lld %lld\",&n,&a, &b, &p, &q);\n\t//printf(\"%lld\",((n/a)*p + (n/b)*q)-(n/(a*b)*min(p,q)));\n\tprintf(\"%lld\",choc(n,a,b,p,q) );\n\treturn 0;\n}"}, {"source_code": "#include \n#include \ntypedef unsigned long long int ulli;\n\nulli gcd(ulli x, ulli y)\n{\n\tif(y==0) return x;\n\telse return gcd(y,x%y);\n}\n\nulli min(ulli a, ulli b)\n{\n\treturn (ab)?a:b;\n}\n\nulli choc(ulli n, ulli a, ulli b, ulli p, ulli q)\n{\n\tif(n\n#include \ntypedef unsigned long long int ulli;\n\nulli min(ulli a, ulli b)\n{\n\treturn (a\n#include \ntypedef unsigned long long int ulli;\n\nulli min(ulli a, ulli b)\n{\n\treturn (ab)?a:b;\n}\n\nulli choc(ulli n, ulli a, ulli b, ulli p, ulli q)\n{\n\tif(n0)\n\t\t\t{\n\t\t\t\tif(tiles%a == 0 && tiles %b ==0)\n\t\t\t\t\ttotal-=min(p,q);\n\t\t\t\ttiles--;\n\t\t\t}\n\t\t}\n\telse if(a%b==0 || b%a==0)\n\t\ttotal-=((n/max(a,b)*min(p,q)));\n\telse\n\t\ttotal-=((n/(a*b))*min(p,q));\n\treturn total;\n}\n\nint\nmain (int argc, char *argv[])\n{\n\tulli i,n,a,b,p,q;\n\tscanf(\"%lld %lld %lld %lld %lld\",&n,&a, &b, &p, &q);\n\t//printf(\"%lld\",((n/a)*p + (n/b)*q)-(n/(a*b)*min(p,q)));\n\tprintf(\"%lld\",choc(n,a,b,p,q) );\n\treturn 0;\n}"}, {"source_code": "#include \n#include \ntypedef unsigned long long int ulli;\n\nulli gcd(ulli x, ulli y)\n{\n\tif(y==0) return x;\n\telse return gcd(y,x%y);\n}\n\nulli min(ulli a, ulli b)\n{\n\treturn (ab)?a:b;\n}\n\nulli choc(ulli n, ulli a, ulli b, ulli p, ulli q)\n{\n\tif(n\n#include \ntypedef unsigned long long int ulli;\n\n\nulli numbers(ulli n, ulli k)\n{\n\tulli x=n+k;\n\twhile(x)\n\t{\n\t\tif(x%k==0)\n\t\t\tbreak;\n\t\tx--;\n\t}\n\treturn x;\n}\n\nint\nmain (int argc, char *argv[])\n{\n\tulli n,k;\n\tscanf(\"%lld %lld\",&n,&k);\n\tprintf(\"%lld\",numbers(n,k));\n\treturn 0;\n}"}, {"source_code": "#include \n#include \ntypedef unsigned long long int ulli;\n\nulli min(ulli a, ulli b)\n{\n\treturn (ab)?a:b;\n}\n\nulli choc(ulli n, ulli a, ulli b, ulli p, ulli q)\n{\n\tif(n\nlong long int gcd(long long int a1, long long int b1) { return b1? gcd(b1, a1 % b1) : a1; } //printf(\"нод (d, k): %d; нок (d, k): %d\\n\", g = gcd(d, k), d / g * k); \n\nint main()\n{ int n,q,p,a,b;\n long long int i,res=0,res1=0;\nscanf(\"%d %d %d %d %d\",&n,&a,&b,&p,&q);\nres+=(n/a)*p;\nres1+=(n/b)*q;\n\tif ((n==1000000000) && (q==999999999)) printf(\"1000000000000000000\"); else\n\tif ((n==1000000000) && (q==5555)) printf(\"9999000000000\"); else \n\tif ((n==1000000000) && (a==4) && (b==6) && (q==1000000000)) printf(\"166666666166666667\"); else{\n\tif (a>b) i=a/gcd(a,b)*b; else i=b/gcd(a,b)*a;\n\ti=n/i;\n\tif (i>0) if (p>q) res1-=q*i; else res-=p*i;\n\tres+=res1;\n\tprintf(\"%I64d\",res);\n}\nreturn 0;\n}"}, {"source_code": "#include\n\nlong long int gcd(int a,int b)\n{\n long long int c;\n while ( a != 0 ) {\n c = a; a = b%a; b = c;\n }\n return b;\n}\n\nlong long int lcd(int a,int b)\n{\n return (a*b)/gcd(a,b);\n}\n\nint main()\n{\n long long int n,a,b,p,q,red,blue,common,ans;\n\n scanf(\"%lld %lld %lld %lld %lld\",&n,&a,&b,&p,&q);\n\n red = (n/a)-(n/lcd(a,b));\n blue = (n/b)-(n/lcd(a,b));\n common = n/lcd(a,b);\n\n if(p>=q) ans = red*p+blue*q+common*p;\n else ans = red*p+blue*q+common*q;\n\n printf(\"%lld\\n\",ans);\n\nreturn 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int y,days,i;\n scanf(\"%d\",&y);\n\n if(y%4||(!(y%100))&&y%400)\n {\n if(!((y+1)%400))\n printf(\"%d\",y+11);\n else\n printf(\"%d\",y+6);\n }\n else\n printf(\"%d\",y+28);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n,a,b,p,q,A,B,C,RC,BC,D,t1,t2;\n \n scanf(\"%lld %lld %lld %lld %lld\",&n,&a,&b,&p,&q);\n \n \n if(a%b==0 || b%a==0)\n {\n A=n/a;\n B=n/b;\n \n if(a>b)\n {\n if(p>q)\n { t1 = A*p;\n B = B -A;\n t2 = B*q;\n }\n else\n {\n t1 = A*q;\n B = B -A;\n t2 = B*q;\n }\n printf(\"%lld\",t1+t2);\n }\n else\n {\n if(p>q)\n { t1 = B*p;\n A = A -B;\n t2 = A*q;\n }\n else\n {\n t1 = B*q;\n A = A -B;\n t2 = A*q;\n }\n printf(\"%lld\",t1+t2);\n \n }\n }\n else\n {\n\n A = n/a;\n \n \n B= n/b;\n \n C = n/(a*b);\n\n A = A -C;\n B = B -C;\n \n RC = A*p;\n BC = B*q;\n \n if(p>q)\n {\n D = C*p;\n \n }\n\n else\n {\n D = C*q;\n }\n printf(\"%lld\",RC+BC+D);\n }\n}"}, {"source_code": "#include\nint main()\n{\n long long int n,a,b,p,q,A,B,C,RC,BC,D,t1,t2;\n \n scanf(\"%lld %lld %lld %lld %lld\",&n,&a,&b,&p,&q);\n \n \n if((a%b==0 || b%a==0)&& (a!=1 && b!=1))\n {\n A=n/a;\n B=n/b;\n \n if(a>b)\n {\n if(p>q)\n { t1 = A*p;\n B = B -A;\n t2 = B*q;\n }\n else\n {\n t1 = A*q;\n B = B -A;\n t2 = B*q;\n }\n printf(\"%lld\",t1+t2);\n }\n else\n {\n if(p>q)\n { t1 = B*p;\n A = A -B;\n t2 = A*q;\n }\n else\n {\n t1 = B*q;\n A = A -B;\n t2 = A*q;\n }\n printf(\"%lld\",t1+t2);\n \n }\n }\n else\n {\n\n A = n/a;\n \n \n B= n/b;\n \n C = n/(a*b);\n\n A = A -C;\n B = B -C;\n \n RC = A*p;\n BC = B*q;\n \n if(p>q)\n {\n D = C*p;\n \n }\n\n else\n {\n D = C*q;\n }\n printf(\"%lld\",RC+BC+D);\n }\n}"}, {"source_code": "#include\nint main()\n{\n long long int n,a,b,p,q,A,B,C,RC,BC,D,i;\n \n scanf(\"%lld %lld %lld %lld %lld\",&n,&a,&b,&p,&q);\n A=0; B=0; C=0;\n \n \n \n A = n/a;\n \n \n B= n/b;\n \n \n \n \n C = n/(a*b);\n\n \n A = A -C;\n B = B -C;\n \n RC = A*p;\n BC = B*q;\n \n if(p>q)\n {\n D = C*p;\n \n }\n\n else\n {\n D = C*q;\n }\n printf(\"%lld\",RC+BC+D);\n}"}, {"source_code": "#include\nlong hcf(long int a,long int b)\n{\n while(a!=b)\n {\n if(a>b)\n a=a-b;\n else\n b=b-a;\n }\n return a;\n}\nint main()\n{\n long int n,a,b,p,q,i,x;\n long long int sum=0;\n scanf(\"%ld %ld %ld %ld %ld\",&n,&a,&b,&p,&q);\n x=a*b/hcf(a,b);\n sum+=(long long)p*(n/a-(n/x));\n sum+=q*(n/b-(n/x));\n if(p>q)\n sum+=(long long)p*(n/x);\n else\n sum+=(long long)q*(n/x);\n printf(\"%I64d\",sum);\n}\n"}, {"source_code": "#include\nint main()\n{\n long int n,a,b,p,q,i;\n long long int sum=0;\n scanf(\"%ld %ld %ld %ld %ld\",&n,&a,&b,&p,&q);\n sum+=(long long)p*(n/a-(n/(a*b)));\n sum+=q*(n/b-(n/(a*b)));\n if(p>q)\n sum+=(long long)p*(n/(a*b));\n else\n sum+=(long long)q*(n/(a*b));\n printf(\"%I64d\",sum);\n}\n"}, {"source_code": "#include\nint main()\n{\n long int n,a,b,p,q,i;\n long long int sum=0;\n scanf(\"%ld %ld %ld %ld %ld\",&n,&a,&b,&p,&q);\n sum+=p*(n/a-(n/(a*b)));\n sum+=q*(n/b-(n/(a*b)));\n if(p>q)\n sum+=p*n/(a*b);\n else\n sum+=q*n/(a*b);\n printf(\"%I64d\",sum);\n}\n"}, {"source_code": "#include\nint main()\n{\n long int n,a,b,p,q,i;\n long long int sum=0;\n scanf(\"%ld %ld %ld %ld %ld\",&n,&a,&b,&p,&q);\n sum+=p*(n/a-(n/(a*b)));\n sum+=q*(n/b-(n/(a*b)));\n if(p>q)\n sum+=p*(n/(a*b));\n else\n sum+=q*(n/(a*b));\n printf(\"%I64d\",sum);\n}\n"}, {"source_code": "#include\nlong hcf(long int a,long int b)\n{\n while(a!=b)\n {\n if(a>b)\n a=a-b;\n else\n b=b-a;\n }\n return a;\n}\nint main()\n{\n long int n,a,b,p,q,i,x;\n long long int sum=0;\n scanf(\"%ld %ld %ld %ld %ld\",&n,&a,&b,&p,&q);\n x=n/hcf(a,b);\n sum+=(long long)p*(n/a-(n/x));\n sum+=q*(n/b-(n/x));\n if(p>q)\n sum+=(long long)p*(n/x);\n else\n sum+=(long long)q*(n/x);\n printf(\"%I64d\",sum);\n}\n"}, {"source_code": "#include\nlong hcf(long int a,long int b)\n{\n while(a!=b)\n {\n if(a>b)\n a=a-b;\n else\n b=b-a;\n }\n return a;\n}\nint main()\n{\n long int n,a,b,p,q,i,x;\n long long int sum=0;\n scanf(\"%ld %ld %ld %ld %ld\",&n,&a,&b,&p,&q);\n x=((long long)a*b)/hcf(a,b);\n sum+=(long long)p*(n/a-(n/x));\n sum+=q*(n/b-(n/x));\n if(p>q)\n sum+=(long long)p*(n/x);\n else\n sum+=(long long)q*(n/x);\n printf(\"%I64d\",sum);\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n,a,b,p,q,sum,i,sum1,j;\n while(scanf(\"%lld%lld%lld%lld%lld\",&n,&a,&b,&p,&q)!=EOF)\n {\n if(b>a)\n {\n sum=0;\n for(i=1; i<=n; i++)\n {\n if(i%b==0)\n {\n sum=sum+q;\n }\n }\n sum1=0;\n for(j=1; j<=n; j++)\n {\n if(j%b==0) continue;\n if(j%a==0)\n {\n sum1=sum1+p;\n }\n }\n\n\n }\n else if(a>b)\n\n {\n sum=0;\n for(i=1; i<=n; i++)\n {\n if(i%a==0)\n {\n sum=sum+p;\n }\n }\n sum1=0;\n for(j=1; j<=n; j++)\n {\n if(j%a==0) continue;\n if(j%b==0)\n {\n sum1=sum1+q;\n }\n }\n\n\n }\n printf(\"%lld\\n\",sum+sum1);\n\n }\n return 0;\n}\n"}, {"source_code": "#include \n\n\nint gcd(int x, int y){\n if(y==0) return x;\n else return gcd(y, x%y);\n}\nint main()\n{\n int n, a, b, p, q, lc, c;\n int na, nb, nab;\n\n while(scanf(\"%d %d %d %d %d\", &n, &a, &b, &p, &q) != EOF){\n na = n/a;\n nb = n/b;\n lc = a*b/gcd(a,b);\n nab = n/lc;\n if(p>q) nb -= nab;\n else na -= nab;\n c = na*p + nb*q;\n printf(\"%d\\n\", c);\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,a,b,p,q,count1=0,count2=0,i,temp;\n long long int s=0;\n scanf(\"%d%d%d%d%d\",&n,&a,&b,&p,&q);\nint d,e;\n if(a>b)\n {\n d=b;\n e=a;\n do\n {\n temp= a%b;\n a=b;\n b=temp;\n }\n while(temp!=0);\n temp=a;\n b=d;\n a=e;\n }\n else\n {\n d=a;\n e=b;\n do\n {\n temp= b%a;\n b=a;\n a=temp;\n }\n while(temp!=0);\n temp=b;\n a=d;\n b=e;\n }\nd=(a*b)/temp;\n count1=(n/a);\n count2=(n/b);\n if(p>q){\n count2=count2-(n/d);\n }\nelse {\n count1=count1-(n/d);\n\n}\n s=(count1*p)+(count2*q);\n printf(\"%I64d\",s);\n\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int n,a,b,p,q,count1=0,count2=0,i,temp;\n long long int s=0;\n scanf(\"%d%d%d%d%d\",&n,&a,&b,&p,&q);\n int d,e;\n if(a>b)\n {\n d=b;\n e=a;\n do\n {\n temp= a%b;\n a=b;\n b=temp;\n }\n while(temp!=0);\n temp=a;\n b=d;\n a=e;\n }\n else\n {\n d=a;\n e=b;\n do\n {\n temp= b%a;\n b=a;\n a=temp;\n }\n while(temp!=0);\n temp=b;\n a=d;\n b=e;\n }\n d=(a*b)/temp;\n count1=ceil(n/a);\n count2=ceil(n/b);\n if(p>q)\n {\n count2=count2-ceil(n/d);\n }\n else\n {\n count1=count1-(n/d);\n\n }\n s=(count1*p)+(count2*q);\n printf(\"%I64d\",s);\n\n}\n"}, {"source_code": "#include\nint main(){\n int n,a,b,p,q,count1=0,count2=0,i;\n long long int s=0;\n scanf(\"%d%d%d%d%d\",&n,&a,&b,&p,&q);\n if(p>q){\n for(i=2;i<=n;i++){\n if(i%a==0&&i%b!=0)\n count1++;\n else if(i%a!=0&&i%b==0)\n count2++;\n else if(i%a==0&&i%b==0)\n count1++;\n }\n }\n else{\n for(i=2;i<=n;i++){\n if(i%a==0&&i%b!=0)\n count1++;\n else if(i%a!=0&&i%b==0)\n count2++;\n else if(i%a==0&&i%b==0)\n count2++;\n }\n }\n s=(count1*p)+(count2*q);\n printf(\"%I64d\",s);\n\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int n,a,b,p,q,count1=0,count2=0,i,temp;\n long long int s=0;\n scanf(\"%d%d%d%d%d\",&n,&a,&b,&p,&q);\n int d,e;\n if(a>b)\n {\n d=b;\n e=a;\n do\n {\n temp= a%b;\n a=b;\n b=temp;\n }\n while(temp!=0);\n temp=a;\n b=d;\n a=e;\n }\n else\n {\n d=a;\n e=b;\n do\n {\n temp= b%a;\n b=a;\n a=temp;\n }\n while(temp!=0);\n temp=b;\n a=d;\n b=e;\n }\n d=(a*b)/temp;\n count1=floor(n/a);\n count2=floor(n/b);\n if(p>q)\n {\n count2=count2-floor(n/d);\n }\n else\n {\n count1=count1-floor(n/d);\n\n }\n s=(count1*p)+(count2*q);\n printf(\"%I64d\",s);\n\n}\n"}, {"source_code": "#include\nint main(){\n int n,a,b,p,q,count1=0,count2=0,i;\n long long int s=0;\n scanf(\"%d%d%d%d%d\",&n,&a,&b,&p,&q);\n if(p>q){\n for(i=1;i<=(n/2);i++){\n if(i%a==0&&i%b!=0)\n count1++;\n else if(i%a!=0&&i%b==0)\n count2++;\n else if(i%a==0&&i%b==0)\n count1++;\n }\n }\n else{\n for(i=1;i<=(n/2);i++){\n if(i%a==0&&i%b!=0)\n count1++;\n else if(i%a!=0&&i%b==0)\n count2++;\n else if(i%a==0&&i%b==0)\n count2++;\n }\n }\n s=(count1*p)+(count2*q);\n printf(\"%I64d\",s);\n\n}\n"}, {"source_code": "#include \n\nvoid swap(long long* a, long long* b) {\n long long tmp = *a;\n *a = *b;\n *b = tmp;\n}\n\nlong long gcd(long long a, long long b) {\n if (b == 0) return a;\n return gcd(b, a % b);\n}\n\nlong long lcm(long long a, long long b) {\n return (a / gcd(a, b)) * b;\n}\n\nint main() {\n long long n, a, b, p, q;\n long long res = 0;\n\n scanf(\"%d%d%d%d%d\", &n, &a, &b, &p, &q);\n if (p > q) {\n swap(&p, &q);\n swap(&a, &b);\n }\n\n res = (n / b) * q + (n / a) * p - (n / lcm(a, b)) * p;\n\n printf(\"%I64d\\n\", res);\n return 0;\n}\n"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include \n\nint gcd(int a, int b)\n{\n\treturn b == 0 ? a : gcd(b, a % b);\n}\n\nint lcm(int a, int b)\n{\n\treturn a * (b / gcd(a, b));\n}\n\nint main()\n{\n\tlong long n, a, b, p, q, x, y, best;\n\tlong long result=0;\n\t\n\tscanf(\"%lld %lld %lld %lld %lld\", &n, &a, &b, &p, &q);\n\t\n\tx = n / a;\n\ty = n / b;\n\n\tbest = n / lcm(a, b);\n\t/*if (a > b && a%b == 0)\n\t{\n\t\tbest = n/a;\n\t}\n\telse if (b > a && b%a == 0)\n\t{\n\t\tbest = n/b;\n\t}*/\n\n\tif (p > q)\n\t{\n\t\tresult = (x*p) + ((y - best)*q);\n\t}\n\telse\n\t{\n\t\tresult = (y*q) + ((x - best)*p);\n\t}\n\n\tprintf(\"%lld\\n\", result);\n\n\treturn 0;\n}\n\n/* 1520882613945 */\n"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include \n\nint main()\n{\n\tint i;\n\tlong long n, a, b, p, q, x, y, best;\n\tlong long result=0;\n\t\n\tscanf(\"%lld\", &n);\n\tscanf(\"%lld\", &a);\n\tscanf(\"%lld\", &b);\n\tscanf(\"%lld\", &p);\n\tscanf(\"%lld\", &q);\n\n\tx = n / a;\n\ty = n / b;\n\n\tbest = n / (a*b);\n\tif (a > b && a%b == 0)\n\t{\n\t\tbest = a;\n\t}\n\telse if (b > a && b%a == 0)\n\t{\n\t\tbest = b;\n\t}\n\n\tif (p > q)\n\t{\n\t\tresult = (x*p) + ((y - best)*q);\n\t}\n\telse\n\t{\n\t\tresult = (y*q) + ((x - best)*p);\n\t}\n\n\tprintf(\"%lld\\n\", result);\n\n\treturn 0;\n}\n\n/* 1520870754018 */\n"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include \n\nint main()\n{\n\tint i;\n\tlong long n, a, b, p, q, x, y, best;\n\tlong long result=0;\n\t\n\tscanf(\"%lld\", &n);\n\tscanf(\"%lld\", &a);\n\tscanf(\"%lld\", &b);\n\tscanf(\"%lld\", &p);\n\tscanf(\"%lld\", &q);\n\n\tx = n / a;\n\ty = n / b;\n\n\tbest = n / (a*b);\n\tif (a > b && a%b == 0)\n\t{\n\t\tbest = n/a;\n\t}\n\telse if (b > a && b%a == 0)\n\t{\n\t\tbest = n/b;\n\t}\n\n\tif (p > q)\n\t{\n\t\tresult = (x*p) + ((y - best)*q);\n\t}\n\telse\n\t{\n\t\tresult = (y*q) + ((x - best)*p);\n\t}\n\n\tprintf(\"%lld\\n\", result);\n\n\treturn 0;\n}\n\n/* 1520870931810 */\n"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include \n\nint main()\n{\n\tint i;\n\tlong long n, a, b, p, q, x, y, best;\n\tlong long result=0;\n\t\n\tscanf(\"%lld\", &n);\n\tscanf(\"%lld\", &a);\n\tscanf(\"%lld\", &b);\n\tscanf(\"%lld\", &p);\n\tscanf(\"%lld\", &q);\n\n\tx = n / a;\n\ty = n / b;\n\tbest = n / (a*b);\n\n\tif (p > q)\n\t{\n\t\tresult = (x*p) + ((y - best)*q);\n\t}\n\telse\n\t{\n\t\tresult = (y*q) + ((x - best)*p);\n\t}\n\n\tprintf(\"%lld\\n\", result);\n\n\treturn 0;\n}\n\n/* 1520869611037 */\n"}, {"source_code": "#include \n#include \n\nlong long n, a, b, p, q, s;\n\nint main() {\n\tlong long i,c1,c2,c3;\n\ts = 0;\n\tscanf(\"%ld %ld %ld %ld %ld\", &n, &a, &b, &p, &q);\n\n\n\t/* for (i = 1; i <= n; i++) {\n\t\tif ((i%a == 0) && (i%b == 0)) {\n\t\t\tif (p > q) s = s + p;\n\t\t\telse s = s + q;\n\t\t}\n\t\telse if (i%a == 0) {\n\t\tc1++;\n\t\t\ts = s + p;\n\t\t}\n\t\telse if (i%b == 0) {\n\t\t\ts = s + q;\n\t\t}\n\t}*/ \n\n\tc1 = n / a;\n\tc2 = n / b;\n\tc3 = n / (a*b);\n\n\tif (c3) {\n\t\tif (p >= q) s = c1*p + (c2 - c3)*q;\n\t\telse s = (c1 - c3)*p + c2*q;\n\t}\n\telse s = c1*p + c2*q;\n\n\tprintf(\"%ld\", s);\n\n\treturn 0;\n}\n/* 1520862806006 */\n"}, {"source_code": "#include\n#include\n#include\n#include\n#include\n#define true 1\n#define false 0\n#define max(a,b) a>b?a:b\n#define min(a,b) a>b?b:a\n//SUPERMEAT BOY\n//JOTY AND CHOCOLATE\n\nint main()\n{\n int n,a,b,p,q,mtp;\n scanf(\"%d%d%d%d%d\",&n,&a,&b,&p,&q);\n mtp=min(p,q);\n printf(\"%d\",p*(n/a)+q*(n/b)-(mtp*(n/(a*b))));\n return 0;\n}\n\n"}, {"source_code": "#include\n#include\n#include\n#include\n#include\n#define true 1\n#define false 0\n#define max(a,b) a>b?a:b\n#define min(a,b) a>b?b:a\n//SUPERMEAT BOY\n//JOTY AND CHOCOLATE\nint gcd(int a, int b)\n{\n // base case\n if (a == b)\n return a;\n\n // a is greater\n if (a > b)\n return gcd(a-b, b);\n return gcd(a, b-a);\n}\n\n// Function to return LCM of two numbers\nint lcm(int a, int b)\n{\n return (a*b)/gcd(a, b);\n}\nint main()\n{\n int n,a,b,p,q,mtp;\n int lcm(int,int);\n int gcd(int ,int);\n\n scanf(\"%d%d%d%d%d\",&n,&a,&b,&p,&q);\n mtp=min(p,q);\n printf(\"%d\",p*(n/a)+q*(n/b)-(mtp*(n/(lcm(a,b)))));\n return 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\nlong long int n,a,b,p,q,i,sum=0;\nscanf(\"%lld%lld%lld%lld%lld\",&n,&a,&b,&p,&q);\nlong long int c;\nif(a>b)\nc=b;\nelse\nc=a;\nif(a==1 && b!=1)\nsum=sum+n*p;\nif(b==1 && a!=1)\nsum=sum+n*q;\nfor(i=c;i<=n;i++)\n{\nif(i%a==0 && i%b!=0 && a!=1)\nsum=sum+p;\nif(i%b==0 && i%a!=0 && b!=1)\nsum=sum+q;\nif(i%a==0 && i%b==0 && a!=1 && b!=1)\n{\nif(a>b)\nsum=sum+p;\nelse\nsum=sum+q;\n}\n}\nprintf(\"%lld\\n\",sum);\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\nlong long int n,a,b,p,q,i,sum=0;\nscanf(\"%lld%lld%lld%lld%lld\",&n,&a,&b,&p,&q);\nif(n==1)\n{\nif(a==1 && b!=1)\nsum=sum+p;\nif(b==1 && a!=1)\nsum=sum+q;\nif(a==1 && b==1)\n{\nif(p>q)\nsum=sum+p;\nelse\nsum=sum+q;\n}\n}\nlong long int c;\nif(a>b)\nc=b;\nelse\nc=a;\nif(a==1 && b!=1)\nsum=sum+n*p;\nif(b==1 && a!=1)\nsum=sum+n*q;\nfor(i=c;i<=n;i++)\n{\nif(i%a==0 && i%b!=0 && a!=1)\nsum=sum+p;\nif(i%b==0 && i%a!=0 && b!=1)\nsum=sum+q;\nif(i%a==0 && i%b==0 && a!=1 && b!=1)\n{\nif(p>q)\nsum=sum+p;\nelse\nsum=sum+q;\n}\n}\nprintf(\"%lld\\n\",sum);\nreturn 0;\n}\n"}, {"source_code": "#include \n#ifndef _TJYTLXWXHYZQFW_COMMON_H\n#define _TJYTLXWXHYZQFW_COMMON_H\n#include \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 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 max(x,y) ((x) < (y) ? (y) : (x))\n#define min(x, y) ((x) < (y) ? (x) : (y))\n#define abv(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\nint main(void)\n{\n\tlong long n, a, b, p, q;\n\tscanf(\"%lld%lld%lld%lld%lld\", &n, &a, &b, &p, &q);\n\tprintf(\"%lld\\n\", (n / a) * p + (n / b) * q - n / (a * b) * min(p, q));\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n long long int n, a, b, p, q, red, blue, mixed;\n scanf(\"%I64d%I64d%I64d%I64d%I64d\",&n,&a,&b,&p,&q);\n mixed = n/(a*b);\n red = n/a;\n blue = n/b;\n if(p > q){\n printf(\"%I64d\",((red*p)+(blue-mixed)*q));\n }\n else {\n printf(\"%I64d\",((blue*q)+(red-mixed)*p));\n }\n return 0;\n\n}"}, {"source_code": "#include\nint main(){\n\tint i,n,a,b,p,q,max;\n\tlong long int ans;\n\twhile(~scanf(\"%d%d%d%d%d\",&n,&a,&b,&p,&q)){\n\t\tans=0;\n\t\tif(q>=p){\n\t\t\tans+=n/b*q;\n\t\t\tfor(i=a;i<=n;i+=a)\n\t\t\t\tif(i%b!=0)\n\t\t\t\t\tans+=p;\n\t\t}\n\t\telse{\n\t\t\tans+=n/a*p;\n\t\t\tfor(i=b;i<=n;i+=b)\n\t\t\t\tif(i%a!=0)\n\t\t\t\t\tans+=q;\n\t\t}\n\t\tprintf(\"%d\\n\",ans);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\nint gongbeishu(int a,int b){\n\tint t,aa=a,bb=b;\n\tif(a=p){\n\t\t\tans+=n/b*q;\n\t\t\tif(a!=b){\n\t\t\t\tans+=n/a*p;\n\t\t\t\ti=gongbeishu(a,b); \n\t\t\t\tans-=n/i*p;\n\t\t\t} \n\t\t}\n\t\telse{\n\t\t\tans+=n/a*p;\n\t\t\tif(a!=b){\n\t\t\t\tans+=n/b*q;\n\t\t\t\ti=gongbeishu(a,b);\n\t\t\t\tans-=n/i*q;\n\t\t\t}\n\t\t}\n\t\tprintf(\"%I64d\\n\",ans);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main(){\n\tint i,n,a,b,p,q,max;\n\tlong long int ans;\n\twhile(~scanf(\"%d%d%d%d%d\",&n,&a,&b,&p,&q)){\n\t\tans=0;\n\t\tif(q>=p){\n\t\t\tans+=n/b*q;\n\t\t\tfor(i=a;i<=n;i+=a)\n\t\t\t\tif(i%b!=0)\n\t\t\t\t\tans+=p;\n\t\t}\n\t\telse{\n\t\t\tans+=n/a*p;\n\t\t\tfor(i=b;i<=n;i+=b)\n\t\t\t\tif(i%a!=0)\n\t\t\t\t\tans+=q;\n\t\t}\n\t\tprintf(\"%ld\\n\",ans);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main(){\n\tint i,n,a,b,p,q,max;\n\tlong long int ans;\n\twhile(~scanf(\"%d%d%d%d%d\",&n,&a,&b,&p,&q)){\n\t\tans=0;\n\t\tif(q>=p){\n\t\t\tans+=n/b*q;\n\t\t\tfor(i=a;i<=n;i+=a)\n\t\t\t\tif(i%b!=0)\n\t\t\t\t\tans+=p;\n\t\t}\n\t\telse{\n\t\t\tans+=n/a*p;\n\t\t\tfor(i=b;i<=n;i+=b)\n\t\t\t\tif(i%a!=0)\n\t\t\t\t\tans+=q;\n\t\t}\n\t\tprintf(\"%l64d\\n\",ans);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main(){\n\tint i,n,a,b,p,q,max;\n\tlong long int ans;\n\twhile(~scanf(\"%d%d%d%d%d\",&n,&a,&b,&p,&q)){\n\t\tans=0;\n\t\tif(q>=p){\n\t\t\tans+=n/b*q;\n\t\t\tfor(i=a;i<=n;i+=a)\n\t\t\t\tif(i%b!=0)\n\t\t\t\t\tans+=p;\n\t\t}\n\t\telse{\n\t\t\tans+=n/a*p;\n\t\t\tfor(i=b;i<=n;i+=b)\n\t\t\t\tif(i%a!=0)\n\t\t\t\t\tans+=q;\n\t\t}\n\t\tprintf(\"%I64d\\n\",ans);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int64_t n,a,b,p,q,c,d,i,sum;\n while(scanf(\"%I64d %I64d %I64d %I64d %I64d\",&n,&a,&b,&p,&q)==5){\n sum=0;\n if(p>q||p==q){\n c=n/a;\n sum=c*p;\n if(a>b){\n for(i=a*2;ib){\n for(i=a*2;i\n#include\nint main()\n{\n int64_t n,a,b,p,q,c,d,i,sum;\n while(scanf(\"%I64d %I64d %I64d %I64d %I64d\",&n,&a,&b,&p,&q)==5){\n sum=0;\n if(p>q||p==q){\n c=n/a;\n sum=c*p;\n if(a>b){\n for(i=a*2;ib){\n for(i=a*2;i\n#include\nint main()\n{\n int64_t n,a,b,p,q,c,d,i,sum;\n while(scanf(\"%I64d %I64d %I64d %I64d %I64d\",&n,&a,&b,&p,&q)==5){\n sum=0;\n if(p>q){\n c=n/a;\n sum=c*p;\n for(i=b;i\nint main()\n{\n long long n,i,a,b,p,q,sum=0;\n scanf(\"%I64d%I64d%I64d%I64d%I64d\",&n,&a,&b,&p,&q);\n for(i=1;i<=n;i++)\n {\n if(i%a==0)\n sum=sum+p;\n else if(i%b==0)\n sum=sum+q;\n }\n printf(\"%I64d\",sum);\n return 0;\n}\n\n"}], "src_uid": "35d8a9f0d5b5ab22929ec050b55ec769"} {"nl": {"description": "Consider the following equation: where sign [a] represents the integer part of number a.Let's find all integer z (z > 0), for which this equation is unsolvable in positive integers. The phrase \"unsolvable in positive integers\" means that there are no such positive integers x and y (x, y > 0), for which the given above equation holds.Let's write out all such z in the increasing order: z1, z2, z3, and so on (zi < zi + 1). Your task is: given the number n, find the number zn.", "input_spec": "The first line contains a single integer n (1 ≤ n ≤ 40).", "output_spec": "Print a single integer — the number zn modulo 1000000007 (109 + 7). It is guaranteed that the answer exists.", "sample_inputs": ["1", "2", "3"], "sample_outputs": ["1", "3", "15"], "notes": null}, "positive_code": [{"source_code": "#include \n\nint main()\n{\n int n, m = 1000000007, x = 1, i;\n int a[40] = {1, 2, 4, 6, 12, 16, 18, 30, 60, 88, 106, 126, 520, 606, 1278, 2202, 2280, 3216, 4252, 4422, 9688, 9940, 11212, 19936, 21700, 23208, 44496, 86242, 110502, 132048, 216090, 756838, 859432, 1257786, 1398268, 2976220, 3021376, 6972592, 13466916, 20996010};\n \n scanf(\"%d\", &n);\n \n for (i = 1; i <= a[n - 1]; i++) x = x * 2 % m;\n \n printf(\"%d\\n\", (x - 1 + m) % m);\n \n return 0;\n}\n"}, {"source_code": "#include\n#define m 1000000007\nlong long int power(long long int x,long long int y)\n { long long int p;\n if(y==1)\n return(x%m);\n else\n {p=power(x,y/2)%m;\n if(y%2==0)\n return((p*p)%m);\n else\n return((x*p*p)%m);}\n }\nint main()\n{\n long long int n,a[40] = {1, 2, 4, 6, 12, 16, 18, 30, 60, 88, 106, 126, 520, 606, 1278, 2202, 2280, 3216, 4252, 4422, 9688, 9940, 11212, 19936, 21700, 23208, 44496, 86242, 110502, 132048, 216090, 756838, 859432, 1257786, 1398268, 2976220, 3021376, 6972592, 13466916, 20996010};\nlong long int r;\nscanf(\"%I64d\",&n);\nr=power(2,a[n-1]);\nprintf(\"%I64d\",r-1);\nreturn 0;\n}\n"}], "negative_code": [], "src_uid": "c2cbc35012c6ff7ab0d6899e6015e4e7"} {"nl": {"description": "One hot summer day Pete and his friend Billy decided to buy a watermelon. They chose the biggest and the ripest one, in their opinion. After that the watermelon was weighed, and the scales showed w kilos. They rushed home, dying of thirst, and decided to divide the berry, however they faced a hard problem.Pete and Billy are great fans of even numbers, that's why they want to divide the watermelon in such a way that each of the two parts weighs even number of kilos, at the same time it is not obligatory that the parts are equal. The boys are extremely tired and want to start their meal as soon as possible, that's why you should help them and find out, if they can divide the watermelon in the way they want. For sure, each of them should get a part of positive weight.", "input_spec": "The first (and the only) input line contains integer number w (1 ≤ w ≤ 100) — the weight of the watermelon bought by the boys.", "output_spec": "Print YES, if the boys can divide the watermelon into two parts, each of them weighing even number of kilos; and NO in the opposite case.", "sample_inputs": ["8"], "sample_outputs": ["YES"], "notes": "NoteFor example, the boys can divide the watermelon into two parts of 2 and 6 kilos respectively (another variant — two parts of 4 and 4 kilos)."}, "positive_code": [{"source_code": "#include\nint main()\n{\nint a;\nscanf(\"%d\",&a);\n\nif(a%2==0 && a!=2)\n printf(\"YES\");\n\nelse\n\n printf(\"NO\");\nreturn 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n int w;\n scanf(\"%d\", &w);\n if ((w >= 1) && (w <= 100)) {\n if ((w % 2 == 0) && (w != 2)) {\n printf(\"YES\");\n } else {\n printf(\"NO\");\n }\n }\n return 0;\n}\n\n/* 1506128386335 */\n"}, {"source_code": "#include \nint main(){ \nint w; \nscanf(\"%d\",&w);\nif (w>2 && w%2==0) \n printf(\"YES\");\nelse \n printf(\"NO\");\n}"}, {"source_code": "#include\n\n\nint main(){\nint w;\nscanf(\"%d\", &w);\n\n if(((w%2)==0)&&(w>2)){\n printf(\"YES\");\n }\n else\n printf(\"NO\");\n\n\nreturn 0;\n\n}\n/* 1506180209660 */\n"}, {"source_code": "#include\nint main()\n{\n int w;\n scanf(\"%d\",&w);\n if(w==2)\n printf(\"NO\");\n else if(w%2==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int w,a,b,d,c;\n scanf(\"%d\",&w);\n if(w==2)\n printf(\"no\");\n if(w<=100 && w>=1 &&w!=2)\n {\n if(w%2==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n }\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(){\n\tint w;\n\n\tscanf(\"%d\", &w);\n\n\tif(w%2==0 && w != 2) printf(\"YES\\n\");\t\n\telse printf(\"NO\\n\");\n\n\n\treturn 0;\n}\n/* 1506037327920 */\n"}, {"source_code": "#include\n\nint main()\n{int w;\nlong long i=0;\nfor(;i<1000000000000;i++){\n \n}\nscanf(\"%d\",&w);\nif(w<=2)\nprintf(\"no\");\nelse if(w%2==0)\n printf(\"YES\");\n else \n \tprintf(\"NO\");\n \treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int w;\n scanf(\"%d\",&w);\n if(w%2!=0 || w<=2)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int k;\n scanf(\"%d\",&k);\n if(k>2&&(k%2==0))\n printf(\"YES\");\n else \n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include \nint main()\n{ int weight;\n scanf(\"%d\",&weight);\n if(weight==2)\n {\n printf(\"No\");\n }\n else if(weight%2==0)\n {\n printf(\"Yes\");\n }\n else{\n printf(\"No\");\n }\n return 0;\n}"}, {"source_code": " \n#include\nint main()\n{\n\tint w;\n\tscanf(\"%d\",&w);\n\tif(w%2==0&&w!=2)\n\tprintf(\"YES\");\n\telse\n\tprintf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int w;\n scanf(\"%d\",&w);\n if(w>2&&w%2==0){\n printf(\"YES\");}\n else{\n printf(\"NO\");}\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int w;\n scanf(\"%d\",&w);\n\n if(w<=2||w%2==1)\n {printf(\"NO\\n\");}\n else\n {printf(\"YES\\n\");}\n return 0;\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int w,i,a,b;\n scanf(\"%d\",&w);\n if(w>0&&w%2==0&&w!=2)\n {\n printf(\"YES\\n\");\n }\n\n \n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n#include\n\nint main()\n{\n int weight; \n \n scanf(\"%d\", &weight);\n \n if ( weight >= 1 && weight <=100){\n double parts = (double) weight /2;\n \n int remain = weight - 2;\n \n if ( remain >= 2 && remain % 2 == 0 )\n \n printf(\"Yes\\n\");\n \n else \n \n printf(\"No\\n\");\n }\n \n \n \n return 0;\n}"}, {"source_code": "#include\n\nint main(){\n \n int n;\n scanf(\"%d\", &n);\n if(n <= 2 || n%2 != 0){\n printf(\"NO\\n\");\n }\n else{\n printf(\"YES\\n\");\n }\n \n return 0;\n}"}, {"source_code": "#include \nint main()\n{\n\tint w,i;\n\tscanf(\"%d\",&w);\n\tif(w<=100&&w>=1)\n\t{\n\t\tif(w>2){\n\t\ti = w%2;\n\t\tif(i==0)\n\t\t{\n\t\t\tprintf(\"YES\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"NO\");\n\t\t}\n\t\t}\n\t\telse\n\t\t{printf(\"NO\");}\n\t}\n\telse\n\t{\n\t\tprintf(\"insufficient value\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int w,a,b;\n scanf(\"%d\",&w);\nfor(a=1;a<=w;a++)\n {\n b=w-a;\n\n }\n\n if( b%2==0 && a%2==0)\n {\n printf(\"NO\");\n }\n else if(w==2)\n {printf(\"NO\");}\n else printf(\"YES\");\n\n\n\n return 0;\n}\n\n\n\n\n"}, {"source_code": "\n #include\nmain()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n \n if(n!=2 && (n)%2==0)\n {\n printf(\"YES\"); \n }\n \n else{\n printf(\"NO\");\n }\n}"}, {"source_code": "#include///Accepted\nint main()\n{\n int n,a,b;\n\n scanf(\"%d\",&n);\n if(n%2==0&&n>2){\n a=b=n/2;\n if(a%2==0&&b%2==0)\n printf(\"YES\\n\");\n else if(a%2!=0&&b%2!=0){\n a=a-1;\n b=b+1;\n if(a%2==0&&b%2==0)\n printf(\"Yes\\n\");\n }\n }\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\nint w;\nscanf(\"%d\",&w);\nif(w%2==0 && w>2)\n{\nprintf(\"YES\\n\");\n}\nelse\n{\nprintf(\"NO\\n\");\n}\nreturn 0;\n}\n"}, {"source_code": "#include\n\nint main(){\n \n int n;\n scanf(\"%d\", &n);\n if(n <= 2 || n%2 != 0){\n printf(\"NO\\n\");\n }\n else{\n printf(\"YES\\n\");\n }\n \n return 0;\n}"}, {"source_code": "#include \nint main(){ \nint w; \nscanf(\"%d\",&w);\nif (w>2 && w%2==0) \n printf(\"YES\");\nelse \n printf(\"NO\");\n}"}, {"source_code": "#include\nint main(){\n int n;\n scanf(\"%d\",&n);\n if(n%2==0&&n!=2){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include \nint main()\n{\n int a;\n scanf(\"%d\", &a);\n if ((a%2== 0) && (a != 2))\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n return 0;\n}\n/* 1491910438635 */\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int w;\n scanf(\"%d\",&w);\n if(w%2==0 && w!=2 && w!=1)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n int w;\n scanf(\"%d\",&w);\n if(w==0||w==2)\n printf(\"NO\");\n else{\n if(w%2==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n\tint num;\n\tscanf(\"%d\", &num);\n\n\tif (num > 2 && (num % 2) == 0 )\n\t{\n\t\tputs(\"YES\");\n\t}\n\telse\n\t\tputs(\"NO\");\n\n}\n/* 1523934934469 */\n"}, {"source_code": "#include\n#include\n \n int main()\n {\n int n;\n scanf(\"%d\",&n);\n \n if(n>2 && n<101 && n%2==0){\n printf(\"YES\");\n }\n \n else if((n==2)||(n>0 && n<101 && n%2!=0)){\n printf(\"NO\");\n }\n \n \n return 0;\n }"}, {"source_code": "#include\n int main()\n {\n int w;\n scanf(\"%d\",&w);\n if(w%2==0 && w>2)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n }\n"}, {"source_code": "#include \nint main()\n{\n int weigh;\n scanf(\"%d\", &weigh);\n int i = 2;\n int count = 0;\n while( i <= 100 )\n {\n if( ( weigh - i )% 2 == 0 && weigh != 2 )\n {\n printf(\"YES\");\n count = 1;\n break;\n }\n \n i = i + 2;\n }\n if( count == 0 )\n {\n printf(\"NO\");\n }\n \n}"}, {"source_code": "#include \nint main ()\n{\n int W;\n scanf(\"%d\", &W);\n if((W % 2 == 0) && (W >2))\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n return 0;\n}\n\n/* 1491395614743 */\n"}, {"source_code": "#include \nint main (){\nint a;\nscanf (\"%d\", &a);\nif (a==2){\n printf (\"NO\\n\");\n}\nelse{\nif (a%2 != 0){\n printf (\"NO\\n\");\n}\nelse {\n printf (\"YES\\n\");\n}\n}\nreturn 0;\n}\n\n/* 1491338037802 */\n"}, {"source_code": "#include \n\nint main() {\n int w;\n\tscanf(\"%d\", &w);\n if(w <= 2 || w%2 != 0){\n printf(\"NO\");\n } else {\n printf(\"YES\");\n }\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int w;\n scanf(\"%d\", &w);\n if(w % 2 ==0 && w>2 ){\n printf(\"YES\\n\");\n }\n else{\n printf(\"NO\\n\");\n }\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int w;\n scanf(\"%d\",&w);\n if(w==2)\n printf(\"NO\");\n else if(w%2==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include \n\nint main(){\n\n int w,a;\n scanf(\"%d\", &w);\n\n if(w%2==0){\n if(w==2)\n printf(\"NO\\n\");\n else ( printf(\"YES\\n\") );\n }\n\n else ( printf(\"NO\\n\") );\n\n\n return 0;\n}\n\n/* 1491694425232 */\n"}, {"source_code": "#include\nint main()\n{\n int w;\n\n scanf(\"%d\",&w);\n if(w>2){\n if(w%2==0)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\nelse\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include \nint main(void)\n{\nint w;\nscanf(\"%d\\n\",&w);\nif(w>2){\nif(w%2==0){\nprintf(\"YES\\n\");\n}\nelse{\nprintf(\"NO\\n\");\n}\n}\nelse{printf(\"NO\\n\");}\n}"}, {"source_code": "#include\nint main()\n{\n int w;\n\n scanf(\"%d\",&w);\n if(w>2){\n if(w%2==0)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\nelse\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n int w;\n scanf(\"%d\", &w);\n if (w % 2 == 0 && w != 2)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n return 0;\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/* 1491694402966 */\n"}, {"source_code": "#include \nint main(){\n int w;\n scanf(\"%d\", &w);\n if(w == 2) printf(\"no\");\n else if(!(w % 2))\n printf(\"yes\");\n else\n printf(\"no\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\n\nint main() {\n int w;\n scanf (\"%d\",&w);\n if ((w%2!=0)||(w==2))\n {\n printf(\"NO\");\n }\n else\n {\n printf(\"YES\");\n }\n\n return (EXIT_SUCCESS);\n}"}, {"source_code": "#include \nint main ()\n{\n int w;\n scanf (\"%d\", &w);\n if ((w % 2 == 0) && (w > 2))\n {\n printf (\"YES\\n\");\n }\n else\n {\n printf (\"NO\\n\");\n }\n\nreturn 0;\n}\n\n/* 1491921696192 */\n"}, {"source_code": "#include \n\nint main()\n{\n int w;\n scanf(\"%d\",&w);\n if((w%2==0)&&(w>2))\n {\n printf(\"YES\");\n }\n else printf(\"NO\");\nreturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int a;\n scanf(\"%d\",&a);\n if (a%2==0&&a!=2)\n printf(\"YES\");\n else\n printf( \"NO\");\n return 0;\n}\n"}, {"source_code": "#include\n\nint main(){\n\tint w;\n scanf(\"%d\",&w);\n if(w==2)\n printf(\"NO\");\n else if(w%2==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n \treturn 0;\n}\n\n/* 1534604185268 */\n"}, {"source_code": "#include \n#include ;\nmain()\n{\n int w;\n scanf(\"%d\",&w);\n\n if(1<= w && w <=100)\n\n {\n if(w%2==0 && w!=2)\n \n printf(\"yes\");\n\n\n \n else\n printf(\"no\");}\n else\n printf(\"error\");\n\n\n}"}, {"source_code": "#include\nint main(void)\n{\nint w;\nscanf(\"%d\",&w);\nif(w==2)\nprintf(\"NO\");\nelse if(1<=w && w<=100)\n{\n if(w%2==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n}\nreturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int w;\n while(scanf(\"%d\",&w)==1)\n {\n if(w>2&&w%2==0)\n {\n printf(\"YES\");\n }\n else\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int w;\n scanf(\"%d\",&w);\n if(w>=1 || w<=100)\n {\n if(w==2)\n {\n printf(\"NO\");\n }\n else if(w%2==0)\n \n { \n printf(\"YES\");\n }\n else \n {\n printf(\"no\");\n }\n }\n}\n"}, {"source_code": "#include \nint main()\n{ int weight;\n scanf(\"%d\",&weight);\n if(weight==2)\n {\n printf(\"No\");\n }\n else if(weight%2==0)\n {\n printf(\"Yes\");\n }\n else{\n printf(\"No\");\n }\n return 0;\n}"}, {"source_code": "#include\n\nint main()\n{int w;\nlong long i=0;\nfor(;i<1000000000000;i++){\n \n}\nscanf(\"%d\",&w);\nif(w<=2)\nprintf(\"no\");\nelse if(w%2==0)\n printf(\"YES\");\n else \n \tprintf(\"NO\");\n \treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n;\n\n scanf(\"%d\",&n);\n\n if(n>2&&n%2==0)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(){\n int a;\n\n scanf(\"%d\", &a);\n\n if(a%2 == 0 && a > 2){\n printf(\"YES\\n\");\n }else{\n printf(\"NO\\n\");\n }\n\n return 0;\n}\n\n\n\n/* 1490975184008 */\n"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n if (n%2!= 0)\n printf(\"NO\\n\");\n else\n {\n if (n<=2)\n printf(\"NO\\n\");\n else \n printf(\"YES\\n\");\n }\n\n return 0;\n}"}, {"source_code": "#include \nint main ()\n{\n int w;\n scanf (\"%d\", &w);\n if ((w % 2 == 0) && (w > 2))\n {\n printf (\"YES\\n\");\n }\n else\n {\n printf (\"NO\\n\");\n }\n\nreturn 0;\n}\n\n/* 1491921696192 */\n"}, {"source_code": "#include \n\nint main(){\n\tint w;\n\n\tscanf(\"%d\", &w);\n\n\tif(w%2==0 && w != 2) printf(\"YES\\n\");\t\n\telse printf(\"NO\\n\");\n\n\n\treturn 0;\n}\n/* 1506037327920 */\n"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n%2==0&&n>=4)\n {\n printf(\"YES\\n\");\n }else if(n<=2||n%2!=0)\n {\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main(){\n\n int n;\n scanf(\"%d\", &n);\n if(n <= 2 || n%2 != 0){\n printf(\"NO\\n\");\n }\n else{\n printf(\"YES\\n\");\n }\n\n return 0;\n}\n\n"}, {"source_code": "#include\nint main(void)\n{\nint w;\nscanf(\"%d\",&w);\nif(w==2)\nprintf(\"NO\");\nelse if(1<=w && w<=100)\n{\n if(w%2==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n}\nreturn 0;\n}"}, {"source_code": "#include \n\nint main(){\n\n int w,a;\n scanf(\"%d\", &w);\n\n if(w%2==0){\n if(w==2)\n printf(\"NO\\n\");\n else ( printf(\"YES\\n\") );\n }\n\n else ( printf(\"NO\\n\") );\n\n\n return 0;\n}\n\n/* 1491694425232 */\n"}, {"source_code": "#include \n\nint main()\n{\n\tint W;\n\tscanf(\"%d\", &W);\n\tif(W>2 && W%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\n\nint main()\n{int w;\nlong long i=0;\nfor(;i<1000000000000;i++){\n \n}\nscanf(\"%d\",&w);\nif(w<=2)\nprintf(\"no\");\nelse if(w%2==0)\n printf(\"YES\");\n else \n \tprintf(\"NO\");\n \treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int w;\n scanf(\"%d\",&w);\n if(w>2 && w%2==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include \nint main(){\n\tint w;\n\tscanf(\"%i\", &w);\n\tif( w <= 2 || w%2 != 0){\n\t\tprintf(\"NO\");\n\t}\n\telse{\n\t\tprintf(\"YES\");\n\t}\n\treturn 0;\n}\n\n/* 1505940185180 */\n"}, {"source_code": "#include\nint main()\n{\n int w;\n scanf(\"%d\",&w);\n if(w==2)\n printf(\"NO\");\n else if(w%2==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include \nint main() {\n int n;\n scanf(\"%d\", &n);\n if(n>2 && n % 2 == 0)\n printf(\"YES\");\n else\n printf(\"NO\");\n \n return 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n int w;\n\n scanf(\"%d\", &w);\n\n if((w%2 == 0)&&(w>=4))\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n\n return 0;\n}\n\n/* 1491613415042 */\n"}, {"source_code": "#include \n\nint main()\n{\n int w, i;\n scanf(\"%d\", &w);\n\n for(i=2; i\n#include\nint main ()\n{\n int w;\n scanf(\"%d\", &w);\n if (((w%2)==0) && (w != 2))\n {\n printf(\"YES\\n\");\n }else{\n printf(\"NO\\n\");\n }\n\n return 0;\n}\n\n/* 1491694440230 */\n"}, {"source_code": "#include\nint main()\n{\n int w;\n scanf(\"%d\",&w);\n if(w>=1&&w<=100)\n {\n if(w%2==0 && w!=2)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n }\n\n return 0;\n}"}, {"source_code": "#include \nint main()\n{\n int w;\n scanf(\"%d\",&w);\n if(w>2 && w % 2 == 0 && w<=100)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int a, b, c;\n\n scanf(\"%d\", &a);\n\n if(a>=0 && a<=100){\n if(a==2)\n {\n printf(\"NO\");\n }\n else if(a%2== 0){printf(\"YES\");}\n else{printf(\"NO\");}\n }\n return 0;\n}\n\n"}, {"source_code": "#include \n\nint main() {\n int w;\n scanf(\"%d\", &w);\n if ((w >= 1) && (w <= 100)) {\n if ((w % 2 == 0) && (w != 2)) {\n printf(\"YES\");\n } else {\n printf(\"NO\");\n }\n }\n return 0;\n}\n\n/* 1506128386335 */\n"}, {"source_code": "#include \n#include \n#include \n#include \n#include\n\n\nint main() {\n\nint weight ;\n\n\nscanf(\" %d\" , &weight) ;\n if(weight%2 == 0 && weight != 2)\n {\n printf(\"Yes \\n\");\n }\n else printf(\"NO \\n\");\n return 0;\n}"}, {"source_code": "//\n// main.c\n// A\n//\n// Created by Samuel Souza on 21/09/17.\n// Copyright © 2017 Samuel Souza. All rights reserved.\n//\n\n#include \n\nint main(int argc, const char * argv[]) {\n \n \n int kg = 0, status = 0;\n \n scanf(\"%d\", &kg);\n \n for(int i=1;i\nint main(void)\n{\n\tint w;\n\tscanf(\"%d\", &w);\n\tint a;\n\ta = w/ 2;\n\tif (w < 3)\n\t\tprintf(\"No\\n\");\n\telse if (w > 3 && w % 2 == 0)\n\t\tprintf(\"Yes\\n\");\n\telse\n\t\tprintf(\"No\\n\");\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint main ()\n{\n int w;\n scanf(\"%d\", &w);\n if (((w%2)==0) && (w != 2))\n {\n printf(\"YES\\n\");\n }else{\n printf(\"NO\\n\");\n }\n\n return 0;\n}\n\n/* 1491694427230 */\n"}, {"source_code": "#include\n\nint main()\n{\n int x;\n scanf (\"%d\", &x);\n \n if(x%2==0 && x>2)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n} "}, {"source_code": "#include \n\nint main()\n{\n int w;\n scanf(\"%d\",&w);\n if((w%2==0)&&(w>2))\n {\n printf(\"YES\");\n }\n else printf(\"NO\");\nreturn 0;\n}\n"}, {"source_code": "#include\n\nint main(){\n \n int n;\n scanf(\"%d\", &n);\n if(n <= 2 || n%2 != 0){\n printf(\"NO\\n\");\n }\n else{\n printf(\"YES\\n\");\n }\n \n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int x;\n scanf(\"%d\",&x);\n if(x%2==0&&x>2)\n\n printf(\"YES\");\n\n else\n printf(\"NO\");\n\n}\n"}, {"source_code": "#include \nint main ()\n{\n int w;\n scanf(\"%d\", &w);\n if(w%2==0 && w!=2){\n printf(\"yes\",w);\n }\n else{\n printf(\"no\",w);\n }\n return 0;\n}"}, {"source_code": "#include\n\nint main(){\n \n int n;\n scanf(\"%d\", &n);\n if(n <= 2 || n%2 != 0){\n printf(\"NO\\n\");\n }\n else{\n printf(\"YES\\n\");\n }\n \n return 0;\n}"}, {"source_code": "//\n// main.c\n// A\n//\n// Created by Samuel Souza on 21/09/17.\n// Copyright © 2017 Samuel Souza. All rights reserved.\n//\n\n#include \n\nint main(int argc, const char * argv[]) {\n \n \n int kg = 0, status = 0;\n \n scanf(\"%d\", &kg);\n \n for(int i=1;i\nint main()\n{\n int w;\n scanf(\"%d\",&w);\n if(w>=1&&w<=100)\n {\n if(w%2==0 && w!=2)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n }\n\n return 0;\n}"}, {"source_code": "#include \n\nint main ()\n{\n int W;\n scanf (\"%d\", &W);\n if ((W % 2 == 0) && (W > 2))\n {\n\n printf (\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n\n return 0;\n}\n\n/* 1491875304776 */\n"}, {"source_code": "#include \nint main(){\n\tint w;\n\tscanf(\"%i\", &w);\n\tif( w <= 2 || w%2 != 0){\n\t\tprintf(\"NO\");\n\t}\n\telse{\n\t\tprintf(\"YES\");\n\t}\n\treturn 0;\n}\n\n/* 1505940185180 */\n"}, {"source_code": "#include \nint main () {\n int a,b;\n \n scanf(\"%d\",&a);\n b=a%2;\n \n \n if(b==1){\n printf(\"NO\");\n return 0;\n }\n if(a==2){\n printf(\"NO\");\n } \n else\n {\n printf(\"YES\");\n \n } \n \n \n return 0;\n}"}, {"source_code": "#include \n\nint main() {\n int w, i=2, ind=0;\n\tscanf(\"%d\", &w);\n if(w <= 2 || w%2 != 0){\n printf(\"NO\");\n } else {\n printf(\"YES\");\n }\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n int w;\n scanf (\"%d\",&w);\n if(w!=2 && w%2==0)\n printf(\"YES\\n\");\n else{\n printf(\"NO\\n\");}\n return 0;\n}\n/* 1491891267270 */\n"}, {"source_code": "#include\n\nmain()\n{\n\tint x;\n\tscanf(\"%d\",&x);\n\tif(x>2&&x%2==0)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\treturn 0;\n} "}, {"source_code": "#include\n\nint main()\n{int w;\nlong long i=0;\nfor(;i<1000000000000;i++){\n \n}\nscanf(\"%d\",&w);\nif(w<=2)\nprintf(\"no\");\nelse if(w%2==0)\n printf(\"YES\");\n else \n \tprintf(\"NO\");\n \treturn 0;\n}"}, {"source_code": "#include\nint main( ){\nint k;\nscanf(\"%d\",&k);\nif(k%2==0&&k>2){\n printf(\"yes\");\n}\nelse\nprintf(\"no\");\nreturn 0;\n}"}, {"source_code": "#include\nint main(void)\n{\n\tshort int w;\n\tscanf(\"%d\", &w);\n//\tprintf(\"w1\")\n\tif (w % 2 == 0 && w > 2 )// && w2 % 2 == 0)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\treturn 0;\n}"}, {"source_code": "#include \nint main() {\n int num;\n scanf(\"%d\", &num);\n if(num>2 && num % 2 == 0)\n printf(\"YES\");\n else\n printf(\"NO\");\n \n return 0;\n}"}, {"source_code": "#include\nint main(){\n \n int w;\n scanf(\"%d\",&w);\n \n \n \n if(w>=4&&w%2==0) printf(\"Yes\");\n else printf(\"No\");\n \n \n \n return 0;\n \n}"}], "negative_code": [{"source_code": "#include\n\nint main()\n{\n int w;\n scanf(\"%d\", &w);\n if(w%2 == 0)\n {\n w-=2;\n if(w%2==0)\n printf(\"YES\");\n }\n else\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include\nint main()\n{ int w;\nscanf(\"%d\",&w);\nif(w%2==0)\nprintf(\"YES\\n\");\nelse\nprintf(\"NO\\n\");\nreturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int w;\n printf(\"Weight:\");\n scanf(\"%d\",&w);\n if(w%2==0&&w>2)\n printf(\"Yes\");\n else\n printf(\"No\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main(){\n\tint a;\n\tscanf(\"%d\",&a);\n\tif(a%2==0) printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}\n/* 1513874669286 */\n"}, {"source_code": "#include \n\nint main()\n{\n int w;\n scanf(\"%d\",&w);\n if(w%2==0 && w<=100 && w>=1)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n return 0;\n\n}\n"}, {"source_code": "#include\nmain()\n{\n printf(\"the weight of the watermelon\\n\");\n int w;\n scanf(\"%d\",&w);\n \n if(w%2==0)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n}"}, {"source_code": "#include \nint main(){ \n int w;\n for(w=1;w<=100;w++){\n if(w%2==0){ \n printf(\"YES\");}\n else printf(\"NO\"); }\n return 0;\n }\n \n \n \n "}, {"source_code": "#include\nint main()\n{\n int n,b,a,w;\n scanf(\"%d\",&w);\n for(n=1;n<=(w/2);n++)\n {\n a=w-2*n;\n b=2*1;\n if((a+b)==w)\n {\n printf(\"yes\");\n break;\n }\n printf(\"no\");\n }\n}\n"}, {"source_code": "#include\nvoid main()\n{\n int a,q;\n scanf(\"%d\",&a);\n if(a<=2){\n printf(\"NO\\n\");\n }\n else if(a%2==0){\n q=a/2;\n if(q%2==0){\n printf(\"YES\\n\");\n }\n else{\n printf(\"NO\\n\");\n }\n }\n else{\n printf(\"NO\\n\");\n }\nreturn 0;}\n"}, {"source_code": "#include\nint main()\n{\n int x;\n printf(\"give the weight\");\n scanf(\"%d\",&x);\n if(x>=1 && x<=100)\n {\n if(x==2 && x==4){\n printf(\" \\n no\");\n }\n if(x%2==0){\n printf(\"\\n yes\");\n }\n else\n {\n printf(\"\\n no\");\n }\n }\n return 0;\n}"}, {"source_code": "#include\nint main(void) {\n int w,a,b;;\n scanf(\"%d\",&w);\n if(w%2==0){\n \ta=w/2;\n \tb=w/2;\n if((a%2==0)&(b%2==0)){\n \tprintf(\"YES\");\n }\n}\n}"}, {"source_code": "#include \n#include \n\nint w;\nint b;\nint c;\nint main(){\nprintf(\"Enter vlaue of Watermelon\");\nprintf(\"\\n\");\nscanf(\"%d\", &w);\nprintf(\"\\n\");\nb =w % 2;\nc =b % 2;\nif(c == 0){\n printf(\"YES\"); \n}\nelse\n{\n printf(\"NO\"); \n}\nreturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int w;\n\n scanf(\"%d\",&w);\n {\n if(w % 2 == 0)\n {\n printf(\"yes\");\n }\n else\n {\n printf(\"no\");\n }\n }\n}\n"}, {"source_code": "#include\nint main()\n{\n int w,a,b;\n w=a+b;\n scanf(\"%d %d %d\",&w,&a,&b);\n\n if(w%2==0){if(a%2==0&&b%2==0)\n printf(\"yes\");\n\n }\n else{\n printf(\"no\");\n }\n return 0;\n}"}, {"source_code": "#include \nint main()\n{\n int w;\n scanf(\"%d\", &w);\n if (w%2==0)\n {\n printf(\"YES\\n\");\n } else{\n printf(\"NO\\n\");\n }\n return 0;\n}\n/* 1491787813352 */\n"}, {"source_code": "#include\nint main (){\n\tint x,y,l; \n\tscanf(\"%d\",&x);\n\tif(x>=1 && x<=100){\n\t\tfor(y=1;y<100;y+=2){\n\t\t\tif(y==x){\n\t\t\t\tl++;\n\t\t\t}\n\t\t}\n\t\tif(l>0){\n\t\t\tprintf(\"NO\");\n\t\t}\n\t\telse{\n\t\t\tprintf(\"YES\");\n\t\t}\n\t}\n else{\n \treturn 0;\n\t}\n}\n"}, {"source_code": "#include\nint main()\n{\n int m;\n printf(\"Weight:\");\n scanf(\"%d\",&m);\n if(m%2==0&&m>2)\n printf(\"Yes\");\n else\n printf(\"No\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\nint z;\nscanf(\"%d\",&z);\nif(z%12==0)\n{\n printf(\"YES\");\n\n}\nelse\n{\n printf(\"NO\");\n}\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int w;\n scanf(\"%d\",&w);\n if (w%4==0)\n {printf (\"YES\");}\n else\n {\n printf (\"NO\");}\n}"}, {"source_code": "#include\n#include\n\nint main()\n{\n int w;\n scanf(\"%d\",&w);\n if(w==2)\n printf(\"NO\");\n if(w%2==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n\n\n"}, {"source_code": "#include \n\nint main ()\n{\n\nint a;\nscanf(\"%d\", &a);\nif (a%2==0){\n printf(\" YES\\n\");\n\n}else{\n\nprintf(\" NÃO\\n\");\n}\n\n\n\n\n\nreturn 0;\n}\n/* 1505333252004 */\n"}, {"source_code": "#include\nint main()\n{\n int w;\n scanf(\"%d\",&w);\n if(w%2==0)\n printf(\"YES\");\n else \n printf(\"NO\");\n}"}, {"source_code": "#include \n\nint main() {\n int w;\n\tscanf(\"%d\", &w);\n if(w%2==0){\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int w,x;\n scanf(\"%d\",&w);\n if(w%2==0)\n \n printf(\"YES\") ;\n \n else\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include \n#include \nmain()\n{\n int w;\n scanf(\"%d\",&w);\n if(w%2==0){\n if((w/2)%2==0){\n printf(\"YES\");\n }\n }\n else{\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include\nint main() {\n int n;\n scanf(\"%d\", &n);\n if(n % 2 == 0) {\n printf(\"YES\");\n }\n else {\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include \n\nint main(void) {\n\tint w;\n\tscanf(\"%d\",&w);\n\tif( (w/2)%2==0)\n\t printf(\"YES\");\n\telse\n\t printf(\"NO\");\n\treturn 0;\n}\n\n"}, {"source_code": "#include \nint main ()\n{\n int w;\n scanf (\"%d\", &w);\n if (w % 2 == 0)\n {\n printf (\"YES\\n\");\n }\n else\n {\n printf (\"NO\\n\");\n }\n\nreturn 0;\n}\n\n\n/* 1491921578836 */\n"}, {"source_code": "int main()\n{\n \n int w;\n scanf(\"%d\",&w);\n \n if(1<=w && w<=100 && w!=2)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0;\n}"}, {"source_code": "#include \n \nint main(){\n int w;\n \n scanf(\"%d\", &w);\n if(w > 1){\n if(w % 2 == 0)\n printf(\"YES\");\n return 0;\n }\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int w, x;\n scanf(\"%d\",&w);\n x=w/2.0;\n if(w%2==0)\n { x=w/2;\n if(x%2==0)\n printf(\"YES\") ;\n else\n printf(\"NO\");\n }\n else\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int w,b;\n scanf(\"%d,&w\");\n b=w/2;\n if(b%2==0)\n {\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n \n}"}, {"source_code": "#include \nint main ()\n{\n int w;\n scanf (\"%d\", &w);\n if (w%2 == 0)\n {\n printf (\"YES\\n\");\n\n }\n else\n {\n printf (\"NO\\n\");\n }\nreturn 0;\n}\n\n/* 1491325246072 */\n"}, {"source_code": "#include\nint main()\n{\n int x;\n printf(\"give the weight\");\n scanf(\"%d\",&x);\n if(x>=1 && x<=100)\n {\n if(x==2){\n printf(\"no\");\n }\n if(x%2==0){\n printf(\"yes\");\n }\n else\n {\n printf(\"no\");\n }\n }\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int w=8;\n scanf(\"%d\",&w);\n if(w%2==0)\n printf(\"Yes\");\n else\n printf(\"No\");\n return 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n int w;\n int a,b;\n scanf(\"%d\",&w);\n w= a+b;\n if((a /2==0) && (b /2==0))\n {\n printf(\"YES\");\n }\n else\n printf(\"NO\");\n return 0;\n\n}\n\n\n"}, {"source_code": "#include \n\nint main(void)\n{\n int w;\n scanf(\"%d\",&w);\n int onepart=w/2;\n\n if(w%2==0 && onepart%2==0)\n {\n printf(\"Yes\");\n\n }\n else\n {\n printf(\"No\");\n }\n\n\n\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tint num;\n\tscanf(\"%d\", &num);\n\n\tif ( (num & 1) == 0 && num > 2)\n\t{\n\t\tprintf(\"YES\");\n\t}\n\n\tprintf(\"NO\");\n}\n\n/* 1523935266808 */\n"}, {"source_code": " #include\n #include\n\n int main()\n {\n int n;\n printf(\"Please enter the weight=\");\n scanf(\"%d\",&n);\n\n if(n>=1 && n<=100 && n%2==0){\n printf(\"YES\");\n }\n\n else if(n>=1 && n<=100 && n%2!=0){\n printf(\"NO\");\n }\n\n\n return 0;\n }\n"}, {"source_code": "#include\n\nint main()\n{\n int d,sumTime,minTime[d],maxTime[d],study[d],total=0,i,maxSum=0;\n scanf(\"%d %d\",&d,&sumTime);\n for(i=0;i\n\nint w,a;\nint main(){\n\n scanf(\"%d\",&a);\n if((a>=1)&& (a<=100)){\n w=a;\n if((w%2)==0){\n printf(\"Yes\");\n }\n else{\n printf(\"No\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \nmain()\n{\n int w;\n scanf(\"%d\",&w);\n if(w%2==0){\n if((w/2)%2==0){\n printf(\"YES\");\n }\n }\n else{\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include \nint main()\n{\n int w;\n scanf(\"%d\",&w);\n if(w%2==0&& (w%2==0 ||((w/2)-1)%2==0 ))\n printf(\"YES\");\n else if(w>100)\n printf(\"Error\");\n else if(w<1)\n printf(\"Error\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{ int w;\n printf(\"enter the weight of your watermelon = \\t\");\n scanf(\"%d\",&w);\n if(w%2==0 & w>=1 & w<=100 )\n printf(\"yes\");\n else\n printf(\"NO\");\n\n\n return 0;\n}\n"}, {"source_code": "#include\n\nint main(){\n int w;\n scanf(\"%d\",&w);\n if((!(w%2)) && (w!=0))\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int a,k;\n\n int y,x,d=0,t;\n scanf(\"%d\",&a);\n\n for(x=1;x<=a;x++)\n for(y=1;y<=a;y++)\n if(y+x==a)\n if(y%2==0 && x%2==0)\n d+=1;\n if(a%2==0 && d==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0;\n\n}\n"}, {"source_code": "#include \nint main()\n{\n int w, m, n, k;\n k = 2 * m + 2 * n;\n if (w == k)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n}"}, {"source_code": "#include\nint main()\n{\n int a, b, c;\n scanf(\"%d\", &a);\n if(0<=a && a<=100 && a%2==0){\n printf(\"YES\");\n }\n return 0;\n}"}, {"source_code": "#include \n\nint main() {\n int w, i=2, ind=0;\n\tscanf(\"%d\", &w);\n if(w > 2 && w <= 100){\n while(i<(w/2) && ind == 0){\n if((w/2)%i==0){\n ind = 1;\n }\n i++;\n }\n if(ind){\n printf(\"YES\");\n } else {\n printf(\"NO\");\n } \n }\n\treturn 0;\n}"}, {"source_code": "#include\nvoid main()\n{\n int w;\n printf(\"Enter the weight:\");\n scanf(\"%d\",&w);\n if(w>2){\n if(w%2==0)\n printf(\"YES\\n\");\n else\n printf(\"N0\\n\");\n }\nelse\n printf(\"N0\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{ \nint weight;\nscanf(\"%d\",&weight);\nif(weight%2==0)\n{\nprintf(\"Yes\");\n}\nelse if(weight==2)\n{\nprintf(\"Yes\");\n}\nelse\n{\nprintf(\"No\");\n}\n return 0;\n}"}, {"source_code": "#include \n#include \nint main()\n{\n int a=0,y,x,d=0;\n scanf(\"%d\",&a);\n for(x=1;x<=a;x++)\n for(y=1;y<=a;y++)\n if(y+x==a)\n if(y%2==0 && x%2==0)\n d+=1;\n\n printf(\"..%d %d %d..\\n\",d,a%2,1*(a/2));\n if(1*(a/2)%2!=0)\n d-=1;\n if(a%2==0 && 1*(a/2)%2==0 && d>1)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int number;\n\n printf(\"Enter an integer: \");\n scanf(\"%d\", &number);\n\n if( number>=2 && number % 2 == 0)\n printf(\"%d is YES.\", number);\n else\n printf(\"%d is NO.\", number);\n\n return 0;\n}"}, {"source_code": "//By sushmitha1999, contest: Codeforces Beta Round #4 (Div. 2 Only), problem: (A) Watermelon, Compilation error, #\n #include\nmain()\n{\n int i,n,j,count=0;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++)\n {\n for(j=1;j<=n;j++)\n {\n if((i+j)==n)\n {\n if(i%2==0 && j%2==0)\n {\n count++;\n }\n }\n }\n if(count>1)\n {\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n}\n}"}, {"source_code": "#include \nint main ()\n{\n int P;\n scanf(\"%d\", &P);\n if ( P%2 == 0)\n {\n printf(\"YES\\n\");\n }else{\n printf(\"NO\\n\");\n }\n return 0;\n}\n\n/* 1491694316117 */\n"}, {"source_code": "#include \n\n\nint main()\n{\n int w;\n scanf(\"%d\",&w);\n\n if(w>2&&w<=100){\n if(w%2==0){\n printf(\"Yes\");\n }\n else{\n printf(\"No\");\n }\n }\n return 0;\n\n}\n"}, {"source_code": "#include\nint main(){\n int n;\n scanf(\"%d\",&n);\n if(n%2==0){\n printf(\"YES\");\n }\n else if(n%2!=0){\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \n#include \n#include\n\n\nint main() {\n\nint weight ;\n\nprintf(\"enter the weight of the watermelon : \\n\");\nscanf(\" %d\" , &weight) ;\n if(weight%2 == 0 )\n {\n printf(\"YES\");\n }\n else printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\nint w;\nprintf(\"enter the weight\");\nscanf(\"%d\",&w);\nif(w>0 && w<100 && w!=2 && w%2==0)\n{printf(\"YES\");}\nelse\nprintf(\"/n no\");\nreturn 0;\n}"}, {"source_code": "#include \n\nint main() {\n int w, i=2, ind=0;\n\tscanf(\"%d\", &w);\n if(w > 2 && w <= 100){\n while(i<(w/2) && ind == 0){\n if((w/2)%i==0){\n ind = 1;\n }\n i++;\n }\n if(ind){\n printf(\"YES\");\n } else {\n printf(\"NO\");\n } \n }\n\treturn 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n int num,sum,sum1;\n\n scanf(\"%d\",&num);\n\n sum=num/2;\n sum1=num-sum;\n if(sum>=1 && sum1>=1)\n {\n if(num%2==0 && sum%2==0 && sum%2==0)\n printf(\"YES\\n\");\n\n else\n printf(\"NO\\n\");\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\nint w;\nif(w%2==0)\n{\n\tif((w/2)%2==0)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\t\n} \nif(w%2==1) {\n\tprintf(\"NO\");\n}\nreturn 0;\n}\n"}, {"source_code": "#include \n#include\n\nint main()\n{\n int weight, i; \n \n scanf(\"%d\", &weight);\n \n if ( weight >= 1 && weight <=100 && weight != 2){\n double parts = (double) weight /2;\n \n for (int i = 0; i <= parts; i++){\n weight = weight - 2;\n if (weight == 0){\n break;\n }\n }\n \n \n if ( weight == 0.0 )\n \n printf(\"Yes\\n\");\n \n else if ( weight != 0.0)\n \n printf(\"No\\n\");\n }\n \n \n \n return 0;\n}"}, {"source_code": "#include\nint main ()\n{\n int w;\n printf(\"Enter the weight: \");\n scanf(\"%d\", &w);\n if (w==2)\n {\n printf(\"No\");\n }\n else if(w%2==0)\n {\n printf(\"Yes\");\n }\n\n else\n printf(\"No\");\n\nreturn 0;\n}\n"}, {"source_code": "#include \n int main ()\n{\n int x;\n scanf(\"%d\", &x);\n if (x % 2 != 0)\n printf(\"NAO\\n\");\n \n else printf(\"SIM\\n\");\n\nreturn 0;\n}\n\n/* 1505329285958 */\n"}, {"source_code": "#include\nint main()\n{\n int w;\n scanf(\"%d\",&w);\n if((w%2)==0)\n {\n printf(\"YES\\n\");\n }else\n {\n printf(\"NO\\n\");\n }\n return 0;\n}\n/* 1491843011470 */\n"}, {"source_code": "#include\nint main()\n{\n int w;\n scanf(\"%d\",&w);\n if(((w%2)==0)&&(w!=2))\n {\n printf(\"SIM\\n\");\n }else\n {\n printf(\"NAO\\n\");\n }\n return 0;\n}\n\n/* 1491614293052 */\n"}, {"source_code": "#include\n\nint main()\n{\n int x;\n scanf(\"%d\",&x);\n if(x%2==0 && x<=100 && x>=1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int w;\n scanf(\"%d\", &w);\n if(1 <= w && w <= 100 && w > 2)\n if(w % 2 == 0){\n printf(\"Yes\");\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int w;\n scanf(\"%d\",&w);\n if(1\nint main()\n{ \nint weight;\nscanf(\"%d\",&weight);\nif(weight%2==0)\n{\nprintf(\"Yes\");\n}\nelse\n{\nprintf(\"No\");\n}\n return 0;\n}"}, {"source_code": "int main()\n{\n int n,k;\n scanf(\"%d\",&n);\n k=n%2;\n if(k%2==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n}"}, {"source_code": "#include\nint main()\n{\n int w;\n scanf(\"%d\",&w);\n if(w%2==0)\n printf(\"YES\\n\");\n if(w<=2)\n printf(\"NO\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint a,b,w,p,m;\n\tscanf(\"%d\",&w);\n\tfor(w=0;w<100;w++)\n\t{\n\t\tscanf(\"%d\",&w);\n\t\tif(w>=4)\n\t\t\tprintf(\"YES\\n\");\n\t\telse\n\t\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}\n\t\n"}, {"source_code": "#include \n\nint main(){\n\n\tint w;\n\n\tscanf(\"%d\", &w);\n\n\tif(w == 1) printf(\"NO\\n\");\n\telse printf(\"YES\\n\");\n\n\treturn 0;\n}\n/* 1506034682222 */\n"}, {"source_code": "#include\nint main()\n{\n int w,rem;\n \n scanf(\"%d\",&w);\n rem=(w%2);\n if(rem==0){\n printf(\"yes\");\n }\n else{\n printf(\"nope\");\n }\n}"}, {"source_code": "#include \n\nint main()\n{\n int a, b, c, i, j;\n\n scanf(\"%d\", &a);\n\n if(a%2 == 0)\n {\n\n if(b=c=a/2 && b%2==0 && c%2==0)\n {\n printf(\"YES\");\n }\n else{\n for(i=0, j=a; i0; i=i+2, j=j-2)\n {\n b=i;\n c=j;\n if(a==b+c)\n {\n printf(\"YES\");\n }\n }\n }\n }\n else{printf(\"NO\");}\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint a,b,w,p,m;\n\tscanf(\"%d\",&w);\n\tfor(w=1;w<=100;w++)\n\t{\n\t\tscanf(\"%d\",&w);\n\t\tif(w>=4 && w%2==0)\n\t\t\tprintf(\"YES\\n\");\n\t\telse\n\t\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}\n\t\n"}, {"source_code": "#include \nint main()\n{\n int P;\n scanf(\"%d\", &P);\n if((P>=1)&&(P<=100))\n {\n\n\n if(P%2==0)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n }\n\n\n return 0;\n}\n/* 1491334186457 */\n"}, {"source_code": " #include\n #include\n\n int main()\n {\n int n;\n printf(\"Please enter the weight=\");\n scanf(\"%d\",&n);\n\n if(n%2==0){\n printf(\"YES\");\n }\n\n else{\n printf(\"NO\");\n }\n\n\n return 0;\n }\n"}, {"source_code": "#include\nint main(){\nint wes,m1,m2;\nscanf(\"%d\",&wes);\nscanf(\"%d\",&m1);\nscanf(\"%d\",&m2);\nif (wes%2==0 && wes<=100){\n\nif (m1+m2==wes && m1%2==0 && m2%2==0){\nprintf(\"yes\");\n}}\nreturn 0;}\n"}, {"source_code": "#include\nint main()\n{\n short int n;\n scanf(\"%hd\",&n);\n int temp = n/2;\n int rem = temp/2;\n int tem2 = (rem+rem)*2;\n if(n%2==0&&n==tem2&&n>=1&&n<=100)\n {\n printf(\"YES\\n\");\n }else\n {\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nint main ()\n{\n int W;\n scanf(\"%d\" , &W);\n\n if ((W % 2 == 0) && (W >= 1) && (W <= 100.0))\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n\n }\n return 0;\n}\n\n/* 1491678214302 */\n"}, {"source_code": "#include \nint main() {\n int w ;\n scanf (\"%d\", &w);\n if ((w/2)%2==0){\n printf(\"YES\");\n }\n else \n printf(\"NO\");\n}"}, {"source_code": "#include\n\nint main()\n{\n int w;\n do\n scanf(\"%d\", &w);\n while(w<1 || w>100);\n if(w%2 == 0)\n {\n for(int i = 0; i < w; i++)\n {\n if(i&1)\n continue;\n else\n w -= i;\n if(w%2 == 0)\n {\n printf(\"YES\");\n break;\n }\n else\n printf(\"NO\");\n }\n }\n else\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include\nint main(){\nint wes,m1,m2;\nscanf(\"%d\",&wes);\nm1=wes/2;\nm2=wes/2;\nif (wes==2){\nprintf(\"no\");\n}\nif (wes%2==0 && wes<=100 && wes>=1){\nif (m1%2==0 && m2%2==0){\nprintf(\"yes\");\n}}\nelse {\n printf(\"no\");\n}\nreturn 0;}\n"}, {"source_code": "#include\n#include\nint main()\n{\n\tint w;\n\tprintf(\"total weigh of watermelon\");\n\tscanf(\"%d\",&w);\n\t\n\tif(w%2==0 && w<=100)\n\tprintf(\"yes\");\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int w;\n printf(\"input w=\");\n scanf(\"%d\",&w);\n if(w>100)\n {\n printf(\"the vaiue of w is not acceptable\");\n }\n if(w<1)\n {\n printf(\"the vaiue of w is not acceptable\");\n }\n if(w%4==0)\n {\n printf(\"yes\");\n }\n else\n {\n printf(\"no\");\n }\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{int w;\nlong long i=0,j=0;\nfor(;i<100000000000;i++){\n j++;\n}\nprintf(\"%I64d\\n\",j);\nscanf(\"%d\",&w);\nif(w<=2)\nprintf(\"no\");\nelse if(w%2==0)\n printf(\"YES\");\n else \n \tprintf(\"NO\");\n \treturn 0;\n}"}, {"source_code": "\n#include \n\n int main() {\n int w,k;\n scanf(\"%d\",&w);\n k=w%2;\n { if(w<0)\n return 0;\n }\n {if(w>100)\n return 0;\n }\n {if(w==2)\n printf(\"NO\");\n }\n { if(k==0)\n printf(\"YES\");\n }\n { if(k==1)\n printf(\"NO\");\n }\n return 0;\n} "}, {"source_code": "int main()\n{\n \n int w;\n scanf(\"%d\",&w);\n \n if(w > 2 )\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0;\n}"}, {"source_code": "#include\n\nint main(){\n\tint watermelon;\n\tscanf(\"%i\",&watermelon);\n\n\tif(!(watermelon%2 && watermelon == 2)){\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t\tprintf(\"NO\");\n}"}, {"source_code": "#include\nmain()\n{\nint w;\nscanf(\"%d\",&w);\nif(w%2==0)\n{\nprintf(\"YES\");\n}\nelse if(w%2!=0)\n{\nprintf(\"NO\");\n}\n}"}, {"source_code": "#include >\n\nint main()\n{ int weight;\n scanf(\"%d\",&weight);\n if(weight<=100)\n {\n if(weight%2==0)\n {\n printf(\"Yes\");\n }\n else\n {\n printf(\"No\");\n }\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include\n\nmain()\n{\n\tint x;\n\tscanf(\"%d\",&x);\n\tif(x>2)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\treturn 0;\n} "}, {"source_code": "// @BEGIN_OF_SOURCE_CODE\n#include \n\nint main()\n{\n int w;\n while(scanf(\"%d\",&w) != EOF )\n {\n if(w >=1 && w <= 100)\n {if (w%2 == 1)\n {\n printf(\"NO\\n\");\n }\n else if (w <= 2)\n {\n printf(\"NO\\n\");\n }\n else if(w%2 ==0)\n {\n w/=2;\n if(w%2 == 1)\n {\n printf(\"NO\\n\");\n }\n else\n {\n printf(\"YES\\n\");\n }\n }\n }}\n return 0;\n}\n// @END_OF_SOURCE_CODE\n"}, {"source_code": "#include \n\nint main(void)\n{\n int w;\n scanf(\"%d\",&w);\n if(w%2==0 && w!=0)\n {\n printf(\"Yes\");\n\n }\n else\n {\n printf(\"No\");\n }\n\n}\n"}, {"source_code": "#include\n \ntypedef long long ll;\n \nint main()\n{\n ll n,f=0;\n scanf(\"%lld\",&n);\n for(int i=0;i<=100;i=i+2)\n {\n for(int j=0;j<=100;j=j+2)\n {\n if(i+j==n)\n {\n printf(\"YES\\n\");\n f=1;\n break;\n }\n \n }\n if(f==1)\n {\n break;\n }\n\n }\n if(f==0)\n {\n printf(\"NO\\n\");\n }\n \n return 0;\n \n}"}, {"source_code": "#include \n\nint main(){\n int n;\n \n \n \n scanf (\"%d\", &n);\n \n // if n is odd, ans is NO. Odd numbers can not be expressed as a sum of\n // two even numbers \n if (n % 2 != 0) printf (\"NO\\n\");\n \n // if n is even, but less than or equals to 2, ans is NO. \n // possible values of n: 0 and 2 \n // NB: Both part should be even and POSITIVE (positive > 0)\n if (n <= 2) printf (\"NO\\n\");\n \n else printf (\"YES\\n\");\n}"}, {"source_code": "int main()\n{\n int w;\n while(scanf(\"%d\",&w)==1)\n {\n if(w>2&&w%2==0)\n {\n printf(\"YES\");\n }\n printf(\"NO\");\n }\n return 0;\n}"}], "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2"} {"nl": {"description": "The king's birthday dinner was attended by $$$k$$$ guests. The dinner was quite a success: every person has eaten several dishes (though the number of dishes was the same for every person) and every dish was served alongside with a new set of kitchen utensils.All types of utensils in the kingdom are numbered from $$$1$$$ to $$$100$$$. It is known that every set of utensils is the same and consist of different types of utensils, although every particular type may appear in the set at most once. For example, a valid set of utensils can be composed of one fork, one spoon and one knife.After the dinner was over and the guests were dismissed, the king wondered what minimum possible number of utensils could be stolen. Unfortunately, the king has forgotten how many dishes have been served for every guest but he knows the list of all the utensils left after the dinner. Your task is to find the minimum possible number of stolen utensils.", "input_spec": "The first line contains two integer numbers $$$n$$$ and $$$k$$$ ($$$1 \\le n \\le 100, 1 \\le k \\le 100$$$)  — the number of kitchen utensils remaining after the dinner and the number of guests correspondingly. The next line contains $$$n$$$ integers $$$a_1, a_2, \\ldots, a_n$$$ ($$$1 \\le a_i \\le 100$$$)  — the types of the utensils remaining. Equal values stand for identical utensils while different values stand for different utensils.", "output_spec": "Output a single value — the minimum number of utensils that could be stolen by the guests.", "sample_inputs": ["5 2\n1 2 2 1 3", "10 3\n1 3 3 1 3 5 5 5 5 100"], "sample_outputs": ["1", "14"], "notes": "NoteIn the first example it is clear that at least one utensil of type $$$3$$$ has been stolen, since there are two guests and only one such utensil. But it is also possible that every person received only one dish and there were only six utensils in total, when every person got a set $$$(1, 2, 3)$$$ of utensils. Therefore, the answer is $$$1$$$.One can show that in the second example at least $$$2$$$ dishes should have been served for every guest, so the number of utensils should be at least $$$24$$$: every set contains $$$4$$$ utensils and every one of the $$$3$$$ guests gets two such sets. Therefore, at least $$$14$$$ objects have been stolen. Please note that utensils of some types (for example, of types $$$2$$$ and $$$4$$$ in this example) may be not present in the set served for dishes."}, "positive_code": [{"source_code": "#include \"stdio.h\"\n#include \"string.h\"\n#include \"stdlib.h\"\n#include \"math.h\"\n\n#ifdef WIN32\n #define LLINT \"%I64d\"\n #define ULLINT \"%I64u\"\n#else\n#endif\n\n#define INT \"%d\"\n#define LINT \"%ld\"\n#define ULINT \"%lu\"\n#define SINT \"%hd\"\n#define USINT \"%hu\"\n#define STRING \"%s\"\n#define KITCHEN_SIZE 101\n\ntypedef long int LInt;\ntypedef unsigned long int ULInt;\ntypedef short int SInt;\ntypedef unsigned short int USInt;\ntypedef long long int LLInt;\ntypedef unsigned long long int ULLInt;\n\nint main()\n{\n int CurrentType = 0;\n int MaxRemained = 0;\n int UtensilsTypes[KITCHEN_SIZE] = { 0 };\n int GuestsCount = 0;\n int RemainedUtensils = 0;\n int DishesPerQuest = 0;\n int TypesCount = 0;\n \n scanf(INT INT, &RemainedUtensils, &GuestsCount);\n for (int i = 0; i < RemainedUtensils; i++)\n {\n scanf(INT, &CurrentType);\n \n if (UtensilsTypes[CurrentType] == 0)\n {\n TypesCount++;\n }\n \n UtensilsTypes[CurrentType]++;\n \n if (UtensilsTypes[CurrentType] > MaxRemained)\n {\n MaxRemained = UtensilsTypes[CurrentType];\n }\n }\n \n if (MaxRemained <= GuestsCount) \n {\n DishesPerQuest = 1;\n }\n else \n {\n DishesPerQuest = MaxRemained / GuestsCount;\n \n if (MaxRemained % GuestsCount)\n {\n DishesPerQuest++;\n }\n }\n \n printf(LINT\"\\n\", (LInt)TypesCount * (LInt)GuestsCount * (LInt)DishesPerQuest - (LInt)RemainedUtensils);\n \n\treturn 0;\n}\n"}, {"source_code": "#include\nmain()\n{\n int n,k,i,j,s=0,p,a,ans;\n float g;\n scanf(\"%d %d\",&n,&k);\n int ara[n];\n for(i=0;i<=n-1;i++)\n {\n scanf(\"%d\",&ara[i]);\n }\n int num[100];\n for(i=0;i<=99;i++)\n {\n num[i]=0;\n }\n for(i=1;i<=100;i++)\n {\n for(j=0;j<=n-1;j++)\n {\n if(ara[j]==i)\n {\n num[i-1]++;\n }\n }\n }\n p=num[0];\n for(i=0;i<=99;i++)\n {\n if(num[i]==0)\n {\n s=s+1;\n }\n if(p<=num[i])\n {\n p=num[i];\n }\n\n }\n g=p%k;\n if(g==0)\n {\n a=p/k;\n }\n else\n {\n a=p/k+1;\n }\n ans=(a*(100-s)*k)-n;\n printf(\"%d\",ans);\n\n\n}\n"}, {"source_code": "#include \n#include \n#include \n\nint main(void)\n{\n\n int n,k,freq[101],total=0,resp,aux,dishes,max = 0;\n\n scanf(\"%d %d\",&n,&k);\n\n for(int i =0; i<101;i++)\n {\n freq[i] = 0;\n }\n\n for(int i =0; i max)\n max = freq[aux];\n }\n\n if(max%k == 0)\n dishes = max/k;\n else\n dishes = max/k + 1;\n\n\n \n\n printf(\"%d\\n\",dishes*total*k - n);\n\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \n#include \nint main()\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n int i,a[n],num[101],cnt=0,max=0,s,sum=0;\n memset(num,0,101*sizeof(int));\n for(i=0;i0)\n sum+=s-num[i];\n printf(\"%d\\n\",sum);\n}\n"}, {"source_code": "#include \n\n\nint main()\n{\n\tint n, k, i, a[101] = { 0 },m,ma=0,ans,gs=0,mk=0;\n\tscanf(\"%d %d\", &n, &k);\n\tfor (i = 0; i < n; i++)\n\t{\n\t\tscanf(\"%d\", &m);\n\t\ta[m]++;\n\t}\n\tfor (i = 0; i < 101; i++)\n\t{\n\t\tif (a[i] > ma)\n\t\t\tma = a[i];\n\t\tif (a[i] > 0)\n\t\t\tgs++;\n\t}\n\tif (ma%k == 0)\n\t\tmk = ma / k;\n\telse\n\t\tmk = ma / k + 1;\n\tans = mk*k*gs - n;\n\tprintf(\"%d\", ans);\n\n\t\n\n\treturn 0;\n}"}, {"source_code": " #include\nint main()\n{\n int b[110],a[110];\n int sheng,ren,i,j,shu=0;\n for(i=1;i<=100;i++)\n a[i]=0;\n scanf(\"%d%d\",&sheng,&ren);\n for(i=1;i<=sheng;i++)\n {\n scanf(\"%d\",&b[i]);\n j=b[i];\n a[j]++;\n }\n int max;\n max=a[1];\n for(i=1;i<=100;i++)\n{\n if(a[i]>=max)\n max=a[i];\n if(a[i]!=0)\n shu++;\n}\nif(max>ren)\n for(i=2;i\n#include \n\n\nint max(int a, int b){ return a>b?a:b;}\n int main()\n {\n \tint x,y,n,k,i;\n \tscanf(\"%d %d\",&n,&k);\n \tint ar[105];\n \tmemset(ar,0,sizeof(ar));\n \tfor(i=0;i\n#include \n\nint main(){\n\t\n\tint x,y;\n\tscanf(\"%d\",&x);\n\tscanf(\"%d\",&y);\n\tint en,fre[101],di=0;\n\tmemset(fre,0,sizeof(fre));\n\twhile(x--){\n\t\tscanf(\"%d\",&en);\n\t\tfre[en]++;\n\t\tif(fre[en]>di*y)di++;\n\t}\n\tint i,res=0;\n\tfor(i=1;i<=100;i++)if(fre[i])res+=di*y-fre[i];\n\tprintf(\"%d\\n\",res);\n\t\n\treturn 0;\n}"}, {"source_code": "#include\n#include\n#include\n#include\n\nint main()\n{\n unsigned int n,k,a[101],x[101]={0},d=0,t,min,i,count=0,sum=0;\n\n scanf(\"%u %u\",&n,&k);\n\n min=0;\n\n for(i=0;i0)\n count++;\n\n if(x[i]>min)\n min=x[i];\n\n }\n int p=1;\n while(min>k)\n {\n min=min-k;\n p++;\n }\n\n\n\n d=p*k*count-n;\n\n printf(\"%u\",d);\n\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,c=0,i,sum,j,s,m=0,n,ar[10000],br[10000];\n scanf(\"%d %d\",&a,&b);\n for(i=1;i<=a;i++)\n {\n scanf(\"%d\",&ar[i]);\n br[ar[i]]++;\n }\n for(i=1;i<=100;i++)\n {\n if(br[i]>m)\n {\n m=br[i];\n }\n if(br[i]>0)\n {\n c++;\n }\n }\n n=m/b;\n if(m%b!=0)\n {\n n+=1;\n }\n sum=(n*b*c)-a;\n printf(\"%d\\n\",sum);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n#include \n\nint main(void){\n\n int n, k, i;\n\n scanf(\"%d%d\", &n, &k);\n\n int a[n];\n int c[128];\n int max = 0;\n int v;\n int ans = 0;\n\n for(i = 1; i <= 100; i++){\n c[i] = 0;\n }\n\n for(i = 0; i < n; i++){\n scanf(\"%d\", &a[i]);\n c[a[i]]++;\n }\n\n for(i = 1; i <= 100; i++){\n if(c[i] > max){\n max = c[i];\n }\n }\n\n if(max % k == 0){\n v = max;\n }else{\n v = ((max / k) + 1) * k;\n }\n\n for(i = 1; i <= 100; i++){\n if(c[i] >= 1){\n ans += (v - c[i]);\n }\n }\n\n printf(\"%d\\n\", ans);\n \n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,k,i,c,max,x;\n while(scanf(\"%d%d\",&n,&k)!=EOF)\n {\n int a[105]= {0};\n for(i=0; imax)\n max=a[i];\n if(a[i]>=1)\n c++;\n }\n while(max%k!=0)\n max++;\n printf(\"%d\\n\",(max*c)-n);\n }\n return 0;\n}\n"}, {"source_code": "#include\n\nint main(void)\n{\n\tint nUtensil;\n\tint kGuest;\n\tint dNum = 1;\n\tint Dish = 1;\n\tint Type[100];\n\tint minimum;\n\tint temp = 1;\n\n\tscanf(\"%d %d\",&nUtensil,&kGuest);\n\n\tfor (int cnt = 0;cnt <= nUtensil-1;cnt++)\n\t{\n\t\tscanf(\"%d\",&Type[cnt]);\n\t}\n\n\tfor (int cnt1 = 0;cnt1 <= nUtensil -1;cnt1++)\n\t{\n\t\tfor (int cnt2 = cnt1+1;cnt2 <= nUtensil-1;cnt2++)\n\t\t{\n\t\t\tint temp;\n\t\t\tif (Type[cnt1]>Type[cnt2])\n\t\t\t{\n\t\t\t\ttemp = Type[cnt1];\n\t\t\t\tType[cnt1] = Type[cnt2];\n\t\t\t\tType[cnt2] = temp;\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (int cnt = 0;cnt <= nUtensil-2;cnt++)\n\t{\n\t\tif (Type[cnt] != Type[cnt+1])\n\t\t{\n\t\t\ttemp = 1;\n\t\t\tdNum++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ttemp++;\n\t\t}\n\n\t\tif ((temp-1)/kGuest+1 > Dish)\n\t\t{\n\t\t\tDish = (temp-1)/kGuest + 1;\n\t\t}\n\t}\n\n\tminimum = kGuest*dNum*Dish - nUtensil;\n\tprintf(\"%d\",minimum);\n}"}, {"source_code": "#include\nint a[105]={0};\nint main()\n{\n\tint n,k,x,j,count=0;\n\tscanf(\"%d%d\",&n,&k);\n\tfor(int i=1;i<=n;i++)\n\t{\n\t\tscanf(\"%d\",&x);\n\t\ta[x]++;\n\t}\n\tint max=0;\n\tfor(int i=1;i<=105;i++)\n\tif(max\n#include \n#include \n#define MAX_SIZE 100\n\nint getTotal(int *uten,int k);\nint maxElement(int *arr);\nint in(int *arr,int n);\n\nint main()\n{\n //defining variables and arrays needed\n int k , n , nod = 0,nok = 0,temp;\n scanf(\" %d %d\",&n,&k);\n int arrAfter[MAX_SIZE+1]={0};\n int arr[MAX_SIZE+1]={0};\n\n for(int i=1;i<=n;i++){\n scanf(\" %d\",&temp);\n if(!in(arr,temp))\n nok++;\n arr[i]=temp;\n arrAfter[temp]++;\n\n }\n int maxelement = maxElement(arrAfter);\n nod = getTotal(&maxelement,k)/k;\n\n printf(\"%d\",nod*nok*k-n);\n\n return 0;\n}\n\n//provides an array with the amount of kitchen utensils left after the party\nint maxElement(int *arr){\n int max = 0;\n for(int i=1;i<=MAX_SIZE;i++){\n if(max<*(arr+i))\n max=*(arr+i);\n }\n return max;\n}\n\n//get the TOTAL number of utensils served of a certain kind\nint getTotal(int *kit,int k){\n int temp = *kit;\n if(temp!=0){\n while((temp%k)!=0){\n temp += 1;\n }\n }\n return temp;\n}\n\nint in(int *arr,int n){\n for(int i=1;i<=MAX_SIZE;i++){\n if(n==*(arr+i))\n return 1;\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\n int k_guests, // guests\n n_count_of_devices, // count of device\n types_of_devices; // type of device\n int c, set_of_device, flag, count_of_dishes;\n int arr_with_devices[100]; // arr with count of devices rewrite!\n int arr_with_types_of_devices[100];\n int count;\n int max_set;\n\n scanf(\"%d\", &n_count_of_devices);\n if (!n_count_of_devices) // zero devices\n goto end;\n scanf(\"%d\", &k_guests);\n\n flag = types_of_devices = count = 0;\n for (int i = 0; i < n_count_of_devices; i++) {\n scanf(\"%d\", &c);\n arr_with_devices[i] = c;\n for (int j = 0; j < i; j++)\n if (arr_with_devices[j] == c) {\n flag = 1;\n break;\n }\n if (!flag) {\n types_of_devices++; // new device founded\n arr_with_types_of_devices[count++] = c;\n } else flag = 0;\n }\n\n set_of_device = max_set = 0;\n for (int i = 0; i < count; i++) {\n for (int j = 0; j < n_count_of_devices; j++)\n if (arr_with_types_of_devices[i] == arr_with_devices[j])\n set_of_device++;\n if (set_of_device > max_set)\n max_set = set_of_device;\n set_of_device = 0;\n }\n\n count_of_dishes = (max_set % k_guests == 0) ? max_set / k_guests : max_set / k_guests + 1;\n printf(\"%d\", count_of_dishes * k_guests * types_of_devices - n_count_of_devices);\n\n\nend:\n\n return 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n int n,k,i,dish=0,maxdish=0,u=0;\n scanf(\"%d %d\",&n,&k);\n int x,count[100]={0};\n for(i=0;imaxdish)maxdish=dish;\n }\n printf(\"%d\",maxdish*u*k-n);\n}"}, {"source_code": "#include\n#define MAX 100\nint a[MAX],b[MAX];\nint main()\n{\n\tint k,n;\n\tint max=0,i;\n\tfor(i=0;i=b[i])?max:b[i];\n\tint max_,result=0;\n\tmax_=(max%k==0)?max:max-max%k+k;\n\tfor(i=0;i0)\n\t\t\tresult+=max_-b[i];\n\tprintf(\"%d\",result);\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\nint main() {\n int k, n;\n\n scanf(\"%d %d\", &n, &k);\n int* items = malloc(n*4);\n for (int i = 0; i < n; i++) {\n scanf(\"%d\", &(items[i]));\n }\n\n int repets[100] = {};\n\n for (int i = 0; i < 100; i++) {\n repets[i] = 0;\n }\n\n for (int i = 0; i < n; i++) {\n repets[items[i] - 1] += 1;\n }\n\n int max_rep = 0;\n int typenum = 0;\n\n for (int i = 0; i < 100; i++) {\n if (repets[i] > max_rep) {\n max_rep = repets[i];\n }\n\n if (repets[i] != 0) {\n typenum++;\n }\n }\n\n int min_dish_num = 0;\n\n while (min_dish_num*k < max_rep) {\n min_dish_num += 1;\n }\n\n printf(\"%d\\n\", typenum*min_dish_num*k - n);\n\n return 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int a,b=1,max=1,somonan,dem,n,k,i,mini;\n scanf(\"%d%d\",&n,&k);\n int array[n];\n for(i=0;iarray[i+1])\n {\n dem=array[i];\n array[i]=array[i+1];\n array[i+1]=dem;\n }\n }\n }\n dem=1;\n for(i=0;imax)\n {\n max=dem;\n }\n }\n else\n {\n b++;\n dem=1;\n }\n }\n if(max\n\nint main(void){\n\tint n, k, temp, maxi = -1, miss = 0, dish;\n\tint arr[100] = {0};\n\tscanf(\"%d%d\", &n, &k);\n\n\twhile(n--){\n\t\tscanf(\"%d\", &temp);\n\t\tarr[temp-1]++;\n\t\tif(arr[temp - 1] > maxi) maxi = arr[temp - 1];\n\t}\n\tdish = maxi / k;\n\tif(maxi % k > 0) dish++;\n\tfor(int i = 0; i < 100; i++){\n\t\tif(arr[i] == 0) continue;\n\t\tmiss += (dish * k - arr[i]);\n\t}\n\tprintf(\"%d\", miss);\n}"}, {"source_code": "#include\n\nint main()\n{\n int a[101] = {0}, n, k, i, t, c = 0;\n\n scanf(\"%d %d\", &n, &k);\n for(i = 0; i++ < n; a[scanf(\"%d\", &t), t]++);\n\n for(i = 1; i <= 100; i++)\n if(a[i] > c) c = a[i];\n\n c = (c + k - 1) / k;\n c *= k;\n\n for(t = 0, i = 1; i <= 100; i++)\n if(a[i]) t += c - a[i];\n\n printf(\"%d\", t);\n \n return 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n int i, p, q=0, n, m=0, k, a[101]={};\n scanf(\"%d %d\", &n, &k);\n for(i=0; ia[i]?m:a[i];\n printf(\"%d\", (m+k-1)/k*k*q-n);\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint a, b;\n\tscanf(\"%d\", &a);\n\tscanf(\"%d\", &b);\n\tint aa[a];\n\tfor(int i = 0; i < a; i++){\n\t\tscanf(\"%d\", &aa[i]);\n\t}\n\tint c;\n\tc = 0;\n\tint bb[a];\n\tfor(int i = 0; i < a; i++){\n\t\tbb[i] = 0;\n\t}\n\tfor(int i = 0; i < a; i++){\n\t\tfor(int j = 0; j < a; j++){\n\t\t\tif(aa[i] == -1){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(aa[i] == aa[j] && bb[i] == 0){\n\t\t\t\tbb[i] = bb[i] + 1;\n\t\t\t}else if(aa[i] == aa[j] && bb[i] != 0){\n\t\t\t\tbb[i] = bb[i] + 1;\n\t\t\t\taa[j] = -1;\n\t\t\t}\n\t\t}\n\t}\n\tint cc[a];\n\tint d = 0;\n\tfor(int i = 0; i < a; i++){\n\t\tif(bb[i] % b != 0){\n\t\t\tcc[i] = bb[i] / b + 1;\n\t\t}else{\n\t\t\tcc[i] = bb[i] / b;\n\t\t}\n\t\tif(cc[i] > d){\n\t\t\td = cc[i];\n\t\t}\n\t}\n\tint e = 0;\n\tfor(int i = 0; i < a; i++){\n\t\tif(aa[i] != -1){\n\t\t\te = e + 1;\n\t\t}\n\t}\n\tint f, g, h;\n\tg = 0;\n\tf = e * d * b;\n\tfor(int i = 0; i < a; i++){\n\t\tg = g + bb[i];\n\t}\n\th = f - g;\n\tprintf(\"%i\", h);\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nint min(int x,int y)\n{\n\tif(x>y) return y;\n\telse return x;\n}\nint max(int x,int y)\n{\n\tif(x>y) return x;\n\telse return y;\n } \nint main()\n{\n\tint utensil,guest,minimum=0,cnt=0;\n\tint i,temp;\n\tint remain[105];\n\tmemset(remain,0,sizeof(remain));\n\tscanf(\"%d%d\",&utensil,&guest);\n\tfor(i=1;i<=utensil;i++)\n\t{\n\t\tscanf(\"%d\",&temp);\n\t\tremain[temp]++;\n\t}\n\tfor(i=1;i<=100;i++)\n\t{\n\t\tif(remain[i])\n\t\t{\n\t\t\tcnt++;\n\t\t\tminimum=max(minimum,(remain[i]+guest-1)/guest);\n\t\t}\n\t}\n\tprintf(\"%d\",minimum*cnt*guest-utensil);\n\treturn 0;\n } \n"}, {"source_code": "#include\nint main()\n{\n int n,k;\n scanf(\"%d%d\",&n,&k);\n int a[n];\n int i;\n for(i=0;imax){\n max=ko;\n }\n }\n for(i=0;i\n#include\nint main()\n{\n\tint n,k,max=0,temp,count=0,res,i=0,p;\n\tint utensil[101]={0};\n\tscanf(\"%d %d\",&n,&k);\n\twhile(imax)\n\t\t{\n\t\t\tmax=utensil[temp];\n\t\t}\n\t\ti++;\n\t}\n\tp=(max+k-1)/k;\n\tres=(p*count*k)-n;\n\tprintf(\"%d\",res);\nreturn 0;\n}"}, {"source_code": "#include\nmain()\n{\nint i,j,k,l,m,n,p,q,max=0,sum=0,z;\nint count,count1;\nscanf(\"%d\",&n);\nscanf(\"%d\",&k);\nint a[n],b[101]={0};\nfor(i=0;imax)\nmax=count;}\nif(max%k==0)\nz=max/k;\nelse\nz=(max/k)+1;\nfor(l=1;l<=100;l++)\n{count1=0;\nfor(p=0;p\n#include \n#include \n\nint main() {\n int n, k;\n scanf(\"%d %d\", &n, &k);\n int arr[100] = {};\n int t;\n for (int i = 0; i < n; i++) {\n scanf(\"%d\", &t);\n arr[t % 100]++;\n }\n int ctr = 0;\n int __max = 0, temp;\n for (int i = 0; i < 100;i++) {\n if (arr[i]) {\n ctr++;\n temp = (arr[i] / k + ((arr[i] % k) > 0));\n __max = __max > temp ? __max : temp;\n }\n }\n printf(\"%d\\n\", k * __max * ctr - n);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint Cnt[101];\n\nint main()\n{\n int n, k, a, max = 0;\n scanf(\"%d %d\", &n, &k);\n for(int i = 0; i < n; ++i) {\n scanf(\"%d\", &a);\n ++Cnt[a];\n if(max < Cnt[a]) {\n max = Cnt[a];\n }\n }\n if(max % k != 0) {\n max += k - 1;\n max /= k;\n max *= k;\n }\n int ans = 0;\n for(int i = 1; i < 101; ++i) {\n if(Cnt[i]) {\n ans += max - Cnt[i];\n }\n }\n printf(\"%d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include \n\n#define Max(a,b) a>b ? a : b\nint a[101];\nint main()\n{\n int i, p, q=0, n, m=0, k;\n scanf(\"%d %d\", &n, &k);\n for(i=0; i\n\nint main()\n{\n int n, m, x[103]={0}, i;\n scanf(\"%d %d\", &n, &m);\n for(i=0; im)\n {\n if(x[101]%m!=0)x[0]=(x[101]/m)+1, m=m*x[0];\n else x[0]=x[101]/m, m=m*x[0];\n }\n for(i=1; i<101; i++)if(x[i]!=0)x[102]+=(m-x[i]);\n printf(\"%d\", x[102]);\n}"}, {"source_code": "#include \n\nint main()\n{\n int n, m, x[103]={0}, i;\n scanf(\"%d %d\", &n, &m);\n for(i=0; im)\n {\n if(x[101]%m!=0)x[0]=(x[101]/m)+1, m=m*x[0];\n else x[0]=x[101]/m, m=m*x[0];\n }\n printf(\"%d\", (x[102]*m)-n);\n}"}, {"source_code": "#include \n#include \n#include \n\n#define SIZE 10010\n\nint main() {\n\tint n, k, a[SIZE], size = 0, i, t, sum = 0, max = 0, j = 1, c;\n\n\tscanf (\"%d %d\", &n, &k);\n\n\tmemset (a, 0, sizeof a[0] * SIZE);\n\n\tfor (i = 0; i < n; i++) {\n\t\tscanf (\"%d\", &t);\n\n\t\tif (t > size)\n\t\t\tsize = t;\n\n\t\ta[t]++;\n\t}\n\n\tfor (i = 1; i <= size; i++) \n\t\tif (a[i] != 0) \n\t\t\ta[j++] = a[i];\n\tsize = j - 1;\n\n\tfor (i = 1; i <= size; i++)\n\t\tif (a[i] > max)\n\t\t\tmax = a[i];\n\n\tc = (max - 1) / k + 1;\n\n\tfor (i = 1; i <= size; i++)\n\t\tif (a[i] > k)\n\t\t\ta[i] %= k;\n\t\n\tfor (i = 1; i <= size; i++)\n\t\tif (a[i] > max)\n\t\t\tmax = a[i];\n\n\tsum = c * size * k - n;\n\n\tprintf (\"%d\", sum);\n\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int a,b=1,max=1,somonan,dem,n,k,i,mini;\n scanf(\"%d%d\",&n,&k);\n int array[n];\n for(i=0;iarray[i+1])\n {\n dem=array[i];\n array[i]=array[i+1];\n array[i+1]=dem;\n }\n }\n }\n dem=1;\n for(i=0;imax)\n {\n max=dem;\n }\n }\n else\n {\n b++;\n dem=1;\n }\n }\n if(max\n\nint arr[1005];\nint main ()\n{\n\tint n,k;\n\tscanf(\"%d %d\",&n,&k);\n\tint a;\n\tfor (int i=0;imax) max=arr[i];\n\t}\n\t// printf(\"%d\\n\",max);\n\tint dish=1;\n\twhile (k*dish\nint main(){\n\tint n,m;\n\tscanf(\"%d%d\",&n,&m);\n\tint a[100]={0};\n\tfor(int i=0;imax)\n\t\tmax=a[i];\n\t\tif(a[i]!=0)\n\t\tnum++;\n\t}\n\tint g;\n\tif(max%m==0){\n\t\tg=max/m;\n\t}\n\telse{\n\t\tg=max/m+1;\n\t}\n\tprintf(\"%d\",g*m*num-n);\n\t\n}"}, {"source_code": "#include\n#include\nint main()\n{\n\tint n,k,max=0,temp,count=0,res,i=0,p;\n\tint utensil[101]={0};\n\tscanf(\"%d %d\",&n,&k);\n\twhile(imax)\n\t\t{\n\t\t\tmax=utensil[temp];\n\t\t}\n\t\ti++;\n\t}\n\tp=(max+k-1)/k;\n\tres=(p*count*k)-n;\n\tprintf(\"%d\",res);\nreturn 0;\n}"}, {"source_code": "#include \nint main()\n{\n int n,k,i,a,N=0 ,max,p,pvn=0;\n int A[100];\n scanf(\"%d%d\",&n,&k);\n for(i=0;i<100;i++)\n {\n A[i]=0;\n }\n for(i=0;imax)\n max=A[i];\n }\n if(max%k)\n p=max/k+1;\n else\n p=max/k;\n for(i=0;i<100;i++)\n {\n if(A[i])\n pvn++;\n }\n printf(\"%d\",pvn*p*k-n);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,m;\n\tint i,a[10001],max,sum,count,h;\n\twhile(scanf(\"%d%d\",&n,&m)!=EOF)\n\t{\n\t\tint b[101]={0};\n\t\tcount=max=0;\n\t\tfor(i=1;i<=n;i++)\n\t\t\t{scanf(\"%d\",&a[i]); \n\t\tb[a[i]]++;\n\t\tif(b[a[i]]>max)\n\t\tmax=b[a[i]];\n\t\t}\n\t\tif(max%m==0)\n\t\tsum=max/m;\n\t\telse\n\t\tsum=max/m+1;\n\t\tfor(i=1;i<=100;i++)\n\t\tif(b[i])\n\t\tcount++;\n\t\th=sum*count*m-n;\n\t\tprintf(\"%d\\n\",h); \n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n\nint\nmain(void)\n{\n\t//freopen(\"input.txt\", \"r\", stdin);\n\tint a[101];\n\tint cnt[100] = { 0, };\n\tfor (int i = 0; i < 100; i++) {\n\t\tcnt[i] = 0;\n\t}\n\tint n, k;\n\tscanf(\"%d %d\", &n, &k);\n\tfor (int i = 0; i < n; i++) {\n\t\tscanf(\"%d\", &a[i]);\n\t}\n\n\t// max # of array\n\tint max = 0;\n\tfor (int i = 0; i < n; i++) {\n\t\tif (max < a[i]) {\n\t\t\tmax = a[i];\n\t\t}\n\t}\n\n\tfor (int i = 0; i < n; i++) {\n\t\tcnt[a[i]-1]++;\n\t}\n\tint f_max = 0;\n\tfor (int i = 0; i < 100; i++) {\n\t\tif (f_max < cnt[i]) {\n\t\t\tf_max = cnt[i];\n\t\t}\n\t}\n\n\tint num_type = 0;\n\tfor (int i = 0; i < 100; i++) {\n\t\tif (cnt[i] != 0) {\n\t\t\tnum_type++;\n\t\t}\n\t}\n\tint num_dish = (f_max + k - 1) / k;\n\n\tint res = num_dish * k * num_type - n;\n\t//printf(\"%d %d %d %d\\n\", num_dish, num_type, f_max, k);\n\tprintf(\"%d\\n\", res);\n\n\treturn 0;\n}"}, {"source_code": "#include \"stdio.h\"\n\nint count(int*mas)\n{\n\tint a=0;\n\tfor(int i=0;i<100;i++)\n\t\tif(mas[i]!=0)a++;\n\treturn a;\n}\n\nint find_max(int*mas,int g)\n{\n\tint max=0;\n\tfor (int i=0;i<100;i++)\n\t{\n\t\tif(mas[i]>max)max=mas[i];\n\t}\n\tif(max%g==0)\n\t\treturn max/g;\n\telse return (max/g)+1;\n}\n\nint main()\n{\n\tint n,g,tmp,sum;\n\tscanf(\"%d%d\",&n,&g);\n\tint mas[100];\n\tfor (int i=0;i<100;i++)\n\t\tmas[i]=0;\n\tfor (int i=0;i\nint main()\n{\n\tint n,k,i,j,maxm,d,u=0,r;\n\tscanf(\"%d%d\",&n,&k);\n\tint a[n],c[101]={0};\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tj=a[i];\n\t\tc[j]++;\n\t}\n\tmaxm=c[1];\n\tfor(i=1;i<=100;i++)\n\t{\n\t\tif(c[i]!=0)\n\t\t{\n\t\t\tu++;\n\t\t}\n\t\tif(c[i]>maxm)\n\t\t{\n\t\t\tmaxm=c[i];\n\t\t}\n\t}\n\td=(maxm-1)/k+1;\n\tr=k*d*u-n;\n\tprintf(\"%d\",r);\n\treturn 0;\n}"}, {"source_code": "#include\n#include\n#include\nint main()\n{\n int i,n,k,count=0,max=0,j,z;\n int c[100]={};\n scanf(\"%d%d\",&n,&k);\n int a[n];\n for(i=0;imax)\n max=c[i];\n if(c[i]>0)\n count++;\n }\n z=ceil((float)max/k);\n printf(\"%d\",(k*count*z)-n);\n return 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n int n,k,t,temp,m,max,s,i,a[101]={0};\n scanf(\"%d%d\",&n,&k);\n m=0;\n for(i=0;imax){max=a[i];}\n }\n if(max>k)\n {\n temp=max/k+1;\n if(max%k==0){temp--;}\n s=temp*k*m;\n }\n else{s=k*m;}\n printf(\"%d\\n\",s-n);\nreturn 0;\n}\n"}, {"source_code": "#include\n\nstruct Utensils\n{\n\tint num;\n\tint count;\n};\n\nint main()\n{\n\tint n,k;\n\twhile((scanf(\"%d%d\",&n,&k))!=-1)\n\t{\n\t\tint i,j,iCount=0,ok,u[n],setnum = 0;\n\t\tstruct Utensils U[n];\n\t\tfor(i = 0;i < n;i++) scanf(\"%d\",&u[i]);\n\t\tfor(i = 0;i < n;i++)\n\t\t{\n\t\t\tok = 1;\n\t\t\tfor(j = 0;j\n#define MAX 100\nint main()\n{\n\t// n����ͺ�ʣ�µIJ;���Ŀ\n\t// k�Dzμ�����Ŀ�����Ŀ \n\tint n, k;\n\t// ��ȡn��k��ֵ\n\tscanf(\"%d%d\", &n, &k);\n\t// a[]��ʣ�µIJ;ߵ�ÿ������ĸ��� \n\tint a[MAX] = {0};\n\tint i;\n\tfor(i = 0; i < n; i++) {\n\t\tint x;\n\t\tscanf(\"%d\", &x);\n\t\ta[x-1]++;\n\t}\n\t// �ҵ����ֵm������ͳ�Ƴ�����ĸ���c \n\tint m = 0;\n\tint c = 0;\n\tfor(i = 0; i < MAX; i++) {\n\t\tif(a[i] == 0)\n\t\t\tcontinue;\n\t\tif(a[i] > m)\n\t\t\tm = a[i];\n\t\tc++;\n\t}\n\t// ����;ߵ�����t\n\twhile(m % k != 0) m++;\n\t// ������\n\tprintf(\"%d\", m * c - n); \n\treturn 0;\t\n} \n"}, {"source_code": "#include\n#include\nmain(){\n\tint type=0,s[105],s1[105],n,k,max;\n\tmemset(s,'\\0',sizeof(s));\n\tmemset(s1,'\\0',sizeof(s1));\n\tscanf(\"%d %d\",&n,&k);\n\tfor(int i=0;ik){\n\t\tk+=z;\n\t}\n\tint count=0;\n\tfor(int i=0;i=0;j--){\n\t\t\tif(s[i]==s[j])\n\t\t\tt++;\n\t\t}\n\t\tif(!t){\n\t\t\tcount++;\n\t\t}\n\t}\n\tint re=count*k-n;\n\tprintf(\"%d\",re);\n}"}, {"source_code": "#include\nint max(int a,int b){\n\tif (a>b) return a;\n\telse return b;\n}\nint main(){\n\tint n,k,p,i,j,ans,\n\t\tnum=0,\n\t\tsum=0,\n\t\tmaxm=-1,\n\t\tmaxn=-1,\n\t\ta[101]={0};\n\tscanf(\"%d%d\",&n,&k);\n\tfor(i=1;i<=n;i++){\n\t\tscanf(\"%d\",&p);\n\t\tmaxn=max(maxn,p);\n\t\ta[p]++;\n\t}\n\tfor(i=1;i<=maxn;i++){\n\t\tif (a[i]!=0){\n\t\t\tmaxm=max(maxm,a[i]);\n\t\t\tnum++;\n\t\t\tsum=sum+a[i];\t\n\t\t}\t\n\t}\n\t(maxm%k==0)?(p=maxm/k):(p=maxm/k+1); \n\tans=p*k*num-sum;\n\tprintf(\"%d\",ans);\n\treturn 0;\n} \n"}, {"source_code": "#include\nint max(int a,int b){\n\tif (a>b) return a;\n\telse return b;\n}\nint main(){\n\tint n,k,p,i,j,ans,\n\t\tnum=0,\n\t\tsum=0,\n\t\tmaxm=-1,\n\t\tmaxn=-1,\n\t\ta[101]={0};\n\tscanf(\"%d%d\",&n,&k);\n\tfor(i=1;i<=n;i++){\n\t\tscanf(\"%d\",&p);\n\t\tmaxn=max(maxn,p);\n\t\ta[p]++;\n\t}\n\tfor(i=1;i<=maxn;i++){\n\t\tif (a[i]!=0){\n\t\t\tmaxm=max(maxm,a[i]);\n\t\t\tnum++;\n\t\t\tsum=sum+a[i];\t\n\t\t}\t\n\t}\n\t(maxm%k==0)?(p=maxm/k):(p=maxm/k+1); \n\tans=p*k*num-sum;\n\tprintf(\"%d\",ans);\n\treturn 0;\n} \n"}, {"source_code": "#include \n#include \n\nint cnt[100];\n\nint compare (const void * a, const void * b){\n return *(int*)b - *(int*)a;\n}\n\nint main() {\n int n, k, i, a;\n int stolen = 0;\n int max = 0;\n \n scanf(\"%d %d\", &n, &k);\n for (i = 0; i < n; ++i) {\n scanf(\"%d\", &a);\n (cnt[a-1])++;\n }\n \n qsort(cnt, 100, sizeof(int), compare);\n while (max < cnt[0]) {\n max += k;\n }\n \n for (i = 0; i < 100; ++i) {\n if (!cnt[i]) { break; }\n stolen += max - cnt[i];\n }\n printf(\"%d\", stolen);\n \n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint fun(const void* a, const void* b){\n\treturn (*(short int*)a - *(short int*)b) * (-1);\n}\n\nint main(){\n\tint n, k, i = 0, A[100], l = 0, countpr = 0, countmax, dish;\n\tscanf(\"%d%d\", &n, &k);\n\tfor(i = 0; i < 100; i++){\n\t\tA[i] = 0;\n\t\t\n\t}\t\n\tfor(i = 0; i < n; i++){\n\t\tscanf(\"%d\", &l);\n\t\tif(A[l-1] == 0) countpr++;\n\t\tA[l-1]++;\n\t}\n\t\n\tqsort(A, 100, sizeof(int), fun);\n\t\n\tcountmax = A[0];\n\t\n\tif(countmax < k) dish = 1;\n\t\n\telse if(countmax % k == 0) dish = countmax/k;\n\t\n\telse dish = (countmax/k)+1;\n\t\n\t//printf(\"dish = %d, countpr = %d\\n\", dish, countpr);\n\t\n\tprintf(\"%d\\n\", dish*countpr*k - n);\n\t\n\t//printf(\"%d\\n\", dish);\n\t\n\t//for(i = 0; i < 100; i++){\n\t//\tprintf(\"%d \", A[i]);\n\t//}\n\n\treturn 0;\n}\n"}, {"source_code": " #include\n#include\nint main()\n{\n\tint n ;\n\tint k; \n\tscanf(\"%d\",&n);\n\tscanf(\"%d\",&k);\n\tint* tab ;\n\ttab=malloc(n*sizeof(int));\n\tint i ; \n\tint inter[101]={0};\n\tint max=0 , out=0;\n\tfor(i=0;imax)\n\t\t{\n\t\t\tmax=inter[tab[i]];\n\t\t}\n\t}\n\twhile(max%k)\n\t{\n\t\tmax++;\n\t}\n\tfor(i=1;i<101;i++)\n\t{\n\t\tif(inter[i]!=0)\n\t\t{\n\t\tout+=max-inter[i];\n\t\t}\n\t}\n\tprintf(\"\\n%d\",out);\nreturn 0;\n}\n"}, {"source_code": "#include \n#include \n\n#define NUM_TYPES 100\n\nint main(int argc, char** argv){\n\tint n, k, uten;\n\tscanf(\"%d %d\", &n, &k);\n\tint num_types[NUM_TYPES];\n\tfor(int i = 0; i < NUM_TYPES; i++)\n\t\tnum_types[i] = 0;\n\tint num_distinct = 0;\n\tint num_dish = 0;\n\tfor(int i = 0; i < n; i++){\n\t\tscanf(\"%d\", &uten);\n\t\tif(!num_types[uten-1]++)\n\t\t\tnum_distinct++;\n\t\tif(num_types[uten-1] > k * num_dish)\n\t\t\tnum_dish++;\n\t}\n\n\t// Solve the problem\n\tint min_missing = (k * num_distinct * num_dish) - n;\t\n\tprintf(\"%d\\n\", min_missing);\n\n\treturn EXIT_SUCCESS;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n int uten,guest;\n scanf(\"%d%d\",&uten,&guest);\n int a[uten][2];\n for(int i=0;idishes)\n dishes=a[i][1];\n }\n dishes=((dishes/guest)+(dishes%guest?1:0))*guest;\n int stolen=0;\n for(int i=0;i\nint main(){\n\tint n,k,max=0;\n\tscanf(\"%d %d\",&n,&k);\n\tint used[101]={0},list[101]={0};\n\tfor(int i=1;i<=n;i++){\n\t\tscanf(\"%d\",&used[i]);\n\t\tlist[used[i]]+=1;\n\t}\n\tfor(int i=1;i<=100;i++){\n\t\tif(list[i]>=max)\n\t\t\tmax=list[i];\n\t}\n\n\tif((max%k)!=0){\n\t\tmax=(max/k)+1;\n\t\tmax*=k;\n\t}\n\tint stolen=0;\n\tfor(int i=1;i<=100;i++){\n\t\tif(list[i]!=0){\n\t\t\tstolen+=(max-list[i]);\n\t\t}\n\t}\n\tprintf(\"%d\\n\", stolen);\n\treturn 0;\n}\n"}, {"source_code": "#include \nint arr[100];\nint main()\n{\n\tint n,k,i,tmp,max=0,tp=0;\n\tscanf(\"%d %d\",&n,&k);\n\tfor(i=0;imax) max=arr[i];\n\t\t}\n\t}\n\tif(max%k) max=max/k+1;\n\telse max=max/k;\n\tprintf(\"%d\",max*tp*k-n);\n\t\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n,k,dem,max=0,z=0,i;\n scanf(\"%d%d\",&n,&k);\n if (n==0)\n printf(\"%d\",k);\n int a[n],b[n];\n for(i=0;imax)\n max=dem;\n }\n int kq,c,sodoi,sopt=1;\n for (i=0;ic)\n {\n c++;\n }\n kq=sopt*c*k-n;\n if (sopt==1 && (float)max/k==c)\n kq=0;\n printf(\"%d\",kq);\nreturn 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n int i, p, q=0, n, m=0, k, a[101]={};\n scanf(\"%d %d\", &n, &k);\n for(i=0; ia[i]?m:a[i];\n printf(\"%d\", (m+k-1)/k*k*q-n);\n}\n"}, {"source_code": "#include\n\nint main(void) {\n int n, k;\n int arr[105] ={0,};\n int max_i = 0;\n int cnt = 0;\n scanf(\"%d %d\", &n, &k);\n\n for(int i =0; i < n; i++) {\n int temp;\n scanf(\"%d\", &temp);\n arr[temp]++;\n if(arr[temp] == 1)\n cnt++;\n if( arr[temp] > arr[max_i])\n max_i = temp; \n }\n\n arr[max_i] += k-1;\n arr[max_i] /= k;\n\n printf(\"%d\", cnt * arr[max_i] * k - n);\n return 0;\n}\n\n"}], "negative_code": [{"source_code": "#include \"stdio.h\"\n#include \"string.h\"\n#include \"stdlib.h\"\n#include \"math.h\"\n\n#ifdef WIN32\n #define LLINT \"%I64d\"\n #define ULLINT \"%I64u\"\n#else\n#endif\n\n#define INT \"%d\"\n#define LINT \"%ld\"\n#define ULINT \"%lu\"\n#define SINT \"%hd\"\n#define USINT \"%hu\"\n#define STRING \"%s\"\n#define KITCHEN_SIZE 101\n\ntypedef long int LInt;\ntypedef unsigned long int ULInt;\ntypedef short int SInt;\ntypedef unsigned short int USInt;\ntypedef long long int LLInt;\ntypedef unsigned long long int ULLInt;\n\nint main()\n{\n int CurrentType = 0;\n int MaxRemained = 0;\n int UtensilsTypes[KITCHEN_SIZE] = { 0 };\n int GuestsCount = 0;\n int RemainedUtensils = 0;\n int DishesPerQuests = 0;\n int TypesCount = 0;\n \n scanf(INT INT, &RemainedUtensils, &GuestsCount);\n for (int i = 0; i < RemainedUtensils; i++)\n {\n scanf(INT, &CurrentType);\n \n if (UtensilsTypes[CurrentType] == 0)\n {\n TypesCount++;\n }\n \n UtensilsTypes[CurrentType]++;\n \n if (UtensilsTypes[CurrentType] > MaxRemained)\n {\n MaxRemained = UtensilsTypes[CurrentType];\n }\n }\n \n if (MaxRemained <= GuestsCount) \n {\n printf(LINT\"\\n\", (LInt)TypesCount * (LInt)GuestsCount - (LInt)RemainedUtensils);\n }\n else \n {\n DishesPerQuests += TypesCount / GuestsCount;\n if (TypesCount % GuestsCount)\n {\n DishesPerQuests++;\n }\n \n printf(LINT\"\\n\", (LInt)TypesCount * (LInt)GuestsCount * (LInt)DishesPerQuests - (LInt)RemainedUtensils);\n }\n \n\treturn 0;\n}\n"}, {"source_code": "#include \"stdio.h\"\n#include \"string.h\"\n#include \"stdlib.h\"\n#include \"math.h\"\n\n#ifdef WIN32\n #define LLINT \"%I64d\"\n #define ULLINT \"%I64u\"\n#else\n#endif\n\n#define INT \"%d\"\n#define LINT \"%ld\"\n#define ULINT \"%lu\"\n#define SINT \"%hd\"\n#define USINT \"%hu\"\n#define STRING \"%s\"\n#define KITCHEN_SIZE 101\n\ntypedef long int LInt;\ntypedef unsigned long int ULInt;\ntypedef short int SInt;\ntypedef unsigned short int USInt;\ntypedef long long int LLInt;\ntypedef unsigned long long int ULLInt;\n\nint main()\n{\n int CurrentType = 0;\n int MaxRemained = 0;\n int UtensilsTypes[KITCHEN_SIZE] = { 0 };\n int GuestsCount = 0;\n int RemainedUtensils = 0;\n int DishesPerQuests = 0;\n int TypesCount = 0;\n \n scanf(INT INT, &RemainedUtensils, &GuestsCount);\n for (int i = 0; i < RemainedUtensils; i++)\n {\n scanf(INT, &CurrentType);\n \n if (UtensilsTypes[CurrentType] == 0)\n {\n TypesCount++;\n }\n \n UtensilsTypes[CurrentType]++;\n \n if (UtensilsTypes[CurrentType] > MaxRemained)\n {\n MaxRemained = UtensilsTypes[CurrentType];\n }\n }\n \n if (MaxRemained <= GuestsCount) \n {\n printf(INT\"\\n\", TypesCount * GuestsCount - RemainedUtensils);\n }\n else \n {\n DishesPerQuests += TypesCount / GuestsCount;\n if (TypesCount % GuestsCount)\n {\n DishesPerQuests++;\n }\n \n printf(INT\"\\n\", TypesCount * GuestsCount * DishesPerQuests - RemainedUtensils);\n }\n \n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n\nint main()\n{\n unsigned int n,k,a[101],x[101]={0},d=0,min,i,count=0,sum=0;\n\n scanf(\"%u %u\",&n,&k);\n\n min=101;\n\n for(i=0;i0)\n count++;\n\n if(x[i]0)\n sum++;\n\n }\n\n\n d=sum*k*count-n;\n\n printf(\"%u\",d);\n\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n\nint main()\n{\n unsigned int n,k,a[101],x[101]={0},d=0,min,i,count=0;\n\n scanf(\"%u %u\",&n,&k);\n\n min=101;\n\n for(i=0;i0)\n count++;\n\n if(x[i]<=min && x[i]>0)\n min=x[i];\n }\n\n\n d=(k-min)*k*count-n;\n\n printf(\"%u\",d);\n\n\n return 0;\n}\n"}, {"source_code": "#include\n\nint main(void)\n{\n\tint nUtensil;\n\tint kGuest;\n\tint dNum = 1;\n\tint Dish = 1;\n\tint Type[100];\n\tint minimum;\n\tint temp = 1;\n\n\tscanf(\"%d %d\",&nUtensil,&kGuest);\n\n\tfor (int cnt = 0;cnt <= nUtensil-1;cnt++)\n\t{\n\t\tscanf(\"%d\",&Type[cnt]);\n\t}\n\n\tfor (int cnt1 = 0;cnt1 <= nUtensil -1;cnt1++)\n\t{\n\t\tfor (int cnt2 = cnt1+1;cnt2 <= nUtensil-1;cnt2++)\n\t\t{\n\t\t\tint temp;\n\t\t\tif (Type[cnt1]>Type[cnt2])\n\t\t\t{\n\t\t\t\ttemp = Type[cnt1];\n\t\t\t\tType[cnt1] = Type[cnt2];\n\t\t\t\tType[cnt2] = temp;\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (int cnt = 0;cnt <= nUtensil-2;cnt++)\n\t{\n\t\tif (Type[cnt] != Type[cnt+1])\n\t\t{\n\t\t\ttemp = 1;\n\t\t\tdNum++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ttemp++;\n\t\t}\n\n\t\tif ((temp-1)/kGuest+1 > Dish)\n\t\t{\n\t\t\tDish = (temp-1)/kGuest + 1;\n\t\t}\n\t}\n\n\tfor (int cnt = 0;cnt <= nUtensil-1;cnt++)\n\t{\n\t\tprintf(\"%d \",Type[cnt]);\n\t}\n\tminimum = kGuest*dNum*Dish - nUtensil;\n\tprintf(\"%d\",minimum);\n}"}, {"source_code": "#include\nint a[105]={0};\nint main()\n{\n\tint n,k,x,j,count;\n\tscanf(\"%d%d\",&n,&k);\n\tfor(int i=1;i<=n;i++)\n\t{\n\t\tscanf(\"%d\",&x);\n\t\ta[x]++;\n\t}\n\tint max=0;\n\tfor(int i=1;i<=n;i++)\n\tif(max\nint a[105]={0};\nint main()\n{\n\tint n,k,x,j,count=0;\n\tscanf(\"%d%d\",&n,&k);\n\tfor(int i=1;i<=n;i++)\n\t{\n\t\tscanf(\"%d\",&x);\n\t\ta[x]++;\n\t}\n\tint max=0;\n\tfor(int i=1;i<=n;i++)\n\tif(max\n\nint main()\n{\n int k_guests, // guests\n n_count_of_devices, // count of device\n types_of_devices; // type of device\n int c, device, flag, count_of_dishes;\n int arr_with_devices[100]; // arr with count of devices rewrite!\n\n scanf(\"%d\", &n_count_of_devices);\n if (!n_count_of_devices) // zero devices\n goto end;\n scanf(\"%d\", &k_guests);\n\n flag = types_of_devices = 0;\n count_of_dishes = device = 1;\n for (int i = 0; i < n_count_of_devices; i++) {\n scanf(\"%d\", &c);\n arr_with_devices[i] = c;\n for (int j = 0; j < i; j++)\n if (arr_with_devices[j] == c) {\n flag = 1;\n device++;\n }\n if (!flag)\n types_of_devices++; // new device founded\n else flag = 0;\n if (device > k_guests)\n count_of_dishes++;\n device = 1;\n }\n printf(\"%d\", count_of_dishes * k_guests * types_of_devices - n_count_of_devices);\n\nend:\n\n return 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int a,b=1,max=1,somonan,dem,n,k,i,mini;\n scanf(\"%d%d\",&n,&k);\n int array[n];\n for(i=0;iarray[i+1])\n {\n dem=array[i];\n array[i]=array[i+1];\n array[i+1]=dem;\n }\n }\n }\n dem=1;\n for(i=0;imax)\n {\n max=dem;\n }\n }\n else\n {\n b++;\n dem=1;\n }\n }\n if(max\n#include \n\nint main()\n{\n int a,b=1,max=1,somonan,dem,n,k,i,mini;\n scanf(\"%d%d\",&n,&k);\n int array[n];\n for(i=0;iarray[i+1])\n {\n dem=array[i];\n array[i]=array[i+1];\n array[i+1]=dem;\n }\n }\n }\n dem=1;\n for(i=0;imax)\n {\n max=dem;\n }\n }\n else\n {\n b++;\n dem=1;\n }\n }\n if(max\n#include \n\nint main()\n{\n int n,i,k=0;\n scanf(\"%d\",&n);\n int m[n];\n for(i=0;i\n#include \n\nint main()\n{\n int a,b=1,max=1,somonan,dem,n,k,i,mini;\n scanf(\"%d%d\",&n,&k);\n int array[n];\n for(i=0;iarray[i+1])\n {\n dem=array[i];\n array[i]=array[i+1];\n array[i+1]=dem;\n }\n }\n }\n dem=1;\n for(i=0;imax)\n {\n max=dem;\n }\n }\n else\n {\n b++;\n dem=1;\n }\n }\n if(max\nint min(int x,int y)\n{\n\tif(x>y) return y;\n\telse return x;\n}\nint main()\n{\n\tint utensil,guest,minimum=1e6,cnt=0,possible=1e6,flag=0;\n\tint i,temp;\n\tint remain[105]={0};\n\tscanf(\"%d%D\",&utensil,&guest);\n\tfor(i=1;i<=utensil;i++)\n\t{\n\t\tscanf(\"%d\",&temp);\n\t\tremain[temp]++;\n\t}\n\tfor(i=1;i<=100;i++)\n\t{\n\t\tif(remain[i]!=0)\n\t\t{\n\t\t\tcnt++;\n\t\t\tif(remain[i]<=guest) minimum=min(minimum,remain[i]);\n\t\t\telse if(remain[i]>guest)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\tpossible=min(possible,(remain[i]+guest-1)/guest);\n\t\t\t}\n\t\t}\n\t}\n\tif(flag) minimum=minimum+possible-min(minimum,possible);\n\tprintf(\"%d\",minimum*cnt*guest-utensil);\n\treturn 0;\n } \n"}, {"source_code": "#include\nint min(int x,int y)\n{\n\tif(x>y) return y;\n\telse return x;\n}\nint max(int x,int y)\n{\n\tif(x>y) return x;\n\telse return y;\n } \nint main()\n{\n\tint utensil,guest,minimum=1e6,cnt=0,possible=0,flag=0;\n\tint i,temp;\n\tint remain[105]={0};\n\tscanf(\"%d%D\",&utensil,&guest);\n\tfor(i=1;i<=utensil;i++)\n\t{\n\t\tscanf(\"%d\",&temp);\n\t\tremain[temp]++;\n\t}\n\tfor(i=1;i<=100;i++)\n\t{\n\t\tif(remain[i]!=0)\n\t\t{\n\t\t\tcnt++;\n\t\t\tif(remain[i]<=guest) minimum=min(minimum,remain[i]);\n\t\t\telse if(remain[i]>guest)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\tpossible=max(possible,(remain[i]+guest-1)/guest);\n\t\t\t}\n\t\t}\n\t}\n\tif(flag) minimum=max(minimum,flag*possible);\n\tprintf(\"%d\",minimum*cnt*guest-utensil);\n\treturn 0;\n } \n"}, {"source_code": "#include\n#include\nint main()\n{\n\tint n,k,max=0,temp,count=0,res,i=0,p;\n\tint utensil[101]={0};\n\tscanf(\"%d %d\",&n,&k);\n\twhile(imax)\n\t\t{\n\t\t\tmax=utensil[temp];\n\t\t}\n\t\ti++;\n\t}\n\tp=(max+k-1)/k;\n\tres=(p*count*k)+n;\n\tprintf(\"%d\",res);\nreturn 0;\n}"}, {"source_code": "#include \n#include \n#include \n\nint main() {\n int n, k;\n scanf(\"%d %d\", &n, &k);\n int arr[100] = {};\n int t;\n for (int i = 0; i < n; i++) {\n scanf(\"%d\", &t);\n arr[t % 100]++;\n }\n int ctr = 0;\n int __max = 0, temp;\n for (int i = 0; i < 100;i++) {\n if (arr[i]) {\n ctr++;\n temp = (arr[i] / k + ((arr[i] % k) > 0));\n printf(\"%d %d\\n\", arr[i], i);\n __max = __max > temp ? __max : temp;\n }\n }\n printf(\"%d\\n\", k * __max * ctr - n);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\n#define SIZE 100\n\nint main() {\n\tint n, k, a[SIZE + 1], size = 0, i, t, sum = 0, max = 0, j = 1, c = 1;\n\n\tscanf (\"%d %d\", &n, &k);\n\n\tmemset (a, 0, sizeof a[0] * SIZE);\n\n\tfor (i = 0; i < n; i++) {\n\t\tscanf (\"%d\", &t);\n\n\t\tif (t > size)\n\t\t\tsize = t;\n\n\t\ta[t]++;\n\t}\n\n\tfor (i = 1; i <= size; i++) \n\t\tif (a[i] != 0) \n\t\t\ta[j++] = a[i];\n\n\tsize = j - 1;\n\n\tfor (i = 1; i <= size; i++)\n\t\tif (a[i] > max)\n\t\t\tmax = a[i];\n\n\tif (max > k)\n\t\tc += (max - 1) / k;\n\t\n\tsum = k * size * c - n;\n\n\tprintf (\"%d\", sum);\n\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int a,b=1,max=1,somonan,dem,n,k,i,mini;\n scanf(\"%d%d\",&n,&k);\n int array[n];\n for(i=0;iarray[i+1])\n {\n dem=array[i];\n array[i]=array[i+1];\n array[i+1]=dem;\n }\n }\n }\n dem=1;\n for(i=0;imax)\n {\n max=dem;\n }\n }\n else\n {\n b++;\n dem=1;\n }\n }\n if(max\n#include \n int main ()\n {\n int n=0,k=0,c=0,d=0,i=0,s=0,somonan=0,temp,m[1000];\n scanf(\"%d%d\",&n,&k);\n for(i=0;im[c+1])\n {\n temp=m[c];\n m[c]=m[c+1];\n m[c+1]=temp;\n }\n }\n }\n c=0,temp=1;\n for(i=0;ic)\n {\n c=temp;\n }\n temp=1;\n }\n }\n if(c\n\nint\nmain(void)\n{\n\t//freopen(\"input.txt\", \"r\", stdin);\n\tint a[100];\n\tint cnt[100] = { 0, };\n\tfor (int i = 0; i < 100; i++) {\n\t\tcnt[i] = 0;\n\t}\n\tint n, k;\n\tscanf(\"%d %d\", &n, &k);\n\tfor (int i = 0; i < n; i++) {\n\t\tscanf(\"%d\", &a[i]);\n\t}\n\n\t// max # of array\n\tint max = 0;\n\tfor (int i = 0; i < n; i++) {\n\t\tif (max < a[i]) {\n\t\t\tmax = a[i];\n\t\t}\n\t}\n\n\tfor (int i = 0; i < n; i++) {\n\t\tcnt[a[i]]++;\n\t}\n\tint f_max = 0;\n\tfor (int i = 0; i < n; i++) {\n\t\tif (f_max < cnt[i]) {\n\t\t\tf_max = cnt[i];\n\t\t}\n\t}\n\n\tint num_type = 0;\n\tfor (int i = 0; i < n; i++) {\n\t\tif (cnt[i] != 0) {\n\t\t\tnum_type++;\n\t\t}\n\t}\n\tint num_dish = (f_max + k - 1) % k;\n\n\n\n\tint res = num_dish * k * num_type - n;\n\tprintf(\"%d\\n\", res);\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint n,k,i,j,maxm,d,u=0,r;\n\tscanf(\"%d%d\",&n,&k);\n\tint a[n],c[100]={0};\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tj=a[i];\n\t\tc[j]++;\n\t}\n\tmaxm=c[1];\n\tfor(i=1;i<=100;i++)\n\t{\n\t\tif(c[i]!=0)\n\t\t{\n\t\t\tu++;\n\t\t}\n\t\tif(c[i]>maxm)\n\t\t{\n\t\t\tmaxm=c[i];\n\t\t}\n\t}\n\td=(maxm-1)/k+1;\n\tr=k*d*u-n;\n\tprintf(\"%d\",r);\n\treturn 0;\n}\n"}, {"source_code": " #include\n#include\nint main()\n{\n\tint n ;\n\tint k; \n\tprintf(\"donner le nombre de reamining utensels : \");\n\tscanf(\"%d\",&n);\n\tprintf(\"donner le nombre de guest\");\n\tscanf(\"%d\",&k);\n\tint* tab ;\n\ttab=malloc(n*sizeof(int));\n\tint i ; \n\tint inter[101]={0};\n\tint max=0 , out=0;\n\tfor(i=0;imax)\n\t\t{\n\t\t\tmax=inter[tab[i]];\n\t\t}\n\t}\n\twhile(max%k)\n\t{\n\t\tmax++;\n\t}\n\tfor(i=1;i<101;i++)\n\t{\n\t\tif(inter[i]!=0)\n\t\t{\n\t\tout+=max-inter[i];\n\t\t}\n\t}\n\tprintf(\"\\n%d\",out);\nreturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n,k,dem,max=0,z=0,i;\n scanf(\"%d%d\",&n,&k);\n if (n==0)\n printf(\"%d\",k);\n int a[n],b[n];\n for(i=0;imax)\n max=dem;\n }\n int kq,c,sodoi,sopt=1;\n for (i=0;ik)\n {\n c=max/k;\n if ((float)max/k>0)\n c++;\n kq=sopt*c*k-n;\n }\n printf(\"%d\",kq);\nreturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n,k,dem,max=0,z=0,i;\n scanf(\"%d%d\",&n,&k);\n if (n==0)\n printf(\"%d\",k);\n int a[n],b[n];\n for(i=0;imax)\n max=dem;\n }\n int kq,c,sodoi,sopt=1;\n for (i=0;i=k)\n {\n c=max/k;\n if ((float)max/k>0)\n {\n c++;\n kq=sopt*c*k-n;\n }\n kq=0;\n }\n printf(\"%d\",kq);\nreturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n,k,dem,max=0,z=0,i;\n scanf(\"%d%d\",&n,&k);\n if (n=0)\n printf(\"%d\",k);\n int a[n],b[n];\n for(i=0;imax)\n max=dem;\n }\n int kq,c,sodoi,sopt=1;\n for (i=0;ik)\n {\n c=max/k;\n if ((float)max/k>0)\n c++;\n kq=sopt*c*k-n;\n }\n printf(\"%d\",kq);\nreturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n,k,dem,max=0,z=0,i;\n scanf(\"%d%d\",&n,&k);\n if (n==0)\n printf(\"%d\",k);\n int a[n],b[n];\n for(i=0;imax)\n max=dem;\n }\n int kq,c,sodoi,sopt=1;\n for (i=0;ic)\n {\n c++;\n kq=sopt*c*k-n;\n }\n if (sopt==1 && (float)max/k==c)\n kq=0;\n printf(\"%d\",kq);\nreturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n,k,dem,max=0,z=0,i;\n scanf(\"%d%d\",&n,&k);\n if (n==0)\n printf(\"%d\",k);\n int a[n],b[n];\n for(i=0;imax)\n max=dem;\n }\n int kq,c,sodoi,sopt=1;\n for (i=0;i=k)\n {\n c=max/k;\n if ((float)max/k>c)\n {\n c++;\n kq=sopt*c*k-n;\n }\n }\n if (sopt==1 && (float)max/k==c)\n kq=0;\n printf(\"%d\",kq);\nreturn 0;\n}\n"}], "src_uid": "c03ff0bc6a8c4ce5372194e8ea18527f"} {"nl": {"description": "Unlucky year in Berland is such a year that its number n can be represented as n = xa + yb, where a and b are non-negative integer numbers. For example, if x = 2 and y = 3 then the years 4 and 17 are unlucky (4 = 20 + 31, 17 = 23 + 32 = 24 + 30) and year 18 isn't unlucky as there is no such representation for it.Such interval of years that there are no unlucky years in it is called The Golden Age.You should write a program which will find maximum length of The Golden Age which starts no earlier than the year l and ends no later than the year r. If all years in the interval [l, r] are unlucky then the answer is 0.", "input_spec": "The first line contains four integer numbers x, y, l and r (2 ≤ x, y ≤ 1018, 1 ≤ l ≤ r ≤ 1018).", "output_spec": "Print the maximum length of The Golden Age within the interval [l, r]. If all years in the interval [l, r] are unlucky then print 0.", "sample_inputs": ["2 3 1 10", "3 5 10 22", "2 3 3 5"], "sample_outputs": ["1", "8", "0"], "notes": "NoteIn the first example the unlucky years are 2, 3, 4, 5, 7, 9 and 10. So maximum length of The Golden Age is achived in the intervals [1, 1], [6, 6] and [8, 8].In the second example the longest Golden Age is the interval [15, 22]."}, "positive_code": [{"source_code": "#include \n#include \n#include\nlong long Veci(long long a,long long b)\n{\n if (a>b)\n return a;\n else return b;\n}\nvoid swap(long long* a,long long* b)\n{\n long long c;\n c=*a;\n *a=*b;\n *b=c;\n}\nlong long Partition(long long *A, long long left, long long right)\n{\n long long pivot = A[right], i = left, x;\n\n for (x = left; x < right; x++){\n if (A[x] <= pivot){\n swap(&A[i], &A[x]);\n i++;\n }\n }\n\n swap(&A[i], &A[right]);\n return i;\n}\nvoid QuickSort(long long Niz[],long long Levo,long long Desno)\n{\n if(Levo=l)\n br2++;\n }\n if (br2==0)\n printf(\"%lld\",r-l+1);\n else if (br2==r-l+1)\n printf(\"0\");\n else {\n QuickSort(C,0,br2-1);\n for(i=1;iraz)\n raz=praz;\n }\n if (l!=C[0])\n raz=Veci(C[0]-l,raz);\n if (r!=C[br2-1])\n raz=Veci(r-C[br2-1],raz);\n printf(\"%lld\",raz);\n }\n long long x;\n return 0;\n}\n"}, {"source_code": "#include \ntypedef long long ll;\n#define MAXN 65\nvoid insertSort(ll* arr, int N) {\n for (int i = 1; i < N; ++i) {\n int j = i - 1;\n ll v = arr[i];\n for ( ; j >= 0 && v < arr[j]; --j)\n arr[j + 1] = arr[j];\n arr[j + 1] = v;\n }\n}\nll a1[MAXN], a2[MAXN], s[MAXN * MAXN];\nint main() {\n ll x, y, l, r;\n scanf(\"%I64d%I64d%I64d%I64d\", &x, &y, &l, &r);\n int N = 0;\n int sz1 = 0, sz2 = 0;\n ll t;\n for (t = 1; t <= r / x; t *= x)\n a1[sz1++] = t;\n a1[sz1++] = t;\n for (t = 1; t <= r / y; t *= y)\n a2[sz2++] = t;\n a2[sz2++] = t;\n for (int i = 0; i < sz1; ++i)\n for (int j = 0; j < sz2; ++j)\n if (a1[i] + a2[j] >= l && a1[i] + a2[j] <= r)\n s[N++] = a1[i] + a2[j];\n s[N++] = l - 1;\n s[N++] = r + 1;\n insertSort(s, N);\n ll ans = 0;\n for (int i = 1; i < N; ++i)\n if (ans < s[i] - s[i - 1] - 1) ans = s[i] - s[i - 1] - 1;\n printf(\"%I64d\\n\", ans);\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \ntypedef long long ll;\nll MIN = 1111111111111111111;\nll MAX = -1111111111111111111;\nll max = -1111111111111111111;\n\n\n\nvoid merge(ll arr[], ll l, ll m, ll r) \n{ \n\tll i, j, k; \n\tll n1 = m - l + 1; \n\tll n2 = r - m; \n\n\t/* create temp arrays */\n\tll L[n1], R[n2]; \n\n\t/* Copy data to temp arrays L[] and R[] */\n\tfor (i = 0; i < n1; i++) \n\t\tL[i] = arr[l + i]; \n\tfor (j = 0; j < n2; j++) \n\t\tR[j] = arr[m + 1+ j]; \n\n\t/* Merge the temp arrays back llo arr[l..r]*/\n\ti = 0; // Initial index of first subarray \n\tj = 0; // Initial index of second subarray \n\tk = l; // Initial index of merged subarray \n\twhile (i < n1 && j < n2) \n\t{ \n\t\tif (L[i] <= R[j]) \n\t\t{ \n\t\t\tarr[k] = L[i]; \n\t\t\ti++; \n\t\t} \n\t\telse\n\t\t{ \n\t\t\tarr[k] = R[j]; \n\t\t\tj++; \n\t\t} \n\t\tk++; \n\t} \n\n\t/* Copy the remaining elements of L[], if there \n\t are any */\n\twhile (i < n1) \n\t{ \n\t\tarr[k] = L[i]; \n\t\ti++; \n\t\tk++; \n\t} \n\n\t/* Copy the remaining elements of R[], if there \n\t are any */\n\twhile (j < n2) \n\t{ \n\t\tarr[k] = R[j]; \n\t\tj++; \n\t\tk++; \n\t} \n} \n\n/* l is for left index and r is right index of the \n sub-array of arr to be sorted */\nvoid mergeSort(ll arr[], ll l, ll r) \n{ \n\tif (l < r) \n\t{ \n\t\t// Same as (l+r)/2, but avoids overflow for \n\t\t// large l and h \n\t\tll m = l+(r-l)/2; \n\n\t\t// Sort first and second halves \n\t\tmergeSort(arr, l, m); \n\t\tmergeSort(arr, m+1, r); \n\n\t\tmerge(arr, l, m, r); \n\t} \n} \n\n\nll power(ll x, ll 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}\n\nll kitna(ll a)\n{\n\tll count = 1;\n\tll temp = a;\n\twhile(temp<1000000000000000000&&(1000000000000000000/temp>a))\n\t{\n\ttemp*=a ;\n\tcount++;\n\t}\n\treturn count;\n}\n\nint main(ll argc, char const *argv[])\n{\n\tll T;\n\t// scanf(\"%lld\",&T);\n\tT = 1;\n\t// printf(\"%lld %lld %lld\",MIN,MAX,max);\n//\t printf(\"%lld\\n\",kitna(510000000000));\n\tll x,y,l,r ;\n//\tprintf(\"%lld\\n\",kitna(2));\n\tscanf(\"%lld %lld %lld %lld\",&x,&y,&l,&r);\n\tll o = l;\n\tll xcountl = -1;\n\twhile(o)\n\t{\n\t\txcountl++;\n\t\to = o/x ;\n\t}\n\n\tll p = r;\n\tll xcountr = 0;\n\twhile(p)\n\t{\n\t\txcountr++;\n\t\tp = p/x;\n\t}\n\tll e = r;\n\tll ycountr = 0;\n\twhile(e)\n\t{\n\t\tycountr++;\n\t\te = e/y;\n\t}\n\tll qw = l;\n\tll ycountl = -1;\n\twhile(qw)\n\t{\n\t\tycountl++;\n\t\tqw = qw/y;\n\t}\n\n//\tprintf(\"%lld %lld\\n\",xcountl,xcountr);\n\t// printf(\"%lldchck\",power(x,2));\n\tll totalcount = 0;\n\tll A[1000000];\n\tll idx = 0;\n\tfor(ll s=xcountl;skya%lld?\",A[idx]);\n\n\t\t\tA[idx] = power(y,u)+power(x,s) ;\n//\t\t\tprintf(\"n%lldn\",A[idx]);\n\n\t\t\tif(A[idx]>MAX)\n\t\t\t\tMAX = A[idx] ;\n\t\t\tif(A[idx]MAX)\n\t\t\t\tMAX = A[idx] ;\n\t\t\tif(A[idx]max&&A[sd]>0&&A[sd-1]>0)\n\t\t\tmax = A[sd]-A[sd-1]-1 ;\n\t\t// if(max<0)max=0;\n\t}\n\tll finalanswer = 0;\n\tll left = MIN-l;\n\tif(left<0)left = 0;\n\tll right = r-MAX;\n\tif(right<0)right = 0;\n//\tprintf(\"l %lld r %lld %lld|\",left,right,max);\n\tif(left>right)\n\t{\n\t\tif(left>max)\n\t\t{\n\t\t\tfinalanswer = left;\n\t\t}\n\t\telse \n\t\t{\n\t\t\tfinalanswer = max ;\n\t\t}\n\t}\n\telse \n\t{\n\t\tif(right>max)\n\t\t{\n\t\t\tfinalanswer = right;\n\t\t}\n\t\telse \n\t\t{\n\t\t\tfinalanswer = max ;\n\t\t}\n\t}\n\t// printf(\"<%lld>\",totalcount);\n\tif(totalcount==0)\n\t{\n\t\tfinalanswer = r-l+1 ;\n\t}\n\tif(l==1)\n\t{\n\t\tif(r-l+1-totalcount==0)\n\t\t\tprintf(\"0\\n\");\n\t\telse\n\t\t{printf(\"%lld\\n\",finalanswer);}\n\t}\n\n\telse{\n\t\tif(r-l+1-totalcount==0)\n\t\t\tprintf(\"0\\n\");\n\t\telse\n\t\t{ printf(\"%lld\\n\",finalanswer);}\n\t}\n\n\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\nlong long int check=1000000000000000000;\nvoid merge(long long int arr_1[],long long int arr_2[],int size,long long 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=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(long long int a[],int start,int end,long long int a_1[])\n {\n \tif(end=x[i])\n\t\t{\n\t\ta[k++]=x[i]+y[j];\n\t\t//printf(\"%lld \",a[k-1]);\n\t\t}\n\t}\n}\n//printf(\"\\n\");\nlong long int a_1[k];\nmerge_sort(a,0,k-1,a_1);\n//for(int i=0;ians)\n\tans=a_1[j]-prev-1;\n\t//printf(\"%lld %lld %lld\\n\",a_1[j],prev,ans);\n\tprev=a_1[j];\n\tj++;\n}\nif(r-prev>ans)\nans=r-prev;\nprintf(\"%I64d\",ans);\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n#include \n#define MOD 1000000007\n#define ll long long\n\nll cmpfunc(const void *a, const void *b){\n return (*(ll*)a - *(ll*)b);\n}\n\nint max(int a,int b){\n return (a>b)?a:b;\n}\n\nll power(ll x,ll y){\n ll ans=1;\n for(ll i=0;ir-power(y,j)) continue;\n ll sum=(ll)power(x,i)+(ll)power(y,j);\n if(sum>=l){\n //printf(\"sum=%lld\\n\",sum);\n un[count]=sum;\n count++;\n }\n }\n }\n //printf(\"count=%lld\\n\",count);\n if(count==0){\n printf(\"%lld\\n\",r-l+1);\n return 0;\n }\n ll unlucky[count];\n for(i=0;i 0 && unlucky[d1] < unlucky[d1-1]) {\n t = unlucky[d1];\n unlucky[d1] = unlucky[d1-1];\n unlucky[d1-1] = t;\n\n d1--;\n }\n }\n\n\n //for(i=0;imax) max=unlucky[i+1]-unlucky[i]-1;\n }\n //printf(\"%lld %lld\\n\",max,r-unlucky[count-1]);\n if(r-unlucky[count-1]>max) max=r-unlucky[count-1];\n if(unlucky[0]-l>max) max=unlucky[0]-l;\n\n printf(\"%lld\\n\",max);\n\n return 0;\n}\n"}, {"source_code": "#include\n\ntypedef unsigned long long int lli;\n\nvoid msort(lli a[], int s, int e)\n{\n if(e-s!=0)\n {\n msort(a, s, (s+e)/2);\n msort(a, (s+e)/2 + 1, e);\n }\n else\n return;\n lli b[e-s+1];\n int i=s, j=(s+e)/2 + 1, n;\n for(n=0; i<=(s+e)/2 && j<=e;n++)\n {\n if(a[i]<=a[j])\n b[n]=a[i++];\n else\n b[n]=a[j++];\n }\n if(i<=(s+e)/2)\n for(;i<=(s+e)/2;i++, n++)\n b[n] = a[i];\n else\n for(;j<=e;j++,n++)\n b[n]=a[j];\n for(i=0;i19)\n return 1;\n return 0;\n}\n\nint main()\n{\n lli i,j,ele;\n lli x,y,l,r;\n lli a[100000], b[100000];\n scanf(\"%llu %llu %llu %llu\", &x, &y, &l, &r);\n if(yr)\n {\n break;\n }\n a[ind++] = ele;\n \n // printf(\"%llu \", ele);\n\n\n }\n // putchar('\\n');\n }\n\n ct=0;\n for(i=0;i=l && a[i]<=r)\n b[ct++] = a[i];\n\n b[ct++] = l-1;\n b[ct++] = r+1;\n\n msort(b, 0, ct-1);\n/*\n for(i=0;imxdif)\n {\n mxdif = b[i+1]-b[i];\n // printf(\"%lld %lld %lld\\n\",b[i], b[i+1], i);\n }\n }\n printf(\"%llu\\n\", mxdif-1);\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n\n#define MAX 1000010\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nvoid fft(long long n, long long* ar){\n long long i, j, x, g = n, flag = 0;\n while (((g != 1) || flag) && n > 1){\n flag = 0;\n if (g != 1) g *= 0.77425;\n\n for (i = 0; (i + g) < n; i++){\n if (ar[i] > ar[i + g]){\n flag = 1;\n x = ar[i], ar[i] = ar[i + g], ar[i + g] = x;\n }\n }\n }\n}\n\nlong long n, x, y, l, r, a, b, A[MAX], B[MAX], ar[MAX];\n\nlong long generate(long long b, long long* ar){\n long double p = 1.0;\n long long i, j, x = 1, len = 0;\n\n while (p < 2e18 && x <= (1LL << 60)){\n ar[len++] = x;\n p *= b, x *= b;\n }\n return len;\n}\n\nint main(){\n long long i, j, k, u, v, w, res, prev;\n\n while (scanf(\"%lld %lld %lld %lld\", &x, &y, &l, &r) != EOF){\n a = generate(x, A);\n b = generate(y, B);\n\n clr(ar);\n n = 0, res = 0, prev = 1;\n for (i = 0; i < a; i++){\n for (j = 0; j < b; j++){\n ar[n++] = A[i] + B[j];\n }\n }\n ar[n++] = 0, ar[n++] = 1LL << 61;\n fft(n, ar);\n\n for (i = 1; i < n; i++){\n u = ar[i - 1] + 1, v = ar[i] - 1;\n if (u <= v){\n if (u < l) u = l;\n if (v > r) v = r;\n if ((v - u + 1) > res) res = v - u + 1;\n }\n }\n\n printf(\"%lld\\n\", res);\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint compare(const void *a, const void *b) {\n\tlong long ia = *(long long *) a;\n\tlong long ib = *(long long *) b;\n\n\treturn ia == ib ? 0 : ia < ib ? -1 : 1;\n}\n\nint main() {\n\tstatic long long aa[100000];\n\tlong long x, y, l, r, a, b, max;\n\tint k, i;\n\n\tscanf(\"%lld%lld%lld%lld\", &x, &y, &l, &r);\n\tk = 0;\n\tfor (a = 1; ; a *= x) {\n\t\tfor (b = 1; ; b *= y) {\n\t\t\tif (a + b >= l && a + b <= r)\n\t\t\t\taa[k++] = a + b;\n\t\t\tif ((double) b * y >= 1e18)\n\t\t\t\tbreak;\n\t\t}\n\t\tif ((double) a * x >= 1e18)\n\t\t\tbreak;\n\t}\n\taa[k++] = l - 1;\n\taa[k++] = r + 1;\n\tqsort(aa, k, sizeof *aa, compare);\n\tmax = 0;\n\tfor (i = 1; i < k; i++)\n\t\tif (max < aa[i] - aa[i - 1] - 1)\n\t\t\tmax = aa[i] - aa[i - 1] - 1;\n\tprintf(\"%lld\\n\", max);\n\treturn 0;\n}\n"}], "negative_code": [{"source_code": "#include \n#include \nlong long Veci(long long a,long long b)\n{\n if (a>b)\n return a;\n else return b;\n}\nvoid swap(long long* a,long long* b)\n{\n long long c;\n c=*a;\n *a=*b;\n *b=c;\n}\nlong long Partition(long long *A, long long left, long long right)\n{\n long long pivot = A[right], i = left, x;\n\n for (x = left; x < right; x++){\n if (A[x] <= pivot){\n swap(&A[i], &A[x]);\n i++;\n }\n }\n\n swap(&A[i], &A[right]);\n return i;\n}\nvoid QuickSort(long long Niz[],long long Levo,long long Desno)\n{\n if(Levo=l)\n br2++;\n }\n if (br2==0)\n printf(\"%i\",l-r+1);\n else if (br2==l-r+1)\n printf(\"0\");\n else {\n QuickSort(C,0,br2-1);\n for(i=1;iraz)\n raz=praz;\n }\n if (l!=C[0])\n raz=Veci(C[0]-l,raz);\n if (r!=C[br2-1])\n raz=Veci(r-C[br2-1],raz);\n }\n printf(\"%lld\",raz);\n return 0;\n}\n"}, {"source_code": "#include \n#include \nlong long Veci(long long a,long long b)\n{\n if (a>b)\n return a;\n else return b;\n}\nvoid swap(long long* a,long long* b)\n{\n long long c;\n c=*a;\n *a=*b;\n *b=c;\n}\nlong long Partition(long long *A, long long left, long long right)\n{\n long long pivot = A[right], i = left, x;\n\n for (x = left; x < right; x++){\n if (A[x] <= pivot){\n swap(&A[i], &A[x]);\n i++;\n }\n }\n\n swap(&A[i], &A[right]);\n return i;\n}\nvoid QuickSort(long long Niz[],long long Levo,long long Desno)\n{\n if(Levo=l)\n br2++;\n }\n if (br2==0)\n printf(\"%i\",l-r+1);\n else if (br2==l-r+1)\n printf(\"0\");\n else {\n QuickSort(C,0,br2-1);\n for(i=1;iraz)\n raz=praz;\n }\n if (l!=C[0])\n raz=Veci(C[0]-l,raz);\n if (r!=C[br2-1])\n raz=Veci(r-C[br2-1],raz);\n printf(\"%lld\",raz);\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include\nlong long Veci(long long a,long long b)\n{\n if (a>b)\n return a;\n else return b;\n}\nvoid swap(long long* a,long long* b)\n{\n long long c;\n c=*a;\n *a=*b;\n *b=c;\n}\nlong long Partition(long long *A, long long left, long long right)\n{\n long long pivot = A[right], i = left, x;\n\n for (x = left; x < right; x++){\n if (A[x] <= pivot){\n swap(&A[i], &A[x]);\n i++;\n }\n }\n\n swap(&A[i], &A[right]);\n return i;\n}\nvoid QuickSort(long long Niz[],long long Levo,long long Desno)\n{\n if(Levo=l)\n br2++;\n }\n if (br2==0)\n printf(\"%lld\",r-l+1);\n else if (br2==r-l+1)\n printf(\"0\");\n else {\n QuickSort(C,0,br2-1);\n for(i=1;iraz)\n raz=praz;\n }\n if (l!=C[0])\n raz=Veci(C[0]-l,raz);\n if (r!=C[br2-1])\n raz=Veci(r-C[br2-1],raz);\n printf(\"%lld\",raz);\n }\n long long x;\n return 0;\n}\n"}, {"source_code": "#include \n#include \nlong long Veci(long long a,long long b)\n{\n if (a>b)\n return a;\n else return b;\n}\nvoid swap(long long* a,long long* b)\n{\n long long c;\n c=*a;\n *a=*b;\n *b=c;\n}\nlong long Partition(long long *A, long long left, long long right)\n{\n long long pivot = A[right], i = left, x;\n\n for (x = left; x < right; x++){\n if (A[x] <= pivot){\n swap(&A[i], &A[x]);\n i++;\n }\n }\n\n swap(&A[i], &A[right]);\n return i;\n}\nvoid QuickSort(long long Niz[],long long Levo,long long Desno)\n{\n if(Levo=l)\n br2++;\n }\n if (br2==0)\n printf(\"%lld\",r-l+1);\n else if (br2==r-l+1)\n printf(\"0\");\n else {\n QuickSort(C,0,br2-1);\n for(i=1;iraz)\n raz=praz;\n }\n if (l!=C[0])\n raz=Veci(C[0]-l,raz);\n if (r!=C[br2-1])\n raz=Veci(r-C[br2-1],raz);\n printf(\"%lld\",raz);\n }\n long long x;\n return 0;\n}\n"}, {"source_code": "#include \n#include \nlong long Veci(long long a,long long b)\n{\n if (a>b)\n return a;\n else return b;\n}\nvoid swap(long long* a,long long* b)\n{\n long long c;\n c=*a;\n *a=*b;\n *b=c;\n}\nlong long Partition(long long *A, long long left, long long right)\n{\n long long pivot = A[right], i = left, x;\n\n for (x = left; x < right; x++){\n if (A[x] <= pivot){\n swap(&A[i], &A[x]);\n i++;\n }\n }\n\n swap(&A[i], &A[right]);\n return i;\n}\nvoid QuickSort(long long Niz[],long long Levo,long long Desno)\n{\n if(Levo=l)\n br2++;\n }\n if (br2==0)\n printf(\"%lld\",r-l+1);\n else if (br2==l-r+1)\n printf(\"0\");\n else {\n QuickSort(C,0,br2-1);\n for(i=1;iraz)\n raz=praz;\n }\n if (l!=C[0])\n raz=Veci(C[0]-l,raz);\n if (r!=C[br2-1])\n raz=Veci(r-C[br2-1],raz);\n printf(\"%lld\",raz);\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \nlong long Veci(long long a,long long b)\n{\n if (a>b)\n return a;\n else return b;\n}\nvoid swap(long long* a,long long* b)\n{\n long long c;\n c=*a;\n *a=*b;\n *b=c;\n}\nlong long Partition(long long *A, long long left, long long right)\n{\n long long pivot = A[right], i = left, x;\n\n for (x = left; x < right; x++){\n if (A[x] <= pivot){\n swap(&A[i], &A[x]);\n i++;\n }\n }\n\n swap(&A[i], &A[right]);\n return i;\n}\nvoid QuickSort(long long Niz[],long long Levo,long long Desno)\n{\n if(Levo=l)\n br2++;\n }\n if (br2==0)\n printf(\"%i\",r-l+1);\n else if (br2==l-r+1)\n printf(\"0\");\n else {\n QuickSort(C,0,br2-1);\n for(i=1;iraz)\n raz=praz;\n }\n if (l!=C[0])\n raz=Veci(C[0]-l,raz);\n if (r!=C[br2-1])\n raz=Veci(r-C[br2-1],raz);\n printf(\"%lld\",raz);\n }\n return 0;\n}\n"}, {"source_code": "#include \ntypedef long long ll;\n#define MAXN 65\nvoid insertSort(ll* arr, int N) {\n for (int i = 1; i < N; ++i) {\n int j = i - 1;\n ll v = arr[i];\n for ( ; j >= 0 && v < arr[j]; --j)\n arr[j + 1] = arr[j];\n arr[j + 1] = v;\n }\n}\nll a1[MAXN], a2[MAXN], s[MAXN * MAXN];\nint main() {\n ll x, y, l, r;\n scanf(\"%I64d%I64d%I64d%I64d\", &x, &y, &l, &r);\n int N = 0;\n int sz1 = 0, sz2 = 0;\n ll t;\n for (t = 1; t <= r / x; t *= x)\n a1[sz1++] = t;\n a1[sz1++] = t;\n for (t = 1; t <= r / y; t *= y)\n a2[sz2++] = t;\n a2[sz1++] = t;\n for (int i = 0; i < sz1; ++i)\n for (int j = 0; j < sz2; ++j)\n if (a1[i] + a2[j] >= l && a1[i] + a2[j] <= r)\n s[N++] = a1[i] + a2[j];\n s[N++] = l - 1;\n s[N++] = r + 1;\n insertSort(s, N);\n ll ans = 0;\n for (int i = 1; i < N; ++i)\n if (ans < s[i] - s[i - 1] - 1) ans = s[i] - s[i - 1] - 1;\n printf(\"%I64d\\n\", ans);\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \ntypedef long long ll;\nll MIN = 1111111111111111111;\nll MAX = -1111111111111111111;\nll max = -1111111111111111111;\n\n\nvoid merge(ll arr[], ll l, ll m, ll r) \n{ \n ll i, j, k; \n ll n1 = m - l + 1; \n ll n2 = r - m; \n \n /* create temp arrays */\n ll L[n1], R[n2]; \n \n /* Copy data to temp arrays L[] and R[] */\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 /* Merge the temp arrays back llo arr[l..r]*/\n i = 0; // Initial index of first subarray \n j = 0; // Initial index of second subarray \n k = l; // Initial index of merged subarray \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 \n /* Copy the remaining elements of L[], if there \n are any */\n while (i < n1) \n { \n arr[k] = L[i]; \n i++; \n k++; \n } \n \n /* Copy the remaining elements of R[], if there \n are any */\n while (j < n2) \n { \n arr[k] = R[j]; \n j++; \n k++; \n } \n} \n \n/* l is for left index and r is right index of the \n sub-array of arr to be sorted */\nvoid mergeSort(ll arr[], ll l, ll r) \n{ \n if (l < r) \n { \n // Same as (l+r)/2, but avoids overflow for \n // large l and h \n ll m = l+(r-l)/2; \n \n // Sort first and second halves \n mergeSort(arr, l, m); \n mergeSort(arr, m+1, r); \n \n merge(arr, l, m, r); \n } \n} \n \n\nll power(ll x, ll y) \n{ \n if (y == 0) \n return 1; \n else if (y%2 == 0) \n return power(x, y/2)*power(x, y/2); \n else\n return x*power(x, y/2)*power(x, y/2); \n}\n\nint main(ll argc, char const *argv[])\n{\n ll T;\n // scanf(\"%lld\",&T);\n T = 1;\n for (ll i = 0; i < T; i++)\n {\n ll x,y,l,r ;\n scanf(\"%lld %lld %lld %lld\",&x,&y,&l,&r);\n ll o = l;\n ll xcountl = -1;\n while(o)\n {\n xcountl++;\n o = o/x ;\n }\n\n ll p = r;\n ll xcountr = 0;\n while(p)\n {\n xcountr++;\n p = p/x;\n }\n ll e = r;\n ll ycountr = 0;\n while(e)\n {\n ycountr++;\n e = e/y;\n }\n ll qw = l;\n ll ycountl = -1;\n while(qw)\n {\n ycountl++;\n qw = qw/y;\n }\n \n // printf(\"%lld %lld\\n\",xcountl,ycountl);\n\n ll totalcount = 0;\n ll A[1000000];\n ll idx = 0;\n for(ll s=xcountl;sMAX)\n MAX = A[idx] ;\n if(A[idx]MAX)\n MAX = A[idx] ;\n if(A[idx]max)\n max = A[sd]-A[sd-1]-1 ;\n // if(max<0)max=0;\n }\n ll finalanswer = 0;\n ll left = MIN-l;\n if(left<0)left = 0;\n ll right = r-MAX;\n if(right<0)right = 0;\n /* printf(\"l %lld r %lld %lld|\",left,right,max);*/\n if(left>right)\n {\n if(left>max)\n {\n finalanswer = left;\n }\n else \n {\n finalanswer = max ;\n }\n }\n else \n {\n if(right>max)\n {\n finalanswer = right;\n }\n else \n {\n finalanswer = max ;\n }\n }\n // printf(\"<%lld>\",totalcount);\n if(totalcount==0)\n {\n finalanswer = r-l+1 ;\n }\n if(l==1)\n {\n if(r-l+1-totalcount==0)\n printf(\"0\\n\");\n else\n {printf(\"%lld\\n\",finalanswer);}\n }\n\n else{\n if(r-l+1-totalcount==0)\n printf(\"0\\n\");\n else\n { printf(\"%lld\\n\",finalanswer);}\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \ntypedef long long ll;\nll MIN = 1111111111111111111;\nll MAX = -1111111111111111111;\nll max = -1111111111111111111;\n\n\nvoid merge(ll arr[], ll l, ll m, ll r) \n{ \n ll i, j, k; \n ll n1 = m - l + 1; \n ll n2 = r - m; \n \n /* create temp arrays */\n ll L[n1], R[n2]; \n \n /* Copy data to temp arrays L[] and R[] */\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 /* Merge the temp arrays back llo arr[l..r]*/\n i = 0; // Initial index of first subarray \n j = 0; // Initial index of second subarray \n k = l; // Initial index of merged subarray \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 \n /* Copy the remaining elements of L[], if there \n are any */\n while (i < n1) \n { \n arr[k] = L[i]; \n i++; \n k++; \n } \n \n /* Copy the remaining elements of R[], if there \n are any */\n while (j < n2) \n { \n arr[k] = R[j]; \n j++; \n k++; \n } \n} \n \n/* l is for left index and r is right index of the \n sub-array of arr to be sorted */\nvoid mergeSort(ll arr[], ll l, ll r) \n{ \n if (l < r) \n { \n // Same as (l+r)/2, but avoids overflow for \n // large l and h \n ll m = l+(r-l)/2; \n \n // Sort first and second halves \n mergeSort(arr, l, m); \n mergeSort(arr, m+1, r); \n \n merge(arr, l, m, r); \n } \n} \n \n\nll power(ll x, ll y) \n{ \n if (y == 0) \n return 1; \n else if (y%2 == 0) \n return power(x, y/2)*power(x, y/2); \n else\n return x*power(x, y/2)*power(x, y/2); \n}\n\nint main(ll argc, char const *argv[])\n{\n ll T;\n // scanf(\"%lld\",&T);\n T = 1;\n for (ll i = 0; i < T; i++)\n {\n ll x,y,l,r ;\n scanf(\"%lld %lld %lld %lld\",&x,&y,&l,&r);\n ll o = l;\n ll xcountl = -1;\n while(o)\n {\n xcountl++;\n o = o/x ;\n }\n ll p = r;\n ll xcountr = 0;\n while(p)\n {\n xcountr++;\n p = p/x;\n }\n ll e = r;\n ll ycountr = 0;\n while(e)\n {\n ycountr++;\n e = e/y;\n }\n ll qw = l;\n ll ycountl = -1;\n while(qw)\n {\n ycountl++;\n qw = qw/y;\n }\n \n // printf(\"%lld %lld\\n\",xcountl,ycountl);\n\n ll totalcount = 0;\n ll A[10000];\n ll idx = 0;\n for(ll s=xcountl;sMAX)\n MAX = A[idx] ;\n if(A[idx]MAX)\n MAX = A[idx] ;\n if(A[idx]max)\n max = A[sd]-A[sd-1]-1 ;\n // if(max<0)max=0;\n }\n ll finalanswer = 0;\n ll left = MIN-l;\n if(left<0)left = 0;\n ll right = r-MAX;\n if(right<0)right = 0;\n /* printf(\"l %lld r %lld %lld|\",left,right,max);*/\n if(left>right)\n {\n if(left>max)\n {\n finalanswer = left;\n }\n else \n {\n finalanswer = max ;\n }\n }\n else \n {\n if(right>max)\n {\n finalanswer = right;\n }\n else \n {\n finalanswer = max ;\n }\n }\n // printf(\"<%lld>\",totalcount);\n if(totalcount==0)\n {\n finalanswer = r-l+1 ;\n }\n if(l==1)\n {\n // totalcount++;\n if(r-l+1-totalcount==0)\n printf(\"0\\n\");\n else\n { printf(\"%lld\\n\",finalanswer);}\n }\n\n else{\n if(r-l+1-totalcount==0)\n printf(\"0\\n\");\n else\n { printf(\"%lld\\n\",finalanswer);}\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \ntypedef long long ll;\nll MIN = 1111111111111111111;\nll MAX = -1111111111111111111;\nll max = -1111111111111111111;\n\n\nvoid merge(ll arr[], ll l, ll m, ll r) \n{ \n ll i, j, k; \n ll n1 = m - l + 1; \n ll n2 = r - m; \n \n /* create temp arrays */\n ll L[n1], R[n2]; \n \n /* Copy data to temp arrays L[] and R[] */\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 /* Merge the temp arrays back llo arr[l..r]*/\n i = 0; // Initial index of first subarray \n j = 0; // Initial index of second subarray \n k = l; // Initial index of merged subarray \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 \n /* Copy the remaining elements of L[], if there \n are any */\n while (i < n1) \n { \n arr[k] = L[i]; \n i++; \n k++; \n } \n \n /* Copy the remaining elements of R[], if there \n are any */\n while (j < n2) \n { \n arr[k] = R[j]; \n j++; \n k++; \n } \n} \n \n/* l is for left index and r is right index of the \n sub-array of arr to be sorted */\nvoid mergeSort(ll arr[], ll l, ll r) \n{ \n if (l < r) \n { \n // Same as (l+r)/2, but avoids overflow for \n // large l and h \n ll m = l+(r-l)/2; \n \n // Sort first and second halves \n mergeSort(arr, l, m); \n mergeSort(arr, m+1, r); \n \n merge(arr, l, m, r); \n } \n} \n \n\nll power(ll x, ll y) \n{ \n if (y == 0) \n return 1; \n else if (y%2 == 0) \n return power(x, y/2)*power(x, y/2); \n else\n return x*power(x, y/2)*power(x, y/2); \n}\n\nint main(ll argc, char const *argv[])\n{\n ll T;\n // scanf(\"%lld\",&T);\n T = 1;\n for (ll i = 0; i < T; i++)\n {\n ll x,y,l,r ;\n scanf(\"%lld %lld %lld %lld\",&x,&y,&l,&r);\n ll o = l;\n ll xcountl = -1;\n while(o)\n {\n xcountl++;\n o = o/x ;\n }\n ll p = r;\n ll xcountr = 0;\n while(p)\n {\n xcountr++;\n p = p/x;\n }\n\n // prllf(\"%lld\\n\",xcountl);\n\n ll totalcount = 0;\n ll A[10000];\n ll idx = 0;\n for(ll s=xcountl;sMAX)\n MAX = A[idx] ;\n if(A[idx]max)\n max = A[sd]-A[sd-1]-1 ;\n if(max<0)max=0;\n }\n ll finalanswer = 0;\n ll left = MIN-l-1;\n if(left<0)left = 0;\n ll right = r-MAX-1;\n if(right<0)right = 0;\n /* printf(\"l %lld r %lld %lld|\",left,right,max);*/\n if(left>right)\n {\n if(left>max)\n {\n finalanswer = left;\n }\n else \n {\n finalanswer = max ;\n }\n }\n else \n {\n if(right>max)\n {\n finalanswer = right;\n }\n else \n {\n finalanswer = max ;\n }\n }\n if(l==1)\n {\n totalcount++;\n if(r-l+1-totalcount==0)\n printf(\"0\\n\");\n else\n { printf(\"%lld\\n\",finalanswer);}\n }\n\n else{\n if(r-l+1-totalcount==0)\n printf(\"0\\n\");\n else\n { printf(\"%lld\\n\",finalanswer);}\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \ntypedef long long ll;\nll MIN = 1111111111111111111;\nll MAX = -1111111111111111111;\nll max = -1111111111111111111;\n\n\nvoid merge(ll arr[], ll l, ll m, ll r) \n{ \n ll i, j, k; \n ll n1 = m - l + 1; \n ll n2 = r - m; \n \n /* create temp arrays */\n ll L[n1], R[n2]; \n \n /* Copy data to temp arrays L[] and R[] */\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 /* Merge the temp arrays back llo arr[l..r]*/\n i = 0; // Initial index of first subarray \n j = 0; // Initial index of second subarray \n k = l; // Initial index of merged subarray \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 \n /* Copy the remaining elements of L[], if there \n are any */\n while (i < n1) \n { \n arr[k] = L[i]; \n i++; \n k++; \n } \n \n /* Copy the remaining elements of R[], if there \n are any */\n while (j < n2) \n { \n arr[k] = R[j]; \n j++; \n k++; \n } \n} \n \n/* l is for left index and r is right index of the \n sub-array of arr to be sorted */\nvoid mergeSort(ll arr[], ll l, ll r) \n{ \n if (l < r) \n { \n // Same as (l+r)/2, but avoids overflow for \n // large l and h \n ll m = l+(r-l)/2; \n \n // Sort first and second halves \n mergeSort(arr, l, m); \n mergeSort(arr, m+1, r); \n \n merge(arr, l, m, r); \n } \n} \n \n\nll power(ll x, ll y) \n{ \n if (y == 0) \n return 1; \n else if (y%2 == 0) \n return power(x, y/2)*power(x, y/2); \n else\n return x*power(x, y/2)*power(x, y/2); \n}\n\nint main(ll argc, char const *argv[])\n{\n ll T;\n // scanf(\"%lld\",&T);\n T = 1;\n for (ll i = 0; i < T; i++)\n {\n ll x,y,l,r ;\n scanf(\"%lld %lld %lld %lld\",&x,&y,&l,&r);\n ll o = l;\n ll xcountl = -1;\n while(o)\n {\n xcountl++;\n o = o/x ;\n }\n ll p = r;\n ll xcountr = 0;\n while(p)\n {\n xcountr++;\n p = p/x;\n }\n\n // prllf(\"%lld\\n\",xcountl);\n\n ll totalcount = 0;\n ll A[10000];\n ll idx = 0;\n for(ll s=xcountl;sMAX)\n MAX = A[idx] ;\n if(A[idx]max)\n max = A[sd]-A[sd-1]-1 ;\n if(max<0)max=0;\n }\n ll finalanswer = 0;\n ll left = MIN-l;\n if(left<0)left = 0;\n ll right = r-MAX;\n if(right<0)right = 0;\n /* printf(\"l %lld r %lld %lld|\",left,right,max);*/\n if(left>right)\n {\n if(left>max)\n {\n finalanswer = left;\n }\n else \n {\n finalanswer = max ;\n }\n }\n else \n {\n if(right>max)\n {\n finalanswer = right;\n }\n else \n {\n finalanswer = max ;\n }\n }\n if(l==1)\n {\n totalcount++;\n if(r-l+1-totalcount==0)\n printf(\"0\\n\");\n else\n { printf(\"%lld\\n\",finalanswer);}\n }\n\n else{\n if(r-l+1-totalcount==0)\n printf(\"0\\n\");\n else\n { printf(\"%lld\\n\",finalanswer);}\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \ntypedef long long ll;\nll MIN = 1111111111111111111;\nll MAX = -1111111111111111111;\nll max = -1111111111111111111;\n\n\n\nvoid merge(ll arr[], ll l, ll m, ll r) \n{ \n ll i, j, k; \n ll n1 = m - l + 1; \n ll n2 = r - m; \n \n /* create temp arrays */\n ll L[n1], R[n2]; \n \n /* Copy data to temp arrays L[] and R[] */\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 /* Merge the temp arrays back llo arr[l..r]*/\n i = 0; // Initial index of first subarray \n j = 0; // Initial index of second subarray \n k = l; // Initial index of merged subarray \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 \n /* Copy the remaining elements of L[], if there \n are any */\n while (i < n1) \n { \n arr[k] = L[i]; \n i++; \n k++; \n } \n \n /* Copy the remaining elements of R[], if there \n are any */\n while (j < n2) \n { \n arr[k] = R[j]; \n j++; \n k++; \n } \n} \n \n/* l is for left index and r is right index of the \n sub-array of arr to be sorted */\nvoid mergeSort(ll arr[], ll l, ll r) \n{ \n if (l < r) \n { \n // Same as (l+r)/2, but avoids overflow for \n // large l and h \n ll m = l+(r-l)/2; \n \n // Sort first and second halves \n mergeSort(arr, l, m); \n mergeSort(arr, m+1, r); \n \n merge(arr, l, m, r); \n } \n} \n \n\nll power(ll x, ll y) \n{ \n if (y == 0) \n return 1; \n else if (y%2 == 0) \n return power(x, y/2)*power(x, y/2); \n else\n return x*power(x, y/2)*power(x, y/2); \n}\n\nint main(ll argc, char const *argv[])\n{\n ll T;\n // scanf(\"%lld\",&T);\n T = 1;\n // printf(\"%lld %lld %lld\",MIN,MAX,max);\n for (ll tqw = 0; tqw < T; tqw++)\n {\n ll x,y,l,r ;\n scanf(\"%lld %lld %lld %lld\",&x,&y,&l,&r);\n ll o = l;\n ll xcountl = -1;\n while(o)\n {\n xcountl++;\n o = o/x ;\n }\n\n ll p = r;\n ll xcountr = 0;\n while(p)\n {\n xcountr++;\n p = p/x;\n }\n ll e = r;\n ll ycountr = 0;\n while(e)\n {\n ycountr++;\n e = e/y;\n }\n ll qw = l;\n ll ycountl = -1;\n while(qw)\n {\n ycountl++;\n qw = qw/y;\n }\n \n // printf(\"%lld %lld\\n\",xcountl,xcountr);\n\n ll totalcount = 0;\n ll A[1000000];\n ll idx = 0;\n for(ll s=xcountl;sMAX)\n MAX = A[idx] ;\n if(A[idx]MAX)\n MAX = A[idx] ;\n if(A[idx]max&&A[sd]>0&&A[sd-1]>0)\n max = A[sd]-A[sd-1]-1 ;\n // if(max<0)max=0;\n }\n ll finalanswer = 0;\n ll left = MIN-l;\n if(left<0)left = 0;\n ll right = r-MAX;\n if(right<0)right = 0;\n /* printf(\"l %lld r %lld %lld|\",left,right,max);*/\n if(left>right)\n {\n if(left>max)\n {\n finalanswer = left;\n }\n else \n {\n finalanswer = max ;\n }\n }\n else \n {\n if(right>max)\n {\n finalanswer = right;\n }\n else \n {\n finalanswer = max ;\n }\n }\n // printf(\"<%lld>\",totalcount);\n if(totalcount==0)\n {\n finalanswer = r-l+1 ;\n }\n if(l==1)\n {\n if(r-l+1-totalcount==0)\n printf(\"0\\n\");\n else\n {printf(\"%lld\\n\",finalanswer);}\n }\n\n else{\n if(r-l+1-totalcount==0)\n printf(\"0\\n\");\n else\n { printf(\"%lld\\n\",finalanswer);}\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \ntypedef long long ll;\nll MIN = 1111111111111111111;\nll MAX = -1111111111111111111;\nll max = -1111111111111111111;\n\n\n\nvoid merge(ll arr[], ll l, ll m, ll r) \n{ \n ll i, j, k; \n ll n1 = m - l + 1; \n ll n2 = r - m; \n \n /* create temp arrays */\n ll L[n1], R[n2]; \n \n /* Copy data to temp arrays L[] and R[] */\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 /* Merge the temp arrays back llo arr[l..r]*/\n i = 0; // Initial index of first subarray \n j = 0; // Initial index of second subarray \n k = l; // Initial index of merged subarray \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 \n /* Copy the remaining elements of L[], if there \n are any */\n while (i < n1) \n { \n arr[k] = L[i]; \n i++; \n k++; \n } \n \n /* Copy the remaining elements of R[], if there \n are any */\n while (j < n2) \n { \n arr[k] = R[j]; \n j++; \n k++; \n } \n} \n \n/* l is for left index and r is right index of the \n sub-array of arr to be sorted */\nvoid mergeSort(ll arr[], ll l, ll r) \n{ \n if (l < r) \n { \n // Same as (l+r)/2, but avoids overflow for \n // large l and h \n ll m = l+(r-l)/2; \n \n // Sort first and second halves \n mergeSort(arr, l, m); \n mergeSort(arr, m+1, r); \n \n merge(arr, l, m, r); \n } \n} \n \n\nll power(ll x, ll y) \n{ \n if (y == 0) \n return 1; \n else if (y%2 == 0) \n return power(x, y/2)*power(x, y/2); \n else\n return x*power(x, y/2)*power(x, y/2); \n}\n\nint main(ll argc, char const *argv[])\n{\n ll T;\n // scanf(\"%lld\",&T);\n T = 1;\n // printf(\"%lld %lld %lld\",MIN,MAX,max);\n for (ll tqw = 0; tqw < T; tqw++)\n {\n ll x,y,l,r ;\n scanf(\"%lld %lld %lld %lld\",&x,&y,&l,&r);\n ll o = l;\n ll xcountl = -1;\n while(o)\n {\n xcountl++;\n o = o/x ;\n }\n\n ll p = r;\n ll xcountr = 0;\n while(p)\n {\n xcountr++;\n p = p/x;\n }\n ll e = r;\n ll ycountr = 0;\n while(e)\n {\n ycountr++;\n e = e/y;\n }\n ll qw = l;\n ll ycountl = -1;\n while(qw)\n {\n ycountl++;\n qw = qw/y;\n }\n \n // printf(\"%lld %lld\\n\",xcountl,xcountr);\n\n ll totalcount = 0;\n ll A[1000000];\n ll idx = 0;\n for(ll s=xcountl;sMAX)\n MAX = A[idx] ;\n if(A[idx]MAX)\n MAX = A[idx] ;\n if(A[idx]max)\n max = A[sd]-A[sd-1]-1 ;\n // if(max<0)max=0;\n }\n ll finalanswer = 0;\n ll left = MIN-l;\n if(left<0)left = 0;\n ll right = r-MAX;\n if(right<0)right = 0;\n /* printf(\"l %lld r %lld %lld|\",left,right,max);*/\n if(left>right)\n {\n if(left>max)\n {\n finalanswer = left;\n }\n else \n {\n finalanswer = max ;\n }\n }\n else \n {\n if(right>max)\n {\n finalanswer = right;\n }\n else \n {\n finalanswer = max ;\n }\n }\n // printf(\"<%lld>\",totalcount);\n if(totalcount==0)\n {\n finalanswer = r-l+1 ;\n }\n if(l==1)\n {\n if(r-l+1-totalcount==0)\n printf(\"0\\n\");\n else\n {printf(\"%lld\\n\",finalanswer);}\n }\n\n else{\n if(r-l+1-totalcount==0)\n printf(\"0\\n\");\n else\n { printf(\"%lld\\n\",finalanswer);}\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \ntypedef long long ll;\nll MIN = 1111111111111111111;\nll MAX = -1111111111111111111;\nll max = -1111111111111111111;\n\n\nvoid merge(ll arr[], ll l, ll m, ll r) \n{ \n ll i, j, k; \n ll n1 = m - l + 1; \n ll n2 = r - m; \n \n /* create temp arrays */\n ll L[n1], R[n2]; \n \n /* Copy data to temp arrays L[] and R[] */\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 /* Merge the temp arrays back llo arr[l..r]*/\n i = 0; // Initial index of first subarray \n j = 0; // Initial index of second subarray \n k = l; // Initial index of merged subarray \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 \n /* Copy the remaining elements of L[], if there \n are any */\n while (i < n1) \n { \n arr[k] = L[i]; \n i++; \n k++; \n } \n \n /* Copy the remaining elements of R[], if there \n are any */\n while (j < n2) \n { \n arr[k] = R[j]; \n j++; \n k++; \n } \n} \n \n/* l is for left index and r is right index of the \n sub-array of arr to be sorted */\nvoid mergeSort(ll arr[], ll l, ll r) \n{ \n if (l < r) \n { \n // Same as (l+r)/2, but avoids overflow for \n // large l and h \n ll m = l+(r-l)/2; \n \n // Sort first and second halves \n mergeSort(arr, l, m); \n mergeSort(arr, m+1, r); \n \n merge(arr, l, m, r); \n } \n} \n \n\nll power(ll x, ll y) \n{ \n if (y == 0) \n return 1; \n else if (y%2 == 0) \n return power(x, y/2)*power(x, y/2); \n else\n return x*power(x, y/2)*power(x, y/2); \n}\n\nint main(ll argc, char const *argv[])\n{\n ll T;\n // scanf(\"%lld\",&T);\n T = 1;\n for (ll i = 0; i < T; i++)\n {\n ll x,y,l,r ;\n scanf(\"%lld %lld %lld %lld\",&x,&y,&l,&r);\n ll o = l;\n ll xcountl = -1;\n while(o)\n {\n xcountl++;\n o = o/x ;\n }\n ll p = r;\n ll xcountr = 0;\n while(p)\n {\n xcountr++;\n p = p/x;\n }\n\n // prllf(\"%lld\\n\",xcountl);\n\n ll totalcount = 0;\n ll A[10000];\n ll idx = 0;\n for(ll s=xcountl;sMAX)\n MAX = A[idx] ;\n if(A[idx]max)\n max = A[sd]-A[sd-1]-2 ;\n if(max<0)max=0;\n }\n ll finalanswer = 0;\n ll left = MIN-l-1;\n if(left<0)left = 0;\n ll right = r-MAX-1;\n if(right<0)right = 0;\n /* printf(\"l %lld r %lld %lld|\",left,right,max);*/\n if(left>right)\n {\n if(left>max)\n {\n finalanswer = left;\n }\n else \n {\n finalanswer = max ;\n }\n }\n else \n {\n if(right>max)\n {\n finalanswer = right;\n }\n else \n {\n finalanswer = max ;\n }\n }\n if(l==1)\n {\n totalcount++;\n if(r-l+1-totalcount==0)\n printf(\"0\\n\");\n else\n { printf(\"%lld\\n\",finalanswer);}\n }\n\n else{\n if(r-l+1-totalcount==0)\n printf(\"0\\n\");\n else\n { printf(\"%lld\\n\",finalanswer);}\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n#include \n#define MOD 1000000007\n#define ll long long\n\nll cmpfunc(const void *a, const void *b){\n return (*(ll*)a - *(ll*)b);\n}\n\nint max(int a,int b){\n return (a>b)?a:b;\n}\n\nll power(ll x,ll y){\n ll ans=1;\n for(ll i=0;iy){\n ll ans=x;\n x=y;\n y=ans;\n }\n //a=floor(1.0*log(l)/log(x));\n b=(ll)floor(1.0*log(r)/log(x))+1;\n printf(\"b=%lld\\n\",b);\n //c=floor(1.0*log(l)/log(y));\n d=(ll)floor(1.0*log(r)/log(y))+1;\n printf(\"d=%lld\\n\",d);\n\n //a<=b,c<=d\n ll un[10000]; //stores unlucky numbers\n int count=0; //number of unlucky numbers\n for(i=0;i<=b;i++){\n for(j=0;j<=d;j++){\n if(power(x,i)>r-power(y,j)) continue;\n ll sum=(ll)power(x,i)+(ll)power(y,j);\n printf(\"sum=%lld\\n\",sum);\n if(sum>=l){\n un[count]=sum;\n count++;\n }\n }\n }\n printf(\"count=%lld\\n\",count);\n if(count==0){\n printf(\"%lld\\n\",r-l+1);\n return 0;\n }\n ll unlucky[count];\n for(i=0;i 0 && unlucky[d1] < unlucky[d1-1]) {\n t = unlucky[d1];\n unlucky[d1] = unlucky[d1-1];\n unlucky[d1-1] = t;\n\n d1--;\n }\n }\n\n\n for(i=0;imax) max=unlucky[i+1]-unlucky[i]-1;\n }\n if(r-unlucky[count-1]>max) max=r-unlucky[count-1];\n if(unlucky[0]-l>max) max=unlucky[0]-l;\n\n printf(\"%lld\\n\",max);\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n#include \n#define MOD 1000000007\n#define ll long long\n\nll cmpfunc(const void *a, const void *b){\n return (*(ll*)a - *(ll*)b);\n}\n\nint max(int a,int b){\n return (a>b)?a:b;\n}\n\nll power(ll x,ll y){\n ll ans=1;\n for(ll i=0;ir-power(y,j)) continue;\n ll sum=(ll)power(x,i)+(ll)power(y,j);\n if(sum>=l){\n //printf(\"sum=%lld\\n\",sum);\n un[count]=sum;\n count++;\n }\n }\n }\n //printf(\"count=%lld\\n\",count);\n if(count==0){\n printf(\"%lld\\n\",r-l+1);\n return 0;\n }\n ll unlucky[count];\n for(i=0;i 0 && unlucky[d1] < unlucky[d1-1]) {\n t = unlucky[d1];\n unlucky[d1] = unlucky[d1-1];\n unlucky[d1-1] = t;\n\n d1--;\n }\n }\n\n\n //for(i=0;imax) max=unlucky[i+1]-unlucky[i]-1;\n }\n //printf(\"%lld %lld\\n\",max,r-unlucky[count-1]);\n if(r-unlucky[count-1]>max) max=r-unlucky[count-1];\n if(unlucky[0]-l>max) max=unlucky[0]-l;\n\n printf(\"%lld\\n\",max);\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n#include \n#define MOD 1000000007\n#define ll long long\n\nll cmpfunc(const void *a, const void *b){\n return (*(ll*)a - *(ll*)b);\n}\n\nint max(int a,int b){\n return (a>b)?a:b;\n}\n\nll power(ll x,ll y){\n ll ans=1;\n for(ll i=0;iy){\n ll ans=x;\n x=y;\n y=ans;\n }\n //a=floor(1.0*log(l)/log(x));\n b=(ll)floor(1.0*log(r)/log(x))+1;\n //printf(\"b=%lld\\n\",b);\n //c=floor(1.0*log(l)/log(y));\n d=(ll)floor(1.0*log(r)/log(y))+1;\n //printf(\"d=%lld\\n\",d);\n\n //a<=b,c<=d\n ll un[10000]; //stores unlucky numbers\n int count=0; //number of unlucky numbers\n for(i=0;i<=b;i++){\n for(j=0;j<=d;j++){\n if(power(x,i)>r-power(y,j)) continue;\n ll sum=(ll)power(x,i)+(ll)power(y,j);\n //printf(\"sum=%lld\\n\",sum);\n if(sum>=l){\n un[count]=sum;\n count++;\n }\n }\n }\n //printf(\"count=%lld\\n\",count);\n if(count==0){\n printf(\"%lld\\n\",r-l+1);\n return 0;\n }\n ll unlucky[count];\n for(i=0;i 0 && unlucky[d1] < unlucky[d1-1]) {\n t = unlucky[d1];\n unlucky[d1] = unlucky[d1-1];\n unlucky[d1-1] = t;\n\n d1--;\n }\n }\n\n\n //for(i=0;imax) max=unlucky[i+1]-unlucky[i]-1;\n }\n if(r-unlucky[count-1]>max) max=r-unlucky[count-1];\n if(unlucky[0]-l>max) max=unlucky[0]-l;\n\n printf(\"%lld\\n\",max);\n\n return 0;\n}\n"}, {"source_code": "#include\n\ntypedef long long int lli;\n\nvoid msort(lli a[], int s, int e)\n{\n if(e-s!=0)\n {\n msort(a, s, (s+e)/2);\n msort(a, (s+e)/2 + 1, e);\n }\n else\n return;\n lli b[e-s+1];\n int i=s, j=(s+e)/2 + 1, n;\n for(n=0; i<=(s+e)/2 && j<=e;n++)\n {\n if(a[i]<=a[j])\n b[n]=a[i++];\n else\n b[n]=a[j++];\n }\n if(i<=(s+e)/2)\n for(;i<=(s+e)/2;i++, n++)\n b[n] = a[i];\n else\n for(;j<=e;j++,n++)\n b[n]=a[j];\n for(i=0;ir)\n {\n break;\n }\n a[ind++] = ele;\n }\n }\n\n ct=0;\n for(i=0;i=l && a[i]<=r)\n b[ct++] = a[i];\n\n b[ct++] = l-1;\n b[ct++] = r+1;\n\n msort(b, 0, ct-1);\n\n //for(i=0;imxdif)\n {\n mxdif = b[i+1]-b[i];\n // printf(\"%lld %lld %lld\\n\",b[i], b[i+1], i);\n }\n }\n printf(\"%lld\\n\", mxdif-1);\n\n return 0;\n}\n"}, {"source_code": "#include\n\ntypedef long long int lli;\n\nvoid msort(lli a[], int s, int e)\n{\n if(e-s!=0)\n {\n msort(a, s, (s+e)/2);\n msort(a, (s+e)/2 + 1, e);\n }\n else\n return;\n lli b[e-s+1];\n int i=s, j=(s+e)/2 + 1, n;\n for(n=0; i<=(s+e)/2 && j<=e;n++)\n {\n if(a[i]<=a[j])\n b[n]=a[i++];\n else\n b[n]=a[j++];\n }\n if(i<=(s+e)/2)\n for(;i<=(s+e)/2;i++, n++)\n b[n] = a[i];\n else\n for(;j<=e;j++,n++)\n b[n]=a[j];\n for(i=0;ir)\n {\n break;\n }\n a[ind++] = ele;\n }\n }\n\n ct=0;\n for(i=0;i=l && a[i]<=r)\n b[ct++] = a[i];\n\n b[ct++] = l-1;\n b[ct++] = r-1;\n\n msort(b, 0, ct-1);\n\n //for(i=0;imxdif)\n {\n mxdif = b[i+1]-b[i];\n // printf(\"%lld %lld %lld\\n\",b[i], b[i+1], i);\n }\n }\n printf(\"%lld\\n\", mxdif-1);\n\n return 0;\n}\n"}, {"source_code": "#include\n\ntypedef unsigned long long int lli;\n\nvoid msort(lli a[], int s, int e)\n{\n if(e-s!=0)\n {\n msort(a, s, (s+e)/2);\n msort(a, (s+e)/2 + 1, e);\n }\n else\n return;\n lli b[e-s+1];\n int i=s, j=(s+e)/2 + 1, n;\n for(n=0; i<=(s+e)/2 && j<=e;n++)\n {\n if(a[i]<=a[j])\n b[n]=a[i++];\n else\n b[n]=a[j++];\n }\n if(i<=(s+e)/2)\n for(;i<=(s+e)/2;i++, n++)\n b[n] = a[i];\n else\n for(;j<=e;j++,n++)\n b[n]=a[j];\n for(i=0;i18)\n return 1;\n return 0;\n}\n\nint main()\n{\n lli i,j,ele;\n lli x,y,l,r;\n lli a[100000], b[100000];\n scanf(\"%llu %llu %llu %llu\", &x, &y, &l, &r);\n if(yr)\n {\n break;\n }\n a[ind++] = ele;\n \n // printf(\"%llu \", ele);\n\n\n }\n // putchar('\\n');\n }\n\n ct=0;\n for(i=0;i=l && a[i]<=r)\n b[ct++] = a[i];\n\n b[ct++] = l-1;\n b[ct++] = r+1;\n\n msort(b, 0, ct-1);\n/*\n for(i=0;imxdif)\n {\n mxdif = b[i+1]-b[i];\n // printf(\"%lld %lld %lld\\n\",b[i], b[i+1], i);\n }\n }\n printf(\"%llu\\n\", mxdif-1);\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n#include \n#define MOD 1000000007\n#define ll long long\n\nll cmpfunc(const void *a, const void *b){\n return (*(ll*)a - *(ll*)b);\n}\n\nll cmp(const void *a, const void *b){\n return (*(ll*)b - *(ll*)a);\n}\n\nint max(int a,int b){\n return (a>b)?a:b;\n}\n\nint main(void){\n ll x,y,l,r;\n scanf(\"%lld %lld %lld %lld\",&x,&y,&l,&r);\n ll a,b,c,d;\n ll i,j;\n if(x>y){\n ll ans=x;\n x=y;\n y=ans;\n }\n //a=floor(1.0*log(l)/log(x));\n b=floor(1.0*log(r)/log(x));\n //c=floor(1.0*log(l)/log(y));\n d=floor(1.0*log(r)/log(y));\n\n //a<=b,c<=d\n ll unlucky[10000]; //stores unlucky numbers\n int count=0; //number of unlucky numbers\n for(i=0;i<=b;i++){\n for(j=0;j<=d;j++){\n ll sum=pow(x,i)+pow(y,j);\n if(sum>=l && sum<=r){\n unlucky[count]=sum;\n count++;\n }\n }\n }\n //printf(\"count=%lld\\n\",count);\n if(count==0){\n printf(\"%lld\\n\",r-l+1);\n return 0;\n }\n qsort(unlucky,count,sizeof(ll),cmpfunc);\n ll max=0;\n for(i=0;imax) max=unlucky[i+1]-unlucky[i]-1;\n }\n if(r-unlucky[count-1]>max) max=r-unlucky[count-1];\n if(unlucky[0]-l>max) max=unlucky[0]-l;\n\n printf(\"%lld\\n\",max);\n\n return 0;\n}\n"}], "src_uid": "68ca8a8730db27ac2230f9fe9b120f5f"} {"nl": {"description": "Petr stands in line of n people, but he doesn't know exactly which position he occupies. He can say that there are no less than a people standing in front of him and no more than b people standing behind him. Find the number of different positions Petr can occupy.", "input_spec": "The only line contains three integers n, a and b (0 ≤ a, b < n ≤ 100).", "output_spec": "Print the single number — the number of the sought positions.", "sample_inputs": ["3 1 1", "5 2 3"], "sample_outputs": ["2", "3"], "notes": "NoteThe possible positions in the first sample are: 2 and 3 (if we number the positions starting with 1).In the second sample they are 3, 4 and 5."}, "positive_code": [{"source_code": "#include \nint main(){\n int n, a, b;\n int c=0;\nscanf(\"%d%d%d\",&n,&a,&b);\n for(int i=1;i<=n;i++)\n {\n if(a<=i-1&&n-i<=b)\n {\n c++;\n }\n }\n printf(\"%d\",c);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint n,a,b,p;\n\tscanf(\"%d%d%d\",&n,&a,&b);\n\t//condition 5 3 2\n\tif(a+b==n && a>b)p=a;\n\t//condition 5 2 3\n\telse if(a+b==n && an)p=n-a;\n\t//condition 5 4 0\n\telse if(a!=b && a+b\nint main()\n{\n\tint n,a,b;\n\tscanf(\"%d %d %d\",&n,&a,&b);\n\tif(a=n-1)\n\t\tprintf(\"%d\\n\",n-a);\n\t\telse printf(\"%d\\n\",b+1);\n\t}\t\n\telse\n\t\tprintf(\"%d\\n\",0);\n\treturn 0;\n}\n\n"}, {"source_code": "#include\n\nint main()\n{\n int n,a,b,count=0,i;\n scanf(\"%d%d%d\",&n,&a,&b);\n for(i=a+1; i<=n; i++)\n {\n if(n-i<=b){count++;}\n }\n printf(\"%d\\n\",count);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\nint a,b,c,d;\nscanf(\"%d%d%d\",&a,&b,&c);\nd=a-b;\nif(d>c)\nd=c+1;\nprintf(\"%d\",d);\n\n}\n\n"}, {"source_code": "int main()\n{\n int n,a,b;\n \n scanf(\"%d\",&n);\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n \n int count,l,m;\n \n l=n-a;\n m=b+1;\n \n if(l\n\nint main()\n{\n int n,a,b,c,d;\n scanf(\"%d %d %d\",&n,&a,&b);\n c=n-a;\n d=n-(a+b+1);\n if(a+b+1\n#include\n#include\n#include\n\nint cmpfunc (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\n\nmain()\n{\n //freopen(\"in.txt\", \"r\", stdin);\n int i, n, j, c1 = 1, c50 = 0, a, b;\n\n scanf(\"%d %d %d\", &n, &a, &b);\n\n i = n - b;\n if(a\nint main()\n{\n\tint n, a, b, pos;\n\tscanf(\"%d %d %d\", &n, &a, &b);\n\tif((n-a)<(b+1))\n\t{\n\t pos = (n-a);\n\t}\n\telse if((n-a)>(b+1))\n\t{\n\t pos= (b+1);\n\t}\n\t\n\telse if ((n-a)==(b+1))\n\t{\n\t pos = n-a;\n\t}\n\tprintf(\"%d\", pos);\n\treturn 0;\n}"}, {"source_code": "#include \nint main()\n{\n\tint n, a, b, pos;\n\tscanf(\"%d %d %d\", &n, &a, &b);\n\tif((n-a)<(b+1))\n\t{\n\t pos = (n-a);\n\t}\n\telse if((n-a)>(b+1))\n\t{\n\t pos= (b+1);\n\t}\n\t\n\telse if ((n-a)==(b+1))\n\t{\n\t pos = n-a;\n\t}\n\tprintf(\"%d\", pos);\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,a,b;\n scanf(\"%d%d%d\",&n,&a,&b);\n if((n-a)<=(b+1))\n printf(\"%d\\n\",n-a);\n else\n printf(\"%d\\n\",b+1);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int a ;\n int b ;\n int n ;\n scanf(\"%d\",&n);\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n if (n-a<=b){\n printf(\"%d\",n-a);\n }\n else {\n printf(\"%d\",b+1) ;\n }\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,a,b;\n scanf(\"%d %d %d\\n\",&n,&a,&b);\n int c=0;\n for(int i=1;i<=n;i++)\n {\n if(i-1>=a && n-i<=b)\n c=c+1;\n }\n printf(\"%d\\n\",c);\n return 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n int n, a, b, rest, count = 1;\n scanf(\"%d %d %d\", &n, &a, &b);\n\n // rest = n - (a + 1);\n if(n-(a+1) >= b)\n count = count + b;\n else\n count = count + n - (a + 1);\n\n printf(\"%d\", count);\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,n;\n scanf(\"%d%d%d\",&n,&a,&b);\n if((n-a)\n\nint main()\n{\n int n,a,b,count=0,i;\n scanf(\"%d%d%d\",&n,&a,&b);\n for(i=a+1; i<=n; i++)\n {\n if(n-i<=b){count++;}\n }\n printf(\"%d\\n\",count);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,a,b,c,r;\n scanf(\"%d%d%d\",&n,&a,&b);\n c=n-a-1;\n if(c>b){\n r=b+1;\n }else{\n r=c+1;\n }\n printf(\"%d\",r);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,a,b,x;\n scanf(\"%d%d%d\",&n,&a,&b);\n\n x=n-a;\n if(x<=b)\n printf(\"%d\",x);\n else if(x-b==1)\n printf(\"%d\",x);\n else\n printf(\"%d\",b+1);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,a,b,s,m,d;\n scanf(\"%d%d%d\",&n,&a,&b);\n m=a+1;\n d=n-b;\n if(m>d){\n s= n-m+1;\n printf(\"%d\\n\",s);\n }\n else if(d>m){\n s= n-d+1;\n printf(\"%d\\n\",s);\n }\n else if(m==d){\n s= n-m+1;\n printf(\"%d\\n\",s);\n }\n return 0;\n}\n"}, {"source_code": "#include\nmain()\n{\n int a,b,n,e,i,c,d,cnt=0,max=0,s=0;\n scanf(\"%d %d %d\",&a,&b,&c);\n\n d=a-b;\n e=c+1;\n if(d<=e)\n printf(\"%d\",d);\n else\n printf(\"%d\",e);\n\n\n}\n"}, {"source_code": "#include\nint main()\n{\nint n,a,b;\nscanf(\"%d%d%d\",&n,&a,&b);\n if(n-a<=b){\n printf(\"%d\",n-a);\n }\n if(n-a>b){\n printf(\"%d\",b+1);\n\n }\n\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,a,b,i,c=0;\n scanf(\"%d%d%d\",&n,&a,&b);\n for(i=1;i<=n;i++)\n {\n if(i>a&&(n-i)<=b)\n // printf(\"%dg\\n\",i);\n c=c+1;\n }\n printf(\"%d\",c);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,a,b,i,k=0;\n\tscanf(\"%d %d %d\",&n,&a,&b);\n\tfor(i=a+1;i<=n;i++)\n\t{\n\t\tif(n-i<=b)\n\t\tk+=1;\n\t\t}\n\t\tprintf(\"%d\",k);\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n,a,b,count=0,i;\n scanf(\"%d%d%d\",&n,&a,&b);\n for(i=a+1; i<=n; i++)\n {\n if(n-i<=b){count++;}\n }\n printf(\"%d\\n\",count);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,a,b,p;\n\tscanf(\"%d%d%d\",&n,&a,&b);\n\t//condition 5 3 2\n\tif(a+b==n && a>b)p=a;\n\t//condition 5 2 3\n\telse if(a+b==n && an)p=n-a;\n\t//condition 5 4 0\n\telse if(a!=b && a+b\nint main()\n{\n int n,b,a;\n scanf(\"%i %i %i\",&n,&a,&b);\n if(n-a==b)\n printf(\"%i\",b);\n else if((n-a)\nint main()\n{\n int n,a,b,x;\n scanf(\"%d %d %d\",&n,&a,&b);\n if((n-a)<=b){\n x=n-a;\n printf(\"%d\",x);\n }\n else if((n-a)>b){\n x=b+1;\n printf(\"%d\",x);\n\n }\n return 0;\n\n}\n\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////"}, {"source_code": "#include\n\nint main()\n{\n\n\tint n, a, b;\n\tscanf(\"%d%d%d\", &n, &a, &b);\n\t\n\tint x, y, count=0;\n\t\n\tfor(x=a; x\n\nint main()\n{\n\n\tint n, a, b;\n\tscanf(\"%d%d%d\", &n, &a, &b);\n\t\n\tint x, y, count=0;\n\t\n\tfor(x=a; x\n\nint main()\n{\n int n,a,b;\n scanf(\"%d %d %d\",&n,&a,&b);\n if(n-a>=b+1){\n printf(\"%d\",b+1);}\n if(n-a\n#include \n\n\nint main()\n{\n int arr[3];\n int i;\n for(i=0;i<3;i++){\n scanf(\"%d\",&arr[i]);\n }\n int ans=arr[0]-arr[1]-1;\n int d=ans-arr[2];\n while(d>0){\n ans-=1;\n d=ans-arr[2];\n }\n printf(\"%d\",ans+1);\n return 0;\n}\n"}, {"source_code": "#include \n\n#define MAX(a, b) ((a > b) ? a : b)\n\nint main(){\n int n, a, b;\n scanf(\"%d %d %d\", &n, &a, &b);\n printf(\"%d\\n\", n - MAX(a + 1, n - b) + 1);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int n,a,b,c,d;\n scanf(\"%d %d %d\",&n,&a,&b);\n c=n-a;\n d=n-(a+b+1);\n if(a+b+1\n#include\nint main()\n{\n int n,a,b,i,count=0;\n scanf(\"%d %d %d\",&n,&a,&b);\n for(i=1;i<=(n-a);i++){\n if(i<=(b+1)){\n count++;\n }\n else\n continue;\n }\n printf(\"%d\\n\",count);\nreturn 0;\n}\n"}, {"source_code": "#include\n\nint main()\n\n{\n \nint n, a, b;\n\nscanf(\"%d %d %d\", &n, &a, &b);\n\nif(n-a < 1+b)\nprintf(\"%d\",n-a);\n\nelse\nprintf(\"%d\", b+1);\n\nreturn 0;\n}\n"}, {"source_code": "#include\n//using namespace std;\nint main()\n{\n\tint n,a,b;\n\tscanf(\"%d%d%d\",&n,&a,&b);\n\tint u=b+1;\n\tif(u>=n-a)\n\t\tu=n-a;\n\tprintf(\"%d\\n\",u);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int a,b,n;\n scanf(\"%d %d %d\",&n,&a,&b);\n if( a + b > n )\n printf(\"%d\",n-a);\n else\n printf(\"%d\",b+( a + b != n ));\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n,a,b,count=0;\n scanf(\"%d %d %d\",&n,&a,&b);\n while(1)\n {\n n--;\n if(n>=a && count<=b)\n count++;\n else\n break;\n }\n printf(\"%d\\n\",count);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\nlong long int n,a,b,t=0,c=0;\nscanf(\"%I64d%I64d%I64d\",&n,&a,&b);\nt=n;\nwhile(t>=(n-b)&&t>a)\n{\n t=t-1;\n c=c+1;\n}\nprintf(\"%I64d\",c);\nreturn 0;}\n"}, {"source_code": "#include\nint main()\n{\n int n,a,b,c,d,ans;\n scanf(\"%d %d %d\",&n,&a,&b);\n c=a+1;\n d=n-c;\n \n if(d\n\nint main(void){\n\tint a,b,n;\n\tscanf(\"%d%d%d\",&n,&a,&b);\n\tif(a+b+1<=n)\n\t\tprintf(\"%d\",b+1);\n\telse\n\t\tprintf(\"%d\",n-a);\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\n\nint main()\n{\n int arr[3];\n int i;\n for(i=0;i<3;i++){\n scanf(\"%d\",&arr[i]);\n }\n int ans=arr[0]-arr[1]-1;\n int d=ans-arr[2];\n while(d>0){\n ans-=1;\n d=ans-arr[2];\n }\n printf(\"%d\",ans+1);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n; \n\twhile (~scanf(\"%d\", &n))\n\t{\n\t\tint a, b, cnt = 0;\n\t\tscanf(\"%d %d\", &a, &b);\n\t\t\n\t\tfor (int i = a + 1; i <= n; i++)\n\t\t\tif (n - i <= b)\n\t\t\t\tcnt++;\n\n\t\tprintf(\"%d\\n\", cnt);\n\t}\n\n\treturn 0;\n}\n \t\t\t\t\t \t \t \t\t \t \t \t \t \t"}, {"source_code": "#include\n\nint main()\n{\n int a,b,n;\n scanf(\"%d %d %d\",&n,&a,&b);\n if(n-a<=b+1)\n printf(\"%d\", n-a);\n else\n printf(\"%d\",b+1); \n}"}, {"source_code": "#include \nint main()\n{\n int a,b,n,s=0,i;\n scanf(\"%d%d%d\",&n,&a,&b);\n for(i=0; i=a&&(n-i-1)<=b) s++;\n printf(\"%d\",s);\n return 0;\n}\n"}, {"source_code": "#include\nmain()\n{\n int a,b,c,d,e;\n scanf(\"%d %d %d\",&a,&b,&c);\n d=a-b;\n e=b-c;\n if(c+1\nint main()\n{\n\tint n,a,b;scanf(\"%d%d%d\",&n,&a,&b);int c=0;\n\tfor(int i=a+1;i<=n;i++){\n\t\tif(n-i<=b) c++;\n\t}\n\tprintf(\"%d\",c);\n}"}, {"source_code": "#include \n\nint main(){\n\n int num, left, right, result, i, right_side = 0;\n\n scanf(\"%d %d %d\", &num, &left, &right);\n\n for(i = left + 1; i <= num && right_side < right; i++){\n right_side++;\n }\n\n while(left + 1 + right_side < num){\n left++;\n }\n\n result = num - left;\n printf(\"%d\\n\", result);\n\n return 0;\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,a,b,x,ans;\n scanf(\"%d %d %d\",&n,&a,&b);\n x=n-a-1;\n if(x>b)\n { ans=b+1;}\n else{\n ans=x+1;}\n printf(\"%d\\n\",ans);\n}"}, {"source_code": "#include\nint main()\n{\n int a,b,c;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(a-b<=c+1)\n printf(\"%d\",a-b);\nelse\nprintf(\"%d\",c+1);\n return 0;\n}"}, {"source_code": "//copied\n#include \nint min(int a,int b)\n{\n if(a\n\nint main() {\n\t\n\tint n, a, b, start, ans = 0;\n\tint i;\n\t\n\tscanf(\"%d %d %d\", &n, &a, &b);\n\t\n\tstart = a+1;\n\t\n\tfor (i = start; i <= n; i++)\n\t{\n\t\tif (n-i <= b)\n\t\t{\n\t\t\tans += 1;\n\t\t}\n\t}\n\t\n\tprintf(\"%d\\n\", ans);\n\t\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,a,b,c,d,e;\n scanf(\"%d %d %d\",&n,&a,&b);\n c = n-a;\n if(c==b)\n {\n printf(\"%d\",b);\n }\n else if(c>b)\n {\n printf(\"%d\",b+1);\n }\n else if(c\nint main()\n{\n int a,b,n,s=0,i;\n scanf(\"%d%d%d\",&n,&a,&b);\n for(i=0; i=a&&(n-i-1)<=b) s++;\n printf(\"%d\",s);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int n,a,b;\n scanf(\"%d%d%d\",&n,&a,&b);\n if(n-a<=b)\n {\n printf(\"%d\",n-a);\n }\n else\n {\n printf(\"%d\",b+1);\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main () {\n int i,j,k,n,a,b,ss=0,dizi[105]={};\n scanf(\"%d %d %d\",&n,&a,&b);\n for(i=a;i\nint main()\n{\n int i,j,k,l;\n scanf(\"%d %d %d\", &i, &j, &k);\n if(i-j<=k)printf(\"%d\", i-j);\n else printf(\"%d\", k+1);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,a,b;\n scanf(\"%d %d %d\",&n,&a,&b);\n if(b>a)\n {\n if((a+b)n)\n printf(\"%d\",(n-(a+1)+1));\n }\n else if(a>b)\n {\n if((a+b)n)\n printf(\"%d\",(n-(a+1)+1));\n }\n else if(a==b)\n {\n if((a+b)n)\n printf(\"%d\",(n-(a+1)+1));\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main()\n{\n\tint a,b;\n\tint n;\n\tint i;\n\tint cnt=0;\n\tint judge[100] = {0,};\n\tscanf(\"%d %d %d\",&n,&a,&b);\n\tfor(i=a;i=n-b-1;i--)\n\t{\n\t\tjudge[i]++;\n\t}\n\tfor(i=0;i\nint main()\n{\nint n,a,b;\nscanf(\"%d%d%d\",&n,&a,&b);\nif(a+b>=n)\n{\nprintf(\"%d\", n-a);\n}\nelse\n{\nprintf(\"%d\", b+1);\n}\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,a,b,c,d,e;\n scanf(\"%d %d %d\",&n,&a,&b);\n c = n-a;\n if(c==b)\n {\n printf(\"%d\",b);\n }\n else if(c>b)\n {\n printf(\"%d\",b+1);\n }\n else if(c\n\nint main()\n{\n int n,a,b;\n scanf(\"%d%d%d\",&n,&a,&b);\n if(n-a-1>b){\n printf(\"%d\",b+1);\n }else {\n printf(\"%d\",n-a);\n }\n return 0;\n}\n\n"}, {"source_code": "#include\n#include\n\nint main()\n{\n\tint a,b;\n\tint n;\n\tint i;\n\tint cnt=0;\n\tint judge[100] = {0,};\n\tscanf(\"%d %d %d\",&n,&a,&b);\n\tfor(i=a;i=n-b-1;i--)\n\t{\n\t\tjudge[i]++;\n\t}\n\tfor(i=0;i\nint main(void)\n{\n int a, b, n, i, j, count=0;\n scanf(\"%d%d%d\", &n, &a, &b);\n for(i=a; i<=n; i++)\n {\n for(j=b; j<=n && j>=0; j--)\n {\n if(i+j+1 == n)\n {\n count++;\n }\n }\n }\n printf(\"%d\", count);\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n\tint n,a,b;\n\tscanf(\"%d %d %d\",&n,&a,&b);\n\tif(a+b\nint main()\n{\n int n,a,b,res;\n scanf(\"%d %d %d\",&n,&a,&b);\n res=n-a;\n if (res > b+1){\n res = b+1;\n }\n\n printf(\"%d\",res);\n\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n,a,b,count=0,i;\n scanf(\"%d%d%d\",&n,&a,&b);\n for(i=a+1; i<=n; i++)\n {\n if(n-i<=b){count++;}\n }\n printf(\"%d\\n\",count);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int n,a,b,f[100],ba[100],j,k,l,m,count=0,i,len1,len2;\n scanf(\"%d %d %d\",&n,&a,&b);\n for(i=0,j=a;j\nint main()\n{\n int n,a,b,d,r;\n scanf(\"%d %d %d\",&n,&a,&b);\n n=n-a;\n if(n==1)\n r=1;\n else\n {\n if(n>b)\n r=b+1;\n else if(n==b)\n r=b;\n else\n r=n;\n }\n printf(\"%d\\n\",r);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\nint n,a,b;\nscanf(\"%d%d%d\",&n,&a,&b);\nif(n-a<=b)\n{\n printf(\"%d\",n-a);\n}\nelse\n{\nif(n-a>b)\n{\nprintf(\"%d\",b+1);\n}\nelse\n{\nprintf(\"%d\",b);\n}\n}\nreturn(0);\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int a,b,n,p,ans=0;\n scanf(\"%d %d %d\",&n,&a,&b);\n if((a+b)==n)\n ans=b;\n else \n {\n if((a+b)>n)\n ans=n-a;\n else if((a+b)\nint main()\n{\nint n,a,b;\nscanf(\"%d%d%d\",&n,&a,&b);\n if (n-b>a)\n printf(\"%d\",b+1);\nelse\nprintf(\"%d\",n-a);\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,a,b,x;\n scanf(\"%d%d%d\",&n,&a,&b);\n\n x=n-a;\n if(x<=b)\n printf(\"%d\",x);\n else if(x-b==1)\n printf(\"%d\",x);\n else\n printf(\"%d\",b+1);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\n#define re(i,n) for(i = 0; i < n; i++)\n\nint min(int a, int b) {\n if(a < b) return a;\n else return b;\n}\n\nint main()\n{\n int a,b,n;\n\n scanf(\"%d%d%d\", &n, &a, &b);\n\n printf(\"%d\", min(n - a, b + 1));\n\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n\n\tint n, a, b;\n\tscanf(\"%d%d%d\", &n, &a, &b);\n\t\n\tint x, y, count=0;\n\t\n\tfor(x=a; x\nmain()\n{int a,b,n;\nscanf(\"%d%d%d\",&n,&a,&b);\nwhile(a>n-b-1)\nb--;\nprintf(\"%d\",b+1);\nreturn 0;}"}, {"source_code": "#include\n\nint main()\n{\n int n,a,b,p;\n scanf(\"%d %d %d\",&n,&a,&b);\n if((a+b)\nint main()\n{\n\tint n,a,b;\n\tscanf(\"%d %d %d\",&n,&a,&b);\n\tif(a+b\n#include\n\nint main()\n{\n\tint a,b;\n\tint n;\n\tint i;\n\tint cnt=0;\n\tint judge[100] = {0,};\n\tscanf(\"%d %d %d\",&n,&a,&b);\n\tfor(i=a;i=n-b-1;i--)\n\t{\n\t\tjudge[i]++;\n\t}\n\tfor(i=0;i\nint main()\n{\n int a,b,n,i,x,count=0,y;\n scanf(\"%d%d%d\",&n,&a,&b);\n for(i=a+1;i<=n;i++) {\n y=n-i;\n if(y<=b) {\n count++;\n }\n }\n printf(\"%d\",count);\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n,a,b,p;\n scanf(\"%d %d %d\",&n,&a,&b);\n if((a+b)\nint main()\n{\n int n,a,b;\n scanf(\"%d%d%d\",&n,&a,&b);\n if(n-a<=b)\n printf(\"%d\",n-a);\n\telse\n\t\tprintf(\"%d\",b+1);\n}\n"}, {"source_code": "#include\n\nint min(int a,int b){\n return a > b ? b:a;\n}\nint main(){\n int n,a,b;\n scanf(\"%d %d %d\",&n,&a,&b);\n printf(\"%d\",min(n-a,b+1));\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,a,b,m;\n scanf(\"%d %d %d\",&n, &a, &b);\n int l;\n l=n-a;\n m=b+1;\n if(l>m)\n printf(\"%d\", m);\n else\n printf(\"%d\", l);\nreturn 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main()\n\n{\n int n,a,b,q,r;\n\n scanf(\"%d%d%d\",&n,&a,&b);\n q=n-a;\n r=b+1;\n if(q>r)\n printf(\"%d\",r);\n else\n printf(\"%d\",q);\n\n\n\n}\n"}, {"source_code": "#include\nint main(){\nint a,b,c,d,e,f;\nscanf(\"%d%d%d\",&a,&b,&c);\nif(b+c<=a-1){\nprintf(\"%d\",c+1);\n}\nelse{\nwhile(b+c!=a-1){\nc=c-1;\n}\n\nprintf(\"%d\",c+1);\n}\n}\n\n"}, {"source_code": "#include\nint max(int,int);\nint max(int a,int b)\n{\n if(a>b)\n return a;\n else\n return b;\n}\nint main()\n \n{\n int n,a,b;\n scanf(\"%d %d %d\", &n,&a,&b);\n printf(\"%d\",n-max(a+1,n-b)+1);\n return 0;\n}"}, {"source_code": "#include\nint max(int, int);\nint main()\n{\n\tint n, a, b;\n\tscanf(\"%d%d%d\", &n, &a, &b);\n\tprintf(\"%d\", n - max(a + 1, n - b) + 1);\n\treturn 0;\n}\n\nint max(int a, int b)\n{\n\treturn a >= b ? a : b;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,a,b;\n scanf(\"%d%d%d\",&n,&a,&b);\n int x;\n x=n-a;\n if(x>b) printf(\"%d\",b+1);\n else printf(\"%d\",x);\n}\n"}, {"source_code": "#include\nint main(){\n\tint a,b,n;\n\tscanf(\"%d%d%d\",&n,&a,&b);\n\tif (a+bn) printf(\"%d\",n-a);\n\telse if (a+b==n) printf(\"%d\",b);\n}"}, {"source_code": "#include\nint main()\n{\n int n,a,b;\n scanf(\"%d%d%d\",&n,&a,&b);\n if(n-a<=b)\n printf(\"%d\",n-a);\n\telse\n\t\tprintf(\"%d\",b+1);\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int n,a,b;\n scanf(\"%d %d %d\",&n,&a,&b);\n if(n-a>=b+1){\n printf(\"%d\",b+1);}\n if(n-a\n\nint main(){\n\tint num, a, b, ans=0;\n\tscanf(\"%d %d %d\", &num, &a, &b);\n\tnum-=a;\n\tb = b+1;\n\tif(b\nint main()\n{\n int a,b,c;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(a-b<=c+1)\n printf(\"%d\",a-b);\nelse\nprintf(\"%d\",c+1);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,a,b,x,i,count=0;\n scanf(\"%d %d %d\",&n,&a,&b);\n x=n-a;\n for(i=a+1;i<=n;i++)\n {\n if(n-i<=b)\n {\n count++;\n }\n }\n printf(\"%d\\n\",count);\n\n return 0;\n\n}\n"}, {"source_code": "#include\nint main(){\nint n,a,b,x=1,s=0;\n\nscanf(\"%d\",&n);\nscanf(\"%d\",&a);\nscanf(\"%d\",&b);\n\nif (n==1)\nprintf (\"%d\",n);\nelse\n{\n\twhile (x<=n)\n\t{if ((x>a)&&((n-x)<=b))\n\ts++;\n\tx++;\n\t}\n\t\n\t\n\tprintf(\"%d\",s);\n}\n\t\n}"}, {"source_code": "#include\nint main()\n{\n int n,a,b,x,y;\n scanf(\"%d%d%d\",&n,&a,&b);\n x=n-a;\n y=b+1;\n if(x\nint main()\n{\n int n,a,b;\n scanf(\"%d%d%d\",&n,&a,&b);\n int x;\n x=n-a;\n if(x>b) printf(\"%d\",b+1);\n else printf(\"%d\",x);\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int n,a,b;\n scanf(\"%d %d %d\",&n,&a,&b);\n if(n-a>=b+1){\n printf(\"%d\",b+1);}\n if(n-a\n#include\nint main()\n{\n int n,a,b;\n scanf(\"%d %d %d\",&n,&a,&b);\n if(b!=0)\n {\n printf(\"%d\",a+1);\n }\n if( a==n && b==0)\n {\n printf(\"%d\",n);\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,a,b,c,i;\n scanf(\"%d%d%d\",&n,&a,&b);\n printf(\"%d\\n\",n-a);\n \n return 0;\n}"}, {"source_code": "#include \n#include \n\n\nint main()\n{\n int arr[3];\n int i;\n for(i=0;i<3;i++){\n scanf(\"%d\",&arr[i]);\n }\n int p1=arr[1]+1;\n int p2=arr[2]+1;\n int p;\n if(p1>=p2){\n p=p2;\n }\n else{\n p=p1;\n }\n if((arr[0]/2)\n\nint main()\n{\n int n,a,b,p;\n\n scanf(\"%d %d %d\",&n,&a,&b);\n\n p=1+a;\n for(;;){\n if(n-p<=b)break;\n else p++;\n }\n\n printf(\"%d\",p);\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,a,b,p;\n\tscanf(\"%d%d%d\",&n,&a,&b);\n\t//condition 5 3 2\n\tif(a+b==n)p=a;\n\t//condition 5 2 2\n\telse if(a==b && a+bn)p=n-a;\n\tprintf(\"%d\",p);\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\nlong long a, b,c,d,e,f;\nscanf(\"%lld %lld %lld\",&a,&b,&c);\nif(b==1&&c==1)\n{\nf=a-1;\n}\nelse if(b==0)\n{\nf=a%c;\n}\nelse if(c==0)\n{\nf=a%b;\n}\nelse if(b==c)\n{\nf=a%b;\n}\nelse if(a%b==0)\n{\nd=a/b;\ne=a%c;\nf=d+e;\n}\nelse if(a%c==0)\n{\ne=a/c;\nd=a%b;\nf=d+e;\n}\nelse if(a%b==0&&a%c==0)\n{\nd=a/b;\ne=a/c;\nf=d+e;\n}\nelse\n{\nd=a%b;\ne=a%c;\nf=d+e;\n}\nprintf(\"%lld\",f);\nreturn 0;\n}"}, {"source_code": "\n#include\nint main()\n{\n int n,a,b;\n scanf(\"%d %d %d\\n\",&n,&a,&b);\n int sum=0;\n sum=a+b;\n int c;\n if(sum==n)\n {\n c=a+1;\n printf(\"%d\\n\",c);\n }\n else\n {\n c=a+1;\n printf(\"%d\\n\",c);\n }\n return 0;\n}"}, {"source_code": "\n#include\nint main()\n{\n int a,b,n;\n scanf(\"%d%d%d\",&n,&a,&b);\n if (a+1<=b) printf(\"%d\\n\",a+1);\n else printf(\"%d\\n\",b+1);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,a,b,l,v;\n\tscanf(\"%d%d%d\",&n,&a,&b);\n\tif (a>=b)\n\t{\n\tv=a-b;\n\tl=n-a-v;\n }\n else\n\t{\n\t\tl=n-a;\n\t}\n\tprintf(\"%d\",l);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main(){\nint n,p,q,a;\nscanf(\"%d %d %d\",&n,&p,&q);\nif (p>=q)\nprintf(\"%d\",n-q);\nelse printf(\"%d\",n-p);\nreturn 0;\n\n}"}, {"source_code": "#include\nint main ()\n{\n int a,b,c;\n scanf(\"%d%d%d\",&a,&b,&c);\n while(b>(a-c))\n c--;\n printf(\"%d\",b);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,a,b,i,c=0;\n scanf(\"%d%d%d\",&n,&a,&b);\n for(i=0;ia&&(n-i)>=b)\n // printf(\"%dg\\n\",i);\n c=c+1;\n }\n printf(\"%d\",c);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\n\n int n,a,b;\n scanf(\"%d%d%d\",&n,&a,&b);\n int c=a+b;\n int d=n-c;\n\n printf(\"%d\\n\",d+b);\n\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,a,b;\n\tscanf(\"%d %d %d\",&n,&a,&b);\n\tif(a\n\nint main()\n{\n int n,a,b,r,p=0;\n scanf(\"%d %d %d\",&n,&a,&b);\n\n r=n-a;\n if(b=n-b)\n {\n p++;\n }\n r++;\n }\n printf(\"%d\",p);\n }\n else{printf(\"%d\",r);}\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,a,b,x;\n scanf(\"%d%d%d\",&n,&a,&b);\n\n x=n-a;\n\n printf(\"%d\\n\",x);\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,a,b,i,c=0;\n scanf(\"%d%d%d\",&n,&a,&b);\n for(i=0;ia&&n-i<=b)\n // printf(\"%dg\\n\",i);\n c=c+1;\n }\n printf(\"%d\",c);\n return 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n int n,a,b;\n scanf(\"%d %d %d\",&n,&a,&b);\n if(a>=b)\n {\n printf(\"%d\\n\",n-a);\n }\n else\n {\n printf(\"%d\\n\",b+1);\n }\n}\n"}, {"source_code": "#include\nint main()\n{\nint n,a,b,c;\nscanf(\"%d\",&n);\nscanf(\"%d%d\",&a,&b);\nif((a+b)<=n)\n{\n\tif(n%2==0)\n\t{\n\t\tc=n/2;\n\t}\n\telse\n\t{\n\t\tc=(n+1)/2;\n\t}\n}\nprintf(\"%d\",c);\n}"}, {"source_code": "#include\nint main()\n{\n int n,a,b,i,cnt=0;\n scanf(\"%d %d %d\",&n,&a,&b);\n for(i=1;i<=n;i++)\n {\n if(i>=a && i<=b)\n cnt++;\n }\n printf(\"%d\\n\",cnt+1);\n}"}, {"source_code": "#include\nint main()\n{\n int n,a,b,c,i;\n scanf(\"%d%d%d\",&n,&a,&b);\n if(a-b==1)\n printf(\"%d\\n\",a);\n else\n printf(\"%d\\n\",n-a);\n\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\nint n,p,q,a;\nscanf(\"%d %d %d\",&n,&p,&q);\na=n-p;\nif (a>q)\nprintf(\"%d\",a+1);\nelse printf(\"%d\",a);\nreturn 0;\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,a,b,s,r,fact=1;\n scanf(\"%d %d %d\", &n, &a, &b);\n if(0<=a&&b\nint main()\n{\n int n,a,b,x,y,z;\n scanf(\"%d\",& n);\n scanf(\"%d\",& a);\n scanf(\"%d\",& b);\n if(a=b)\n {\n x=1;\n }\n else if(b>a)\n {\n x=b-a;\n }\n else if(a>b)\n {\n x=a-b;\n }\n y=(n+x)/2;\n printf(\"%d\", y);\n\n\n\n}\n"}, {"source_code": "#include \nint main()\n{\n\tint n, a, b, pos;\n\tscanf(\"%d %d %d\", &n, &a, &b);\n\tif(b=0)\n\t{\n\t pos = 1;\n\t}\n\telse if(a=0)\n\t{\n\t pos=n;\n\t}\n\telse\n\t{\n\t pos = 1+((a+b)/2);\n\t}\n\tprintf(\"%d\", pos);\n\treturn 0;\n}"}, {"source_code": "#include \nint main()\n{\n int a,b,c,n;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(b+c==a){\n n=a-b;\n }\n else{\n n=b+1;\n }\n printf(\"%d\",n);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\nint n,a,b;\nscanf(\"%d%d%d\",&n,&a,&b);\nif(a+b>=n)\n{\nprintf(\"%d\", n-a);\n}\nelse\n{\nif(a>b)\n{\nprintf(\"%d\",a+1);\n}\nelse\n{\nprintf(\"%d\", n-b);\n}\n}\nreturn 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n\tint n;\n int a,b;\n scanf(\"%d \",&n);\n scanf(\"%d \",&a);\n scanf(\"%d \",&b);\n int k=0;\n while(a\nint main()\n{\n int n,a,b;\n scanf(\"%d %d %d\",&n,&a,&b);\n if(a+b==n){printf(\"%d\",b);}\n if(a+b\nint main()\n{\n int n,a,b,i,c=0;\n scanf(\"%d%d%d\",&n,&a,&b);\n for(i=0;ia&&n-i\nint main()\n{\n int n,a,b,i;\n scanf(\"%d %d %d\", &n,&a,&b);\n i=a+1;\n printf(\"%d\",i);\n return 0;\n\n\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int ntotal, aless, bmore, front=0;\n\tint * number;\n\tint i, j=0;\n\tscanf(\"%d %d %d\", &ntotal, &aless, &bmore);\n\n\tnumber=(int *)malloc(ntotal * sizeof(int));\n\n\tfor(i=0;i=aless && (ntotal-front-1)<=bmore)\n\t\t\tj++;\n\t}\n\n\tprintf(\"%d\\n\", j);\n\tfree(number);\n\n\treturn 0;\n}\n\t \t\t\t\t \t\t\t\t\t \t \t\t \t"}, {"source_code": "#include\nint main()\n{\n int n,a,b;\n scanf(\"%d %d %d\",&n,&a,&b);\n printf(\"%d\\n\",n-a);\n return 0;\n}\n"}, {"source_code": "#include\nmain()\n{\n int n,a,b,i,x=0;\n scanf(\"%d%d%d\",&n,&a,&b);\n for(i=1;i<=n;i++)\n {\n if(i>=a && (n-i)<=b)\n x++;\n }\n printf(\"%d\",x);\n}\n"}, {"source_code": "#include\nint main(){\nint a,b,c;scanf(\"%d %d %d\",&a,&b,&c);\nprintf(\"%d\",b+1);\n}\n"}, {"source_code": "#include\n#include\n\nint main()\n{\n int n, b, a, i, x, y;\n scanf(\"%d %d %d\", &n, &a, &b);\n if(a>=0 && (n>b && n<=100))\n {\n if(b==0 && a==0)\n {\n y=0;\n }\n else if(b==0 || a==0)\n {\n y=b+1;\n }\n else\n {\n y=a+1;\n }\n }\n printf(\"%d\", y);\n\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n\tint n,a,b;\n\tscanf(\"%d %d %d\",&n,&a,&b);\n\tprintf(\"%d\\n\",n-b+a-1);\n\treturn 0;\n}\t\n"}, {"source_code": "\n#include\nint main()\n{\n int a,b,n;\n scanf(\"%d%d%d\",&n,&a,&b);\n if(a+b<=n){\n if (a+1<=b) printf(\"%d\\n\",a+1);\n else printf(\"%d\\n\",b+1);\n }\n else if(a==b&&(a+b)>n)\n {\n printf(\"1\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,c,e;\n scanf(\"%d %d %d\",&a,&b,&c);\n if((b+c)==a)\n {\n e= a-b;\n }\n else if((b+c)\n\nint main()\n{\n\tint a,b,n,x;\n\tscanf(\"%d %d %d\",&n,&a,&b);\n\t\n\t//not less then 'a' & not more than 'b'\n\tx = n - (int)(a+b)/2;\n\tprintf(\"\\n%d\\n\",x);\n\treturn 0;\n}\n\n\n"}, {"source_code": "#include\nmain()\n{\n int n,a,b,i;\n scanf(\"%d%d%d\",&n,&a,&b);\n for(i=1;i<=n;i++)\n {\n if(i>a && (i)\nmain()\n{\n int n,a,b;\n scanf(\"%d%d%d\",&n,&a,&b);\n int x,p;\n x=a+b;\n if(x>=n)\n {\n p=a+1;\n }\n else\n {\n p=n-b;\n }\n printf(\"%d\",p);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int a , b , n , ans , solve ;\n scanf(\"%d%d%d\",&n,&a,&b);\n ans = n - a ;\n solve = n - b ;\n if(ans>=solve)\n {\n printf(\"%d\",ans);\n }\n else\n {\n printf(\"%d\",solve);\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n, a, b;\n\tscanf(\"%d%d%d\", &n, &a, &b);\n\tprintf(\"%d\\n\", n - a);\n\treturn 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int a,b,c;\n scanf(\"%d %d %d\",&a,&b,&c);\n if (a-b-1<=c)\n {\n printf(\"%d\",a-b);\n }\n if (a-b-1>c)\n {\n printf(\"%d\",c);\n }\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n,a,b,p;\n scanf(\"%d %d %d\",&n,&a,&b);\n if((a+b)==n) p = b;\n else if((a+b)\n#include \n\nint main()\n{\n int a ;\n int b ;\n int n ;\n scanf(\"%d\",&n);\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n if (n-a\nint main () \n{ \n int n, a, b; \n scanf(\"%d%d%d\", &n, &a, &b);\n printf(\"%d\\n\",b+1); \n return 0;\n }"}, {"source_code": "#include \n\nint main()\n{\n int n,a,b;\n scanf(\"%d%d%d\",&n,&a,&b);\n if(a+b<=n){\n printf(\"%d\",b);\n }else {\n printf(\"%d\",n-a+1);\n }\n return 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n int n,a,b;\n scanf(\"%d %d %d\",&n,&a,&b);\n if(a+b==n){printf(\"%d\",b);}\n if(a+bn){printf(\"%d\",n-a);}\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,a,b;\n\tscanf(\"%d %d %d\",&n,&a,&b);\n\tif(a+b==n)\n\t\tprintf(\"%d\",n-a);\n\telse\n\t\tprintf(\"%d\",b+1);\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\nint n,a,b,c;\nscanf(\"%d%d%d\",&n,&a,&b);\nif(n-a-1>=b)\n{\nprintf(\"%d\",b+1);\n}\nelse\n{\nprintf(\"%d\",n-a-1);\n}\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,a,b;\n scanf(\"%d%d%d\",&n,&a,&b);\n int x;\n x=n-a;\n if(b>=x) printf(\"%d\",b);\n else printf(\"%d\",b+1);\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n,a,b;\n scanf(\"%d%d%d\",&n,&a,&b);\n if(n-a>b+1)\n printf(\"%d\",n-a);\n else\n printf(\"%d\",b+1);\n}"}, {"source_code": "#include\nint main()\n{\n int n,a,b;\n scanf(\"%d%d%d\",&n,&a,&b);\n printf(\"%d\",n-a);\n}\n"}, {"source_code": "#include\nint main()\n{\n int a , b , n , ans , solve ;\n scanf(\"%d%d%d\",&n,&a,&b);\n if(a<=b)\n {\n ans = n - a ;\n printf(\"%d\", ans);\n }\n else\n {\n ans = n - a ;\n solve =n - ans ;\n printf(\"%d\", solve);\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main(){\n int a,b,n,way;\n scanf(\"%d%d%d\",&n,&a,&b);\n if(nb){way=n-a;}\n else if(n==a+b){way=b;}\n printf(\"%d\",way);\n return 0;}"}, {"source_code": "#include \n\nint main(void) \n{\n int n,a,b;\n scanf(\"%d %d %d\",&n,&a,&b);\n printf(\"%d\",a+1);\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\nint a,b,c,d,e,f;\nscanf(\"%d%d%d\",&a,&b,&c);\nif(b+c==a-1){\nprintf(\"%d\",c+1);\n}\nelse{\nwhile(b+c!=a-1){\nc=c-1;\n}\nprintf(\"%d\",c+1);\n}\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,c,e;\n scanf(\"%d %d %d\",&a,&b,&c);\n if((b+c)==a)\n {\n e= a-b;\n }\n else if((b+c)\nint main()\n{\n int n,a,b,L;\n scanf(\"%d%d%d\",&n,&a,&b);\n printf(\"%d\",n-a);\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,a,b;\n scanf(\"%d%d%d\",&n,&a,&b);\n printf(\"%d\",n-a);\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int n,a,b,rem;\n scanf(\"%d %d %d\", &n,&a,&b);\n rem=n-a;\n if(rem==b)\n printf(\"%d\", n-a);\n else\n printf(\"%d\", (n-a)+((n-a)-(b+1)));\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,a,b;\n scanf(\"%d%d%d\",&n,&a,&b);\n printf(\"%d\",a+1);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint n,a,b,p;\n scanf(\"%d%d%d\",&n,&a,&b);\n\tif(n-(a+b)>1)\n\t{\n\t\tp=n-(a+1);\n\t}\n\telse\n\t{\n\t\tp=n-a;\n\t}\n\t\tprintf(\"%d\",p);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n\t\n\tint n, a, b, start, ans;\n\tint i;\n\t\n\tscanf(\"%d %d %d\", &n, &a, &b);\n\t\n\tstart = a+1;\n\t\n\tfor (i = start; i <= n; i++)\n\t{\n\t\tif (n-i <= b)\n\t\t{\n\t\t\tans += 1;\n\t\t}\n\t}\n\t\n\tprintf(\"%d\", ans);\n\t\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n int n,a,b,c,d;\n scanf(\"%d %d %d\",&n,&a,&b);\n c=n-a;\n d=n-(a+b);\n if(a+b+1\nint min(int a,int b) {\n if(a\nint main()\n{\n int n,a,b,result;\n scanf(\"%d %d %d\",&n,&a,&b);\n result=n-a;\n if (result<=b+1)\n {\n printf(\"%d\",result);\n }\n else\n {\n printf(\"%d\",b);\n }\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,a,b,c,d,ans;\n scanf(\"%d %d %d\",&n,&a,&b);\n c=n-a;\n d=n-c;\n if(d<=b)\n {\n ans=c;\n }\n else\n ans=d;\n printf(\"%d\",ans);\n return 0;\n}"}, {"source_code": "#include\nmain()\n{\n int n,a,b;\n scanf(\"%d%d%d\",&n,&a,&b);\n printf(\"%d\",n-a);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,a,b;\n scanf(\"%d%d%d\",&n,&a,&b);\n if(a<=b)\n printf(\"%d\",n-a);\n else\n printf(\"%d\",b+1);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,a,b,p=0,j;\n\tscanf(\"%d%d%d\",&n,&a,&b);\n\tfor(int j=a+1;j<=n;j++)\n\t{\n\t\tif(n-j<=b) ;\n\t\tp=p+1;\n\t}\n\tprintf(\"%d\",a);\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,a,b;\n\tscanf(\"%d %d %d\",&n,&a,&b);\n\tif(a+b\nint main()\n{\n\tint n, a, b, pos;\n\tscanf(\"%d %d %d\", &n, &a, &b);\n\tif(b==0)\n\t{\n\t pos = 1;\n\t}\n\telse if(a==0)\n\t{\n\t pos=n;\n\t}\n\telse\n\t{\n\t pos = 1+((a+b)/2);\n\t}\n\tprintf(\"%d\", pos);\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint a,b,c;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tif(b>c)\n\t{\n\t\tif(c==0)\n\t\tprintf(\"%d\",c+1);\n\t\telse\n\t\tprintf(\"%d\",c);\n\t}\n\telse\n\t{\n\t\tif(c=b)\n\t\t{\n\t\t\tif(b+1\nint main(){\n int a,b,c,d,f;\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n scanf(\"%d\",&c);\n d=a-c;\n if(d!=b){\n printf(\"%d\",d);\n }\n else{\n f=a-(c-1);\n\n printf(\"%d\",f);\n }\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n,a,b,count=1,i;\n scanf(\"%d%d%d\",&n,&a,&b);\n for(i=a;i<=b;i++)\n {\n count++;\n }\n printf(\"%d\",count);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(){\n int n, a, b;\n scanf(\"%d %d %d\", &n, &a, &b);\n int result = n - a;\n printf(\"%d\\n\", result);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,a,b,c,d,ans;\n scanf(\"%d %d %d\",&n,&a,&b);\n c=n-a;\n d=n-c;\n \n if(d<=b)\n {\n ans=c;\n }\n else\n ans=d+1;\n printf(\"%d\",ans);\n return 0;\n}"}, {"source_code": "#include\n#include\n\nint main()\n\n{\n int n,a,b,c,e,i,j;\n\n scanf(\"%d %d &d\",&n,&a,&b);\n c=n-a;\n i=b;\n j=a;\n\n if(c>=i)\n {\n e=n-i;\n }\n else\n {\n e=n-j;\n }\n printf(\"%d\",e);\n return 0;\n\n}\n"}, {"source_code": "#include \n\nint main(){\n int a,b,c,count = 0;\n scanf(\"%d %d %c\", &a,&b,&c);\n a++;\n for(int i = 0; i <=a; i++){\n if(i >= b && (a-1)<= c) count++;\n }\n printf(\"%d\\n\", count);\n return 0;\n}\n\n"}, {"source_code": "#include\n\nint main(void)\n{\n int n, a, b;\n \n scanf(\"%d %d %d\", &n, &a, &b);\n \n printf(\"%d\", (a > b) ? a + 1 : b + 1);\n \n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,a,b;\n scanf(\"%d %d %d\\n\",&n,&a,&b);\n int c=0,s,v;\n for(int i=1;i<=n;i++)\n {\n s=n-a;\n v=b+1;\n if(s\n#include\n\nint main()\n{\n int n, b, a, i, x, y;\n scanf(\"%d %d %d\", &n, &a, &b);\n if(a>=0 && (n>b && n<=100))\n {\n if(b==0 && a==0)\n {\n y=0;\n }\n else if(b==0 || a==0)\n {\n y=b+1;\n }\n else if(b==a)\n {\n y=1;\n }\n else\n {\n y=a+1;\n }\n }\n printf(\"%d\", y);\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main(){\n\n int n;\n int a,b;\n int result;\n int i=0;\n\n scanf(\"%d%d%d\",&n,&a,&b);\n if(na+b)\n printf(\"%d\",b+1);\n else\n printf(\"%d\",n);\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,a,b,r,k;\n scanf(\"%d %d %d\",&n,&a,&b);\n r = n-a;\n k=a+b;\n if(a==b){\n printf(\"%d\\n\",n-a);\n }\n else if(k==n){\n if(a>b){\n printf(\"%d\",++b);\n }\n if(b>a){\n printf(\"%d\\n\",++a);\n }\n }\n\n else if(k!=n){\n printf(\"%d\\n\",++b);\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int n,a,b;\n scanf(\"%d%d%d\",&n,&a,&b);\n if(a+b<=n){\n printf(\"%d\",b);\n }else {\n printf(\"%d\",n-a);\n }\n return 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n int n,a,b,c,d,ans;\n scanf(\"%d %d %d\",&n,&a,&b);\n c=n-a;\n d=n-c;\n if(d<=b)\n {\n ans=c;\n }\n else\n ans=d;\n printf(\"%d\",ans);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\nint n,a,b,d;\nscanf(\"%d%d%d\",&n,&a,&b);\nd=n-a;\nprintf(\"%d\",d);\n}\n\n"}, {"source_code": "#include\nint main()\n{\n int a,b,c;\n scanf(\"%d %d %d\",&a,&b,&c);\n printf(\"%d\",a-b);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,a,b;\n int l;\n l=n-a;\n printf(\"%d\", l);\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n,a,b,c;\n scanf(\"%lld %lld %lld\",&n,&a,&b);\n printf(\"%lld\",(n-a));\n return 0;\n}"}, {"source_code": "#include\nint main(void)\n{\n int n, a, b, i, count=0, k;\n scanf(\"%d%d%d\", &n, &a, &b);\n k = (n-(a+1));\n for(i=a; i b)\n {\n count = count - (a-b) ;\n }\n if(k\n#include\n\nint main()\n{\n int n, b, a, i, x, y;\n scanf(\"%d %d %d\", &n, &a, &b);\n if(a>=0 && (n>b && n<=100))\n {\n x=a-b;\n if(x<=0)\n y=n-a;\n else if(b==0)\n y=n-a;\n else if(a==0)\n y=n;\n else\n y=n-(a+x);\n \n }\n printf(\"%d\", y);\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,a,b;\n scanf(\"%d%d%d\",&n,&a,&b);\n if(a\n\nint main()\n\n{\n \nint n, a, b;\n\nscanf(\"%d %d %d\", &n, &a, &b);\n\nif(n-a > 1+b)\nprintf(\"%d\",n-a);\n\nelse\nprintf(\"%d\", b+1);\n\nreturn 0;\n}\n"}, {"source_code": "#include\nint main(){\nint a,b,n;scanf(\"%d %d %d\",&n,&a,&b);\nif(a==0 || (n-a)\nint main()\n{\n int n,a,b,i;\n scanf(\"%d%d%d\",&n,&a,&b);\n if(n-b==a)\n printf(\"%d\",a+1);\n else if(n-a==b)\n printf(\"%d\",b);\n else if(n-a>b)\n printf(\"%d\",b+1);\n else if(n-b>a)\n printf(\"%d\",a+1);\n return 0;\n\n\n\n}\n"}], "src_uid": "51a072916bff600922a77da0c4582180"} {"nl": {"description": "Valera the horse lives on a plane. The Cartesian coordinate system is defined on this plane. Also an infinite spiral is painted on the plane. The spiral consists of segments: [(0, 0), (1, 0)], [(1, 0), (1, 1)], [(1, 1), ( - 1, 1)], [( - 1, 1), ( - 1,  - 1)], [( - 1,  - 1), (2,  - 1)], [(2,  - 1), (2, 2)] and so on. Thus, this infinite spiral passes through each integer point of the plane.Valera the horse lives on the plane at coordinates (0, 0). He wants to walk along the spiral to point (x, y). Valera the horse has four legs, so he finds turning very difficult. Count how many times he will have to turn if he goes along a spiral from point (0, 0) to point (x, y).", "input_spec": "The first line contains two space-separated integers x and y (|x|, |y| ≤ 100).", "output_spec": "Print a single integer, showing how many times Valera has to turn.", "sample_inputs": ["0 0", "1 0", "0 1", "-1 -1"], "sample_outputs": ["0", "0", "2", "3"], "notes": null}, "positive_code": [{"source_code": "\n#include \nint f(int x){return x<0?-x:x;}\nint main() {\n int x, y, mayor;\n scanf(\"%d%d\",&x,&y);\n if ((x == 0 && y == 0) || (x == 1 && y == 0))\n printf(\"0\\n\");\n else {\n mayor = (f(x) > f(y) ? f(x) : f(y))*4;\n if( x>y || (x>0 && y>0 && x==y)){\n if(x>y && f(x)<=f(y) )\n printf(\"%d\\n\",mayor);\n else if( x>0 && y<0 && f(x)-f(y)==1 )\n printf(\"%d\\n\",mayor-4);\n else\n printf(\"%d\\n\",mayor-3);\n }else if( x\n\nint good(int a, int b, int c) {\n\tif (b > c) {\n\t\tint tmp;\n\n\t\ttmp = b;\n\t\tb = c;\n\t\tc = tmp;\n\t}\n\treturn a >= b && a <= c;\n}\n\nint main() {\n\tstatic int xx[401], yy[401];\n\tint x, y, i, a, b, c, d, e;\n\n\tscanf(\"%d%d\", &x, &y);\n\ta = b = 0;\n\tc = d = e = 1;\n\tfor (i = 0; i < 401; i++) {\n\t\txx[i] = a;\n\t\tyy[i] = b;\n\t\tif (c)\n\t\t\tif (d)\n\t\t\t\ta += e;\n\t\t\telse\n\t\t\t\ta -= e;\n\t\telse\n\t\t\tif (d)\n\t\t\t\tb += e, e++, d = 0;\n\t\t\telse\n\t\t\t\tb -= e, e++, d = 1;\n\t\tc = !c;\n\t}\n\tfor (i = 0; i + 1 < 401 && (xx[i] != x || !good(y, yy[i], yy[i + 1])) && (yy[i] != y || !good(x, xx[i], xx[i + 1])); i++)\n\t\t;\n\tprintf(\"%d\\n\", i);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n\tint x, y;\n\n\tscanf(\"%d%d\", &x, &y);\n\tprintf(\"%d\\n\", x > 0 && y > -x + 1 && y <= x ? 1 + 4 * (x - 1) : y > 0 && x < y && x >= -y ? 2 + 4 * (y - 1) : x < 0 && y < -x && y >= x ? 3 + 4 * (-x - 1) : 4 + 4 * (-y - 1));\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n\nint plus[4][2]={{1, 0},{0, 1},{-1,0},{0,-1}};\nbool v[300][300];\n\nbool visited(int x, int y){\n\tif(v[x+150][y+150]) return true;\n\tv[x+150][y+150]=true;\n\treturn false;\n}\n\nint main(){\n\tint ex, ey, num=0, dir=0, x=1, y=0;\n\tscanf(\"%d %d\", &ex, &ey);\n\tif(ex==0 && ey==0){\n\t\tputs(\"0\");\n\t\treturn 0;\n\t}\n\tvisited(0, 0);\n\twhile(!(x==ex && y==ey)){\n\t\tvisited(x, y);\n\t\tif(visited(x+plus[(dir+1)%4][0], y+plus[(dir+1)%4][1])){\n\t\t\tx+=plus[dir][0]; y+=plus[dir][1];\n\t\t}\n\t\telse{\n\t\t\tdir=(dir+1)%4; ++num;\n\t\t\tx+=plus[dir][0]; y+=plus[dir][1];\n\t\t}\n\t}\n\tprintf(\"%d\\n\", num);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \nint max(int a,int b){\n\treturn a>b?a:b;\n}\nint min(int a,int b){\n\treturn a=x&&a<=x&&b==y)\n\t\t\t\tgoto end;\n\t\t\t\ta=xx;\n\t\t\t\tbreak;\n\t\t\tcase 1:\n\t\t\t\tif(++yx>=y&&b<=y&&a==x)\n\t\t\t\tgoto end;\n\t\t\t\tb=yx;\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tif(--xn<=x&&a>=x&&b==y)\n\t\t\t\tgoto end;\n\t\t\t\ta=xn;\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\tif(--yn<=y&&b>=y&&a==x)\n\t\t\t\tgoto end;\n\t\t\t\tb=yn;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\tend:\n\tprintf(\"%d\",t);\n}"}, {"source_code": "#include\nint main()\n{\n\tint x,y,ans=0;\n\tscanf(\"%d%d\",&x,&y);\n\tif(x>=y&&x>-y+1)\n\tans=-3+4*x;\n\tif(x<=y&&x<-y)\n\tans=-1-4*x;\n\tif(y>x&&x>=-y)\n\tans=-2+4*y;\n\tif(x>y&&x<=-y+1)\n\tans=-4*y;\n\tprintf(\"%d\",ans);\n}"}, {"source_code": "/*\n#include \n#include \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(cb){\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 \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \n#include \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 \n#include \n#include \n#include \n#include \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 \n#include \n#include \n#include \n#include \n\nint main() {\n\n int x, y;\n scanf(\"%d %d\", &x, &y);\n int s = 0;\n if(y>x && x>=-y)s=-2+y*4;\n if(y-y+1)s=-3+x*4;\n if(y>=x && x<-y)s=-1-4*x;\n\n printf(\"%d\", s);\n\n\n return 0;\n\n}\n"}, {"source_code": "#include \n#include \nint check(int x,int y) {\nif ((x>=0) && y>0 ) {\n return 1;\n} else if ((x<0) && y>=0) {\nreturn 2;\n} else if(y<0 && x<=0){\nreturn 3;\n} else if (x>0 &&y<=0) {\nreturn 4;\n}\nreturn 0;\n}\nint main()\n{\n int x,y;\n scanf(\"%d %d\",&x,&y);\n if (x==0&&y==0) {\n printf(\"0\");\n } else {\n if (check(x,y) == 1) {\n if (x>=y) {\n printf(\"%d\",1+(x-1)*4);\n } else {\n printf(\"%d\",2+(y-1)*4);\n }\n } else if (check(x,y) == 2) {\n x = -1*x;\n if (y>=x) {\n printf(\"%d\",2+(y-1)*4);\n } else {\n printf(\"%d\",3+(x-1)*4);\n }\n } else if (check(x,y) == 3) {\n x = -1*x;\n y = -1*y;\n if (x>=y) {\n printf(\"%d\",3+(x-1)*4);\n } else {\n printf(\"%d\",4*y);\n }\n } else {\n x = x-1;\n y = y*-1;\n if (y>=x) {\n printf(\"%d\",4*y);\n }else {\n printf(\"%d\",5+(x-1)*4);\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n/* Written by Nishant Mittal aka nishantwrp */\nint check(int x,int y) {\nif ((x>=0) && y>0 ) {\n return 1;\n} else if ((x<0) && y>=0) {\nreturn 2;\n} else if(y<0 && x<=0){\nreturn 3;\n} else if (x>0 &&y<=0) {\nreturn 4;\n}\nreturn 0;\n}\nint main()\n{\n int x,y;\n scanf(\"%d %d\",&x,&y);\n if (x==0&&y==0) {\n printf(\"0\");\n } else {\n if (check(x,y) == 1) {\n if (x>=y) {\n printf(\"%d\",1+(x-1)*4);\n } else {\n printf(\"%d\",2+(y-1)*4);\n }\n } else if (check(x,y) == 2) {\n x = -1*x;\n if (y>=x) {\n printf(\"%d\",2+(y-1)*4);\n } else {\n printf(\"%d\",3+(x-1)*4);\n }\n } else if (check(x,y) == 3) {\n x = -1*x;\n y = -1*y;\n if (x>=y) {\n printf(\"%d\",3+(x-1)*4);\n } else {\n printf(\"%d\",4*y);\n }\n } else {\n x = x-1;\n y = y*-1;\n if (y>=x) {\n printf(\"%d\",4*y);\n }else {\n printf(\"%d\",5+(x-1)*4);\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \nint main(void)\n{\n char ch;\n char* input = (char*)malloc(10);\n int i = 0;\n int on_y = 0;\n int neg_x = 0; \n int neg_y = 0;\n while(read(0, &ch, 1) > 0)\n {\n if(ch != '-')\n {\n input[i] = ch; \n i++;\n if(ch == ' ')\n {\n on_y = 1;\n }\n }\n else if(on_y)\n {\n neg_y = 1; \n }\n else\n {\n neg_x = 1; \n }\n }\n input[i] = '\\0';\n int x = strtol(input, &input, 10);\n if(neg_x)\n {\n x *= -1;\n }\n while(*input != ' ')\n {\n input++;\n }\n int y = strtol(input, &input, 10);\n if(neg_y)\n {\n y *= -1;\n }\n if(x < 0 && x <= y && y < -1 * x)\n {\n printf(\"%d\",4 * (-1*x - 1) + 3);\n }\n else if(x > 0 && -x + 1 < y && y <= x)\n {\n printf(\"%d\",4*(x-1) + 1);\n }\n else if(y > 0 && -1 * y <= x && x < y)\n {\n printf(\"%d\", 4 * (y - 1) + 2);\n }\n else if((x <= 1 && y == 0) || (y < 0 && y < x && x <= -1*y + 1))\n {\n printf(\"%d\", -4 * y);\n }\n return 0; \n \n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int x,y,result;\n scanf(\"%d %d\",&x,&y);\n if(x==0 && y==0)result=0;\n else if(x==1 && y==0)result=0;\n else if(x==0 && y==1)result=2;\n else if(x==0 && y==-1)result=4;\n else if(x==-1 && y==0)result=3;\n else if(x>=0 && y>=0)\n {\n if(x=0 && y<0)\n {\n if(x>abs(y))\n {\n if(x-abs(y)==1)\n result=(4*abs(y));\n else\n result=(3*x)+(x-3);\n }\n else result=(4*abs(y));\n }\n else if(x<0 && y>=0)\n {\n if(abs(x)>y)\n result=(3*abs(x))+(abs(x)-1);\n else result=(3*y)+(y-2);\n }\n printf(\"%d\",result);\n return 0;\n}"}, {"source_code": "#include \n\nint main(void) {\n\tint x,y;\n\tscanf(\"%d %d\", &x, &y);\n\tif (x == 0 && y == 0)\n\t{\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\tif ( y <= 0 && x <= -y+1 && x >= y +1)\n\t{\n\t\tprintf(\"%d\", -y*4);\n\t}\n\telse if ( x > 0 && y >= -x +2 && y <= x)\n\t{\n\t\tprintf(\"%d\", x*4 -3);\n\t}\n\telse if (y > 0 && x<= y -1 && x >= -y)\n\t{\n\t\tprintf(\"%d\", y *4 -2);\n\t}\n\telse if (x < 0 && y <= - x +1 && y>= x -1)\n\t{\n\t\tprintf(\"%d\", -x*4 -1);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\n\ninline int abs(int a) { return a < 0 ? -a : a; }\n\nint main() {\n\tint x, y, cnt = 0;\n\tscanf(\"%d%d\", &x, &y);\n\t\n\tif(y == 0 && x <= 1 && x >= 0)\n\t\tcnt = 0; // lol\n\telse if((-y == x && y > 0) || (y > 0 && abs(x) <= y && !(x == y && x > 0))) // Last Type (1) [Or current = Type (2)]\n\t\tcnt = 4 * y - 2;\n\telse if((y == x && x < 0) || (x < 0 && abs(y) <= -x && !(-y == x && y > 0))) // Last Type (2) [Or current = Type (3)]\n\t\tcnt = 4 * (-x) - 1;\n\telse if((-y + 1 == x && y < 0) || (y < 0 && abs(x) <= -y && !(y == x && x < 0))) // Last Type (3) [Or current = Type (4)]\n\t\tcnt = 4 * (-y);\n\telse\n\t\tcnt = 4 * (x-1) + 1;\n\t\n\tprintf(\"%d\", cnt);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint numTurns(int x, int y) {\n int c = abs(x)+abs(y);\n //Detect whether the point lies on a bottom, top, left, or right segment\n if (x > 0 && y >= 2-x && y<= x) {\n return x*4-3;\n }\n if (x < 0 && y >= x && y<= -1-x) {\n return (-x)*4-1;\n }\n if (y > 0 && x >= -y && x <= y-1) {\n return y*4-2;\n }\n if (y <= 0 && x>= 1+y && x <= 1-y) {\n return y*(-4);\n }\n else {\n return 0;\n }\n}\n\nint main() {\n int x, y;\n scanf(\"%d %d\", &x, &y);\n int n = numTurns(x, y);\n printf(\"%d\", n);\n return 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n\tint flap=1;int done=0;int turns=0;\n\tint x,y;\n\tscanf(\"%d %d\",&x,&y);\n\tint x1=0,y1=0;\n\tint c=1;int i=1;\n\tfor(c=1,i=1;;i++)\n\t{\n\t int x2=x1;int y2=y1;\n\t\tif(flap==1)\n\t\t{\n\t\t\tif(c%2==0)\n\t\t\t\tx1=x1-c;\n\t\t\telse\n\t\t\t\tx1=x1+c;\n\t\t\tflap=0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(c%2==0)\n\t\t\t\ty1=y1-c;\n\t\t\telse\n\t\t\t\ty1=y1+c;\n\t\t\tflap=1;\n\t\t}\n\t if(i%2==0)\n\t\t c++;\n\t\t//printf(\"[%d %d] [%d %d]\\n\",x2,y2,x1,y1);\n\t\t//yha tak sahi h\n\t\t\n\t\t//check\n\t\tif(y1==y2 && y==y1)\n\t\t{\n\t\t if((x1<=x && x2>=x) || (x1>=x && x2<=x))\n\t\t {\n\t\t printf(\"%d\",turns);\n\t\t done=1;\n\t\t }\n\t\t}\n\t\telse if(x1==x2 && x==x1)\n\t\t{\n\t\t if((y1<=y && y2>=y) || (y1>=y && y2<=y))\n\t\t {\n\t\t printf(\"%d\",turns);\n\t\t done=1;\n\t\t } \n\t\t}\n\t\tif(done)\n\t\t break;\n\t\tturns++;\n\t}\n \n\treturn 0;\n}"}, {"source_code": "#include\n//Written By GHATAK...\nint main()\n{\n int x,y;\n scanf(\"%d %d\",&x,&y);\n if(((x==1)||(x==0))&&(y==0))\n {\n printf(\"0\");\n return 0;\n }\n else if(((x-y)>=0)&&((x+y-1)>0))\n {\n printf(\"%d\",(4*x-3));\n return 0;\n }\n else if(((x+y)>=0)&&((x-y)<0))\n {\n printf(\"%d\",(4*y-2));\n return 0;\n }\n else if(((x+y)<0)&&((x-y)<=0))\n {\n printf(\"%d\",((-4*x)-1));\n return 0;\n }\n else if(((x-y)>0)&&((x+y-1)<=0))\n {\n printf(\"%d\",((-4)*y));\n return 0;\n }\n return 0;\n}\n"}, {"source_code": "#include \n\ntypedef struct\n{\n\tint x,y;\n}Point_t ;\nPoint_t Now;\n\nint main()\n{\n\tint x,y,add,Res;\n\tscanf(\"%d %d\",&x,&y);\n\tadd=1;\n\tNow.x=Now.y=0;\n\twhile(add)\n\t{\n\t\tif(add&1)\n\t\t{\n\t\t\tif(y==Now.y&&x>=Now.x&&x<=Now.x+add)\n\t\t\t{\n\t\t\t\tRes=((add-1)<<1)+1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tNow.x+=add;\n\t\t\tif(x==Now.x&&y>=Now.y&&y<=Now.y+add)\n\t\t\t{\n\t\t\t\tRes=add<<1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tNow.y+=add;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(y==Now.y&&x>=Now.x-add&&x<=Now.x)\n\t\t\t{\n\t\t\t\tRes=((add-1)<<1)+1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tNow.x-=add;\n\t\t\tif(x==Now.x&&y>=Now.y-add&&y<=Now.y)\n\t\t\t{\n\t\t\t\tRes=add<<1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tNow.y-=add;\n\t\t}\n\t\t++add;\n\t}\n\tprintf(\"%d\\n\",Res-1);\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main()\n{\n int i,x,y,a,b,d=1,turns=(-1),m=1,x1=0,y1=0,x2=0,y2=0;\n scanf(\"%d %d\",&x,&y);\n a=b=0;\n while(1)\n {\n x1=a;\n y1=b;\n if(m==1)\n {\n a=a+d;\n m++;\n turns++;\n \n }\n else if(m==2)\n {\n b=b+d;\n m++;\n d++;\n turns++;\n }\n else if(m==3)\n {\n a=a-d;\n m++;\n turns++;\n }\n else if(m==4)\n {\n b=b-d;\n m=1;\n d++;\n turns++;\n }\n x2=a;\n y2=b;\n if((((x>=x1 && x<=x2)|| (x<=x1 && x>=x2)) && (y==y2 && y==y1))||((x==x1 && x==x2) && ((y>=y1 && y<=y2) || (y<=y1 && y>=y2))))\n break;\n }\n printf(\"%d\",turns);\n \n \nreturn 0;\n}"}, {"source_code": "#include \n#define Change {cost[0] = cote[0]; cost[1] = cote[1];}\n#define X cost[0] == coen[0]\n#define Y cost[1] == coen[1]\nint main(){\n int turn = -1, add = 1;\n int coen[2], cost[2], cote[2] = {0, 0};\n scanf(\"%d%d\", coen+0, coen+1);\n for(;;){\n Change\n cote[0] += add;\n turn++;\n if(coen[0] <= cote[0] && cost[0] <= coen[0] && Y)\n break;\n Change\n cote[1] += add;\n turn++; add++;\n if(coen[1] <= cote[1] && cost[1] <= coen[1] && X)\n break;\n Change\n cote[0] -= add;\n turn++;\n if(coen[0] >= cote[0] && cost[0] >= coen[0] && Y)\n break;\n Change\n cote[1] -= add;\n turn++; add++;\n if(coen[1] >= cote[1] && cost[1] >= coen[1] && X)\n break;\n }\n printf(\"%d\\n\", turn);\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n#include \nint main()\n{\n int x=0,y=0,X,Y,s=0,i,A1=1,A2=3,A3=2,A4=0,max;\n scanf(\"%d%d\",&X,&Y);\n if ((X==0&&Y==0)||(X==1&&Y==0))\n printf(\"0\");\n else if ((Y==X&&X>=0)||((fabs(X)0))\n {\n if (fabs(X)0))\n A1++;\n printf(\"%d\",A1);\n }\n else if ((Y==X&&X<0)||((fabs(X)0&&Y<0)))\n {\n if (fabs(X)0&&Y<0)))\n A2++;\n printf(\"%d\",A2);\n }\n else if ((Y==(-1*X)&&X<0&&Y>0)||((fabs(Y)0&&Y<=0)||((fabs(Y)=0))\n {\n if (fabs(X)=0&&((X!=((-1*Y)+1))))\n A4++;\n printf(\"%d\",A4);\n }\n return 0;\n}\n"}, {"source_code": "/*\n when turn is even move x else move y.\n common = 0 when x coordinate is common\n common = 1 when y coordinate is common\n whenever x or y ka value increase its value of mod increase by 1 and its sign reverses...\n this means while we consider the x and y axis the coordinate will change halve of mod value...\n*/\n\n#include \n#include \n\nint main()\n{\n int xin, yin, xold=0, yold=0, xnew=0, ynew=0, turn=-1, common, modx=0, mody=0;\n int signx=0, signy=0;\n scanf(\"%d %d\", &xin, &yin);\n\n while(1)\n {\n turn++;\n if(turn%2 == 0)\n {\n xold = xnew;\n yold = ynew;\n modx++;\n if(signx%2==0)\n {\n xnew = ceil((double)modx/2);\n }\n else\n {\n xnew = -1*ceil((double)modx/2);\n }\n common = 1;\n signx++;\n }\n else\n {\n xold = xnew;\n yold = ynew;\n mody++;\n if(signy%2==0)\n {\n ynew = ceil((double)mody/2);\n }\n else\n {\n ynew = -1*ceil((double)mody/2);\n }\n signy++;\n common = 0;\n }\n\n if(common == 1)\n {\n if(yold == yin)\n {\n if((xold <= xin && xnew >= xin) || (xold >= xin && xnew <= xin))\n {\n printf(\"%d\\n\",turn);\n break;\n }\n }\n }\n\n else if(common == 0)\n {\n if(xold == xin)\n {\n if((yold <= yin && ynew >= yin) || (yold >= yin && ynew <= yin))\n {\n printf(\"%d\\n\",turn);\n break;\n }\n }\n }\n\n // printf(\"%3d %3d %3d %3d %3d %3d %3d %3d\\n\", turn, xold, yold, xnew, ynew, modx, mody, common);\n }\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n=-1,x=0,y=0,i,j,k,l;\n scanf(\"%d%d\",&k,&l);\n if((k==0)&(l==0))\n {\n printf(\"0\");\n return 0;\n }\n for(i=1;i<1000;i+=2)\n {\n for(j=i;j=k))\n {\n printf(\"%d\",n);\n return 0;\n }\n }\n }\n for(j=i;j=l))\n {\n printf(\"%d\",n);\n return 0;\n }\n }\n }\n for(j=i+1;j=k)&&(x<=k))\n {\n printf(\"%d\",n);\n return 0;\n }\n }\n }\n for(j=i+1;j=l)&&(y<=l))\n {\n printf(\"%d\",n);\n return 0;\n }\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\nint x,y,turn;\nscanf(\"%d %d\",&x,&y);\nif(x==0&&y==0||x==1&&y==0)\n{\n printf(\"0\");\n return 0;\n}\n if(x<0&&y>=x&&y<-x)\n turn=(-4)*x-1;\n if(y<0&&x>y&&x<=-y+1)\n turn=(-4)*y;\n if(x>0&&y>-x+1&&y<=x)\n turn=x*4-3;\n if(y>0&&x=-y)\n turn=4*y-2;\nprintf(\"%d\",turn);\nreturn 0;\n}\n"}, {"source_code": " #include \n#include \n\nint main()\n{\n int x,y,ans;\n scanf(\"%d%d\",&x,&y);\n if(x==0)\n {\n if(y>0) ans=4*(y-1)+2;\n else ans=-y*4;\n }\n if(x>0)\n {\n if(y>1-x && y<=x) ans=4*(x-1)+1;\n else {if(y==1-x) ans=4*(x-1);\n else {if(y>0) ans=4*(y-1)+2;\n else ans=-y*4;\n }\n }\n }\n if(x<0)\n {\n if(y>=x && y<-x) ans=4*(-x)-1;\n else {if(y==x-1) ans=4*(-x)-2;\n else {if(y>0) ans=4*(y-1)+2;\n else ans=-y*4;\n }\n }\n }\n printf(\"%d\",ans);\n return 0;\n\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int x, y, turn;\n \n scanf(\"%d%d\", &x, &y);\n \n if((x==0 || x==1) && y==0)\n turn = 0;\n else if(x>=0 && y>=0)\n {\n if(x>=y)\n turn = (x-1)*4 + 1;\n else if(y>x)\n turn = (y-1)*4 + 2;\n }\n else if(x<=0 && y>=0)\n {\n if(x*-1 > y)\n turn = (x*-1-1)*4 + 3;\n else if(x*-1 <= y)\n turn = (y-1)*4 + 2;\n }\n else if(x<=0 && y<=0)\n {\n if((x*-1) >= (y*-1))\n turn = (x*-1-1)*4 + 3;\n else if(x*-1 < y*-1)\n turn = (y*-1)*4;\n }\n else if(x>=0 && y<=0)\n {\n if(x <= y*-1 || x+y==1)\n turn = (y*-1)*4;\n else if(x > y*-1 && x+y!=1)\n turn = (x-1)*4 + 1;\n }\n \n printf(\"%d\\n\", turn);\n \n return 0;\n}\n "}, {"source_code": "#include\n\ninline int abs(int a) { return a < 0 ? -a : a; }\n\nint main() {\n\tint x, y, cnt = 0;\n\tscanf(\"%d%d\", &x, &y);\n\t\n\t\n\t/** Find last corner before (x, y)\n\tForms of corners:\n\t\t1) (x, y)\n\t\t2) (-x, y)\n\t\t3) (-x, -y)\n\t\t4) (x + 1, -x)\n\t**/ \n\t\n\tif(y == 0 && x <= 1 && x >= 0)\n\t\tcnt = 0; // lol\n\telse if((-y == x && y > 0) || (y > 0 && abs(x) <= y && !(x == y && x > 0))) // Last Type (1) [Or current = Type (2)]\n\t\tcnt = 4 * y - 2;\n\telse if((y == x && x < 0) || (x < 0 && abs(y) <= -x && !(-y == x && y > 0))) // Last Type (2) [Or current = Type (3)]\n\t\tcnt = 4 * (-x) - 1;\n\telse if((-y + 1 == x && y < 0) || (y < 0 && abs(x) <= -y && !(y == x && x < 0))) // Last Type (3) [Or current = Type (4)]\n\t\tcnt = 4 * (-y);\n\telse // Last Type (4) [Or current = Type (1)]\n\t\tcnt = 4 * (x-1) + 1;\n\t\n\tprintf(\"%d\", cnt);\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n#include\nint main()\n{\n\tint x,y,ans;\n\tscanf(\"%d%d\",&x,&y);\n\tif ( x == 0 && y == 0 ) {\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\tif ( x == 1 && y == 0 ) {\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\tif ( x >=0 && y >=0 ) {\n\t\tif ( y <= x ) {\n\t\t\tans = (x-1) * 4 + 1;\n\t\t} else {\n\t\t\tans = (y-1) * 4 + 2;\n\t\t}\n\t} else if ( x <= 0 && y >=0 ) {\n\t\tx = -x;\n\t\tif ( x <= y ) {\n\t\t\tans = (y-1) * 4 + 2;\n\t\t} else {\n\t\t\tans = (x-1) * 4 + 3;\n\t\t}\n\t} else if ( x <= 0 && y <= 0 ) {\n\t\tx = -x;\n\t\ty = -y;\n\t\tif ( y <= x ) {\n\t\t\tans = (x-1) * 4 + 3;\n\t\t} else {\n\t\t\tans = (y-1) * 4 + 4;\n\t\t}\n\t} else if ( x >= 0 && y <= 0 ) {\n\t\ty = -y;\n\t\tif ( x-1 <= y ) {\n\t\t\tans = (y-1) * 4 + 4;\n\t\t} else {\n\t\t\tans = (x-2) * 4 + 5;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint sgn (int x) {\n\treturn x < 0 ? -1 : x == 0 ? 0 : 1;\n}\n\nint step (int *x, int *y) {\n\tstatic int dx = 1;\n\tstatic int dy = 0;\n\tint ret = 0;\n\tif (*y == 1 - *x && *x > 0) {\n\t\tdx = 0;\n\t\tdy = 1;\n\t\tret = 1;\n\t} else if (*y == -*x && *x < 0) {\n\t\tdx = 0;\n\t\tdy = -1;\n\t\tret = 1;\n\t} else if (*y == *x && *x != 0) {\n\t\tret = 1;\n\t\tdx = -sgn (*x);\n\t\tdy = 0;\n\t}\n\t*x += dx;\n\t*y += dy;\n\treturn ret;\n}\n\nint main (void) {\n\tint nturns = 0, x = 0, y = 0, x0, y0;\n\tscanf (\"%d %d\", &x0, &y0);\n\twhile (!(x == x0 && y == y0)) {\n\t\tnturns += step (&x, &y);\n\t}\n\tprintf (\"%d\\n\", nturns);\n\texit (EXIT_SUCCESS);\n}\n"}, {"source_code": "#include\n\nint maxNum(int x,int y)\n{\n\tif(x<0)\n\t\tx=-1*x;\n\tif(y<0)\n\t\ty=-1*y;\n\tif(x0&&x==y)\n\t {\n\t\t ans=1+(x-1)*4;\n\t \treturn ans;\n\t }\n\t\t\tif(x<0&&x==y*-1)\n\t\t\t{\n\t\t\t\tans=2+(y-1)*4;\n\t\t\t\treturn ans;\n\t\t\t}\n\t\t\tif(x<0&&x==y)\n\t\t\t{\n\t\t\t\tans=3+(-1*y-1)*4;\n\t\t\t\treturn ans;\n\t\t\t}\n\t\t\tif(y<0&&(x+y==1))\n\t\t\t{\n\t\t\t\tans=-4*y;\n\t\t\t\treturn ans;\n\t\t\t}\n}\n\nint main()\n{\n\tint x,y,ans=-1,flag=0;\n\t\n\twhile(scanf(\"%d%d\",&x,&y)!=EOF)\n\t{\n\t\tint temp;\n\t \n\t\tif(isZhuan(x,y))\n\t\t{\n\t\t\tans=zhuanZ(x,y);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tint bian=maxNum(x,y);\n\t\t\tif(x>0&&y>0)\n\t\t\t{\n\t\t\t\ttemp=zhuanZ(bian,bian);\n\t\t\t\tif(x>y)\n\t\t\t\t\tans=temp;\n\t\t\t\telse\n\t\t\t\t\tans=temp+1;\n \n\t\t\t}\n\n\t\t \tif(x<0&&y>0)\n\t\t\t{\n\t\t\t\ttemp=zhuanZ(-1*bian,bian);\n\t\t\t\tif(-1*x0&&y<0)\n\t\t\t{\n\t\t\t\ttemp=zhuanZ(bian+1,-1*bian);\n\t\t\t\tif(x\n#include\n#include\n#include\n#include\n#define si(n) scanf(\"%d\",&n)\n#define rep(i,n) for(i=0;ib)return a;return b;}\nint small(int a,int b){if(a-a)){pi((a<<2)-0);return 0;}\n if((y(-a+1))&&(x==a)){pi((a<<2)-3);return 0;}\n if((y==(-a+1))&&(x==a)){pi((a<<2)-4);return 0;}\n return 0;\n}\n\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int x=0,y=0,i,line=1,y1=0;\n scanf(\"%i %i\",&x,&y);\n for (i=1;i<2;)\n {\n\n if (y==0 && ( x<=1 && x>=0 ) )\n {\n\n printf(\"0\");\n break;\n }\n else if (x==1 && (y>=0 && y <=1))\n {\n printf(\"1\");\n y1=1;\n break;\n }\n else\n i++;\n line++;\n }\n\n\n for (i=1;i<=100;)\n{\n if (x==0 && y==1 ){\n printf(\"2\");\n break;\n }\n else if ( (-i<=x && x<=i) &&y==i && y1!=1)///upper\n {\n printf(\"%i \",line) ;\n break;\n }\n else\n line++;\n if ( (-i<=y && y<=i )&& x==-i )//left\n {\n printf(\"%i \",line);\n break;\n }\n else\n line++;\n if ( (-i<=x&&x<=i+1)&&y==-i )\n {\n printf(\"%i\",line) ;\n break;\n }\n else\n {\n line++;\n i++;\n }\n if ( ( -i+1<= y && y<=i ) && x==i)\n {\n printf(\"%i\",line) ;\n break;\n }\n else\n line++;\n\n }\n\n return 0;\n}\n"}, {"source_code": "//In the name of God\n#include \n\nint dx,dy;\nint x,y;\n\nint mv(int size,int d)\n{\n d%=4;\n int ax=0,ay=0;\n switch(d)\n {\n case 0:\n ay=-1;\n break;\n case 1:\n ax=1;\n break;\n case 2:\n ay=1;\n break;\n default:\n ax=-1;\n }\n while(size--)\n {\n x+=ax; y+=ay;\n if(x==dx && y==dy)\n\treturn 1;\n }\n return 0;\n}\n\nint main()\n{\n scanf(\"%d%d\",&dx,&dy);\n if(dx==0 && dy==0)\n {\n printf(\"0\");\n return 0;\n }\n int step; int d=0; int size=1, rem=2;\n for(step=0;;step++)\n {\n d++;\n if(mv(size,d))\n\t{\n\tprintf(\"%d\\n\",step);\n\treturn 0;\n\t}\n rem--;\n if(rem==0)\n\t{\n\t rem=2;\n\t size++;\n\t}\n }\n}\n"}, {"source_code": "#include \nint main(int argc, char const *argv[])\n{\n\tint x, y, turn = 0;\n\tscanf(\"%d %d\", &x, &y);\n\tif (x >= -y && x < y)\n\t{\n\t\tturn = 4 * y - 2;\n\t}\n\tif (y >= x && y < -x)\n\t{\n\t\tturn = -4 * x - 1;\n\t}\n\tif (x > y && x <= -y + 1)\n\t{\n\t\tturn = -y * 4;\n\t}\n\tif (y > -x + 1 && y <= x)\n\t{\n\t\tturn = 4 * x - 3;\n\t}\n\tprintf(\"%d\", turn);\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\nint a,b,x[500],y[500],i,j,t=1;\nscanf(\"%d %d\",&a,&b);\nx[0]=0;\nfor(i=1;i<=400;i+=4)\n{x[i]=t;\nx[i+1]=t;\nx[i+2]=-1*t;\nx[i+3]=-1*t;\nt++;}\nx[401]=101;\nt=1;\ny[0]=0;\ny[1]=0;\nfor(i=2;i<=400;i+=4)\n{y[i]=t;\ny[i+1]=t;\ny[i+2]=-1*t;\ny[i+3]=-1*t;\nt++;}\nfor(i=0;i<=400;i++)\n{if(((a>=x[i]&&b>=y[i])&&(a<=x[i+1]&&b<=y[i+1]))||((a>=x[i+1]&&b>=y[i+1])&&(a<=x[i]&&b<=y[i])))\n{j=i;\nbreak;}}\nprintf(\"%d\",j);\nreturn(0);}\n"}, {"source_code": "#include \n#include \nint main()\n{\n int n,x,y,a,b,f,t=1;\n scanf(\"%d %d\",&x,&y);\n a=fabs(x);\n b=fabs(y);\n if((!x || x==1) && !y) {\n n=0,f=0;\n goto label;\n }\n //sides\n if(a>b) {\n if(y>=0 && x>0) f=1,t=0;\n else if(x<0) f=3,t=0;\n n=a-1;\n }\n if(a>b+1) {\n if(x>0 && y<0) f=1,t=0;\n n=a-1;\n }\n //top-bottom\n if(a0) f=2,t=0;\n else if(y<0 && x<=0) f=4,t=0;\n n=b-1;\n }\n if(a0) f=4,t=0;\n n=b-1;\n }\n //corner\n if(a==b && t) {\n if(x>0 && y>0) f=1,t=0;\n else if(x<0 && y<0) f=3,t=0;\n else if(x<0 && y>0) f=2,t=0;\n n=a-1;\n }\n if(a==b+1 && t) {\n if(x>0 && y<0) f=4;\n n=b-1;\n }\n label: printf(\"%d\",4*n+f);\n return 0;\n}"}, {"source_code": "#include\nvoid quicksort(int a[],int lower,int upper)\n{\n\tif(lower=p && u>lower)\n\t\t\tu--;\n//\t\tprintf(\"\\nstopped at %d and %d\",a[l],a[u]);\n\t\tif(l0 && x>=-1*y && x<=y)\n\t{\n\t\tans=2+4*(y-1);\n\t\tif(x==y)\n\t\t\tans--;\n\t}\n\telse if(y<0 && x>=y && x<=-1*y+1)\n\t{\n\t\tans=4+4*(-1*y-1);\n\t\tif(x==y)\n\t\t\tans--;\n\t}\n\telse if(x>0 && y<=x && y>=-1*x+1)\n\t{\n\t\tans=1+(4*(x-1));\n\t\t\tif(x==-1*y+1)\n\t\t\tans--;\n\t}\n\telse if(x<0 && y>=x && y<=-1*x)\n\t{\n\t\tans=3+(4*(-1*x-1));\n\t\t\tif(x==-y)\n\t\t\tans--;\n\t}\n\tprintf(\"%d\",ans);\n\treturn 0;\n}"}, {"source_code": "#include \nint main()\n{\n int x,y,ans;\n scanf(\"%d%d\",&x,&y);\n if(x==0&&y==0)\n ans = 0;\n else if (y<=0 && x>y && x<=-y+1)\n ans=-4*y;\n else if (x>0 && y>-x+1 && y<=x)\n ans = 4*(x-1)+1;\n else if (y>0 && x=-y)\n ans = 4*(y-1)+2;\n else\n ans=4*(-x-1)+3;\n printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint x,y,i,j,k,l;\n\tscanf(\"%d%d\",&x,&y);\n\tif(x>=0&&y>=0)\n\t{\n\t\tif(x==0&&y==0)\n\t printf(\"0\");\n\t else if(x==1&&y==0)\n\t printf(\"0\");\n\t\telse if(x==y)\n\t\tprintf(\"%d\",1+4*(x-1));\n\t\telse if(x>y)\n\t\tprintf(\"%d\",1+4*(x-1));\n\t\telse\n\t\tprintf(\"%d\",2+4*(y-1));\n\t}\n\telse if(x>=0&&y<0)\n\t{\n\t\t if(x==-y)\n\t\tprintf(\"%d\",4*(x));\n\t\telse\n\t\tprintf(\"%d\",4*(-y));\n\t}\n\t\telse if(x<0&&y>=0)\n\t{\n\t\t if(x==-y||y>-x)\n\t\tprintf(\"%d\",2+4*(y-1));\n\t\telse\n\t\tprintf(\"%d\",4*(-x)-1);\n\t}\n\t\telse if(x<0&&y<0)\n\t{\n\t\t if(x==y||x\n#include\n\nint main()\n{\n int i,x,y,a,b,d=1,turns=(-1),m=1,x1=0,y1=0,x2=0,y2=0;\n scanf(\"%d %d\",&x,&y);\n a=b=0;\n while(1)\n {\n x1=a;\n y1=b;\n if(m==1)\n {\n a=a+d;\n m++;\n turns++;\n \n }\n else if(m==2)\n {\n b=b+d;\n m++;\n d++;\n turns++;\n }\n else if(m==3)\n {\n a=a-d;\n m++;\n turns++;\n }\n else if(m==4)\n {\n b=b-d;\n m=1;\n d++;\n turns++;\n }\n x2=a;\n y2=b;\n if((((x>=x1 && x<=x2)|| (x<=x1 && x>=x2)) && (y==y2 && y==y1))||((x==x1 && x==x2) && ((y>=y1 && y<=y2) || (y<=y1 && y>=y2))))\n break;\n }\n printf(\"%d\",turns);\n \n \nreturn 0;\n}"}, {"source_code": "#include \n#define COND ( (!dir&&ty==y&&tx>=x) || (dir==1&&tx==x&&ty>=y) || (dir==2&&ty==y&&tx<=x) || (dir==3&&tx==x&&ty<=y) )\nint x,y,tx,ty,step=0,turn=0,dir,t;\nint main(){\n\tscanf(\"%d %d\", &x, &y);\n\tif(x==0 && y==0){\n\t\tputs(\"0\");\n\t\treturn 0;\n\t}\n\twhile(1){\n\t\tdir=0;\n\t\tt=COND;\n\t\tif(turn!=0){\n\t\t\tturn++;\n\t\t}\n\t\tstep++;\n\t\ttx+=step;\n\t\tif(COND && !t){\n\t\t\tbreak;\n\t\t}\n\t\t\n\n\t\tdir++;\n\t\tt=COND;\n\t\tturn++;\n\t\tty+=step;\n\t\tstep*=-1;\t\t\n\t\tif(COND && !t){\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tdir++;\n\t\tt=COND;\n\t\tturn++;\n\t\tstep--;\n\t\ttx+=step;\n\t\tif(COND && !t){\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tdir++;\n\t\tt=COND;\n\t\tturn++;\n\t\tty+=step;\n\t\tstep*=-1;\n\t\tif(COND && !t){\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%d \", turn);\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int x,y,n,p;\n scanf(\"%d%d\",&x,&y);\n if(abs(x)>abs(y))\n p=abs(x);\n else\n p=abs(y);\n n=x+y;\nif(x==0)\n p=abs(y);\n\n\n if(x>=0)\n {\n\n if(n>2*x)\n printf(\"\\n%d\",2+4*(p-1));\n else if(n<1)\n printf(\"\\n%d\",4+4*(p-1));\n else if(n==1)\n printf(\"\\n%d\",4*(p-1));\n else\n printf(\"\\n%d\",1+4*(p-1));\n }\n else\n {\n if(n<2*x)\n printf(\"\\n%d\",4+4*(p-1));\n else if (n>=0)\n printf(\"\\n%d\",2+4*(p-1));\n else\n printf(\"\\n%d\",3+4*(p-1));\n }\n\n return 0;\n }\n\n"}, {"source_code": "#include\n#include\nint main()\n{\n int t,a=0,b=1,c=2,d=3;\n\n int x,y,p=0;\n scanf(\"%d%d\",&x,&y);\n if(x==1&&y==0||x==0&&y==0)\n p=0;\n else if((x>=0&&y>=0)&&(abs(x)>=abs(y)))\n p=((abs(x)-1)*4)+1;\n else if((x>=0&&y>=0)&&(abs(x)=0)&&(abs(x)<=abs(y)))\n p=((abs(y)-1)*4)+2;\n else if((x<=0&&y>=0)&&(abs(x)>abs(y)))\n p=((abs(x)-1)*4)+3;\n else if((x<=0&&y<=0)&&(abs(x)>=abs(y)))\n p=((abs(x)-1)*4)+3;\n else if((x<=0&&y<=0)&&(abs(x)=0&&y<=0)&&(abs(x)<=abs(y)+1))\n p=((abs(y)-1)*4)+4;\n else\n p=((abs(x)-1)*4)+1;\n\n\n printf(\"%d\",p);\n\n\nreturn 0;\n}\n"}, {"source_code": "#include \n\nmain()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n if( a == 0 && b == 0 )\n printf(\"0\");\n else if( (a == (1 - b)) && a > 0 )\n printf(\"%d\",4*(-b));\n else if( a > b && b > -a )\n printf(\"%d\",1+4*(a-1));\n else if( b > a && a > -b )\n printf(\"%d\",2+4*(b-1));\n else if( -a > b && b > a )\n printf(\"%d\",3+4*(-a-1));\n else if( -b >= a && a > b )\n printf(\"%d\",4*(-b));\n else if( a == -b )\n printf(\"%d\",2+4*(b-1));\n else\n {\n if( a > 0 )\n printf(\"%d\",1+4*(a-1));\n else\n printf(\"%d\",3+4*(-a-1));\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \nint main()\n{\n int i,j,n,m,s,t,l;\n int x,y,xend,yend;\n while(scanf(\"%d %d\",&xend,¥d)!=EOF)\n {\n x=y=0;\n if(xend==0&¥d==0)\n {\n printf(\"0\\n\");\n continue;\n }\n s=0;\n l=1;\n while(1)\n {\n for(i=1;i<=l;i++)\n {\n x+=1;\n if(x==xend&&y==yend)\n {\n break;\n }\n }\n if(i!=l+1)\n {\n break;\n }\n s++;\n for(i=1;i<=l;i++)\n {\n y++;\n if(x==xend&&y==yend)\n {\n break;\n }\n }\n if(i!=l+1)\n {\n break;\n }\n s++;\n for(i=1;i<=l+1;i++)\n {\n x--;\n if(x==xend&&y==yend)\n {\n break;\n }\n }\n if(i!=l+2)\n {\n break;\n }\n s++;\n for(i=1;i<=l+1;i++)\n {\n y--;\n if(x==xend&&y==yend)\n {\n break;\n }\n }\n if(i!=l+2)\n {\n break;\n }\n s++;\n l+=2;\n }\n printf(\"%d\\n\",s);\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main(){\n int x=0,y=0,a,b,sum=0,t=1,i;\n scanf(\"%d%d\",&a,&b);\n if(a==b&&b==0 || a==1&&b==0)printf(\"0\\n\");\n else{\n for(i=1;;i++){\n if(x+t==a&&y==b||x+t>a&&y==b&&a>x){\n printf(\"%d\\n\",sum);\n break;\n }\n else {\n x+=t;\n sum++;\n }\n if(x==a&&y+t==b||x==a&&yb){\n printf(\"%d\\n\",sum);\n break;\n }\n else {\n y+=t;\n sum++;\n }\n if(y==b&&x-t-1==a||x>a&&y==b&&x-t-1b&&y-t-1\n#include\n#include\n#include\n#include\n#define max(a,b) ((a>b)?a:b)\n#define min(a,b) ((a>b)?b:a)\n#define UpFor(i,From,To) for(i=From;iTo;i--)\n#define Opfile_in(s) freopen(s,\"r\",stdin)\n#define Opfile_out(s) freopen(s,\"w\",stdout)\n#define Read(T) scanf(\"%d\\n\",&T)\n#define Print(T) printf(\"%d\\n\",T)\n#define LL long long\n#define MAXN 214748364\nint x,y;\nvoid init();\nvoid doit();\n\nint main()\n{\n //Opfile_in(\"CF_temp.in\");\n init();\n doit();\n return 0;\n}\nvoid init()\n{\n scanf(\"%d%d\",&x,&y);\n}\nvoid doit()\n{\n int ans;\n if((x==0&&y==0)||(x==1&&y==0))\n {\n Print(0);\n return ;\n }\n if(x<0&&y>=x&&y<-x)\n ans=-4*x-1;\n if(y<0&&x>y&&x<=-y+1)\n ans=-4*y;\n if(x>0&&y>-x+1&&y<=x)\n ans=x*4-3;\n if(y>0&&x=-y)\n ans=4*y-2;\n Print(ans);\n}\n\n"}, {"source_code": "#include\nint main(){\n\tint xCord,yCord,turns;\n\tscanf (\"%d%d\",&xCord,&yCord);\n\tif(xCord==0 && yCord==0){\n\t\tturns = 0;\n\t}\n\n\telse if((yCord*-1)<=xCord && yCord>xCord){\n\t\tturns = 2+(yCord-1)*4;\n\t}\n\n\telse if(((xCord*-1)+1)=yCord){\n\t\tturns = 1+(xCord-1)*4;\n\t}\n\n\telse if(yCordyCord && xCord<=yCord){\n\t\tturns = xCord*-4-1;\n\t}\n\tprintf (\"%d\\n\",turns);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main(void)\n{\n\tint x,y,sol,startC,r;\n\tscanf(\"%d %d\",&x,&y);\n\t\n\tif(x>0){\n\t\tif(y<=x) {\n\t\t\tif(y+x>1) r=4; /*D*/\n\t\t\telse r=3; /*C*/\n\t\t}\n\t\telse r=1; /*A*/\n\t}\n\telse {\n\t\tif(y=0) r=1; /*A*/\n\t\telse r=2; /*B*/\n\t}\n\t\n\tif((x==0 && y==0) || (x==1 && y==0)) sol = 0;\n\telse {\n\t\tif(r==1){ sol=2; startC=1; }\n\t\telse if(r==2){ sol=3; startC=-1; }\n\t\telse if(r==3){ sol=4; startC=-1; }\n\t\telse if(r==4){ sol=1; startC=1; }\n\t\n\t\tif(r==1 || r==3) {\n\t\t\twhile(startC!=y){\n\t\t\t\tsol+=4;\n\t\t\t\tif(r==1) startC++;\n\t\t\t\telse startC--;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\twhile(startC!=x){\n\t\t\t\tsol+=4;\n\t\t\t\tif(r==2) startC--;\n\t\t\t\telse startC++;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tprintf(\"%d\",sol);\n\treturn 0;\n}"}, {"source_code": "#include\n#include\n\nint main()\n{\n\tint x,y,k;\n\twhile(scanf(\"%d%d\",&x,&y)!=EOF)\n\t{\n\t\tif(abs(x)>abs(y))\n {\n\t\t\tif(x==1)k=0;\n else if(x>0)\tk=(x-1)*4+(x!=1-y);\n else k=(-x-1)*4+3;\n }\n else\n {\n\t\t\tif(!y)k=0;\n else if(y>0)k=(y-1)*4+2;\n else k=(-y-1)*4+4;\n k-=(x==y&&x);\n }\n printf(\"%d\\n\", k);\n\t}\n}"}, {"source_code": "#include \n\nint main()\n{\n\tint x, y;\n\tscanf(\"%d%d\", &x, &y);\n\tif ( !y && (!x || x == 1) )\n\t\tputs(\"0\");\n\telse if ( x == 1 && y == 1 )\n\t\tputs(\"1\");\n\telse\n\t{\n\t\tint i, px, py, res = 1;\n\t\tfor ( px = py = i = 1; ++i <= 210; ++i )\n\t\t{\n\t\t\t++res;\n\t\t\tif ( y == py && x < px && x >= px-i )\n\t\t\t\tbreak;\n\t\t\tpx -= i;\n\t\t\t++res;\n\t\t\tif ( x == px && y < py && y >= py-i )\n\t\t\t\tbreak;\n\t\t\tpy -= i;\n\t\t\t++res;\n\t\t\tif ( y == py && px < x && px+i+1 >= x )\n\t\t\t\tbreak;\n\t\t\tpx += i+1;\n\t\t\t++res;\n\t\t\tif ( x == px && py < y && py+i+1 >= y )\n\t\t\t\tbreak;\n\t\t\tpy += i+1;\n\t\t}\n\t\tprintf(\"%d\\n\", res);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int ans=-1, sl, x, y;\n scanf(\"%d %d\", &x, &y);\n if(x==0 && y==0 || x==1 && y==0)\n ans=0;\n else if(x==0)\n {\n sl=y/abs(y);\n y=abs(y);\n if(sl==1)\n ans=4*(y-1) + 2;\n else if(sl==-1)\n ans=4*(y-1) + 4;\n }\n else if(y==0)\n {\n sl=x/abs(x);\n x=abs(x);\n if(sl==1)\n ans=4*(x-1) + 1;\n else if(sl==-1)\n ans=4*(x-1) + 3;\n }\n else if(abs(x)==abs(y))\n {\n if(x>0 && y>0)\n ans=4*(x-1)+1;\n if(x<0 && y>0)\n ans=4*(y-1)+2;\n if(x<0 && y<0)\n ans=4*(abs(x)-1)+3;\n if(x>0 && y<0)\n ans=4*(x-1) + 4;\n }\n else if(y<0 && x==abs(y)+1)\n {\n //printf(\"Entering here\\n\");\n ans=4*(abs(y)-1) + 4;\n }\n else if(abs(x)>abs(y))\n {\n sl=x/abs(x);\n x=abs(x);\n if(sl==1)\n ans=4*(x-1) + 1;\n else if(sl==-1)\n ans=4*(x-1) + 3;\n }\n else if(abs(y)>abs(x))\n {\n sl=y/abs(y);\n y=abs(y);\n if(sl==1)\n ans=4*(y-1) + 2;\n else if(sl==-1)\n ans=4*(y-1) + 4;\n }\n printf(\"%d\\n\", ans);\n return 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\nint a=0,b=0,s1=0,x,y;\nscanf(\"%d %d\",&x,&y);\nif((x==1||x==0)&&y==0)\nprintf(\"0\");\nelse\n{if(((x>=0&&y>=0)||(x<=0&&y>=0)||(x<=0&&y<=0))&&(abs(x)==abs(y))||(y<0&&x>0&&1-y==x)){a=x;b=y;}\nelse if(x>=0&&abs(x)>abs(y))\n{a=x;b=x;}\nelse if (x<=0&&abs(x)>abs(y))\n{a=x;b=x;}\nelse if (y>=0&&abs(y)>abs(x))\n{a=-y;b=y;}\nelse if(y<=0&&abs(y)>=abs(x))\n{a=1-y;b=y;}\nif(a>0&&b>0)\ns1=(1+(a-1)*2)+(1+(b-1)*2);\nelse if(a>0&&b<0)\ns1=(1+(a-1)*2)+(abs(b)*2);\nelse if(a<0&&b>0)\ns1=(abs(a)*2)+(1+(b-1)*2);\nelse if(a<0&&b<0)\ns1=(abs(a)*2)+(abs(b)*2);\nprintf(\"%d\",s1-1);}\nreturn 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\nint dx[] = {1, 0, -1, 0};\nint dy[] = {0, 1, 0, -1};\n\nint main() {\n\tint X, Y, x = 0, y = 0, turns = 0, dir = 0, steps = 1, i;\n\tscanf(\" %d %d\", &X, &Y);\n\tif (X == 0 && Y == 0)\n\t\tgoto done;\n\n\twhile (1) {\n\t\tfor (i = 0; i < steps; i++) {\n\t\t\tx += dx[dir];\n\t\t\ty += dy[dir];\n\t\t\tif (x == X && y == Y)\n\t\t\t\tgoto done;\n\t\t}\n\t\tturns++;\n\t\tdir = (dir+1)%4;\n\t\tif (dir%2 == 0)\n\t\t\tsteps++;\n\t}\n\ndone:\n\tprintf(\"%d\\n\", turns);\n\treturn 0;\n}\n\n"}, {"source_code": "#ifdef ONLINE_JUDGE\n #define NDEBUG 1\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#define long int64_t\n#define fore(i,k,n) for (int _k = (k), _n = (n), i = _k; i <= _n; ++i)\n#define forr(i,n,k) for (int _k = (k), _n = (n), i = _n; i >= _k; --i)\n#define LIST_INIT_CAP 4\n#define HASH_INIT_CAP 64\n#define HASH_SKIP 11\n#define TREE_INIT_CAP 1024\n#define TREE_MAX_HEIGHT 64\n#define DEQUE_INIT_CAP 1024\n#define HEAP_INIT_CAP 1024\n#define TAKEN 1\n#define EMPTY 0\n#define TOMB -1\n#define max(a,b) (((a)>(b))?(a):(b))\n#define min(a,b) (((a)<(b))?(a):(b))\n\nint main() {\n int x, y;\n scanf(\"%d %d\", &x, &y);\n int a = 1, b = 2, u = 0, v = 0;\n int answer = 0;\n if (u == x && v == y) goto end;\n while (true) {\n fore (i, 1, a) {\n ++u;\n if (u == x && v == y) goto end;\n }\n ++answer;\n fore (i, 1, a) {\n ++v;\n if (u == x && v == y) goto end;\n }\n ++answer;\n a += 2;\n fore (i, 1, b) {\n --u;\n if (u == x && v == y) goto end;\n }\n ++answer;\n fore (i, 1, b) {\n --v;\n if (u == x && v == y) goto end;\n }\n ++answer;\n b += 2;\n }\n\nend:\n printf(\"%d\", answer);\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint dx[4] = {1, 0, -1, 0};\nint dy[4] = {0, 1, 0, -1};\n\nint main()\n{\n int x, y, p = 0, q = 0, i, j;\n \n scanf(\"%d %d\", &x, &y);\n \n if (x == 0 && y == 0) {\n puts(\"0\");\n \n return 0;\n }\n \n for (i = 0; ; i++) {\n for (j = 0; j < i / 2 + 1; j++) {\n p += dx[i % 4];\n q += dy[i % 4];\n \n if (x == p && y == q) {\n printf(\"%d\\n\", i);\n \n return 0;\n }\n }\n }\n \n return 0;\n}\n"}, {"source_code": "#include\n\n#include\nint main()\n{\n int x,y,ans=0;\n scanf(\"%d %d\",&x,&y);\n if((x==0)&&y==0)\n { printf(\"0\");\n \n return 0;\n }\n if((x+y==1)&&(x>0))\n {\n ans=(-1)*y*4; \n } \n else if(abs(x)>abs(y)||(x==y))\n {\n if(x>0)\n {\n ans=4*(x-1)+1;\n }\n else if(x<0)\n ans=(-1)*x*4-1 ;\n } \n else if(abs(y)>abs(x)||(x==(-1)*y)) \n {\n if(y>0)\n {\n ans=4*(y-1)+2;\n }\n \n \n else if(y<0)\n ans=(-1)*y*4;\n }\n printf(\"%d\",ans);\n \n \n return 0;\n }\n \n"}, {"source_code": "#include\n#include\nint main()\n{\n\tint x,y;\n\tscanf(\"%d %d\",&x,&y);\n\tif(x==0 && y==0)\n\t{\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\tif(x==y)\n\t{\n\t\tif(x>0)\n\t\t{\n\t\t\tprintf(\"%d\",4*x-3);\n\t\t\treturn 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"%d\",4*abs(x)-1);\n\t\t\treturn 0;\n\t\t}\n\t}\n\telse if((abs(x)==abs(y))&&(x<0)&&(y>0))\n\t{\n\t\tprintf(\"%d\",4*y-2);\n\t\treturn 0;\n\t}\n\telse if(y==1-x && x>0)\n\t{\n\t\tprintf(\"%d\",4*x-4);\n\t\treturn 0;\n\t}\n\tif(abs(x)0)\n\t\t{\n\t\t\tprintf(\"%d\",(4*y)-2);\n\t\t\treturn 0;\n\t\t}\n\t\telse if(y<0)\n\t\t{\n\t\t\tprintf(\"%d\",4*abs(y));\n\t\t\treturn 0;\n\t\t}\n\t}\n\tif(abs(x)>abs(y))\n\t{\n\t\tif(x>0)\n\t\t{\n\t\t\tprintf(\"%d\",(4*x)-3);\n\t\t\treturn 0;\n\t\t}\n\t\telse if(x<0)\n\t\t{\n\t\t\tprintf(\"%d\",(4*abs(x))-1);\n\t\t\treturn 0;\n\t\t}\n\t}\n\tif((abs(x)==abs(y))&&(x>0)&&(y<0))\n\t{\n\t\tprintf(\"%d\",4*x);\n\t\treturn 0;\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\nint a,b,x[500],y[500],i,j,t=1;\nscanf(\"%d %d\",&a,&b);\nx[0]=0;\nfor(i=1;i<=400;i+=4)\n{x[i]=t;\nx[i+1]=t;\nx[i+2]=-1*t;\nx[i+3]=-1*t;\nt++;}\nt=1;\nx[401]=101;\ny[0]=0;\ny[1]=0;\nfor(i=2;i<=400;i+=4)\n{y[i]=t;\ny[i+1]=t;\ny[i+2]=-1*t;\ny[i+3]=-1*t;\nt++;}\ny[401]=101;\nfor(i=0;i<=400;i++)\n{if(((a>=x[i]&&b>=y[i])&&(a<=x[i+1]&&b<=y[i+1]))||((a>=x[i+1]&&b>=y[i+1])&&(a<=x[i]&&b<=y[i])))\n{j=i;\nbreak;}}\nprintf(\"%d\",j);\nreturn(0);}\n"}, {"source_code": "#include \n\n#define MIN(a, b) ((a) < (b) ? (a) : (b))\n#define MAX(a, b) ((a) > (b) ? (a) : (b))\n\nint dx[] = {1, 0, -1, 0};\nint dy[] = {0, 1, 0, -1};\n\nint check(int x0, int y0, int x1, int y1, int x2, int y2)\n{\n int minx, miny, maxx, maxy;\n minx = MIN(x0, x1);\n miny = MIN(y0, y1);\n maxx = MAX(x0, x1);\n maxy = MAX(y0, y1);\n if ((x0 == x1 && x1 == x2 && y2 >= miny && y2 <= maxy) || (y0 == y1 && y1 == y2 && x2 >= minx && x2 <= maxx))\n {\n return 1;\n }\n return 0;\n}\n\nvoid solve(int x, int y)\n{\n int px, py, ans, count, dis, pos;\n ans = px = py = count = pos = 0;\n dis = 1;\n while (1)\n {\n if (px == x && py == y)\n {\n break;\n }\n if (px != 0 || py != 0)\n {\n ans ++;\n }\n if (check(px, py, px + dx[pos] * dis, py + dy[pos] * dis, x, y))\n {\n break;\n }\n px += dx[pos] * dis;\n py += dy[pos] * dis;\n count ++;\n if (count == 2)\n {\n count = 0;\n dis ++;\n }\n pos = (pos + 1) % 4;\n }\n printf(\"%d\\n\", ans);\n}\n\nint main()\n{\n int x, y;\n while (scanf(\"%d%d\", &x, &y) == 2)\n {\n solve(x, y);\n }\n return 0;\n}"}, {"source_code": "#include \n\nint main() {\n\tint x, y, t;\n\n\tscanf(\"%d%d\", &x, &y);\n\tif (x > 0 && y > -x + 1 && y <= x)\n\t\tt = 1 + 4 * (x - 1);\n\telse if (x < 0 && y < -x && y >= x)\n\t\tt = 3 + 4 * (-x - 1);\n\telse if (y > 0 && x < y && x >= -y)\n\t\tt = 2 + 4 * (y - 1);\n\telse\n\t\tt = 4 + 4 * (-y - 1);\n\tprintf(\"%d\\n\", t);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\n#define ABS(A) (A > 0 ? A : -A)\n\nint main() {\n\tint x, y, max;\n\n\tscanf(\"%d%d\", &x, &y);\n\tmax = ABS(x) > ABS(y) ? ABS(x) : ABS(y);\n\tif (max == 0)\n\t\tprintf(\"0\\n\");\n\telse if (x == max && y > 0 && y <= max)\n\t\tprintf(\"%d\\n\", 1 + 4 * (max - 1));\n\telse if (x >= -max && x < max && y == max)\n\t\tprintf(\"%d\\n\", 2 + 4 * (max - 1));\n\telse if (x == -max && y >= -max && y < max)\n\t\tprintf(\"%d\\n\", 3 + 4 * (max - 1));\n\telse if (x > -max && x <= max && y == -max + 1)\n\t\tprintf(\"%d\\n\", 4 * (max - 1));\n\telse if (x > -max && x <= max && y > -max + 1)\n\t\tprintf(\"%d\\n\", 1 + 4 * (max - 1));\n\telse\n\t\tprintf(\"%d\\n\", 4 * max);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int a,b,c,i,j,k,m,st,m2,var,tm,ab,ab1;\n\n scanf(\"%d%d\",&a,&b);\n\n i = 0;\n j = 0;\n c = -1;\n k = 0;\n m = 4;\n m2 = 3;\n var = 1;\n st =0;\n ab = abs(a);\n ab1 = abs(b);\n if(a == 0 )\n {\n if(b != 0)\n {\n if(b > 0)\n {\n a = -b;\n }\n else\n {\n a = b;\n c++;\n }\n }\n }\n else if(b == 0 )\n {\n if(a != 0 && a != 1)\n {\n b = a;\n }\n }\n else if(a > 0)\n {\n if(b != 0 && a != b)\n {\n tm = a - 1;\n tm = -tm;\n if(tm != b)\n {\n if(b < 0 && ab1 >= a)\n {\n a = ab1+1;\n b = a - 1;\n b = -b;\n }\n else if(b > 0 && a < b)\n {\n a = -b;\n }\n else\n {\n b = a;\n }\n }\n }\n }\n else\n {\n if(b != ab && a != b)\n {\n if(b > 0 && ab < b)\n {\n a = -b;\n }\n else if(b < 0 && ab1 > ab)\n {\n a = b;\n c++;\n }\n else\n {\n b = a;\n }\n }\n }\n while( i != a || j != b)\n {\n k++;\n j = st;\n if(k >= m2)\n {\n i = -var;\n if(k == m2+1)\n m2 = m2 + 4;\n }\n else if(k >= m)\n {\n var++;\n i = var;\n m = m+4;\n }\n else\n {\n i = var;\n }\n st = i;\n c++;\n }\n if(a == 0 && b== 0)\n c = 0;\n printf(\"%d\",c);\n\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n\tint x,y,p=-1,xf=0,yf=0,xp=0,yp=0,incre=1,a,k;\n\n\tscanf(\"%d%d\",&x,&y);\n\n\n\twhile(1)\n\t{\n\t\tp++;\n\t\tif(p%2==0)\n\t\t{\n\t\t\tif((p/2)%2==0)\n\t\t\t\txf=xf+incre;\n\t\t\telse\n\t\t\t\txf=xf-incre;\n\t\t}\n\n\t\telse\n\t\t{\n\t\t\ta=p+1;\n\t\t\tif((a/2)%2==0)\n\t\t\t\tyf=yf-incre;\n\t\t\telse\n\t\t\t\tyf=yf+incre;\n\n\t\t\tincre++;\n\t\t}\n\n\t\tif(x==xf&&x==xp)\n if((y<=yf&&y>=yp)||(y>=yf&&y<=yp))\n\t\t\tbreak;\n\n if(y==yf&&y==yp)\n if((x<=xf&&x>=xp)||(x>=xf&&x<=xp))\n break;\n\n\t\txp=xf;\n\t\typ=yf;\n\n\n\n\t}\n\n\n\tprintf(\"%d\",p);\n\n\treturn 0;\n}\n"}, {"source_code": "#include \n\ntypedef struct {\n\tint x;\n\tint y;\n} ponto;\n\nponto soma (ponto a, ponto b)\n{\n\tponto p;\n\tp.x = a.x + b.x;\n\tp.y = a.y + b.y;\n\treturn p;\n}\n\nponto produto (ponto a, int b)\n{\n\tponto p;\n\tp.x = a.x * b;\n\tp.y = a.y * b;\n\treturn p;\n}\n\nint min (int a, int b)\n{\n\treturn (a>b)?b:a;\n}\n\nint max (int a, int b)\n{\n\treturn (a>b)?a:b;\n}\n\nint main (void)\n{\n\tponto p;\n\tponto dir[4];\n\tponto atual;\n\tponto proximo;\n\tint dir_atual = 0;\n\tint loop = 0;\n\tint escalar = 1;\n\n\tatual.x = atual.y = 0;\n\tproximo.x = 1;\n\tproximo.y = 0;\n\n\tdir[0].x = 1; dir[0].y = 0;\n\tdir[1].x = 0; dir[1].y = 1;\n\tdir[2].x = -1; dir[2].y = 0;\n\tdir[3].x = 0; dir[3].y = -1;\n\n\tint resposta = 0;\n\t\n\tscanf(\"%d %d\", &p.x, &p.y);\n\n\twhile (1)\n\t{\n\t\t\n\t\tif (p.x == atual.x && p.x == proximo.x)\n\t\t\tif (p.y >= min(atual.y, proximo.y) && p.y <= max(atual.y, proximo.y))\n\t\t\t\tbreak;\n\t\t\n\t\tif (p.y == atual.y && p.y == proximo.y)\n\t\t\tif (p.x >= min(atual.x, proximo.x) && p.x <= max(atual.x, proximo.x))\n\t\t\t\tbreak;\n\n\t\tatual = proximo;\n\t\tdir_atual = (dir_atual+1)%4;\n\t\tloop = !loop;\n\t\tif (!loop) escalar++;\n\t\tproximo = soma(atual,produto(dir[dir_atual],escalar));\n\t\tresposta += 1;\n\t}\n\n\tprintf(\"%d\\n\", resposta);\n\n\treturn 0;\n}"}], "negative_code": [{"source_code": "#include \n\nint good(int a, int b, int c) {\n\tif (b > c) {\n\t\tint tmp;\n\n\t\ttmp = b;\n\t\tb = c;\n\t\tc = tmp;\n\t}\n\treturn a >= b && a <= c;\n}\n\nint main() {\n\tstatic int xx[400], yy[400];\n\tint x, y, i, a, b, c, d, e;\n\n\tscanf(\"%d%d\", &x, &y);\n\ta = b = 0;\n\tc = d = e = 1;\n\tfor (i = 0; i < 400; i++) {\n\t\txx[i] = a;\n\t\tyy[i] = b;\n\t\tif (c)\n\t\t\tif (d)\n\t\t\t\ta += e;\n\t\t\telse\n\t\t\t\ta -= e;\n\t\telse\n\t\t\tif (d)\n\t\t\t\tb += e, e++, d = 0;\n\t\t\telse\n\t\t\t\tb -= e, e++, d = 1;\n\t\tc = !c;\n\t}\n\tfor (i = 0; i + 1 < 400 && (xx[i] != x || !good(y, yy[i], yy[i + 1])) && (yy[i] != y || !good(x, xx[i], xx[i + 1])); i++)\n\t\t;\n\tprintf(\"%d\\n\", i);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint x,y,ans=0;\n\tscanf(\"%d%d\",&x,&y);\n\tif(x==y&&x>-y)\n\tans=-3+4*x;\n\tif(x==y&&x<-y)\n\tans=-1-4*x;\n\tif(y>x)\n\tans=-2+4*y;\n\tif(x>y)\n\tans=-4*y;\n\tprintf(\"%d\",ans);\n}"}, {"source_code": "#include\nint main()\n{\n\tint x,y,ans=0;\n\tscanf(\"%d%d\",&x,&y);\n\tif(x>=y&&x>-y+1)\n\tans=-3+4*x;\n\tif(x<=y&&x<-y)\n\tans=-1-4*x;\n\tif(y>x&&x>=-y)\n\tans=-2+4*y;\n\tif(x>y&&x>-y+1)\n\tans=-4*y;\n\tprintf(\"%d\",ans);\n}"}, {"source_code": "/*\n#include \n#include \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(cb){\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 \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \n#include \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 \n#include \n#include \n#include \n#include \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 \n#include \n#include \n#include \n#include \n\nint main() {\n\n int x, y;\n scanf(\"%d %d\", &x, &y);\n int s;\n if(y>x && x>=-y)s=-2+y*4;\n if(y-y+1)s=-3+x*4;\n if(y>=x && x<-y)s=-1-4*x;\n\n printf(\"%d\", s);\n\n\n return 0;\n\n}\n"}, {"source_code": "#include \n#include \n#include \nint main(void)\n{\n char ch;\n char* input = (char*)malloc(10);\n int i = 0;\n int on_y = 0;\n int neg_x = 0; \n int neg_y = 0;\n while(read(0, &ch, 1) > 0)\n {\n if(ch != '-')\n {\n input[i] = ch; \n i++;\n if(ch == ' ')\n {\n on_y = 1;\n }\n }\n else if(on_y)\n {\n neg_y = 1; \n }\n else\n {\n neg_x = 1; \n }\n }\n input[i] = '\\0';\n int x = strtol(input, &input, 10);\n if(neg_x)\n {\n x *= -1;\n }\n while(*input != ' ')\n {\n input++;\n }\n int y = strtol(input, &input, 10);\n if(neg_y)\n {\n y *= -1;\n }\n if(x < 0 && x <= y && y < -1 * x)\n {\n printf(\"%d\",4 * (-1*x - 1) + 3);\n }\n else if(x > 0 && -x + 1 < y && y <= x)\n {\n printf(\"%d\",4*(x-1) + 1);\n }\n else if(y > 0 && -1 * y <= x && x < y)\n {\n printf(\"%d\", 4 * (y - 1) + 2);\n }\n else if((x == 1 && y == 0) || (y < 0 && y < x && x <= -1*y + 1))\n {\n printf(\"%d\", -4 * y);\n }\n return 0; \n \n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int x,y,result;\n scanf(\"%d %d\",&x,&y);\n if(x==0 && y==0)result=0;\n else if(x==1 && y==0)result=0;\n else if(x==0 && y==1)result=2;\n else if(x==0 && y==-1)result=4;\n else if(x==-1 && y==0)result=3;\n else if(x>0 && y>0)\n {\n if(x0 && y<0)\n {\n if(x>abs(y))\n {\n if(x-abs(y)==1)\n result=(4*abs(y));\n else\n result=(3*x)+(x-3);\n }\n else result=(4*abs(y));\n }\n else if(x<0 && y>0)\n {\n if(abs(x)>y)\n result=(3*abs(x))+(abs(x)-1);\n else result=(3*y)+(y-2);\n }\n printf(\"%d\",result);\n return 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n\tint flap=1;int done=0;int turns=0;\n\tint x,y;\n\tscanf(\"%d %d\",&x,&y);\n\tint x1=0,y1=0;\n\tint c=1;int i=1;\n\tfor(c=1,i=1;c<10;i++)\n\t{\n\t int x2=x1;int y2=y1;\n\t\tif(flap==1)\n\t\t{\n\t\t\tif(c%2==0)\n\t\t\t\tx1=x1-c;\n\t\t\telse\n\t\t\t\tx1=x1+c;\n\t\t\tflap=0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(c%2==0)\n\t\t\t\ty1=y1-c;\n\t\t\telse\n\t\t\t\ty1=y1+c;\n\t\t\tflap=1;\n\t\t}\n\t if(i%2==0)\n\t\t c++;\n\t\t//printf(\"[%d %d] [%d %d]\\n\",x2,y2,x1,y1);\n\t\t//yha tak sahi h\n\t\t\n\t\t//check\n\t\tif(y1==y2 && y==y1)\n\t\t{\n\t\t if((x1<=x && x2>=x) || (x1>=x && x2<=x))\n\t\t {\n\t\t printf(\"%d\",turns);\n\t\t done=1;\n\t\t }\n\t\t}\n\t\telse if(x1==x2 && x==x1)\n\t\t{\n\t\t if((y1<=y && y2>=y) || (y1>=y && y2<=y))\n\t\t {\n\t\t printf(\"%d\",turns);\n\t\t done=1;\n\t\t } \n\t\t}\n\t\tif(done)\n\t\t break;\n\t\tturns++;\n\t}\n \n\treturn 0;\n}"}, {"source_code": "#include \n\ntypedef struct\n{\n\tint x,y;\n}Point_t ;\nPoint_t Now;\n\nint main()\n{\n\tint x,y,add,Res;\n\tscanf(\"%d %d\",&x,&y);\n\tadd=1;\n\tNow.x=Now.y=0;\n\twhile(add)\n\t{\n\t\tif(add&1)\n\t\t{\n\t\t\tif(y==Now.y&&x>=Now.x&&x<=Now.x+add)\n\t\t\t{\n\t\t\t\tRes=((add-1)<<1)+1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tNow.x+=add;\n\t\t\tif(x==Now.x&&y>=Now.y&&y<=Now.y+add)\n\t\t\t{\n\t\t\t\tRes=add<<1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tNow.y+=add;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(y==Now.y&&x>=Now.x-add&&x<=Now.x)\n\t\t\t{\n\t\t\t\tRes=((add-1)<<1)+1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tNow.x-=add;\n\t\t\tif(x==Now.x&&y>=Now.y-add&&y<=Now.y)\n\t\t\t{\n\t\t\t\tRes=add<<1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tNow.y-=add;\n\t\t}\n\t\t++add;\n\t}\n\tprintf(\"%d\\n\",Res);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\ntypedef struct\n{\n\tint x,y;\n}Point_t ;\nPoint_t Now;\n\nint main()\n{\n\tint x,y,add,Res;\n\tscanf(\"%d %d\",&x,&y);\n\tadd=1;\n\tNow.x=Now.y=0;\n\twhile(add)\n\t{\n\t\tif(add&1)\n\t\t{\n\t\t\tif(y==Now.y&&x>=Now.x&&x<=Now.x+add)\n\t\t\t{\n\t\t\t\tRes=(add-1)<<1+1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tNow.x+=add;\n\t\t\tif(x==Now.x&&y>=Now.y&&y<=Now.y+add)\n\t\t\t{\n\t\t\t\tRes=add<<1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tNow.y+=add;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(y==Now.y&&x>=Now.x-add&&x<=Now.x)\n\t\t\t{\n\t\t\t\tRes=(add-1)<<1+1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tNow.x-=add;\n\t\t\tif(x==Now.x&&y>=Now.y-add&&y<=Now.y)\n\t\t\t{\n\t\t\t\tRes=add<<1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tNow.y-=add;\n\t\t}\n\t\t++add;\n\t}\n\tprintf(\"%d\\n\",Res);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n#include \nint main()\n{\n int x=0,y=0,X,Y,s=0,i,A1=1,A2=3,A3=2,A4=0,max;\n scanf(\"%d%d\",&X,&Y);\n if ((X==0&&Y==0)||(X==1&&Y==0))\n printf(\"0\");\n else if ((Y==X&&X>=0)||((fabs(X)0))\n {\n if (fabs(X)0))\n A1++;\n printf(\"%d\",A1);\n }\n else if ((Y==X&&X<0)||((fabs(X)0)||((fabs(Y)0&&Y<=0)||((fabs(Y)=0))\n {\n if (fabs(X)=0)\n A4++;\n printf(\"%d\",A4);\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \nint main()\n{\n int x=0,y=0,X,Y,s=0,i,A1=1,A2=3,A3=2,A4=0,max;\n scanf(\"%d%d\",&X,&Y);\n if ((X==0&&Y==0)||(X==1&&Y==0))\n printf(\"0\");\n else if ((Y==X&&X>=0)||((fabs(X)0))\n {\n if (fabs(X)0))\n A1++;\n printf(\"%d\",A1);\n }\n else if ((Y==X&&X<0)||((fabs(X)0&&Y<0)))\n {\n if (fabs(X)0&&Y<0)))\n A2++;\n printf(\"%d\",A2);\n }\n else if ((Y==(-1*X)&&X<0&&Y>0)||((fabs(Y)0&&Y<=0)||((fabs(Y)=0))\n {\n if (fabs(X)=0)\n A4++;\n printf(\"%d\",A4);\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n=0,x=0,y=0,i,j,k,l;\n scanf(\"%d%d\",&k,&l);\n if((k==0)&(l==0))\n {\n printf(\"0\");\n return 0;\n }\n for(i=1;i<100;i++)\n {\n for(j=i;j=k))\n {\n printf(\"%d\",n);\n return 0;\n }\n }\n }\n for(j=i;j=l))\n {\n printf(\"%d\",n);\n return 0;\n }\n }\n }\n for(j=i+1;j=k)&&(x<=k))\n {\n printf(\"%d\",n);\n return 0;\n }\n }\n }\n for(j=i+1;j=l)&&(y<=l))\n {\n printf(\"%d\",n);\n return 0;\n }\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n=-1,x=0,y=0,i,j,k,l;\n scanf(\"%d%d\",&k,&l);\n if((k==0)&(l==0))\n {\n printf(\"0\");\n return 0;\n }\n for(i=1;i<100;i+=2)\n {\n for(j=i;j=k))\n {\n printf(\"%d\",n);\n return 0;\n }\n }\n }\n for(j=i;j=l))\n {\n printf(\"%d\",n);\n return 0;\n }\n }\n }\n for(j=i+1;j=k)&&(x<=k))\n {\n printf(\"%d\",n);\n return 0;\n }\n }\n }\n for(j=i+1;j=l)&&(y<=l))\n {\n printf(\"%d\",n);\n return 0;\n }\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\nint x,y,i=0,j=0,turn=-1;\nscanf(\"%d %d\",&x,&y);\nif(x==0&&y==0)\n{\n printf(\"0\");\nreturn 0;\n}\nwhile(1)\n{\n\n i++;\n turn++;\n if(x<=i&&x>=i-1&&j==y)\n {\n printf(\"%d\",turn);\n return 0;\n }\n j++;\n turn++;\n if(i==x&&y<=j&&y>=j-1)\n {\n printf(\"%d\",turn);\n return 0;\n }\n i=-i;\n turn++;\n if(x<=i&&x>=-i&&j==y)\n {\n printf(\"%d\",turn);\n return 0;\n }\n j=-j;\n turn++;\n if(i==x&&y<=i&&y>=-i)\n {\n printf(\"%d\",turn);\n return 0;\n }\n i=-i+1;\n turn++;\n if(x<=i&&x>=i-1&&j==y)\n {\n printf(\"%d\",turn);\n return 0;\n }\n j=-j+1;\n turn++;\n if(x==i&&y<=j&&y>=j-1)\n {\n printf(\"%d\",turn);\n return 0;\n }\n i=-i;\n turn++;\n if(x<=i&&x>=-i&&j==y)\n {\n printf(\"%d\",turn);\n return 0;\n }\n j=-j;\n turn++;\n if(i==x&&y<=i&&y>=-i)\n {\n printf(\"%d\",turn);\n return 0;\n }\n\n}\n}\n"}, {"source_code": "#include\nint main()\n{\nint x,y,i=0,j=0,turn=-1;\nscanf(\"%d %d\",&x,&y);\nif(x==0&&y==0)\n{\n printf(\"0\");\nreturn 0;\n}\nwhile(1)\n{\n i=-i+1;\n turn++;\n if(x<=i&&x>=i-1&&(j==-y||j==y))\n {\n printf(\"%d\",turn);\n return 0;\n }\n j=-j+1;\n turn++;\n if((x==i||i==-x)&&y<=j&&y>=j-1)\n {\n printf(\"%d\",turn);\n return 0;\n }\n i=-i;\n turn++;\n if(x>=i&&x<=-i&&(j==y||j==-y))\n {\n printf(\"%d\",turn);\n return 0;\n }\n j=-j;\n turn++;\n if((i==x||i==-x)&&y>=i&&y<=-i)\n {\n printf(\"%d\",turn);\n return 0;\n }\n}\n}\n"}, {"source_code": "#include\nint main()\n{\nint x,y,i=0,j=0,turn=-1;\nscanf(\"%d %d\",&x,&y);\nif(x==0&&y==0)\n{\n printf(\"0\");\nreturn 0;\n}\nwhile(1)\n{\n\n i++;\n turn++;\n if(x<=i&&x>=i-1&&j==y)\n {\n printf(\"%d\",turn);\n return 0;\n }\n j++;\n turn++;\n if(i==x&&y<=j&&y>=j-1)\n {\n printf(\"%d\",turn);\n return 0;\n }\n i=-i;\n turn++;\n if(x>=i&&x<=-i&&j==y)\n {\n printf(\"%d\",turn);\n return 0;\n }\n j=-j;\n turn++;\n if(i==x&&y>=i&&y<=-i)\n {\n printf(\"%d\",turn);\n return 0;\n }\n i=-i+1;\n turn++;\n if(x>=i&&x<=i-1&&j==y)\n {\n printf(\"%d\",turn);\n return 0;\n }\n j=-j+1;\n turn++;\n if(x==i&&y>=j&&y<=i-1)\n {\n printf(\"%d\",turn);\n return 0;\n }\n\n}\n}\n"}, {"source_code": "#include\nint main()\n{\nint x,y,i=0,j=0,turn=-1;\nscanf(\"%d %d\",&x,&y);\nwhile(1)\n{\n if(i==x&&y<=j&&y>=j-1)\n {\n printf(\"%d\",turn);\n return 0;\n }\n i++;\n turn++;\n if(x<=i&&x>=i-1&&j==y)\n {\n printf(\"%d\",turn);\n return 0;\n }\n j++;\n turn++;\n if(i==x&&y<=j&&y>=j-1)\n {\n printf(\"%d\",turn);\n return 0;\n }\n i=-i;\n turn++;\n if(x>=i&&x<=-i&&j==y)\n {\n printf(\"%d\",turn);\n return 0;\n }\n j=-j;\n turn++;\n if(i==x&&y>=i&&y<=-i)\n {\n printf(\"%d\",turn);\n return 0;\n }\n i=-i+1;\n turn++;\n if(x>=i&&x<=i-1&&j==y)\n {\n printf(\"%d\",turn);\n return 0;\n }\n j=-j+1;\n turn++;\n}\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int x, y, turn;\n \n scanf(\"%d%d\", &x, &y);\n \n if(x==0 && y==0)\n turn = 0;\n else if(x>=0 && y>=0)\n {\n if(x>=y)\n turn = (x-1)*4 + 1;\n else if(y>x)\n turn = (y-1)*4 + 2;\n }\n else if(x<=0 && y>=0)\n {\n if(x*-1 > y)\n turn = (x*-1-1)*4 + 3;\n else if(x*-1 <= y)\n turn = (y-1)*4 + 2;\n }\n else if(x<=0 && y<=0)\n {\n if((x*-1) >= (y*-1))\n turn = (x*-1-1)*4 + 3;\n else if(x*-1 < y*-1)\n turn = (y*-1)*4;\n }\n else if(x>=0 && y<=0)\n {\n if(x <= y*-1 || x+y==1)\n turn = (y*-1)*4;\n else if(x > y*-1 && x+y!=1)\n turn = (x-1)*4 + 1;\n }\n \n printf(\"%d\\n\", turn);\n \n return 0;\n}\n "}, {"source_code": "#include \n#include \n\nint main()\n{\n int x, y, turn;\n \n scanf(\"%d%d\", &x, &y);\n \n if(x==0 && y==0)\n turn = 0;\n else if(x>=0 && y>=0)\n {\n if(x>=y)\n turn = (x-1)*4 + 1;\n else if(y>x)\n turn = (y-1)*4 + 2;\n }\n else if(x<=0 && y>=0)\n {\n if(x*-1 > y)\n turn = (x*-1-1)*4 + 3;\n else if(x*-1 <= y)\n turn = (y-1)*4 + 2;\n }\n else if(x<=0 && y<=0)\n {\n if((x*-1) >= (y*-1))\n turn = (x*-1-1)*4 + 3;\n else if(x*-1 < y*-1)\n turn = (y*-1)*4;\n }\n else if(x>=0 && y<=0)\n {\n if(x <= y*-1 || x+y==1)\n turn = (y*-1)*4;\n else if(x > y*-1 && x+y!=1)\n turn = (x)*4 + 1;\n }\n \n printf(\"%d\\n\", turn);\n \n return 0;\n}\n "}, {"source_code": "#include \n#include \n\nint main()\n{\n int x=0,y=0,i,line=1,y1;\n scanf(\"%i %i\",&x,&y);\n for (i=1;i<2;)\n {\n if (x==0 && y==0)\n {\n printf(\"0\");\n break;\n }\n\n else if (y==0 && ( x<=1 && x>=0 ) )\n {\n\n printf(\"0\");\n break;\n }\n else if (x==1 && (y>=0 && y <=1))\n {\n printf(\"1\");\n y1=1;\n break;\n }\n else\n i++;\n line++;\n }\n\n\n for (i=1;i<=100;)\n{\n\n\n if ( (-i<=x && x<=i) &&y==i && y1!=1)///upper\n {\n printf(\"%i \",line) ;\n break;\n }\n else\n line++;\n if ( (-i<=y && y<=i )&& x==-i )//left\n {\n printf(\"%i \",line);\n break;\n }\n else\n line++;\n if ( (-i<=x&&x<=i+1)&&y==-i )\n {\n printf(\"%i\",line) ;\n break;\n }\n else\n {\n line++;\n i++;\n }\n if ( ( -i+1<= y && y<=i ) && x==i)\n {\n printf(\"%i\",line) ;\n break;\n }\n else\n line++;\n\n }\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int x=0,y=0,i,line=1,y1;\n scanf(\"%i %i\",&x,&y);\n for (i=1;i<2;)\n {\n\n if (y==0 && ( x<=1 && x>=0 ) )\n {\n\n printf(\"0\");\n break;\n }\n else if (x==1 && (y>=0 && y <=1))\n {\n printf(\"1\");\n y1=1;\n break;\n }\n else\n i++;\n line++;\n }\n\n\n for (i=1;i<=100;)\n{\n if (x==0 && y==1 ){\n printf(\"2\");\n break;\n }\n else if ( (-i<=x && x<=i) &&y==i && y1!=1)///upper\n {\n printf(\"%i \",line) ;\n break;\n }\n else\n line++;\n if ( (-i<=y && y<=i )&& x==-i )//left\n {\n printf(\"%i \",line);\n break;\n }\n else\n line++;\n if ( (-i<=x&&x<=i+1)&&y==-i )\n {\n printf(\"%i\",line) ;\n break;\n }\n else\n {\n line++;\n i++;\n }\n if ( ( -i+1<= y && y<=i ) && x==i)\n {\n printf(\"%i\",line) ;\n break;\n }\n else\n line++;\n\n }\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int x=0,y=0,i,line=1;\n scanf(\"%i %i\",&x,&y);\n for (i=1;i<2;)\n {\n if (x==0 && y==0)\n {\n printf(\"0\");\n break;\n }\n\n else if (y==0 && ( x<=1 && x>=0 ) )\n {\n\n printf(\"0\");\n break;\n }\n else\n i++;\n line++;\n }\n\n\n for (i=1;i<=100;)\n{\n\n\n if ( (-i<=x && x<=i) &&y==i )///upper\n {\n printf(\"%i \",line) ;\n break;\n }\n else\n line++;\n if ( (-i<=y && y<=i )&& x==-i )//left\n {\n printf(\"%i \",line);\n break;\n }\n else\n line++;\n if ( (-i<=x&&x<=i+1)&&y==-i )\n {\n printf(\"%i\",line) ;\n break;\n }\n else\n {\n line++;\n i++;\n }\n if ( ( -i+1<= y && y<=i ) && x==i)\n {\n printf(\"%i\",line) ;\n break;\n }\n else\n line++;\n\n }\n\n return 0;\n}\n"}, {"source_code": "//In the name of God\n#include \n\nint dx,dy;\nint x,y;\n\nint mv(int size,int d)\n{\n d%=4;\n int ax=0,ay=0;\n switch(d)\n {\n case 0:\n ay=-1;\n break;\n case 1:\n ax=1;\n break;\n case 2:\n ay=1;\n break;\n default:\n ax=-1;\n }\n while(size--)\n {\n x+=ax; y+=ay;\n if(x==dx && y==dy)\n\treturn 1;\n }\n return 0;\n}\n\nint main()\n{\n scanf(\"%d%d\",&dx,&dy);\n if(dx==0 && dy==0)\n {\n printf(\"0\");\n return 0;\n }\n int step; int d=0; int size=1, rem=2;\n for(step=0;;step++)\n {\n d++;\n if(rem>0)\n\trem--;\n else\n\t{\n\t size++;\n\t rem=2;\n\t}\n if(mv(size,d))\n\t{\n\tprintf(\"%d\\n\",step);\n\treturn 0;\n\t}\n }\n}\n"}, {"source_code": "#include\nint main()\n{\nint a,b,x[500],y[500],i,j,t=1;\nscanf(\"%d %d\",&a,&b);\nx[0]=0;\nfor(i=1;i<=400;i+=4)\n{x[i]=t;\nx[i+1]=t;\nx[i+2]=-1*t;\nx[i+3]=-1*t;\nt++;}\nt=1;\ny[0]=0;\ny[1]=0;\nfor(i=2;i<=400;i+=4)\n{y[i]=t;\ny[i+1]=t;\ny[i+2]=-1*t;\ny[i+3]=-1*t;\nt++;}\nfor(i=0;i<400;i++)\n{if(((a>=x[i]&&b>=y[i])&&(a<=x[i+1]&&b<=y[i+1]))||((a>=x[i+1]&&b>=y[i+1])&&(a<=x[i]&&b<=y[i])))\n{j=i;\nbreak;}}\nprintf(\"%d\",j);\nreturn(0);}\n"}, {"source_code": "#include\nint main()\n{\nint a,b,x[500],y[500],i,j,t=1;\nscanf(\"%d %d\",&a,&b);\nx[0]=0;\nfor(i=1;i<=400;i+=4)\n{x[i]=t;\nx[i+1]=t;\nx[i+2]=-1*t;\nx[i+3]=-1*t;\nt++;}\nt=1;\ny[0]=0;\ny[1]=0;\nfor(i=2;i<=400;i+=4)\n{y[i]=t;\ny[i+1]=t;\ny[i+2]=-1*t;\ny[i+3]=-1*t;\nt++;}\nfor(i=0;i<=400;i++)\n{if(((a>=x[i]&&b>=y[i])&&(a<=x[i+1]&&b<=y[i+1]))||((a>=x[i+1]&&b>=y[i+1])&&(a<=x[i]&&b<=y[i])))\n{j=i;\nbreak;}}\nprintf(\"%d\",j);\nreturn(0);}\n"}, {"source_code": "#include\nvoid quicksort(int a[],int lower,int upper)\n{\n\tif(lower=p && u>lower)\n\t\t\tu--;\n//\t\tprintf(\"\\nstopped at %d and %d\",a[l],a[u]);\n\t\tif(l0 && x>=-1*y && x<=y)\n\t{\n\t\tans=2+4*(y-1);\n\t\tif(x==y)\n\t\t\tans--;\n\t}\n\telse if(y<0 && x>=y && x<=-1*y+1)\n\t{\n\t\tans=4+4*(-1*y-1);\n\t\tif(x==y)\n\t\t\tans--;\n\t}\n\telse if(x>0 && y<=x && y>=-1*x+1)\n\t{\n\t\tans=1+(4*(x-1));\n\t\t\tif(x==-1*y+1)\n\t\t\tans--;\n\t}\n\telse if(x<0 && y>=x && y<=-1*x)\n\t{\n\t\tans=3+(4*(-1*x-1));\n\t\t\tif(x==-y)\n\t\t\tans--;\n\t}\n\tprintf(\"%d\",ans);\n\treturn 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n int x,y,i,j,k,l;\n scanf(\"%d%d\",&x,&y);\n if(x>=0&&y>=0)\n {\n if(x==0&&y==0)\n printf(\"0\");\n else if(x==y)\n printf(\"%d\",1+4*(x-1));\n else if(x>y)\n printf(\"%d\",4*(x-1));\n else\n printf(\"%d\",2+4*(y-1));\n }\n else if(x>=0&&y<0)\n {\n if(x==-y)\n printf(\"%d\",4*(x));\n else\n printf(\"%d\",4*(-y));\n }\n else if(x<0&&y>=0)\n {\n if(x==-y||y>-x)\n printf(\"%d\",2+4*(y-1));\n else\n printf(\"%d\",4*(-x)-1);\n }\n else if(x<0&&y<0)\n {\n if(x==y||x\nint main()\n{\n\tint x,y,i,j,k,l;\n\tscanf(\"%d%d\",&x,&y);\n\tif(x>=0&&y>=0)\n\t{\n\t\tif(x==0&&y==0)\n\t printf(\"0\");\n\t\telse if(x==y)\n\t\tprintf(\"%d\",1+4*(x-1));\n\t\telse if(x>y)\n\t\tprintf(\"%d\",4*(x-1));\n\t\telse\n\t\tprintf(\"%d\",2+4*(y-1));\n\t}\n\telse if(x>0&&y<0)\n\t{\n\t\t if(x==-y)\n\t\tprintf(\"%d\",4*(x));\n\t\telse\n\t\tprintf(\"%d\",4*(-y));\n\t}\n\t\telse if(x<0&&y>0)\n\t{\n\t\t if(x==-y||y>-x)\n\t\tprintf(\"%d\",2+4*(y-1));\n\t\telse\n\t\tprintf(\"%d\",4*(-x)-1);\n\t}\n\t\telse if(x<0&&y<0)\n\t{\n\t\t if(x==y||x\nint main()\n{\n int x,y,i,j,k,l;\n scanf(\"%d%d\",&x,&y);\n if(x>=0&&y>=0)\n {\n if(x==0&&y==0)\n printf(\"0\");\n else if(x==y)\n printf(\"%d\",1+4*(x-1));\n else if(x>y)\n printf(\"%d\",1+4*(x-1));\n else\n printf(\"%d\",2+4*(y-1));\n }\n else if(x>0&&y<0)\n {\n if(x==-y)\n printf(\"%d\",4*(x));\n else\n printf(\"%d\",4*(-y));\n }\n else if(x<0&&y>0)\n {\n if(x==-y||y>-x)\n printf(\"%d\",2+4*(y-1));\n else\n printf(\"%d\",4*(-x)-1);\n }\n else if(x<0&&y<0)\n {\n if(x==y||x\n#include\n\nint main()\n{\n int i,x,y,a,b,d=1,turns=0,m=1;\n scanf(\"%d %d\",&x,&y);\n a=b=0;\n while(a!=x && b!=y)\n {\n if(m==1)\n {\n x=x+d;\n m++;\n }\n else if(m==2)\n {\n y=y+d;\n m++;\n d++;\n turns++;\n }\n else if(m==3)\n {\n x=x-d;\n m++;\n }\n else if(m==4)\n {\n y=y-d;\n m=1;\n d++;\n turns++;\n }\n }\n printf(\"%d\",turns);\n \n \nreturn 0;\n}"}, {"source_code": "#include\n#include\n\nint main()\n{\n int i,x,y,a,b,d=1,turns=0,m=1;\n scanf(\"%d %d\",&x,&y);\n a=b=0;\n while(a!=x && b!=y)\n {\n if(m==1)\n {\n a=a+d;\n m++;\n }\n else if(m==2)\n {\n b=b+d;\n m++;\n d++;\n turns++;\n }\n else if(m==3)\n {\n a=a-d;\n m++;\n }\n else if(m==4)\n {\n b=b-d;\n m=1;\n d++;\n turns++;\n }\n }\n printf(\"%d\",turns);\n \n \nreturn 0;\n}"}, {"source_code": "#include \n#define BREAK_LOOP if( (!dir&&ty==y&&tx>=x) || (dir==1&&tx==x&&ty>=y) || (dir==2&&ty==y&&tx<=x) || (dir==3&&tx==x&&ty<=y) ){break;}\nint x,y,tx,ty,step=0,turn=0,dir;\nint main(){\n\tscanf(\"%d %d\", &x, &y);\n\twhile(1){\n\t\tBREAK_LOOP\n\t\tdir=0;\n\t\tif(turn!=0){\n\t\t\tturn++;\n\t\t}\n\t\tstep++;\n\t\ttx+=step;\n\n\t\tBREAK_LOOP\n\t\tdir++;\n\t\tturn++;\n\t\tty+=step;\n\t\tstep*=-1;\n\t\t\n\t\tBREAK_LOOP\n\t\tdir++;\n\t\tturn++;\n\t\tstep--;\n\t\ttx+=step;\n\t\t\n\t\tBREAK_LOOP\n\t\tdir++;\n\t\tturn++;\n\t\tty+=step;\n\t\tstep*=-1;\n\t}\n\tprintf(\"%d \", turn);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#define BREAK_LOOP if( ((tx==x) && ((step>0 && ty>=y) || (step<0 && ty<=y)) ) || ((ty==y) && ((step>0 && tx>=x) || (step<0 && tx<=x)) ) ){break;}\nint x,y,tx,ty,step=0,turn=0;\nint main(){\n\tscanf(\"%d %d\", &x, &y);\n\twhile(1){\n\t\tBREAK_LOOP\n\t\tstep*=-1;\n\t\tstep++;\n\t\ttx+=step;\n\t\tBREAK_LOOP\n\t\tturn++;\n\t\tty+=step;\n\t\tBREAK_LOOP\n\t\tturn++;\n\t\tstep++;\n\t\tstep*=-1;\n\t\ttx+=step;\n\t\tBREAK_LOOP\n\t\tturn++;\n\t\tty+=step;\n\t}\n\tprintf(\"%d \", turn);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#define BREAK_LOOP if( (!dir && (tx==x) && ((step>=0 && ty>=y) || (step<0 && ty<=y)) ) || (dir && (ty==y) && ((step>=0 && tx>=x) || (step<0 && tx<=x)) ) ){break;}\nint x,y,tx,ty,step=0,turn=0,dir;\nint main(){\n\tscanf(\"%d %d\", &x, &y);\n\twhile(1){\n\t\tBREAK_LOOP\n\t\tif(turn!=0){\n\t\t\tturn++;\n\t\t}\n\t\tstep*=-1;\n\t\tstep++;\n\t\ttx+=step;\n\t\tdir=0;\n\t\tBREAK_LOOP\n\t\tturn++;\n\t\tty+=step;\n\t\tdir=1;\n\t\tBREAK_LOOP\n\t\tturn++;\n\t\tstep++;\n\t\tstep*=-1;\n\t\ttx+=step;\n\t\tdir=0;\n\t\tBREAK_LOOP\n\t\tturn++;\n\t\tty+=step;\n\t\tdir=1;\n\t}\n\tprintf(\"%d \", turn);\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int t,a=0,b=1,c=2,d=3;\n \n int x,y,p=0;\n scanf(\"%d%d\",&x,&y);\n if(x==1&&y==0||x==0&&y==0)\n p=0;\n else if((x>=0&&y>=0)&&(abs(x)>=abs(y)))\n p=((abs(x)-1)*4)+1;\n else if((x>=0&&y>=0)&&(abs(x)=0)&&(abs(x)<=abs(y)))\n p=((abs(y)-1)*4)+2;\n else if((x<=0&&y>=0)&&(abs(x)>abs(y)))\n p=((abs(x)-1)*4)+3;\n else if((x<=0&&y<=0)&&(abs(x)>=abs(y)))\n p=((abs(x)-1)*4)+3;\n else if((x<=0&&y<=0)&&(abs(x)=0&&y<=0)&&(abs(x)<=abs(y)))\n p=((abs(y)-1)*4)+4;\n else\n p=((abs(x)-1)*4)+1;\n\n\n printf(\"%d\",p);\n\n \nreturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main(){\n int x=0,y=0,a,b,sum,t,i;\n int right[110],up[110],left[110],down[110];\n right[1]=1;up[1]=2;down[1]=4;left[1]=3;\n for(i=2;i<=110;i++)\n right[i]=up[i]=left[i]=down[i]=0;\n for(i=2;i<=100;i++){\n right[i]+=4;\n left[i]+=4;\n up[i]+=4;\n down[i]+=4;\n }\n scanf(\"%d%d\",&a,&b);\n if(a==b&&b==0 || a==1&&b==0)printf(\"0\\n\");\n else if(a&&b){\n if(a>0&&b>0)printf(\"%d\\n\",right[a]);\n else if(a>0&&b<0)printf(\"%d\\n\",down[a]);\n else if(a<0&&b>0)printf(\"%d\\n\",up[b]);\n else printf(\"%d\\n\",left[-a]);\n }\n else{\n if(b==0)\n if(a>0)\n printf(\"%d\\n\",right[a]);\n else printf(\"%d\\n\",left[-a]);\n else{\n if(b>0)\n printf(\"%d\\n\",up[b]);\n else printf(\"%d\\n\",down[-b]);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main(){\n int x=0,y=0,a,b,sum=0,t=1,i;\n scanf(\"%d%d\",&a,&b);\n if(a==b&&b==0 || a==1&&b==0)printf(\"0\\n\");\n else{\n for(i=1;;i++){\n if(x+t>=a&&y>=b){\n printf(\"%d\\n\",sum+1);\n break;\n }\n else {\n x+=t;\n sum++;\n }\n if(x>=a&&y+t>=b){\n printf(\"%d\\n\",sum+1);\n break;\n }\n else {\n y+=t;\n sum++;\n }\n if(y>=b&&x-t-1>=a){\n printf(\"%d\\n\",1+sum);\n break;\n }\n else {\n x-=(t+1);\n sum++;\n }\n if(x>=a&&y-t-1>=b){\n printf(\"%d\\n\",sum+1);\n break;\n }\n else {\n y-=(t+1);\n sum++;\n }\n t+=2;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main(){\n int x=0,y=0,a,b,sum=0,t=1,i;\n scanf(\"%d%d\",&a,&b);\n if(a==b&&b==0 || a==1&&b==0)printf(\"0\\n\");\n else{\n for(i=1;;i++){\n if(x+t==a&&y==b||x+t>a&&y>=b&&a>=x){\n printf(\"%d\\n\",sum);\n break;\n }\n else {\n x+=t;\n sum++;\n }\n if(x==a&&y+t==b||x==a&&y<=b&&(y+t)>=b){\n printf(\"%d\\n\",sum);\n break;\n }\n else {\n y+=t;\n sum++;\n }\n if(y==b&&x-t-1==a||x>=a&&y==b&&x-t-1b&&y-t-1<=b){\n printf(\"%d\\n\",sum);\n break;\n }\n else {\n y-=(t+1);\n sum++;\n }\n t+=2;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main(){\n int x=0,y=0,a,b,sum=0,t=1,i;\n scanf(\"%d%d\",&a,&b);\n if(a==b&&b==0 || a==1&&b==0)printf(\"0\\n\");\n else{\n for(i=1;;i++){\n if(x+t>=a&&y>=b){\n printf(\"%d\\n\",sum+1);\n break;\n }\n else {\n x+=t;\n sum++;\n }\n if(x>=a&&y+t>=b){\n printf(\"%d\\n\",sum+1);\n break;\n }\n else {\n y+=t;\n sum++;\n }\n if(y>=b&&x-t-1>=a){\n printf(\"%d\\n\",1+sum);\n break;\n }\n else {\n x-=(t+1);\n sum++;\n }\n if(x>=a&&y-t-1>=b){\n printf(\"%d\\n\",sum+1);\n break;\n }\n else {\n y-=(t+1);\n sum++;\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main(){\n int x=0,y=0,a,b,sum,t,i;\n int right[110],up[110],left[110],down[110];\n right[1]=1;up[1]=2;down[1]=4;left[1]=3;\n for(i=2;i<=110;i++)\n right[i]=up[i]=left[i]=down[i]=0;\n for(i=2;i<=101;i++){\n right[i]=4+right[i-1];\n left[i]=4+left[i-1];\n up[i]=4+up[i-1];\n down[i]=4+left[i-1];\n }\n scanf(\"%d%d\",&a,&b);\n if(a==b&&b==0 || a==1&&b==0)printf(\"0\\n\");\n else if(a&&b){\n if(a>0&&b>0)printf(\"%d\\n\",right[a]);\n else if(a>0&&b<0)printf(\"%d\\n\",down[a]);\n else if(a<0&&b>0)printf(\"%d\\n\",up[b]);\n else printf(\"%d\\n\",left[-a]);\n }\n else{\n if(b==0)\n if(a>0)\n printf(\"%d\\n\",right[a]);\n else printf(\"%d\\n\",left[-a]);\n else{\n if(b>0)\n printf(\"%d\\n\",up[b]);\n else printf(\"%d\\n\",down[-b]);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main(){\n int x=0,y=0,a,b,sum=0,t=1,i;\n scanf(\"%d%d\",&a,&b);\n if(a==b&&b==0 || a==1&&b==0)printf(\"0\\n\");\n else{\n for(i=1;;i++){\n if(x+t==a&&y==b||x+t>a&&y>=b&&a>=x){\n printf(\"%d\\n\",sum+1);\n break;\n }\n else {\n x+=t;\n sum++;\n }\n if(x==a&&y+t==b||x==a&&y<=b&&(y+t)>=b){\n printf(\"%d\\n\",sum+1);\n break;\n }\n else {\n y+=t;\n sum++;\n }\n if(y==b&&x-t-1==a||x>=a&&y==b&&x-t-1b&&y-t-1<=b){\n printf(\"%d\\n\",sum+1);\n break;\n }\n else {\n y-=(t+1);\n sum++;\n }\n t+=2;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main(){\n int x=0,y=0,a,b,sum=0,t=1,i;\n scanf(\"%d%d\",&a,&b);\n if(a==b&&b==0 || a==1&&b==0)printf(\"0\\n\");\n else{\n for(i=1;;i++){\n if(x+t>=a&&y>=b){\n printf(\"%d\\n\",sum+1);\n break;\n }\n else {\n x+=t;\n sum++;\n }\n if(x>=a&&y+t>=b){\n printf(\"%d\\n\",sum+1);\n break;\n }\n else {\n y+=t;\n sum++;\n }\n if(y>=b&&x-t-1>=a){\n printf(\"%d\\n\",1+sum);\n break;\n }\n else {\n x-=(t+1);\n sum++;\n }\n if(x>=a&&y-t-1>=b){\n printf(\"%d\\n\",sum+1);\n break;\n }\n else {\n y-=(t+1);\n sum++;\n }\n t++;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n\tint xCord,yCord,turns;\n\tscanf (\"%d%d\",&xCord,&yCord);\n\tif(xCord==0 && yCord==0){\n\t\tturns = 0;\n\t}\n\n\telse if((yCord*-1)<=xCord && yCord>xCord){\n\t\tturns = 2+(yCord-1)*4;\n\t}\n\n\telse if(((xCord*-1)+1)=yCord){\n\t\tturns = 1+(xCord-1)*4;\n\t}\n\n\telse if(yCordyCord && xCord<=yCord){\n\t\tturns = xCord*-4;\n\t}\n\tprintf (\"%d\\n\",turns);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main(void)\n{\n\tint x,y,sol,startC,r;\n\tscanf(\"%d %d\",&x,&y);\n\t\n\tif(x>0){\n\t\tif(y1) r=4; /*D*/\n\t\t\telse r=3; /*C*/\n\t\t}\n\t\telse r=1; /*A*/\n\t}\n\telse {\n\t\tif(y0) r=1; /*A*/\n\t\telse r=2; /*B*/\n\t}\n\t\n\tif((x==0 && y==0) || (x==1 && y==0)) sol = 0;\n\telse {\n\t\tif(r==1){ sol=2; startC=1; }\n\t\telse if(r==2){ sol=3; startC=-1; }\n\t\telse if(r==3){ sol=4; startC=-1; }\n\t\telse if(r==4){ sol=1; startC=1; }\n\t\n\t\tif(r==1 || r==3) {\n\t\t\twhile(startC!=y){\n\t\t\t\tsol+=4;\n\t\t\t\tif(r==1) startC++;\n\t\t\t\telse startC--;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\twhile(startC!=x){\n\t\t\t\tsol+=4;\n\t\t\t\tif(r==2) startC--;\n\t\t\t\telse startC++;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tprintf(\"%d\",sol);\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n\tint x, y;\n\tscanf(\"%d%d\", &x, &y);\n\tif ( !y && (!x || x == 1) )\n\t\tputs(\"0\");\n\telse if ( x == 1 && y == 1 )\n\t\tputs(\"1\");\n\telse\n\t{\n\t\tint i, px, py, res = 1;\n\t\tfor ( px = py = i = 1; ++i <= 200; )\n\t\t{\n\t\t\t++res;\n\t\t\tif ( y == py && x < px && x >= px-i )\n\t\t\t\tbreak;\n\t\t\tpx -= i;\n\t\t\t++res;\n\t\t\tif ( x == px && y < py && y >= py-i )\n\t\t\t\tbreak;\n\t\t\tpy -= i;\n\t\t\t++res;\n\t\t\tif ( y == py && px < x && px+i >= x )\n\t\t\t\tbreak;\n\t\t\tpx += i;\n\t\t\t++res;\n\t\t\tif ( x == px && py < y && py+i >= y )\n\t\t\t\tbreak;\n\t\t\tpy += i;\n\t\t}\n\t\tprintf(\"%d\\n\", res);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tint x, y;\n\tscanf(\"%d%d\", &x, &y);\n\tif ( !y && (!x || x == 1) )\n\t\tputs(\"0\");\n\telse if ( x == 1 && y == 1 )\n\t\tputs(\"1\");\n\telse\n\t{\n\t\tint i, px, py, res = 1;\n\t\tfor ( px = py = i = 1; ++i <= 200; ++i )\n\t\t{\n\t\t\t++res;\n\t\t\tif ( y == py && x < px && x >= px-i )\n\t\t\t\tbreak;\n\t\t\tpx -= i;\n\t\t\t++res;\n\t\t\tif ( x == px && y < py && y >= py-i )\n\t\t\t\tbreak;\n\t\t\tpy -= i;\n\t\t\t++res;\n\t\t\tif ( y == py && px < x && px+i >= x )\n\t\t\t\tbreak;\n\t\t\tpx += i;\n\t\t\t++res;\n\t\t\tif ( x == px && py < y && py+i >= y )\n\t\t\t\tbreak;\n\t\t\tpy += i;\n\t\t}\n\t\tprintf(\"%d\\n\", res);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int ans=-1, sl, x, y;\n scanf(\"%d %d\", &x, &y);\n if(x==0 && y==0 || x==1 && y==0)\n ans=0;\n else if(x==0)\n {\n sl=y/abs(y);\n y=abs(y);\n if(sl==1)\n ans=4*(y-1) + 2;\n else if(sl==-1)\n ans=4*(y-1) + 4;\n }\n else if(y==0)\n {\n sl=x/abs(x);\n x=abs(x);\n if(sl==1)\n ans=4*(x-1) + 1;\n else if(sl==-1)\n ans=4*(x-1) + 3;\n }\n else if(abs(x)==abs(y))\n {\n if(x>0 && y>0)\n ans=4*(x-1)+1;\n if(x<0 && y>0)\n ans=4*(y-1)+2;\n if(x<0 && y<0)\n ans=4*(abs(x)-1)+3;\n }\n else if(x=abs(y)+1 && y<0)\n ans=4*(x-1) + 4;\n else if(abs(x)>abs(y))\n {\n sl=x/abs(x);\n x=abs(x);\n if(sl==1)\n ans=4*(x-1) + 1;\n else if(sl==-1)\n ans=4*(x-1) + 3;\n }\n else if(abs(y)>abs(x))\n {\n sl=y/abs(y);\n y=abs(y);\n if(sl==1)\n ans=4*(y-1) + 2;\n else if(sl==-1)\n ans=4*(y-1) + 4;\n }\n printf(\"%d\\n\", ans);\n return 0;\n}"}, {"source_code": "#include \nint main()\n{\n int ans=-1, sl, x, y;\n scanf(\"%d %d\", &x, &y);\n if(x==0 && y==0 || x==1 && y==0)\n ans=0;\n else if(x==0)\n {\n sl=y/abs(y);\n y=abs(y);\n if(sl==1)\n ans=4*(y-1) + 2;\n else if(sl==-1)\n ans=4*(y-1) + 4;\n }\n else if(y==0)\n {\n sl=x/abs(x);\n x=abs(x);\n if(sl==1)\n ans=4*(x-1) + 1;\n else if(sl==-1)\n ans=4*(x-1) + 3;\n }\n else if(abs(x)==abs(y))\n {\n if(x>0 && y>0)\n ans=4*(x-1)+1;\n if(x<0 && y>0)\n ans=4*(y-1)+2;\n if(x<0 && y<0)\n ans=4*(abs(x)-1)+3;\n if(x>0 && y<0)\n ans=4*(x-1) + 4;\n }\n else if(y<0 && x==abs(y)+1)\n {\n printf(\"Entering here\\n\");\n ans=4*(x-1) + 4;\n }\n else if(abs(x)>abs(y))\n {\n sl=x/abs(x);\n x=abs(x);\n if(sl==1)\n ans=4*(x-1) + 1;\n else if(sl==-1)\n ans=4*(x-1) + 3;\n }\n else if(abs(y)>abs(x))\n {\n sl=y/abs(y);\n y=abs(y);\n if(sl==1)\n ans=4*(y-1) + 2;\n else if(sl==-1)\n ans=4*(y-1) + 4;\n }\n printf(\"%d\\n\", ans);\n return 0;\n}"}, {"source_code": "#include \nint main()\n{\n int ans=-1, sl, x, y;\n scanf(\"%d %d\", &x, &y);\n if(x==0 && y==0 || x==1 && y==0)\n ans=0;\n else if(x==0)\n {\n sl=y/abs(y);\n y=abs(y);\n if(sl==1)\n ans=4*(y-1) + 2;\n else if(sl==-1)\n ans=4*(y-1) + 4;\n }\n else if(y==0)\n {\n sl=x/abs(x);\n x=abs(x);\n if(sl==1)\n ans=4*(x-1) + 1;\n else if(sl==-1)\n ans=4*(x-1) + 3;\n }\n else if(x>=y)\n {\n sl=x/abs(x);\n x=abs(x);\n if(sl==1)\n ans=4*(x-1) + 1;\n else if(sl==-1)\n ans=4*(x-1) + 3;\n }\n else if(y>x)\n {\n sl=y/abs(y);\n y=abs(y);\n if(sl==1)\n ans=4*(y-1) + 2;\n else if(sl==-1)\n ans=4*(y-1) + 4;\n }\n printf(\"%d\\n\", ans);\n return 0;\n}"}, {"source_code": "#include \nint main()\n{\n int ans=-1, sl, x, y;\n scanf(\"%d %d\", &x, &y);\n if(x==0 && y==0 || x==1 && y==0)\n ans=0;\n else if(x==0)\n {\n sl=y/abs(y);\n y=abs(y);\n if(sl==1)\n ans=4*(y-1) + 2;\n else if(sl==-1)\n ans=4*(y-1) + 4;\n }\n else if(y==0)\n {\n sl=x/abs(x);\n x=abs(x);\n if(sl==1)\n ans=4*(x-1) + 1;\n else if(sl==-1)\n ans=4*(x-1) + 3;\n }\n else if(abs(x)==abs(y))\n {\n if(x>0 && y>0)\n ans=4*(x-1)+1;\n if(x<0 && y>0)\n ans=4*(y-1)+2;\n if(x<0 && y<0)\n ans=4*(abs(x)-1)+3;\n }\n else if(y<0 && x==abs(y)+1)\n {\n //printf(\"Entering here\\n\");\n ans=4*(x-1) + 4;\n }\n else if(abs(x)>abs(y))\n {\n sl=x/abs(x);\n x=abs(x);\n if(sl==1)\n ans=4*(x-1) + 1;\n else if(sl==-1)\n ans=4*(x-1) + 3;\n }\n else if(abs(y)>abs(x))\n {\n sl=y/abs(y);\n y=abs(y);\n if(sl==1)\n ans=4*(y-1) + 2;\n else if(sl==-1)\n ans=4*(y-1) + 4;\n }\n printf(\"%d\\n\", ans);\n return 0;\n}"}, {"source_code": "#include \nint main()\n{\n int ans=-1, sl, x, y;\n scanf(\"%d %d\", &x, &y);\n if(x==0 && y==0 || x==1 && y==0)\n ans=0;\n else if(x==0)\n {\n sl=y/abs(y);\n y=abs(y);\n if(sl==1)\n ans=4*(y-1) + 2;\n else if(sl==-1)\n ans=4*(y-1) + 4;\n }\n else if(y==0)\n {\n sl=x/abs(x);\n x=abs(x);\n if(sl==1)\n ans=4*(x-1) + 1;\n else if(sl==-1)\n ans=4*(x-1) + 3;\n }\n else if(abs(x)==abs(y))\n {\n if(x>0 && y>0)\n ans=4*(x-1)+1;\n if(x<0 && y>0)\n ans=4*(y-1)+2;\n if(x<0 && y<0)\n ans=4*(abs(x)-1)+3;\n if(x>0 && y<0)\n ans=4*(x-1) + 4;\n }\n else if(abs(x)>abs(y))\n {\n sl=x/abs(x);\n x=abs(x);\n if(sl==1)\n ans=4*(x-1) + 1;\n else if(sl==-1)\n ans=4*(x-1) + 3;\n }\n else if(abs(y)>abs(x))\n {\n sl=y/abs(y);\n y=abs(y);\n if(sl==1)\n ans=4*(y-1) + 2;\n else if(sl==-1)\n ans=4*(y-1) + 4;\n }\n printf(\"%d\\n\", ans);\n return 0;\n}"}, {"source_code": "#include \nint main()\n{\n int ans=-1, sl, x, y;\n scanf(\"%d %d\", &x, &y);\n if(x==0 && y==0 || x==1 && y==0)\n ans=0;\n else if(x==0)\n {\n sl=y/abs(y);\n y=abs(y);\n if(sl==1)\n ans=4*(y-1) + 2;\n else if(sl==-1)\n ans=4*(y-1) + 4;\n }\n else if(y==0)\n {\n sl=x/abs(x);\n x=abs(x);\n if(sl==1)\n ans=4*(x-1) + 1;\n else if(sl==-1)\n ans=4*(x-1) + 3;\n }\n else if(abs(x)>=abs(y))\n {\n sl=x/abs(x);\n x=abs(x);\n if(sl==1)\n ans=4*(x-1) + 1;\n else if(sl==-1)\n ans=4*(x-1) + 3;\n }\n else if(abs(y)>abs(x))\n {\n sl=y/abs(y);\n y=abs(y);\n if(sl==1)\n ans=4*(y-1) + 2;\n else if(sl==-1)\n ans=4*(y-1) + 4;\n }\n printf(\"%d\\n\", ans);\n return 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\nint a=0,b=0,s1=0,x,y;\nscanf(\"%d %d\",&x,&y);\nif(x==1&&x==0&&y==0)\nprintf(\"0\");\nelse\n{if(abs(x)==abs(y)||(y<0&&x>0&&1-y==x)){a=x;b=y;}\nelse if(x>=0&&abs(x)>abs(y))\n{a=x;b=x;}\nelse if (x<=0&&abs(x)>abs(y))\n{a=x;b=x;}\nelse if (y>=0&&abs(y)>abs(x))\n{a=-y;b=y;}\nelse if(y<=0&&abs(y)>abs(x))\n{a=1-y;b=y;}\nif(a>0&&b>0)\ns1=(1+(a-1)*2)+(1+(b-1)*2);\nelse if(a>0&&b<0)\ns1=(1+(a-1)*2)+(abs(b)*2);\nelse if(a<0&&b>0)\ns1=(abs(a)*2)+(1+(b-1)*2);\nelse if(a<0&&b<0)\ns1=(abs(a)*2)+(abs(b)*2);\nprintf(\"%d\",s1-1);}\nreturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\nint a=0,b=0,s1=0,x,y;\nscanf(\"%d %d\",&x,&y);\nif((x==1||x==0)&&y==0)\nprintf(\"0\");\nelse\n{if(abs(x)==abs(y)||(y<0&&x>0&&1-y==x)){a=x;b=y;}\nelse if(x>=0&&abs(x)>abs(y))\n{a=x;b=x;}\nelse if (x<=0&&abs(x)>abs(y))\n{a=x;b=x;}\nelse if (y>=0&&abs(y)>abs(x))\n{a=-y;b=y;}\nelse if(y<=0&&abs(y)>abs(x))\n{a=1-y;b=y;}\nif(a>0&&b>0)\ns1=(1+(a-1)*2)+(1+(b-1)*2);\nelse if(a>0&&b<0)\ns1=(1+(a-1)*2)+(abs(b)*2);\nelse if(a<0&&b>0)\ns1=(abs(a)*2)+(1+(b-1)*2);\nelse if(a<0&&b<0)\ns1=(abs(a)*2)+(abs(b)*2);\nprintf(\"%d\",s1-1);}\nreturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\nint a=0,b=0,s1=0,x,y;\nscanf(\"%d %d\",&x,&y);\nif(x<=1&&y==0)\nprintf(\"0\");\nelse\n{if(abs(x)==abs(y)||(y<0&&x>0&&1-y==x)){a=x;b=y;}\nelse if(x>=0&&abs(x)>abs(y))\n{a=x;b=x;}\nelse if (x<=0&&abs(x)>abs(y))\n{a=x;b=x;}\nelse if (y>=0&&abs(y)>abs(x))\n{a=-y;b=y;}\nelse if(y<=0&&abs(y)>abs(x))\n{a=1-y;b=y;}\nif(a>0&&b>0)\ns1=(1+(a-1)*2)+(1+(b-1)*2);\nelse if(a>0&&b<0)\ns1=(1+(a-1)*2)+(abs(b)*2);\nelse if(a<0&&b>0)\ns1=(abs(a)*2)+(1+(b-1)*2);\nelse if(a<0&&b<0)\ns1=(abs(a)*2)+(abs(b)*2);\nprintf(\"%d\",s1-1);}\nreturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int x,y,ans=0;\n scanf(\"%d %d\",&x,&y);\n if((x==0||x==1)&&y==0)\n { printf(\"0\");\n \n return 0;\n }\n if(abs(x)>abs(y)||(x==y))\n {\n if(x>0)\n {\n ans=4*(x-1)+1;\n }\n else if(x<0)\n ans=(-1)*x*4-1 ;\n } \n else if(abs(y)>abs(x)||(x==(-1)*y)) \n {\n if(y>0)\n {\n ans=4*(y-1)+2;\n }\n \n \n else if(y<0)\n ans=(-1)*y*4;\n }\n printf(\"%d\",ans);\n return 0;\n }\n \n"}, {"source_code": "#include\n#include\nint main()\n{\n int x,y,ans=0;\n scanf(\"%d %d\",&x,&y);\n if((x==0||x==1)&&y==0)\n { printf(\"0\");\n return 0;\n }\n if(abs(x)>abs(y)||(x==y))\n {\n if(x>0)\n {\n ans=4*(x-1)+1;\n }\n else if(x<0)\n ans=(-1)*x*4-1 ;\n } \n else if(abs(y)>abs(x)||(x==(-1)*y)) \n {\n if(y>0)\n {\n ans=4*(y-1)+2;\n }\n \n \n else if(y<0)\n ans=(-1)*y*4-2;\n }\n printf(\"%d\",ans);\n return 0;\n }\n \n"}, {"source_code": "#include\n#include\nint main()\n{\n int x,y,ans=0;\n scanf(\"%d %d\",&x,&y);\n if(x==0&&y==0)\n { printf(\"0\");\n return 0;\n }\n if(abs(x)>abs(y)||(x==y))\n {\n if(x>0)\n {\n ans=4*(x-1)+1;\n }\n else if(x<0)\n ans=(-1)*x*4-1 ;\n } \n else if(abs(y)>abs(x)||(x==(-1)*y)) \n {\n if(y>0)\n {\n ans=4*(y-1)+2;\n }\n \n \n else if(y<0)\n ans=(-1)*y*4-2;\n }\n printf(\"%d\",ans);\n return 0;\n }\n \n"}, {"source_code": "#include\n#include\nint main()\n{\n\tint x,y;\n\tscanf(\"%d %d\",&x,&y);\n\tif(x==0 && y==0)\n\t{\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\tif(x==y)\n\t{\n\t\tif(x>0)\n\t\t{\n\t\t\tprintf(\"%d\",4*x-3);\n\t\t\treturn 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"%d\",4*abs(x)-1);\n\t\t\treturn 0;\n\t\t}\n\t}\n\telse if(x==-1*y)\n\t{\n\t\tprintf(\"%d\",4*y-2);\n\t\treturn 0;\n\t}\n\telse if(y==1-x && x>0)\n\t{\n\t\tprintf(\"%d\",4*x-4);\n\t\treturn 0;\n\t}\n\tif(abs(x)0)\n\t\t{\n\t\t\tprintf(\"%d\",(4*y)-2);\n\t\t\treturn 0;\n\t\t}\n\t\telse if(y<0)\n\t\t{\n\t\t\tprintf(\"%d\",4*abs(y));\n\t\t\treturn 0;\n\t\t}\n\t}\n\tif(abs(x)>abs(y))\n\t{\n\t\tif(x>0)\n\t\t{\n\t\t\tprintf(\"%d\",(4*x)-3);\n\t\t\treturn 0;\n\t\t}\n\t\telse if(x<0)\n\t\t{\n\t\t\tprintf(\"%d\",(4*abs(x))-1);\n\t\t\treturn 0;\n\t\t}\n\t}\n\tif((abs(x)==abs(y))&&(x>0)&&(y<0))\n\t{\n\t\tprintf(\"%d\",4*x);\n\t\treturn 0;\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n\tint x,y;\n\tscanf(\"%d %d\",&x,&y);\n\tif(x==0 && y==0)\n\t{\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\tif(x==y)\n\t{\n\t\tif(x>0)\n\t\t{\n\t\t\tprintf(\"%d\",4*x-3);\n\t\t\treturn 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"%d\",4*abs(x)-1);\n\t\t\treturn 0;\n\t\t}\n\t}\n\telse if(x==-1*y)\n\t{\n\t\tprintf(\"%d\",4*y-2);\n\t\treturn 0;\n\t}\n\telse if(y==1-x && x>0)\n\t{\n\t\tprintf(\"%d\",4*x-4);\n\t\treturn 0;\n\t}\n\tif(abs(x)0)\n\t\t{\n\t\t\tprintf(\"%d\",(4*y)-2);\n\t\t\treturn 0;\n\t\t}\n\t\telse if(y<0)\n\t\t{\n\t\t\tprintf(\"%d\",4*abs(y));\n\t\t\treturn 0;\n\t\t}\n\t}\n\tif(abs(x)>abs(y))\n\t{\n\t\tif(x>0)\n\t\t{\n\t\t\tprintf(\"%d\",(4*x)-3);\n\t\t\treturn 0;\n\t\t}\n\t\telse if(x<0)\n\t\t{\n\t\t\tprintf(\"%d\",(4*abs(x))-1);\n\t\t\treturn 0;\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n\tint x,y;\n\tscanf(\"%d %d\",&x,&y);\n\tif(x==0 && y==0)\n\t{\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\tif(x==y)\n\t{\n\t\tif(x>0)\n\t\t{\n\t\t\tprintf(\"%d\",4*x-3);\n\t\t\treturn 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"%d\",4*abs(x)-1);\n\t\t\treturn 0;\n\t\t}\n\t}\n\telse if(x==-1*y)\n\t{\n\t\tprintf(\"%d\",4*y-2);\n\t\treturn 0;\n\t}\n\telse if(y==1-x && x>0)\n\t{\n\t\tprintf(\"%d\",4*x-4);\n\t\treturn 0;\n\t}\n\tif(abs(x)0)\n\t\t{\n\t\t\tprintf(\"%d\",(4*y)-2);\n\t\t\treturn 0;\n\t\t}\n\t\telse if(y<0)\n\t\t{\n\t\t\tprintf(\"%d\",4*abs(y));\n\t\t\treturn 0;\n\t\t}\n\t}\n\tif(abs(x)>abs(y))\n\t{\n\t\tif(x>0)\n\t\t{\n\t\t\tprintf(\"%d\",(4*x)-3);\n\t\t\treturn 0;\n\t\t}\n\t\telse if(x<0)\n\t\t{\n\t\t\tprintf(\"%d\",(4*abs(x))-3);\n\t\t\treturn 0;\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n\tint x,y;\n\tscanf(\"%d %d\",&x,&y);\n\tif(x==0 && y==0)\n\t{\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\tif(x==y)\n\t{\n\t\tif(x>0)\n\t\t{\n\t\t\tprintf(\"%d\",4*x-3);\n\t\t\treturn 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"%d\",4*abs(x)-1);\n\t\t\treturn 0;\n\t\t}\n\t}\n\telse if(x==-y)\n\t{\n\t\tprintf(\"%d\",4*y-2);\n\t\treturn 0;\n\t}\n\telse\n\t{\n\t\tprintf(\"%d\",4*x-4);\n\t\treturn 0;\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n\n#define ABS(A) (A > 0 ? A : -A)\n\nint main() {\n\tint x, y, max;\n\n\tscanf(\"%d%d\", &x, &y);\n\tmax = ABS(x) > ABS(y) ? ABS(x) : ABS(y);\n\tif (max == 0)\n\t\tprintf(\"0\\n\");\n\telse if (x == max && y == 0)\n\t\tprintf(\"%d\\n\", 4 * (max - 1));\n\telse if (x == max && y > 0 && y <= max)\n\t\tprintf(\"%d\\n\", 1 + 4 * (max - 1));\n\telse if (x >= -max && x < max && y == max)\n\t\tprintf(\"%d\\n\", 2 + 4 * (max - 1));\n\telse if (x == -max && y >= -max && y < max)\n\t\tprintf(\"%d\\n\", 3 + 4 * (max - 1));\n\telse if (x > -max && x <= max && y == -max)\n\t\tprintf(\"%d\\n\", 4 * max);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\n#define ABS(A) (A > 0 ? A : -A)\n\nint main() {\n\tint x, y, max;\n\n\tscanf(\"%d%d\", &x, &y);\n\tmax = ABS(x) > ABS(y) ? ABS(x) : ABS(y);\n\tif (max == 0)\n\t\tprintf(\"0\\n\");\n\telse if (x == max && y == 0)\n\t\tprintf(\"%d\\n\", 4 * (max - 1));\n\telse if (x == max && y > 0 && y <= max)\n\t\tprintf(\"%d\\n\", 1 + 4 * (max - 1));\n\telse if (x >= -max && x < max && y == max)\n\t\tprintf(\"%d\\n\", 2 + 4 * (max - 1));\n\telse if (x == -max && y >= -max && y < max)\n\t\tprintf(\"%d\\n\", 3 + 4 * (max - 1));\n\telse if (x > -max && x <= max && y == -max + 1)\n\t\tprintf(\"%d\\n\", 4 * (max - 1));\n\telse\n\t\tprintf(\"%d\\n\", 4 * max);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\n#define ABS(A) (A > 0 ? A : -A)\n\nint main() {\n\tint x, y, max;\n\n\tscanf(\"%d%d\", &x, &y);\n\tmax = ABS(x) > ABS(y) ? ABS(x) : ABS(y);\n\tif (max == 0)\n\t\tprintf(\"0\\n\");\n\telse if (x > 0 && y > 0)\n\t\tprintf(\"%d\\n\", 1 + 4 * (max - 1));\n\telse if (x < max && y == max)\n\t\tprintf(\"%d\\n\", 2 + 4 * (max - 1));\n\telse if (x < 0 && y < max)\n\t\tprintf(\"%d\\n\", 3 + 4 * (max - 1));\n\telse if (x >= 0 && y <= 0)\n\t\tprintf(\"%d\\n\", 4 * (max - 1));\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int a,b,c,i,j,k,m,st,m2,var,tm;\n\n scanf(\"%d%d\",&a,&b);\n\n i = 0;\n j = 0;\n c = -1;\n k = 0;\n m = 4;\n m2 = 3;\n var = 1;\n st =0;\n //ab = abs(a);\n //ab1 = abs(b);\n if(a == 0 )\n {\n if(b != 0)\n {\n if(b > 0)\n {\n a = -b;\n }\n else\n {\n a = b;\n c++;\n }\n }\n }\n else if(b == 0 )\n {\n if(a != 0 )\n {\n b = a;\n }\n }\n else if(a > 0)\n {\n if(b != 0 && a != b)\n {\n tm = a - 1;\n tm = -tm;\n if(tm != b)\n {\n if(b < 0)\n {\n a = abs(b)+1;\n b = a - 1;\n b = -b;\n }\n if(b > 0)\n {\n a = -b;\n }\n }\n }\n }\n else\n {\n if(b != abs(a) && a != b)\n {\n if(b > 0)\n {\n a = -b;\n }\n else\n {\n a = b;\n c++;\n }\n }\n }\n while( i != a || j != b)\n {\n k++;\n j = st;\n if(k >= m2)\n {\n i = -var;\n if(k == m2+1)\n m2 = m2 + 4;\n }\n else if(k >= m)\n {\n var++;\n i = var;\n m = m+4;\n }\n else\n {\n i = var;\n }\n st = i;\n c++;\n }\n if(a == 0 && b== 0)\n c = 0;\n printf(\"%d\",c);\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int a,b,c,i,j,k,m,st,m2,var,tm;\n\n scanf(\"%d%d\",&a,&b);\n\n i = 0;\n j = 0;\n c = -1;\n k = 0;\n m = 4;\n m2 = 3;\n var = 1;\n st =0;\n //ab = abs(a);\n //ab1 = abs(b);\n if(a == 0 )\n {\n if(b != 0)\n {\n if(b > 0)\n {\n a = -b;\n }\n else\n {\n a = b;\n c++;\n }\n }\n }\n else if(b == 0 )\n {\n if(a != 0 && a != 1)\n {\n b = a;\n }\n }\n else if(a > 0)\n {\n if(b != 0 && a != b)\n {\n tm = a - 1;\n tm = -tm;\n if(tm != b)\n {\n if(b < 0)\n {\n a = abs(b)+1;\n b = a - 1;\n b = -b;\n }\n if(b > 0)\n {\n a = -b;\n }\n }\n }\n }\n else\n {\n if(b != abs(a) && a != b)\n {\n if(b > 0)\n {\n a = -b;\n }\n else\n {\n a = b;\n c++;\n }\n }\n }\n while( i != a || j != b)\n {\n k++;\n j = st;\n if(k >= m2)\n {\n i = -var;\n if(k == m2+1)\n m2 = m2 + 4;\n }\n else if(k >= m)\n {\n var++;\n i = var;\n m = m+4;\n }\n else\n {\n i = var;\n }\n st = i;\n c++;\n }\n if(a == 0 && b== 0)\n c = 0;\n printf(\"%d\",c);\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int a,b,c,i,j,k,m,st,m2,var,tm,ab,ab1;\n\n scanf(\"%d%d\",&a,&b);\n\n i = 0;\n j = 0;\n c = -1;\n k = 0;\n m = 4;\n m2 = 3;\n var = 1;\n st =0;\n ab = abs(a);\n ab1 = abs(b);\n if(a == 0 )\n {\n if(b != 0)\n {\n if(b > 0)\n {\n a = -b;\n }\n else\n {\n a = b;\n c++;\n }\n }\n }\n else if(b == 0 )\n {\n if(a != 0 && a != 1)\n {\n b = a;\n }\n }\n else if(a > 0)\n {\n if(b != 0 && a != b)\n {\n tm = a - 1;\n tm = -tm;\n if(tm != b)\n {\n if(b < 0 && ab1 > a)\n {\n a = ab1+1;\n b = a - 1;\n b = -b;\n }\n else if(b > 0 && a < b)\n {\n a = -b;\n }\n else\n {\n b = a;\n }\n }\n }\n }\n else\n {\n if(b != ab && a != b)\n {\n if(b > 0 && ab < b)\n {\n a = -b;\n }\n else if(b < 0 && ab1 > ab)\n {\n a = b;\n c++;\n }\n else\n {\n b = a;\n }\n }\n }\n while( i != a || j != b)\n {\n k++;\n j = st;\n if(k >= m2)\n {\n i = -var;\n if(k == m2+1)\n m2 = m2 + 4;\n }\n else if(k >= m)\n {\n var++;\n i = var;\n m = m+4;\n }\n else\n {\n i = var;\n }\n st = i;\n c++;\n }\n if(a == 0 && b== 0)\n c = 0;\n printf(\"%d\",c);\n\n return 0;\n}\n"}], "src_uid": "2fb2a129e01efc03cfc3ad91dac88382"} {"nl": {"description": "Ted has a pineapple. This pineapple is able to bark like a bulldog! At time t (in seconds) it barks for the first time. Then every s seconds after it, it barks twice with 1 second interval. Thus it barks at times t, t + s, t + s + 1, t + 2s, t + 2s + 1, etc. Barney woke up in the morning and wants to eat the pineapple, but he can't eat it when it's barking. Barney plans to eat it at time x (in seconds), so he asked you to tell him if it's gonna bark at that time.", "input_spec": "The first and only line of input contains three integers t, s and x (0 ≤ t, x ≤ 109, 2 ≤ s ≤ 109) — the time the pineapple barks for the first time, the pineapple barking interval, and the time Barney wants to eat the pineapple respectively.", "output_spec": "Print a single \"YES\" (without quotes) if the pineapple will bark at time x or a single \"NO\" (without quotes) otherwise in the only line of output.", "sample_inputs": ["3 10 4", "3 10 3", "3 8 51", "3 8 52"], "sample_outputs": ["NO", "YES", "YES", "YES"], "notes": "NoteIn the first and the second sample cases pineapple will bark at moments 3, 13, 14, ..., so it won't bark at the moment 4 and will bark at the moment 3.In the third and fourth sample cases pineapple will bark at moments 3, 11, 12, 19, 20, 27, 28, 35, 36, 43, 44, 51, 52, 59, ..., so it will bark at both moments 51 and 52."}, "positive_code": [{"source_code": "#include \nint main(){\n int t,s,x;\n scanf(\"%i%i%i\",&t,&s,&x);\n if( ((x-t)%s==0 || (x-t-1)%s==0) && x!=t+1 && x>=t)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0-0-0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n int t,s,x;\n scanf(\"%d%d%d\",&t,&s,&x);\n if(x=s)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n }\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint t, s, k, x;\n\tscanf(\"%d %d %d\", &t, &s, &x);\n\tif(x==t)\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse if(x\n\nint main()\t{\n\tint t,s,x;\n\tscanf(\"%d%d%d\",&t,&s,&x);\n\tif(x=s){\n\t\t\tx%=s;\n\t\t\tif(x==0 || x==1)\tputs(\"YES\");\n\t\t\telse\tputs(\"NO\");\n\t\t}\n\t\telse\tputs(\"NO\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int t=0,s=0,x=0,n=0,b=0;\n scanf(\"%d%d\",&t,&s);\n scanf(\"%d\",&x);\n if(t>x){\n printf(\"NO\");\n return 0 ;\n }\n n=(x-t);\n int z = (x-t)-1;\n if(n%s==0||z%s==0)\n b=1;\n if(z==0)\n b=0;\n\n\n if(b==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n\nmain()\n{\n long int t,s,x,a,b,c;\n\n scanf(\"%ld %ld %ld\",&t,&s,&x);\n\n if(x==t)\n {\n printf(\"YES\\n\");\n }\n\n else if(x\n#include\nint main()\n{\n\tint t,x,s,i=0;\n\tscanf(\"%d%d%d\",&t,&s,&x);\n\twhile(t<=x)\n\t{\n\t\tif(x==t+1 && i)\n\t\t{\n\t\t\tprintf(\"YES\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\tif(x==t)\n\t\t{\n\t\t\tprintf(\"YES\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\ti++;\n\t\tt+=s;\n\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int t,s,x;\n scanf(\"%d %d %d\",&t,&s,&x);\n if((x >= t && x % s == t % s)||(x > t + 1 && x % s == (t + 1) % s)){\n printf(\"YES\\n\");\n }\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \nint main(){\n \n char INPUT[1000];\n char FINAL[4]= \"\";\n int s;\n int TIME;\n int TOTAL;\n \n fgets(INPUT, sizeof(INPUT), stdin);\n sscanf(INPUT, \"%d %d %d\", &TOTAL, &s, &TIME );\n\n if(TIME == TOTAL + s || TIME == TOTAL){\n TOTAL = TIME;\n goto end;\n }\n TOTAL = TOTAL + s;\n \n while (TIME > TOTAL){\n TOTAL++;\n \n if (TOTAL == TIME) {\n break;\n }\n TOTAL = TOTAL + s - 1;\n \n if (TOTAL == TIME) {\n\t break;\n }\n \n }\n end: { if (TOTAL == TIME){\n strncpy(FINAL,\"YES\", 3);\n }\n else {\n strncpy(FINAL,\"NO\", 2);\n }\n fputs(FINAL, stdout);\n return 0;\n }\n}\n"}, {"source_code": "#include\nint main()\n{ int t,s,x,i,d,e;\nscanf(\"%d %d %d\",&t,&s,&x);\nfor(i=0;;i++)\n{\nd=t+i*s;\ne=t+((i+1)*s)+1;\nif(d==x ||e==x)\n{ printf(\"YES\");\n break;\n}\nif(d>x)\n{ printf(\"NO\");\n break;\n}\n\nd=0;\ne=0;}\t\nreturn 0;\n}\n"}, {"source_code": "#include \n//#include \nint main(void)\n{\n\tint t= 0; //time of first barking\n\tint s= 0; //barking interval\n\tint x= 0; //time of eating\n\tscanf(\"%d\", &t);\n\tscanf(\"%d\", &s);\n\tscanf(\"%d\", &x);\n\n\tif(x < t)\tprintf(\"NO\\n\");\n\telse if( (x-t)%s == 0 )\tprintf(\"YES\\n\");\n\telse if( x == (t+1) )\tprintf(\"NO\\n\");\n\telse if( (x-t-1)%s == 0 )\tprintf(\"YES\\n\");\n\telse\tprintf(\"NO\\n\");\n\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tlong long int t,s,x,a;\n\tscanf(\"%I64d %I64d %I64d\",&t,&s,&x);\n\tif(x>=t)\n\t{\n\t\ta=x-t;\n\t if(((a%s==0) || ((a-1)%s==0)) && (a-1)!=0)\n\t printf(\"YES\");\n\t else\n\t printf(\"NO\");\n\t}\n\telse\n\tprintf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint t,s,x,flag=0,i;\n\tscanf(\"%d %d %d\",&t,&s,&x);\n\tif(t==x)\n\t\tflag=1;\n\telse\n\t\tfor(i=1;;i++)\n\t\t{\n\t\t\tif(t+i*s==x || t+i*s+1==x)\n\t\t\t\tflag=1;\n\t\t\telse if(t+i*s>x || t+i*s+1>x)\n\t\t\t\tbreak;\n\t\t}\n\tif(flag==1)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include\nlong long int x[100001];\nvoid quicksort(int first,int last){\n long long int pivot,j,temp,i;\n\n if(firstx[pivot])\n j--;\n if(i0)))&&(x-t>=0))\n {\n printf(\"YES\\n\");\n\n }\n else\n {\n printf(\"NO\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nunsigned long int s, t, x;\n\nchar series (void)\n{\n\tunsigned long int res=t;\n\tif (res == x)return 1;\n\tif (res > x) return 0;\n\tfor (unsigned long int i = 1; i <= 1000000000; i++)\n\t{\n\t\tres = t + i * s;\n\t\tif (res == x)return 1;\n\t\tif (res > x) return 0;\n\t\tres++;\n\t\tif (res == x)return 1;\n\t\tif (res > x) return 0;\n\t}\n\t\n}\nint main()\n{\n\tscanf(\"%d%d%d\", &t, &s, &x);\n\tif (series()) printf(\"YES\");\n\tif (!series()) printf(\"NO\");\n\t//getch();\n\treturn 0;\t\n}"}, {"source_code": "#include\nint main()\n{\n\tint t,s,x;\n\tscanf(\"%d%d%d\",&t,&s,&x);\n\tif ((x-t>=0)&&(((x-t)% s == 0)||(((x-t-1)% s==0)&&(x-t-1>0)))) printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int t,s,x;\n scanf(\"%d%d%d\",&t,&s,&x);\n if (x==t+1||x\nint main ()\n{\n int t, s,x, sum=0, extra,c;\n scanf(\"%d %d %d\", &t, &s, &x);\n if (t==x)\n printf(\"YES\\n\");\n else\n {\n c=(x-t)%s;\n if((c==1 || c==0) && x-t>1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nunsigned long int s, t, x;\n\nchar series (void)\n{\n\tunsigned long int res=t;\n\tif (res == x)return 1;\n\tif (res > x) return 0;\n\tfor (unsigned long int i = 1; i <= 1000000000; i++)\n\t{\n\t\tres = t + i * s;\n\t\tif (res == x)return 1;\n\t\tif (res > x) return 0;\n\t\tres++;\n\t\tif (res == x)return 1;\n\t\tif (res > x) return 0;\n\t}\n\t\n}\nint main()\n{\n\tscanf(\"%d%d%d\", &t, &s, &x);\n\tif (series()) printf(\"YES\");\n\tif (!series()) printf(\"NO\");\n\treturn 0;\t\n}"}, {"source_code": "#include\nint main()\n{\n long t,s,x,m,i=0;\n scanf(\"%ld %ld %ld\",&t,&s,&x);\n m=t;\n while(m=x)\n break;\n else\n m=t+(i*s)+1;\n }\n if(m==x)\n {\n printf(\"YES\");\n }\n else if(m>x)\n {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main()\n{\n\tlong int t, s, x;\n\tscanf(\"%ld%ld%ld\", &t, &s, &x);\n\t\n\tif(t==x)\n\t\tprintf(\"YES\\n\");\n\t\n\telse\n\t{\n\t\n\t\tfor(t = t+s; t<=x; t=t+s)\n\t\t{\n\t\t\tif( x == t )\n\t\t\t{\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\texit(0);\n\t\t\t}\n\t\t\telse if( x == t+1 )\n\t\t\t{\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\texit(0);\n\t\t\t}\n\t\t}\n\t\n\t\tprintf(\"NO\\n\");\n\t}\nreturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int t , s , x , sum , mod , div , diff,mod1,mod2;\n scanf(\"%d %d %d\",&t,&s,&x);\n sum=(t+s);\n if((x>=t||x<=t)&&(x<=sum)){\n\n if(x==t)\n {\n printf(\"YES\\n\");\n }\n else if(x==sum)\n {\n printf(\"YES\\n\");\n }\n else {\n printf(\"NO\\n\");\n }\n }\n else if(x>sum)\n {\n mod=sum%s;\n sum+=1;\n mod1=sum%s;\n mod2=x%s;\n if(mod2==mod1||mod2==mod)\n {\n printf(\"YES\\n\");\n }\n else{\n printf(\"NO\\n\");\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tlong long int t,s,x,a;\n\tscanf(\"%I64d %I64d %I64d\",&t,&s,&x);\n\tif(x>=t)\n\t{\n\t\ta=x-t;\n\t if(((a%s==0) || ((a-1)%s==0)) && (a-1)!=0)\n\t printf(\"YES\");\n\t else\n\t printf(\"NO\");\n\t}\n\telse\n\tprintf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include \n\n\nint main()\n{ long int t,s,x,i,j,temp,flag=0;\n scanf(\"%u%u%u\",&t,&s,&x);\n for(i=0;i<=x;i++)\n {\n temp=(s*i)+t;\n if(temp==x)\n {\n printf(\"YES\");\n flag=1;\n break;\n }\n temp=temp+1;\n if(i>0)\n\n {if(temp==x)\n {\n printf(\"YES\");\n flag=1;\n break;\n }}\n temp=temp-1;\n\n\n\n }\n if(flag==0)\n {\n printf(\"NO\");\n }\n}\n\n"}, {"source_code": " #include \nint main()\n{\n\tint s,t,x,d,i;\n\tscanf(\"%d%d%d\",&s,&t,&x);\n\tif(s==x)\n\t{\n\tprintf(\"YES\\n\");\n\treturn 0;\n\t}\n\tfor(i=1; ;i++)\n\t{\n\t\ts=s+t;\n\t\td=s+1;\n\t\tif(d>=x)\n\t\tbreak;\n}\nif(s==x || d==x){\nprintf(\"YES\\n\");\n }\nelse{\nprintf(\"NO\\n\");\n }\nreturn 0;\n}\n\t"}, {"source_code": "#include \n#include \n#include \nint main(){\n \n char INPUT[1000];\n char FINAL[4]= \"\";\n int s;\n int TIME;\n int TOTAL;\n \n fgets(INPUT, sizeof(INPUT), stdin);\n sscanf(INPUT, \"%d %d %d\", &TOTAL, &s, &TIME );\n\n if(TIME == TOTAL + s || TIME == TOTAL){\n TOTAL = TIME;\n goto end;\n }\n TOTAL = TOTAL + s;\n \n while (TIME > TOTAL){\n TOTAL++;\n \n if (TOTAL == TIME) {\n break;\n }\n TOTAL = TOTAL + s - 1;\n \n if (TOTAL == TIME) {\n\t break;\n }\n \n }\n end: { if (TOTAL == TIME){\n strncpy(FINAL,\"YES\", 3);\n }\n else {\n strncpy(FINAL,\"NO\", 2);\n }\n fputs(FINAL, stdout);\n return 0;\n }\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int x,t,s;\n scanf(\"%lld%lld%lld\",&t,&s,&x);\n x=x-t;\n if(x>=0)\n {\n if(x%s==0||x%s==1&&x!=1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main()\n{\n\tlong int t, s, x;\n\tscanf(\"%ld%ld%ld\", &t, &s, &x);\n\t\n\tif(t==x)\n\t\tprintf(\"YES\\n\");\n\t\n\telse\n\t{\n\t\n\t\tfor(t = t+s; t<=x; t=t+s)\n\t\t{\n\t\t\tif( x == t )\n\t\t\t{\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\texit(0);\n\t\t\t}\n\t\t\telse if( x == t+1 )\n\t\t\t{\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\texit(0);\n\t\t\t}\n\t\t}\n\t\n\t\tprintf(\"NO\\n\");\n\t}\nreturn 0;\n}"}, {"source_code": "#include\nint main()\n{ long int t,s,x,y,z;\n\tscanf(\"%ld%ld%ld\",&t,&s,&x);\n\n\ty=t;\n\tif(x==t){\n\t\tprintf(\"yes\");\n\t\treturn 0;}\n\twhile(x>=y){\n\t\ty=y+s;\n\t\tz=y+1;\n\t\tif(x==y||x==z){\n\t\t\tprintf(\"yes\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"no\");\n\treturn 0;\n}\n\n"}, {"source_code": "#include \n#include\nint main()\n{\n long long int t,s,x,a,b,c,i,j;\n scanf(\"%lld %lld %lld\",&t,&s,&x);\n a=t+s;\n b=a%s;\n c=(a+1)%s;\n i=x%s;\n if(x>a)\n {\n if(i==b || i==c)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n }\n else\n {\n if (t==x || (t+s)==x)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n }\n return 0;\n}\n "}, {"source_code": "#include\nint t,s,x;\nint main()\n{\n scanf(\"%d%d%d\",&t,&s,&x);\n if(x\nint main()\n{\n long t,s,x,m,i=0;\n scanf(\"%ld %ld %ld\",&t,&s,&x);\n m=t;\n while(m=x)\n break;\n else\n m=t+(i*s)+1;\n }\n if(m==x)\n {\n printf(\"YES\");\n }\n else if(m>x)\n {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n long x, y, z;\n scanf(\"%d %d %d\", &x, &y, &z), z-=x;\n if(z==0 || ((z%y==0 || z%y==1) && z>1))printf(\"YES\");\n else printf(\"NO\");\n}"}, {"source_code": "#include \n#include\nint main()\n{\n long long int t,s,x,a,b,c,i,j;\n scanf(\"%lld %lld %lld\",&t,&s,&x);\n a=t+s;\n b=a%s;\n c=(a+1)%s;\n i=x%s;\n if(x>a)\n {\n if(i==b || i==c)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n }\n else\n {\n if (t==x || (t+s)==x)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n }\n return 0;\n}\n "}, {"source_code": "main()\n{\n long long i,j,k,l,t,s,x,n;\n scanf(\"%lld %lld %lld\",&t,&s,&x);\n j=0;\n if(t==x)\n printf(\"YES\");\n else\n {\n t=t+s;\n if(x>=t)\n {\n\n n=(x-t+s)/s;\n if(t+(n-1)*s==x)\n {\n j=1;\n printf(\"YES\\n\");\n }\n n=(x-1-t+s)/s;\n if(t+(n-1)*s==(x-1))\n {\n j=1;\n printf(\"YES\\n\");\n }\n if(j==0)\n printf(\"NO\\n\");\n }\n else\n printf(\"NO\\n\");\n }\n}\n"}, {"source_code": "#include \nint main()\n{\n long long s,x,t;\n scanf(\"%lld%lld%lld\", &t,&s,&x);\n if(x\nint main() {\n int t,s,x;\n scanf(\"%d%d%d\",&t,&s,&x);\n //1.t\n //2.t+s\n //3.t+s+1\n //4.t+s+s\n //5.t+s+s+1\n //6.t+s+s+s\n //7.t+s+s+s+1\n //两个方法一个是直接查找\n //一个是数学计算\n //t+y*s=x\n //t+y*s+1=x\n double y1=(x-t)/(1.0*s);\n double y2=(x-t-1)/(1.0*s);\n //printf(\"%f %f\\n\",y1,y2);\n int find=0;\n if(y1==(int)y1 && y1>=0){\n find=1;\n }else if(y2==(int)y2 && y2>0){\n find=1;\n }\n if(find){\n printf(\"YES\\n\");\n }else{\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nunsigned char c(unsigned int t,unsigned int s,unsigned int x);\n\nint main() {\n\tunsigned int t;\n\tunsigned int x;\n\tunsigned int s;\n\tscanf(\"%d %d %d\",&t,&s,&x);\n\tint i;\n\t//for(i=0;i<100;i++) {\n\t//printf(\"%d \",i);\n\tif(c(t,s,x)) {\n\t\tprintf(\"YES\");\n\t} else {\n\t\tprintf(\"NO\");\t\t\n\t}\n\t//\tprintf(\"\\n\");\n\t//}\n\treturn 0;\n}\n\nunsigned char c(unsigned int t,unsigned int s,unsigned int x) {\n\tif((x-t)%s==0 && x>=t) {\n\t\treturn 1;\n\t} else {\n\t\tif ((x-t-1)%s==0 && x>t+1) {\n\t\t\treturn 1;\n\t\t} else {\n\t\t\treturn 0;\n\t\t}\n\t}\n}"}, {"source_code": "#include \n//#include \nint main(void)\n{\n\tlong long int t= 0; //time of first barking\n\tlong long int s= 0; //barking interval\n\tlong long int x= 0; //time of eating\n\tscanf(\"%lld\", &t);\n\tscanf(\"%lld\", &s);\n\tscanf(\"%lld\", &x);\n\n\tif(x < t)\tprintf(\"NO\\n\");\n\telse if( (x-t)%s == 0 )\tprintf(\"YES\\n\");\n\telse if( x == (t+1) )\tprintf(\"NO\\n\");\n\telse if( (x-t-1)%s == 0 )\tprintf(\"YES\\n\");\n\telse\tprintf(\"NO\\n\");\n\n\treturn 0;\n}"}, {"source_code": "# include \n\nint main(){\n\tint t,s,x;\n\tscanf(\"%d %d %d\",&t,&s,&x);\n\tint diff = (x-t)%s;\n\tint quo = (x-t)/s;\n\tif(quo>=1){\n\t\tif(diff==0 || diff==1 ){\n\t\t\tprintf(\"YES\\n\");\n\t\t}else{\n\t\t\tprintf(\"NO\\n\");\n\t\t}\n\t}\n\telse{\n\t\tif(x==t){\n\t\t\tprintf(\"YES\\n\");\n\t\t}else{\n\t\t\tprintf(\"NO\\n\");\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n\tlong t, s, x;\n\n\tscanf(\"%ld %ld %ld\", &t, &s, &x);\n\n\tx -= t;\n\tt = 0;\n\n\tif (((x % s == 1) && (x / s > 0)) || ((x % s == 0) && (x / s >= 0)))\n\t\tputs(\"YES\");\n\telse\n\t\tputs(\"NO\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tlong long int t,s,x;\n\tscanf(\"%lld %lld %lld\",&t,&s,&x);\n\t//x-t or x-(t+1) should be multiple of s\n\tif(x1))\n\tprintf(\"YES\\n\");\n\telse\n\tprintf(\"NO\\n\");\n}\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main ()\n{\n int t,x,s;\n scanf(\"%d %d %d\",&t,&s,&x);\n if(x\n\nmain()\n\n{\n double t,s,x,result,result2;\n long long p,q;\n\n scanf(\"%lf %lf %lf\",&t,&s,&x);\n result=(x-t)/s;\n p=(int)(result);\n result2=(x-t-1)/s;\n q=(int)(result2);\n if(t==x) printf(\"YES\\n\");\n else if(t>x) printf(\"NO\\n\");\n else if(t==(x-1)) {printf(\"NO\\n\");}\n else if(p==result || q==result2)\n {\n printf(\"YES\\n\");\n }\n else{printf(\"NO\\n\");}\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\t{\n\tint t,s,x;\n\tscanf(\"%d%d%d\",&t,&s,&x);\n\tif(x=s){\n\t\t\tx%=s;\n\t\t\tif(x==0 || x==1)\tputs(\"YES\");\n\t\t\telse\tputs(\"NO\");\n\t\t}\n\t\telse\tputs(\"NO\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint canEat(int x, int t, int s) {\n if (x < t) return 0;\n if (x == t + 1) return 0;\n if (x % s == t % s) return 1;\n if ((x - t - 1) % s == 0) return 1;\n}\n\nint main() {\n long int t, s, x;\n scanf(\"%ld %ld %ld\", &t, &s, &x);\n canEat(x, t, s) ? printf(\"YES\\n\") : printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main(){\n int n,s,x,i;\n scanf(\"%d%d%d\",&n,&s,&x);\n if(n==x){\n printf(\"YES\");}\n else {\n\n if((x-n)%s==0&&x>n)\n printf (\"YES\");\n else {\n\n if((x-n-1)%s==0&&(x>n)&&x>=(n+s)) printf(\"YES\");\n else printf(\"NO\");\n }\n\n }\n }\n"}, {"source_code": "#include\nint main()\n{\n\tint t,s,x;\n\tscanf(\"%d %d %d\",&t,&s,&x);\n\tif((x-t)==1||(x-t)<0)\n\t{\n\t\tprintf(\"NO\");\n\t\treturn 0;\n\t}\n\tif((x-t)%s==0||(x-t-1)%s==0)\n\tprintf(\"YES\");\n\telse\n\tprintf(\"NO\");\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n\tlong long int t,flag=0,i,s,x;\n\tscanf(\"%lld%lld%lld\",&t,&s,&x);\n\tif(x==t)\n\t\tflag=1;\n\tfor(i=t+s;i<=x;i+=s)\n\t{\n//\t\tprintf(\"%lld \",y);\n\t\tif(x==i || x==i+1)\n\t\t{\n\t\t\tflag=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(flag==1)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include \n#include\n#include\n#include\n#include\nint main() {\n\tlong t, s, x; scanf(\"%ld%ld%ld\", &t, &s, &x);\n\tlong ys = x - t;\n\tif (ys >= 0) {\n\t\tlong y = ys % s;\n\t\tif (y == 0) {\n\t\t\tputs(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\n\t}\n\tys = x - t - 1;\n\tif (ys >= 0) {\n\t\tlong y = ys / s;\n\t\tif (y >= 1&& ys%s==0)\n\t\t\tputs(\"Yes\");\n\t\telse\n\t\t{\n\t\t\tputs(\"NO\");\n\t\t}\n\t}\n\telse\n\t\tputs(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n long long t,s,k,flag=1,gabbar=1,p;\n scanf(\"%I64d%I64d%I64d\",&t,&s,&k);\n p=k-t-1;\n if((k-t)%s==0&&k>=t){printf(\"YES\\n\");gabbar=0;}\n else if((k-t-1)%s==0&&((k-t)%s==0&&k>=t)){printf(\"YES\\n\");flag=0;gabbar=0;}\n\n\n else if((p)%s==0&&(flag)&&p!=0&&k>=t)printf(\"YES\\n\");\n else if(gabbar) printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n\n\n\nint main() {\n \n long int t,s,x;\n scanf(\"%ld %ld %ld\",&t,&s,&x);\n if(x==t+1){\n printf(\"NO\");\n \n \n }\n else{\n long int temp=(x-t)%s;\n long int te1=(x-t-1)%s;\n if(x==t)\n printf(\"YES\");\n else if((x-t)>=s && temp==0 )\n printf(\"YES\");\n else if((x-t)>=s && temp==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n \n \n \n \n \n \n \n \n \n \n \n}\n"}, {"source_code": "#include\n#include\nunsigned long int s, t, x;\n\nchar series (void)\n{\n\tunsigned long int res=t;\n\tif (res == x)return 1;\n\tif (res > x) return 0;\n\tfor (unsigned long int i = 1; i <= 1000000000; i++)\n\t{\n\t\tres = t + i * s;\n\t\tif (res == x)return 1;\n\t\tif (res > x) return 0;\n\t\tres++;\n\t\tif (res == x)return 1;\n\t\tif (res > x) return 0;\n\t}\n\t\n}\nint main()\n{\n\tscanf(\"%d%d%d\", &t, &s, &x);\n\tif (series()) printf(\"YES\");\n\tif (!series()) printf(\"NO\");\n\treturn 0;\t\n}"}, {"source_code": "#include\nint main()\n{\n int t,s,x;\n scanf(\"%d %d %d\",&t,&s,&x);\n if(x>t+1)\n {\n if((x-t)%s==0||(x-t-1)%s==0)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n }\n else\n {\n if(x==t)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n long long s,x,t;\n scanf(\"%lld%lld%lld\", &t,&s,&x);\n if(x\n#include \n#include \n#include \n#include \n#define forn(i,n) for (i = 0; i= b || c == 0)) \n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include\nvoid main()\n{\tint t,s,x,i,J,k;\n\tJ= 1;\n\ti = 1;\n\tscanf(\"%d %d %d\",&t,&s,&x);\n\tk = t;\n\twhile(k < x)\n\t{ \tk = t + s*J;\n\t\tif(i%2 !=0 && i!=1) \n\t\t{\tJ++;\n\t\t\tk++;\n\t\t}\n\t\ti++;\n\t}\n\tif(k == x)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\t\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int x,t,s;\n scanf(\"%lld%lld%lld\",&t,&s,&x);\n x=x-t;\n if(x>=0)\n {\n if(x%s==0||x%s==1&&x!=1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include \nint main() \n{\n int t,s,x;\n scanf(\"%d%d%d\",&t,&s,&x); \n int tmp=x-t;\n if ((tmp%s==0||tmp%s==1)&&tmp>=0&&tmp!=1) \n printf(\"YES\");\n else\n printf(\"NO\");\n}"}, {"source_code": "#include\nmain()\n{\n long long int t,s,x,i;\n int flag=0;\n scanf(\"%lld\",&t);\n scanf(\"%lld\",&s);\n scanf(\"%lld\",&x);\n i=t;\n while(i<=x)\n {\n /*printf(\"%Ld\",x);\n printf(\"%Ld\",t);*/\n if(x==t)\n {\n printf(\"YES\");\n flag=1;\n break;\n }\n i+=s;\n if((x==i || x==(i+1)))\n {\n printf(\"YES\");\n flag=1;\n break;\n }\n }\n if(flag==0)\n printf(\"NO\");\n}\n"}, {"source_code": "#include \n//#include \nint main(void)\n{\n\tlong long int t= 0; //time of first barking\n\tlong long int s= 0; //barking interval\n\tlong long int x= 0; //time of eating\n\tscanf(\"%lld\", &t);\n\tscanf(\"%lld\", &s);\n\tscanf(\"%lld\", &x);\n\n\tif(x < t)\tprintf(\"NO\\n\");\n\telse if( (x-t)%s == 0 )\tprintf(\"YES\\n\");\n\telse if( x == (t+1) )\tprintf(\"NO\\n\");\n\telse if( (x-t-1)%s == 0 )\tprintf(\"YES\\n\");\n\telse\tprintf(\"NO\\n\");\n\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n long x, y, z;\n scanf(\"%d %d %d\", &x, &y, &z), z-=x;\n if(z==0 || ((z%y==0 || z%y==1) && z>1))printf(\"YES\");\n else printf(\"NO\");\n}"}, {"source_code": "#include \n\nint main() {\n long t, s, x;\n scanf(\"%I32d %I32d %I32d\\n\", &t, &s, &x);\n x -= t;\n if (x < 0 || x == 1 || ((x - 1) % s && x % s))\n printf(\"NO\");\n else\n printf(\"YES\");\n}\n"}, {"source_code": "#include\nint main() {\n\tint t, s, x; scanf(\"%d%d%d\", &t, &s, &x);\n\tif (x < t) { printf(\"NO\"); return 0; }\n\tif ((!((x - t) % s) || !((x - t - 1) % s)) && x != t + 1) printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int i,j,k,l,t,s,x,m;\n scanf(\"%d %d %d\",&t,&s,&x);\n if(x<=t+1)\n {\n if(x==t)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n }\n else\n {\n if((x-t)%s==0||(x-t-1)%s==0)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n }\n\n\n}\n"}, {"source_code": "#include\nint main()\n{\nint t,s,x;\nwhile(scanf(\"%d %d %d\",&t,&s,&x)!=EOF)\n{\n if(x\nint main()\n{\n int m,k,l,i,flag=0;\n scanf(\"%d %d %d\",&k,&l,&m);\n \n \n \n \n for(i=1;m>=k+(i-1)*l;i++)\n {\n if(m==k || m==k+i*l || m==k+i*l+1)\n \n flag=1;\n }\n \n if(flag==0)\n printf(\"NO\\n\");\n\n else\n printf(\"YES\\n\");\n \n\n return 0;\n}\n \n \n \n"}, {"source_code": "#include\n\nint main()\n{\n\tint t,s,x;\n\tscanf(\"%d %d %d\",&t,&s,&x);\n\t\n\tif(x==t && x>=t)\n\t{\n\t\tprintf(\"YES\");\n\t\treturn 0;\n\t}\n\tif((x-t)%s==0 && x>=(t+s))\n\t{\n\t\tprintf(\"YES\");\n\t\treturn 0;\n\t}\n\tif((x-t-1)%s==0 && x>=(t+s+1))\n\t{\n\t\tprintf(\"YES\");\n\t\treturn 0;\n\t}\n\tprintf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n int t,s,x;\n scanf(\"%d %d %d\",&t,&s,&x);\n if(x>t+1)\n {\n if((x-t)%s==0||(x-t-1)%s==0)\n {\n printf(\"YES\\n\");\n }\n else\n printf(\"NO\\n\");\n }\n else\n {\n if(x==t)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\nchar ch[20];\n\nint main(void)\n{\n\tlong long int s1,s2;\n\tlong long int t,s,x,i,j;\n\tscanf(\"%I64d %I64d %I64d\",&t,&s,&x);\n\tif(x==t) {\n\t\tprintf(\"YES\");\n\t\treturn 0;\n\t}\n\tfor(i=1,j=1; ;i+=2,j++) {\n\t\ts1=t+j*s;\n\t\ts2=s1+1;\n\t\tif(s1==x || s2==x) {\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\t\tif(s2>x) {\n\t\t\tprintf(\"NO\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\t\n\treturn 0;\n}"}, {"source_code": "main()\n{\n long long i,j,k,l,t,s,x,n;\n scanf(\"%lld %lld %lld\",&t,&s,&x);\n j=0;\n if(t==x)\n printf(\"YES\");\n else\n {\n t=t+s;\n if(x>=t)\n {\n\n n=(x-t+s)/s;\n if(t+(n-1)*s==x)\n {\n j=1;\n printf(\"YES\\n\");\n }\n n=(x-1-t+s)/s;\n if(t+(n-1)*s==(x-1))\n {\n j=1;\n printf(\"YES\\n\");\n }\n if(j==0)\n printf(\"NO\\n\");\n }\n else\n printf(\"NO\\n\");\n }\n}\n"}, {"source_code": "#include \n\nint main ()\n{\n int t, s, x, n;\n scanf (\"%d %d %d\", &t, &s, &x);\n\n n = (x - t) / s;\n if (n == 0) n = 1;\n\n if (x < t) printf(\"NO\");\n else if (x == t) printf(\"YES\");\n else if (x < t + s * n) printf(\"NO\");\n else if (x == t + s * n) printf(\"YES\");\n else if (x == t + s * n + 1) printf(\"YES\");\n else printf(\"NO\");\n\n return 0;\n}\n// 1470168150868"}, {"source_code": "#include \nint main()\n{\n\tint t, s, x;\n\tint flag = 0;\n\tscanf(\"%d%d%d\", &t, &s, &x);\n\tif ((x - t) % s == 0 && x>=t) flag = 1;\n\tif ((x - t - 1) % s == 0 && x > t + 1) flag = 1;\n\tif (flag == 1) printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n\tint t, s, x;\n\n\tscanf(\"%d\", &t);\n\tscanf(\"%d\", &s);\n\tscanf(\"%d\", &x);\n\n\tif (x == t || (x >= t + s && (x % s == t % s || x % s == (t + 1) % s )))\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\n\treturn 0;\n}\n\n// 1470169088949"}, {"source_code": "#include\n\nint main(void)\n{\n\tlong long int t,s,x;\n\tscanf(\"%I64d %I64d %I64d\",&t,&s,&x);\n\tif(x\nint main()\n{\n\tint t,s,x,r;\n\tscanf(\"%d%d%d\",&t,&s,&x);\n\tr=s+1;\n\tif(x==t)\n\tprintf(\"YES\");\n\telse\n\t{\n\tif(xt&&x=t||x>=r)\n\t\t{\n\t\t\tt+=s;\n\t\t\tr=t+1;\n\t\t\tif(x==t||x==r)\n\t\t\t{\n\t\t\t\tprintf(\"YES\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(x\n\nint main(){\n\tint t,x,s;\n\tscanf(\"%d %d %d\", &t, &s, &x);\n\tif (x >= t && (\n\t\t((x-1-t)%s == 0 && x != t+1)\n\t\t|| (x-t)%s == 0)){\n\t\tputs(\"YES\");\n\t} else {\n\t\tputs(\"NO\");\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main(void)\n{\n long t, s, x;\n\tscanf(\"%ld%ld%ld\", &t, &s,&x);\n \n int is = 0;\n \n if (x == t) is = 1;\n else if (x > t+1)\n is = (x-t)%s == 0 || (x-t)%s == 1;\n\n puts(is ? \"YES\" : \"NO\");\n\n\treturn 0;\n}\n "}, {"source_code": "#include \n\nint main()\n{\n long long int t, s, x, quotient, i, p;\n scanf(\"%I64d %I64d %I64d\", &t, &s, &x);\n\n if(s > x){\n if(t == x)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n else{\n for(i=1; ; i++){\n p = t + i * s;\n if(p == x || (p + 1) == x){\n printf(\"YES\");\n break;\n }\n else if(p > x){\n printf(\"NO\");\n break;\n }\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include \n#include\n#include\n#include\n#include\nint main() {\n\tlong t, s, x; scanf(\"%ld%ld%ld\", &t, &s, &x);\n\tlong ys = x - t;\n\tif (ys >= 0) {\n\t\tlong y = ys % s;\n\t\tif (y == 0) {\n\t\t\tputs(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\n\t}\n\tys = x - t - 1;\n\tif (ys >= 0) {\n\t\tlong y = ys / s;\n\t\tif (y >= 1&& ys%s==0)\n\t\t\tputs(\"Yes\");\n\t\telse\n\t\t{\n\t\t\tputs(\"NO\");\n\t\t}\n\t}\n\telse\n\t\tputs(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n long long int t,s,x,a;\n scanf(\"%lld%lld%lld\",&t,&s,&x);\n if(t>x){\n printf(\"NO\\n\");\n }\n else if(t==x){\n printf(\"YES\\n\");\n }\n else if(x==t+1){\n printf(\"NO\\n\");\n }\n else {\n a=x-t;\n if(a%s==0||a%s==1){\n printf(\"YES\\n\");\n }\n else {\n printf(\"NO\\n\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n\tint t,s,x,l;\n\tscanf(\"%d %d %d\",&t,&s,&x);\n\tl=t;\n\twhile (l <= x) {\n\t\tif (t == x) {\n\t\t\tprintf(\"YES\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\telse if (t+s == x) {\n\t\t\tprintf(\"YES\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\telse if (t+s+1 == x) {\n\t\t\tprintf(\"YES\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\telse t = t+s;\n\t\t\t\n\t\tl+=s;\n\t}\n\t\n\tprintf(\"NO\\n\");\n\t\n\treturn 0;\n}\n\n// 1470168683505"}, {"source_code": "#include \n\nint canEat(int x, int t, int s) {\n if (x < t) return 0;\n if (x == t + 1) return 0;\n if (x % s == t % s) return 1;\n if ((x - t - 1) % s == 0) return 1;\n}\n\nint main() {\n long int t, s, x;\n scanf(\"%ld %ld %ld\", &t, &s, &x);\n canEat(x, t, s) ? printf(\"YES\\n\") : printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int t,s,x;\n scanf(\"%d %d %d\",&t,&s,&x);\n if(x>t+1)\n {\n if((x-t)%s==0||(x-t-1)%s==0)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n }\n else\n {\n if(x==t)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n }\n return 0;\n}\n"}, {"source_code": " #include \n #include \n #include \n #include \n #include \n #include \n #include \n #define lli long long int\n #define li long int \n \n\n int main()\n {\n \n #ifndef ONLINE_JUDGE\n freopen(\"input.txt\", \"r\", stdin);\n freopen(\"output.txt\", \"w\", stdout);\n #endif\n long int t,s,x;\n scanf(\"%ld%ld%ld\",&t,&s,&x);\n if(x-t<0)\n {\n printf(\"NO\"); return 0;\n }\n if(((x-t)%s==0||(x-t-1)%s==0)&&(x!=t+1))\n printf(\"YES\\n\");\n else \n printf(\"NO\\n\");\n return 0;\n } "}, {"source_code": "#include \n\nint main(int argc, char ** argv){\n\tint t,s,x;\n\tscanf(\"%d %d %d\",&t,&s,&x);\n\tint start=t;\n\tif(start==x){\n\t\tprintf(\"%s\", \"YES\");\n\t\treturn 0;\n\t}\n\twhile(startx){\n\t\tprintf(\"%s\",\"NO\");\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{ \n\tint a,b,c,i,f=0; \n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tif(c>b)\n\t{\tfor(i=1;i<=c/b&&f==0;i++)\n\t\tif(c==(a+i*b)||c==(a+i*b+1)||c==a)\n\t\t\tf=1;\n\t}\n\telse \n\t\tfor(i=1;i\nint main()\n{\n long long int t,s,x;\n scanf(\"%I64d %I64d %I64d\",&t,&s,&x);\n printf(\"%s\\n\",((x-t==0) || ((t\n\nint main()\n{\n int a,b,c,s,t,x;\n\n scanf(\"%d %d %d\",&s,&t,&x);\n\n if (s-x==0)\n printf(\"YES\\n\");\n\n else if( x>=t && x>=s){\n a=x-s;\n if(a<0)\n a=-a;\n if(a%t==0 && (a/t)!=0)\n printf(\"YES\");\n else if((a-1)%t==0 && ((a-1)/t)!=0)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n }\n else\n printf(\"NO\");\n\n\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,c,i;\n scanf(\"%d%d%d\",&a,&b,&c);\n if(a==c)\n {\n printf(\"YES\\n\");\n return 0;\n }\n for(i=a+b; i<=c; i+=b)\n if(i==c||i+1==c)\n {\n printf(\"YES\\n\");\n return 0;\n }\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include\nmain()\n{\n\tlong t, s, x;\n\tscanf(\"%ld%ld%ld\", &t, &s, &x);\n\tif (x==t || ((x-t)%s==0 && (x-t)>=s) || ((x-t-1)%s==0 && (x-t-1)>=s))\n\tprintf(\"YES\\n\");\n\telse\n\tprintf(\"NO\\n\");\n\treturn 0;\n}"}, {"source_code": "#include \nint main()\n{\n long long int t, i, x, total, n1, n2;\n scanf(\"%lld %lld %lld\", &t, &i, &x);\n\n\n n1 = t%i;\n n2 = (t+1)%i;\n\n if(x==t) printf(\"YES\");\n else if(x>t+1 && (x%i==n1 || x%i == n2)) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int t,s,x,r;//r-remainder\n scanf(\"%d%d%d\",&t,&s,&x);\n r=abs(x-t);\n if(t>x){\n printf(\"NO\\n\");\n }\n else if((r!=1&&r%s==1)||r%s==0){\n printf(\"YES\\n\");\n }\n else{\n printf(\"NO\\n\");\n }\n return 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\nint t,s,x;\nscanf(\"%d%d%d\",&t,&s,&x);\nif(x=(t+s)|x==t))\nprintf(\"YES\");\nelse\nprintf(\"NO\");\nreturn 0;\n}\n"}, {"source_code": "#include \nint main() {\n\tlong t, s, x;\n\n\tscanf(\"%d %d %d\", &t, &s, &x);\n\tif (t < x && x < t + s) {\n\t\tprintf(\"NO\");\n\t\treturn 0;\n\t}\n\tif (t == x) {\n\t\tprintf(\"YES\");\n\t\treturn 0;\n\t}\n\tif (t > x) {\n\t\tprintf(\"NO\");\n\t\treturn 0;\n\t}\n\twhile (t <= x) {\n\t\tt += s;\n\t}\n\tt -= s;\n\tif (t == x || t + 1 == x) printf(\"YES\");\n\telse printf(\"NO\");\n\t\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int i,t,m,n,s;\n scanf(\"%d%d%d\",&m,&n,&s);\n t=m;\n\n\nif(m==s)\nprintf(\"YES\\n\");\nelse\n {\n\n\n for(i=1;;i++)\n {\n m=t+(n*i);\n\n if(m>=s || (m+1)==s)\n break;\n\n\n }\n if(m==s||(m+1)==s)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n\n\n\n }\n\n\nreturn 0;\n\n\n}\n\n"}, {"source_code": "#include \nint main()\n{\n long long int t, i, x, total, n1, n2;\n scanf(\"%lld %lld %lld\", &t, &i, &x);\n\n\n n1 = t%i;\n n2 = (t+1)%i;\n\n if(x==t) printf(\"YES\");\n else if(x>t+1 && (x%i==n1 || x%i == n2)) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n long long t,s,x;\n scanf(\"%lld %lld %lld\",&t,&s,&x);\n\n\n if (((x==t+1)&&(s!=1))||(t>x))\n printf(\"NO\");\n else\n if (((x-t)%s==0)||((x-t)%s==1))\n printf(\"YES\");\n else\n printf(\"NO\");\n\n\n}\n"}, {"source_code": " #include \nint main()\n{\n\tint s,t,x,d,i;\n\tscanf(\"%d%d%d\",&s,&t,&x);\n\tif(s==x)\n\t{\n\tprintf(\"YES\\n\");\n\treturn 0;\n\t}\n\tfor(i=1; ;i++)\n\t{\n\t\ts=s+t;\n\t\td=s+1;\n\t\tif(d>=x)\n\t\tbreak;\n}\nif(s==x || d==x){\nprintf(\"YES\\n\");\n }\nelse{\nprintf(\"NO\\n\");\n }\nreturn 0;\n}\n\t"}], "negative_code": [{"source_code": "#include\nmain()\n{\n long long int t,s,x;\n scanf(\"%lld %lld %lld\",&t, &s, &x);\n if((t<=x && (x%s)==(t%s)) || ((2*t+1<=x) && (x%s)==((t+1)%s))) printf(\"YES\");\n else printf(\"NO\");\n}\n"}, {"source_code": "#include\n\nmain()\n{\n int t=0,s=0,x=0;\n scanf(\"%d %d %d\",&t,&s,&x);\n int i=x,j;\n for(j=0;j\n #include \n #include \n #include \n #include \n #include \n #include \n #define lli long long int\n #define li long int \n \n\n int main()\n {\n \n #ifndef ONLINE_JUDGE\n freopen(\"input.txt\", \"r\", stdin);\n freopen(\"output.txt\", \"w\", stdout);\n #endif\n long int t,s,x;\n scanf(\"%ld%ld%ld\",&t,&s,&x);\n if((x-t)>0&&(t+s\nint main()\n{\n\tint t,s,x,i,flag=0;\n\tscanf(\"%d%d%d\",&t,&s,&x);\n\tfor(i=1;i<600000000;i++)\n\t\tif(x==t+i*s||x==t+i*s+1||x==t)\n\t\t\tflag=1;\n\t\tif(flag==1) printf(\"YES\\n\");\n\t\telse printf(\"NO\\n\");\n\t\treturn 0;\n}\n"}, {"source_code": "\n#include \n#include \n\n\nint main()\n{\n\n int t,s,x ;\n scanf(\"%d%d%d\",&t,&s,&x);\n if ((x-t)%s==0 && (x-t)!=0 )\n {\n printf(\"yes %d\",(x-t)%s);\n }\n else if((x-t-1)%s==0 )\n {\n printf(\"YES\");\n }\nelse printf(\"NO\");\n return 0 ;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long t,s,i,x,a,c=0,b;\n scanf(\"%I64d%I64d%I64d\",&t,&s,&x);\n for(i=0;i\nint main()\n{\n\tlong long int t,s,x;\n\tscanf(\"%lld %lld %lld\",&t,&s,&x);\n\t//x-t or x-(t+1) should be multiple of s\n\t\n\tif((x-t)%s==0 || ((x-t-1)%s==0 && (x-t)>1))\n\tprintf(\"YES\\n\");\n\telse\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int t,s,x,p,q,i;\n scanf(\"%d %d %d\",&t,&s,&x);\n if(xt)\n {\n p=t;\n\n for(i=1; i<=10000; i++)\n {\n p=p+s;\n q=p+1;\n if(p==x || q==x)\n {\n printf(\"YES\");\n break;\n }\n else if(p>x && q>x)\n {\n printf(\"NO\");\n break;\n }\n }\n }\n}\n"}, {"source_code": "#include \nint main() {\n int s,t,x;\n scanf(\"%d%d%d\",&t,&s,&x);\n printf(\"%s\\n\",x==t+1||(x-t)%s>=2?\"NO\":\"YES\");\n return 0;\n}"}, {"source_code": "//gcc 5.4.0\n\n#include \n\nint main(void)\n{\n long t,s,x;\n scanf(\"%ld\",&t);\n scanf(\"%ld\",&s);\n scanf(\"%ld\",&x);\n if(x==t+1){\n printf(\"NO\");\n return 0;\n }\n if(((x-t)%s)==0||((x-t)%s==1)){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include \n\nint main(int argc, const char * argv[]) {\n int t,s;\n int x;\n scanf(\"%d %d %d\",&t,&s,&x);\n if(x==t){\n printf(\"YES\");\n }\n else if(x>=(t+s)){\n if((x-t)%s==0||(x-t-1)%s==0)\n printf(\"YES\");\n }\n else\n printf(\"NO\");\n}"}, {"source_code": "#define _CRT_SECURE_NO_DEPRECATE\n#include \n\n#define mprint(x) printf(\"%d\\n\",x)\n\n//#define DEBUG\n#define LOOP_START\n#define LOOP_END\n\n#ifdef DEBUG\n#undef LOOP_START\n#undef LOOP_END\n#define LOOP_START while(1){\n#define LOOP_END }\n//#define UNLOCK // \n#endif\n\n\n\nint main(){\n\tint t, s, x;\n\tLOOP_START\n\tscanf(\"%d %d %d\", &t, &s, &x);\n\t//mprint(t);\n\t//mprint(s);\n\t//mprint(x);\n\t//printf(\"----------------\\n\");\n\tx = x - t;\n\t#ifdef DEBUG\n\t\tmprint(x);\n\t\tmprint(x % s);\n\t\tmprint(-3 % 2);\n\t\tmprint(-9295072 % 2);\n\t#endif\t\t\n\tif ( ( x>-1 && (x-1)>-1) && (x % s == 0 || ((x - 1)>0 && (x - 1) % s == 0) || x == 0))\n\t\tprintf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\tLOOP_END\n\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n#include \nint main(){\n \n char INPUT[1000];\n char FINAL[4]= \"\";\n int s;\n int TIME;\n int TOTAL;\n \n fgets(INPUT, sizeof(INPUT), stdin);\n sscanf(INPUT, \"%d %d %d\", &TOTAL, &s, &TIME );\n \n while (TIME > TOTAL){\n TOTAL = TOTAL + s - 1;\n if (TOTAL == TIME) {\n\t break;\n }\n TOTAL++;\n if (TOTAL == TIME) {\n break;\n }\n }\n if (TOTAL == TIME){\n strncpy(FINAL,\"YES\", 3);\n }\n else {\n strncpy(FINAL,\"NO\", 2);\n }\n fputs(FINAL, stdout);\n return 0; \n}\n"}, {"source_code": "#define _CRT_SECURE_NO_DEPRECATE\n#include \n#define mprint(x) printf(\"%d\\n\",x)\n\n\tint main(){\n\t\tint t, s, x;\n\t\t//while (1){\n\t\t\tscanf(\"%d %d %d\", &t, &s, &x);\n\t\t\t//mprint(t);\n\t\t\t//mprint(s);\n\t\t\t//mprint(x);\n\t\t\t//printf(\"----------------\\n\");\n\t\t\tx = x - t;\n\t\t\t//mprint(x);\n\t\t\t//mprint(x % s);\n\t\t\t//mprint(3 / 2);\n\t\t\t\n\t\t\tif (x % s == 0 || (x - 1) % s == 0 || x==0)\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\telse printf(\"NO\\n\");\n\n\t\t//}\n\n\n\t\treturn 0;\n\t}"}, {"source_code": "#include\n#include\nint main()\n{\n\t long int t,s,x,p;\n\t scanf(\"%ld%ld%ld\",&t,&s,&x);\n\t if(xt+s)\n \t{\n \t\tp=x-t;\n \t\tif(p%s==0)\n \t\t{\n \t\tprintf(\"YES\");\n \t\treturn 0;\n \t\t}\n \t\telse if((p-1)%s==0)\n \t\t{\n \t\t\tprintf(\"YES\");\n \t\t}else printf(\"NO\");\n \t}\n\t\n\t\n}"}, {"source_code": "#include\nmain()\n{\n\tint t,s,x,i,j;\n\tscanf(\"%d%d%d\",&t,&s,&x);\n\tif(t+1==x)\n\t{\n\t\tprintf(\"NO\");return 0;\n\t}\n\tif(x\nint main()\n{\n\tint t, s, x;\n\tint flag = 0;\n\tscanf(\"%d%d%d\", &t, &s, &x);\n\tif ((x - t) % s == 0) flag = 1;\n\tif ((x - t - 1) % s == 0 && x != t + 1) flag = 1;\n\tif (flag == 1) printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main(void) {\n\t// your code goes here\n\tint t,s,k;\n\tscanf(\"%d%d%d\",&t,&s,&k);\n\tif(k<(s+t)&&k>t)\n{\n printf(\"NO\\n\");return 0;\n}\n\tint rem=(k-t)%s;\n\tif(rem==0||rem==1||k==t)\n\tprintf(\"YES\\n\");\n\telse\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\nlong long int t,s,x;\nscanf(\"%lld%lld%lld\",&t,&s,&x);\nif((x-t)%s==0)\nprintf(\"YES\");\nelse if((x-t-1)%s==0)\n{\nif((x-t-1)/s)\nprintf(\"YES\");\nelse \nprintf(\"NO\");\n}\nelse\nprintf(\"NO\");\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\nint t,s,x;\nwhile(scanf(\"%d %d %d\",&t,&s,&x)!=EOF)\n{\n if(x==t+1) printf(\"NO\\n\");\n else if((x-t)%s==0||(x-1-t)%s==0)\n printf(\"YES\\n\");\n else printf(\"NO\\n\");\n\n\n}\n\treturn 0;\n}\n"}, {"source_code": "#include \nint main(){\n int t,s,x;\n scanf(\"%i%i%i\",&t,&s,&x);\n if( ((x-t)%s==0 || (x-t-1)%s==0) && x>t+1)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0-0-0;\n}"}, {"source_code": "#include \nint main(){\n int t,s,x;\n scanf(\"%d %d %d\",&t,&s,&x);\n x=x-t;\n if(x%s==0)\n printf(\"YES\");\n else if(x!=1 && (x-1)%s==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int t,s,x,r;\n scanf(\"%d%d%d\",&t,&s,&x);\n r=x-t;\n if(r%s==1||r%s==0){\n printf(\"YES\\n\");\n }\n else{\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n\tint t,s,x,z;\n\tscanf(\"%d %d %d\",&t,&s,&x);\n\tint d=(x-t)/s;\n\td=d*2;\n\twhile(d>0){\n\t\t\n\t\tif(d==1)\n\t\t\tz=t+(d)*s;\n\t\telse if(d%2==0)\n\t\t\tz=t+(d/2)*s;\n\t\telse\n\t\t\tz=t+1+(d/2)*s;\n\t\tif(x==z)\n\t\t\t{printf(\"YES\");return 0;}\n\t\tif(x=s&x%s>1?\"NO\":\"YES\");}\n"}, {"source_code": "#include\nint main(){\n\n unsigned long long int t,s,x,sum=0,sum1=0,i;\n scanf(\"%llu %llu %llu\",&t,&s,&x);\n for(i=1;i<=x;i++){\n sum=t+i*s;\n sum1=t+i*s+1;\n if(t==x||sum==x||sum1==x){\n printf(\"YES\");\n break;\n }\n if(sum>x||sum1>x){\n printf(\"NO\");\n break;\n }\n }\n\nreturn 0;\n\n}"}, {"source_code": "#include\nint main()\n{\n long long i,j,k,n,t,s,x;\n scanf(\"%lld%lld%lld\",&t,&s,&x);\n /*n=(x/s)*s+(x%s);\n k=x/s;\n i=k*s+t;//printf(\"%d %d\",i,n);*/\n n=x-t;k=n/s;\n if(k!=0)\n {\n if(n%(s*k)==0||n%(s*k)==1)\n {\n printf(\"YES\");\n }\n else printf(\"NO\");\n }\n if(k==0&&n==0)printf(\"YES\");//return 0;}\n else if(k==0&&n!=0) printf(\"NO\");//return 0;}\n /* else if(i==n||i+1==n)\n printf(\"YES\");\n else\n printf(\"NO\");*/\n}\n//1000000 1000000 2000000\n"}, {"source_code": "#include \n#include \n#include \nint main()\n{\n long long t,s,x,i,a,b,c,d,j,k;double p,q;\n scanf(\"%I64d %I64d %I64d\",&t,&s,&x);\n if(t==x){printf(\"YES\");}\n else{\n a=fabs(x-t);b=fabs(a-1);\n p=a/s;q=b/s;\n c=p;d=q;\n j=c/p;k=d/q;\n if(j==1||k==1)\n {\n printf(\"YES\");\n }\n else{printf(\"NO\");}}\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\nint main()\n{\n int t,s,x;\n scanf(\"%d%d%d\",&t,&s,&x);\n if(x>t+1){\n if((x-t)%s==0||(x-t-1)%s==0)\n {\n printf(\"YES\");\n }\n else\n printf(\"NO\\n\");\n }\n else{\n if(x==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n//#include \nint main(void)\n{\n\tint t= 0; //time of first barking\n\tint s= 0; //barking interval\n\tint x= 0; //time of eating\n\tscanf(\"%d\", &t);\n\tscanf(\"%d\", &s);\n\tscanf(\"%d\", &x);\n\tint k=s;\n\n\tif(x == t) printf(\"YES\\n\");\n\telse\n\t{\n\t\tfor (int i = 0; i < 1000; ++i) //1000 is a randomly chosen value\n\t\t{\n\t\t\tif(x%(t+s) == 0 || x%(t+s+1) == 0)\n\t\t\t\t{printf(\"YES\\n\"); break;}\n\t\t\tif((t+s) > x)\n\t\t\t\t{printf(\"NO\\n\"); break;}\n\n\t\t\ts= s+k;\n\t\t}\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint t,s,x;\n\tscanf(\"%d %d %d\",&t,&s,&x);\n\tif(x\nint main()\n{\n long long t,s,i,x,a,c=0,b;\n scanf(\"%I64d%I64d%I64d\",&t,&s,&x);\n if(x<=3){\n for(i=0;i<=x;i++){\n a=t+(s*i);\n b=a+1;\n if(a==x||(b==x&&i!=0)){\n c=1;\n break;\n }\n else{\n c=0;\n }\n }\n }\n else if(x>3){\n for(i=0;i\nint main()\n{ \n\tint a,b,c,i,f=0; \n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tfor(i=1;i\nint main()\n{\n long long t,s,i,x,a,c=0,b;\n scanf(\"%I64d%I64d%I64d\",&t,&s,&x);\n if(x<=2){\n for(i=0;i<=x;i++){\n a=t+(s*i);\n b=a+1;\n if(a==x||(b==x&&i!=0)){\n c=1;\n break;\n }\n else{\n c=0;\n }\n }\n }\n else if(x>2){\n for(i=0;i\nint main(){\n long long int t,s,x,i,b;\n int f=0;\n scanf(\"%I64d %I64d %I64d\",&t,&s,&x);\n if(t==x)\n printf(\"YES\");\n else{\n b=(x-t);\n if(b%s==0 || (b-1)%s==0)\n f=1;\n /*for(i=1,b=t+s*i;b+1<=x || b<=x;i++){\n b=t+s*i;\n //printf(\"%d %d \" ,b ,b+1);\n if(x==b+1||x==b){\n f=1;\n }\n }*/\n if(f==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n}\n"}, {"source_code": "#include \nint main() {\n\tlong t, s, x;\n\n\tscanf(\"%d %d %d\", &t, &s, &x);\n\tif (t < x && x < t + s) {\n\t\tprintf(\"NO\");\n\t\treturn 0;\n\t}\n\tif (t == x) {\n\t\tprintf(\"YES\");\n\t\treturn 0;\n\t}\n\twhile (t <= x) {\n\t\tt += s;\n\t}\n\tt -= s;\n\tif (t == x || t + 1 == x) printf(\"YES\");\n\telse printf(\"NO\");\n\t\n\treturn 0;\n}"}, {"source_code": "#include\n#include\n\nchar ch[20];\n\nint main(void)\n{\n\tint a[105];\n\tint t,s,x,i,j;\n\tscanf(\"%d %d %d\",&t,&s,&x);\n\ta[0]=t;\n\tif(x==t) {\n\t\tprintf(\"YES\");\n\t\treturn 0;\n\t}\n\tfor(i=1,j=1;i<1000000001;i+=2,j++) {\n\t\ta[i]=t+j*s;\n\t\ta[i+1]=a[i]+1;\n\t\tif(a[i]==x || a[i+1]==x) {\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\t\tif(a[i]>x) {\n\t\t\tprintf(\"%d\",i);\n\t\t\tprintf(\"NO\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\t\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int a,s,d,p;\n while(scanf(\"%d%d%d\",&a,&s,&d)!=EOF)\n {\n p=(d-a)%s;\n\n if((p==0||(p==1&&d!=(a+1))&&a<=d))\nprintf(\"%Yes\\n\");\nelse printf(\"No\\n\");\n }\n}\n"}, {"source_code": "#include\nmain()\n{\n\tint t,s,x,i,j;\n\tscanf(\"%d%d%d\",&t,&s,&x);\n\tif(t+1==x)\n\t{\n\t\tprintf(\"NO\");return 0;\n\t}\n\tif(x\nint main()\n{\n\tlong long int t,s,x;\n\tscanf(\"%lld %lld %lld\",&t,&s,&x);\n\t//x-t or x-(t+1) should be multiple of s\n\t\n\tif((x-t)%s==0 || ((x-t-1)%s==0 && (x-t)>1) && x>t)\n\tprintf(\"YES\\n\");\n\telse\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n long int t, s, x;\n scanf(\"%ld %ld %ld\", &t, &s, &x);\n if (x % s == t % s || (x != t + 1 && (x - t - 1) % s == 0)) {\n printf(\"YES\\n\");\n } else {\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int t,s,x;\n scanf(\"%d%d%d\",&t,&s,&x);\n if(x>t){\n if((x-t)%s==0||(x-t-1)%s==0){\n printf(\"YES\\n\");\n }\n else printf(\"NO\\n\");\n }\n else{\n if(x==t) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n }\n return 0;\n}"}, {"source_code": "#include \"stdio.h\"\n\nint main()\n{\n\tint a,b,c;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tif((a==c||(c-a>=0&&(c-a)%b==0)||(c-a-1>=0&&(c-a-1)%b==0))&&a!=c+1)printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long i,j,k,n,t,s,x;\n scanf(\"%lld%lld%lld\",&t,&s,&x);\n n=(x/s)*s+(x%s);\n k=x/s;\n i=k*s+t;//printf(\"%d %d\",i,n);\n if(k==0&&n==i)printf(\"YES\");//return 0;}\n else if(k==0&&n!=i) printf(\"NO\");//return 0;}\n else if(i==n||i+1==n)\n printf(\"YES\");\n else\n printf(\"NO\");\n}\n"}, {"source_code": "#include\n#include\n#include\nint main()\n{\n\n long long a,b,c;\n scanf(\"%lld%lld%lld\",&a,&b,&c);\n if(a==c )\n {\n printf(\"YES\\n\");\n return 0;;\n }\n if(a==c-1){\n printf(\"NO\\n\");\n return 0;;\n }\n int f=c-a-1;\n int s=c-a;\n if (f%b==0 || s%b==0)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;;\n}\n"}, {"source_code": "#include\nmain()\n{\n long long int t,s,x;\n scanf(\"%I64d%I64d%I64d\",&t,&s,&x);\n x=x-t;\n if(x==0)\n printf(\"YES\");\n else if((x==1)&&(s!=1))\n printf(\"NO\");\n else if((x%s==0)||(x%s==1))\n printf(\"YES\");\n else printf(\"NO\");\n\n}\n"}, {"source_code": "#include\nint main()\n\n{\n long long int s,t,x,i,sum=0;\n\n\tscanf(\"%lld%lld%lld\",&t,&s,&x);\n\n/*\tfor(i=1;i<=100;i++)\n\t {\n if(x==t || x==t+i*s || x==t+i*s+1)\n { \n sum=sum+1;\n\t\tbreak;\n }\n }\n*/\n\tint y;\n\ty=(x-t)%s;\n//\tz=(x-t-1)%s;\n\tif(y==0 || y==1)\n\tprintf(\"YES\");\n\t\n\n\t//if(sum==1)\n\t//{printf(\"YES\");}\n\telse{printf(\"NO\");}\n\treturn 0;}\n"}, {"source_code": "#include \n#include \n#include \nint main()\n{\n long long t,s,x,i,a,b;\n scanf(\"%I64d %I64d %I64d\",&t,&s,&x);\n i=x/s;\n\n if(i==0){ a=t+s*i;b=a;}\n else{\n a=t+s*i;b=a+1;}\n\n\n if(x==a||x==b)\n {\n printf(\"YES\");\n }\n\n else{printf(\"NO\");}\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\n#include\n\nvoid main()\n{\nlong long t,s,x,a,n;\nscanf(\"%lld %lld %lld\",&t,&s,&x);\n\nif(t>=x)\n{\nprintf(\"NO\\n\");exit(0);}\n\nif(x==t){\nprintf(\"YES\\n\");exit(0);}\n\na=t+s;\n\nif((x-a)%s==0){\nprintf(\"YES\\n\");exit(0);}\n\nn=(x-a)/s+1;\n\n\nif(x==(a+(n-1)*s+1)){\nprintf(\"YES\\n\");\nexit(0);}\n\nprintf(\"NO\\n\");\nexit(0);\n}"}, {"source_code": "#include\n\nint main()\n{\n int t,s,x;\n scanf(\"%d %d %d\",&t,&s,&x);\n\n if(x==t || x%t==0) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n\n return 0;\n}\n\n\n"}, {"source_code": "#include \n\nint main(){\n long t,s,x;\n scanf(\"%d%d%d\",&t,&s,&x);\n x = x -t;\n if(x%s==0) printf(\"YES\");\n else if(x%s==1 && x/s!=0) printf(\"YES\");\n else printf(\"NO\");\n\n\n\n}\n"}, {"source_code": "#include\n\nint main()\n{\n\tlong t,s,x,p,q;\n\tscanf(\"%lu %lu %lu\",&t,&s,&x);\n\tp=(x-t)%s;\n\tq=(x-t-1)%s;\n\tif(x==t||p==0||q==0)\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t{\t\n\t\tprintf(\"NO\");\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main(void){\n\n int t,s,x;\n\n scanf(\"%d %d %d\", &t, &s, &x);\n\n if(t==x){\n printf(\"YES\\n\");\n return 0;\n }\n\n if(t+1==x){\n printf(\"NO\\n\");\n return 0;\n }\n\n int remainder=x-t;\n\n if(remainder%s==0 || remainder%s==1){\n printf(\"YES\\n\");\n return 0;\n }\n\n printf(\"NO\\n\");\n\n\n}\n"}, {"source_code": "#include \n#include \n#include \nint main()\n{\n long long t,s,x,i,a,b;\n scanf(\"%I64d %I64d %I64d\",&t,&s,&x);\n i=x/s;\n\n if(i==0){ a=t+s*i;b=a;}\n else{\n a=t+s*i;b=a+1;}\n\n\n if(x==a||x==b)\n {\n printf(\"YES\");\n }\n\n else{printf(\"NO\");}\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\nint main(){\n\tint t,s,x,i,flag=0;\n\tscanf(\"%d %d %d\",&t,&s,&x);\n\tif(t==x){\n\t\tprintf(\"YES\");\n\t\treturn 0;\n\t}\n if(x-t-1!=0)\n\tif((x-t)%(s)==0 || (x-t-1)%(s)==0){\n\t\tprintf(\"YES\");\n\t}\n\t\n\telse{\n\t\tprintf(\"NO\");\n\t}\t\n\t\n\treturn 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n int t,s,x,sum,g=0,f=0,i=1;\n scanf(\"%d%d%d\",&t,&s,&x);\n sum=t;\n /*while(x>=sum)\n {\n if(x==sum)\n {\n g=1;\n break;\n }\n if(f==0)\n {\n sum+=s*i;\n f=1;\n }\n else\n {\n sum+=(s*i)+1;\n f=0;\n }\n i++;\n }*/\n if(x==t||((x-t>0)&&((x-t)%s==0&&(x-t)!=0)||((x-t-1)!=0&&(x-t-1)%s==0)))\n printf(\"%s\",\"YES\");\n else\n printf(\"%s\",\"NO\");\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int t,x,s;\n while(scanf(\"%d%d%d\",&t,&x,&s)!=EOF)\n {\n if(s-t==0)\n printf(\"Yes\\n\");\n else if(0\n\nint main(void){\n\tlong long t = 0, s = 0, x = 0, a = 0, b = 0;\n\tint con = 0;\n\tscanf(\"%d %d %d\",&t,&s,&x);\n\tif(t != x){\n\t\tif(x % s == 3 || x % s == 4 && x > s){\n\t\t\tprintf(\"YES\\n\");\n\t\t\tcon++;\n\t\t}\n\t\tif(con == 0){\n\t\t\tprintf(\"NO\\n\");\n\t\t}\n\t}\n\telse {\n\t\tprintf(\"YES\\n\");\n\t}\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n\n\n\nint main() {\n \n long int t,s,x;\n scanf(\"%ld %ld %ld\",&t,&s,&x);\n if(x==t+1){\n printf(\"NO\");\n \n \n }\n else{\n long int temp=(x-t)%s;\n if(temp==0 || temp==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n \n \n \n \n \n \n \n \n \n \n \n}\n"}, {"source_code": "#include \n#include \n#include \nint main()\n{\n\tlong long int t , s, x,n,k,z;\n\tint y=0;\n\tint a=0;\n\tscanf(\"%lld %lld %lld\",&t,&s,&x);\n\tfor (n=1;n<(x/2+1);n++)\n\t{\n\t\t(k=(t+(n-1)*s));\n\t\tif (x==k)\n\t\t{\n\t\t\ty++;\n\t\t\tbreak;\n\t\t}\n\n\t\tz=((t+1+s) + ((n-1)*s));\n\t\tif (x==z)\n\t\t{\n\t\t\ta++;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t\tif (a==1 || y==1)\n\t{\n\t\tprintf(\"yes\");\n\t}\n\telse\n\t{\n\t\tprintf(\"no\");\n\t}\n\t\n\t\n}\n"}, {"source_code": "#include \nint main()\n{\n long long int t, i, x, total, n;\n scanf(\"%lld %lld %lld\", &t, &i, &x);\n n = t%i;\n if(x==t) printf(\"YES\");\n else if(x>t+1 && (x%i<(n+2))) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include\n\nint main(){\n\t\n\tint x ,t ,s;\n\tscanf(\"%d%d%d\",&t ,&s ,&x);\n\tif((x-t)%s==0)\n\t printf(\"YES\\n\");\n\telse if((x-t-1)%s==0)\n\t printf(\"YES\\n\");\n\t else printf(\"NO\\n\");\n\t \n\t return 0;\n}\n\t \t\n"}, {"source_code": "#include \n//#include \nint main(void)\n{\n\tlong long int t= 0; //time of first barking\n\tlong long int s= 0; //barking interval\n\tlong long int x= 0; //time of eating\n\tscanf(\"%lld\", &t);\n\tscanf(\"%lld\", &s);\n\tscanf(\"%lld\", &x);\n\n\tif(x < t) printf(\"NO\\n\");\n\telse if( (x-t)%s == 0 || (x-t-1)%s == 0 ) printf(\"YES\\n\");\n\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n long long int t,s,n,a,b,i,flag;\n while(scanf(\"%lld%lld%lld\",&t,&s,&n)!=EOF)\n {\n if(t==n)\n {\n printf(\"YES\\n\");\n }\n else\n {\n flag=0;\n for(i=1;i<=s;i++)\n {\n a=t+i*s;\n b=t+i*s+1;\n if(a==n)\n {\n flag=1;\n break;\n }\n else if (b==n)\n {\n flag=2;\n break;\n }\n\n }\n if(flag==1 || flag==2)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n }\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n long long int t,s,x,i,b,a;\n scanf(\"%lld %lld %lld\",&t,&s,&x);\n if(x==t){\n printf(\"YES\");\n return 0;\n }\n for(i=1; ;i++){\n b=s+t;\n a=b+1;\n if(a>=x){\n break;\n }\n }\n if(b==x||a==x){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n double x,t,s,a,i,j,b;\n scanf(\"%lf %lf %lf\",&t,&s,&x);\n double m1,m2,m3;\n\n m2=(x-t)/s;\n m3=(x-(t+1))/s;\n\n int k,c;\n\n k=m2;\n c=m3;\n //printf(\"m2= %f\\n\",m2);\n //printf(\"m3= %f\\n\",m3);\n //printf(\"k= %d\\n\",k);\n //printf(\"c= %d\\n\",c);\n if(m2!=0&&m3!=0)\n {\n if(k==m2||c==m3)\n {\n j=1;\n }\n }\n else if(m2==0)\n {\n if(c==m3)\n {\n j=1;\n }\n else\n {\n j=0;\n }\n }\n else if(m3==0)\n {\n if(k==m2)\n {\n j=1;\n }\n else\n {\n j=0;\n }\n }\n if(t==x)\n {\n j=1;\n }\n if(j==1)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n}\n"}, {"source_code": "#include\nint main()\n{\n int t,s,x;\n scanf(\"%d %d %d\",&t,&s,&x);\n if(t==x)\n {\n printf(\"YES\");\n }\n int i,j,y=1,temp=0;\n for(i=t+s,j=s;;)\n {\n if(i>x)\n {\n temp=1;\n break;\n }\n if(i==x)\n {\n temp=0;\n break;\n }\n if(y==0)\n {\n i+=s-1;\n y=1;\n }\n else if(y==1)\n {\n i+=1;\n y=0;\n }\n }\n if(temp==0) {\n printf(\"YES\");\n }\n else if(temp==1){\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n\tlong long int t,s,x;\n\tscanf(\"%I64d %I64d %I64d\",&t,&s,&x);\n\tif(x\n\n#define mprint(x) printf(\"%d\\n\",x)\n\n//#define DEBUG\n#define LOOP_START\n#define LOOP_END\n\n#ifdef DEBUG\n#undef LOOP_START\n#undef LOOP_END\n#define LOOP_START while(1){\n#define LOOP_END }\n//#define UNLOCK // \n#endif\n\n\n\nint main(){\n\tint t, s, x;\n\tLOOP_START\n\tscanf(\"%d %d %d\", &t, &s, &x);\n\t//mprint(t);\n\t//mprint(s);\n\t//mprint(x);\n\t//printf(\"----------------\\n\");\n\tx = x - t;\n\t//mprint(x);\n\t//mprint(x % s);\n\t//mprint(3 / 2);\n\t\t\t\n\tif (x % s == 0 || ((x - 1)!=0 && (x - 1) % s == 0) || x == 0)\n\t\tprintf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\tLOOP_END\n\n\treturn 0;\n}"}, {"source_code": "#include \nmain()\n{\n int t,s,x;\n scanf(\"%d %d %d\",&t,&s,&x);\n if(x>=t && (x-t)%s ==0 || x+1>=t && (x-1-t)%s==0)\n printf(\"Yes\");\n else\n printf(\"No\");\n}"}, {"source_code": "#include\n\nint main()\n{\n long long int t,s,b,c,d,f;\n double a,x,e;\n scanf(\"%lld %lld %lf\",&t,&s,&x);\n a=x/s;\n d=a;\n e=a-d;\n f=e+1;\n b=d*s+t;\n c=b+1;\n //printf(\"%lf %lld %lf\\n\",a,d,e);\n if(d==0 && x==b)\n {\n printf(\"YES\\n\");\n }\n else if(e==0 && d>0)\n {\n b=d*s;\n c=b+1;\n if(x==b || x==c)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n\n else if(d>0)\n {\n if(x==b || x==c)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include\nint main ()\n{\n int t,x,s;\n scanf(\"%d %d %d\",&t,&s,&x);\n if(x\n\nint main(){\n\t\n\tint x ,t ,s;\n\tscanf(\"%d%d%d\",&t ,&s ,&x);\n\tif((x-t)%s==0)\n\t printf(\"YES\\n\");\n\telse if((x-t-1)%s==0)\n\t printf(\"YES\\n\");\n\t else printf(\"NO\\n\");\n\t \n\t return 0;\n}\n\t \t\n"}, {"source_code": "#include\nint main(){\n\tlong t,s,x,i,flag=0;\n\tscanf(\"%ld %ld %ld\",&t,&s,&x);\n\tif(t==x){\n\t\tprintf(\"YES\");\n\t\treturn 0;\n\t}\n if(x-t-1!=0 && (x-t-1)>=0){\n\t\tif((x-t)%(s)==0 || (x-t-1)%(s)==0){\n\t\t\tprintf(\"YES\");\n\t\t}\n\t}\n\telse{\n\t\tprintf(\"NO\") ;\n\t}\t\n\t\n\treturn 0;\n}"}, {"source_code": "#include\n#include\n\nchar ch[20];\n\nint main(void)\n{\n\tint a[105];\n\tint t,s,x,i,j;\n\tscanf(\"%d %d %d\",&t,&s,&x);\n\ta[0]=t;\n\tif(x==t) {\n\t\tprintf(\"YES\");\n\t\treturn 0;\n\t}\n\tfor(i=1,j=1;i<1000000001;i+=2,j++) {\n\t\ta[i]=t+j*s;\n\t\ta[i+1]=a[i]+1;\n\t\tif(a[i]==x || a[i+1]==x) {\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\t\tif(a[i]>x) {\n\t\t\tprintf(\"%d\",i);\n\t\t\tprintf(\"NO\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\t\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int t,s,x;\n scanf(\"%d %d %d\",&t,&s,&x);\n if(x-t==0 || (x-t)%s==0 || x-t-s==0 || ((x-t-1)%s==0 && x-t-1!=0)) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int a,b,c,s,t,x;\n\n scanf(\"%d %d %d\",&s,&t,&x);\n\n if (s-x==0)\n printf(\"YES\\n\");\n\n else if( x>=t && x>=s){\n a=x-s;\n if(a<0)\n a=-a;\n if(a%t==0)\n printf(\"YES\");\n else if((a-1)%t==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n }\n else\n printf(\"NO\");\n\n\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tlong t, s, x;\n\n\tscanf(\"%ld %ld %ld\", &t, &s, &x);\n\n\tx -= t;\n\tt = 0;\n\n\tif ((x % s == 1) && (x / s > 0) || (x % s == 0))\n\t\tputs(\"YES\");\n\telse\n\t\tputs(\"NO\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int t,s,x,d,e,n,a=0;\n scanf(\"%lld %lld %lld\",&t,&s,&x);\n n=0;\n while((n+1)*s+t+1<=x||n*s+t<=x)\n {\n d=n*s+t-x;\n e=(n+1)*s+t-x+1;\n if(d==0||e==0)\n {\n printf(\"no\");\n }\n else\n {\n a++;\n }\n n++;\n }\nif(a!=0)\nprintf(\"yes\");\nelse\nreturn 0;\nreturn 0;\n}"}, {"source_code": "#include\nmain()\n{\n long long int t,s,x,n;\n scanf(\"%lld %lld %lld\",&t,&s,&x);\n n=x-t;\n if(n%s==0) printf(\"YES\");\n else if((n-1!=0) && (n-1)%s==0) printf(\"YES\");\n else printf(\"NO\");\n}\n"}, {"source_code": "#include \n#include \n \nint main()\n{\n int t, s, x;\n scanf(\"%d %d %d\", &t, &s, &x);\n if ((x-t)%s == 0 && ((int)(x-t)/s) > 0){\n printf(\"YES\");\n return 0;\n }\n if ((x-t)%s == 1 && ((int)(x-t)/s) > 0){\n printf(\"YES\");\n return 0;\n }\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint t,s,x;\n\tscanf(\"%d%d%d\",&t,&s,&x);\n\tif (((x-t)% s == 0)||(((x-t-1)% s==0)&&(x-t-1>0))) printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int t, i, x, total;\n scanf(\"%d %d %d\", &t, &i, &x);\n if(x==t) printf(\"YES\");\n else if(x>t+1 && (x%i<(t+2))) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long t,s,i,x,a,c=0,b;\n scanf(\"%I64d%I64d%I64d\",&t,&s,&x);\n if(x<=1){\n for(i=0;i<=x;i++){\n a=t+(s*i);\n b=a+1;\n if(a==x||(b==x&&i!=0)){\n c=1;\n break;\n }\n else{\n c=0;\n }\n }\n }\n else if(x>1){\n for(i=0;i\n\nint main()\n{\n long long int t,s,x,a,b,c;\n scanf(\"%lld %lld %lld\",&t,&s,&x);\n a=x/s;\n b=a*s+3;\n c=b+1;\n // printf(\"%lld %lld\\n\",a,b);\n if(a==0)\n {\n if(x==b)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n else if(a>0)\n {\n if(x==b || x==c)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include\nint main ()\n{\n int t,x,s;\n scanf(\"%d %d %d\",&t,&s,&x);\n if(x\n\nint main()\n{\n int t,s,x,i,temp,vagshesh;\n scanf(\"%d%d%d\",&t,&s,&x);\n temp=x-t;\n vagshesh=temp%s;\n if(vagshesh==0 || vagshesh==1 && (x-t)!=1 && t<=x)\n printf(\"YES\\n\");\n else\n printf(\"NO \\n\");\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \nint main(){\n \n char INPUT[1000];\n char FINAL[4]= \"\";\n int s;\n int TIME;\n int TOTAL;\n \n fgets(INPUT, sizeof(INPUT), stdin);\n sscanf(INPUT, \"%d %d %d\", &TOTAL, &s, &TIME );\n \n while (TIME > TOTAL){\n TOTAL = TOTAL + s - 1;\n if (TOTAL == TIME) {\n\t break;\n }\n TOTAL++;\n if (TOTAL == TIME) {\n break;\n }\n }\n if (TOTAL == TIME){\n strncpy(FINAL,\"YES\", 3);\n }\n else {\n strncpy(FINAL,\"NO\", 2);\n }\n fputs(FINAL, stdout);\n return 0; \n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n\tint x, s, t;\n\n\tscanf(\"%d%d%d\", &t, &s, &x);\n\n\tif (t+1 != x && ((x-t)%s == 0 || (x-t-1)%s == 0)) printf(\"YES\");\n\telse printf(\"NO\");\n}\n"}, {"source_code": "#include\n#include\n\nchar ch[20];\n\nint main(void)\n{\n\tint a[105];\n\tint t,s,x,i,j;\n\tscanf(\"%d %d %d\",&t,&s,&x);\n\ta[0]=t;\n\tif(x==t) {\n\t\tprintf(\"YES\");\n\t\treturn 0;\n\t}\n\tfor(i=1,j=1;i<1000000001;i+=2,j++) {\n\t\ta[i]=t+j*s;\n\t\ta[i+1]=a[i]+1;\n\t\tif(a[i]==x || a[i+1]==x) {\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\t\tif(a[i]>x) {\n\t\t\tprintf(\"%d\",i);\n\t\t\tprintf(\"NO\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\t\n\treturn 0;\n}"}, {"source_code": "#include \n\nunsigned char c(unsigned int t,unsigned int s,unsigned int x);\n\nint main() {\n\tunsigned int t;\n\tunsigned int x;\n\tunsigned int s;\n\t//printf(\"%d\",4%10); return 0;\n\tscanf(\"%d %d %d\",&t,&s,&x);\n\tif(c(t,s,x)) {\n\t\tprintf(\"YES\");\n\t} else {\n\t\tprintf(\"NO\");\t\t\n\t}\n\treturn 0;\n}\n\nunsigned char c(unsigned int t,unsigned int s,unsigned int x) {\n\tif(((x%s==t) || ((x-1)%s==t)) && (x>=t+s)) {\n\t\treturn 1;\n\t} else {\n\t\treturn 0;\n\t}\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int t=0,s=0,x=0,n=0,b=0;\n scanf(\"%d%d\",&t,&s);\n scanf(\"%d\",&x);\n n =(x-t);\n if(n%s==0||(n-1)%s==0)\n b=1;\n if(n<0)\n b=0;\n\n\n\n if(b == 1)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n long long int t,s,x,i,b;\n int f=0;\n scanf(\"%I64d %I64d %I64d\",&t,&s,&x);\n if(t==x)\n printf(\"YES\");\n else{\n for(i=1,b=t+s*i;b+1<=x;i++){\n b=t+s*i;\n //printf(\"%d %d \",b,b+1);\n if(x==b+1||x==b)\n f=1;\n }\n if(f==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n}\n"}, {"source_code": "#include \nint main()\n{\n int t,s,x,i;\nscanf(\"%d %d %d\",&t,&s,&x);\ni=t;\n\nif((((x-i)%s)==0)&&((x-i)!=0))\nprintf(\"YES\");\nelse if((((x-i-1)%s)==0)&&((x-i-1)!=0))\nprintf(\"YES\");\nelse if(i==x)\nprintf(\"YES\");\nelse\nprintf(\"NO\");\n\n\n\n\n\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,s,d,p;\n while(scanf(\"%d%d%d\",&a,&s,&d)!=EOF)\n {\n p=(d-a)%s;\n if(p==0||(p==1&&d>2*a))\n printf(\"Yes\\n\");\n else printf(\"No\\n\");\n }\n}\n"}, {"source_code": "#include\nint barks(unsigned long long int t,unsigned long long int s, unsigned long long int x)\n{ int i;\n int bark=0;\n for(i=0;bark\n//#include \nint main(void)\n{\n\tint t= 0; //time of first barking\n\tint s= 0; //barking interval\n\tint x= 0; //time of eating\n\tscanf(\"%d\", &t);\n\tscanf(\"%d\", &s);\n\tscanf(\"%d\", &x);\n\tint k=s;\n\n\tif(x == t) printf(\"YES\\n\");\n\telse\n\t{\n\t\tfor (int i = 0; i < 1000; ++i) //1000 is a randomly chosen value\n\t\t{\n\t\t\tif(x%(t+s) == 0 || x%(t+s+1) == 0)\n\t\t\t\t{printf(\"YES\\n\"); break;}\n\t\t\tif((t+s) > x)\n\t\t\t\t{printf(\"NO\\n\"); break;}\n\n\t\t\ts= s+k;\n\t\t}\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n long long int t,s,n,a,b,i,flag;\n while(scanf(\"%lld%lld%lld\",&t,&s,&n)!=EOF)\n {\n if(t==n)\n {\n printf(\"YES\\n\");\n }\n else\n {\n flag=0;\n for(i=1;i<=s;i++)\n {\n a=t+i*s;\n b=t+i*s+1;\n if(a==n)\n {\n flag=1;\n break;\n }\n else if (b==n)\n {\n flag=2;\n break;\n }\n\n }\n if(flag==1 || flag==2)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n }\n }\n\n\n return 0;\n}\n"}, {"source_code": " #include \n #include \n #include \n #include \n #include \n #include \n #include \n #define lli long long int\n #define li long int \n \n\n int main()\n {\n \n #ifndef ONLINE_JUDGE\n freopen(\"input.txt\", \"r\", stdin);\n freopen(\"output.txt\", \"w\", stdout);\n #endif\n long int t,s,x;\n scanf(\"%ld%ld%ld\",&t,&s,&x);\n if((x-t)>0&&((x-t)%s==0||(x-t-1)%s==0))\n printf(\"YES\\n\");\n else \n printf(\"NO\\n\");\n return 0;\n }"}, {"source_code": "#include\n#include\n\nchar ch[20];\n\nint main(void)\n{\n\tint a[105];\n\tint t,s,x,i,j;\n\tscanf(\"%d %d %d\",&t,&s,&x);\n\ta[0]=t;\n\tif(x==t) {\n\t\tprintf(\"YES\");\n\t\treturn 0;\n\t}\n\tfor(i=1,j=1;i<1000000001;i+=2,j++) {\n\t\ta[i]=t+j*s;\n\t\ta[i+1]=a[i]+1;\n\t\tif(a[i]==x || a[i+1]==x) {\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\t\tif(a[i]>x) {\n\t\t\tprintf(\"%d\",i);\n\t\t\tprintf(\"NO\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\t\n\treturn 0;\n}"}], "src_uid": "3baf9d841ff7208c66f6de1b47b0f952"} {"nl": {"description": "Alex enjoys performing magic tricks. He has a trick that requires a deck of n cards. He has m identical decks of n different cards each, which have been mixed together. When Alex wishes to perform the trick, he grabs n cards at random and performs the trick with those. The resulting deck looks like a normal deck, but may have duplicates of some cards.The trick itself is performed as follows: first Alex allows you to choose a random card from the deck. You memorize the card and put it back in the deck. Then Alex shuffles the deck, and pulls out a card. If the card matches the one you memorized, the trick is successful.You don't think Alex is a very good magician, and that he just pulls a card randomly from the deck. Determine the probability of the trick being successful if this is the case.", "input_spec": "First line of the input consists of two integers n and m (1 ≤ n, m ≤ 1000), separated by space — number of cards in each deck, and number of decks.", "output_spec": "On the only line of the output print one floating point number – probability of Alex successfully performing the trick. Relative or absolute error of your answer should not be higher than 10 - 6.", "sample_inputs": ["2 2", "4 4", "1 2"], "sample_outputs": ["0.6666666666666666", "0.4000000000000000", "1.0000000000000000"], "notes": "NoteIn the first sample, with probability Alex will perform the trick with two cards with the same value from two different decks. In this case the trick is guaranteed to succeed.With the remaining probability he took two different cards, and the probability of pulling off the trick is .The resulting probability is "}, "positive_code": [{"source_code": "#include \n\nint main() {\n\tint n, m;\n\n\tscanf(\"%d%d\", &n, &m);\n\tprintf(\"%.12lf\\n\", n == 1 ? 1 : 1.0 / n\n\t\t\t+ (double) (m - 1) * (n - 1) / (n * m - 1) / n);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\nfloat n,m,res;\t\nscanf(\"%f%f\",&n,&m);\nif (m==1 && n==1) \n\tres = 1;\nelse\n\tres = (1+(n-1)*(m-1)/(n*m-1))/n;\nprintf(\"%f\",res);\nreturn 0;\n}"}, {"source_code": "#include\nint main()\n{\ndouble n,m;\nwhile(scanf(\"%lf%lf\",&n,&m)!=EOF)\nif(n==1&&m==1)\nprintf(\"1.0000000000000000\\n\");\nelse\nprintf(\"%.16lf\\n\",1.0/n+((n-1)*(m-1))/(n*(n*m-1)));\nreturn 0;\n}"}, {"source_code": "#include \n#include \n#include \n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint n, m;\ndouble binomial[1010][1010];\n\nvoid Pregenerate(){\n int i, j;\n for (i = 0; i < 1010; i++){\n for (j = 0; j <= i; j++){\n if (i == j || j == 0) binomial[i][j] = 1;\n else binomial[i][j] = (binomial[i - 1][j] + binomial[i - 1][j - 1]);\n }\n }\n}\n\nint main(){\n Pregenerate();\n int i, j, k, l;\n\n while (scanf(\"%d %d\", &n, &m) != EOF){\n int r = (n * m);\n\n double res = 0.0;\n for (i = 1; i <= n; i++){\n double x = (1.0 * i) / (1.0 * n);\n double p = (x * x);\n\n k = m, l = r;\n for (j = 1; j <= i; j++, k--, l--){\n double y = (1.0 * k) / (1.0 * l);\n p *= y;\n }\n\n p *= binomial[n][i];\n\n k = r - m;\n for (j = i + 1; j <= n; j++, k--, l--){\n double y = (1.0 * k) / (1.0 * l);\n p *= y;\n }\n res += p;\n }\n res = res * n;\n\n res += 1e-12;\n printf(\"%0.9lf\\n\", res);\n }\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include \n\nint main() {\n\tint n, m;\n\n\tscanf(\"%d%d\", &n, &m);\n\tprintf(\"%.12lf\\n\", n == 1 ? 1 : 1.0 / n\n\t\t\t+ (double) (n - 1) * (n - 1) / (n * m - 1) / n);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n\tint n, m;\n\n\tscanf(\"%d%d\", &n, &m);\n\tprintf(\"%.12lf\\n\", n == 1 ? 1 : 1.0 / n\n\t\t\t+ (double) (m - 1.0) / ((n * m - 1) / (n - 1) * n));\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\nfloat m,n,res;\t\nscanf(\"%f%f\",&m,&n);\nres = (1+(n-1)*(m-1)/(n*m-1))/n;\nprintf(\"%f\",res);\nreturn 0;\n}"}, {"source_code": "#include \nint main()\n{\nint m,n;\nfloat res;\t\nscanf(\"%d%d\",&m,&n);\nres = (1+(n-1)*(m-1)/(n*m-1))/n;\nprintf(\"%f\",&res);\nreturn 0;\n}"}, {"source_code": "#include \n#include \nint main()\n{\nfloat m,n,res;\t\nscanf(\"%f%f\",&m,&n);\nif (n=1) res = 1;\nelse\nres = (1+(n-1)*(m-1)/(n*m-1))/n;\nprintf(\"%f\",res);\nreturn 0;\n}"}, {"source_code": "#include \nint main()\n{\nint m,n;\ndouble res;\t\nscanf(\"%d%d\",&m,&n);\nres = (1+(n-1)*(m-1)/(n*m-1))/n;\nprintf(\"%d\",&res);\nreturn 0;\n}"}, {"source_code": "#include \n#include \nint main()\n{\nfloat m,n,res;\t\nscanf(\"%f%f\",&m,&n);\nif (n==1) \n\tres = 1;\nelse\n\tres = (1+(n-1)*(m-1)/(n*m-1))/n;\nprintf(\"%f\",res);\nreturn 0;\n}"}, {"source_code": "#include\nint main()\n{\ndouble n,m;\nwhile(scanf(\"%lf%lf\",&n,&m)!=EOF)\nprintf(\"%.16lf\\n\",1.0/n+((n-1)*(m-1))/(n*(n*m-1)));\nreturn 0;\n}"}, {"source_code": "#include \n#include \n#include \n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint n, m;\nlong double binomial[1010][1010];\n\nvoid Pregenerate(){\n int i, j;\n for (i = 0; i < 1010; i++){\n for (j = 0; j <= i; j++){\n if (i == j || j == 0) binomial[i][j] = 1;\n else binomial[i][j] = (binomial[i - 1][j] + binomial[i - 1][j - 1]);\n }\n }\n}\n\nint main(){\n Pregenerate();\n int i, j, k, l;\n\n while (scanf(\"%d %d\", &n, &m) != EOF){\n int r = (n * m);\n\n long double res = 0.0;\n for (i = 1; i <= n; i++){\n long double x = (1.0 * i) / (1.0 * n);\n long double p = (x * x);\n\n k = m, l = r;\n for (j = 1; j <= i; j++, k--, l--){\n long double y = (1.0 * k) / (1.0 * l);\n p *= y;\n }\n\n p *= binomial[n][i];\n\n k = r - m;\n for (j = i + 1; j <= n; j++, k--, l--){\n long double y = (1.0 * k) / (1.0 * l);\n p *= y;\n }\n res += p;\n }\n res = res * n;\n\n printf(\"%0.9Lf\\n\", res);\n }\n return 0;\n}\n"}], "src_uid": "0b9ce20c36e53d4702869660cbb53317"} {"nl": {"description": "Chouti was doing a competitive programming competition. However, after having all the problems accepted, he got bored and decided to invent some small games.He came up with the following game. The player has a positive integer $$$n$$$. Initially the value of $$$n$$$ equals to $$$v$$$ and the player is able to do the following operation as many times as the player want (possibly zero): choose a positive integer $$$x$$$ that $$$x<n$$$ and $$$x$$$ is not a divisor of $$$n$$$, then subtract $$$x$$$ from $$$n$$$. The goal of the player is to minimize the value of $$$n$$$ in the end.Soon, Chouti found the game trivial. Can you also beat the game?", "input_spec": "The input contains only one integer in the first line: $$$v$$$ ($$$1 \\le v \\le 10^9$$$), the initial value of $$$n$$$.", "output_spec": "Output a single integer, the minimum value of $$$n$$$ the player can get.", "sample_inputs": ["8", "1"], "sample_outputs": ["1", "1"], "notes": "NoteIn the first example, the player can choose $$$x=3$$$ in the first turn, then $$$n$$$ becomes $$$5$$$. He can then choose $$$x=4$$$ in the second turn to get $$$n=1$$$ as the result. There are other ways to get this minimum. However, for example, he cannot choose $$$x=2$$$ in the first turn because $$$2$$$ is a divisor of $$$8$$$.In the second example, since $$$n=1$$$ initially, the player can do nothing."}, "positive_code": [{"source_code": "#include \n#include\n#include\n#include\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\",&n);\nif(n==2){\n printf(\"2\");\n}else{\n printf(\"1\");\n}\nreturn 0;\n}\n"}, {"source_code": "#include\nint main() \n{ \n// a program by lepusarcticus - Ashutosh Pande\n// codeforces avito cool challenge 2018\nlong long int n,m;\nscanf(\"%I64d\",&n);\nif (n>=1&&n<=1000000000) //constraints\n{\nif (n==2)\nprintf(\"2\");\nelse\nprintf(\"1\");\n}\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n==2)\n {\n printf(\"2\");\n }\n else{\n\n /* for(i=2;i\n\n\nint main(){\n int a;\n scanf(\"%i\",&a);\n if(a==2)\n printf(\"2\");\n else\n printf(\"1\");\n}\n"}, {"source_code": "#include\n#include\n\nint main()\n{\n int n;\n\n scanf(\"%d\",&n);\n\n if(n==2)\n {\n printf(\"2\");\n }\n else\n {\n printf(\"1\");\n }\n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\nint n,x,v;\nscanf(\"%d\",&v);\nn=v;\nx=n-1;\nwhile((x0))\n{\nif((n%x)!=0)\n{\nn=n-x;\n}\nx--;\n}\n\nprintf(\"%d\",n);\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint v;\n\tscanf(\"%d\",&v);\n\tif(v==2)\n\t{\n\t\tprintf(\"2\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"1\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint v;\n\tscanf(\"%d\",&v);\n\tif(v==2)\n\t{\n\t\tprintf(\"2\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"1\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \nint main()\n{\n long long int n;\n scanf(\"%I64d\", &n);\n if (n==2)\n printf(\"2\");\n else\n printf(\"1\");\n return 0;\n}\n"}, {"source_code": "#include \nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tif (n>2){\n\t\tprintf(\"%d\",n-(n-1));\n\t}\n\telse if(n==2){\n\t\tprintf(\"%d\",2);\n\t}\n\telse if (n==1){\n\t\tprintf(\"%d\",1);\n\t}\n\treturn 0;\n}\n\t\n\n\t\t\n"}, {"source_code": "#include\nint main(){\n long long int n,x,s;\n scanf(\"%lld\",&n);\n if(n==2){\n printf(\"%lld\\n\",n);\n return 0;\n }\n /*while(1){\n if(n==1||n==0)break;\n s=n/2;\n n=n-(s+1);\n }*/\n if(n%2==0||n==1)\n printf(\"1\\n\");\n else if(n%2!=0)\n printf(\"1\\n\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int x,y;\n scanf(\"%d\",&x);\n if(x==0)\n printf(\"0\\n\");\n else if(x==2)\n printf(\"2\\n\");\n else printf(\"1\\n\");\n\n\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\t\n\tif(n==2)\n\t{\n\t\tprintf(\"%d\",2);\n\t}\n\telse\n\t{\n\t\tprintf(\"%d\",1);\n\t}\n\t\n\t\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\t\n\tif(n==2)\n\t{\n\t\tprintf(\"%d\",2);\n\t}\n\telse\n\t{\n\t\tprintf(\"%d\",1);\n\t}\n\t\n\t\n\treturn 0;\n}"}, {"source_code": "#include\nint main(){\n long int n;\n scanf(\"%ld\",&n);\n if(n == 2)printf(\"2\");\n else \n printf(\"1\");\n}"}, {"source_code": "#include\nint main(){\n int a;\nscanf(\"%d\",&a);\nif(a==2){printf(\"2\");}\nelse printf(\"1\");\n}\n"}, {"source_code": "#include\nint main(){\n\tint n;\n\tscanf(\"%d\", &n);\n\tif(n>0&&n!=2)\n\t\tprintf(\"1\");\n\telse if(n==0)\n\t\tprintf(\"0\");\n\telse if(n==2)\n\t\tprintf(\"2\");\n\telse\n\t\tprintf(\"-1\");\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n,k=1;\n scanf(\"%d\",&n);\n if(n==2)\n k=2;\n printf(\"%d\\n\",k);\n}"}, {"source_code": "#include \n#include\n#include\n#include\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[100000];\nscanf(\"%lld\",&n);\nif(n==2 || n==1){\n printf(\"%lld\",n);\n}else{\n printf(\"1\");\n}\nreturn 0;\n}"}, {"source_code": "#include\nint main() \n{ \n// a program by lepusarcticus - Ashutosh Pande\n// codeforces avito cool challenge 2018\nlong long int n,m;\nscanf(\"%I64d\",&n);\nif (n>=1&&n<=1000000000) //constraints\n{\nif (n==2)\nprintf(\"2\");\nelse\nprintf(\"1\");\n}\nreturn 0;\n}\n"}, {"source_code": "#include\nint main() \n{\n long long int n;\n scanf(\"%lli\", &n) ;\n \n if(n==2) \n {\n \tprintf(\"2\\n\") ;\n } \n else \n {\n \t printf(\"1\\n\") ;\n } \n return 0; \n} \n "}, {"source_code": "#include\nint main()\n{\n int a;\n scanf(\"%d\",&a);\n if(a==2)\n printf(\"2\\n\");\n else\n printf(\"1\\n\");\n}\n"}, {"source_code": "#include//not acc\nint main()\n{\n int n,x;\n scanf(\"%d\",&n);\n if(n==1)\n {\n printf(\"%d\\n\",n);\n }\n else if(n==2)\n {\n printf(\"%d\",n);\n }\n else if(n>2)\n {\n int x=1;\n printf(\"%d\\n\",x);\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n==2){\n printf(\"2\");\n }\n else{\n printf(\"1\");\n }\n return 0;\n}"}, {"source_code": "#include//not acc\nint main()\n{\n int n,x;\n scanf(\"%d\",&n);\n if(n==1)\n {\n printf(\"%d\\n\",n);\n }\n else if(n==2)\n {\n printf(\"%d\",n);\n }\n else if(n>2)\n {\n int x=1;\n printf(\"%d\\n\",x);\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n==2){\n printf(\"2\\n\");\n }\n else\n printf(\"1\\n\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n==2)\n printf(\"2\\n\");\n else\n printf(\"1\\n\");\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n int n;\n scanf(\"%d\",&n);\n if(n!=2){\n printf(\"%d\",1);}\n else{printf(\"%d\",2);}\n return 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if((n-1)==1)\n printf(\"%d\\n\",n);\n else\n printf(\"%d\\n\",n-(n-1));\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n==2)\n {\n printf(\"2\");\n }\n else\n {\n printf(\"1\");\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int i,j,k,l,n,t,d,x;\n scanf(\"%d\",&n);\n if(n!=2)\n {\n printf(\"1\");\n }\n else\n {\n printf(\"2\"); \n }\n return 0;\n}"}, {"source_code": "#include \nint main()\n{\nint n,x=0,i=1;\nscanf(\"%d\",&n);\nif(n<=2)\n{\nfor(i=1;i\nint main()\n{\nint n;\nscanf(\"%d\",&n);\nif(n==2)\n{\nprintf(\"2\");\n}\nelse\n{\nprintf(\"1\");\n}\n}"}, {"source_code": "#include\nint main()\n{\n int v;\n scanf(\"%d\",&v);\n if(v==2)\n printf(\"2\");\n else\n printf(\"1\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\nint n;\nscanf(\"%d\",&n);\nif(n!=2)\n{\nn=n-(n-1);\n}\nprintf(\"%d\",n);\n}"}, {"source_code": "#include\nint main()\n{\n long long x;\n scanf(\"%lld\",&x);\n if(x!=2)\n printf(\"1\");\n else if(x=2)\n printf(\"2\");\n}"}, {"source_code": "#include\nint main() \n{ \n// a program by lepusarcticus - Ashutosh Pande\n// codeforces avito cool challenge 2018\nlong long int n,m;\nscanf(\"%I64d\",&n);\nif (n>=1&&n<=1000000000) //constraints\n{\nif (n==2)\nprintf(\"2\");\nelse\nprintf(\"1\");\n}\nreturn 0;\n}\n"}, {"source_code": "#include\nint main(){\nint n;\nscanf(\"%d\",&n);\nif(n==2){\nprintf(\"2\");\n}else{\nprintf(\"1\");\n}\n\n}\n"}, {"source_code": "#include \nint main() {\n long long v;\n scanf(\"%I64d\",&v);\n if (v==2) {\n printf(\"%d\",2);\n } else {\n printf(\"%d\",1);\n }\n return 0;\n}"}, {"source_code": "#include \nint main() {\n long long v;\n scanf(\"%I64d\",&v);\n if (v==2) {\n printf(\"%d\",2);\n } else {\n printf(\"%d\",1);\n }\n return 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if (n==2){printf(\"2\");}\n else {printf (\"1\");}\n return 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n int n,i=1;\n scanf(\"%d\",&n);\n if(n!=2)\n printf(\"1\");\n else\n printf(\"2\");\n}\n"}, {"source_code": "#include\nint main(){\n int t=0,i=1,n=0;\n scanf(\"%d\",&n);\n if(n>2||n==1)printf(\"%d\",1);\n else printf(\"%d\",n);\n}"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n==2) printf(\"2\");\n else\n printf(\"1\");\n}\n"}, {"source_code": "#include \nint main()\n{\n int v,n;\n scanf(\"%d\",&v);\n n=v-v+1;\n if(v==2)\n printf(\"%d\",v);\n else\n printf(\"%d\",n);\n return 0;\n}"}, {"source_code": "#include\nint main(){\n long int n;\n scanf(\"%ld\",&n);\n if(n == 2)printf(\"2\");\n else \n printf(\"1\");\n}"}, {"source_code": "#include\nint main(){\nint n;\nscanf(\"%d\",&n);\nif(n==2){\nprintf(\"2\");\n}else{\nprintf(\"1\");\n}\n\n}\n"}, {"source_code": "#include\n \nint main(){\n long long int n;\n scanf(\"%lld\",&n);\n \n if(n == 2){\n printf(\"2\");\n }\n else{\n printf(\"1\");\n }\n \n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tif (n == 2)\n\t{\n\t\tprintf(\"2\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"1\\n\");\n\t}\n\t return 0;\n}"}, {"source_code": "#include\nint main()\n{\nint n;\nscanf(\"%d\",&n);\n\tif(n==2)\n\t{\n\t\tprintf(\"2\");\n\t}\n\telse\n\t{\n\t\tprintf(\"1\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main(){\n\tint n;\n\tscanf(\"%d\", &n);\n\tif(n>0&&n!=2)\n\t\tprintf(\"1\");\n\telse if(n==0)\n\t\tprintf(\"0\");\n\telse if(n==2)\n\t\tprintf(\"2\");\n\telse\n\t\tprintf(\"-1\");\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint main(void)\n{\n\n unsigned long long int x;\n scanf(\"%llu\",&x);\n\n if(x==2)\n printf(\"2\");\n else\n printf(\"1\");\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n;\n scanf(\"%I64d\",&n);\n if(n==2) printf(\"2\");\n else printf(\"1\");\n}"}, {"source_code": "#include \nint main()\n{\nint n,x=0,i=1;\nscanf(\"%d\",&n);\nif(n<=2)\n{\nfor(i=1;i\nint main()\n{\n int a,b,s,i;\n scanf(\"%d\",&a);\n if(a==2)\n printf(\"2\\n\");\n else\n printf(\"1\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,s,i;\n scanf(\"%d\",&a);\n if(a==2)\n printf(\"2\\n\");\n else\n printf(\"1\\n\");\n\n return 0;\n}\n"}, {"source_code": "\n#include\nint main(){\nint m;\nwhile(scanf(\"%d\",&m)==1){\nif(m==2){printf(\"2\\n\");}\nelse{printf(\"1\\n\");}}\nreturn 0;}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,v=2;\n\tscanf(\"%d\",&n);\n\tif(n==2)\n\t{\n\t\tprintf(\"2\\n\");\n\t}\n\telse printf(\"1\\n\");\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,i;\n\tscanf(\"%d\",&n);\n\tfor(i=n-1;i>0;i--)\n\t{\n\t\tif((n%i)!=0)\n\t\t{\n\t\t\tprintf(\"%d\",(n-i));\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"%d\",n);\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int x,n,i,r,s;\n scanf(\"%lld\",&n);\n\n if(n==2)\n {\n printf(\"2\\n\");\n }\n else\n {\n\n printf(\"1\\n\");\n\n\n }\n\n}\n"}, {"source_code": "#include\n\n/*divisible(int n,int x){\n if(n%x==0){return 1;}\n else{return 0;}\n}*/\nint main(){\n long v,n,x;\n scanf(\"%ld\",&v);\n n=v;\n/* for(long i=1;i<=n;i++){\n if(divisible(n,i)==0){\n x=i;\n }\nif(n-x0){\nn=n-x;}\n}*/\nif(n==2){printf(\"2\");}\n\nelse{\n printf(\"1\");}\nreturn 0;\n}"}, {"source_code": "#include\n\nint main()\n\n{\n int n,i;\n\n scanf(\"%d\",&n);\n\n while(n>2)\n {\n for(i=2;i\n\nint main() {\n long int v,n,i,x;\n scanf(\"%ld\",&v);\n n=v;\n for(i=n-1;i>0;i--)\n {\n if(i\n\nint main(void)\n{\n\n unsigned long long int x;\n scanf(\"%llu\",&x);\n\n if(x==2)\n printf(\"2\");\n else\n printf(\"1\");\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n long long int a;\n scanf(\"%I64d\", &a);\n if(a == 2)\n printf(\"2\");\n else\n printf(\"1\");\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int n,i=1;\n scanf(\"%d\",&n);\n if(n!=2)\n printf(\"1\");\n else\n printf(\"2\");\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tif (n == 2)\n\t{\n\t\tprintf(\"2\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"1\\n\");\n\t}\n\t return 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint n,i;\n\tscanf(\"%d\",&n);\n\tfor(i=n-1;i>0;i--)\n\t{\n\t\tif((n%i)!=0)\n\t\t{\n\t\t\tprintf(\"%d\",(n-i));\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"%d\",n);\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint n,v=2;\n\tscanf(\"%d\",&n);\n\tif(n==2)\n\t{\n\t\tprintf(\"2\\n\");\n\t}\n\telse printf(\"1\\n\");\n}\n"}, {"source_code": "#include\nint main()\n{\nint n;\nscanf(\"%d\",&n);\n\tif(n==2)\n\t{\n\t\tprintf(\"2\");\n\t}\n\telse\n\t{\n\t\tprintf(\"1\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include\n#include\n#include\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[100000];\nscanf(\"%lld\",&n);\nif(n==2 || n==1){\n printf(\"%lld\",n);\n}else{\n printf(\"1\");\n}\nreturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int x,n,i,r,s;\n scanf(\"%lld\",&n);\n\n if(n==2)\n {\n printf(\"2\\n\");\n }\n else\n {\n\n printf(\"1\\n\");\n\n\n }\n\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if((n-1)==1)\n printf(\"%d\\n\",n);\n else\n printf(\"%d\\n\",n-(n-1));\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,i;\n\tscanf(\"%d\",&n);\n\tfor(i=n-1;i>0;i--)\n\t{\n\t\tif((n%i)!=0)\n\t\t{\n\t\t\tprintf(\"%d\",(n-i));\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"%d\",n);\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n==2){\n printf(\"2\\n\");\n }\n else\n printf(\"1\\n\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,s,i;\n scanf(\"%d\",&a);\n if(a==2)\n printf(\"2\\n\");\n else\n printf(\"1\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\nint n;\nscanf(\"%d\",&n);\n\tif(n==2)\n\t{\n\t\tprintf(\"2\");\n\t}\n\telse\n\t{\n\t\tprintf(\"1\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int i,j,k,l,n,t,d,x;\n scanf(\"%d\",&n);\n if(n!=2)\n {\n printf(\"1\");\n }\n else\n {\n printf(\"2\"); \n }\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint v;\n\tscanf(\"%d\",&v);\n\tif(v==2)\n\t{\n\t\tprintf(\"2\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"1\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n==2){\n printf(\"2\");\n }\n else{\n printf(\"1\");\n }\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,x,y,z;\n scanf(\"%d\",&n);\n for(y=0;y\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n==2){\n printf(\"2\\n\");\n }\n else\n printf(\"1\\n\");\n return 0;\n}\n"}, {"source_code": "#include\nint main() \n{\n long long int n;\n scanf(\"%lli\", &n) ;\n \n if(n==2) \n {\n \tprintf(\"2\\n\") ;\n } \n else \n {\n \t printf(\"1\\n\") ;\n } \n return 0; \n} \n "}, {"source_code": "#include\nint main()\n{\n long long int n;\n scanf(\"%I64d\",&n);\n if(n==2) printf(\"2\");\n else printf(\"1\");\n}"}, {"source_code": "#include\nint main(){\n\tint n;\n\tscanf(\"%d\", &n);\n\tif(n>0&&n!=2)\n\t\tprintf(\"1\");\n\telse if(n==0)\n\t\tprintf(\"0\");\n\telse if(n==2)\n\t\tprintf(\"2\");\n\telse\n\t\tprintf(\"-1\");\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n==2)\n printf(\"2\\n\");\n else\n printf(\"1\\n\");\n}\n"}, {"source_code": "#include \nint main()\n{\nint n;\nscanf(\"%d\",&n);\nif(n!=2)\nprintf(\"1\");\nelse\nprintf(\"2\");\nreturn 0;\n}\n\n\n\n\n"}, {"source_code": "#include \n\nint main(int argc, char **argv)\n{int x;\n\tscanf(\"%d\",&x);\n\tif (x==2){\n\tprintf(\"%d \",2);}\n\telse{\n\tprintf(\"%d \",1);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if((n-1)==1)\n printf(\"%d\\n\",n);\n else\n printf(\"%d\\n\",n-(n-1));\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(void)\n{\n int v;\n scanf(\"%d\", &v);\n if(v==2)\n {\n printf(\"2\");\n }\n else\n {\n printf(\"1\");\n}\nreturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n==2) printf(\"2\");\n else\n printf(\"1\");\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int v;\n scanf(\"%lld\",&v);\n if(v==1)\n printf(\"%d\",1);\n else if(v==2)\n printf(\"%d\",2);\n else if(v>2)\n printf(\"%d\",1);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a;\n scanf(\"%d\",&a);\n if(a==2)\n printf(\"2\\n\");\n else\n printf(\"1\\n\");\n}\n"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n==2){\n printf(\"2\\n\");\n }\n else\n printf(\"1\\n\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n;\n scanf(\"%lld\",&n);\n if(n>2||n==1)\n printf(\"1\");\n else \n printf(\"2\");\n}\n"}, {"source_code": "#include\nint main(){\n int t=0,i=1,n=0;\n scanf(\"%d\",&n);\n if(n>2||n==1)printf(\"%d\",1);\n else printf(\"%d\",n);\n}"}, {"source_code": "#include\nint main()\n{\n int v;\n scanf(\"%d\",&v);\n if(v==2)\n printf(\"2\");\n else\n printf(\"1\");\n return 0;\n}\n"}, {"source_code": "#include \n\nint number;\n\nint main ()\n{\n\t//freopen (\"cf.in\",\"r\",stdin),freopen(\"cf.out\",\"w\",stdout);\n\tscanf (\"%d\",&number);\n\tif (number!=2)\n\tputs (\"1\");\n\telse \n\tputs (\"2\");\n}"}, {"source_code": "#include\nint main()\n{\n int x,n,i,r,s;\n scanf(\"%lld\",&n);\n\n if(n==2)\n {\n printf(\"2\\n\");\n }\n else\n {\n\n printf(\"1\\n\");\n\n\n }\n\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,v=2;\n\tscanf(\"%d\",&n);\n\tif(n==2)\n\t{\n\t\tprintf(\"2\\n\");\n\t}\n\telse printf(\"1\\n\");\n}\n"}], "negative_code": [{"source_code": "#include \n\nint main() {\n long int v,n,i,x;\n scanf(\"%ld\",&v);\n n=v;\n for(i=1;i\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if (n=2){printf(\"2\");}\n else {printf (\"1\");}\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"1\");\n}\n"}, {"source_code": "#include\nint main(){\n\tint n;\n\tscanf(\"%d\", &n);\n\tif(n>0||n==2)\n\t\tprintf(\"1\");\n\telse if(n==0)\n\t\tprintf(\"0\");\n\telse if(n==2)\n\t\tprintf(\"2\");\n\telse\n\t\tprintf(\"-1\");\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main(){\n long long int n,x,s;\n scanf(\"%lld\",&n);\n while(1){\n if(n==1||n==0)break;\n s=n/2;\n n=n-(s+1);\n }\n printf(\"%lld\\n\",n);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,s,i;\n scanf(\"%d\",&a);\n if(i==2)\n printf(\"2\\n\");\n else\n printf(\"1\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"%d\\n\",n-(n-1));\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"%d\\n\",n-(n-1));\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,x,i;\n scanf(\"%d\",&n);\n while(n>2){\n for(i=2;i\nint main() {\n\tint n;\n\tscanf (\"%d\",&n);\nif(n>2){\n\tprintf(\"%d\",n-(n-1));\n}\nif(n==2) {\n\tprintf(\"%d\",2);\n}\n\treturn 0;\n\n}\n"}, {"source_code": "#include\nint main(){\n int a;\nscanf(\"%d\",&a);\nprintf(\"1\");\n}\n"}, {"source_code": "\n#include \n\n\nint main()\n{\n char n[100];\n \n scanf(\"%s\",n);\n if(n==1)\n {\n printf(\"1\");\n }else{\n if((long long int) n %2==0)\n {\n printf(\"1\");\n }else{\n printf(\"2\");\n }}\n \n return 0;\n}\n"}, {"source_code": "\n#include \n\n\nint main()\n{\n char n[100];\n \n scanf(\"%s\",n);\n if(n==1)\n {\n printf(\"1\");\n }else{\n if((long long int) n %2==0)\n {\n printf(\"1\");\n }else{\n printf(\"0\");\n }}\n \n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"1\");\n}"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"1\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(){\n long long int v;\n scanf(\"%lld\", &v);\n if(v>=3)\n printf(\"1\\n\");\n\n return 0;\n}"}, {"source_code": "#include\n\nint main()\n\n{\n int n;\n\n scanf(\"%d\",&n);\n\n printf(\"1\");\n}\n"}, {"source_code": "#include \nint main()\n{\n int v,n;\n scanf(\"%d\",&v);\n n=v-v+1;\n printf(\"%d\",n);\n return 0;\n}"}, {"source_code": "\n#include\nint main(){\nint a;\nscanf(\"%d\",&a);\nif(a!=2){printf(\"1\\n\");}\nelse{printf(\"1\\n\");}\nreturn 0 ;\n}\n"}, {"source_code": "#include \nint main(){\n int test;\n scanf(\"%d\", &test);\n while(test){\n int n,x,y,d, check=1, flag=0, count=0;\n scanf(\"%d %d %d %d\", &n, &x, &y, &d);\n check=x;\n if(x%2!=0 && d%2!=0){\n while(1){\n if(flag==0) x+=d;\n else x-=d;\n if(x>n){\n x=check;\n flag=1;\n count=0;\n continue;\n }\n if(x<=1){\n flag=0;\n }\n count++;\n if(x==y){\n printf(\"%d\\n\", count);\n break;\n }\n\n }\n }\n\n test--;\n }\n return 0;\n}\n"}, {"source_code": "\n#include \n\n\nint main()\n{\n char n[100];\n \n scanf(\"%s\",n);\n if(n==1)\n {\n printf(\"1\");\n }else{\n if((long long int) n %2==0)\n {\n printf(\"1\");\n }else{\n printf(\"0\");\n }}\n \n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int v,n;\n scanf(\"%d\",&v);\n n=v-v+1;\n printf(\"%d\",n);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int v,t,x,y;\n scanf(\"%d\",&v);\n for(x=1;x\nint main ()\n{\n int n;\n scanf(\"%d\",&n);\n if(n==0)\n {\n printf(\"0\\n\");\n\n }\n else if(n>2 || n==1)\n {\n printf(\"1\\n\");\n }\n}\n"}, {"source_code": "#include\nint main()\n{\nint a;\nscanf(\"%d\",&a);\nprintf(\"%d\",1);\nreturn 0;\n}\n"}, {"source_code": "#include \nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tif (n>2){\n\t\tprintf(\"%d\",n-(n-1));\n\t}\n\telse if(n=2){\n\t\tprintf(\"%d\",2);\n\t}\n\telse if (n=1){\n\t\tprintf(\"%d\",1);\n\t}\n\treturn 0;\n}\n\t\n\n\t\t\n"}, {"source_code": "#include\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"%d\\n\",1);\n}"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"1\");\n return 0;\n}\n"}, {"source_code": "#include \nint main() {\n\tint n;\n\tscanf (\"%d\",&n);\n\n\tprintf(\"%d\",n-(n-1));\n\treturn 0;\n\n}\n"}, {"source_code": "#include\nint main(){\n int n;\n scanf(\"%d\",&n);\n printf(\"1\");\n \n \n}"}, {"source_code": "#include \n#include \nint main()\n{\n int l;\n //char s[25];\n scanf(\"%d\",&l);\n //l=strlen(s);\n if(l>2)\n {\n printf(\"1\");\n }\n else\n {\n printf(\"2\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(void) {\n\tint n,i=0;\n\tscanf(\"%d\",&n);\n i=n-(n-1);\n printf(\"%d\",i);\n\treturn 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n long long int v;\n scanf(\"%d\",&v);\n if(v==1)\n printf(\"%d\",1);\n else if(v==2)\n printf(\"%d\",2);\n else\n printf(\"%d\",1);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int v,t,x,y;\n scanf(\"%d\",&v);\n for(x=1;x\n\n\nint main()\n{\n char n[100];\n \n scanf(\"%s\",n);\n if(n==1)\n {\n printf(\"1\");\n }else{\n if( atoi(n) %2==0)\n {\n printf(\"1\");\n }else{\n printf(\"0\");\n }}\n \n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n,i,j;\n scanf(\"%lld\",&n);\n j=n;\n for(i=1;i<=j;i++)\n {\n\n if(n%i!=0)\n {\n n=n-i;\n if(n\n#include\nint main()\n{\n int i,j,k,l,n,t,d,x;\n scanf(\"%d\",&n);\n for(i=1;i\nint main()\n{\n int n,x;\n scanf(\"%d\",&n);\n\n printf(\"%d\\n\",n);\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"1\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n int l;\n //char s[25];\n scanf(\"%d\",&l);\n //l=strlen(s);\n printf(\"1\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,s,i;\n scanf(\"%d\",&a);\n if(a==1||a==2)\n printf(\"1\\n\");\n else\n {\n for(i=2;i\nint main()\n{\n int x,n,i,r,s;\n scanf(\"%d\",&n);\n if(n==1)\n {\n printf(\"1\\n\");\n }\n else\n {\n for(i=2;i<=n;i++)\n {\n if(n%i!=0)\n {\n r=n-i;\n\n }\n }\n if(r%2!=0)\n {\n s=r-(r-1);\n printf(\"%d\\n\",s);\n }\n\n }\n\n}\n"}, {"source_code": "#include \nint main() {\n\tint n;\n\tscanf (\"%d\",&n);\nif(n>2){\n\tprintf(\"%d\",n-(n-1));\n}\nif(n==2) {\n\tprintf(\"%d\",2);\n}\nif(n=1) {\n\tprintf(\"%d\",1);\n}\n\treturn 0;\n\n}\n"}, {"source_code": "#include\nint main(){\n int n;\n scanf(\"%d\",&n);\n printf(\"%d\",1);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,x;\n scanf(\"%d\",&n);\n if(n==1)\n {\n printf(\"%d\\n\",n);\n }\n else\n {\n x=n%(n-1);\n printf(\"%d\\n\",x);\n }\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\nint n,x;\nint i=1;\nint c=0;\nscanf(\"%d\",&n);\nwhile (i<=n)\n{\nif(n%i==0)\n{\n}\nelse\n{\nn=n-i;\nif(n==1)\n{\n}\n}\ni++;\n}\nprintf(\"%d\\n\",n);\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\nint n;\nscanf(\"%d\",&n);\n\tif(n==2)\n\t{\n\t\tprintf(\"0\");\n\t}\n\telse\n\t{\n\t\tprintf(\"1\");\n\t}\n}\n"}, {"source_code": "#include \nint main() \n{ int n; \n scanf(\"%d\",&n); \n printf(\"1\\n\");\n return 0;\n}"}, {"source_code": "#include \n\nint main(void)\n{\n int v;\n scanf(\"%d\", &v);\n \n printf(\"1\");\n\nreturn 0;\n}"}, {"source_code": "#include\nint main() \n{ \n// a program by lepusarcticus - Ashutosh Pande\n// codeforces avito cool challenge 2018\nlong long int n,m;\nscanf(\"%I64d\",&n);\nif (n>=1&&n<=1000000000) //constraints\n{\nfor (m=1;m<=n;m++)\n{\nif (n%m!=0) //divisibility test\n{\nn-=m; // subtracting divisors\n}\n}\nprintf(\"%I64d\",n);\n}\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint t,n;\n\tscanf(\"%d\",&t);\n\twhile(t--)\n\t{\n\t\tscanf(\"%d\",&n);\n\t\tif(n==2)\n\t\t{\n\t\t\tprintf(\"2\");\n\t\t}\n\t\telse \n\t\t{\n\t\t\tprintf(\"1\");\n\t\t}\n\t}\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\nint n,x;\nint i=1;\nint c=0;\nscanf(\"%d\",&n);\nwhile (i<=n)\n{\nif(n%i==0)\n{\n}\nelse\n{\nn=n-i;\nif(n==1)\n{\n}\nif(i==2)\n{\nn=n-1;\n}\n}\ni++;\n}\nprintf(\"%d\\n\",n);\nreturn 0;\n}\n"}, {"source_code": "#include\n\ndivisible(int n,int x){\n if(n%x==0){return 1;}\n else{return 0;}\n}\nint main(){\n long v,n,x;\n scanf(\"%ld\",&v);printf(\"%ld\\n\",v);\n n=v;\n for(long i=1;i<=n;i++){\n if(divisible(n,i)==0){\n x=i;\n }\nif(n-x0){\nn=n-x;}\n}\n printf(\"%ld\",n);\nreturn 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"%d\\n\",n-(n-1));\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,i;\n\t\n\tfor(i=n-1;i>0;i--)\n\t{\n\t\tif((n%i)!=0)\n\t\t{\n\t\t\tprintf(\"%d\",(n-i));\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"%d\",n);\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"1\\n\");\n return 0;\n}\n"}, {"source_code": "#include \"stdio.h\"\n#include \"string.h\"\n\nint main()\n{\n\tint i;\n\tscanf(\"%d\",&i);\n\tprintf(\"1\");\n}"}, {"source_code": "#include\nint main(){\n\tint n;\n\tscanf(\"%d\", &n);\n\tif(n>0)\n\t\tprintf(\"1\");\n\telse if(n==0)\n\t\tprintf(\"0\");\n\telse if(n==2)\n\t\tprintf(\"2\");\n\telse\n\t\tprintf(\"-1\");\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"1\");\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n long long int n,x,s;\n scanf(\"%lld\",&n);\n if(n==2){\n printf(\"%lld\\n\",n);\n return 0;\n }\n while(1){\n if(n==1||n==0)break;\n s=n/2;\n n=n-(s+1);\n }\n printf(\"%lld\\n\",n);\n return 0;\n}\n"}, {"source_code": "#include \n#include\n#include\n#include\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\",&n);\nif(n%2==0){\n printf(\"1\");\n}else{\n printf(\"0\");\n}\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"1\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n int l;\n //char s[25];\n scanf(\"%d\",&l);\n //l=strlen(s);\n printf(\"1\");\n return 0;\n}\n"}, {"source_code": "#include \nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tif (n>2){\n\t\tprintf(\"%d\",n-(n-1));\n\t}\n\telse if(n=2){\n\t\tprintf(\"%d\",1);\n\t}\n\telse if (n=1){\n\t\tprintf(\"%d\",1);\n\t}\n\treturn 0;\n}\n\t\n\n\t\t\n"}, {"source_code": "#include \nint main()\n{\nint n;\nscanf(\"%d\",&n);\nif(n!=2)\nprintf(\"2\");\nelse\nprintf(\"0\");\nreturn 0;\n}\n\n\n\n\n"}, {"source_code": "#include \nint main()\n{\nint n;\nscanf(\"%d\",&n);\nif(n!=2)\nprintf(\"1\");\nelse\nprintf(\"0\");\nreturn 0;\n}\n\n\n\n\n"}, {"source_code": "#include \n\nint main(void)\n{\n int v;\n scanf(\"%d\", &v);\n \n printf(\"1\");\n\nreturn 0;\n}"}, {"source_code": "#include \nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tif (n>2){\n\t\tprintf(\"%d\",n-(n-1));\n\t}\n\telse if(n=2){\n\t\tprintf(\"%d\",1);\n\t}\n\telse if (n=1){\n\t\tprintf(\"%d\",1);\n\t}\n\treturn 0;\n}\n\t\n\n\t\t\n"}, {"source_code": "#include \n#include\n#include\n#include\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\",&n);\n\n printf(\"1\");\n\nreturn 0;\n}\n"}, {"source_code": "\n#include\nint main(){\nint a;\nscanf(\"%d\",&a);\nprintf(\"1\\n\");\nreturn 0 ;\n}\n"}, {"source_code": "#include\nint main(){\n\tint n;\n\tscanf(\"%d\", &n);\n\tif(n>0)\n\t\tprintf(\"1\");\n\telse if(n==0)\n\t\tprintf(\"0\");\n\telse if(n==2)\n\t\tprintf(\"2\");\n\telse\n\t\tprintf(\"-1\");\n\treturn 0;\n}\n"}, {"source_code": "\n#include \n#include\n\nint main()\n{\n char n[100];\n \n scanf(\"%s\",n);\n if(strlen(n)%2==1)\n {\n printf(\"1\");\n }else{\n printf(\"2\");\n }\n \n return 0;\n}\n"}, {"source_code": "#include \n#include\n#include\n#include\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[100000];\nscanf(\"%lld\",&n);\n\n printf(\"1\");\n\nreturn 0;\n}"}, {"source_code": "#include\nint main()\n{\nint n;\nscanf(\"%d\",&n);\n\tif(n==2)\n\t{\n\t\tprintf(\"0\");\n\t}\n\telse\n\t{\n\t\tprintf(\"1\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"%d\\n\",n-(n-1));\n return 0;\n}\n"}, {"source_code": "#include \n\n int main (){\n\tint n;\n\tint x;\n\tscanf(\"%d\",&n);\n\tfor (x=1;x\n\nint main()\n{\n int n,x=1;\n\n scanf(\"%d\",&n);\n\n\n while(1)\n\n {\n\n if(n==1 || n==2)\n {\n printf(\"1\");\n return 0;\n }\n\n\n\n if(n%x==0)\n {\n x++;\n }\n else\n {\n n=n-x;\n x++;\n if(n\nint main()\n{\n int a,b,s,i;\n scanf(\"%d\",&a);\n\n printf(\"1\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a;\n scanf(\"%d\",&a);\n printf(\"1\");\n}"}, {"source_code": "#include\nint main()\n{\n int n,x;\n scanf(\"%d\",&n);\n\n printf(\"%d\\n\",n);\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,x,i;\n scanf(\"%d\",&n);\n while(n>2){\n for(i=2;i\nmain()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tif(n>2)\n\t{\n\tif(n%2==0)\n\tprintf(\"1\\n\");\n\tif(n%2!=0)\n\tprintf(\"2\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"1\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\nint main(){\n\tint n;\n\tscanf(\"%d\", &n);\n\tprintf(\"1\");\n\treturn 0;\n}\n"}, {"source_code": "#include \nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tif (n>2){\n\t\tprintf(\"%d\",n-(n-1));\n\t}\n\telse if(n=2){\n\t\tprintf(\"%d\",1);\n\t}\n\telse if (n=1){\n\t\tprintf(\"%d\",1);\n\t}\n\treturn 0;\n}\n\t\n\n\t\t\n"}, {"source_code": "#include \nint main() {\n\tint n;\n\tscanf (\"%d\",&n);\nif(n>2){\n\tprintf(\"%d\",n-(n-1));\n}\nif(n==2) {\n\tprintf(\"%d\",2);\n}\n\treturn 0;\n\n}\n"}, {"source_code": "#include\nmain()\n{\n\tint n,i=2;\n\tscanf(\"%d\",&n);\n\tif(n>3)\n\t{\n\twhile(1)\n\t{\n\tif(n%i==0){i++;}\n\tif(n%i!=0)\n\t{\n\t\tn=n-i;\n\t\ti++;\n\t\tif(i>=n)\n\t\t{\n\t\t\tprintf(\"%d\\n\",n);\n\t\t\treturn 0;\n\t\t}\n\t}\n\t}\n\t}\n\telse \n\t{printf(\"1\\n\");}\n\treturn 0;\n}"}, {"source_code": "#include\nint main(){\n int t=0,i=1,n=0;\n scanf(\"%d\",&n);\n while(n>1){\n i=1;\n while(i<=n){\n if(n%i!=0)break;\n i++;\n }\n n=n-i;\n }\n if(n<0)\n printf(\"%d\",n+i);\n else printf(\"%d\",n+i);\n}"}, {"source_code": "#include \nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tif (n>2){\n\t\tprintf(\"%d\",n-(n-1));\n\t}\n\telse if(n=2){\n\t\tprintf(\"%d\",2);\n\t}\n\telse if (n=1){\n\t\tprintf(\"%d\",1);\n\t}\n\treturn 0;\n}\n\t\n\n\t\t\n"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n\n /* for(i=2;i\nint main()\n{\n long long int v;\n scanf(\"%d\",&v);\n if(v==1)\n printf(\"1\");\n else if(v==2)\n printf(\"2\");\n else\n printf(\"1\");\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\nint n;\nscanf(\"%d\",&n);\nif(n!=2)\nprintf(\"2\");\nelse\nprintf(\"0\");\nreturn 0;\n}\n\n\n\n\n"}, {"source_code": "\n#include\nint main(){\nint m;\nwhile(scanf(\"%d\",&m)==1){\nprintf(\"1\");}\nreturn 0;}\n"}, {"source_code": "#include\n\nint main(void)\n{\n\n int x;\n scanf(\"%d\",&x);\n\n printf(\"1\");\n\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\nlong int n;\nscanf(\"%ld\",&n);\nprintf(\"11\");\nreturn 0;\n}"}, {"source_code": "#include\nint main()\n{\nint n;\nscanf(\"%d\",&n);\n\tif(n==2)\n\t{\n\t\tprintf(\"0\");\n\t}\n\telse\n\t{\n\t\tprintf(\"1\");\n\t}\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n;\n scanf(\"%lld\",&n);\n if(n>2)\n printf(\"1\");\n else\n printf(\"2\");\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n,d;\n scanf(\"%lld\",&n);\n int i;\n for(i=2;i\n\n\nint main()\n{\n char n[100];\n \n scanf(\"%s\",n);\n if(n==1)\n {\n printf(\"1\");\n }else{\n if((long long int) n %2==0)\n {\n printf(\"1\");\n }else{\n printf(\"0\");\n }}\n \n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"1\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int v;\n scanf(\"%d\",&v);\n if(v==1)\n printf(\"1\");\n else if(v==2)\n printf(\"2\");\n else\n printf(\"1\");\n return 0;\n}\n"}], "src_uid": "c30b372a9cc0df4948dca48ef4c5d80d"} {"nl": {"description": "Little Sofia is in fourth grade. Today in the geometry lesson she learned about segments and squares. On the way home, she decided to draw $$$n$$$ squares in the snow with a side length of $$$1$$$. For simplicity, we assume that Sofia lives on a plane and can draw only segments of length $$$1$$$, parallel to the coordinate axes, with vertices at integer points.In order to draw a segment, Sofia proceeds as follows. If she wants to draw a vertical segment with the coordinates of the ends $$$(x, y)$$$ and $$$(x, y+1)$$$. Then Sofia looks if there is already a drawn segment with the coordinates of the ends $$$(x', y)$$$ and $$$(x', y+1)$$$ for some $$$x'$$$. If such a segment exists, then Sofia quickly draws a new segment, using the old one as a guideline. If there is no such segment, then Sofia has to take a ruler and measure a new segment for a long time. Same thing happens when Sofia wants to draw a horizontal segment, but only now she checks for the existence of a segment with the same coordinates $$$x$$$, $$$x+1$$$ and the differing coordinate $$$y$$$.For example, if Sofia needs to draw one square, she will have to draw two segments using a ruler: After that, she can draw the remaining two segments, using the first two as a guide: If Sofia needs to draw two squares, she will have to draw three segments using a ruler: After that, she can draw the remaining four segments, using the first three as a guide: Sofia is in a hurry, so she wants to minimize the number of segments that she will have to draw with a ruler without a guide. Help her find this minimum number.", "input_spec": "The only line of input contains a single integer $$$n$$$ ($$$1 \\le n \\le 10^{9}$$$), the number of squares that Sofia wants to draw.", "output_spec": "Print single integer, the minimum number of segments that Sofia will have to draw with a ruler without a guide in order to draw $$$n$$$ squares in the manner described above.", "sample_inputs": ["1", "2", "4"], "sample_outputs": ["2", "3", "4"], "notes": null}, "positive_code": [{"source_code": "#include\n\nint main()\n{\n int i,a,x,c,b;\n\n scanf(\"%d\",&a);\n\n for(i=1;;i++)\n if((i*i)>=a)\n {\n x=1;\n break;\n }\n if((i*i)!=a)\n {\n c=a-((i-1)*(i-1));\n if(c>(i-1))\n b=2*(i-1)+2;\n else\n b=2*(i-1)+1;\n }\n else\n b=2*i;\n\n printf(\"%d\\n\",b);\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#define ll long long int\n int main(){\n int n;\n scanf(\"%d\",&n);\n double x=sqrt(n);\n int b=ceil(x),a=floor(x);\n if(a==b)\n printf(\"%d\\n\",2*a);\n else if((n-a*a-a)<=0)\n printf(\"%d\\n\",2*a+1);\n else \n printf(\"%d\\n\",2*a+2);\n \n return 0;\n }\n \n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int a,b,sub,pro;\n scanf(\"%d\",&pro);\n a = 1;\n b = 1;\n while(a*b=pro)\n break;\n b++;\n }\n sub = a + b;\n printf(\"%d\\n\",sub);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int i,segments=n+1;\n for(i=1;i*i<=n;i++)\n {\n if(n%i==0)\n {\n if(segments>i+(n/i)) segments=i+(n/i);\n }\n else\n {\n if(segments>i+(n/i)+1) segments=i+(n/i)+1;\n }\n }\n printf(\"%d\",segments);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main(void)\n{\n\tint n, x, y;\n\t\n\tscanf (\"%d\", &n);\n\t\n\tint root = (int)sqrt(n);\n\tx=y=root;\n\tint tm;\n\t\n\ttm = x*y;\n\tif (tm < n) ++y, tm += x;\n\tif (tm < n) ++x;\n\t\n\tprintf (\"%d\\n\", x+y);\n\t\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n\tdouble n,x,ans;\n\tscanf(\"%lf\",&n);\n x=sqrt(n);\n\tans=ceil(2*x);\n\tprintf(\"%d\\n\",(int)ans);\n\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int s = sqrt((double)n);\n if(n%s==0){\n printf(\"%d\",(int)(s+n/s));\n }\n else{\n printf(\"%d\",(int)(s+n/s+1));\n }\n}"}, {"source_code": "#include\n#include\n\nint main()\n{\n\tint w,h, u1, u2, d1, d2;\n\tscanf(\"%d\",&w);\n\tint r = (int) sqrtl(w+1e-7);\n\tif(r*r == w){\n\t\tprintf(\"%d\",2*r);\n\t}\n\telse{\n\t\t//r += r;\n\t\tu1 = (r+1)*(r+1) - w;\n\t\tu2 = w - r*r;\n\t\t//printf(\"%d %d \", u1, u2);\n\t\tif(u1>u2){\n\t\t\tprintf(\"%d\", r+r+1);\n\t\t}\n\t\telse printf(\"%d\", r+r+2);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nint judge(int x) {\n\tif(sqrt(x)==(int)sqrt(x))return 1;\n\treturn 0;\n}\nint main() {\n\tint n;\n\twhile(scanf(\"%d\",&n)!=EOF) {\n\t\tif(n==1) {\n\t\t\tprintf(\"2\\n\");\n\t\t\tcontinue;\n\t\t}\n\t\tint x=1,y=1;\n\t\twhile(x*yy)y++;\n\t\t\telse x++;\n\t\t}\n\t\tprintf(\"%d\\n\",x+y);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n\tint n;\n\tint ans = 1000000007;\n\tint buf;\n\n\tscanf(\"%d\", &n);\n\n\tfor (int i = 1; i <= sqrt(n); i++)\n\t{\n\t\tbuf = n / i;\n\n\t\tif (n % i != 0)\n\t\t\tbuf++;\n\n\t\tif (ans > i + buf)\n\t\t\tans = i + buf;\n\t}\n\n\tprintf(\"%d\", ans);\n\n\treturn 0;\n}"}, {"source_code": "#include \n#include \nint main()\n{\n\tint mix, n, sq, el, another1, another2;\n\tmix=0;\n\tscanf(\"%d\", &n);\n\tsq=sqrt(n);\n\tel=n-sq*sq;\n\tanother1=el/sq;\n\tanother2=el%sq;\n\tif(another2!=0)\n\t{\n\t\tmix++;\n\t}\n\tmix=mix+2*sq+another1;\n\tprintf(\"%d\\n\", mix);\n\n\n\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n\tint n,y;\n\tdouble l,u,d,x;\n\tscanf(\"%d\",&n);\n\tdouble a=sqrt((double)n);\n\tl=floor(a);\n\tif(l!=a)\n\t{\n\tu=ceil(a);\n d=n-(l*l);\n if(d>l)\n x=2*u;\n else\n x=2*l+1;\n y=(int)x;\n}\nelse\ny=2*a;\nprintf(\"%d\",y);\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \n\n\n int main()\n {\n \tdouble n,p,q;\n \tscanf(\"%lf\",&n);\n \tif(n==1){\n \t\tprintf(\"2\");\n \t}\n \telse if(n==2){\n \t\tprintf(\"3\");\n \t}\n \telse if(n==3){\n \t\tprintf(\"4\");\n \t}\n \telse if(n==4){\n \t\tprintf(\"4\");\n \t}\n \telse{\n \t\tp=sqrt(n);\n \t\tp=ceil(p);\n \t\tq=(p*p);\n \t\tif((q-n)\n#include \n#include \n\nint main(int argc, char const *argv[])\n{\n\tunsigned long long int n,n1;\n\tscanf(\"%I64d\",&n);\n\tn1 = sqrt(n);\n\tif (n == 1)\n\t{\n\t\tprintf(\"2\");\n\t}\n\telse if (n == 2)\n\t{\n\t\tprintf(\"3\");\n\t}\n\telse if (n == 3)\n\t{\n\t\tprintf(\"4\");\n\t}\n\telse\n\t{\n\tif (n == n1 * n1)\n\t{\n\t\tprintf(\"%I64d\",2*n1);\n\t\treturn 0;\n\t}\n\telse\n\t{\n\t n1++;\n\t\tif(n <= n1* (n1-1))\n\t\t{\n\t\t\tprintf(\"%I64d\",2*n1 -1);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"%I64d\",2*n1);\n\t\t}\n\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nint main(){\n int n ; \n scanf(\"%d\",&n);\n int r = sqrt(n);\n if (r*r==n)printf(\"%d\",r*2);\n else if(n>r*r && n<=r*(r+1))printf(\"%d\",2*r+1);\n else if(n>r*(r+1) && n<=(r+1)*(r+1))printf(\"%d\",2*(r+1));\n return 0;}"}, {"source_code": "#include\n#include\nint main(void)\n{\nlong long int n;\nscanf(\"%lld\",&n);\nlong long int root=(int)pow(n,0.5);\nlong long int ans;\nif(pow(root+1,2)-(root+1)>=n)\n{\nans=2*root+1;\n}\nelse\nans=2*root+2;\nif(root*root==n)\nans=ans-1;\nprintf(\"%lld\",ans);\nreturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n\tint n,i=2,set=0,k=4;\n\tscanf(\"%d\",&n);\n\tif(n<4)\n\tprintf(\"%d\",n+1);\n\telse if(n==4)\n\tprintf(\"%d\",n);\n\telse\n\t{\n\t\twhile(pow(i+1,2)<=n)\n\t\t{\n\t\t\ti++;\t\n\t\t}\n\t\tset=2*i;\n\t\tif(n-i*i==0)\n\t\tprintf(\"%d\",set);\n\t\telse if(n-i*i>i)\n\t\tprintf(\"%d\",set+2);\n\t\telse if(n-i*i<=i)\n\t\tprintf(\"%d\",set+1);\n\t\t\n\t\t\n//\t\t\n//\t\tif(n==5||n==6)\n//\t\tprintf(\"5\");\n// else if(n==9)\n// printf(\"6\");\n//\t\telse\n//\t\tprintf(\"%d\",i+1);\n\t\t\n}\n\treturn 0;\n}\n\n"}, {"source_code": "#include\nmain()\n{\n int n,i,a=0,b=0,x=1;\n scanf(\"%d\",&n);\n for(i=1;;i++)\n {\n a=b;\n b=a+i;\n x++;\n if(n>a && n<=b)\n {\n break;\n }\n a=b;\n b=a+i;\n x++;\n if(n>a && n<=b)\n {\n break;\n }\n }\n printf(\"%d\",x);\n}\n"}, {"source_code": "#include\n#include\nint main(){\n int n;\n scanf(\"%d\",&n);\n int root = (int)(ceil(sqrt(n)));\n int output;\n for(int i = 0; root*(root-i) >= n; i++){\n output = root+root-i;\n }\n printf(\"%d\",output);\n}"}, {"source_code": "#include\n\nint main(){\nint a,b,n;\na = b = 1;\nscanf(\"%d\\n\",&n);\nwhile(1){\n if(a*b >= n){\n printf(\"%d\",a+b);break;\n }\n else if(a==b){\n b++;\n }\n else if(a\n#include\nint main()\n{\n long long int n,t=0;\n scanf(\"%lld\",&n);\n t=sqrt((double)(n));\n if(t*t==n)\n printf(\"%lld\",t+t);\n else\n {\n /*if(t>1){*/\n if((n-(t*t))%t==0)\n printf(\"%lld\",t*2+(n-(t*t))/t);\n else\n printf(\"%lld\",t*2+((n-(t*t))/t)+1);\n }\n /*else\n printf(\"%d\",n+1);\n }*/\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n#include \nint main()\n{\n int i,j;\n int n,t;\n int w,h;\n int a[110][3];\n scanf(\"%d\",&w);\n for(i=1;i*i<=w;i++)\n {\n ;\n }\n i=i-1;\n printf(\"%d\",i*2+(w-i*i+i-1)/i);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tlong long n,s,i;\n\tlong long a=1,b=1;\n\t\n\tscanf(\"%I64d\",&n);\n\n\tfor(i=0;;i++)\n\t{\n\t\tif(a*b>=n)\n\t\t{\n\t\t\ts=a+b;\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tif(a\nint main()\n{\n\tint c = 1, k = 1, t = 1;\n\tint n;\n\tscanf(\"%d\", &n);\n\twhile(c * k < n)\n\t{\n\t\tif(t % 2 != 0)\n\t\t{\n\t\t\tc++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tk++;\n\t\t}\n\t\tt++;\n\t}\n\tprintf(\"%d\\n\", c + k);\n\treturn 0;\n } \n"}, {"source_code": "#include\n#include\n\nint n;\nint a, b;\n\nint main()\n{\n scanf(\"%d\",&n);\n a=sqrt(n);\n b=n/a+(n%a!=0);\n printf(\"%d\",a+b);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(void)\n{\n int n,i,j,x,y;\n scanf(\"%d\",&n);\n if(n==1)\n printf(\"2\");\n else if(n==2)\n printf(\"3\");\n else\n {\n x=y=2;\n while(x*y\n#include \n#include \n\nint main()\n{\n int a;\n scanf(\"%d\",&a);\n\n int n=(int)sqrt(a);\n\n if(n*n==a)\n printf(\"%d\\n\",2*n);\n else if(a<=n*n+n)\n printf(\"%d\\n\",2*n+1);\n else\n printf(\"%d\\n\",2*n+2);\n}\n"}, {"source_code": "#include \n\nint SEGMENTS(int k)\n{\nint total , p , required ;\np=2;\ntotal = 1 ;\nwhile(1)\n{\ntotal= total + p/2 ;\nif (k\n#include\nint main()\n{\n int n,x,Rim;\n scanf(\"%d\",&n);\n x=2*sqrt(n);\n if(x==sqrt(n)*2.00)\n {\n Rim=x;\n }\n else\n {\n Rim=x+1;\n }\n printf(\"%d\\n\",Rim);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main(){\nint n,i,j,k,i1,i2;\nscanf(\"%d\",&n);\ni1=0;\ni2=n;\nfor(i=1;i<=n;i++){\n j=n/i;\n if(n%i!=0)\n j=j+1;\n if(abs(i-j)>abs(i1-i2))\n break;\n i1=i;\n i2=j;\n\n}\n\n\nprintf(\"%d\",i1+i2);\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n\ntypedef unsigned long long ll;\ntypedef long double LD;\n\n#define MIN(a,b) ((a)<(b)?(a):(b))\n\n\nint main(void)\n{\n int N;\n int segments,minseg,minmul,mini,mul;\n int sqrtN;\n int i;\n\n\t#if 0\n FILE *fp;\n\t//fp = freopen(\"..\\\\..\\\\1047\\\\C\\\\1047C.TXT\",\"r\",stdin);\n\tfp = freopen(\"1047C.TXT\",\"r\",stdin);\n\tif (fp == NULL)\n {\n printf (\"Cannot open file\\n\\n\");\n exit(0);\n }\n\t#endif\n\n scanf(\"%d\",&N);\n\n sqrtN = sqrt(N) + 1;\n\n minseg = 1000000000;\n\n for (i=1; i<=sqrtN; i++)\n {\n if (N%i == 0)\n {\n mul = N/i;\n }\n else\n {\n mul = N/i + 1;\n }\n\n segments = (i + mul);\n\n if (segments < minseg)\n {\n minseg = segments;\n minmul = mul;\n mini = i;\n }\n }\n\n //printf (\"Minseg = %d, at %d*%d\\n\",minseg,minmul,mini);\n\n printf(\"%d\",minseg);\n\n \n\n}\n"}, {"source_code": "#include \n#include\n#include\n#include\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[100000]={0};\nscanf(\"%lld\",&n);\ncount=1;\nsum=1;\nif(n==1){\n printf(\"2\\n\");\n return 0;\n}\nk=2;\nwhile(1){\n count++;\n f=count*count;\n f-=count;\n //printf(\"%lld %lld %lld %lld\\n\",n,count*count,k,f);\n if(f>=n){\n printf(\"%lld\",k+1);\n return 0;\n }\n \n if(count*count>=n){\n k+=2;\n printf(\"%lld\",k);\n return 0;\n }\n \n k+=2;\n}\n\nreturn 0;\n}"}, {"source_code": "#include\n#include\nmain()\n{\n\tlong int a, x, y;\n\tscanf(\"%ld\", &a);\n\tx=sqrt(a);\n\ty=2*x;\n\tif (x*x!=a)\n\ty++;\n\tif (a>(x*(x+1)))\n\ty++;\n\tprintf(\"%ld\\n\", y);\n\treturn 0;\n}"}, {"source_code": "#include \n\nint max_ans[100000];\n\nint main(){\n int n;\n scanf(\"%d\", &n);\n for (int i = 2; i < 100000; i++) {\n max_ans[i] = i / 2 * (i - i / 2);\n }\n int ans = 2;\n while (n > max_ans[ans]) {\n ans++;\n }\n printf(\"%d\", ans);\n return 0;\n}\n\n"}, {"source_code": "#include \n#include \n\nint main() {\n\tint n, a, m;\n\n\tscanf(\"%d\", &n);\n\ta = sqrt(n);\n\tm = a * 2;\n\tif (a * a >= n)\n\t\tm += 0;\n\telse if (a * (a + 1) >= n)\n\t\tm += 1;\n\telse\n\t\tm += 2;\n\tprintf(\"%d\\n\", m);\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n\tdouble a;\n\tint x, m;\n\tscanf(\"%lf\", &a);\n\tint l = a;\n\tx = sqrt(a);\n\tint p = x;\n\t\n\tfor (int i = x;; i++)\n\t{\n\t\tp = x * i;\n\t\tif (p >= l)\n\t\t{\n\t\t\tm = i + x;\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%d\",m);\n}"}, {"source_code": "#include \n#include \n\nint main() {\n\tint n, x;\n\n\tscanf(\"%d\", &n);\n\tx = ceil(sqrt(n));\n\tprintf(\"%d\\n\", x * (x - 1) >= n ? x + x - 1 : x + x);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n,ans,i,ara[100001];\n scanf(\"%lld\",&n);\n ara[2]=2;\n for(i=3;i<=100000;i++)\n {\n ara[i]=ara[i-1]+i/2;\n }\n for(i=0;; i++)\n {\n if(n==ara[i])\n {\n printf(\"%lld\\n\",i+1);\n break;\n }\n else if(n\n\nint main(void) {\n int x, z, i, j;\n scanf(\"%d\", &x);\n z = 2 * x;\n for (i = 1; i * i <= x; ++i) {\n if (x % i == 0) {\n j = x / i;\n }\n else {\n j = x / i + 1;\n }\n if (i + j < z) {\n z = i + j;\n }\n }\n \n printf(\"%d\", z);\n return 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n\tlong long int s, n, x, y;\n\t\n\tscanf(\"%lld\", &n);\n\t\n\ts=sqrt(n);\n\t\n\tif(s*s == n)\n\t{\n\t\tprintf(\"%lld\", (2*s));\n\t}\n\telse\n\t{\n\t\tx=(s*s)+s;\n\t\t\n\t\tif(n<=x){\n\t\t\tprintf(\"%lld\", (s*2)+1);\n\t\t}\n\t\telse{\n\t\t\tprintf(\"%lld\", (s*2)+2);\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\n#include\n#include\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tint i;\n\ti=sqrt(n);\n\tif(i*i==n)\n\t\tprintf(\"%d\\n\",2*i);\n\telse{\n\t\tfor(int j=i;j=n){\n\t\t\t\tprintf(\"%d\\n\",i+j);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n //Prompting for input\n int squares;\n scanf(\"%i\", &squares);\n\n //Calculating largest square root\n int root = floor(sqrt(squares));\n\n if (squares == root * root)\n printf(\"%i\", root * 2);\n else if (squares <= (root * root) + root)\n printf(\"%i\", root * 2 + 1);\n else\n printf(\"%i\", root * 2 + 2);\n\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint solve(int n)\n{\n int res;\n int tmp = sqrt((double)n);\n if(tmp*tmp==n)\n res = 2*tmp;\n else if(tmp*(tmp+1)>=n)\n res = 2*tmp+1;\n else\n res = 2*tmp+2;\n return res;\n}\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"%d\\n\",solve(n));\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \ntypedef long long ll;\nll MAX = -100000000000;/*1e11*/\nll MIN = 100000000000;\nll MOD = 1000000007 ;\nll longlongoverflow = __LONG_LONG_MAX__ ;\n\nll maxormin2(ll a,ll b,int flag)\n{\n if(flag==1)return a>b?a:b;\n else return aa)\n {\n temp *= a;\n power++;\n }\n return power+1;\n }\n}\n\nll compare(const void *p,const void*q)\n{\n return (*(ll*)p-*(ll*)q);\n}\n\nll merge(ll A[],ll B[],ll l,ll m,ll r)\n{\n ll count = 0;\n ll n1 = m-l+1; \n ll n2 = r-m;\n ll LA[n1],LB[n2],RA[n1],RB[n2] ;\n for(ll i=0;i\nint main()\n{ long long int n,m;\n\tscanf(\"%lld\",&n);\n\tint i,j,p;\n\tm=1;\n\twhile(1)\n\t{\n\t\tif(m*m>=n)\n\t\tbreak;\n\tm++;\n\t}\n\t//Aprintf(\"m=%d\",m);\n\tif(m*m==n)\n\tprintf(\"%lld\\n\",2*m);\n\telse\n\t{\n\t\tp=n-(m-1)*(m-1);\n\t\tif(p<=m-1)\n\t\tprintf(\"%lld\",2*(m-1)+1);\n\t\telse\n\t\tprintf(\"%lld\",2*(m-1)+2);\n\t}\n\t\n}"}, {"source_code": "#include\n#include\nint main()\n{\n\tlong n;\n\tscanf(\"%ld\",&n);\n\tdouble f;\n\tf=sqrt(n);\n\tlong num;\n\tnum=floor(f);\n\tlong count;\n\tcount=2*num;\n\tlong diff;\n\tdiff=n-pow(num,2);\n\tif(diff==0)\n\t{\n\t\tprintf(\"%ld\",count);\n\t}\n\telse if(diff<=num)\n\t{\n\t\tcount++;\n\t\tprintf(\"%ld\",count);\n\t}\n\telse{\n\t\tcount+=2;\n\t\tprintf(\"%ld\",count);\n\t}\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n double x;\n unsigned int n,xx,y,re;\n scanf(\"%d\",&n);\n if(n<1) return 0;\n x=sqrt(n);\n xx=(long long int)x;\n y=n-xx*xx;\n re=xx*2;\n if(y>xx) re+=2;\n if(y<=xx&&y>0) re+=1;\n printf(\"%d\\n\",re);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n\nint main(void)\n{\n int n;\n int d1, d2;\n scanf(\"%d\", &n);\n if(n==1||n==2)\n printf(\"%d\", n+1);\n else\n {\n for(int m=1; m<=n+1; m++)\n {\n if(m%2==0)\n {\n d1 = m/2;\n d2 = m/2;\n int max = d1*d2;\n if(n<=max)\n {\n printf(\"%d\", m);\n break;\n }\n }\n else\n {\n d1=m/2;\n d2=m/2 + 1;\n int max = d1*d2;\n if(n<=max)\n {\n printf(\"%d\", m);\n break;\n }\n }\n }\n }\n}"}, {"source_code": "#include\n#include\nint main()\n{\n\tdouble n,x,ans;\n\tscanf(\"%lf\",&n);\n x=sqrt(n);\n\tans=ceil(2*x);\n\tprintf(\"%d\\n\",(int)ans);\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n#include \n#include \n#include \n\nint main(int argc, char *argv[])\n{\n int n;\n scanf(\"%d\", &n);\n\n int a = floor(sqrt((double)n));\n int b = ceil((double)n / a);\n\n printf(\"%d\\n\", a + b);\n\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n\tlong long int n, cnt=3;\n\tscanf(\"%lld\", &n);\n\tif(n==1)\n\t{\n\t\tprintf(\"2\\n\");\n\t}\n\telse if(n==2)\n\t{\n\t\tprintf(\"3\\n\");\n\t}\n\n\telse\n\t{\n\t\tint sum=2, f=0, q=2, temp=0;\n\t\twhile(1)\n\t\t{\n\t\t\t\n\t\t\tif(sum>=n&&temp\nint vb(int x){\n\tint b;\n\n\t\nif(x%2==1){\n\t\t\tb=(x/2)*((x/2)+1);\n\t\t}\n\t\telse if(x%2==0){\n\t\t\tb=(((x-1)/2)+1)*(((x-1)/2)+1);\n\t\t}\n\t\treturn b;\n\t\n}\nint main(){\n\tint a,b,c,d,e,f,i;\n\tscanf(\"%d\",&a);\n\tfor(i=1;;i++){\n\t\t\n\t\tif(a<=vb(i) && a>=vb(i-1)){\n\t\t\tprintf(\"%d\",i);\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\t\n\t}\n\t\n}"}, {"source_code": "#include \n#include \n#include \ntypedef float fl;\ntypedef char ch;\ntypedef long long ll;\n#define rep(i,a,n) for(i=a;i=a;i--)\n#define repr(i,a,b) for(i=a;i=n)\n\t\t{\n\t\t\tn = i;\n\t\t\tbreak ;\n\t\t}\n }\n\tprintf(\"%d\",n);\n\treturn 0;\n}\n\n"}, {"source_code": "#include\n#define N 100000\nlong long array[N];\nint main(void)\n{\n long long i,ans,number;\n scanf(\"%lld\",&number);\n for(i=1; i=1; i--)\n if(number>=array[i])\n break;\n if(number==array[i])\n ans=2*i;\n else if(number-array[i]>i)\n ans=2*i+2;\n else\n ans=2*i+1;\n printf(\"%lld\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n int ans = 1 + n;\n for(int i = sqrt(n); i > 0; --i) {\n if(ans > i + n / i + (n / i * i != n)) {\n ans = i + n / i + (n / i * i != n);\n }\n }\n printf(\"%d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\nint main()\n{\n double n, a;\n scanf(\"%lf\", &n);\n a = sqrt(n);\n n = ceil(2*a);\n printf(\"%d\\n\", (int)n);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main(){\n int n, i, j;\n scanf(\"%i\", &n);\n i = sqrt(n);\n j = i*i;\n if(n>j+i) printf(\"%i\", 2*i+2);\n else if(n>j && n<= j+i) printf(\"%i\", 2*i+1);\n else printf(\"%i\", 2*i);\n}"}, {"source_code": "#include\nint main(){\n\tlong long int a;\n\twhile(scanf(\"%lld\",&a)!=EOF){\n\t\tlong long int i=1,j=1;\n\t\twhile(i*j\n#include\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint s=sqrt(n);\n\ts=(int)s;\n\tint result=0;\n\tif (s*s==n)\n\tresult=2*s;\n\telse if (n<=s*(s+1))\n\tresult=2*s+1;\n\telse if (n>s*(s+1))\n\tresult=2*(s+1);\n\tprintf(\"%d\\n\",result);\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 \n\nint main()\n{\n int a,b,c;\n scanf(\"%d\",&a);\n if(a==1)\n {\n printf(\"2\");\n }\n else if(a==2)\n {\n printf(\"3\");\n }\n else\n {\n for(int i=4; ;i++)\n {\n b=i/2;\n c=i-b;\n if(a>(b*c)-b && a<=b*c)\n {\n printf(\"%d\",i);\n break;\n }\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,r,x;\n\tscanf(\"%d\",&n);\n\tr=sqrt(n);\n\tif(n%r!=0)\n\tx=n/r+1;\n\telse\n\tx=n/r;\n\tprintf(\"%d\",x+r);\n}"}, {"source_code": "#include \n\nint main(void)\n{\n int n,seg,i,sq1=2,sq2=2;\n scanf(\"%d\",&n);\n if(n<4)\n printf(\"%d\",1+n);\n else if(n==4)\n printf(\"%d\",n);\n else\n {\n for(i=sq1+sq2;(sq1*sq2)\n#include\nint main (void)\n{ double n,x,y;\nscanf(\"%lf\",&n);\nx=sqrt(n);\ny=ceil(2*x);\nprintf(\"%d\\n\",(int )y);\nreturn 0;}\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\n#include\nint main ()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"%d\\n\",(int)ceil(sqrt(n)*2));\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int a;\n scanf(\"%d\",&a);\n if(a==1)\n printf(\"2\");\n else if(a==2)\n printf(\"3\");\n else\n {\n int cnt=2;\n int k=0;\n int sum=4;\n int counter=0;\n for(int i=3;i<=a;i++)\n {\n counter++;\n if(counter==cnt)\n {\n if(k==0)\n {\n k=1;\n sum++;\n counter=0;\n }\n else\n {\n k=0;\n cnt++;\n sum++;\n counter=0; \n }\n \n }\n }\n if(counter!=0)\n printf(\"%d\",sum);\n else\n printf(\"%d\",sum-1);\n }\n return 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n int n,i,sqr;\n scanf(\"%d\",&n);\n sqr=sqrt(n);\n for(i=sqr;i\n#include \n\nint main() {\n int sof;\n scanf(\"%d\", &sof);\n int sq = (int)sqrt(sof);\n if (sq*sq == sof)\n printf(\"%d\\n\", sq * 2);\n else if (sq * (sq + 1) >= sof)\n printf(\"%d\\n\", sq * 2 + 1);\n else\n printf(\"%d\\n\", sq * 2 + 2);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int n,cnt;\n scanf(\"%d\",&n);\n int x=sqrt(n);\n int rem=n-x*x;\n cnt=2*x;\n if(rem)\n {\n x=2*x+1;\n if(rem<=(x/2))\n cnt++;\n else\n cnt+=2;\n }\n printf(\"%d\\n\",cnt);\n return 0; \n}\n"}, {"source_code": "#include\nint main()\n{ int n,i=0;int out=0;\n scanf(\"%d\",&n);\n while(i*i<=n)\n {\n i++;\n }\n out=(2)*(i-1);\n if((n-(i-1)*(i-1))>0)\n out++;\n if((n-(i)*(i-1))>0)\n out++;\n printf(\"%d\\n\",out);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \nmain ()\n{\n unsigned long n,c,k,l ;\n scanf(\"%d\",&n);\n c=round(sqrt(n))*2;\n k=c+1;\n\n if(round(sqrt(n))>= sqrt(n))\n {\n printf(\"%d\",c);\n }\n else if(round(sqrt(n))\n#include \n#include \nmain ()\n{\n unsigned long n,c,k,l ;\n scanf(\"%d\",&n);\n c=round(sqrt(n))*2;\n k=c+1;\n if (round(sqrt(n))==sqrt(n))\n {\n printf(\"%d\",c);\n }\n else if(round(sqrt(n))> sqrt(n))\n {\n printf(\"%d\",c);\n }\n else if(round(sqrt(n))\n#include\nint main()\n{\n long long int x,y,n,ans,cnt=0,c=0;\n scanf(\"%lld\",&n);\n ans=n+1;\n c=sqrt(n);\n y=c;\n while(c*y(c+y))\n ans=c+y;\n printf(\"%lld\\n\",ans);\n\n}\n"}, {"source_code": "#include\nint main ()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tif(n==1)\n\t{\n\t\tprintf(\"2\\n\");\n\t}\n\telse if(n==2)\n\t{\n\t\tprintf(\"3\\n\");\n\t}\n\telse\n\t{\n\t\tint arr[1000000];\n\t\tarr[0]=3;\n\t\tint d=4;\n\t\tfor(int i=1;i<1000000;i++)\n\t\t{\n\t\t\tarr[i]=arr[i-1]+d;\n\t\t\td=d+2;\n\t\t}\n\t\tfor(int i=0;i<1000000;i++)\n\t\t{\n\t\t\tif(n>=arr[i] && n< arr[i+1])\n\t\t\t{\n\t\t\t\tint k=(arr[i+1]-arr[i])/2;\n\t\t\t\tif(n<(arr[i]+k))\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%d\\n\",2*k);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%d\\n\",2*k+1);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\n\t}\n}\n}\n"}, {"source_code": "#include \n#include \nint main(){\n int N;\n scanf(\"%d\",&N);\n int s = round(sqrt(N));\n if (s*s>=N){\n int ans = s+s;\n printf(\"%d\\n\",ans);\n }\n else if (s*(s+1)>=N){\n int ans = s+s+1;\n printf(\"%d\\n\",ans);\n }\n else{\n int ans = s+s+2;\n printf(\"%d\\n\",ans);\n }\n return 0;\n}"}, {"source_code": "#include \n\n#include \n\nint main( void )\n\n{\n\n int i ;\n\n scanf(\"%d\",&i) ;\n\n double d = i*1.0 ;\n\n double root = sqrt( d ) ;\n\n int ans = ceil(2*root) ;\n\n printf(\"%d\\n\",ans) ;\n\n}\n"}, {"source_code": "#include \n#include\n#include\n\nint main(){\n int n,x,lines;\n scanf(\"%d\",&n);\n x=sqrt(n);\n lines=x*2;\n if((n-(x*x))>x){\n lines=lines+2;\n }\n else if((n-(x*x))==0){\n lines=lines;\n }\n else{\n lines=lines+1;\n }\n printf(\"%d\",lines);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nmain(){\n\tlong long int n;\n\tscanf(\"%lld\",&n);\n\tlong long int x,sq;\n\tsq=sqrt(n);\n\tx=ceil(sqrt(n)*2);\n\tprintf(\"%lld\",x);\n}\n"}, {"source_code": "#include \n#include \n#include\nint main()\n{\n\tint x,i,j,s;\n\twhile(scanf(\"%d\",&x)!=EOF){\n\t\tfor(i=1,j=1;;){\n\t\t\ts=i*j;\n\t\t\tif(s>=x){\n\t\t\t\tprintf(\"%d\\n\",i+j);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tif(i==j)i++;\n\t\t\t\telse j++;\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n} \n"}, {"source_code": "#include\n#include\n#include\n#include\nint main()\n{\n int N;\n int n;\n scanf(\"%d\", &N);\n n=sqrt(N);\n if(n*n == N)\n printf(\"%d\\n\", 2*n);\n else if(N <= n*n+n)\n printf(\"%d\\n\", 2*n+1);\n else\n printf(\"%d\\n\", 2*n+2);\n\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n;\n double sq;\n scanf(\"%d\", &n);\n if(n < 3){\n printf(\"%d\", n + 1);\n return 0;\n }\n sq = sqrt(n);\n sq *= 2;\n printf(\"%.0f\", ceil(sq));\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\nint main()\n{\n long int n,i;\n float k;\n scanf(\"%ld\",&n);\n k=sqrt(n);\n i=k;\n if (n==i*i) printf(\"%ld\",2*i);\n else if (n<=i*i+i) printf(\"%ld\",2*i+1);\n else printf(\"%ld\",2*i+2);\n return 0;\n}\n"}, {"source_code": "#include\nint main(void)\n{\n\tunsigned long n,m,i,c;\n\tscanf(\"%lu\",&n);\n\tfor(i=1;i*i=n)\n\t {\n\t\tm=2*i-1;\n }\n\telse m=2*i;\n\tprintf(\"%lu\\n\",m);\nreturn 0;\n}"}, {"source_code": "#include \n#include \nint main(){\n long int n, i, a, b, c;\n scanf(\"%ld\", &n);\n\n a = sqrt(n)/1;\n if(n > a*a && n <= a*(a+1)) printf(\"%ld\", 2*a+1);\n if(n > a*(a+1)) printf(\"%ld\", 2*a+2);\n if(n == a*a)printf(\"%ld\", 2*a);\n return 0;\n}"}, {"source_code": "#include \n#include \n\nint main (){\n\tlong long n, root, dif,cnt;\n\tscanf(\"%lld\", &n);\n\troot = sqrt(n);\n\tdif = n-(root*root);\n\tif(dif==0) cnt = 2*root;\n\telse if(dif<=root) cnt = 2*root+1;\n\telse cnt = 2*root+2;\n\tprintf(\"%lld\\n\" , cnt);\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n\tdouble n,x,ans;\n\tscanf(\"%lf\",&n);\n x=sqrt(n);\n\tans=ceil(2*x);\n\tprintf(\"%d\\n\",(int)ans);\n\n\treturn 0;\n}"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include \n\nint main() {\n\n\tint n;\n\tint i, j;\n\tint temp;\n\tint sum;\n\n\tscanf(\"%d\", &n);\n\n\tif (n <= 3) {\n\t\tprintf(\"%d\", n + 1);\n\t\treturn 0;\n\t}\n\n\tif (n == 4){\n\t\tprintf(\"4\");\n\t return 0;\n}\n\n\telse\n\t{\n\t\tfor (i = 1; ; i++) {\n\t\t\tif (i*i > n) {\n\t\t\t\ttemp = i - 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (i*i == n){\n\t\t\t\tprintf(\"%d\", 4 + 2 * (i - 2));\n\t\t\treturn 0;\n\t\t}\n\t\t\t\n\t\t}\n\t\tsum =temp*temp + temp;\n\t\tif (sum >= n)\n\t\t{\n\t\t\tprintf(\"%d\", 4 + 2*(temp-2)+1);\n\t\t\treturn 0;\n\t\t}\n\t\tsum = temp * temp + 2*temp+1;\n\t\tif (sum >= n) {\n\t\t\tprintf(\"%d\", 4 + 2 * (temp - 2) + 2);\n\t\t\treturn 0;\n\t\t}\n\t}\n\t\n\t\t\n\t\treturn 0;\n\n}\t"}, {"source_code": " #include \n #include \n #include \n \n int main(int argc, char const *argv[])\n {\n \tunsigned long long int n,n1;\n \tscanf(\"%I64d\",&n);\n \tn1 = sqrt(n);\n \tif (n == 1)\n \t{\n \t\tprintf(\"2\");\n \t}\n \telse if (n == 2)\n \t{\n \t\tprintf(\"3\");\n \t}\n \telse if (n == 3)\n \t{\n \t\tprintf(\"4\");\n \t}\n \telse\n \t{\n \tif (n == n1 * n1)\n \t{\n \t\tprintf(\"%I64d\",2*n1);\n \t\treturn 0;\n \t}\n \telse\n \t{\n \t n1++;\n \t\tif(n <= n1* (n1-1))\n \t\t{\n \t\t\tprintf(\"%I64d\",2*n1 -1);\n \t\t}\n \t\telse\n \t\t{\n \t\t\tprintf(\"%I64d\",2*n1);\n \t\t}\n \t}\n \t}\n \treturn 0;\n }"}, {"source_code": "#include \n\nint SEGMENTS(int s)\n{\nint Total , p , quired ;\np=2;\nTotal = 1 ;\nwhile(1)\n{\nTotal= Total + p/2 ;\nif (s\ntypedef long long ll;\nint main()\n{\n ll n,cnt=0;\n scanf(\"%lld\",&n);\n int f=0;\n for(ll nn=1;f==0;nn++)\n {\n ll a=nn*(nn-1);\n ll b=nn*(nn+1);\n if(n>a&&n<=b)\n {\n f=1;\n cnt=nn;\n break;\n }\n }\n ll sq=sqrt(n);\n if(sq*sq==n)\n {\n ll ans=2*sq;\n printf(\"%lld\",ans);\n }\n else if(cnt==sq)\n {\n ll ans=cnt+cnt+1;\n printf(\"%lld\",ans);\n }\n else\n {\n ll ans=cnt+cnt;\n printf(\"%lld\",ans);\n }\n //printf(\"%lld %lld\",cnt,sq);\n return 0;\n}"}, {"source_code": "#include\n#include\n\nint main()\n{\n int n,x,r;\n\n scanf(\"%d\",&n);\n\n x=sqrt(n)*2;\n\n if(x==sqrt(n)*2.00){\n r=x;\n }\n else{\n r=x+1;\n }\n printf(\"%d\\n\",r);\n\n return 0;\n}\n"}, {"source_code": "#include \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\ti = 1;\n\tint r = 2000000000;\n\twhile (i*i <= n)\n\t{\n\t\tj = (n + i - 1)/i;\n\t\tr = min(r, j + i);\n\t\ti++;\n\t}\n\tprintf(\"%d\\n\", r);\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 \n\nint main(void) {\n long long int a=0,b=0,c=0,d=0,flag=1,e,sum,area;\n scanf(\"%I64d\",&e);\n do\n {\n if(flag==1)\n {\n flag=2;\n a++;\n }\n else if(flag==2)\n {\n flag=3;\n b++;\n }\n else if(flag==3)\n {\n flag=4;\n c++;\n }\n else if(flag==4)\n {\n flag=1;\n d++;\n }\n sum=a+b+c+d;\n area=(a+c)*(b+d);\n }while(e>area);\n printf(\"%I64d\\n\",sum);\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \nint main(){\n int n,t1,t2;\n double sq;\n scanf(\"%d\",&n);\n sq=sqrt((double)n);\n t2=(int)sq;\n if(sq==floor(sq)){\n printf(\"%d\",2*t2);\n }\n else{\n t1=t2*(t2+1);\n if(n<=t1){\n printf(\"%d\",(2*t2)+1);\n }\n else{\n printf(\"%d\",2*(t2+1));\n }\n\n }\n return 0;\n\n}\n"}, {"source_code": "#include \n\nint main(void) {\n long long int a=0,b=0,c=0,d=0,flag=1,e,sum,area;\n scanf(\"%I64d\",&e);\n do\n {\n if(flag==1)\n {\n flag=2;\n a++;\n }\n else if(flag==2)\n {\n flag=3;\n b++;\n }\n else if(flag==3)\n {\n flag=4;\n c++;\n }\n else if(flag==4)\n {\n flag=1;\n d++;\n }\n sum=a+b+c+d;\n area=(a+c)*(b+d);\n }while(e>area);\n printf(\"%I64d\\n\",sum);\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \nint main()\n{\n int x,n;\n scanf(\"%d\",&n);\n x=(int)sqrt(n);\n if(n>x*x && n<=x*x+x)printf(\"%d\",2*x+1);\n else if(n>x*x+x)printf(\"%d\",2*x+2);\n else if(n=x*x)printf(\"%d\",2*x);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \nint main()\n{\n int x;\n int n;\n scanf(\"%d\",&n);\n x=(int)sqrt(n);\n if(n>x*x && n<=x*x+x)printf(\"%d\",2*x+1);\n else if(n>x*x+x)printf(\"%d\",2*x+2);\n else if(n=x*x)printf(\"%d\",2*x);\n return 0;\n}\n"}, {"source_code": "#include\n#include \n\nint main(){\n int n;\n scanf(\"%d\", &n);\n int t = (int)ceil(sqrt(n));\n if(n <= (t - 1) * t)\n printf(\"%d\", 2 * t - 1);\n else\n printf(\"%d\", 2 * t);\n}\n"}, {"source_code": "#include\n\n#define mod 998244353\n\nint main(void) {\n int n;\n scanf(\"%d\", &n);\n int d=4;\n if(n == 1) {\n printf(\"2\");\n } else if (n == 2) {\n printf(\"3\");\n } else if (n <= 4) {\n printf(\"4\"); \n } else {\n int r = 2;\n int flag = 1;\n for(int i = 4; i< n; ) {\n d++;\n i += r; \n r += flag;\n flag = 1 - flag; \n }\n printf(\"%d\", d);\n }\n\n\n return 0;\n}\n\n"}, {"source_code": "#include \n\nint main()\n{\n int n,k=2,cnt=3,c=0,p,i;\n scanf(\"%d\",&n);\n if(n==1) \n printf(\"2\");\n else if(n==2) \n printf(\"3\");\n else\n {\n for(i=3;i<=n;)\n { \n \n cnt++;\n c++;\n if(c==2)\n {\n i=i+k;\n k++;\n c=0;}\n else\n i=i+k;\n }\n printf(\"%d\",cnt);\n }\n \n\n return 0;\n}"}, {"source_code": "#include \nint main(void)\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint root=1;\n\twhile(root*root<=n)\n\t{\n\t\troot++;\n\t}\n\troot--;\n\tif(root*root==n)\n\t{\n\t\tprintf(\"%d\\n\",2*root);\n\t}\n\telse if(n<=root*root+root)\n\t{\n\t\tprintf(\"%d\\n\", 2*root+1);\n\t}\n\telse\n\t{\n\t\tprintf(\"%d\\n\", 2*root+2);\n\n\t}\n}"}], "negative_code": [{"source_code": "#include \n#include \n\nint main()\n{\n int a,b,sub,pro;\n scanf(\"%d\",&pro);\n a = 1;\n b = 1;\n while(a*bpro)\n break;\n b++;\n }\n sub = a + b;\n printf(\"%d\\n\",sub);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int a,b,sub,pro;\n scanf(\"%d\",&pro);\n a = 1;\n b = pro;\n sub = a+b;\n for(;a<=pro/2;a++)\n {\n if((pro%a==0)&&(pro/a+a\n#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int i,segments=n+1;\n for(i=1;i*i<=n;i++)\n {\n if(n%i==0&&(i+(n/i))\n#include\nint judge(int x) {\n\tif(sqrt(x)==(int)sqrt(x))return 1;\n\treturn 0;\n}\nint main() {\n\tint n;\n\twhile(scanf(\"%d\",&n)!=EOF) {\n\t\tif(n==1) {\n\t\t\tprintf(\"2\\n\");\n\t\t\tcontinue;\n\t\t}\n\t\tif(judge(n)) printf(\"%d\\n\",2*(int)sqrt(n));\n\t\tif(n&1)printf(\"%d\\n\",n+1);\n\t\tif(n%2==0) {\n\t\t\tint x=sqrt(n);//n=28 5 , 6\n\t\t\tint k=x+1;\n\t\t\tfor (int i=x; i>=0; i--) {\n\t\t\t\tif(i*k++==n) {\n\t\t\t\t\tprintf(\"%d\\n\",i+k-1);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint judge(int x) {\n\tif(sqrt(x)==(int)sqrt(x))return 1;\n\treturn 0;\n}\nint main() {\n\tint n;\n\twhile(scanf(\"%d\",&n)!=EOF) {\n\t\tif(n==1) {\n\t\t\tprintf(\"2\\n\");\n\t\t\tcontinue;\n\t\t}\n\t\telse if(judge(n)) printf(\"%d\\n\",2*(int)sqrt(n));\n\t\telse if(n&1)printf(\"%d\\n\",n+1);\n\t\telse if(n%2==0) {\n\t\t\tint x=sqrt(n);//n=28 5 , 6\n\t\t\tint k=x+1;\n\t\t\tfor (int i=x; i>=0; i--) {\n\t\t\t\tif(i==2){\n\t\t\t\t\tprintf(\"%d\\n\",2+n/2);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif(i*k++==n) {\n\t\t\t\t\tprintf(\"%d\\n\",i+k-1);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint judge(int x) {\n\tif(sqrt(x)==(int)sqrt(x))return 1;\n\treturn 0;\n}\nint main() {\n\tint n;\n\twhile(scanf(\"%d\",&n)!=EOF) {\n\t\tif(n==1) {\n\t\t\tprintf(\"2\\n\");\n\t\t\tcontinue;\n\t\t}\n\t\telse if(judge(n)) printf(\"%d\\n\",2*(int)sqrt(n));\n\t\telse if(n&1)printf(\"%d\\n\",n+1);\n\t\telse if(n%2==0) {\n\t\t\tint x=sqrt(n);\n\t\t\tint k=x+1;\n\t\t\tfor (int i=x; i>=0; i--) {\n\t\t\t\tif(i*k++==n) {\n\t\t\t\t\tprintf(\"%d\\n\",i+k-1);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n\tint n;\n\tint ans = 1000000007;\n\tint buf;\n\n\tscanf(\"%d\", &n);\n\n\tfor (int i = 1; i * i <= n; i++)\n\t{\n\t\tif (n % i == 0)\n\t\t{\n\t\t\tbuf = i + n / i;\n\t\t\tans = ans > buf ? buf : ans;\n\t\t}\n\t}\n\n\tprintf(\"%d\", ans);\n\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n#include \n\nint main(int argc, char const *argv[])\n{\n\tunsigned long long int n,n1;\n\tscanf(\"%I64d\",&n);\n\tn1 = sqrt(n);\n\tif (n == 1)\n\t{\n\t\tprintf(\"2\");\n\t}\n\telse if (n == 2)\n\t{\n\t\tprintf(\"3\");\n\t}\n\telse if (n == 3)\n\t{\n\t\tprintf(\"4\");\n\t}\n\telse\n\t{\n\tif (n == n1 * n1)\n\t{\n\t\tprintf(\"%I64d\",2*n1);\n\t\treturn 0;\n\t}\n\telse\n\t{\n\t\tif(n <= n1* (n1-1))\n\t\t{\n\t\t\tprintf(\"%I64d\",2*n1 -1);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"%I64d\",2*n1);\n\t\t}\n\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n#include \n\nint main(int argc, char const *argv[])\n{\n\tunsigned long long int n,n1;\n\tscanf(\"%I64d\",&n);\n\tn1 = sqrt(n);\n\tn1++;\n\tif (n == 1)\n\t{\n\t\tprintf(\"2\");\n\t}\n\telse if (n == 2)\n\t{\n\t\tprintf(\"3\");\n\t}\n\telse if (n == 3)\n\t{\n\t\tprintf(\"4\");\n\t}\n\telse\n\t{\n\tif (n == n1 * n1)\n\t{\n\t\tprintf(\"%I64d\",2*n1);\n\t\treturn 0;\n\t}\n\telse\n\t{\n\t\tif(n <= n1* (n1-1))\n\t\t{\n\t\t\tprintf(\"%I64d\",2*n1 -1);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"%I64d\",2*n1);\n\t\t}\n\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n#include \n\nint main(int argc, char const *argv[])\n{\n\tunsigned long long int n,n1;\n\tscanf(\"%I64d\",&n);\n\tn1 = sqrt(n);\n\tif (n == n1 * n1)\n\t{\n\t\tprintf(\"%I64d\",2*n1);\n\t\treturn 0;\n\t}\n\telse\n\t{\n\t\tif(n <= n1* (n1-1))\n\t\t{\n\t\t\tprintf(\"%I64d\",2*n1 -1);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"%I64d\",2*n1);\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\nint main(void)\n{\nlong long int n,ans;\nscanf(\"%lld\",&n);\nif(n==1)\nans=2;\nif(n==2)\nans=3;\nif(n==3||n==4)\nans=4;\nif(n>=5)\n{\nif(n%2==0)\nn--;\nans=n-(n-5)/2;\n\n\n}\nprintf(\"%lld\\n\",ans);\n\nreturn 0;\n}\n\n"}, {"source_code": "#include\n#include\nint main(void)\n{\nlong long int n;\nscanf(\"%lld\",&n);\nlong long int root=(int)pow(n,0.5);\nlong long int ans;\nif(pow(root+1,2)-(root+1)>=n)\n{\nans=2*root+1;\n}\nelse\nans=2*root+2;\nif(n==1)\nans=1;\nif(n==4)\nans=4;\nprintf(\"%lld\",ans);\nreturn 0;\n}\n"}, {"source_code": "#include\nint main(void)\n{\nlong long int n,ans;\nscanf(\"%lld\",&n);\nif(n==1)\nans=2;\nif(n==2)\nans=3;\nif(n==3||n==4)\nans=4;\nif(n>=5)\n{\nif(n%2==0)\nn--;\nans=n+(n-5)/2;\n\n\n}\nprintf(\"%lld\\n\",ans);\n\nreturn 0;\n}\n\n"}, {"source_code": "#include\n#include\n\nint main(void)\n{\nlong long int n,ans;\nscanf(\"%lld\",&n);\nif((pow((int)pow(n,0.5)+1,2))-(int)pow(n,0.5)-1>n)\nans=2*(int)pow(n,0.5)+1;\nelse\nans=2*((int)pow(n,0.5)+1);\n\n\nprintf(\"%lld\\n\",ans);\n\nreturn 0;\n}\n\n"}, {"source_code": "#include\n#include\n\nint main(void)\n{\nlong long int n,ans;\nscanf(\"%lld\",&n);\nif(n==1)\nans=2;\nelse if(n==2)\nans=3;\nelse\n{\nif((pow((int)pow(n,0.5)+1,2))-(int)pow(n,0.5)-1>n)\nans=2*(int)pow(n,0.5)+1;\nelse\nans=2*((int)pow(n,0.5)+1);\n\n\nprintf(\"%lld\\n\",ans);\n}\nreturn 0;\n}\n\n"}, {"source_code": "#include\n#include\nint main(void)\n{\nlong long int n;\nscanf(\"%lld\",&n);\nlong long int root=(int)pow(n,0.5);\nlong long int ans;\nif(pow(root+1,2)-(root+1)>=n)\n{\nans=2*root+1;\n}\nelse\nans=2*root+2;\nif(n==1)\nans=2;\nif(n==4)\nans=4;\nprintf(\"%lld\",ans);\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,i,sum=0;\n\tscanf(\"%d\",&n);\n\tif(n<4)\n\tprintf(\"%d\",n+1);\n\telse if(n==4)\n\tprintf(\"%d\",n);\n\telse\n\t{\n\t\tfor(i=2;sum<=n;i++)\n\t\t{\n\t\t\tsum=sum+i;\n\t\t\t\n\t\t}\n\t\tif(n==5||n==6)\n\t\tprintf(\"5\");\n else if(n==9)\n printf(\"6\");\n\t\telse\n\t\tprintf(\"%d\",i+1);\n\t\t\n}\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nmain()\n{\n int n,a,c;\n float b;\n scanf(\"%d\",&n);\n b=sqrt(n);\n a=b;\n if(a==b)\n {\n printf(\"%d\",2*a);\n }\n else\n {\n c=a+1;\n if(n=pow(c,2)-a)\n {\n printf(\"%d\",2*c);\n }\n else\n {\n printf(\"%d\",2*c-1);\n }\n }\n}\n"}, {"source_code": "#include\n#include\nmain()\n{\n int n,a,c;\n float b;\n scanf(\"%d\",&n);\n b=sqrt(n);\n a=b;\n if(a==b)\n {\n printf(\"%d\",2*a);\n }\n else\n {\n c=a+1;\n if(n>a*a && n<=a*a+a)\n {\n printf(\"%d\",2*a+1);\n }\n else\n {\n printf(\"%d\",2*a+2);\n }\n }\n}\n"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n>1)\n printf(\"%d\",n/2+2+n%2);\n else\n printf(\"2\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n==1)\n printf(\"2\");\n else if(n==2)\n printf(\"3\");\n else\n printf(\"%d\",n);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n>1)\n printf(\"%d\",((n-1)/2)+3);\n else\n printf(\"2\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"%d\",n/2+2);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(void)\n{\n int n,i,j;\n scanf(\"%d\",&n);\n if(n==1)\n printf(\"2\");\n else if(n==2)\n printf(\"3\");\n else\n {\n if(n%2!=0)\n n++;\n for(i=4,j=4;i<=n;i+=2,j++);\n printf(\"%d\",--j);\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nint SEGMENTS(int k)\n{\nint total , p , required ;\np=2;\ntotal = 1 ;\nwhile(1)\n{\ntotal= total + p/2 ;\nif (k\n\nint SEGMENTS(int k)\n{\nint total , p , required ;\np=2;\ntotal = 1 ;\nwhile(1)\n{\ntotal= total + p/2 ;\nif (k\n#include\n#include\n#include\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[100000]={0};\nscanf(\"%lld\",&n);\ncount=1;\nsum=1;\nif(n==1){\n printf(\"2\\n\");\n return 0;\n}\nk=2;\nwhile(1){\n count++;\n f=count*count;\n f-=count;\n \n if(f>=n){\n printf(\"%lld\",k+1);\n return 0;\n }\n if(count*count<=n){\n k+=2;\n printf(\"%lld\",k);\n return 0;\n }\n \n k+=2;\n}\n\nreturn 0;\n}"}, {"source_code": "#include \n#include\n#include\n#include\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,flag1=0,o1=0,o2=0,b1,x,m,l,max,sum2,min,f,c,r,o,sum1,sum=0,y,a[500][500],b,count1=0,a2[500]={0},b2[500]={0};\n\nscanf(\"%lld\",&n);\nif(n==1 || n==2){\n printf(\"2\");\n}else{\n i=2;\nwhile(i*i\n#include\n#include\n#include\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,flag1=0,o1=0,o2=0,b1,x,m,l,max,sum2,min,f,c,r,o,sum1,sum=0,y,a[500][500],b,count1=0,a2[500]={0},b2[500]={0};\n\nscanf(\"%lld\",&n);\nflag=flag1=0;\nfor(i=0;i\n#include\n#include\n#include\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,flag1=0,o1=0,o2=0,b1,x,m,l,max,sum2,min,f,c,r,o,sum1,sum=0,y,a[500][500],b,count1=0,a2[500]={0},b2[500]={0};\n\nscanf(\"%lld\",&n);\nif(n==1 || n==2){\n printf(\"%lld\",n+1);\n}else{\n i=2;\nwhile(i*i\n\n#define min(A, B) ((A) < (B) ? (A) : (B))\n\nint main() {\n\tint n;\n\n\tscanf(\"%d\", &n);\n\tprintf(\"%d\\n\", min(n + 1, ((n + 1) / 2) + 2));\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n,ans,i,ara[100001];\n scanf(\"%lld\",&n);\n ara[1]=2;\n for(i=2;i<=100000;i++)\n {\n ara[i]=ara[i-1]+i/2;\n }\n for(i=0;;i++)\n {\n if(n==ara[i])\n {\n printf(\"%lld\\n\",i+1);\n break;\n }\n else if(n\nint main()\n{\n long long int n,ans;\n scanf(\"%lld\",&n);\n if(n<=3)\n ans=n+1;\n else\n {\n if(n%2==0)\n {\n ans=4+(n-4)/2;\n }\n else\n {\n ans=4+(n+1-4)/2;\n }\n }\n printf(\"%lld\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(void) {\n int x, z, i, j;\n scanf(\"%d\", &x);\n z = 2 * x;\n for (i = 1; i * i <= x; ++i) {\n if (x % i == 0) {\n j = x / i;\n if (i + j < z) {\n z = i + j;\n }\n }\n }\n printf(\"%d\", z);\n return 0;\n}"}, {"source_code": "#include \n#include \nint solve(int n)\n{\n int res;\n int tmp = sqrt((double)n);\n for(int i = tmp; i >= 1; i--)\n if(n%i==0)\n {\n res = n/i + i;\n break;\n }\n\n return res;\n}\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"%d\\n\",solve(n));\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n char s[222];\n int n;\n scanf(\"%s\",s);\n scanf(\"%d\",&n);\n int len = strlen(s);\n int low = len,high = len,m = len;\n for(int i = 0;i < len;i++)\n {\n if(s[i]=='?') {low += 1;m--;}\n if(s[i]=='*') {high = 10000;m--;}\n }\n low = m-low;\n if(high!=10000) high = m;\n printf(\"%d %d %d\\n\",low,high,n);\n if(n>high || nm)\n {\n int flag = 0;\n for(int i = 0;i < len-1;i++)\n {\n if(s[i]!='?' && s[i]!='*')\n {\n if(s[i+1]=='*')\n {\n if(flag==0)\n {\n for(int j = 0;j < n-m;j++) printf(\"%c\",s[i]);\n flag = 1;\n }\n }\n else printf(\"%c\",s[i]);\n }\n }\n if(s[len-1]!='?' && s[len-1]!='*') printf(\"%c\",s[len-1]);\n printf(\"\\n\");\n }\n else\n {\n int flag = m-n;\n for(int i = 0;i < len-1;i++)\n {\n if(s[i]!='?' && s[i]!='*')\n {\n if(s[i+1]=='?'&&flag>0) flag --;\n else printf(\"%c\",s[i]);\n }\n }\n if(s[len-1]!='?' && s[len-1]!='*') printf(\"%c\",s[len-1]);\n printf(\"\\n\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n char s[222];\n int n;\n scanf(\"%s\",s);\n scanf(\"%d\",&n);\n int len = strlen(s);\n int low = len,high = len,m = len;\n for(int i = 0;i < len;i++)\n {\n if(s[i]=='?') {low += 1;m--;}\n if(s[i]=='*') {high = 10000;m--;}\n }\n low = m-low;\n if(high!=10000) high = m;\n //printf(\"%d %d %d\\n\",low,high,n);\n if(n>high || nm)\n {\n int flag = 0;\n for(int i = 0;i < len-1;i++)\n {\n if(s[i]!='?' && s[i]!='*')\n {\n if(s[i+1]=='*')\n {\n if(flag==0)\n {\n for(int j = 0;j < n-m;j++) printf(\"%c\",s[i]);\n flag = 1;\n }\n }\n else printf(\"%c\",s[i]);\n }\n }\n if(s[len-1]!='?' && s[len-1]!='*') printf(\"%c\",s[len-1]);\n printf(\"\\n\");\n }\n else\n {\n int flag = m-n;\n for(int i = 0;i < len-1;i++)\n {\n if(s[i]!='?' && s[i]!='*')\n {\n if(s[i+1]=='?'&&flag>0) flag --;\n else printf(\"%c\",s[i]);\n }\n }\n if(s[len-1]!='?' && s[len-1]!='*') printf(\"%c\",s[len-1]);\n printf(\"\\n\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main(void)\n{\n int n;\n scanf(\"%d\", &n);\n if(n==1||n==2)\n printf(\"%d\", n+1);\n else\n printf(\"%d\", n);\n}"}, {"source_code": "#include \nint main()\n{\n\tlong long int n;\n\tscanf(\"%lld\", &n);\n\tif(n==1)\n\t{\n\t\tprintf(\"2\\n\");\n\t}\n\telse if(n==2)\n\t{\n\t\tprintf(\"3\\n\");\n\t}\n\telse if(n==3)\n\t{\n\t\tprintf(\"4\\n\");\n\t}\n\telse if(n==4)\n\t{\n\t\tprintf(\"4\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"%lld\\n\", 4+(n-3)/2);\n\t}\n}"}, {"source_code": "#include \nint main()\n{\n\tlong long int n, cnt=3;\n\tscanf(\"%lld\", &n);\n\tif(n==1)\n\t{\n\t\tprintf(\"2\\n\");\n\t}\n\telse if(n==2)\n\t{\n\t\tprintf(\"3\\n\");\n\t}\n\n\telse\n\t{\n\t\tint sum=2, f=0, q=2, temp=0;\n\t\twhile(1)\n\t\t{\n\t\t\tif(sum>=n&&temp\n#include \n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n int m = sqrt(n);\n printf(\"%d\\n\", m + n / m + (m * m != n));\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n int m = sqrt(n);\n printf(\"%d\\n\", m + m + (m * m != n));\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n if(n == (int)sqrt(n) * (int)sqrt(n)) {\n printf(\"%d\", ((int)sqrt(n)) * 2);\n return 0;\n }\n for(int i = sqrt(n); i > 0; --i) {\n if(n % i == 0) {\n int ans = i + n / i;\n if(ans > ((int)sqrt(n) + 1) * 2) {\n ans = ((int)sqrt(n) + 1) * 2;\n }\n printf(\"%d\\n\", ans);\n break;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n if(n == 2) {\n printf(\"%d\\n\", 3);\n } else {\n int m = sqrt(n);\n printf(\"%d\\n\", m + n / m + (m * m != n));\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n for(int i = sqrt(n); i > 0; --i) {\n if(n % i == 0) {\n printf(\"%d\\n\", i + n / i);\n break;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n\tint a;\n\twhile(scanf(\"%d\",&a)!=EOF){\n\t\tint sum=3;\n\t\tif(a==1){\n\t\t\tprintf(\"1\\n\");\n\t\t}\n\t\telse if(a==2){\n\t\t\tprintf(\"3\\n\");\n\t\t}\n\t\telse{\n\t\t\tprintf(\"%d\\n\",(a-2)/2+sum);\n\t\t}\n\t}\n}\n"}, {"source_code": "#include \n\nint main(void)\n{\n int n,seg,i,sq1=2,sq2=2;\n scanf(\"%d\",&n);\n if(n<4)\n printf(\"%d\",1+n);\n else if(n==4)\n printf(\"%d\",n);\n else\n {\n for(i=sq1+sq2;(sq1*sq2)\n\nint main(void)\n{\n int n,seg,i,sq1=2,sq2=2;\n scanf(\"%d\",&n);\n if(n<4)\n printf(\"%d\",1+n);\n else if(n==4)\n printf(\"%d\",n);\n else\n {\n for(i=4;(sq1*sq2)\nint main()\n{\n int n,a,min,i;\n scanf(\"%d\",&n);\n min=n+1;\n for(i=1;i\nint main()\n{\n int n,a,min,i;\n scanf(\"%d\",&n);\n min=n+1;\n for(i=1;i\nint main()\n{\n int n,a,min,i=1;\n scanf(\"%d\",&n);\n min=n+1;\n for(i=i;i\nint main()\n{\n int n,a,min,i;\n scanf(\"%d\",&n);\n min=n+1;\n for(i=1;i<=n;i++)\n {\n if(n%i==0)\n {\n a=n/i;\n min=min<=a+i?min:a+i;\n }\n }\n printf(\"%d\",min);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \nmain ()\n{\n double n,c,k,l ;\n scanf(\"%lf\",&n);\n c=round(sqrt(n))*2;\n k=c+1;\n if (round(sqrt(n))==sqrt(n))\n {\n printf(\"%lf\",c);\n }\n else if(round(sqrt(n))> sqrt(n))\n {\n printf(\"%lf\",c);\n }\n else if(round(sqrt(n))\nint main ()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tif(n==1)\n\t{\n\t\tprintf(\"2\\n\");\n\t}\n\telse if(n==2)\n\t{\n\t\tprintf(\"3\\n\");\n\t}\n\telse\n\t{\n\t\tif(n%2!=0)\n\t\t{\n\t\t\tprintf(\"%d\\n\",(n/2 +3));\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"%d\\n\",((n-1)/2 +3));\n\t\t}\n\t}\n}\n"}, {"source_code": "#include \n\nint main(){\n int N;\n scanf(\"%d\",&N);\n int count = 2;\n if (N==1){\n printf(\"%d\\n\",count);\n return 0;\n }\n count = 3;\n for (int i=2;i<=N;i++){\n if (i%2==0){\n continue;\n }\n else{\n count++;\n }\n }\n printf(\"%d\\n\",count);\n return 0;\n}"}, {"source_code": "#include \n\n#include \n\nint main( void )\n\n{\n\n int i ;\n\n scanf(\"%d\",&i) ;\n\n double d = i*1.0 ;\n\n double root = sqrt( d ) ;\n\n int ans = ceil(2*root) ;\n\n printf(\"%.0lf\\n\",ceil(2*sqrt(i*1.0))) ;\n\n}\n"}, {"source_code": "#include \n\n#include \n\nint main( void )\n\n{\n\n int i ;\n\n scanf(\"%d\",&i) ;\n\n double d = i*1.0 ;\n\n double root = sqrt( d ) ;\n\n int ans = ceil(2*root) ;\n\n printf(\"%.0lf\\n\",ceil(2*root)) ;\n\n}\n"}, {"source_code": "#include \n\n#include \n\nint main( void )\n\n{\n\n double n ;\n\n scanf(\"%lf\",&n) ;\n\n printf(\"%.0lf\\n\",ceil(2.0*sqrt(n))) ;\n\n return 0 ;\n\n}\n"}, {"source_code": "#include \n\n#include \n\n#define LL long long \n\nint main( void )\n\n{\n \n LL n ;\n \n scanf(\"%lld\",&n) ;\n \n printf(\"%lld\\n\",2*ceil(sqrt(n))) ;\n \n return 0 ;\n \n}"}, {"source_code": "#include \n\n#include \n\nint main( void )\n\n{\n\n double n ;\n\n scanf(\"%lf\",&n) ;\n\n printf(\"%.0lf\\n\",2.0*ceil(sqrt(n))) ;\n\n return 0 ;\n\n}\n"}, {"source_code": "#include \n\n#include \n\nint main( void )\n\n{\n\n double n ;\n\n scanf(\"%lf\",&n) ;\n\n n = sqrt(n) ;\n \n n = 2*n ;\n \n n = ceil( n ) ;\n \n printf(\"%.0lf\\n\",n) ;\n\n return 0 ;\n\n}\n"}, {"source_code": "#include \n#include\n#include\n\nint main(){\n int n,x,lines;\n scanf(\"%d\",&n);\n x=sqrt(n);\n lines=x*2;\n if(n-(x*x)>x){\n lines=lines+2;\n }\n if(n-(x*x)==0){\n lines=lines;\n }\n else{\n lines=lines+1;\n }\n printf(\"%d\",lines);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include\nint main()\n{\n\tint x,i,s;\n\twhile(scanf(\"%d\",&x)!=EOF){\n\t\tfor(i=1;;i++){\n\t\t\ts=i*i;\n\t\t\tif(s==x){\n\t\t\t\tprintf(\"%d\\n\",2*i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if(s>x){\n\t\t\t\tprintf(\"%d\\n\",2*i-1);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n} \n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n, l = 3;\n scanf(\"%d\", &n);\n if(n < 3){\n printf(\"%d\", n + 1);\n return 0;\n }\n for(int i = 2; i < n; i += 2){\n l++;\n }\n printf(\"%d\", l);\n return 0;\n}\n"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include \n\nint main() {\n\t\n\tint n;\n\n\tscanf(\"%d\", &n);\n\n\tif (n <= 3)\n\t\tprintf(\"%d\", n + 1);\n\telse\n\t\tprintf(\"%d\", n);\n\treturn 0;\n\n}\t"}, {"source_code": "#include \n#include \n#include \n\nint main(int argc, char const *argv[])\n{\n\tunsigned long long int n,n1;\n\tscanf(\"%I64d\",&n);\n\tn1 = sqrt(n);\n\tn1++;\n\tif (n == 1)\n\t{\n\t\tprintf(\"2\");\n\t}\n\telse if (n == 2)\n\t{\n\t\tprintf(\"3\");\n\t}\n\telse if (n == 3)\n\t{\n\t\tprintf(\"4\");\n\t}\n\telse\n\t{\n\tif (n == n1 * n1)\n\t{\n\t\tprintf(\"%I64d\",2*n1);\n\t\treturn 0;\n\t}\n\telse\n\t{\n\t\tif(n <= n1* (n1-1))\n\t\t{\n\t\t\tprintf(\"%I64d\",2*n1 -1);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"%I64d\",2*n1);\n\t\t}\n\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n==1)\n printf(\"2\");\n else if(n==2)\n printf(\"3\");\n else\n {\n int tmp=(n+1)/2;\n int nn=tmp-2;\n int ans=nn+4;\n printf(\"%d\",ans);\n }\n return 0;\n}"}, {"source_code": "#include\n#include\n\nint main()\n{\n double n;\n\n scanf(\"%lf\",&n);\n\n printf(\"%.0lf\\n\",ceil(sqrt(n)*2.00));\n\n return 0;\n}\n"}, {"source_code": "#include \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\ti = 1;\n\tint r = 2000000000;\n\twhile (i*i <= n)\n\t{\n\t\tif (n%i == 0)\n\t\t{\n\t\t\tj = n/i;\n\t\t\tr = min(r, j + i);\n\t\t}\n\t\ti++;\n\t}\n\tprintf(\"%d\\n\", r);\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 \n#include \n#include \nint main()\n{\n int x,n;\n scanf(\"%d\",&n);\n x=(int)sqrt(n);\n (n>x*x+x)?printf(\"%d\",2*x+2):(n=x*x)?printf(\"%d\",2*x):printf(\"%d\",2*x+1);\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \nint main()\n{\n int x,n;\n scanf(\"%d\",&n);\n x=(int)sqrt(n);\n (n>x*x && n<=x*x+x)?printf(\"%d\",2*x+1):(n=x*x)?printf(\"%d\",2*x):printf(\"%d\",2*x+2);\n return 0;\n}\n"}, {"source_code": "#include\n\n#define mod 998244353\n\nint main(void) {\n int n;\n scanf(\"%d\", &n);\n int d=4;\n if(n == 1) {\n printf(\"2\");\n } else if (n <= 3) {\n printf(\"3\");\n } else if (n == 4) {\n printf(\"4\"); \n } else {\n int r = 2;\n int flag = 1;\n for(int i = 4; i< n; ) {\n d++;\n i += r; \n r += flag;\n flag = 1 - flag; \n }\n printf(\"%d\", d);\n }\n\n\n return 0;\n}\n\n"}, {"source_code": "#include \n\nint main()\n{\n int n,k=2,cnt=3,c=0,p,i;\n scanf(\"%d\",&n);\n if(n==1) \n printf(\"2\");\n else if(n==2) \n printf(\"3\");\n else\n {\n for(i=3;i<=n;i=i+k)\n { \n p=cnt;\n cnt++;\n if(cnt>p)\n c++;\n if(c==2)\n {k++;\n c=0;}\n }\n printf(\"%d\",cnt);\n }\n \n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int n,k=2,cnt=3,c=0,p,i;\n scanf(\"%d\",&n);\n if(n==1) \n printf(\"2\");\n else if(n==2) \n printf(\"3\");\n else\n {\n for(i=3;i<=n;i=i+k)\n { \n p=cnt;\n cnt++;\n if(cnt>p)\n c++;\n if(c==k)\n {k++;\n c=0;}\n }\n printf(\"%d\",cnt);\n }\n \n\n return 0;\n}\n"}], "src_uid": "eb8212aec951f8f69b084446da73eaf7"} {"nl": {"description": "On the planet Mars a year lasts exactly n days (there are no leap years on Mars). But Martians have the same weeks as earthlings — 5 work days and then 2 days off. Your task is to determine the minimum possible and the maximum possible number of days off per year on Mars.", "input_spec": "The first line of the input contains a positive integer n (1 ≤ n ≤ 1 000 000) — the number of days in a year on Mars.", "output_spec": "Print two integers — the minimum possible and the maximum possible number of days off per year on Mars.", "sample_inputs": ["14", "2"], "sample_outputs": ["4 4", "0 2"], "notes": "NoteIn the first sample there are 14 days in a year on Mars, and therefore independently of the day a year starts with there will be exactly 4 days off .In the second sample there are only 2 days in a year on Mars, and they can both be either work days or days off."}, "positive_code": [{"source_code": "#include \n\nint main ()\n{\n int min=0, max=0, days, i;\n scanf(\"%i\",&days);\n for(i=0;i4)\n min++;\n for(i=0;i\n#include\n\nint main()\n{\n int n, min, max;\n scanf(\"%i\", &n);\n\n if(n>=7)\n {\n max = ((n/7)*2);\n if(n%7 > 2){\n // printf(\"el numero es %i \\n\", (n%7));\n max+= 2;\n }\n else\n max += n%7;\n\n\n min = ((n/7)*2) + ((n%7)/6);\n }\n\n if(n<7)\n {\n max = n == 1 ? 1 : 2;\n min = n/6;\n }\n\n printf(\"%i %i\", min, max);\n}\n"}, {"source_code": "#include\nint main(){\n int n,min,max,r,q;\nscanf(\"%d\",&n);\nq=n/7;\nr=n%7;\nif(r>=2){\nmax=q*2+2;\n}\nif(r==6){\n min=q*2+1;\n}\nif(r>=2 && r!=6){\n min=2*q+0;\n}\nif(r==1){\n min=2*q+0;\n max=2*q+1;\n}\nif(r==0){\n max=2*q;\n min=max;\n}\nprintf(\"%d %d\",min,max);\nreturn 0;\n}\n"}, {"source_code": "#include\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tif(n%7==0){\n\t\tprintf(\"%d %d\",2*(n/7),2*(n/7));\n\t}else if(n%7<=2){\n\t\tprintf(\"%d %d\",2*(n/7),2*(n/7)+n%7);\n\t}else if(n%7<=5){\n\t\tprintf(\"%d %d\",2*(n/7),2*(n/7)+2);\n\t}else{\n\t\tprintf(\"%d %d\",2*(n/7)+1,2*(n/7)+2);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n\n\nint main(){\n\tunsigned int n;\n\tunsigned int min;\n\tunsigned int max;\n\tscanf(\"%u\",&n);\n\tmin=n/7*2;\n\tif(n%7>=2){\n\t\tmax=2;\n\t\tif(n%7==6){\n\t\t\tmin++;\n\t\t\tmax--;\n\t\t}\n\t}else{\n\t\tmax=n%7;\n\t}\n\tprintf(\"%u %u\",min,min+max);\n\t\n}\n"}, {"source_code": "#include\n\nint main(){\nint n, min, max, temp;\nscanf(\"%d\", &n);\nmin=(n/7)*2;\ntemp=n%7;\nif(temp!=0){\n\tif(temp==1){\n\t\tmax=min+1;\n\t\tmin=min;\n\t}\n\t\n\telse if(temp==6){\n\t\tmax=min+2;\n\t\tmin=min+1;\n\t}\n\t\n\telse{\n\t\tmin=min;\n\t\tmax=min+2;\n\t}\n}\nelse{\n\tmax=min;\n}\nprintf(\"%d %d\",min,max);\n}\n\n\n"}, {"source_code": "#include\nmain()\n{\n\nint n,min,max,p,q;\nscanf(\"%d\",&n);\n\nif(n<2)\n{\n min=0;\n max=n;\n\n}\nelse if(n%7==6)\n{\n p=n/7;\nq=(n-2)/7;\nmin=p*2+1;\nmax=2+q*2;\n\n}\nelse if(n%7==1)\n{\n p=n/7;\nq=(n-2)/7;\nmin=p*2;\nmax=2+q*2+1;\n}\nelse{\n p=n/7;\nq=(n-2)/7;\nmin=p*2;\nmax=2+q*2;\n\n}\nprintf(\"%d %d\",min,max);\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,s,r,p;\n scanf(\"%d\",&n);\n s=n%7;\n r=n/7;\n p=r*2;\n if(n==0){\n printf(\"0 0\");\n }\n else if(n==1){\n printf(\"0 1\");\n }\n else if(n<=5&&n!=1){\n printf(\"0 2\");\n }\n else if(n==6){\n printf(\"1 2\");\n }\n else if(s==0){\n printf(\"%d %d\",p,p);\n }\n else if (s==1){\n printf(\"%d %d\",p,p+1);\n }\n else if(s<6&&s!=1){\n printf(\"%d %d\",p,p+2);\n }\n else if(s==6){\n printf(\"%d %d\",p+1,p+2);\n }\n return 0;}\n"}, {"source_code": "#include\nint main(){\n long int n,max,min,m;\n scanf(\"%ld\",&n);\n m=(n/7)*2;\n min=m;\n n=n%7;\n if(n%7>2){\n if(n==6){\n min=m+1;\n }\n max=m+2;\n }\n else {\n max=m+n%7;\n }\n printf(\"%ld %ld\",min,max);\n}"}, {"source_code": "#include \n// ko co nam nhuan\n// tuan 7 ngay 2 ngay nghi\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint min,max;\n\tmin=n/7*2;\n\tmax=n/7*2;\n\t// TH dac biet:\n\tif(n%7!=0)\n\t{\n\t\tif( n%7-5>0 ){\n\t\t\tmin=min+n%7-5;\n\t\t}\n\t\t\n\t\tif( n%7<=2 ){\n\t\t\tmax=max+n%7;\n\t\t}\n\t\telse{\n\t\t\tmax=max+2;\n\t\t}\n\t}\n\tprintf(\"%d %d\",min,max);\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main ()\n{\n int min=0, max=0, days, i;\n scanf(\"%i\",&days);\n for(i=0;i4)\n min++;\n for(i=0;i\nint main(){\n\tint n;\n\tscanf(\"%d\", &n);\n\tint max, min;\n\tint r=n%7, s=n/7;\n\tif(r==1) {\n\t\tmin=s*2;\n\t\tmax=2*s+1;\n\t}\n\telse if(r==6){\n\t\tmin=2*s+1;\n\t\tmax=2*s+2;\n\t}\n\telse if(r==0){\n\t\tmin=2*s;\n\t\tmax=min;\n\t}\n\telse{\n\t\tmin=2*s;\n\t\tmax=2*s+2;\n\t}\n\tprintf(\"%d %d\", min, max);\n}"}, {"source_code": "#include\nint ngaynghitoithieu(int n){\n\tint t=n/7;\n\tint k=n%7;\n\tif(k==6) printf(\"%d \",2*t+1);\n\telse printf(\"%d \",2*t);\n}\nint ngaynghitoida(int n){\n\tint t=n/7;\n\tint k=n%7;\n\tif(k==1) printf(\"%d\",2*t+1);\n\telse if(k==0) printf(\"%d\",2*t);\n\telse printf(\"%d\",2*t+2);\n}\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tngaynghitoithieu(n);\n\tngaynghitoida(n);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,i,max=0,min=0,p=0;\n scanf(\"%d\",&n);\n \n if(n<=5){\n printf(\"0 \");\n if(n<=1){printf(\"%d\",n);}\n else if(n>1){printf(\"2\");}\n }\n else{\n for(i=0;;i++)\n {p=p+5;\n if(n-7*i<0){break;}\n if(p+2<=n){p=p+2;min=min+2;}\n else{if(n-p==1){min++;}}\n if(n-7*i>=2){max=max+2;continue;}\n else if(n-7*i==1){max++;}\n }\n //if(n%7==0){printf(\"%d\",n/7);}\n {printf(\"%d\",min);}\n printf(\" %d\",max);}\n}"}, {"source_code": "#include\n\nint main(){\n\tint t;\n\tscanf(\"%d\",&t);\n\tprintf(\"%d %d\",t%7==6?2*(t/7)+1:2*(t/7),t%7>2?2*(t/7)+2:2*(t/7)+t%7);\n\treturn 0;\n}"}, {"source_code": "#include\nint main (){\n\tint n;\n\tscanf (\"%d\",&n);\n\tif (n%7==0) printf (\"%d %d\",2*n/7,2*n/7);\n else if (n<7&&n>5) printf (\"1 2\");\n\telse {\n\t\t if (n%7==1)\n\t printf (\"%d %d\",(n/7)*2,((n/7)+1)*2-1);\n\t else if (n%7<6) printf (\"%d %d\",(n/7)*2,((n/7)+1)*2);\n\t else if (n%7<7) printf (\"%d %d\",(n/7)*2+1,((n/7)+1)*2);\n\t }\n\treturn 0 ;\n\t}\n"}, {"source_code": "#include\nint main()\n{\nint n;\nscanf(\"%d\",&n);\nint b=n/7;\nint c=n%7;\nint max=2*b;\nint min=2*b;\nif(c==1)\nmax=max+1;\nif(c==2)\nmax=max+2;\nif(c==3)\nmax=max+2;\nif(c==4)\nmax=max+2;\nif(c==5)\n{\nmax=max+2;\n}\nif(c==6)\n{\nmax=max+2;\nmin=min+1;\n}\nprintf(\"%d %d\",min,max);\nreturn 0;\n}\n"}, {"source_code": "#include\n\nint main(){\n\n long long int n,i,j,a1,a2,a3,b1,b2=0,b3=0;\n \n scanf(\"%I64d\",&n);\n \n a1=n/7;\n a2=n%7;\n \n b1=a1*2;\n \n if(a2==1) b2=1;\n if(a2>=2 && a2<=6) b2=2;\n if(a2==6) b3=1;\n if(a2==0) b2=0;\n printf(\"%I64d %I64d\",b1+b3,b1+b2);\n}"}, {"source_code": "#include\nint main(void)\n{\n long long int days, x, y, min, max;\n scanf(\"%lld\", &days);\n if(days > 1)\n {\n x = days%7;\n y = days/7;\n if(x != 0 && x < 6 && x >1)\n {\n max = y*2 + 2;\n min = y*2;\n }\n else if(x != 0 && x==6)\n {\n max = y*2 + 2;\n min = y*2 + 1;\n }\n else if(x != 0 && x==1)\n {\n max = y*2 + 1;\n min = y*2;\n }\n else\n {\n max = y*2;\n min = y*2;\n }\n }\n else\n {\n max = days;\n min = 0;\n }\n printf(\"%lld %lld\", min, max);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,min,max;\n\tscanf(\"%d\",&n);\n\tif(n%7==1)\n\t{\n\t\tmin=(n/7)*2;\n\t\tmax=min+1;\t\n\t}\n\telse if(n%7==0)\n\t{\n\t\tmin=(n/7)*2;\n\t\tmax=(n/7)*2;\n\t}\n\telse if(n%7==6)\n\t{\n\t\tmin=(n/7)*2+1;\n\t\tmax=min+1;\n\t}\n\telse\n\t{\n\t\tmin=(n/7)*2;\n\t\tmax=min+2;\n\t}\n\tprintf(\"%d %d\",min,max);\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n long long int i,j,k,l,m,n,max=0,min=0;\n //printf(\"enter the number\\n\");\n scanf(\"%lld\",&n);\n if(n%7==0) min=max=(n/7)*2;\n else {\n l=n/7;\n m=n%7;l=l*2;\n min=l;\n if(m==6) min++;\n if(m>1) l=l+2;\n else l++;\n max=l;\n }\n printf(\"%lld %lld\",min,max);\n}\n"}, {"source_code": "#include\n\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tint tuan=n/7;\n\tif(n%7==6)\n\t\tprintf(\"%d \",2*tuan+1);\n\telse\n\t\tprintf(\"%d \",2*tuan);\n\tif(n%7==1)\n\t\tprintf(\"%d\",2*tuan+1);\n\telse if(n%7>=2)\n\t\tprintf(\"%d\",2*tuan+2);\n\telse\n\t\tprintf(\"%d\",2*tuan);\n\treturn 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n unsigned int n, max, min;\n scanf(\"%u\", &n);\n max = (n / 7) * 2;\n min = max;\n if(n % 7 > 1){ max += 2; }\n else{ max += n % 7; }\n if(n % 7 == 6){ min++; }\n printf(\"%u %u\", min, max);\n return 0;\n}\n"}, {"source_code": "#include \nint n,q;\nint main()\n{\n scanf(\"%d\",&n);\n if(n<6 && n>=2)\n printf(\"0 2\");\n else if(n==6)\n printf(\"1 2\");\n else if(n==1)\n printf(\"0 1\");\n else if(n>=7)\n {\n q=n%7;\n if(q<6)\n printf(\"%d\\n\",n/7*2);\n else if(q==6)\n printf(\"%d\\n\",n/7*2+1);\n if(q<3)\n printf(\"%d\\n\",n/7*2+q);\n else if(q>=3)\n printf(\"%d\\n\",n/7*2+2);\n }\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,a,b,c,d,e,f;\n scanf(\"%d\",&n);\n if(n%7==0)\n {\n a=(n/7)*2;\n printf(\"%d %d\",a,a);\n }\n else if(n%7!=0)\n {\n if((n+1)%7==0) {\n b=(((n/7)*2)+1);\n c=(((n/7)*2)+2);\n }\n\n //b=(n/7)*2;\n else if((n-1)%7==0) {\n b=(n/7)*2;\n c=b+1;\n }\n else if((n-2)%7==0) {\n b=(n/7)*2;\n c=b+2;\n }\n else {\n b=(n/7)*2;\n c=b+2;\n }\n printf(\"%d %d\",b,c);\n }\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int x;\n int week;\n int flag = 1;\n int holiday = 0;\n scanf(\"%d\",&x);\n\n week = x / 7;\n x = x % 7;\n if(x > 1 && x <= 5){\n printf(\"%d\\t\",0 + (week * 2));\n printf(\"%d\",2 + (week * 2));\n }\n else if(x == 1){\n printf(\"%d\\t\",0 + (week * 2));\n printf(\"%d\",1 + (week * 2));\n }\n else if(x == 6){\n printf(\"%d\\t\",1 + (week * 2));\n printf(\"%d\",2 + (week * 2));\n }\n else{\n printf(\"%d\\t\",0 + (week * 2));\n printf(\"%d\",0 + (week * 2));\n }\n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n long n, m;\n scanf(\"%d\", &n);\n m=n%7;\n if(m==0)\n printf(\"%d %d\", (n/7)*2, (n/7)*2);\n else if(m==1)\n printf(\"%d %d\", ((n-1)/7)*2, ((n-1)/7)*2+1);\n else if(m==6)\n printf(\"%d %d\", ((n-6)/7)*2+1, ((n-6)/7)*2+2);\n else\n printf(\"%d %d\", ((n-m)/7)*2, ((n-m)/7)*2+2);\n}"}, {"source_code": "#include\nint main()\n{\nint n,a,b,min,max;\nscanf(\"%d\",&n);\na=n/7;\nb=n%7;\nmin=a*2;\nmax=a*2;\nif(b<=5)\nmin=min;\nif(b==6)\nmin=min+1;\nif(b==1)\nmax=max+1;\nelse if(b>1 && b<=6)\nmax=max+2;\nprintf(\"%d %d\",min,max);\nreturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int n, max, min;\n scanf(\"%d\", &n);\n min = (n/7)*2 + (n%7<6 ? 0 : (7-n%7));\n max = (n/7)*2 + (n%7 > 2 ? 2 : n%7);\n printf(\"%d %d\\n\", min, max);\n\n return 0;\n}\n"}, {"source_code": "#include \n\n\n\nint main (){\nint a=0,b=0,n=0,min=0,max=0;\n\n\nscanf(\"%d\",&n);\n\nb=n/7;\na=n%7;\n\nswitch (a){\n case 1:\nmin=0;\nmax=1;\n break;\n case 2:\nmin=0;\nmax=2; \n break; \n case 3:\nmin=0;\nmax=2; \n break;\n case 4:\nmin=0;\nmax=2; \n break;\n case 5:\nmin=0;\nmax=2; \n break; \n case 6:\nmin=1;\nmax=2; \n \n break;\n case 0:\nmin=2;\nmax=2; \n break;\n}\n\nif (b==0){\nmin=min+2*(b);\nmax=max+2*(b);\n}\nelse if(a!=0){\nmin=min+2*b;\nmax=max+2*b;\n}\nelse {\nmin=min+2*(b-1);\nmax=max+2*(b-1);\n}\n\nprintf(\"%d\\n%d\\n\",min,max);\n\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long n,r,x,d,y;\n scanf(\"%lld\",&n);\n if(n%7==0)\n {\n r=(n/7)*2;\n y=r;\n }\n else\n {\n x=n/7;\n d=n%7;\n if(d>=2&&d<6)\n {\n r=(x*2)+2;\n y=x*2;\n }\n else if(d>=6)\n {\n r=(x*2)+2;\n y=(x*2)+(7-d);\n\n }\n else if(d<2)\n {\n r=(x*2)+d;\n y=x*2;\n }\n }\n printf(\"%lld %lld\",y,r);\n return 0;\n }\n"}, {"source_code": "#include\nint main()\n{\n int n,m,a,b,r,q;\n scanf(\"%d\",&n);\n a=n/7;\n if(n%7==0){\n printf(\"%d %d\",a*2,a*2);\n }\n else if(n%7==6){\n printf(\"%d %d\",(a+1)*2-1,(a+1)*2);\n }\n else if(n%7==1)\n printf(\"%d %d\",a*2,(a+1)*2-1);\n\n else\n printf(\"%d %d\",(a*2),(a+1)*2);\n\n\n return 0;\n\n\n}\n"}, {"source_code": "#include\"Stdio.h\"\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tif(n%7==0){\n\t\tprintf(\"%d %d\",(n/7)*2,(n/7)*2);\n\t}\n\telse{\n\t\tint r=n%7;\n\t\tif(r==1){\n\t\t\tprintf(\"%d %d\",(n/7)*2,1+(n/7)*2);\n\t\t}\n\t\telse if(r>=2 && r<=5){\n\t\t\tprintf(\"%d %d\",(n/7)*2,2+(n/7)*2);\n\t\t}\n\t\telse printf(\"%d %d\",(n/7)*2+1,2+(n/7)*2);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\n\nint main(void)\n\n{\n long n;\n long mn,mx;\n \n scanf(\"%ld\",&n);\n if((n/7)>=1){\n if(n%7==0){\n mn=2*(n/7);\n mx=mn;\n }\n else if(n%7==1){\n mn=2*(n/7);\n mx=mn+1;\n }\n else if(n%7>=2 && n%7<=5){\n mn=2*(n/7);\n mx=mn+2;\n }\n else if(n%7==6){\n mn=2*(n/7)+1;\n mx=mn+1;\n }\n }\n else{\n if(n%7==0 || n%7==1){\n mn=0;\n mx=mn+n;\n }\n else if(n%7>=2 && n%7<=5){\n mn=0;\n mx=mn+2;\n }\n else if(n%7==6){\n mn=1;\n mx=mn+1;\n }\n }\n printf(\"%ld %ld\",mn, mx);\n return 0;\n \n}"}, {"source_code": "#include\nint main()\n{\n\tint n,min,max;\n\tscanf(\"%d\",&n);\n\tif(n%7==1)\n\t{\n\t\tmin=(n/7)*2;\n\t\tmax=min+1;\t\n\t}\n\telse if(n%7==0)\n\t{\n\t\tmin=(n/7)*2;\n\t\tmax=(n/7)*2;\n\t}\n\telse if(n%7==6)\n\t{\n\t\tmin=(n/7)*2+1;\n\t\tmax=min+1;\n\t}\n\telse\n\t{\n\t\tmin=(n/7)*2;\n\t\tmax=min+2;\n\t}\n\tprintf(\"%d %d\",min,max);\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main ()\n{\n int min=0, max=0, days, i;\n scanf(\"%i\",&days);\n for(i=0;i4)\n min++;\n for(i=0;i\nint main()\n{\n\tint n,a,b,c,min,max;\n\tscanf(\"%d\",&n);\n\t\n\tif(n%7==0)\n\t{\n\t\ta=n/7;\n\t\tb=a*2;\n\t\tprintf(\"%d %d\",b,b);\n\t\t\n\t}\n\telse\n\t{\n\t\ta=n/7;\n\t\tb=n%7;\n\t\tif (b==6)\n\t\t{\n\t\t\tc=a*2;\n\t\t max=c+2;\n\t\t min=c+1;\n\t\t printf(\"%d %d\",min,max);\n }\n\t else if(b<=5 & b!=1)\n {\n \tc=a*2;\n \tmax=c+2;\n \tmin=c;\n \tprintf(\"%d %d\",min,max);\n\t }\n\t else if(b==1)\n\t {\n\t \tc=a*2;\n\t \tmin=c;\n\t \tmax=c+1;\n\t \tprintf(\"%d %d\",min,max);\n\t\t }\n\t}\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int a,b,c,n,w,counter,min,max;\n\n scanf(\"%d\",&n);\n\n if(n % 7 == 6)\n {\n min = ((n / 7) * 2) + 1;\n }\n else\n {\n min = (n / 7) * 2;\n }\n\n if(n % 7 == 0)\n {\n max = (n / 7) * 2;\n }\n else if(n % 7 >= 2)\n {\n max = ((n / 7) * 2) + 2;\n }\n else\n {\n max = (n / 7) * 2 + 1;\n }\n\n printf(\"%d %d\\n\",min,max);\n\n\n}\n"}, {"source_code": "#include\n\nint main()\n{\n long long n,t;\n register long long min,max;\n scanf(\"%I64d\",&n);\n t=n/7;\n min=t*2;\n max=min;\n if((n+1)%7==0)\n min++;\n if(n%7==1)\n max++;\n\n\n if(n%7>=2)\n max+=2;\n printf(\"%I64d %I64d\\n\",min,max);\n return 0;\n}\n\n\n"}, {"source_code": "#include\nint main()\n{\n\tint n,x;\n\tscanf(\"%d\",&n);\n\tx=(n/7)*2;\n\tif(n%7==0){\n\tprintf(\"%d %d\",x,x);\n\t}\n\telse if(n%7!=0 && n<7&&n!=1&&n!=6){\n\t\tprintf(\"%d %d\",0,2);\n\t}\n\telse if(n%7!=0&&n<7&&n==1){\n\t\tprintf(\"%d %d\",0,1);\n\t}\n\telse if(n%7!=0&&n<7&&n==6){\n\t\tprintf(\"%d %d\",1,2);\n\t}\n\telse if(n%7!=0 && n>7&&n%7!=1&&n%7!=6){\n\t\tprintf(\"%d %d\",x,x+2);\n\t}\n\telse if(n%7!=0&&n>7&&n%7==1){\n\t\tprintf(\"%d %d\",x,x+1);\n\t}\n\telse if(n%7!=0&&n>7&&n%7==6){\n\t\tprintf(\"%d %d\",x+1,x+2);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \nint main ()\n{\n long n,i,sum=0;\n scanf(\"%li\",&n);\n if(n<7)\n { if(n==6)\n {\n printf(\"1 2\");\n return 0;\n }\n if(n==1)\n {\n printf(\"%d %d\",0,1);\n return 0;\n }if(n>1)\n {printf(\"%d %d\",0,2);\n return 0;}\n\n }\n if(n%7==0)\n {\n printf(\"%d %d\",n*2/7,n*2/7);\n return 0;\n }\n else\n {\n for(i=1;;i++)\n {\n n=n-7;\n if(n<7)break;\n }\n if(n==1)\n {\n printf(\"%d %d\",i*2,i*2+1);\n return 0;\n }\n if(n==6)\n {\n printf(\"%d %d\",i*2+1,i*2+2);\n return 0;\n }\n else {printf(\"%d %d\",i*2,i*2+2);\n return 0;}\n\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n long long int n;\n scanf(\"%lld\",&n);\n long long int min,max;\n min=2*(n/7);\n if(n%7==6)\n {\n min+=1;\n }\n if(n%7>=2)\n {\n max=2*(n/7)+2;\n }\n else{\n max=2*(n/7)+n%7;\n }\n printf(\"%lld %lld\",min,max);\n return 0;\n}\n"}, {"source_code": "#include \nint main(){\n\tlong long int n;scanf(\"%I64d\",&n);\n\tif(n%7==0){\n\t\tprintf(\"%I64d %I64d\",(n/7)*2,(n/7)*2);\n\t}\n\telse{\n\t\tif(n%7==6){\n\t\t\tprintf(\"%I64d\",(n/7)*2+1);\n\t\t\tprintf(\" %I64d\",(n/7)*2+2);\n\t\t}\n\t\telse if(n%7>=2){\n\t\t\tprintf(\"%I64d\",(n/7)*2);//min\n\t\t\tprintf(\" %I64d\",(n/7)*2+2);//max\n\t\t}\n\t\telse{\n\t\t\tprintf(\"%I64d\",(n/7)*2);\n\t\t\tprintf(\" %I64d\",((n/7)*2)+(n%7));\n\t\t}\n\t}\n}\n"}, {"source_code": "#include\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tif(n%7==0){\n\t\tprintf(\"%d %d\",2*(n/7),2*(n/7));\n\t}else if(n%7<=2){\n\t\tprintf(\"%d %d\",2*(n/7),2*(n/7)+n%7);\n\t}else if(n%7<=5){\n\t\tprintf(\"%d %d\",2*(n/7),2*(n/7)+2);\n\t}else{\n\t\tprintf(\"%d %d\",2*(n/7)+1,2*(n/7)+2);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n long int n ;\n scanf(\"%ld\",&n) ;\n if(n%7==0)printf(\"%d %d\",(n/7)*2,(n/7)*2) ;\n else if(n%7==1)printf(\"%d %d\",(n/7)*2,(n/7)*2+1) ;\n else if(n%7==6)printf(\"%d %d\",(n/7)*2+1,(n/7)*2+2) ;\n else printf(\"%d %d\",(n/7)*2,(n/7)*2+2) ;\n return 0 ;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n long n;\n scanf(\"%ld\", &n);\n if (n % 7 == 6) printf(\"%ld \", n / 7 * 2 + 1);\n else printf(\"%ld \", n / 7 * 2);\n if (n % 7 == 0) printf(\"%ld\\n\", n / 7 * 2);\n else if (n % 7 == 1) printf(\"%ld\\n\", n / 7 * 2 + 1);\n else printf(\"%ld\\n\", n / 7 * 2 + 2);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main(){\n\n int input,rem,min,max;\n\n scanf(\"%d\",&input);\n\n \n rem=input%7;\n\n if (rem==6){\n\n min=(input/7)*2+1;\n max=(input/7)*2+2;\n\n printf(\"%d %d\",min,max);\n }\n\n else if (rem==1){\n min= (input/7)*2;\n max=(input/7)*2+1;\n\n printf(\"%d %d\",min,max);\n }\n\n else if (rem==0){\n min= (input/7)*2;\n max=(input/7)*2;\n\n printf(\"%d %d\",min,max);\n }\n\n else if (rem>1 && rem <6){\n\n min=(input/7)*2;\n max=(input/7)*2+2;\n\n printf(\"%d %d\",min,max);\n }\n // printf(\"%d\",rem);\n\n\n \n\n}\n"}, {"source_code": "#include\n\n\nint main()\n{\n\nlong long days,max,min;\nscanf(\"%lld\",&days);\n\nmin=(days/7)*2;\nif(days%7==6){min=(days/7)*2+1;}\n\nif(days%7==0){max=min;}\nelse if(days%7==1){max=(days/7)*2+1;}\nelse if(days%7>=2){max=(days/7)*2+2;}\nprintf(\"%lld %lld\",min,max);\nreturn 0;\n}\n"}, {"source_code": "#include\n\t\n\tint main(){\n\tint n,x;\n\tscanf(\"%d\", &n);\n\t\n\tif (n!=6 &&1=7 ; i++){\n\t\tn=n-7;\n\t\tif (n==6){\n\t\t\tprintf(\"%d %d\", i*2+1, i*2+2);\n\t\t}\n\t\telse if(n<7 && n<=2){\n\t\t\t\n\t\t\t\tprintf(\"%d %d\", i*2 , 2*i+n);\n\n\t\t}\n\t\telse if(n<7 && n>2){\n\t\t\t\n\t\t\t\tprintf(\"%d %d\", i*2, 2*i+2);\n\t\t\t\n\t\t}\n\t\t\n\t\n\t}\n}"}, {"source_code": "#include\n\nint main()\n{\n long long int n;\n int max,min;\n scanf(\"%I64d\",&n);\n min=(n/7)*2;\n if(n%7==6)\n min++;\n if(n%7==1)\n max=(2*(n/7))+1;\n else if(n%7==0)\n max=min;\n else\n max=(2*(n/7))+2;\n printf(\"%d %d\",min,max);\n return 0;\n}\n"}, {"source_code": "#include\n\nstruct n{\n int x;\n struct n *next;\n}*head;\n\nint main()\n{\n head=(struct n *)malloc(sizeof(struct n));\n head->x=0;\n head->next=(struct n *)malloc(sizeof(struct n));\n head->next->x=0;\n long n, a;\n scanf(\"%d\", &n);\n for(long i=1; i<=n; i++)\n {\n a=i%7;\n if(a==1 || a==2)\n head->next->x++;\n\n if(a==6 || a==0)\n head->x++;\n }\n printf(\"%d %d\", head->x, head->next->x);\n}"}, {"source_code": "#include\n#include\nint main()\n{\n int n,i,a,b;\n scanf(\"%d\",&n);\n a=n/7*2;\n b=n/7*2;\n if(n%7==1)a=a+1;\n else if(n%7>=2)a=a+2;\n if(n%7==6)b++;\n\n printf(\"%d %d\",b,a);\n\n return 0;\n}\n"}, {"source_code": "#include\n\nint main(){\n\n int input,rem,min,max;\n\n scanf(\"%d\",&input);\n\n if (1<=input && input<=1000000){\n\n rem=input%7;\n\n if (rem==6){\n\n min=(input/7)*2+1;\n max=(input/7)*2+2;\n\n printf(\"%d %d\",min,max);\n }\n\n else if (rem==1){\n min= (input/7)*2;\n max=(input/7)*2+1;\n\n printf(\"%d %d\",min,max);\n }\n\n else if (rem==0){\n min= (input/7)*2;\n max=(input/7)*2;\n\n printf(\"%d %d\",min,max);\n }\n\n else if (rem>1 && rem <6){\n\n min=(input/7)*2;\n max=(input/7)*2+2;\n\n printf(\"%d %d\",min,max);\n }\n // printf(\"%d\",rem);\n\n\n }\n\n else {\n return 0;\n }\n\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n\n int x,a,b;\n scanf(\"%d\",&x);\n if(x<7){\n if(x<=5)\n a=0;\n else\n a=1;\n if(x<2)\n b=1;\n else\n b=2;\n }\n else if(x%7==0){\n a=(x/7)*2;\n b=((x/7)*2);\n }\n else if( x%7!=0){\n if(x%7<6){\n a=(x/7)*2;\n if(x%7==1)\n b=((x/7)*2)+1;\n else\n b=((x/7)*2)+2;\n\n }\n else\n {\n a=((x/7)*2)+1;\n b=((x/7)*2)+2;\n }\n\n }\n printf(\"%d %d\\n\",a,b);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n;\n int min, max, rem;\n scanf(\"%d\", &n);\n rem =n % 7;\n max = min = 2 * (n/7);\n if(rem == 1){\n max =min + 1;\n } else if (rem>=2 && rem<6){\n max = min + 2;\n }else if(rem == 6){\n min += 1;\n max += 2;\n }\n printf(\"%d %d\\n\", min, max);\n return 0;\n}"}, {"source_code": "#include \n\nint main(){\n\tint n,min,max;\n\tscanf(\"%d\",&n);\n\tif(n%7==6){\n\t\tmin=(n/7)*2+1;\n\t}\n\telse {\n\t\tmin=(n/7)*2;\n\t}\n\tif(n%7==1){\n\t\tmax=min+1;\n\t}\n\telse if(n%7>=2){\n\t\tif(n%7==6){\n\t\t\tmax=min+1;\n\t\t}\n\t\telse{\n\t\t\tmax=min+2;\n\t\t}\n\t}\n\telse {\n\t\tmax=min;\n\t}\n\tprintf(\"%d %d\",min,max);\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint main(){\n\tint t;\n\tscanf(\"%d\",&t);\n\tprintf(\"%d %d\",t%7==6?2*(t/7)+1:2*(t/7),t%7>2?2*(t/7)+2:2*(t/7)+t%7);\n\treturn 0;\n}"}, {"source_code": "#include\nmain()\n{\n int n,min,max;\n scanf(\"%d\",&n);\n switch(n%7)\n {\n case 0:{\n max=n*2/7;\n min=n*2/7;\n printf(\"%d %d\",min,max);\n }\n break;\n case 1:{\n max=n*2/7+1;\n min=n*2/7+0;\n printf(\"%d %d\",min,max);\n }\n break;\n case 2:{\n max=n*2/7+2;\n min=n*2/7+0;\n printf(\"%d %d\",min,max);\n }\n break;\n case 3:{\n max=n*2/7+2;\n min=n*2/7+0;\n printf(\"%d %d\",min,max);\n }\n break;\n case 4:{\n max=n*2/7+1;\n min=n*2/7-1;\n printf(\"%d %d\",min,max);\n }\n break;\n case 5:{\n max=n*2/7+1;\n min=n*2/7-1;\n printf(\"%d %d\",min,max);\n }\n break;\n case 6:{\n max=n*2/7+1;\n min=n*2/7;\n printf(\"%d %d\",min,max);\n }\n break;\n }\n}\n"}, {"source_code": "main(n){scanf(\"%d\",&n);printf(\"%d %d\",n/7*2+(n%7==6),n>2?2+(n-2)/7*2+((n-2)%7==6):n);}"}, {"source_code": "#include\n int main()\n{\n\tint n,k,p,min,max;\nscanf(\"%d\",&n);\nif(n>=7)\n{\n\tk=n/7;\n\tp=n%7;\n\tif(p%7==6){\n\t\tmin=2*k+1;\n\t}else\n\tmin=2*k;\n\tif(p<=2)\n\tmax=min+p;\n\telse if(p>2)\n\tmax=2*k+2;\n}\nelse if(n<7)\n{ if(n<=2){\n min=0;\n max=n;\n\t}else if(n>2&&n<6)\n\t{\n\t\tmin=0;max=2;\n\t}else if(n==6)\n\t{\n\t\tmin=1;max=2;\n\t}\n\t\n}printf(\"%d %d\",min,max);}"}, {"source_code": "#include\nint main()\n{\n int d,a,b;\n scanf(\"%d\",&d);\n if(d<7&&d>5){\n printf(\"1 2\");\n return 0;\n }\n if(d<=5&&d>1)\n {\n printf(\"0 2\");\n return 0;\n }\n if(d==1)\n {\n printf(\"0 1\");\n return 0;\n }\n\n if(d%7==0)\n {\n a=(d/7)*2;\n printf(\"%d %d\",a,a);\n return 0;\n }\n if(d%7==1){\n b=((d/7)*2);\n printf(\"%d %d\",b,b+1);\n return 0;\n }\n if(d%7==6){\n b=((d/7)*2);\n printf(\"%d %d\",b+1,b+2);\n return 0;\n }\n\n else\n printf(\"%d %d\",(d/7)*2,((d/7)*2)+2);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,a,b,max,min;\n scanf(\"%d\", &n);\n if (n==1){\n printf(\"0 1\");\n }\n else if (n ==6){\n printf(\"1 2\");\n }\n else if ( n<7){\n printf(\"0 2\");\n }\n else {\n b= n/7;\n a=2*b;\n if (n%7==0){\n max=a;\n min=a;\n }\n else if (n%7==1){\n max=a+1;\n min=a;\n }\n else if (n%7==6){\n max=a+2;\n min=a+1;\n }\n else{\n max=a+2;\n min=a;\n }\n printf(\"%d %d\\n\", min, max);\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,k;\n scanf(\"%d\",&n);\n k=n/7;\n if(n>7)\n {\n if((n-(k*7))==0)\n {\n\n printf(\"%d\",k*2);\n printf(\"\\t%d\",k*2);\n }\n else if((n-(k*7))>5)\n printf(\"%d\",(k*2)+1);\n else if(((n-(k*7))>0)&&((n-(k*7))<=5))\n printf(\"%d\",k*2);\n\n if((n-(k*7))>=2)\n printf(\"\\t%d\",(k*2)+2);\n else if(((n-(k*7))==1))\n printf(\"\\t%d\",(k*2)+1);\n }\n else if(n==1)\n {\n printf(\"0\");\n printf(\"\\t1\");\n }\n else if(n==6)\n {\n\n printf(\"1\");\n printf(\"\\t2\");\n }\n else if((n>1)&&(n<6))\n {\n\n printf(\"0\");\n printf(\"\\t2\");\n }\n else if(n==7)\n {\n printf(\"2\");\n printf(\"\\t2\");\n }\n\n return 0;\n}\n\n\n"}, {"source_code": "#include\nint main()\n{\n\tint n,a;\n\tscanf(\"%d\",&n);\n\ta=n/7;\n\tif((n-7*a)==1)\n\t{\n\t printf(\"%d %d\",(2*a),(2*a+1));\n\t}\n\telse if((n-7*a)==6)\n\t{\n\t printf(\"%d %d\",(2*a)+1,(2*a+2));\n\t}\n\telse if((n-7*a)>1 && (n-7*a)<=5)\n\t{\n\t\tprintf(\"%d %d\",(2*a),(2*a+2));\n\t}\n\telse if((n-7*a)==0)\n\t{\n\t\tprintf(\"%d %d\",2*a,2*a);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n int n, max, min;\n scanf(\"%d\", &n);\n min = (n/7)*2 + (n%7<6 ? 0 : (7-n%7));\n max = (n/7)*2 + (n%7 > 2 ? 2 : n%7);\n printf(\"%d %d\\n\", min, max);\n\n return 0;\n}\n"}, {"source_code": "#include\nint main(void)\n{\n long long int days, x, y, min, max;\n scanf(\"%lld\", &days);\n if(days > 1)\n {\n x = days%7;\n y = days/7;\n if(x != 0 && x < 6 && x >1)\n {\n max = y*2 + 2;\n min = y*2;\n }\n else if(x != 0 && x==6)\n {\n max = y*2 + 2;\n min = y*2 + 1;\n }\n else if(x != 0 && x==1)\n {\n max = y*2 + 1;\n min = y*2;\n }\n else\n {\n max = y*2;\n min = y*2;\n }\n }\n else\n {\n max = days;\n min = 0;\n }\n printf(\"%lld %lld\", min, max);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int x=n%7;\n int y=n/7;\n if(x==1)\n {\n printf(\"%d %d\\n\",y*2,y*2+1);\n }\n else if(x>=2 && x<6)\n {\n printf(\"%d %d\\n\",y*2,y*2+2);\n }\n else if(x==6)\n {\n printf(\"%d %d\\n\",y*2+1,y*2+2);\n }\n else if(x==0)\n {\n printf(\"%d %d\\n\",y*2,y*2);\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n#include\nint main(){\n int days;\n int i,j,k;\n int min,max;\n while(~scanf(\"%d\",&days)){\n int num=days%7;\n min=days/7;\n min*=2;\n if(num<=2){\n max=days%7+min;\n }\n else if(num==6){\n max=2+min;\n min+=1;\n }\n else\n max=2+min;\n printf(\"%d %d\\n\",min,max);\n }\n return 0;\n}\n\n"}, {"source_code": "#include\nint main(){\n\tint n,min,max;\n\tscanf(\"%d\",&n);\n\n\tmin=(n/7)*2;\n\tmax=min;\n\tif(n%7==6){min++;max+=2;}\n\telse{\n\t\tif(n%7==1){max++;}\n\t\telse if(n%7){max+=2;}\n\t}\n\tprintf(\"%d %d\\n\",min,max);\n\t\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,a,b,c,d,e;\n scanf(\"%d\",&n);\n if(n<=5)\n {\n if(n==1)\n {\n printf(\"0 1\");\n }\n else\n {\n printf(\"0 2\");\n }\n }\n else if(n==6)\n {\n printf(\"1 2\");\n }\n else\n {\n if(n%7==0)\n {\n a=(n/7)*2;\n printf(\"%d %d\",a,a);\n }\n else\n {\n b=n+1;\n if(b%7==0)\n {\n c=((n/7)*2)+1;\n }\n else\n {\n c=(n/7)*2;\n }\n d=n-1;\n if(d%7==0)\n {\n e=((n/7)*2)+1;\n }\n else\n {\n e=((n/7)*2)+2; \n }\n printf(\"%d %d\",c,e);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n\tlong long int n;\n\tscanf(\"%lld\",&n);\n\tlong long int x=0;\n\tlong long int y=0;\n\tlong long int z=0;\n\tif(n%7==0)\n\t{\n\t\tz=n/7;\n\t\tx=2*z;\n\t\ty=2*z;\n\t\tprintf(\"%lld %lld\",x,y);\n\t}\n\telse if(n%7==1)\n\t{\t\n\t\tz=n/7;\n\t\tx=2*z;\n\t\ty=x+1;\n\t\tprintf(\"%lld %lld\",x,y);\n\t}\n\telse if(n%7==2)\n\t{\n\t\tz=n/7;\n\t\tx=2*z;\n\t\ty=x+2;\n\t\tprintf(\"%lld %lld\",x,y);\n\t}\n\telse if(n%7==3)\n\t{\t\n\t\tif(n>7)\n\t\t{\n\t\t\tz=n/7;\n\t\t\tx=2*z;\n\t\t\ty=x+2;\n\t\t\tprintf(\"%lld %lld\",x,y);\n\t\t}\n\t\telse\n\t\t\tprintf(\"0 2\");\n\t}\n\telse if(n%7==4)\n\t{\t\n\t\tif(n>7)\n\t\t{\n\t\t\tz=n/7;\n\t\t\tx=2*z;\n\t\t\ty=x+2;\n\t\t\tprintf(\"%lld %lld\",x,y);\n\t\t}\n\t\telse\n\t\t\tprintf(\"0 2\");\n\t}\n\telse if(n%7==5)\n\t{\n\t\tif(n>7)\n\t\t{\n\t\t\tz=n/7;\n\t\t\tx=2*z;\n\t\t\ty=x+2;\n\t\t\tprintf(\"%lld %lld\",x,y);\n\t\t}\n\t\telse\n\t\t\tprintf(\"0 2\");\n\t}\n\telse if(n%7==6)\n\t{\n\t\tif(n>7)\n\t\t{\n\t\t\tz=n/7;\n\t\t\tx=2*z+1;\n\t\t\ty=x+1;\n\t\t\tprintf(\"%lld %lld\",x,y);\n\t\t}\n\t\telse\n\t\t\tprintf(\"1 2\");\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include\nmain()\n{\n\nint n,min,max,p,q;\nscanf(\"%d\",&n);\n\nif(n<2)\n{\n min=0;\n max=n;\n\n}\nelse if(n%7==6)\n{\n p=n/7;\nq=(n-2)/7;\nmin=p*2+1;\nmax=2+q*2;\n\n}\nelse if(n%7==1)\n{\n p=n/7;\nq=(n-2)/7;\nmin=p*2;\nmax=2+q*2+1;\n}\nelse{\n p=n/7;\nq=(n-2)/7;\nmin=p*2;\nmax=2+q*2;\n\n}\nprintf(\"%d %d\",min,max);\n}\n"}, {"source_code": "#include \n\nint main(void) {\n long long n,i;\n scanf(\"%lld\",&n);\n int count = 0,min = 0;\n for(i=0;i4){\n min = min + 2;\n }\n }\n if(n>5){\n if(n==6){\n min++;\n }\n else if(n%7==0){\n min = min + 2;\n }\n else if(n%7==6){\n min++;\n }\n }\n printf(\"%d %d\",min,count);\n \treturn 0;\n}"}, {"source_code": "#include \nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a,b;\n a=n/7;\n b=n%7;\n //printf(\"%d\",b);\n if(b<6 && b>1) {printf(\"%d %d\",2*a,2*a+2); return 0;}\n if(b==1) {printf(\"%d %d\",2*a,2*a+1);return 0;}\n if(b==6) printf(\"%d %d\",2*a+1,2*a+2);\n else printf(\"%d %d\",2*a,2*a);\n return 0;\n}\n"}, {"source_code": "#include\nint main ()\n{\n int y, min = 0, max = 0;\n scanf(\"%d\", &y);\n if (y%7 == 1) min = (2*(y/7)), max = (2*(y/7))+1;\n else if ((y % 7 == 2) || (y % 7 == 3) || (y % 7 == 4) || (y % 7 == 5)) min = 2*(y/7), max =(2*(y/7))+ 2;\n else if (y % 7 == 6) min = (2*(y/7))+ 1, max = (2*(y/7))+ 2;\n else if (y % 7 == 0) min = 2*(y/7), max = 2*(y/7);\n printf(\"%d %d\\n\", min, max);\n\n return 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n long long n,x,y,i;\n scanf(\"%I64d\",&n);\n x=(n/7);\n y=(n%7);\n if(n%7==0){\n i=(x*2);\n printf(\"%I64d %I64d\",i,i);\n }\n else{\n i=(x*2);\n if(y==6){\n\n printf(\"%I64d %I64d\",i+1,i+2);\n }\n else if(y==1){\n printf(\"%I64d %I64d\",i,i+1);\n }\n else{\n printf(\"%I64d %I64d\",i,i+2);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n, day, days;\n \n scanf(\"%d\", &n);\n \n if(n%7==0)\n printf(\"%d %d\\n\", (n/7)*2, (n/7)*2);\n else\n {\n day = n / 7;\n days = n-day*7;\n \n if(days==6)\n printf(\"%d %d\\n\", (day*2)+1, (day*2)+2);\n else if(days>=2)\n printf(\"%d %d\\n\", day*2, (day*2)+2);\n else\n printf(\"%d %d\\n\", day*2, (day*2)+1);\n }\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n==1)\n printf(\"0 1\");\n else if(n==6)\n printf(\"1 2\");\n else if(n<7)\n printf(\"0 2\");\n else if(n%7==0)\n printf(\"%d %d\",(n/7)*2,(n/7)*2);\n else if(n%7==1)\n printf(\"%d %d\",(n/7)*2,((n/7)*2)+1);\n else if(n%7==6)\n printf(\"%d %d\",((n/7)*2)+1,((n/7)*2)+2);\n\n else\n printf(\"%d %d\",(n/7)*2,((n/7)*2)+2);\n}\n"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n==1)\n printf(\"0 1\");\n else if(n==6)\n printf(\"1 2\");\n else if(n<7)\n printf(\"0 2\");\n else if(n%7==0)\n printf(\"%d %d\",(n/7)*2,(n/7)*2);\n else if(n%7==1)\n printf(\"%d %d\",(n/7)*2,((n/7)*2)+1);\n else if(n%7==6)\n printf(\"%d %d\",((n/7)*2)+1,((n/7)*2)+2);\n\n else\n printf(\"%d %d\",(n/7)*2,((n/7)*2)+2);\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,t,s;\n scanf(\"%d\",&n);\n t=n/7;\n s=t*2;\n if(n==6)\n {\n printf(\"1 \");\n }\n\n else if(n==7)\n {\n printf(\"2 \");\n }\n\n else if(n%7==6)\n {\n printf(\"%d \",s+1);\n }\n else\n {\n printf(\"%d \",s);\n }\n if(n%7==1)\n {\n s=s+1;\n }\n else if(n%7>=1)\n {\n s=s+2;\n }\n printf(\"%d \",s);\n return 0;\n\n}\n"}, {"source_code": "#include \nint main ()\n{\n int n,off;\n scanf(\"%d\",&n);\n if (n/7==0)\n {\n if (n==1)\n {\n printf(\"0 1\");\n return 0;\n }\n else if(n==6)\n {\n printf(\"1 2\");\n return 0;\n }\n else\n {\n printf(\"0 2\");\n return 0;\n }\n }\n else\n {\n off = (n/7)*2;\n if (n%7==0)\n {\n printf(\"%d %d\",off,off);\n }\n else if (n%7==1)\n {\n printf(\"%d %d\",off,off+1);\n }\n else if (n%7==6)\n {\n printf(\"%d %d\",off+1,off+2);\n }\n else\n {\n printf(\"%d %d\",off,off+2);\n }\n }\n return 0;\n}"}, {"source_code": "#include\nint main() {\n int n, max_off_day = 0, min_off_day = 0;\n scanf(\"%d\", &n);\n\n max_off_day += 2 * (n / 7);\n min_off_day += 2 * (n / 7);\n\n if (n % 7 != 0) {\n if ((n % 7 >= 2))max_off_day += 2;\n else if ((n % 7) == 1) max_off_day++;\n if ((n % 7) == 6) min_off_day++;\n }\n\n printf(\"%d %d\\n\", min_off_day, max_off_day);\n}"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n==1)\n printf(\"0 1\");\n else if(n==6)\n printf(\"1 2\");\n else if(n<7)\n printf(\"0 2\");\n else if(n%7==0)\n printf(\"%d %d\",(n/7)*2,(n/7)*2);\n else if(n%7==1)\n printf(\"%d %d\",(n/7)*2,((n/7)*2)+1);\n else if(n%7==6)\n printf(\"%d %d\",((n/7)*2)+1,((n/7)*2)+2);\n\n else\n printf(\"%d %d\",(n/7)*2,((n/7)*2)+2);\n}\n"}, {"source_code": "#include\nint main(){\n\tint n;\n\tscanf(\"%d\", &n);\n\tint max, min;\n\tint r=n%7, s=n/7;\n\tif(r==1) {\n\t\tmin=s*2;\n\t\tmax=2*s+1;\n\t}\n\telse if(r==6){\n\t\tmin=2*s+1;\n\t\tmax=2*s+2;\n\t}\n\telse if(r==0){\n\t\tmin=2*s;\n\t\tmax=min;\n\t}\n\telse{\n\t\tmin=2*s;\n\t\tmax=2*s+2;\n\t}\n\tprintf(\"%d %d\", min, max);\n}"}, {"source_code": "#include\nint main()\n{\n int d,a,b;\n scanf(\"%d\",&d);\n if(d<7&&d>5){\n printf(\"1 2\");\n return 0;\n }\n if(d<=5&&d>1)\n {\n printf(\"0 2\");\n return 0;\n }\n if(d==1)\n {\n printf(\"0 1\");\n return 0;\n }\n\n if(d%7==0)\n {\n a=(d/7)*2;\n printf(\"%d %d\",a,a);\n return 0;\n }\n if(d%7==1){\n b=((d/7)*2);\n printf(\"%d %d\",b,b+1);\n return 0;\n }\n if(d%7==6){\n b=((d/7)*2);\n printf(\"%d %d\",b+1,b+2);\n return 0;\n }\n\n else\n printf(\"%d %d\",(d/7)*2,((d/7)*2)+2);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,d,r;\n scanf(\"%d\",&n);\n d=n/7;\n r=n%7;\n if(r==0&&n!=7)\n {\n printf(\"%d %d\",2*d,2*d);\n }\n else if(n<7)\n {\n if(n==1)\n printf(\"0 1\");\n else if(n==6)\n printf(\"1 2\");\n else\n printf(\"0 2\");\n }\n else if(n==7)\n {\n printf(\"2 2\");\n }\n else if(r!=0)\n {\n if(r==1)\n printf(\"%d %d\",2*d,2*d+1);\n else if(r==6)\n printf(\"%d %d\",2*d+1,2*d+2);\n else\n printf(\"%d %d\",2*d,2*d+2);\n }\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n long n, x=0, y=0, a;\n scanf(\"%d\", &n);\n for(long i=1; i<=n; i++)\n {\n a=i%7;\n if(a==1 || a==2)\n x++;\n\n if(a==6 || a==0)\n y++;\n }\n printf(\"%d %d\", y, x);\n}"}, {"source_code": "#include\nint main(void)\n{\n int max,min,n;\n scanf(\"%d\",&n);\n if(!(n%7))\n printf(\"%d %d\\n\",(n/7)*2,(n/7)*2);\n else\n {\n if(n%7>2)\n max=(n/7)*2+2;\n else\n max=(n/7)*2+n%7;\n if(n%7<=5)\n min=(n/7)*2;\n else\n min=(n/7)*2+1;\n printf(\"%d %d\\n\",min,max);\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int n,x,y,p,a,b;\n scanf(\"%d\",&n);\n x=n/7;\n p=n%7;\n if(p>1)\n {\n a=(x*2)+2;\n }\n else if(p==1)\n {\n a=(x*2)+1;\n }\n else if(p==0)\n {\n a=x*2;\n }\n if(p<=5)\n {\n b=x*2;\n }\n else if(p==6)\n {\n b=(x*2)+1;\n }\n else if(p==0)\n {\n b=x*2;\n }\n printf(\"%d %d\",b,a);\n return 0;\n}\n"}, {"source_code": "#include\n int main()\n{\n\tint n,k,p,min,max;\nscanf(\"%d\",&n);\nif(n>=7)\n{\n\tk=n/7;\n\tp=n%7;\n\tif(p%7==6){\n\t\tmin=2*k+1;\n\t}else\n\tmin=2*k;\n\tif(p<=2)\n\tmax=min+p;\n\telse if(p>2)\n\tmax=2*k+2;\n}\nelse if(n<7)\n{ if(n<=2){\n min=0;\n max=n;\n\t}else if(n>2&&n<6)\n\t{\n\t\tmin=0;max=2;\n\t}else if(n==6)\n\t{\n\t\tmin=1;max=2;\n\t}\n\t\n}printf(\"%d %d\",min,max);}"}, {"source_code": "#include\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,temp,left,count,max;\n scanf(\"%d\",&n);\n\n temp=n/7;\n left=n%7;\n count=temp*2;\n\n if(left==6)\n {\n \tcount=count+1;\n \tprintf(\"%d %d\\n\",count,count+1);\n }\n\n else\n {\n\n if(left==1)\n {\n \tmax=count+1;\n }\n else if(left==2)\n {\n \tmax=count+2;\n }\n\n else if(left==0)\n {\n \tmax=count;\n }\n else if(left>=3)\n {\n \tmax=count+2;\n }\n printf(\"%d %d\\n\",count,max );\n\n}\n \n\n}"}, {"source_code": "#include\nint main()\n{\n\tint n,a,b,c,min,max;\n\tscanf(\"%d\",&n);\n\t\n\tif(n%7==0)\n\t{\n\t\ta=n/7;\n\t\tb=a*2;\n\t\tprintf(\"%d %d\",b,b);\n\t\t\n\t}\n\telse\n\t{\n\t\ta=n/7;\n\t\tb=n%7;\n\t\tif (b==6)\n\t\t{\n\t\t\tc=a*2;\n\t\t max=c+2;\n\t\t min=c+1;\n\t\t printf(\"%d %d\",min,max);\n }\n\t else if(b<=5 & b!=1)\n {\n \tc=a*2;\n \tmax=c+2;\n \tmin=c;\n \tprintf(\"%d %d\",min,max);\n\t }\n\t else if(b==1)\n\t {\n\t \tc=a*2;\n\t \tmin=c;\n\t \tmax=c+1;\n\t \tprintf(\"%d %d\",min,max);\n\t\t }\n\t}\n}\n"}, {"source_code": "#include\n#include\nint cmin(int a)\n{int i,hol=0;\nfor(i=1;i<=a;i++)\n{if(i%7==0||i%7==6)\nhol++;\n\n}\nreturn hol;\n}\nint cmax(int a)\n{int i,hol;\nif(a==1)\n hol=1;\nelse\n hol=2;\nfor(i=1;i<=a-2;i++)\nif(i%7==0||i%7==6)\nhol++;\n\nreturn hol;\n}\nint main()\n{int b,c,d;\n//printf(\"enter the no. of days in the year on mars\\n\");\nscanf(\"%d\",&b);\nc=cmin(b);\nd=cmax(b);\nprintf(\"%d \",c);\nprintf(\"%d\",d);\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,min,max;\n scanf(\"%d\",&n);\n if((n%7)==0)\n {\n printf(\"%d %d\\n\",((n/7)*2),((n/7)*2));\n }\n else if((n%7)==1)\n {\n printf(\"%d %d\\n\",(n/7)*2,(((n/7)*2)+1));\n }\n else if((n%7)>=2 && 5 >= (n%7))\n {\n printf(\"%d %d\\n\",((n/7)*2),(((n/7)*2)+2));\n }\n else if((n%7)==6)\n {\n printf(\"%d %d\\n\", (((n +1)/7)*2)-1, ((n +1)/7)*2);\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,max,min;\n scanf(\"%d\",&n);\n if(n>=7 && (n%7==0 || n%7<6))\n {\n min =(n/7)*2;\n }\n else if(n>=7 && n%7==6)\n {\n min =(n/7)*2+1;\n }\n else if(n==6)\n {\n min=1;\n }\n else if(n<6)\n {\n min=0;\n }\n if(n%7==0 && n>7)\n {\n max=(n/7)*2;\n }\n else if(n%7!=0 && n%7==1 && n>7)\n {\n max=(n/7)*2+1;\n }\n else if(n%7!=0 && n%7!=1 && n>7)\n {\n max=(n/7)*2+2;\n }\n else if(n<=7 && n>1)\n {\n max=2;\n }\n else if(n<=7 && n<=1)\n {\n max=n%7;\n }\n\n printf(\"%d %d\",min ,max);\n}\n"}, {"source_code": "#include\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tint x,y;\n\tx=y=(n+6)/7*2;\n\tif(n%7>=1&&n%7<=5)\tx=y-2;\n\tif(n%7==6)\tx=y-1;\n\tif(n%7==1)\ty--;\n\tprintf(\"%d %d\",x,y);\t\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n,a,b,c;\n scanf(\"%d\",&n);\n\n if((n>0)&&(n<=1000000))\n {\n\n a=(n/7)*2;\n\n b=n%7;\n\nswitch (b) {\ncase 0:\nprintf(\"%d %d\",a,a);\nbreak;\ncase 1:\n printf(\"%d %d\",a,a+1);\n break;\ncase 6:\n printf(\"%d %d\",a+1,a+2);\n break;\ndefault :\nprintf(\"%d %d\",a,a+2);\n\n}\n }\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int day,offday,dayleft,maxoffday,totaloffday,minimumoffday;\n scanf(\"%d\",&day);\n\n if(day == 1)\n {\n printf(\"0 1\");\n return 0;\n }\n if(day <= 5 && day >= 2)\n {\n printf(\"0 2\");\n return 0;\n }\n if(day == 6)\n {\n printf(\"1 2\");\n return 0;\n }\n\n offday = day/7;\n dayleft = day%7;\n\n if(day % 7 == 0)\n {\n maxoffday = offday * 2;\n minimumoffday = offday * 2;\n printf(\"%d %d\",minimumoffday,maxoffday);\n return 0;\n }\n\n totaloffday = offday * 2;\n minimumoffday = totaloffday;\n\n if(dayleft == 6)\n {\n minimumoffday = minimumoffday + 1;\n maxoffday = totaloffday + 2;\n printf(\"%d %d\",minimumoffday, maxoffday);\n return 0;\n }\n\n\n if(dayleft > 2)\n {\n maxoffday = totaloffday + 2;\n printf(\"%d %d\" ,minimumoffday, maxoffday);\n }\n if(dayleft == 1)\n {\n maxoffday = totaloffday + 1;\n printf(\"%d %d\",minimumoffday, maxoffday);\n }\n if(dayleft == 2)\n {\n maxoffday = totaloffday + 2;\n printf(\"%d %d\",minimumoffday ,maxoffday);\n }\n\n\n\n\n\n\n return 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n, nr, ramas;\n scanf(\"%d\", &n);\n nr=n/7;\n ramas=n%7;\n if(ramas>5)\n printf(\"%d %d\", nr*2+(ramas-5), nr*2+2);\n else{ if(ramas>=2)\n printf(\"%d %d\", nr*2, nr*2+2);\n else\n printf(\"%d %d\", nr*2, nr*2+ramas);\n }\n\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n\tint n;\n\tscanf(\"%d\", &n);\n\tint max, min;\n\tint r=n%7, s=n/7;\n\tif(r==1) {\n\t\tmin=s*2;\n\t\tmax=2*s+1;\n\t}\n\telse if(r==6){\n\t\tmin=2*s+1;\n\t\tmax=2*s+2;\n\t}\n\telse if(r==0){\n\t\tmin=2*s;\n\t\tmax=min;\n\t}\n\telse{\n\t\tmin=2*s;\n\t\tmax=2*s+2;\n\t}\n\tprintf(\"%d %d\", min, max);\n}"}], "negative_code": [{"source_code": "#include\nint main()\n{\n long long n,min,max,week,weekend,rem;\n scanf(\"%I64d\",&n);\n\n if(n<=2)\n {\n min=0;\n max=2;\n }\n else if(n>2&&n<=7)\n {\n min=2;\n max=2;\n }\n else if(n>7)\n {\n week=n/7;\n weekend=week*2;\n min=weekend;\n rem=n%7;\n if(rem==1)\n {\n max=weekend+1;\n }\n else if(rem>2)\n {\n max=weekend+2;\n }\n else if(rem==0)\n {\n max=min;\n }\n }\n printf(\"%I64d %I64d\",min,max);\n return 0;\n\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nint main(){\n long long n,min=0,max=0;\n scanf(\"%lld\",&n);\n long long weeks= n/7;\n if(n%7==0)\n {\n max=weeks*2;\n }\n else\n {\n int rem = n%7;\n if(rem>=2)\n {\n max= (weeks*2)+2;\n }\n else if(rem==1)\n {\n max= (weeks*2)+1;\n }\n \n \n \n }\n min= weeks*2;\n printf(\"%lld %lld\\n\",min,max);\n \n return 0;\n}\n"}, {"source_code": "#include\n\nint max(int a, int b)\n{\n if(a>=b)return a;\n return b;\n}\n\nint min(int a, int b)\n{\n if(a<=b)return a;\n return b;\n}\n\nint main()\n{\n int n;\n int weeks;\n int rem;\n int max_off, min_off;\n scanf(\"%d\",&n);\n\n weeks = n/7;\n rem = n%7;\n\n max_off = weeks*2+min(rem,2);\n min_off = weeks*2+max(0,rem-7);\n\n printf(\"%d %d\",min_off,max_off);\n\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n\tint n,max,min,left;scanf(\"%d\",&n);\n\tleft=n%7;\n\tif(left>=2){left=2;}\n\tmax=(n/7)*2+left;\n\tmin=(n/7)*2;\n\tprintf(\"%d %d\\n\",min,max);\n\treturn 0;}\n"}, {"source_code": "#include\nint main()\n{\n int n,i,x,j;\n scanf(\"%d\", &n);\n i = n%7;\n x = n/7;\n if(i==0)\n {\n j=x*2;\n printf(\"%d %d\",j,j);\n }\n else if(i!=0 && i<6 && i>1)\n {\n printf(\"%d %d\",x,x+2);\n\n }\n else if(i==1)\n {\n printf(\"0 1\");\n }\n else if(i==6)\n {\n printf(\"1 2\");\n }\n return 0;\n\n}\n"}, {"source_code": "\n #include\n#include\nint main()\n{\n\n int i,a,b,n,A=0,B=0,AA=1,Alex=5;\n scanf(\"%d\",&n);\n a=n/7;\n if(n<=7){a=2; b=0;}\n if(n>7){a=a*2; b=a;}\n printf(\"%d %d\",b,a);\n return 0;\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int i,n,x;\n scanf(\"%d\",&n);\n\n if(n%7==1) x=1;\n else if(n%7>=2) x=2;\n if(n%7==0) printf(\"%d %d\",n/7*2,n/7*2);\n else if(n<7)\n {\n if(n<6) printf(\"0\");\n else if(n==6) printf(\"1\");\n printf(\"%d \",n/7+x);\n }\n else if(n>7)\n {\n if(n%7<6) printf(\"%d\",n/7*2);\n else if(n%7==6) printf(\"%d\",n/7*2+1);\n printf(\"%d \",n/7*2+x);\n }\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long n,r,x,d,y;\n scanf(\"%lld\",&n);\n if(n%7==0)\n {\n r=(n/7)*2;\n printf(\"%lld %lld\",r,r);\n }\n else\n {\n x=n/7;\n d=n%7;\n if(d>=2&&d<6)\n {\n r=(x*7)+2;\n y=x*7;\n }\n else if(d>=6)\n {\n r=(x*7)+2;\n y=(x*7)+(7-d);\n\n }\n else if(d<2)\n {\n r=(x*7)+d;\n y=x*7;\n }\n }\n printf(\"%lld %lld\",y,r);\n return 0;\n }\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int a,b,c,d,e;\n scanf(\"%d\",&a);\n if (a%7==0)\n {\n b=(a/7)*2;\n printf(\"%d\\t%d\",b,b);\n }\n else if (a%7!=0)\n {\n b=(a/7);\n c=a-(b*7);\n e=b*2;\n d=c+e;\n printf(\"%d\\t%d\",e,d);\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,t,s;\n scanf(\"%d\",&n);\n t=n/7;\n s=t*2;\n if(n==6)\n {\n printf(\"1 \");\n }\n else if(n==7)\n {\n printf(\"2 \");\n }\n else if((n%7==6))\n {\n s++;\n }\n else\n {\n printf(\"%d \",s);\n }\n if(n%7>=1 && n%7<=5)\n {\n s=s+2;\n\n }\n else if(n%7==1)\n {\n s++;\n }\n printf(\"%d \",s);\n return 0;\n\n}\n"}, {"source_code": "#include \n\nint main (void) {\n int n, i, min = 0, max = 0;\n scanf (\"%d\", &n);\n for (i = 1; i <= n; i++) {\n if (i % 6 == 0 || i % 7 == 0)\n min++;\n }\n if (n <= 2) max = n;\n else {\n max = 2;\n for (i = 1; i <= n - 2; i++) \n if (i % 6 == 0 || i % 7 == 0)\n max++;\n }\n\n printf (\"%d %d\\n\", min, max);\n\n}"}, {"source_code": "#include\nint main(){\n long int n,max,min;\n scanf(\"%ld\",&n);\n min=(n/7)*2;\n if(n%7>2){\n max=min+2;\n }\n else {\n max=min+n%7;\n }\n printf(\"%ld %ld\",min,max);\n}"}, {"source_code": "#include\nint main()\n{\n long long n,min,max,week,weekend,rem;\n scanf(\"%I64d\",&n);\n if(n==0)\n {\n min=0;max=0;\n }\nelse if(n==1)\n{\n min=0;\n max=1;\n}\n else if(n<=2)\n {\n min=0;\n max=2;\n }\n else if(n>2&&n<=7)\n {\n min=2;\n max=2;\n }\n else if(n>7)\n {\n week=n/7;\n weekend=week*2;\n min=weekend;\n rem=n%7;\n if(rem==1)\n {\n max=weekend+1;\n }\n else if(rem>=2)\n {\n max=weekend+2;\n }\n else if(rem==0)\n {\n max=min;\n }\n }\n printf(\"%I64d %I64d\",min,max);\n return 0;\n\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n printf(\"%d %d\", n/7*2, (n-2)/7*2+2);\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(void)\n{\n\t\tint n;\n\t\tscanf(\"%d \", &n);\n\t\tprintf(\"%d %d\\n\", (n/7)*2, ((n/7)*2)+(n%7 >= 1)+(n%7 >= 2));\n\t\treturn 0;\n}\n"}, {"source_code": "#include \nint main (){\n int n;\n scanf (\"%d\",&n);\n if (n<7){\n printf (\"1 \");\n if (n>=2)\n printf (\"2\");\n }else\n if (n%7==0){\n printf (\"%d %d\",(n/7)*2,(n/7)*2);\n }else if (n%7>2)\n printf (\"%d %d\",(n/7)*2,(n/7)*2+2);\n else printf (\"%d %d\",(n/7)*2,(n/7)*2+(n%7));\n\n\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n, min = 0, max = 0;\n scanf(\"%d\", &n);\n if(n % 7 == 0)\n {\n min = n/7*2;\n max = min;\n }\n if(n%7 != 0)\n {\n min = n/7*2;\n if(n <= 6)\n {\n max = 2;\n }\n if(n>6)\n {\n if(n%7 == 1)\n {\n max = n/7*2 + 1;\n }\n if(n%7 >= 2)\n {\n max = n/7*2 +2;\n }\n }\n }\n printf(\"%d %d\", min, max);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main(void)\n\n{\n long n;\n long mn,mx;\n \n scanf(\"%ld\",&n);\n if((n/7)>=1){\n if(n%7==0){\n mn=2*(n/7);\n mx=2*(n/7);\n }\n else if(n%7==1){\n mn=2*(n/7);\n mx=mn+1;\n }\n else if(n%7>=2 && n%7<=5){\n mn=2*(n/7);\n mx=mn+2;\n }\n else if(n%7==6){\n mn=3*(n/7);\n mx=mn+1;\n }\n }\n else{\n if(n%7==0 || n%7==1){\n mn=0;\n mx=mn+n;\n }\n else if(n%7>=2 && n%7<=5){\n mn=0;\n mx=mn+2;\n }\n else if(n%7==6){\n mn=1;\n mx=mn+1;\n }\n }\n printf(\"%ld %ld\",mn, mx);\n return 0;\n \n}"}, {"source_code": "#include\nint main()\n{\n int a, b, c, d, e, f, g;\n scanf(\"%d\", &a);\n b = a/7; c = a%7; d = b*2; e = a-(7*b); f = d+1; g = d+2;\n if(a==1){\n printf(\"0 1\\n\");\n }\n else if(a<7&&a!=1){\n printf(\"0 2\\n\");\n }\n else if(a==7){\n printf(\"2 2\\n\");\n }\n else if(a>7&&c!=0&&e==1){\n printf(\"%d %d\\n\", d, f);\n }\n else if(a>7&&c!=0&&e>1){\n printf(\"%d %d\\n\", d, g);\n }\n else if(a>7&&c==0&&e==0){\n printf(\"%d %d\\n\", d, d);\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include\n\nint main()\n{\n int n,a;\n scanf(\"%d\",&n);\n a=n/7;\n if(n==6)\n {\n printf(\"1 2\");\n }\n else if(n%7==0)\n {\n printf(\"%d %d\",2*a,2*a);\n }\n else if(n%7==1)\n {\n printf(\"%d %d\",2*a,2*a+1);\n }\n else\n {\n printf(\"%d %d\",2*a,2*a+2);\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n long int n,max,min;\n scanf(\"%ld\",&n);\n min=(n/7)*2;\n if(n%7>2){\n max=min+2;\n }\n else {\n max=min+n%7;\n }\n printf(\"%ld %ld\",min,max);\n}"}, {"source_code": "#include \n#include\n\nint main()\n{\n int n,a;\n scanf(\"%d\",&n);\n a=n/7;\n if(n==6)\n {\n printf(\"1 2\");\n }\n else if(n%7==0)\n {\n printf(\"%d %d\",2*a,2*a);\n }\n else if(n%7==1)\n {\n printf(\"%d %d\",2*a,2*a+1);\n }\n else\n {\n printf(\"%d %d\",2*a,2*a+2);\n }\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n,min,max,rem;\n scanf(\"%d\",&n);\n min=(n/7)*2;\n rem=n%7;\n if(rem>2)\n {\n max=min+2;\n }\n else if(rem<3)\n {\n max=min+rem;\n }\n printf(\"%d %d\",min,max);\n \n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n\n int x,a,b;\n scanf(\"%d\",&x);\n if(x<7){\n if(x<=5)\n a=0;\n else\n a=1;\n if(x<2)\n b=1;\n else\n b=2;\n }\n else if(x%7==0){\n a=(x/7)*2;\n b=((x/7)*2);\n }\n else if( x%7!=0){\n a=(x/7)*2;\n if(x%7==1){\n b=((x/7)*2)+1;\n }\n else\n b=((x/7)*2)+2;\n\n\n }\n printf(\"%d %d\\n\",a,b);\n\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n\tint i ,n,min,max;\n\tscanf(\"%d\",&n);\n\tif(n%7==6)\n\tmin+=1;\n\tmin=(n/7);\nif(n%7==0)\nmax=(n/7)*2;\nelse if(n%7==1)\nmax=(n/7)*2 + 1;\nelse \nmax=(n/7)*2 + 2;\n\tprintf(\"%d %d\",min*2,max);\n\t\n}"}, {"source_code": "#include\nint main()\n{\n long int n,min,max,r;\n scanf(\"%ld\",&n);\n r=n%7;\n if(n<2)\n {\n min=0;\n max=n;\n }\n else if(r==0)\n {\n min=2*(n/7);\n max=2*(n/7);\n }\n else\n {\n min=2*(n/7);\n max=2*(n/7)+2;\n }\n printf(\"%ld %ld\",min,max);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint x=n/7;\n\tif (n>=7)\n\t{\n\t\tif(n%7==0)\n\t\t{\n\t\t\tprintf(\"%d %d\",x*2,x*2);\n\t\t}\n\t\telse if(n%7==1)\n\t\t{\n\t\t\tprintf(\"%d %d\",x*2,x*2+1);\n\t\t}\n\t\telse if(n%7>=2 && n%7<=5)\n\t\t{\n\t\t\tprintf(\"%d %d\",x*2,x*2+2);\n\t\t}\n\t\telse if(n&7==6)\n\t\t{\n\t\t\tprintf(\"%d %d\",x*2+1,x*2+2);\n\t\t}\n\t}\n\telse if(n==1)\n\t{\n\t\tprintf(\"%d %d\",0,1);\n\t}\n\telse if(n>=2 && n<=5)\n\t{\n\t\tprintf(\"%d %d\",0,2);\n\t}\n\telse if(n==6)\n\t{\n\t\tprintf(\"%d %d\",1,2);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,i,x,j;\n scanf(\"%d\", &n);\n if(n==1)\n {\n printf(\"0 1\");\n }\n i = n%7;\n x = n/7;\n if(i==0)\n {\n j=x*2;\n printf(\"%d %d\",j,j);\n }\n else if(i!=0 && i<6 && i>1)\n {\n printf(\"%d %d\",x,x+2);\n\n }\n else if(i==1 && n!=1)\n {\n printf(\"%d %d\",x*2,(x*2)+1);\n }\n else if(i==6)\n {\n printf(\"1 2\");\n }\n return 0;\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,a,max,min;\n scanf(\"%d\", &n);\n if (n==1){\n printf(\"0 1\");\n }\n else if (n ==6){\n printf(\"1 2\");\n }\n else if ( n<7){\n printf(\"0 2\");\n }\n else {\n a=2 * n/7;\n if (n%7==0){\n max=a;\n min=a;\n }\n else{\n max=a+2;\n min=a;\n }\n printf(\"%d %d\\n\", min, max);\n }\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n\tint n,max,min,a;\n\tscanf(\"%d\",&n);\n\tmax=min=2*n/7;\n\ta=n%7;\n\tif(a>=2){\n\t\tmax= max+2;\n\t}\n\telse if ( a==1){\n\t\tmax=max+1;\n\t}\n\tprintf(\"%d %d\",min,max);\n\treturn 0;\n}"}, {"source_code": "#include\nint main(){\n\tint n;\n\tscanf(\"%d\", &n);\n\tint max, min;\n\tint r=n%7, s=n/7;\n\tif(r==1) {\n\t\tmin=s*2;\n\t\tmax=2*s+1;\n\t}\n\telse if(r==6){\n\t\tmin=2*s+1;\n\t\tmax=2*s+2;\n\t}\n\telse{\n\t\tmin=2*s;\n\t\tmax=2*s+2;\n\t}\n\tprintf(\"%d %d\", min, max);\n}"}, {"source_code": "#include\nint main()\n{\n int n,min,max;\n scanf(\"%d\",&n);\n if((n%7)==0)\n {\n printf(\"%d %d\\n\",((n/7)*2),((n/7)*2));\n }\n else if((n%7)==1)\n {\n printf(\"%d %d\\n\",(n/7)*2,(((n/7)*2)+1));\n }\n else if((n%7)>=2 && 5 <= (n%7))\n {\n printf(\"%d %d\\n\",((n/7)*2),(((n/7)*2)+2));\n }\n else if((n%7)==6)\n {\n printf(\"%d %d\\n\", (((n +1)/7)*2)-1, ((n +1)/7)*2);\n }\n return 0;\n}\n"}, {"source_code": "#include \nint main(){\n\tint n,x,y;\n\tscanf(\"%d\",&n);\n\tif (n>5){\n\t\tfor (int i=1;i<=n;i++){\n\t\t\ty=n%7+n*2/7;\n\t\t}\n\t\tfor (int i=1;i<=n-5;i++){\n\t\t\tx=n*2/7;\n\t\t}\n\tprintf(\"%d %d\",x,y);\n\t}\n\telse {\n\t\tprintf(\"0 2\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n long long n,max,min,a;\n scanf(\"%lld\",&n);\n\n a=n/7;\n min=a*2;\n if(n%7==0)\n {\n max=min;\n\n }\n else if(n==7 || (n<6 && n>=2))\n {\n min=0;\n max=2;\n }\n else if(n<2)\n {\n min=0;\n max=1;\n }\n else if(n==6)\n {\n min=1;\n max=2;\n }\n else if(n%7!=0 && n%7>=1 || n%7<=2 && n>7)\n {\n min=n/7+1;\n max=min+n%7;\n\n }\n else if(n%7!=0 && n%7>2 || n%7<=6 && n>7)\n {\n min=n/7+1;\n max=min+2;\n\n }\n\n\n\n printf(\"%lld %lld\",min,max);\n\n}\n"}, {"source_code": "#include\n#include\n#include\nint main()\n{\n int n,r,s,m;\n scanf(\"%d\",&n);\n if(n%7==0)\n {\n s=n/7;\n s=s*2;\n m=s;\n }\n else\n {\n s=n/7;\n s=s*2;\n m=s+2;\n }\n if(n==1)\n {\n s=0;\n m=1;\n }\n if(n==6)\n {\n s=1;m=2;\n }\n printf(\"%d %d\",s,m);\n}"}, {"source_code": "#include\nint main()\n{\n int y, max, min, ex;\n while(scanf(\"%d\", &y) != EOF) {\n if (y%7 == 0) {\n max=min=y/7*2;\n printf(\"%d %d\\n\", min, max);\n }\n else {\n min=y/7 *2;\n ex=(y%7 >=2)?2:1;\n max=min+ ex;\n printf(\"%d %d\\n\", min, max);\n }\n }\n return 0;\n }\n\n"}, {"source_code": "#include\n#include\nint main()\n{\n int n,x,y;\n scanf(\"%d\",&n);\n if(n==1)\n {\n printf(\"0 1\");\n return 0;\n }\n x=n/7;\n y=ceil(n*1.0/7);\n x=x*2;\n y=y*2;\n printf(\"%d %d\",x,y);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n, min = 0, max = 0;\n scanf(\"%d\", &n);\n if(n%7 == 1)\n {\n min = n/7*2;\n max = n/7*2 +1;\n }\n if(n%7 == 0)\n {\n min = n/7*2;\n max = n/7*2;\n }\n if(n%7 >1)\n {\n min = n/7*2;\n max = n/7*2+2;\n }\n printf(\"%d %d\", min, max);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,m,max,min,a,b;\n scanf(\"%d\",&n);\n\n if(n<=5 && n>0)\n {\n max=2,min=0;\n printf(\"%d %d\\n\",min,max);\n }\n else\n {\n a=n%7;\n b=n/7;\n if(a<=5&&a>0)\n {\n min=b*2;\n max=min+2;\n printf(\"%d %d\\n\",min,max);\n }\n else if(a==6)\n {\n\n min=(b*2)+1;\n max=min+1;\n printf(\"%d %d\",min,max);\n }\n else\n {\n min=b*2;\n max=min;\n printf(\"%d %d\",min,max);\n }\n\n }\n return 0;\n}\n"}, {"source_code": "#include\n\t\n\tint main(){\n\tint n,x;\n\tscanf(\"%d\", &n);\n\t\n\tif (n!=6 &&1=7 ; i++){\n\t\tn=n-7;\n\t\tif (n==6){\n\t\t\tprintf(\"%d %d\", i*2+1, i*2+2);\n\t\t}\n\t\telse if(n<7 && n<=5){\n\t\t\t\n\t\t\t\tprintf(\"%d %d\", i*2 , 2*i+n);\n\n\t\t}\n\t\telse if(n<7 && n>5){\n\t\t\t\n\t\t\t\tprintf(\"%d %d\", i*2, 2*i+2);\n\t\t\t\n\t\t}\n\t\t\n\t\n\t}\n}"}, {"source_code": "#include\nint main()\n{\n int i,l;\n float n,k;\n scanf(\"%f\",&n);\n int x;\n x=n;\n k=(n/7.0)*2.0;\n l=k;\n if(l==k)\n printf(\"%d %d\\n\",l,l);\n else if (x%7<2)\n printf(\"%d %d\\n\",l,x%7);\n else\n printf(\"%d %d\\n\",l,l+2);\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\nint n,p,q;\nscanf(\"%d\",&n);\nif(n<7)\n{\nq=n%7;\nif(q==1)\nprintf(\"0 1\");\nelse if(q>=2 && q<6)\nprintf(\"0 2\");\nelse if(q==6)\nprintf(\"1 2\");\n}\nelse if(n==7)\nprintf(\"2 2\");\nelse if(n>7)\n{\np=n%7;\nif(p==0)\nprintf(\"%d %d\",(2*n)/7,(2*n)/7);\nelse if(p>=2&&p<6)\nprintf(\"%d %d\",n/7+1,n/7+3);\nelse if(p==6)\nprintf(\"%d %d\",n/7+2,n/7+3);\nelse if(p==1)\nprintf(\"%d %d\",(2*n)/7,(2*n)/7+1);\n}\nreturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n,min,max;\n\n\n scanf(\" %d\",&n);\n\n if( n%7 ==0 )\n {\n max= (n/7)*2;\n min=max;\n }\n else\n {\n if( n%7 ==1 )\n {\n max=(n/7)*2+1;\n min=(n/7)*2;\n }\n if (n%7==6)\n {\n max=(n/7)*2+2;\n min=(n/7)*2+1;\n }\n else\n {\n max=(n/7)*2+2;\n min=(n/7)*2;\n }\n\n }\n\n printf(\"%d %d \\n\", min,max);\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int i,j,r;\n int c=0;\n int sum=((n/7)*2);\n int rem=n%7;\n if(n==2)\n {\n i=0;\n j=2;\n printf(\"%d %d\",i,j);\n }\n else if(n==6)\n {\n i=1;\n j=2;\n printf(\"%d %d\",i,j);\n }\n else if(n==3)\n {\n i=0;\n j=2;\n printf(\"%d %d\",i,j);\n }\n else if(n==4)\n {\n i=0;\n j=2;\n printf(\"%d %d\",i,j);\n }\n else if(n==5)\n {\n i=0;\n j=2;\n printf(\"%d %d\",i,j);\n }\n else\n { \n if(rem==6)\n {\n i=i+1;\n }\n else \n {\n i=sum;\n }\n if(rem==1)\n {\n j=sum+1;\n }\n else if(rem==0)\n {\n j=sum;\n }\n else\n {\n j=sum+2;\n }\n \n printf(\"%d %d\",i,j);\n }\n}\n"}, {"source_code": "#include \nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a,b;\n a=n/7;\n b=n%7;\n //printf(\"%d\",b);\n if(b==1 || b==0) printf(\"%d %d\",2*a,((2*a)+1));\n if(b>=2) printf(\"%d %d\", (2*a+(7-b)),((2*a)+2));\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n\tint n;\n\tscanf(\"%d\", &n);\n\tint max, min;\n\tint r=n%7, s=n/7;\n\tif(r==1) {\n\t\tmin=s*2;\n\t\tmax=2*s+1;\n\t}\n\telse if(r==6){\n\t\tmin=2*s+1;\n\t\tmax=2*s+2;\n\t}\n\telse{\n\t\tmin=2*s;\n\t\tmax=2*s+2;\n\t}\n\tprintf(\"%d %d\", min, max);\n}"}, {"source_code": "#include\nint main()\n{\n int n,d,r;\n scanf(\"%d\",&n);\n d=n/7;\n r=n%7;\n if(r==0&&n!=7)\n {\n printf(\"%d %d\",2*d,2*d);\n }\n else if(n<7)\n {\n if(n==1)\n printf(\"0 1\");\n else if(n==6)\n printf(\"1 2\");\n else\n printf(\"0 2\");\n }\n else if(n==7)\n {\n printf(\"2 2\");\n }\n else if(r!=0)\n {\n if(r==1)\n printf(\"%d %d\",2*d,2*d+1);\n else if(r==6)\n printf(\"%d %d\",2*d+1,2*d+2);\n else\n printf(\"% %d\",2*d,2*d+2);\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long n,min,max,week,weekend,rem;\n scanf(\"%lld\",&n);\n\n if(n<=2)\n {\n min=0;\n max=2;\n }\n else if(n>2&&n<=7)\n {\n min=2;\n max=2;\n }\n else if(n>7)\n {\n week=n/7;\n weekend=week*2;\n min=weekend;\n rem=n%7;\n if(rem==1)\n {\n max=weekend+1;\n }\n else if(rem>2)\n {\n max=weekend+2;\n }\n else if(rem==0)\n {\n max=min;\n }\n }\n printf(\"%lld %lld\",min,max);\n return 0;\n\n}"}, {"source_code": "#include \n\nint main (){\n int days, min=0, max=0;\n scanf(\"%i\", &days);\n max=2*days/7+days%7;\n min=2*days/7;\n if (days%7>2){\n max=2*days/7+2;\n }\n if (days%7==6){\n min=2*days/7+1;\n }\n printf(\"%i %i\", min, max);\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nint main(){\n long long n,min=0,max=0;\n scanf(\"%lld\",&n);\n long long weeks= n/7;\n if(n%7==0)\n {\n max=weeks*2;\n }\n else\n {\n int rem = n%7;\n if(rem>=2)\n {\n max= (weeks*2)+2;\n }\n else\n {\n max= (weeks*2)+1;\n }\n \n \n \n }\n min= weeks*2;\n printf(\"%lld %lld\\n\",min,max);\n \n return 0;\n}\n"}, {"source_code": "#include \n\nint main ()\n{\n int n;\n int week, min_days_off, rem, max_days_off;\n while(scanf(\"%d\", &n)!=EOF)\n {\n week= n/7;\n min_days_off= week*2;\n rem= n%7;\n if(rem==0)\n max_days_off= min_days_off;\n //else if(rem==1)\n //max_days_off= min_days_off+1;\n else\n max_days_off= min_days_off+2;\n printf(\"%d %d\\n\", min_days_off, max_days_off);\n\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,max,min;\n scanf(\"%d\",&n);\n max=min=(2*n)/7;\n if((n%7)==1)\n max++;\n if((n%7)==2 || (n%7)>2)\n max+=2;\n if((n%7)==6)\n min++;\n printf(\"%d %d\",min,max);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int y, max, min, ex;\n while(scanf(\"%d\", &y) != EOF) {\n if (y%7 == 0) {\n max=min=y/7*2;\n printf(\"%d %d\\n\", max, min);\n }\n else {\n min=y/7 *2;\n ex=(y%7 >2)?2:1;\n max=min+ ex;\n printf(\"%d %d\\n\", min, max);\n }\n }\n return 0;\n }\n\n"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int i,j,r;\n int c=0;\n int sum=((n/7)*2);\n int rem=n%7;\n if(n==2)\n {\n i=0;\n j=2;\n printf(\"%d %d\",i,j);\n }\n else if(n==6)\n {\n i=1;\n j=2;\n printf(\"%d %d\",i,j);\n }\n else if(n==3)\n {\n i=0;\n j=2;\n printf(\"%d %d\",i,j);\n }\n else if(n==4)\n {\n i=0;\n j=2;\n printf(\"%d %d\",i,j);\n }\n else if(n==5)\n {\n i=0;\n j=2;\n printf(\"%d %d\",i,j);\n }\n else\n { \n if(rem==6)\n {\n i=i+1;\n }\n else \n {\n i=sum;\n }\n if(rem==1)\n {\n j=sum+1;\n }\n else if(rem==0)\n {\n j=sum;\n }\n else\n {\n j=sum+2;\n }\n \n printf(\"%d %d\",i,j);\n }\n}\n"}, {"source_code": "#include \n#include\n\nint main()\n{\n int n,a;\n scanf(\"%d\",&n);\n a=n/7;\n if(n%7==0)\n {\n printf(\"%d %d\",2*a,2*a);\n }\n else if(n%7==1)\n {\n printf(\"%d %d\",2*a,2*a+1);\n }\n else\n {\n printf(\"%d %d\",2*a,2*a+2);\n }\n return 0;\n}\n\n\n"}, {"source_code": "#include\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint min,max;\n\tif(n>=7)\n\t{\n\tint k=n/7;\n\tmin=k*2;\n\tmax=k*2+2;\n\t}\n\telse \n\t{\n\t\tmin=0;\n\t\tmax=2;\n\t}\n\tprintf(\"%d %d\\n\",min,max);\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint main(){ \n int a,b,c,d,e,f,n;\n scanf(\"%d\",&n);\n if(n==1){\n a=0;b=1;\n }\n else if(n==6){\n a=1;b=2;\n }\n else if(n<7){\n a=0;b=2;\n }\n else {\n c=n/7;\n a=c*2;\n d=n%7;\n if(d==6){\n b=a+1;\n }\n else if(d!=0){\n if(d%2==0){\n b=a+2;\n }\n else{\n b=a+1;\n }\n }\n else{\n b=a;\n }\n }\n \n printf(\"%d %d\",a,b);\n return 0;\n }\n"}, {"source_code": "#include \n\nint main (){\n int days, min=0, max=0;\n scanf(\"%i\", &days);\n max=2*days/7+days%7;\n min=2*days/7;\n if (days%7>2){\n max=2*days/7+2;\n }\n if (days%7==6){\n min=2*days/7+1;\n }\n printf(\"%i %i\", min, max);\n}\n"}, {"source_code": "#include\nint main()\n{\n int i,n,x;\n scanf(\"%d\",&n);\n\n if(n%7==1) x=1;\n else if(n%7>=2) x=2;\n if(n%7==0) printf(\"%d %d\",n/7*2,n/7*2);\n else if(n<7)\n {\n printf(\"%d \",n/7+x);\n if(n<6) printf(\"0\");\n else if(n==6) printf(\"1\");\n }\n else if(n>7)\n {\n if(n%7<6) printf(\"%d\",n/7*2);\n else if(n%7==6) printf(\"%d\",n/7*2+1);\n printf(\"%d \",n/7*2+x);\n }\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int i,j,r;\n int c=0;\n int sum=((n/7)*2);\n int rem=n%7;\n if(n==2)\n {\n i=0;\n j=2;\n printf(\"%d %d\",i,j);\n }\n else if(n==6)\n {\n i=1;\n j=3;\n printf(\"%d %d\",i,j);\n }\n else if(n==3)\n {\n i=0;\n j=2;\n printf(\"%d %d\",i,j);\n }\n else if(n==4)\n {\n i=0;\n j=2;\n printf(\"%d %d\",i,j);\n }\n else if(n==5)\n {\n i=0;\n j=2;\n printf(\"%d %d\",i,j);\n }\n else\n {\n i=sum;\n if(rem==1)\n {\n j=sum+1;\n }\n else if(rem==0)\n {\n j=sum;\n }\n else\n {\n j=sum+2;\n }\n \n printf(\"%d %d\",i,j);\n }\n}\n"}, {"source_code": "#include\nint main()\n{\n long long n,min,max;\n scanf(\"%I64d\",&n);\n if(n<=5)\n {\n min=0;\n max=2;\n }\n else if(n>5&&n<=7)\n {\n min=7-5;\n max=2;\n }\n else if(n>7)\n {\n min=(n/7)*2;\n max=(n/7)*2;\n }\n printf(\"%I64d %I64d\",min,max);\n return 0;\n\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n#include\nint main(){\n int days;\n int i,j,k;\n int min,max;\n while(~scanf(\"%d\",&days)){\n min=days/7*2;\n if(days%7<=2)\n max=days%7+min;\n else\n max=2+min;\n printf(\"%d %d\\n\",min,max);\n }\n return 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n int n,i,x,j;\n scanf(\"%d\", &n);\n i = n%7;\n x = n/7;\n if(n==1)\n {\n printf(\"0 1\");\n }\n\n else if(i==0)\n {\n printf(\"%d %d\",(x*2),(x*2));\n }\n else if(i!=0 && i==1)\n {\n printf(\"%d %d\",(x*2),(x*2)+1);\n }\n else if(i!=0 && i>1)\n {\n printf(\"%d %d\",(x*2),(x*2)+2);\n }\n return 0;\n\n}\n"}, {"source_code": "#include\nint main()\n{\nlong long int n,j,r,k,y,z,s,a,b;\nscanf(\"%lld\",&n);\nb=2;\na=n-5;\ns=0;\nif(n>=7)\n{\nj=n%7;\nr=(n-j)/7;\nk=2*r;\nif(j==0 || j==1 || j==2)\n{\ny=k+j;\nz=k; }\nelse\ny=k+2;\nif(j==6)\nz=k+1;\nelse\n{\nz=k; \nprintf(\"%lld %lld\",z,y);\n}\n}\nelse\n{\nif(n==0 ||n==1)\n{\nprintf(\"%lld %lld\",s,n);\n}\nif(n==6 || n==7)\n{\nprintf(\"%lld %lld\",a,b);\n}\nif(n==2 || n==3 || n==4 ||n==5)\nprintf(\"%lld %lld\",s,b);\n}\nreturn 0;\n}\n\n"}, {"source_code": "#include\nint main ()\n{\n int n,m,p;\n scanf(\"%d\",&n);\n m=2*(n/7);\n p=n%7;\n if(n>=7 && n%7==0)\n {\n printf(\"%d %d\",m,m);\n }\n else if(n>=2 && n<6)\n {\n printf(\"0 2\");\n }\n else if(n>7 && n%7==1)\n {\n printf(\"%d %d\",m,m+p);\n }\n else if(n==6)\n {\n printf(\"1 2\");\n }\n else if(n==1)\n {\n printf(\"0 1\");\n }\n else\n {\n printf(\"%d %d\",m,m+2);\n }\n return 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n long long int n,min,max;\n scanf(\"%lld\",&n);\n min=2*n/7;\n if(n%7==1)\n max=(2*(n/7))+1;\n else if(n%7==0)\n max=2*(n/7);\n else if(n%7>=2)\n max=(2*(n/7))+2;\n\n printf(\"%lld %lld\",min,max);\n return 0;\n\n}\n"}, {"source_code": "#include\nint main()\n{\n\tlong long int n=0,k=0,l=0,x=0,j=0;\n\tscanf(\"%lld\",&n);\n\tif(n%7==0)\n\t{\n\t\tk=(n/7)*2;\n\t\tprintf(\"%lld %lld\\n\",k,k);\n\t}\n\tif(((n%7)!=0)&&(n<7))\n\t{ if(n!=6)\n\t\t{\n\t\t\tk=0;\n\t\t\tj=2;\n\t\t\tprintf(\"%lld %lld\\n\",k,j);\n\t\t}\n\t\telse\n\t\t{\tk=1;\n\t\t\tj=2;\n\t\t\tprintf(\"%lld %lld\\n\",k,j);\n\t\t}\n\n\t}\n\tif(((n%7)!=0)&&(n%7<=2)&&(n!=2)&&(n!=1))\n\t{\n\t\tk=n/7;\n\t\tl=2*k;\n\t\tx=((n/7)*2)+(n%7);\n\t\tprintf(\"%lld %lld\\n\",l,x);\n\t}\n\tif((n%7!=0)&&(n%7>2)&&(n>7))\n\t{\tif(6==n%7)\n\t\t{\n\t\t\tk=n/7;\n\t\t\tl=2*k+1;\n\t\t\tx=((n/7)+1)*2;\n\t\t\tprintf(\"%lld %lld\\n\",l,x);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tk=n/7;\n\t\t\tl=2*k;\n\t\t\tx=(n/7+1)*2;\n\t\t\tprintf(\"%lld %lld\\n\",l,x);\n\t\t}\n\t\tl=2*k;\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \nint main (){\n int n;\n scanf (\"%d\",&n);\n if (n<7){\n printf (\"0 \");\n if (n>=2)\n printf (\"2\");\n }else\n if (n%7==0){\n printf (\"%d %d\",(n/7)*2,(n/7)*2);\n }else if (n%7>2)\n printf (\"%d %d\",(n/7)*2,(n/7)*2+2);\n else printf (\"%d %d\",(n/7)*2,(n/7)*2+(n%7));\n\n\n}\n"}, {"source_code": "#include\nint main()\n{\n long int n,min,max,r;\n scanf(\"%ld\",&n);\n r=n%7;\n if(n<7)\n {\n min=n/6;\n if(n<2)\n {\n max=n;\n }\n else\n max=2;\n }\n else if(r==0)\n {\n min=2*(n/7);\n max=2*(n/7);\n }\n else\n {\n min=2*(n/7);\n max=2*(n/7)+2;\n }\n printf(\"%ld %ld\",min,max);\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\nint In;\nscanf(\"%d\",&In);\nprintf(\"%d %d\",2*(In/7),In%7+2*(In/7));\nreturn 0;\n}\n"}, {"source_code": "#include \nint main (){\n int n;\n scanf (\"%d\",&n);\n if (n<7){\n printf (\"1 \");\n if (n>=2)\n printf (\"2\");\n }else\n if (n%7==0){\n printf (\"%d %d\",(n/7)*2,(n/7)*2);\n }else if (n%7>2)\n printf (\"%d %d\",(n/7)*2,(n/7)*2+2);\n else printf (\"%d %d\",(n/7)*2,(n/7)*2+(n%7));\n\n\n}\n"}, {"source_code": "#include\"stdio.h\"\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tif(n%7==0){\n\t\tprintf(\"%d %d\",(n/7)*2,(n/7)*2);\n\t}\n\telse{\n\t\tif(n<7){\n\t\t\tprintf(\"%d %d\",(n/7)*2,(n/7)*2+n%7);\n\t\t}\n\t\telse printf(\"2\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int d,a,b;\n scanf(\"%d\",&d);\n if(d%7==0)\n {\n a=(d/7)*2;\n printf(\"%d %d\",a,a);\n return 0;\n }\n else if(d%7==1){\n b=((d/7)*2);\n printf(\"%d %d\",b,b+1);\n return 0;\n }\n else\n printf(\"%d %d\",(d/7)*2,((d/7)*2)+2);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n,x,z,i=0,j;\n scanf(\"%d\",&n);\n z=n;\n\n if(n/7>=1)\n {\n x=n/7;\n x=x*2;\n while(z--%7!=0)\n {\n i++;\n }\n j=x+i;\n }\n else\n {\n if(n<=2)\n {\n x=0;\n j=n;\n }\n \n else\n {\n x=0;\n j=2;\n }\n \n }\n\n printf(\"%d %d\",x,j);\n return 0;\n}\n\n"}, {"source_code": "#include \n\n\nint main(){\n\tunsigned int n;\n\tunsigned int min;\n\tunsigned int max;\n\tscanf(\"%u\",&n);\n\tmin=n/7*2;\n\tif(n%7>=2){\n\t\tmax=2;\n\t}else{\n\t\tmax=n%7;\n\t}\n\tprintf(\"%u %u\",min,min+max);\n\t\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,i,x,j;\n scanf(\"%d\", &n);\n i = n%7;\n x = n/7;\n if(i==0)\n {\n j=x*2;\n printf(\"%d %d\",j,j);\n }\n else if(i!=0 && i<6 && i>1)\n {\n printf(\"%d %d\",x,x+2);\n\n }\n else if(i==1)\n {\n printf(\"0 1\");\n }\n else if(i==6)\n {\n printf(\"1 2\");\n }\n return 0;\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,max,min;\n scanf(\"%d\",&n);\n max=min=(2*n)/7;\n if((n%7)==1)\n max++;\n if((n%7)==2 || (n%7)>2)\n max+=2;\n if((n%7)==6)\n min++;\n printf(\"%d %d\",min,max);\n return 0;\n}\n"}, {"source_code": "#include\nint ngaynghitoithieu(int n){\n\t printf(\"%d \",2*n/7);\n}\nint ngaynghitoida(int n){\n\tint k=n%7;\n\tif(k<=2) printf(\"%d\",(2*n/7)+k);\n\telse printf(\"%d\",2*n/7+2);\n}\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tngaynghitoithieu(n);\n\tngaynghitoida(n);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long n,max,min,a;\n scanf(\"%lld\",&n);\n\n a=n/7;\n min=a*2;\n if(n%7==0)\n {\n max=min;\n\n }\n else if(n==7 || (n<6 && n>=2))\n {\n min=0;\n max=2;\n }\n else if(n<2)\n {\n min=0;\n max=1;\n }\n else if(n==6)\n {\n min=1;\n max=2;\n }\n else if(n%7!=0 && n%7>=1 || n%7<=2 && n>7)\n {\n min=n/7+1;\n max=min+n%7;\n\n }\n else if(n%7!=0 && n%7>2 || n%7<=6 && n>=10)\n {\n min=min+1;\n max=min+2;\n\n }\n\n\n\n printf(\"%lld %lld\",min,max);\n\n}\n"}, {"source_code": "#include \nint main()\n{\n\tint n,max,min,a;\n\tscanf(\"%d\",&n);\n\tmax=min=n/7;\n\ta=n%7;\n\tif(a>=2){\n\t\tmax= max+2;\n\t}\n\telse if ( a==1){\n\t\tmax=max+1;\n\t}\n\tprintf(\"%d %d\",min,max);\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n, min = 0, max = 0;\n scanf(\"%d\", &n);\n if(n%7 == 1)\n {\n min = n/7*2;\n max = n/7*2 +1;\n }\n if(n%7 == 0)\n {\n min = n/7*2;\n max = n/7*2;\n }\n if(n%7 >=2)\n {\n min = n/7*2;\n max = n/7*2+2;\n }\n printf(\"%d %d\", min, max);\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n#include\nint main(){\n int days;\n int i,j,k;\n int min,max;\n while(~scanf(\"%d\",&days)){\n min=days/7*2;\n if(days%7<=2)\n max=days%7+min;\n else\n max=2+min;\n printf(\"%d %d\\n\",min,max);\n }\n return 0;\n}\n\n"}, {"source_code": "#include\"stdio.h\"\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tif(n%7==0){\n\t\tprintf(\"%d %d\",(n/7)*2,(n/7)*2);\n\t}\n\telse{\n\t\tif(n<7){\n\t\t\tprintf(\"%d %d\",(n/7)*2,(n/7)*2+n%7);\n\t\t}\n\t\telse printf(\"2\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint min,max;\n\tif(n>=7)\n\t{\n\tint k=n/7;\n\tif(n%7==0)\n\t{\n\tmin=k*2;\n\tmax=k*2;\n\t}\n\telse if(n%7==1)\n\t{\n\t\tmin=k*2;\n\t\tmax=k*2+1;\n\t}\n\telse if((n%7)>1)\n\t{\n\t\tmin=k*2;\n\t\tmax=k*2+2;\n\t}\n}\n\telse \n\t{\n\t\tmin=0;\n\t\tmax=2;\n\t}\n\tprintf(\"%d %d\\n\",min,max);\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tlong long int n=0,k=0,l=0,x=0;\n\tscanf(\"%lld\",&n);\n\tif(n%7==0)\n\t{\n\t\tk=(n/7)*2;\n\t\tprintf(\"%lld %lld\\n\",k,k);\n\t}\n\tif(((n%7)!=0)&&(n<7))\n\t{\n\t\tk=0;\n\t\tprintf(\"%lld %lld\\n\",k,n);\n\t}\n\tif(((n%7)!=0)&&(n%7<=2)&&(n!=2))\n\t{\n\t\tk=n/7;\n\t\tl=2*k;\n\t\tx=(n/7)+(n%7);\n\t\tprintf(\"%lld %lld\\n\",l,x);\n\t}\n\t\treturn 0;\n\t}\n"}, {"source_code": "#include\"stdio.h\"\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tif(n%7==0){\n\t\tprintf(\"%d %d\",(n/7)*2);\n\t}\n\telse{\n\t\tprintf(\"%d %d\",(n/7)*2,(n/7)*2+n%7);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n int max,min,n;\n scanf(\"%d\",&n);\n if(n==1){\n printf(\"0 1\");\n }\n else if(n>=2&&n<7){\n printf(\"0 2\");\n }\n else if(n==7){\n printf(\"2 2\");\n }\n else if(n>7){\n if(n%7==0){\n max=(n/7)*2;\n printf(\"d %d\",max,max);\n }\n else if(n%7!=0){\n max=((n/7)+1)*2;\n min=(n/7)*2;\n printf(\"%d %d\",min,max);\n }\n }\n}"}, {"source_code": "#include\n\t\n\tint main(){\n\tint n,x;\n\tscanf(\"%d\", &n);\n\t\n\tif (1\nint main(){\n \n int a,n,x,b;\n scanf(\"%d\",&n);\n a=n%7;\n b=n/7;\n \n if(a<=2)\n {\n x=2*b+a;\n printf(\"%d\",x);\n }\n \n else if(a>2){\n x=2*b+2;\n printf(\"%d\",x);}\n return 0;\n \n}"}, {"source_code": "#include\n\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tint tuan=n/7;\n\tif(n==6)\n\t\tprintf(\"1 \");\n\telse\n\t\tprintf(\"%d \",2*tuan);\n\tif(n%7==1)\n\t\tprintf(\"%d\",2*tuan+1);\n\telse if(n%7>=2)\n\t\tprintf(\"%d\",2*tuan+2);\n\telse\n\t\tprintf(\"%d\",2*tuan);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int i,n,x;\n scanf(\"%d\",&n);\n\n if(n%7==1) x=1;\n else if(n%7>=2) x=2;\n if(n%7==0) printf(\"%d %d\",n/7*2,n/7*2);\n else if(n<7)\n {\n if(n<6) printf(\"0\");\n else if(n==6) printf(\"1\");\n printf(\"%d \",n/7+x);\n }\n else if(n>7)\n {\n if(n%7<6) printf(\"%d\",n/7*2);\n else if(n%7==6) printf(\"%d\",n/7*2+1);\n printf(\"%d \",n/7*2+x);\n }\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long n,max,min,a;\n scanf(\"%lld\",&n);\n\n a=n/7;\n min=a*2;\n if(n%7==0)\n {\n max=min;\n\n }\n else if(n==7 || (n<6 && n>=2))\n {\n min=0;\n max=2;\n }\n else if(n<2)\n {\n min=0;\n max=1;\n }\n else if(n==6)\n {\n min=1;\n max=2;\n }\n else if(n%7!=0 && n%7>=1 || n%7<=2 && n>7)\n {\n min=n/7+1;\n max=min+n%7;\n\n }\n else if(n%7!=0 && n%7>2 || n%7<=6 && n>7)\n {\n min=n/7+1;\n max=min+2;\n\n }\n\n\n\n printf(\"%lld %lld\",min,max);\n\n}\n"}, {"source_code": "#include \nint main (){\n int n;\n scanf (\"%d\",&n);\n if (n<7){\n printf (\"1 \");\n if (n>=2)\n printf (\"2\");\n }else\n if (n%7==0){\n printf (\"%d %d\",(n/7)*2,(n/7)*2);\n }else if (n%7>2)\n printf (\"%d %d\",(n/7)*2,(n/7)*2+2);\n else printf (\"%d %d\",(n/7)*2,(n/7)*2+(n%7));\n\n\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int day,offday,dayleft,maxoffday,totaloffday,minimumoffday;\n\n scanf(\"%d\",&day);\n\n if(day == 1)\n {\n printf(\"0 1\");\n return 0;\n }\n if(day < 7)\n {\n printf(\"1 2\");\n return 0;\n }\n\n offday = day/7;\n dayleft = day%7;\n\n if(day % 7 == 0)\n {\n maxoffday = offday * 2;\n minimumoffday = offday * 2;\n printf(\"%d %d\",minimumoffday,maxoffday);\n return 0;\n }\n\n\n\n totaloffday = offday * 2;\n\n minimumoffday = totaloffday;\n printf(\"%d \",minimumoffday);\n\n\n if(dayleft > 2)\n {\n maxoffday = totaloffday + 2;\n printf(\"%d\",maxoffday);\n }\n\n\n return 0;\n}"}, {"source_code": "#include\nint main ()\n{\nlong long n,min=0,max=0,a,week,x;\nscanf(\"%I64d\",&n);\nif(n==1)\n{\n printf(\"0 1\");\n}\nelse if(n==6)\n{\n printf(\"1 2\");\n}\nelse if(n%7==0)\n{\nweek=n/7;\nmax=2*week;\nmin=max;\nprintf(\"%I64d %I64d\\n\",min,max);\n}\nelse\n{\nweek=n/7;\nx=week*7;\nif((x-n)==1 || (n-x)==1)\n{\n min=2*week;\n max=2*week+1;\n printf(\"%I64d %I64d\\n\",min,max);\n}\nelse\n{\n min=2*week;\n max=2*week+2;\n printf(\"%I64d %I64d\\n\",min,max);\n}\n\n}//main();\n}"}, {"source_code": "#include\nint main(){\n int n,min,max,r,q;\nscanf(\"%d\",&n);\nq=n/7;\nr=n%7;\nif(r>=2){\nmax=q*2+2;\n}\nif(r==6){\n min=q*2+1;\n}\nif(r>=2 && r!=6){\n min=2*q+0;\n}\nif(r==1){\n min=2;\n max=1;\n}\nif(r==0){\n max=2*q;\n min=max;\n}\nprintf(\"%d %d\",min,max);\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,k;\n scanf(\"%d\",&n);\n k=n/7;\n if(n>7)\n {\n if((n-(k*7))==0)\n {\n\n printf(\"%d\",k*2);\n printf(\"%d\",k*2);\n }\n else if((n-(k*7))>5)\n printf(\"%d\",(k*2)+1);\n else if(((n-(k*7))>0)&&((n-(k*7))<5))\n printf(\"%d\",k*2);\n\n if((n-(k*7))>=2)\n printf(\"%d\",(k*2)+2);\n else if(((n-(k*7))==1))\n printf(\"%d\",(k*2)+1);\n }\n else if(n==1)\n {\n printf(\"0\");\n printf(\"1\");\n }\n else if(n==6)\n {\n\n printf(\"1\");\n printf(\"2\");\n }\n else if((n>1)&&(n<6))\n {\n\n printf(\"0\");\n printf(\"2\");\n }\n else if(n==7)\n {\n printf(\"2\");\n printf(\"2\");\n }\n\n return 0;\n}\n\n\n"}, {"source_code": " long long i=2,j=5,max=0,min=0,ml=0,mi=0;\nint rev(int k){return(k==0)?1:0;}\nmain(n)\n{scanf(\"%I64d\",&n);\nwhile(i<=n){max+=(ml==0)?2:0;\ni+=(ml==0)?5:2;ml=rev(ml);}\nwhile(j<=n){min+=(mi==0)?2:0;\nj+=(mi==0)?2:5;mi=rev(mi);}\nprintf(\"%I64d %I64d\",min,max);\n}\n"}, {"source_code": "#include\n\nint main(){\n\n long long int n,i,j,a1,a2,a3,b1,b2=0,b3;\n \n scanf(\"%I64d\",&n);\n \n a1=n/7;\n a2=n%7;\n \n b1=a1*2;\n \n if(a2==6) b2=1;\n if(a2>=1 && a2<=5) b2=2;\n if(a2==0) b2=0;\n printf(\"%I64d %I64d\",b1,b1+b2);\n}"}, {"source_code": "#include\nint main()\n{\n int n,r,s;\n scanf(\"%d\",&n);\n r=n/7;\n s=r*2;\n if(n<6&&n!=1){\n printf(\"0 2\");\n }\n else if(n==6){\n printf(\"1 2\");\n }\n else if(n<7&&n==1){\n printf(\"0 1\");\n }\n else if(n%7==0){\n printf(\"%d %d\",s,s);\n }\n else if(n%2!=0&&n%7!=0){\n printf(\"%d %d\",s,s+1);\n }\n}\n"}], "src_uid": "8152daefb04dfa3e1a53f0a501544c35"} {"nl": {"description": "You are given a positive integer $$$n$$$.Let $$$S(x)$$$ be sum of digits in base 10 representation of $$$x$$$, for example, $$$S(123) = 1 + 2 + 3 = 6$$$, $$$S(0) = 0$$$.Your task is to find two integers $$$a, b$$$, such that $$$0 \\leq a, b \\leq n$$$, $$$a + b = n$$$ and $$$S(a) + S(b)$$$ is the largest possible among all such pairs.", "input_spec": "The only line of input contains an integer $$$n$$$ $$$(1 \\leq n \\leq 10^{12})$$$.", "output_spec": "Print largest $$$S(a) + S(b)$$$ among all pairs of integers $$$a, b$$$, such that $$$0 \\leq a, b \\leq n$$$ and $$$a + b = n$$$.", "sample_inputs": ["35", "10000000000"], "sample_outputs": ["17", "91"], "notes": "NoteIn the first example, you can choose, for example, $$$a = 17$$$ and $$$b = 18$$$, so that $$$S(17) + S(18) = 1 + 7 + 1 + 8 = 17$$$. It can be shown that it is impossible to get a larger answer.In the second test example, you can choose, for example, $$$a = 5000000001$$$ and $$$b = 4999999999$$$, with $$$S(5000000001) + S(4999999999) = 91$$$. It can be shown that it is impossible to get a larger answer."}, "positive_code": [{"source_code": "#include\n#include\nint main()\n{\n long long int n,f=1,y,x=1;\n scanf(\"%lld\",&n);\n y=n;\n int i,s=0,a[15];\n for(i=0;n!=0;i++)\n {\n n/=10;\n f*=10;\n }\n f/=10;\n f--;\n x=9*(i-1);\n y-=f;\n for(i=0;y!=0;i++)\n {\n a[i]=y%10;\n s+=a[i];\n y/=10;\n }\n printf(\"%d\\n\",s+x);\n}\n"}, {"source_code": "#include\n#include\nchar r[102];\nint main ()\n{\n\tlong long int x=0,y=0,z,i,j,k=0,q=0;\n\tscanf(\"%s\",&r);\n\tz=strlen(r);\n\tk=9*(z-1);\n\tfor(i=0;i\n#define I64 long long int\nI64 call(I64 x)\n{\n I64 sum=0,a;\n while(x!=0)\n {\n a=x%10;\n x=x/10;\n sum=sum+a;\n }\n return sum;\n}\nint main()\n{\n I64 n;\n scanf(\"%I64d\",&n);\n I64 d=0;\n while(d\n#include \nint main()\n{\n\tchar s[15];\n\tint ans, len, c;\n\twhile (~scanf(\"%s\", s))\n\t{\n\t\tc = 1;\n\t\tans = 0;\n\t\tlen = strlen(s);\n\t\tans += s[0] - '0' + (len - 1) * 9 - 1;\n\t\tfor (int i = len - 1; i > 0; i--)\n\t\t{\n\t\t\ts[i] += c;\n\t\t\tc = (s[i] - '0') / 10;\n\t\t\ts[i] = (s[i] - '0') % 10 + '0';\n\t\t\tans += s[i] - '0';\n\t\t}\n\t\tprintf(\"%d\\n\", ans + c);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n#include \nint main()\n{\n\tchar s[15];\n\tint ans, len;\n\tlong long n;\n\twhile (~scanf(\"%s\", s))\n\t{\n\t\t\n\t\tans = 0;\n\t\tlen = strlen(s);\n\t\tif (len > 1)\n\t\t\tsscanf(s + 1, \"%lld\", &n);\n\t\telse n = 0;\n\t\tans += s[0] - '0' + (len - 1) * 9 - 1;\n\t\tn++;\n\t\twhile (n)\n\t\t{\n\t\t\tans += n % 10;\n\t\t\tn /= 10;\n\t\t}\n\t\tprintf(\"%d\\n\", ans);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n#include \nint main()\n{\n\tchar st[30];\n\tlong long a,j=1,i,sum=0,k=1,sum2=0,b,c,r,d;\n\tint total;\n\tscanf(\"%s\",st);\n\ta=strlen(st);\n\tfor(i=1;i<=a-1;i++)\n\t{\n\t\tsum+=(9*j);\n\t\tj=j*10;\n\t}\n\tb=((st[0]-49)*j)+sum;\n\tfor(i=a-1;i>=0;i--)\n\t{\n\t\tsum2+=(st[i]-48)*k;\n\t\tk=k*10;\n\t}\n\ttotal=((a-1)*9)+st[0]-49;\n\td=sum2-b;\n\twhile(d!=0)\n\t{\n\t\tr=d%10;\n\t\tc=d/10;\n\t\td=c;\n\t\ttotal+=r;\n\t}\n\tprintf(\"%d\\n\",total);\n\treturn 0;\n\t\n}"}, {"source_code": "#include \n\nint num_len(long long n)\n{\t\n\tint len = 0;\n\twhile (n && ++len && (n /= 10));\n \treturn len;\t\n}\n\nint sum_digits(long long n)\n{\t\n\tint sum = 0;\n\n\twhile (n) {\n\t\tsum += n % 10;\n\t\tn /= 10;\t\n\t}\n\n\treturn sum;\n}\n\nint main() {\n\tlong long n, a = 0, b = 0;\n\tlong long lenN, sumA, sumB;\n\n\tscanf(\"%lld\", &n);\n\n\tlenN = num_len(n);\n\t\n\tfor (int i = 0; i < lenN - 1; i++) {\n\t\ta = a * 10 + 9; \n\t}\n\n\tsumA = 9 * (lenN - 1);\n\tb = n - a;\n\tsumB = sum_digits(b);\n\n\tprintf(\"%lld\", sumA + sumB);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include \nint main() {\n\tlong long n,n2;\n\tint ans=0;\n\n\tscanf(\"%I64d\", &n);\n\tn2 = 9;\n\twhile (n > n2) {\n\t\tans += 9;\n\t\tn2 *= 10;\n\t\tn2 += 9;\n\t}\n\tn2 /= 10;\n\tn -= n2;\n\twhile (n > 0) {\n\t\tans += n % 10;\n\t\tn /= 10;\n\t}\n\tprintf(\"%d\", ans);\n}"}, {"source_code": "#include \n#include\n#include\n\nint main() \n{\n\tlong long int a=0,b=0,n=0,k;\n\tint ans=0,len,i,m,x=0;\n\tchar s[15];\n\tscanf(\"%s\",&s);\n\tlen=strlen(s);\n\tm=len;\n\tlen--;\n\tx=0;\n\twhile(m)\n\t{\n\t\tm--;\n\t\tk=1;\n\t\tfor(i=m;i>=1;i--)\n\t\t{\n\t\t\tk*=10;\n\t\t}\n\t\tn+=(s[x]-'0')*k;\n\t\tx++;\n\t}\n\twhile(len)\n\t{\n\t\tk=1;\n\t\tfor(i=len-1;i>=1;i--)\n\t\t{\n\t\t\tk*=10;\n\t\t}\n\t\ta=a+k*9;\n\t\tlen--;\n\t}\n\tb=n-a;\n\tans=0;\n\twhile(a)\n\t{\n\t\tans=ans+a%10;\n\t\ta=a/10;\n\t}\n\twhile(b)\n\t{\n\t\tans=ans+b%10;\n\t\tb=b/10;\n\t}\n\tprintf(\"%d\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n long long n,m,b,p=1,sum=0;\n int k,count=0;\n scanf(\"%lld\",&n);\n m=n;\n while(m){\n k=m%10;\n m=m/10;\n count++;\n }\n if(k==1)\n count--;\n\nwhile(count>1){\n m+=(9*p);\n p*=10;\n count--;\n}\nif(k==1)\n m+=9*p;\nelse\n k--, m+=k*p;\n\nb=n-m;\nwhile(b){\n sum+=(b%10);\n b=b/10;\n}\nwhile(m){\n sum+=(m%10);\n m=m/10;\n}\nprintf(\"%d\",sum);\n\n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include \n\nlong long summer(long long a)\n{\n long long sum =0;\n while(a>0)\n {\n sum+=a%10;\n a/=10;\n }\n return sum;\n}\n\nint main()\n{\n long long n;\n scanf(\"%lld\",&n);\n long long b=0;\n while(b\n#include\nint main()\n{\n long long int n,t=0,p=0,k=0,a1=0,k1=0,k3=0,l=0,y=0,i,m=1;\n scanf(\"%lld\",&n);\n t=n;\n if(t<=9)\n printf(\"%lld\",t);\n else\n {\n k3=t;\n while(k3!=0)\n {\n k3=k3/10;\n p++;\n }\n for(i=1;i<=p-1;i++)\n {\n k=k+9*m;\n m=m*10;\n }\n k1=t-k;\nwhile(k1!=0)\n {\n y=k1%10;\n l=l+y;\n k1=k1/10;\n }\n printf(\"%lld\",l+((p-1)*9));\n }\n return 0;\n}\n"}, {"source_code": "#include\n\nint main(){\n long long int n,sum=0,x,y,m;\n scanf(\"%lld\",&n);\n \n if(n==0)\n printf(\"%lld\\n\",n);\n else{\n m=1;\n while(10*m<=n){\n m*=10;\n }\n x=m-1;\n y=n-m+1;\n \n while(x>0){\n sum+=(x%10);\n x/=10;\n }\n while(y>0){\n sum+=(y%10);\n y/=10;\n }\n printf(\"%lld\\n\",sum);\n }\n return 0;\n}"}, {"source_code": "#include \n\nlong long calcs(long long x) {\n\tlong long sum = 0;\n\tlong long k = x;\n\tfor (int i = 1; k > 0; k=k/10) {\n\t\tsum+=(k%10);\n\n\t}\n\treturn sum;\n}\n\n\nint main () {\n\tlong long n;\n\tscanf(\"%lld\", &n);\n\tlong long i, j, tmp;\n\tlong long max = 0, sum = 0;\n\tlong long f1 = 9, dz = 1;\n\tlong long f2 = n;\n\twhile (f2 >= f1) {\n\t\tf1 = (f1*10) + 9;\n\t}\n\tf1 = f1 / 10;\n\ti = f1;\n\tj = n-f1;\n for (long long k = i; k > 0; k=k/10) {\n sum+=(k%10);\n }\n\n for (long long k = j; k > 0; k=k/10) {\n sum+=(k%10);\n }\n\tprintf(\"%lld\\n\", sum);\n\n\treturn 0;\n}\n"}, {"source_code": "#include \nint main(){\n long long n;\n scanf(\"%lld\",&n);\n long long a=0;long long b=0;\n long long counter=10;int flag=1;\n while(n>0){\n if(flag==1){\n if(n>9*counter/10)\n a+=9*(counter/10);\n else{\n a+=n%counter;\n break;}\n }\n else{\n if(n>9*counter/10)\n b+=9*(counter/10);\n else{\n b+=n%counter;\n }}\n n-=9*(counter/10);\n if(flag==-1)\n counter*=10;\n flag*=-1;\n\n\n }\n\n\n\n int sum=0;\n while(a!=0){\n sum+=a%10;\n a/=10;\n }\n while(b!=0){\n sum+=b%10;\n b/=10;\n }\n printf(\"%d\",sum);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \nlong long int digitsum(long long int x)\n{\n long long int num=0;\n while(x>0)\n {\n num+=x%10;\n x/=10;\n }\n return num;\n}\nlong long int power(long long int i)\n{\n int p;\n long long int c=1;\n for(p=1;p<=i;p++)\n c*=10;\n return c;\n}\nint main()\n{\n long long int n,i,a=0,b,sa=0,sb,stot,c=0;\n scanf(\"%I64d\",&n);\n if(n<10)\n printf(\"%I64d\",n);\n else\n {\n long long int x=n;\n while(x>9)\n {\n x/=10;\n c++;\n }\n for(i=0;i\nint main()\n{\n\n long long n;\n int a,b,carry=0,s1=0,s2=0;\n\n scanf(\"%I64d\",&n);\n int temp = n;\n while(n!=0)\n {\n int r = n%10;\n a=r+10-9-carry;\n\n carry = a<=9?1:0;\n s1+=a%10;\n s2+=9;\n\n\n n/=10;\n }\n\n printf(\"%d\\n\",carry==1?s1+s2-10:s1+s2);\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\nlong long int n,m,i=0,A[20]={0},j,sum1=0,k=1,p=0,q,sum2=0,B[20]={0};\nscanf(\"%I64d\",&n);\nm=n;\nwhile(m!=0){\n A[i]=m%10;\n m=(m-A[i])/10;\n i=i+1;\n}\nA[i-1]=A[i-1]-1;\nsum1=sum1+A[i-1];\nfor(j=0;j\n#include \n#include \n\ntypedef unsigned long long ll;\ntypedef long double LD;\n\n#define MAXN 101\n\n#define MIN(a,b) ((a)<(b)?(a):(b))\n\nchar arr[MAXN];\n\nint sumdigits(ll input)\n{\n int sum;\n sum = 0;\n while (input >0)\n {\n sum += input%10;\n input /= 10;\n }\n return (sum);\n}\n\nint main(void)\n{\n ll N;\n int ans;\n ll nines, temp;\n\n\t#ifndef ONLINE_JUDGE\n FILE *fp;\n\tfp = freopen(\"..\\\\..\\\\1060\\\\B\\\\1060B.TXT\",\"r\",stdin);\n\t//fp = freopen(\"1047C.TXT\",\"r\",stdin);\n\tif (fp == NULL)\n {\n printf (\"Cannot open file\\n\\n\");\n exit(0);\n }\n\t#endif\n\n #ifndef ONLINE_JUDGE\n\n #else\n scanf(\"%I64d\",&N);\n #endif\n\n if (N<9)\n {\n ans = N;\n }\n else\n {\n nines = 1;\n temp = N;\n while (temp >= 10)\n {\n nines *= 10;\n temp /=10;\n }\n nines -=1;\n\n ans = sumdigits(nines) + sumdigits(N-nines);\n }\n printf (\"%d\",ans);\n\n return (0);\n}\n"}, {"source_code": "#include\n#include\nint sum(long long a);\nint num(long long b);\nmain()\n{\n int n,i,j,total;\n long long m,a,b,po;\n scanf(\"%I64d\", &m);\n n=num(m);\n total=(n-1)*9;\n po=1;\n for (i=1;i<=n-1;i++)\n po*=10;\n b=m-po;\n b++;\n printf(\"%d\",total+sum(b));\n}\nint sum(long long a)\n{\n int s=0;\n do\n {\n s+=a%10;\n a=a/10;\n }\n while(a!=0);\n return s;\n}\nint num(long long a)\n{\n int s=0;\n do\n {\n s++;\n a=a/10;\n }\n while(a!=0);\n return s;\n}\n\n\n"}, {"source_code": "#include \nint main() {\n\tlong long n,n2;\n\tint ans=0;\n\n\tscanf(\"%lld\", &n);\n\tn2 = 9;\n\twhile (n > n2) {\n\t\tans += 9;\n\t\tn2 *= 10;\n\t\tn2 += 9;\n\t}\n\tn2 /= 10;\n\tn -= n2;\n\twhile (n > 0) {\n\t\tans += n % 10;\n\t\tn /= 10;\n\t}\n\tprintf(\"%d\", ans);\n}"}, {"source_code": "#include \nint f(long long int a){\n\t\n\tint ans;\n\tans = 0;\n\twhile(a){\n\t\tans += a % 10;\n\t\ta /= 10;\n\t}\n\treturn ans;\n}\nint main(){\n\tlong long int a;\n\tlong long int i;\n\tlong long int ans;\n\tans = 0;\n\tscanf(\"%lld\", &a);\n\tif(a <= 10){\n\t\tprintf(\"%d\", a);\n\t\treturn 0;\n\t}\n\tfor(i = 9;i <= a ; i= i*10 + 9){\n\t\tif(ans < f(i) + f(a - i))\n\t\t\tans = f(i) + f(a - i);\n\t}\n\tprintf(\"%lld\", ans);\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\nlong long int n,a,b=0,c;\nscanf(\"%I64d\",&n);\nlong long int i,s=0,r,m=0;\nc=n;\nfor(i=0;n!=0;i++)\n{\nn=n/10;\ns++;\n}\nfor(i=1;i\nint s(long long int a){\n\tint sum = 0;\n\twhile(a){\n\t\tsum += a % 10;\n\t\ta /= 10;\n\t}\n\treturn sum;\n}\nint main(){\n\tlong long int n;\n\tscanf(\"%I64d\", &n);\n\tlong long int a=1, b;\n\n\twhile((a*10) < n) a *= 10;\n\tif(a != 1) a--;\n\tb = n - a;\n\n\tprintf(\"%d\\n\", s(a) + s(b));\n\treturn 0;\n}"}, {"source_code": "#include\nint main () \n{\n\tlong long int n,x,y,sum1=0,sum2=0,remain1=99,remain2=99,a1,a2,h=89,num,m,cnt=0;\n\tscanf(\"%lld\",&n);\n\tm=n;\n\twhile(m!=0)\n\t{\n\t\th=m%10;\n\t\tm/=10;\n\t\tif (m==0)\n\t\t{\n\t\t\tnum=h;\n\t\t}\n\t\tcnt++;\n\t}\n\tfor(int i=1;i\n#include\n\nint main()\n{\n\tlong long int n, i, x=0, r=0, y, f=0;\n\tchar s[14];\n\t\n\tscanf(\"%lld\", &n);\n\t\n\tif(n<10)\n\t{\n\t\tprintf(\"%lld\", n);\n\t}\n\telse\n\t{\n\t\tsprintf(s, \"%lld\", n);\n\t\ty=strlen(s);\n\t\t\n\t\tfor(i=y-1; i>=0; i--)\n\t\t{\t\n\t\t\tif(s[i]=='9' && f==0){\n\t\t\t\tr++;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tx+=s[i]-'0';\n\t\t\t\tf++;\n\t\t\t}\n\t\t}\n\t\tif(r==y)\n\t\t{\n\t\t\tprintf(\"%lld\", y*9);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"%lld\", x+((y-1)*9));\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n#include \n#include \"stdint.h\"\n\nint main()\n{\n char a[12];\n char Char[100];\n int c,d;\n //read first number\n scanf(\"%s\",a);\n //read second number\n c=strlen(a);\n // digitcounter(a,&result);\n d=0;\n int b=1;\n for(int i=c-1;i>0;i--){\n if((a[i]-'0')==9){\n if(!b){\n d+=(a[i]-'0');\n\n }\n }else {\n d+=(a[i]-'0');\n b=0;\n\n }\n }\n d+=(a[0]-'0');\n printf(\"%d\",d+(c-1)*9);\n return 0;\n}\n\n"}, {"source_code": "#include\n\nint main ()\n{\n long long int n,a,b,m=10,i,j,x,k,sum1=0,sum2=0,sum,count;\n scanf(\"%lld\",&n);\n b=n;\n for(i=1; i<=12; i++)\n {\n count=i;\n n=n/10;\n if(n==0)\n {\n break;\n }\n }\n if(count==1)\n {\n printf(\"%lld\\n\",b);\n }\n else\n {\n for(j=1; j<=count-2; j++)\n {\n m=m*10;\n }\n a=(b%m)+1;\n b=b-a;\n for(k=1; k<=12; k++)\n {\n sum1=sum1+b%10;\n b=b/10;\n }\n for(x=1; x<=12; x++)\n {\n sum2=sum2+a%10;\n a=a/10;\n }\n sum=sum1+sum2;\n printf(\"%lld\\n\",sum);\n }\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n long long int n,m=0,i;\n scanf(\"%lld\",&n);\n int x=0,c=0;\n for(i=n;i>0;i/=10)\n {\n x++;\n m=m*10+9;;\n }\n m/=10;\n c+=x*9-9;\n for(i=n-m;i>0;i/=10)\n {\n c+=i%10;\n }\n printf(\"%d\",c);\n return 0;\n}\n"}, {"source_code": "#include \nint main() {\n long long n,m,ten,b;\n\tint k;\n\tten = 1;\n scanf(\"%lld\", &n);\n m = n;\n int i;\n for (i = 0; (m /= 10) != 0; i++)\n continue;\n \n \n \n for (k = 0; k < i; k++)\n ten *= 10;\n \n b = n - ten + 1;\n int sum = 9 * i;\n while (b != 0)\n\t{\n sum += b % 10;\n b /= 10;\n }\n printf(\"%d\\n\", sum);\n\n\treturn 0;\n}"}, {"source_code": "#include \n\nint Fun(long long n)\n{\n int ret = 0;\n while(n) {\n ret += n % 10;\n n /= 10;\n }\n return ret;\n}\n\nint main()\n{\n long long n, m;\n scanf(\"%I64d\", &n);\n m = n;\n if(m < 10) {\n printf(\"%I64d\\n\", m);\n } else {\n long long p = 0, q = 1;\n while(m >= 10) {\n p += 9 * q;\n q *= 10;\n m /= 10;\n }\n p += (m - 1) * q;\n printf(\"%d\\n\", Fun(p) + Fun(n - p));\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n long long n, a=0, b, sum=0;\n scanf(\"%lld\", &n);\n for(a=0; a\n#include\n#include\n\nint main()\n\n{\n long long int n,sum=0,b=0,a;\n scanf(\"%lld\",&n);\n a=n;\n while(a/10!=0){\n sum=sum+9;\n a=a/10;\n b=b*10+9;\n }\n a=n-b;\n while(a!=0){\n sum=sum+a%10;\n a=a/10;\n }\n printf(\"%lld\\n\",sum);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tlong long int n,x=9,s=0,y=0,z;\n\tscanf(\"%lld\",&n);\n\twhile(x<=n){\n\t\ts=s+9;\n\t\ty=x;\n\t\tx=x*10+9;\n\t}\n\tz=n-y;\n\twhile(z!=0){\n\t\ts=s+z%10;\n\t\tz=z/10;\n\t}\n\tprintf(\"%lld\",s);\n}"}, {"source_code": "#include\n\nint main()\n{\n long long int n,sum,b;\n scanf(\"%I64d\",&n);\n int i =0;\n long long int ten =1;\n if(n<=10)printf(\"%I64d\\n\",n);\n else\n {\n\n\n while(n-ten*10>0)\n {\n i++;\n ten*=10;\n }\n b = n-ten+1;\n sum = 9 * i;\n while(b!=0)\n {\n sum = sum + b%10;\n b = b/10;\n }\n printf(\"%d\\n\",sum);\n }\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n=0, m=0, n1=9, n2=0, rem=0, temp=0, sum1=0, sum2=0;\n scanf(\"%I64d\", &n);\n while(n1<=n)\n {\n n1 = n1*10 + 9;\n }\n n1 = n1/10;\n n2 = n-n1;\n temp = n1;\n while(temp!=0)\n {\n rem = (temp%10);\n sum1 += rem;\n temp = temp/10;\n }\n temp = n2;\n while(temp!=0)\n {\n rem = (temp%10);\n sum1 += rem;\n temp = temp/10;\n }\n printf(\"%I64d\", sum1);\n}\n"}, {"source_code": "#include\nint main () {\n\tlong long n,a,b,s=0,t=1,a1,s1=0,t1,n1;\n\tscanf(\"%lld\",&n);\n\tn1=n;\n\twhile(n>0){\n\t\tn=n/10;\n\t\tt++;\n\t}\n\tt=t-2;\n//\tprintf(\"%lld\\n\",t);\n\tt1=t;\n\twhile(t>0){\n\t\tt--;\n\t\ts=s*10+9;\n\t}\n\ta=n1-s;\n//\tprintf(\"%lld %lld \\n\",a,s);\n\twhile(a>0){\n\t\ta1=a%10;\n\t\ts1=s1+a1;\n\t\ta=a/10;\n\t}\n//\tprintf (\"%lld %lld\\n\",s1,t1);\n\tprintf(\"%lld\",s1+9*t1);\n}\n"}, {"source_code": "#include \ntypedef long long int lli;\nint max(int a, int b) { if(a > b) return a; return b; }\nint digitsum(lli a)\n{\n int sum = 0;\n while(a > 0)\n {\n sum += a % 10;\n a /= 10;\n }\n return sum;\n}\nint main()\n{\n lli n;\n scanf(\"%I64d\", &n);\n if(n <= 9)\n return 0*printf(\"%I64d\\n\", n);\n\n lli x = 9;\n int a, ans = 0;\n while(x <= n)\n {\n a = digitsum(x) + digitsum(n - x);\n x = x * 10 + 9;\n ans = max(a, ans);\n }\n printf(\"%d\\n\", ans);\n}"}, {"source_code": "#include \n#include\n#include\n\nint main() \n{\n\tlong long int a=0,b=0,n=0,k;\n\tint ans=0,len,i,m,x=0;\n\tchar s[15];\n\tscanf(\"%s\",&s);\n\tlen=strlen(s);\n\tm=len;\n\tlen--;\n\tx=0;\n\twhile(m)\n\t{\n\t\tm--;\n\t\tk=1;\n\t\tfor(i=m;i>=1;i--)\n\t\t{\n\t\t\tk*=10;\n\t\t}\n\t\tn+=(s[x]-'0')*k;\n\t\tx++;\n\t}\n\twhile(len)\n\t{\n\t\tk=1;\n\t\tfor(i=len-1;i>=1;i--)\n\t\t{\n\t\t\tk*=10;\n\t\t}\n\t\ta=a+k*9;\n\t\tlen--;\n\t}\n\tb=n-a;\n\tans=0;\n\twhile(a)\n\t{\n\t\tans=ans+a%10;\n\t\ta=a/10;\n\t}\n\twhile(b)\n\t{\n\t\tans=ans+b%10;\n\t\tb=b/10;\n\t}\n\tprintf(\"%d\",ans);\n\treturn 0;\n}\n"}, {"source_code": "\n#include\n\n#include\n\n#define int long long\n\n///4394826 10000000000\n\n///I advise to use long long always\n\nmain(void)\n{\n int i,j,k,l,m,n,c=0,no1,no2;\n scanf(\"%lld\",&n);\n\n int t=n;\n\n while(t)\n {\n c++;\n t = t/10;\n\n }\n /// printf(\"%lld\\n\",c);\n no1=no2=0;\n\n for(int p=1,i=1;i\n#include \n#include \nint main()\n{\n long long int m;\n scanf(\"%lld\", &m);\n if(m<=18)\n {\n printf(\"%I64d\", m);\n return 0;\n }\n long long int x,y;\n long long int p,a;\n int q=0;\n p=m;\n while(p)\n {\n q++;\n p=p/10;\n }\n a=pow(10,q-1)+0.5;\n x=m-1-(m%a);\n y=m-x;\n int count=0;\n while(x)\n {\n count+=x%10;\n x=x/10;\n }\n while(y)\n {\n count+=y%10;\n y=y/10;\n }\n printf(\"%d\", count);\n return 0;\n}"}, {"source_code": "#include\n#include\n\n\nlong deco(long long x){\n long long a = x;\n long long n = 0;\n while(a>=10){\n n+= a%10;\n a /= 10;\n }\n n+=a%10;\n return n;\n}\n\nlong long pot(long long x, long long y){\n long long a =1;\n for(long long c = 0;c=10){\n n++;\n p = p/10;\n }\n for(long long c=0;c\nint main()\n{\n long long int a,b;\n int cnt=0;\n scanf(\"%I64d\",&a);\n b=9;\n while(a>b)\n {\n cnt=cnt+9;\n\t\tb=b*10;\n\t\tb=b+9;\n\t}\n\tb=b/10;\n\ta=a-b;\n\twhile(a>0)\n {\n cnt=cnt+(a%10);\n a=a/10;\n }\n printf(\"%d\\n\",cnt);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int num,a,b=0,i,k,x=1,j,r1,r2,R1=0,R2=0,ans;\n scanf(\"%lld\",&num);\n j=num;\n while(num!=0){\n num=num/10;\n b++;\n }\n\n /*k=b-1;\n x=pow(10,k);\n printf(\"%d\\n\",x);\n printf(\"%d\",b);\n */\n for(i=1;i\n#include \nint main()\n{\n\tlong long n,s=9,x;\n\tint k=0,y=0,i;\n\tscanf(\"%lld\",&n);\n\twhile(1)\n\t{\n\t\tint c = n/pow(10,k);\n\t\tif(c==0)\n\t\t\tbreak;\n\t\tk++;\n\t}\n\tfor(i=2;i=2)\n\t\tx=n-s;\n\telse\n\t\tx=n;\n\twhile(x)\n\t{\n\t\ty=y+x%10;\n\t\tx=x/10;\n\t}\n\ty=y+9*(k-1);\n\tprintf(\"%d\",y);\n\treturn 0;\n}\n\n \t \t\t\t\t\t\t \t \t\t \t \t\t\t"}, {"source_code": "#include\n#include\n#include\n#include\n\nlong long string_to_int(char str[],int len)\n{\n int i;\n long long x=0;\n for(i=0;i\nint main()\n{\n long long int n,r,t=0,m,i=0,s=0,d,p=0;\n scanf(\"%lld\",&n);\n m=n;\n while(m>0)\n {\n r=m%10;\n if(r==9) t++;\n s=s+r;\n i++;\n m=m/10;\n }\n if(i==t) printf(\"%lld\\n\",s);\n else{\n long long int k=0;\n while(kn) {k=k/10;\n p=p-9;}\n if(k==0)\n {\n printf(\"%lld\\n\",n);\n }\n else{\n d=n-k;\n while(d>0)\n {\n r=d%10;\n p=p+r;\n d=d/10;\n }\n printf(\"%lld\\n\",p);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n;\n long long int div,first,sec,total,res,sum;\n long long int sum_1=0,sum_2=0,count=0,hold=0;\n\n scanf(\"%I64d\",&n);\n if(n==190420131558)\n {\n printf(\"138\");\n return 0;\n }\n\n div = n/2;\n sec = div;\n first = n-sec;\n\n while(div!=0)\n {\n hold = hold + div%10;\n sum = div%10;\n div = div/10;\n count++;\n }\n\n if(first==sec)\n {\n if(hold/count==9)\n {\n total = 2*hold;\n printf(\"%I64d\",total);\n return 0;\n }\n }\n\n if(count==0)\n {\n printf(\"%lld\",n);\n return 0;\n }\n else if(count==1)\n {\n sec = sec;\n first = n-sec;\n }\n else if(count==2)\n {\n sec = sum*10-1;\n first = n-sec;\n }\n else if(count==3)\n {\n sec = sum*100-1;\n first = n-sec;\n }\n else if(count==4)\n {\n sec = sum*1000-1;\n first = n-sec;\n }\n else if(count==5)\n {\n sec = sum*10000-1;\n first = n-sec;\n }\n else if(count==6)\n {\n sec = sum*100000-1;\n first = n-sec;\n }\n else if(count==7)\n {\n sec = sum*1000000-1;\n first = n-sec;\n }\n else if(count==8)\n {\n sec = sum*10000000-1;\n first = n-sec;\n }\n else if(count==9)\n {\n sec = sum*100000000-1;\n first = n-sec;\n }\n else if(count==10)\n {\n sec = sum*1000000000-1;\n first = n-sec;\n }\n else if(count==11)\n {\n sec = sum*10000000000-1;\n first = n-sec;\n }\n else if(count==12)\n {\n sec = sum*100000000000-1;\n first = n-sec;\n }\n\n while(first!=0)\n {\n sum_1 = sum_1 + first%10;\n first = first/10;\n }\n while(sec!=0)\n {\n sum_2 = sum_2 + sec%10;\n sec = sec/10;\n }\n\n total = sum_1 + sum_2;\n\n printf(\"%I64d\",total);\n\n return 0;\n}\n"}, {"source_code": "#include\n\n#include\n\n#include\n\nint main(){\n\n char s[11],s2[11],s3[2];\n\n long long n,m;\n\n int i,len,sum;\n\n gets(s);\n\n /*printf(\"%c\",s[0] - 1);*/\n\n len = strlen(s);\n\n s3[0] = s[0] - 1;\n\n s3[1] = '\\0';\n\n sum = atoi(s3) + (len - 1)*9;\n\n n = atoll(s);\n\n s2[0] = s[0] - 1;\n\n for(i = 1; i < len; i++){\n\n s2[i] = '9';\n }\n s2[len] = '\\0';\n\n /*printf(\"%s\",s2);*/\n\n m = atoll(s2);\n\n n = n - m;\n\n do{\n sum = sum + (int)(n % 10);\n\n n = n/10;\n }\n while(n != 0);\n\n printf(\"%d\",sum);\n\n return 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n long long int n, p, q, r, i=0, sum=0, sum2, total=0;\n \n scanf(\"%lld\", &n);\n \n p=n;\n while(p!=0)\n {\n r=p%10;\n p=p/10;\n if(i!=0)\n {\n sum=sum*10+9;\n total=total + 9;\n }\n i++;\n }\n sum2=r-1;\n total=total + sum2;\n while(sum!=0)\n {\n sum=sum/10;\n sum2=sum2*10+9;\n }\n sum=n-sum2;\n while(sum!=0)\n {\n r=sum%10;\n sum=sum/10;\n total=total + r;\n }\n printf(\"%lld\\n\", total);\n return 0;\n}"}, {"source_code": "#include \n#include \n\nint digitSum(long long int n) {\n int s = 0;\n while (n != 0) {\n s += n % 10;\n n /= 10;\n }\n return s;\n}\n\nint sln(int n) {\n int i, m = 0;\n for (i = 0; i <= n / 2; i++) {\n int v = digitSum(i) + digitSum(n - i);\n if (v > m) {\n m = v;\n }\n }\n return m;\n}\n\nint cntdigit(long long int n) {\n int c = 0;\n while (n != 0) {\n c++;\n n /= 10;\n }\n return c;\n}\n\nint sln1(long long int n) {\n int c = cntdigit(n);\n long long int i, v = 1;\n for (i = 0; i != c; i++) {\n v *= 10;\n }\n v /= 10;\n v--;\n return digitSum(v) + digitSum(n - v);\n}\nvoid unit(unsigned long long int n) {\n int r1 = sln1(n);\n // int r2= sln(i);\n int i, m = 0;\n for (i = n / 2; i != 0; i--) {\n int v = digitSum(i) + digitSum(n - i);\n if (v > m) {\n m = v;\n if (m > r1) {\n printf(\"solution is wrong for now\\n\");\n exit(-1);\n }\n }\n }\n int r2 = m;\n // printf(\"%lld: %d %d\\n\", n, r1, r2);\n if (r1 != r2) {\n exit(-1);\n }\n\n}\n\nvoid run(long long int n) {\n int r = sln1(n);\n // printf(\"%lld: %d\\n\", n, r);\n}\nvoid test() {\n unit(9992); // 56\n unit(99992); // 74\n unit(999992); // 92\n unit(9999992); // 110\n // unit(99999992); // 128\n // unit(999999992); // 146\n // unit(9999999992);\n run(999999999992ull);\n return;\n run(1); // 1\n run(1000); // 3\n run(1000000); // 6\n run(1000000000); // 9\n run(10000000000ull); // 10\n run(1000000000000ull); // 12\n run(999999999992ull);\n // return;\n int i;\n for (i = 1; i != 1000 * 10 * 2; i++) {\n unit(i);\n }\n}\nint main() {\n // test();\n // return 0;\n long long int n;\n scanf(\"%I64lld\", &n);\n // printf(\"%lld\\n\", n);\n int r = sln1(n);\n printf(\"%d\\n\", r);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int a,b,c,d,i,j,k=0,f=0,e,g,h;\n scanf(\"%lld\",&a);\n long long int A=a;\n for(i=1; a>0; i++)\n {\n b=a%10;\n k++;\n a=a/10;\n }\n if(k==1)\n {\n b=A/1;\n c=b*1-1;\n d=A-c;\n for(i=1; c>0; i++)\n {\n e=c%10;\n f=f+e;\n c=c/10;\n }\n for(i=1; d>0; i++)\n {\n g=d%10;\n f=f+g;\n d=d/10;\n }\n printf(\"%lld\\n\",f);\n }\n else if(k==2)\n {\n b=A/10;\n c=b*10-1;\n d=A-c;\n for(i=1; c>0; i++)\n {\n e=c%10;\n f=f+e;\n c=c/10;\n }\n for(i=1; d>0; i++)\n {\n g=d%10;\n f=f+g;\n d=d/10;\n }\n printf(\"%lld\\n\",f);\n }\n else if(k==3)\n {\n b=A/100;\n c=b*100-1;\n d=A-c;\n for(i=1; c>0; i++)\n {\n e=c%10;\n f=f+e;\n c=c/10;\n }\n for(i=1; d>0; i++)\n {\n g=d%10;\n f=f+g;\n d=d/10;\n }\n printf(\"%lld\\n\",f);\n }\n\n else if(k==4)\n {\n b=A/1000;\n c=b*1000-1;\n d=A-c;\n for(i=1; c>0; i++)\n {\n e=c%10;\n f=f+e;\n c=c/10;\n }\n for(i=1; d>0; i++)\n {\n g=d%10;\n f=f+g;\n d=d/10;\n }\n printf(\"%lld\\n\",f);\n\n }\n else if(k==5)\n {\n b=A/10000;\n c=b*10000-1;\n d=A-c;\n for(i=1; c>0; i++)\n {\n e=c%10;\n f=f+e;\n c=c/10;\n }\n for(i=1; d>0; i++)\n {\n g=d%10;\n f=f+g;\n d=d/10;\n }\n printf(\"%lld\\n\",f);\n\n }\n else if(k==6)\n {\n b=A/100000;\n c=b*100000-1;\n d=A-c;\n for(i=1; c>0; i++)\n {\n e=c%10;\n f=f+e;\n c=c/10;\n }\n for(i=1; d>0; i++)\n {\n g=d%10;\n f=f+g;\n d=d/10;\n }\n printf(\"%lld\\n\",f);\n\n }\n else if(k==7)\n {\n b=A/1000000;\n c=b*1000000-1;\n d=A-c;\n for(i=1; c>0; i++)\n {\n e=c%10;\n f=f+e;\n c=c/10;\n }\n for(i=1; d>0; i++)\n {\n g=d%10;\n f=f+g;\n d=d/10;\n }\n printf(\"%lld\\n\",f);\n }\n\n else if(k==8)\n {\n b=A/10000000;\n c=b*10000000-1;\n d=A-c;\n for(i=1; c>0; i++)\n {\n e=c%10;\n f=f+e;\n c=c/10;\n }\n for(i=1; d>0; i++)\n {\n g=d%10;\n f=f+g;\n d=d/10;\n }\n printf(\"%lld\\n\",f);\n }\n\n else if(k==9)\n {\n b=A/100000000;\n c=b*100000000-1;\n d=A-c;\n for(i=1; c>0; i++)\n {\n e=c%10;\n f=f+e;\n c=c/10;\n }\n for(i=1; d>0; i++)\n {\n g=d%10;\n f=f+g;\n d=d/10;\n }\n printf(\"%lld\\n\",f);\n\n }\n else if(k==10)\n {\n b=A/1000000000;\n c=b*1000000000-1;\n d=A-c;\n for(i=1; c>0; i++)\n {\n e=c%10;\n f=f+e;\n c=c/10;\n }\n for(i=1; d>0; i++)\n {\n g=d%10;\n f=f+g;\n d=d/10;\n }\n printf(\"%lld\\n\",f);\n }\n\n else if(k==11)\n {\n b=A/10000000000;\n c=b*10000000000-1;\n d=A-c;\n for(i=1; c>0; i++)\n {\n e=c%10;\n f=f+e;\n c=c/10;\n }\n for(i=1; d>0; i++)\n {\n g=d%10;\n f=f+g;\n d=d/10;\n }\n printf(\"%lld\\n\",f);\n\n }\n else if(k==12)\n {\n b=A/100000000000;\n c=b*100000000000-1;\n d=A-c;\n for(i=1; c>0; i++)\n {\n e=c%10;\n f=f+e;\n c=c/10;\n }\n for(i=1; d>0; i++)\n {\n g=d%10;\n f=f+g;\n d=d/10;\n }\n printf(\"%lld\\n\",f);\n }\n\n else if(k==13)\n {\n b=A/1000000000000;\n c=b*1000000000000-1;\n d=A-c;\n for(i=1; c>0; i++)\n {\n e=c%10;\n f=f+e;\n c=c/10;\n }\n for(i=1; d>0; i++)\n {\n g=d%10;\n f=f+g;\n d=d/10;\n }\n printf(\"%lld\\n\",f);\n }\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int a,b,c,d,i,j,k=0,f=0,e,g,h;\n scanf(\"%lld\",&a);\n long long int A=a;\n for(i=1; a>0; i++)\n {\n b=a%10;\n k++;\n a=a/10;\n }\n if(k==1)\n {\n b=A/1;\n c=b*1-1;\n d=A-c;\n for(i=1; c>0; i++)\n {\n e=c%10;\n f=f+e;\n c=c/10;\n }\n for(i=1; d>0; i++)\n {\n g=d%10;\n f=f+g;\n d=d/10;\n }\n printf(\"%lld\\n\",f);\n }\n else if(k==2)\n {\n b=A/10;\n c=b*10-1;\n d=A-c;\n for(i=1; c>0; i++)\n {\n e=c%10;\n f=f+e;\n c=c/10;\n }\n for(i=1; d>0; i++)\n {\n g=d%10;\n f=f+g;\n d=d/10;\n }\n printf(\"%lld\\n\",f);\n }\n else if(k==3)\n {\n b=A/100;\n c=b*100-1;\n d=A-c;\n for(i=1; c>0; i++)\n {\n e=c%10;\n f=f+e;\n c=c/10;\n }\n for(i=1; d>0; i++)\n {\n g=d%10;\n f=f+g;\n d=d/10;\n }\n printf(\"%lld\\n\",f);\n }\n\n else if(k==4)\n {\n b=A/1000;\n c=b*1000-1;\n d=A-c;\n for(i=1; c>0; i++)\n {\n e=c%10;\n f=f+e;\n c=c/10;\n }\n for(i=1; d>0; i++)\n {\n g=d%10;\n f=f+g;\n d=d/10;\n }\n printf(\"%lld\\n\",f);\n\n }\n else if(k==5)\n {\n b=A/10000;\n c=b*10000-1;\n d=A-c;\n for(i=1; c>0; i++)\n {\n e=c%10;\n f=f+e;\n c=c/10;\n }\n for(i=1; d>0; i++)\n {\n g=d%10;\n f=f+g;\n d=d/10;\n }\n printf(\"%lld\\n\",f);\n\n }\n else if(k==6)\n {\n b=A/100000;\n c=b*100000-1;\n d=A-c;\n for(i=1; c>0; i++)\n {\n e=c%10;\n f=f+e;\n c=c/10;\n }\n for(i=1; d>0; i++)\n {\n g=d%10;\n f=f+g;\n d=d/10;\n }\n printf(\"%lld\\n\",f);\n\n }\n else if(k==7)\n {\n b=A/1000000;\n c=b*1000000-1;\n d=A-c;\n for(i=1; c>0; i++)\n {\n e=c%10;\n f=f+e;\n c=c/10;\n }\n for(i=1; d>0; i++)\n {\n g=d%10;\n f=f+g;\n d=d/10;\n }\n printf(\"%lld\\n\",f);\n }\n\n else if(k==8)\n {\n b=A/10000000;\n c=b*10000000-1;\n d=A-c;\n for(i=1; c>0; i++)\n {\n e=c%10;\n f=f+e;\n c=c/10;\n }\n for(i=1; d>0; i++)\n {\n g=d%10;\n f=f+g;\n d=d/10;\n }\n printf(\"%lld\\n\",f);\n }\n\n else if(k==9)\n {\n b=A/100000000;\n c=b*100000000-1;\n d=A-c;\n for(i=1; c>0; i++)\n {\n e=c%10;\n f=f+e;\n c=c/10;\n }\n for(i=1; d>0; i++)\n {\n g=d%10;\n f=f+g;\n d=d/10;\n }\n printf(\"%lld\\n\",f);\n\n }\n else if(k==10)\n {\n b=A/1000000000;\n c=b*1000000000-1;\n d=A-c;\n for(i=1; c>0; i++)\n {\n e=c%10;\n f=f+e;\n c=c/10;\n }\n for(i=1; d>0; i++)\n {\n g=d%10;\n f=f+g;\n d=d/10;\n }\n printf(\"%lld\\n\",f);\n }\n\n else if(k==11)\n {\n b=A/10000000000;\n c=b*10000000000-1;\n d=A-c;\n for(i=1; c>0; i++)\n {\n e=c%10;\n f=f+e;\n c=c/10;\n }\n for(i=1; d>0; i++)\n {\n g=d%10;\n f=f+g;\n d=d/10;\n }\n printf(\"%lld\\n\",f);\n\n }\n else if(k==12)\n {\n b=A/100000000000;\n c=b*100000000000-1;\n d=A-c;\n for(i=1; c>0; i++)\n {\n e=c%10;\n f=f+e;\n c=c/10;\n }\n for(i=1; d>0; i++)\n {\n g=d%10;\n f=f+g;\n d=d/10;\n }\n printf(\"%lld\\n\",f);\n }\n\n else if(k==13)\n {\n b=A/1000000000000;\n c=b*1000000000000-1;\n d=A-c;\n for(i=1; c>0; i++)\n {\n e=c%10;\n f=f+e;\n c=c/10;\n }\n for(i=1; d>0; i++)\n {\n g=d%10;\n f=f+g;\n d=d/10;\n }\n printf(\"%lld\\n\",f);\n }\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long sum=0,a,s,d=0,f=1,j,k,l,i=0;\n scanf(\"%I64d\\n\",&a);\n s=a;\n while(s!=0){\n s=s/10;\n i++;\n }\n\n for(j=1;j\ntypedef long long ll;\nint main()\n{\n ll n,xxx=0,cnt=0;\n scanf(\"%lld\",&n);\n ll nn=n;\n while(n)\n {\n n/=10;\n cnt++;\n }\n ll num=0,sum=0;\n for(ll i=0;ixxx)\n xxx=sum;\n }\n printf(\"%lld\",xxx);*/\n return 0;\n}"}, {"source_code": "#include \n\ntypedef long long LL;\n\nLL pow_10(LL x)\n{\n\tLL ans = 1;\n\tfor (LL i = 0; i < x; i++)\n\t\tans *= 10;\t\n\n\treturn ans;\t\n}\n\nint sum_of_digit(LL x)\n{\n\tint sum = 0;\n\n\twhile (x != 0)\n\t{\n\t\tsum += x % 10;\n\t\tx /= 10;\n\t}\n\n\treturn sum;\n}\n\nLL get_highest_digit(LL x, LL *a)\n{\n\tLL temp = x;\n\t*a = 0;\n\twhile (x != 0)\n\t{\n\t\ttemp = x;\n\t\tx /= 10;\n\t\t(*a)++;\n\t}\n\n\treturn temp;\n}\n\nint main()\n{\n\t//input\n\tLL n, a, b;\n\tscanf(\"%I64lld\", &n);\n\t//scanf(\"%lld\", &n);\n\n\n\t//produce output\n\tLL digits;\n\tLL msb = get_highest_digit(n, &digits);\n\t\n\ta = msb * pow_10(digits-1);\n\ta--;\n\n\tb = n - a;\t\n\t\n\tprintf(\"%d\\n\", sum_of_digit(a) + sum_of_digit(b));\n}\n"}, {"source_code": "#include \nint main() {\n long long int num, sum=0;\n\n scanf(\"%lld\", &num);\n while(num>=9) {\n sum = sum + 9+(num-9)%10;\n num=(num-9)/10;\n }\n printf(\"%lld\", num+sum);\n return 0;\n}\n"}, {"source_code": "#include\n\nlong long search(long long n);\n\nint main(){\n long long n;\n scanf(\"%lld\",&n);\n \n printf(\"%lld\\n\",search(n)); \n \n \n \n return 0;\n}\n\n\nlong long search(long long n){\n if(n<10) \n return n;\n\n //printf(\"%lld\\n\",n);\n\n if(n%10 != 9)\n return search(n/10-1)+n%10+10;\n else\n return search(n/10)+n%10;\n}\n\n\n\n\n\n"}, {"source_code": "#include\n\nlong long maxx(long long a,long long b); \nlong long search(long long n);\n\nint main(){\n long long n;\n scanf(\"%lld\",&n);\n \n printf(\"%lld\\n\",search(n)); \n \n \n \n return 0;\n}\n\nlong long maxx(long long a,long long b){\n return a>b?a:b;\n}\n\nlong long search(long long n){\n if(n<10) \n return n;\n\n //printf(\"%lld\\n\",n);\n\n if(n%10 != 9)\n return maxx(search(n/10)+n%10,search(n/10-1)+n%10+10);\n else\n return search(n/10)+n%10;\n}\n\n\n\n\n\n\n\n"}, {"source_code": "#include \n\nint digs(long long n) {\n\tint result = 0;\n\twhile (n > 0) {\n\t\tresult += n % 10;\n\t\tn /= 10;\n\t}\n\treturn result;\n}\n\nint main() {\n\tlong long n;\n\tscanf(\"%I64d\", &n);\n\n\tlong long a = 0;\n\tfor (a = 0; a < n; a=a*10+9) ;\n\ta = a/10;\n\n\tprintf(\"%d\\n\", digs(a) + digs(n-a));\n\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n#include\nchar *subtract(char *a,char *b)\n{\n int len_a,i,carry=0;\n len_a=strlen(a);\n char *c;\n c=(char *)malloc(len_a*sizeof(char));\n for(i=len_a-1;i>=0;i--){\n if(a[i]>b[i]){\n c[i]=a[i]-b[i]-carry+'0';\n carry=0;\n }\n else if(a[i]\n#include\nint main()\n{\n long long i,j,k=0,n,x,t=0,ans,n1=1,n2;\n scanf(\"%I64d\",&n);\n ans=n;\n if(n<10)\n x=1;\n else\n {\n\n for(x=1;x<1000;)\n {\n n=n/10;\n x++;\n if(n<10)\n {\n break;\n }\n }\n }\n\n x=x-1;\n for(i=0;i\nint main()\n{\n\tlong long n,a=1,b,s=0;\n\twhile(~scanf(\"%lld\",&n))\n\t{\n\t\twhile(a<=n)\n\t\ta*=10;\n\t\ta=a/10-1;\n\t\tb=n-a;\n\t\twhile(a>0)\n\t\t{\n\t\t\ts+=a%10;a=a/10;\n\t\t}\n\t\twhile(b>0)\n\t\t{\n\t\t\ts+=b%10;b=b/10;\n\t\t}\n\t\tprintf(\"%lld\\n\",s);\n\t\ta=1;s=0;\n\t}\n}"}, {"source_code": "#include\n#include\nint count (long long int n){\n\tlong long int sum=0;\n\twhile(n>0){\n\t\tsum+=(n%10);\n\t\tn=n/10;\n\t}\n\treturn sum;\n}\nint main(){\n\tlong long int n;\n\tscanf(\"%I64d\",&n);\n\t\tlong long int t=n,h=0;\n\t\twhile(t){\n\t\t\th=h*10+9;\n\t\t\tt=t/10;\n\t\t}\n\t\th=h/10;\n\t\tif(h==0){\n\t\t\tprintf(\"%I64d\",n);\n\t\t\treturn 0;\n\t\t}\n\t\telse{\n\t\tlong long int j=count(h);\n\t\tlong long int g=count(n-h);\n\t printf(\"%I64d\",j+g);\n\t\treturn 0;\n\t\t}\n}"}], "negative_code": [{"source_code": "#include\nint main()\n{\n long long int n=0, n1=0, n2=0, rem=0, temp=0, sum1=0, sum2=0;\n scanf(\"%I64d\", &n);\n n1 = (n/2)+1;\n n2 = (n-n1);\n temp = n1;\n while(temp!=0)\n {\n rem = (temp%10);\n sum1 += rem;\n temp = temp/10;\n }\n temp = n2;\n while(temp!=0)\n {\n rem = (temp%10);\n sum1 += rem;\n temp = temp/10;\n }\n printf(\"%I64d\", sum1);\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n\tchar s[15];\n\tint ans, len;\n\twhile (~scanf(\"%s\", s))\n\t{\n\t\tans = 0;\n\t\tlen = strlen(s);\n\t\tfor (int i = 0; i < len; i++)\n\t\t{\n\t\t\tif (s[i] - '0')\n\t\t\t\tans += s[i] - '0' + (len - i - 1) * 9;\n\t\t}\n\t\tprintf(\"%d\\n\", ans);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\nint digitSum(int n) {\n int s = 0;\n while (n != 0) {\n s += n % 10;\n n /= 10;\n }\n return s;\n}\n\nint wrong(int n) {\n int r;\n if (n % 2 == 0) {\n int s0 = digitSum(n / 2) * 2;\n int s1 = digitSum(n / 2 + 1) + digitSum(n / 2 - 1);\n r = s0 > s1 ? s0 : s1;\n } else {\n int s = digitSum(n / 2) + digitSum(n / 2 + 1);\n r = s;\n }\n return r;\n}\n\nint sln(int n) {\n int i, m = 0;\n for (i = 0; i <= n / 2; i++) {\n int v = digitSum(i) + digitSum(n - i);\n if (v > m) {\n m = v;\n }\n }\n return m;\n}\n\nint cntdigit(int n) {\n int c = 0;\n while (n != 0) {\n c++;\n n /= 10;\n }\n return c;\n}\n\nint sln1(int n) {\n int c = cntdigit(n);\n int i, v = 1;\n for (i = 0; i != c; i++) {\n v *= 10;\n }\n v /= 10;\n v--;\n // printf(\"%d\\n\", v - 1);\n return digitSum(v) + digitSum(n - v);\n}\n\nint main() {\n int n;\n scanf(\"%d\", &n);\n int r = sln1(n);\n // int i;\n // for (i = 1; i != 10000; i++) {\n // int r1 = sln1(i);\n // int r2= sln(i);\n // if (r1 != r2) {\n // printf(\"%d: %d %d\\n\", i, r1, r2);\n // // return 0;\n // }\n // }\n printf(\"%d\\n\", r);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\ntypedef unsigned long long ll;\ntypedef long double LD;\n\n#define MAXN 101\n\n#define MIN(a,b) ((a)<(b)?(a):(b))\n\nchar arr[MAXN];\n\nint sumdigits(ll input)\n{\n int sum;\n sum = 0;\n while (input >0)\n {\n sum += input%10;\n input /= 10;\n }\n return (sum);\n}\n\nint main(void)\n{\n ll N;\n int ans;\n ll nines, temp;\n\n\t#ifndef ONLINE_JUDGE\n FILE *fp;\n\tfp = freopen(\"..\\\\..\\\\1060\\\\B\\\\1060B.TXT\",\"r\",stdin);\n\t//fp = freopen(\"1047C.TXT\",\"r\",stdin);\n\tif (fp == NULL)\n {\n printf (\"Cannot open file\\n\\n\");\n exit(0);\n }\n\t#endif\n\n #ifndef ONLINE_JUDGE\n\n #else \n scanf(\"%I64d\",&N);\n #endif \n \n if (N<9)\n {\n ans = N;\n }\n else\n {\n nines = 1;\n temp = N;\n while (temp > 10)\n {\n nines *= 10;\n temp /=10;\n }\n nines -=1;\n\n ans = sumdigits(nines) + sumdigits(N-nines); \n }\n printf (\"%d\",ans);\n \n return (0);\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n long long int n,y,x=1;\n scanf(\"%lld\",&n);\n y=n;\n int i,s=0,a[15],f=1;\n for(i=0;n!=0;i++)\n {\n n/=10;\n }\n x=9*(i-1);\n y-=x;\n for(i=0;y!=0;i++)\n {\n a[i]=y%10;\n s+=a[i];\n y/=10;\n }\n printf(\"%d\\n\",s+x);\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int num,div,hold,ano,sum=0,add=0;\n long long int res;\n\n scanf(\"%lld\",&num);\n\n div = num/2;\n\n hold = div;\n\n hold = hold%10;\n\n if(hold==0)\n {\n div = div-1;\n }\n else if(hold==1)\n {\n div = div-2;\n }\n else if(hold==2)\n {\n div = div-3;\n }\n else if(hold==3)\n {\n div = div-4;\n }\n else if(hold==4)\n {\n div = div-5;\n }\n else if(hold==5)\n {\n div = div-6;\n }\n else if(hold==6)\n {\n div = div-7;\n }\n else if(hold==7)\n {\n div = div-8;\n }\n else if(hold==8)\n {\n div = div-9;\n }\n\n ano = num-div;\n\n if(ano>num)\n {\n ano = ano-1;\n printf(\"%d\",ano);\n return 0;\n }\n while(ano!=0)\n {\n sum = sum + ano%10;\n ano = ano/10;\n }\n\n while(div!=0)\n {\n add = add + div%10;\n div = div/10;\n }\n\n res = sum + add;\n\n printf(\"%lld\",res);\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n long long i,j,k=0,n,x,t=0,ans,n1,n2;\n scanf(\"%I64d\",&n);\n ans=n;\n if(n<10)\n x=1;\n else\n {\n\n for(x=1;x\n#include \n#include \n\ntypedef unsigned long long ll;\ntypedef long double LD;\n\n#define MAXN 101\n\n#define MIN(a,b) ((a)<(b)?(a):(b))\n\nchar arr[MAXN];\n\nint sumdigits(ll input)\n{\n int sum;\n sum = 0;\n while (input >0)\n {\n sum += input%10;\n input /= 10;\n }\n return (sum);\n}\n\nint main(void)\n{\n ll N;\n int ans;\n ll nines;\n int temp;\n\n\t#ifndef ONLINE_JUDGE\n FILE *fp;\n\tfp = freopen(\"..\\\\..\\\\1060\\\\B\\\\1060B.TXT\",\"r\",stdin);\n\t//fp = freopen(\"1047C.TXT\",\"r\",stdin);\n\tif (fp == NULL)\n {\n printf (\"Cannot open file\\n\\n\");\n exit(0);\n }\n\t#endif\n\n #ifndef ONLINE_JUDGE\n\n #else \n scanf(\"%I64d\",&N);\n #endif \n \n if (N<9)\n {\n ans = 9;\n }\n else\n {\n nines = 1;\n temp = N;\n while (temp > 10)\n {\n nines *= 10;\n temp /=10;\n }\n nines -=1;\n\n ans = sumdigits(nines) + sumdigits(N-nines); \n }\n printf (\"%d\",ans);\n \n return (0);\n}\n"}, {"source_code": "#include \n\nint num_len(int n)\n{\t\n\tint len = 0;\n\twhile (n && ++len && (n /= 10));\n \treturn len;\t\n}\n\nint sum_digits(int n)\n{\t\n\tint sum = 0;\n\n\twhile (n) {\n\t\tsum += n % 10;\n\t\tn /= 10;\t\n\t}\n\n\treturn sum;\n}\n\nint main() {\n\tlong n, a, b;\n\tint lenN, sumA, sumB;\n\n\tscanf(\"%d\", &n);\n\n\tlenN = num_len(n);\n\t\n\ta = 1;\n\tfor (int i = 0; i < lenN - 1; i++) {\n\t\ta *= 10; \n\t}\n\ta--;\n\n\tsumA = 9 * (lenN - 1);\n\tb = n - a;\n\tsumB = sum_digits(b);\n\n\tprintf(\"%d\", sumA + sumB);\n\t\n\t\n\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tlong long int n, i, x=0;\n\tchar s[14];\n\t\n\tscanf(\"%lld\", &n);\n\t\n\tif(n<10)\n\t{\n\t\tprintf(\"%lld\", n);\n\t}\n\telse\n\t{\n\t\tsprintf(s, \"%lld\", n);\n\t\t\n\t\tfor(i=0; s[i]!='\\0'; i++)\n\t\t{\n\t\t\tx+=s[i]-'0';\n\t\t}\n\t\tprintf(\"%lld\", x+((i-1)*9));\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n long long int n=0, n1=0, n2=0, rem=0, temp=0, sum1=0, sum2=0;\n scanf(\"%I64d\", &n);\n n1 = (n/2)+1;\n n2 = (n-n1);\n temp = n1;\n while(temp!=0)\n {\n rem = (temp%10);\n sum1 += rem;\n temp = temp/10;\n }\n temp = n2;\n while(temp!=0)\n {\n rem = (temp%10);\n sum1 += rem;\n temp = temp/10;\n }\n printf(\"%I64d\", sum1);\n}\n"}, {"source_code": "#include\n#include\nint sum(long a);\nint num(long b);\nmain()\n{\n int n,i,j,total;\n long m,a,b;\n scanf(\"%ld\",&m);\n n=num(m);\n total=(n-1)*9;\n b=m-pow(10,n-1)+1;\n printf(\"%d\",total+sum(b));\n}\nint sum(long a)\n{\n int s=0;\n do\n {\n s+=a%10;\n a=a/10;\n }\n while(a!=0);\n return s;\n}\nint num(long a)\n{\n int s=0;\n do\n {\n s++;\n a=a/10;\n }\n while(a!=0);\n return s;\n}\n\n\n"}, {"source_code": "#include\nint main ()\n{\n\tlong long n,b,a,i;\n\tint s[12],s1[12],s2=0;\n\tscanf(\"%lld\",&n);\n\tif(n%2==0)\n\t{\n\t\ta=n/2+1;\n\t\tb=n/2-1;\n\t}\n\telse \n\t{\n\t\ta=n/2;\n\t\tb=a+1;\n\t}\n\tfor(i=0;i<12;i++)\n\t{\n\t\ts[i]=a%10;\n\t\ta/=10;\n\t\ts1[i]=b%10;\n\t\tb/=10;\n\t\ts2=s2+s[i]+s1[i];\n\t}\n\tprintf(\"%d\\n\",s2);\n\t\n\t\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\nint digitSum(int n) {\n int s = 0;\n while (n != 0) {\n s += n % 10;\n n /= 10;\n }\n return s;\n}\n\nint main() {\n int n;\n scanf(\"%d\", &n);\n int r;\n if (n % 2 == 0) {\n int s0 = digitSum(n / 2) * 2;\n int s1 = digitSum(n / 2 + 1) + digitSum(n / 2 - 1);\n r = s0 > s1 ? s0 : s1;\n } else {\n int s = digitSum(n / 2) + digitSum(n / 2 + 1);\n r = s;\n }\n printf(\"%d\\n\", r);\n return 0;\n}\n"}, {"source_code": "#include\nint count (long long int n){\n\tlong long int sum=0;\n\twhile(n>0){\n\t\tsum+=(n%10);\n\t\tn=n/10;\n\t}\n\treturn sum;\n}\nint main(){\n\tlong long int n;\n\tscanf(\"%I64d\",&n);\n\tlong long int l,g;\n\tl=(n/2)+1;\n\tg=n-l;\n\tl=count(l);\n\tg=count(g);\n\tprintf(\"%I64d\",l+g);\n\treturn 0;\n\t\n}"}, {"source_code": "#include\n#include\nint sum(long long a);\nint num(long long b);\nmain()\n{\n int n,i,j,total;\n long long m,a,b;\n scanf(\"%I64d\", &m);\n n=num(m);\n total=(n-1)*9;\n b=m-pow(10,n-1);\n b++;\n printf(\"%d\",total+sum(b));\n}\nint sum(long long a)\n{\n int s=0;\n do\n {\n s+=a%10;\n a=a/10;\n }\n while(a!=0);\n return s;\n}\nint num(long long a)\n{\n int s=0;\n do\n {\n s++;\n a=a/10;\n }\n while(a!=0);\n return s;\n}\n\n\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n long long int m;\n scanf(\"%lld\", &m);\n if(m<=18)\n {\n printf(\"%I64d\", m);\n return 0;\n }\n long long int x,y;\n x=m-1-(m%10);\n y=m-x;\n int count=0,j=0;\n while(x)\n {\n count+=x%10;\n x=x/10;\n }\n count+=y;\n printf(\"%d\", count);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint digitSum(long long int n) {\n int s = 0;\n while (n != 0) {\n s += n % 10;\n n /= 10;\n }\n return s;\n}\n\nint sln(int n) {\n int i, m = 0;\n for (i = 0; i <= n / 2; i++) {\n int v = digitSum(i) + digitSum(n - i);\n if (v > m) {\n m = v;\n }\n }\n return m;\n}\n\nint cntdigit(int n) {\n int c = 0;\n while (n != 0) {\n c++;\n n /= 10;\n }\n return c;\n}\n\nint sln1(long long int n) {\n int c = cntdigit(n);\n long long int i, v = 1;\n for (i = 0; i != c; i++) {\n v *= 10;\n }\n v /= 10;\n v--;\n // printf(\"%lld %d %lld\\n\", n, c, v);\n return digitSum(v) + digitSum(n - v);\n}\nvoid unit(unsigned long long int i) {\n int r1 = sln1(i);\n int r2= sln(i);\n if (r1 != r2) {\n printf(\"%lld: %d %d\\n\", i, r1, r2);\n }\n\n}\n\nvoid run(long long int n) {\n int r = sln1(n);\n printf(\"%lld: %d\\n\", n, r);\n}\nvoid test() {\n run(1); // 1\n run(1000); // 3\n run(1000000); // 6\n run(1000000000); // 9\n run(10000000000ull); // 10\n run(1000000000000ull); // 12\n // return;\n int i;\n for (i = 1; i != 1000 * 10 * 2; i++) {\n unit(i);\n }\n}\nint main() {\n // test();\n // return 0;\n long long int n;\n scanf(\"%I64lld\", &n);\n // printf(\"%lld\\n\", n);\n int r = sln1(n);\n printf(\"%d\\n\", r);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint count (long long int n){\n\tlong long int sum=0;\n\twhile(n>0){\n\t\tsum+=(n%10);\n\t\tn=n/10;\n\t}\n\treturn sum;\n}\nint main(){\n\tlong long int n;\n\tscanf(\"%I64d\",&n);\n\tif(n>99){\n\t\tlong long int t=n,h=0;\n\t\twhile(t){\n\t\t\th=h*10+9;\n\t\t\tt=t/10;\n\t\t}\n\t\th=h/10;\n\t\tlong long int j=count(h);\n\t\tlong long int g=count(n-h);\n\t printf(\"%I64d\",j+g);\n\t\treturn 0;\n\t}\n\telse{\n\t\tlong long int l,g;\n\t\tl=(n/2)+1;\n\t\tg=n-l;\n\t\tl=count(l);\n\t\tg=count(g);\n\t\tprintf(\"%I64d\",l+g);\n\t\treturn 0;\n\t\n\t}\n}"}, {"source_code": "#include\nint main()\n{\n long long int a,i=0,j,k,sum=0;\n scanf(\"%I64d\\n\",&a);\n if(a%9==0){\n while(a!=0){\n sum=sum+(a%10);\n a/=10;\n }\n }\n else{\n while(a!=0){\n sum=sum+(a%10);\n a/=10;\n i++;\n }\n sum=sum+((i-1)*9);\n }\n printf(\"%I64d\\n\",sum);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tlong long int n, i, x=0;\n\tchar s[14];\n\t\n\tscanf(\"%lld\", &n);\n\t\n\tif(n<10)\n\t{\n\t\tprintf(\"%lld\", n);\n\t}\n\telse\n\t{\n\t\tsprintf(s, \"%lld\", n);\n\t\t\n\t\tfor(i=0; s[i]!='\\0'; i++)\n\t\t{\n\t\t\tx+=s[i]-'0';\n\t\t}\n\t\tprintf(\"%lld\", x+((i-1)*9));\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n long long int a,i=0,j,k,sum=0;\n scanf(\"%I64d\\n\",&a);\n k=a;\n while(k!=0){\n sum=sum+(k%10);\n k/=10;\n i++;\n }\n\n if(a%10==9)printf(\"%I64d\\n\",sum);\n else{\n sum=sum+((i-1)*9);\n printf(\"%I64d\\n\",sum);\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n long long n, a, b, sum=0;\n scanf(\"%lld\", &n);\n if(n&1)\n {\n a = (n+1)/2;\n b = n/2;\n }\n else\n {\n a = n/2 + 1;\n b = n/2- 1;\n }\n while(a)\n {\n sum += a%10;\n a /= 10;\n }\n while(b)\n {\n sum += b%10;\n b /= 10;\n }\n printf(\"%lld\\n\", sum);\n\n return 0;\n}\n"}, {"source_code": "#include\nint main ()\n{\n\tlong long n,m,t=1,b;\n\tint a=0,s2;\n\tscanf(\"%lld\",&n);\n\twhile(n-t*10>0)\n\t{\n\t\ta++;\n\t\tt*=10;\n\t}\n\tb=n-t+1;\n\ts2=9*a;\n\twhile(b!=0)\n\t{\n\t\ts2+=b%10;\n\t\tb/=10;\n\t}\n\tprintf(\"%d\\n\",s2);\n\t\n\t\n\treturn 0;\n}"}, {"source_code": "#include \n\nint Fun(long long n)\n{\n int ret = 0;\n while(n) {\n ret += n % 10;\n n /= 10;\n }\n return ret;\n}\n\nint main()\n{\n long long n, m;\n scanf(\"%I64d\", &n);\n m = n;\n if(m < 9) {\n printf(\"%I64d\\n\", m);\n } else {\n while(m % 10 != 9) {\n --m;\n }\n printf(\"%d\\n\", Fun(m) + Fun(n - m));\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\n\nlong int deco(long int x){\n long int a = x;\n long int n = 0;\n while(a>=10){\n n+= a%10;\n a /= 10;\n }\n n+=a%10;\n return n;\n}\n\nlong int pot(long int x, long int y){\n long int a =1;\n for(int c = 0;c=10){\n n++;\n p = p/10; \n }\n for(int c = 0;c\n#include \n\nlong long sum(long long a)\n{\n long long s =0;\n while(a>0){\n s += a%10;\n a/=10;}\n return (s);\n}\n\nint main() {\n\t//code\n\t\n\tlong long n;\n\tscanf(\"%lld\\n\",&n);\n\tlong long tmp1 = n/2, tmp2 = n - (n/2);\n\t\n\tif(tmp1%10==0)\n\t{\n\t tmp1-=1;\n\t tmp2+=1; \n\t}\n\tif(tmp2%10==0)\n\t{\n\t tmp2-=1;\n\t tmp1+=1; \n\t}\n\t\n\tprintf(\"%lld\",sum(tmp1)+sum(tmp2));\n\t\n\t\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n#include \n\ntypedef unsigned long long ll;\ntypedef long double LD;\n\n#define MAXN 101\n\n#define MIN(a,b) ((a)<(b)?(a):(b))\n\nchar arr[MAXN];\n\nint sumdigits(ll input)\n{\n int sum;\n sum = 0;\n while (input >0)\n {\n sum += input%10;\n input /= 10;\n }\n return (sum);\n}\n\nint main(void)\n{\n ll N;\n int ans;\n ll nines;\n int temp;\n\n\t#ifndef ONLINE_JUDGE\n FILE *fp;\n\tfp = freopen(\"..\\\\..\\\\1060\\\\B\\\\1060B.TXT\",\"r\",stdin);\n\t//fp = freopen(\"1047C.TXT\",\"r\",stdin);\n\tif (fp == NULL)\n {\n printf (\"Cannot open file\\n\\n\");\n exit(0);\n }\n\t#endif\n\n #ifndef ONLINE_JUDGE\n\n #else \n scanf(\"%I64d\",&N);\n #endif \n \n if (N<9)\n {\n ans = 9;\n }\n else\n {\n nines = 1;\n temp = N;\n while (temp > 10)\n {\n nines *= 10;\n temp /=10;\n }\n nines -=1;\n\n ans = sumdigits(nines) + sumdigits(N-nines); \n }\n printf (\"%d\",ans);\n \n return (0);\n}\n"}, {"source_code": "#include \n#include\n\nint main() \n{\n\t__int64 n,sa,sb;\n\tint s=0;\n\tscanf(\"%I64d\",&n);\n\tif(n%2==1)\n\t{\n\t\tsa=n/2;\n\t\tsb=sa+1;\n\t}\n\telse\n\t{\n\t\tsa=n/2-1;\n\t\tsb=n/2+1;\n\t}\n\twhile(sa)\n\t{\n\t\ts=s+sa%10;\n\t\tsa=sa/10;\n\t}\n\twhile(sb)\n\t{\n\t\ts=s+sb%10;\n\t\tsb=sb/10;\n\t}\n\tprintf(\"%d\",s);\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint count (long long int n){\n\tlong long int sum=0;\n\twhile(n>0){\n\t\tsum+=(n%10);\n\t\tn=n/10;\n\t}\n\treturn sum;\n}\nint main(){\n\tlong long int n;\n\tscanf(\"%I64d\",&n);\n\tif(n>99){\n\tlong long int t=n,h=0;\n\twhile(t){\n\t\th++;\n\t\tt=t/10;\n\t}\n\tlong long int n1=pow(10,h-1);\n\tn1-=1;\n\tlong long int j=n-n1;\n\tj=count(j);\n\tint f=(9*(h-1));\n\tprintf(\"%d\",f+j);\n\treturn 0;\n}\n\telse{\n\tlong long int l,g;\n\tl=(n/2)+1;\n\tg=n-l;\n\tl=count(l);\n\tg=count(g);\n\tprintf(\"%I64d\",l+g);\n\treturn 0;\n\t\n\t}\n}"}, {"source_code": "#include \n#include \n#include \n#include \"stdint.h\"\n\nint main()\n{\n char a[12];\n char Char[100];\n int c,d;\n //read first number\n scanf(\"%s\",a);\n //read second number\n c=strlen(a);\n // digitcounter(a,&result);\n d=0;\n for(int i=0;i\n#include\n\n\nlong int deco(long int x){\n long int a = x;\n long int n = 0;\n while(a>=10){\n n+= a%10;\n a /= 10;\n }\n n+=a%10;\n return n;\n}\n\nlong int pot(long int x, long int y){\n long int a =1;\n for(int c = 0;c=10){\n n++;\n p = p/10; \n }\n for(int c = 0;c100){\n\tprintf(\"%ld\",n);\n\tprintf(\"%ld\\n\",res);\n\tprintf(\"%ld\\n\",a-res);\n\tprintf(\"%ld\\n\",x);\n\tprintf(\"%ld\\n\",y);\n }\n printf(\"%ld\",x+y);\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n=0, n1=0, n2=0, rem=0, temp=0, sum1=0, sum2=0;\n scanf(\"%I64d\", &n);\n if(n%2==0)\n {\n n1 = (n/2)+1;\n n2 = (n-n1);\n }\n else\n {\n n1 = (n/2);\n n2 = (n-n1);\n }\n temp = n1;\n while(temp!=0)\n {\n rem = (temp%10);\n sum1 += rem;\n temp = temp/10;\n }\n temp = n2;\n while(temp!=0)\n {\n rem = (temp%10);\n sum1 += rem;\n temp = temp/10;\n }\n printf(\"%I64d\", sum1);\n}\n"}, {"source_code": "#include\nint count (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}\nint main(){\n\tlong long int n;\n\tscanf(\"%I64d\",&n);\n\tlong long int l,g;\n\tl=(n/2)+1;\n\tg=n-l;\n\tl=count(l);\n\tg=count(g);\n\tprintf(\"%d\",l+g);\n\treturn 0;\n\t\n}"}, {"source_code": "#include\nint count (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}\nint main(){\n\tlong long int n;\n\tscanf(\"%I64d\",&n);\n\tlong long int l,g;\n\tl=(n/2)+1;\n\tg=n-l;\n\tl=count(l);\n\tg=count(g);\n\tprintf(\"%d\",l+g);\n\treturn 0;\n\t\n}"}, {"source_code": "#include \n#include \nint main()\n{\n\tchar s[15];\n\tint ans, len;\n\twhile (~scanf(\"%s\", s))\n\t{\n\t\tans = 0;\n\t\tlen = strlen(s);\n\t\tfor (int i = 0; i < len; i++)\n\t\t{\n\t\t\tif (s[i] - '0')\n\t\t\t{\n\t\t\t\tif (s[i] != '9')\n\t\t\t\t\tans += s[i] - '0' + (len - i - 1) * 9;\n\t\t\t\telse ans += s[i] - '0';\n\t\t\t}\n\t\t}\n\t\tprintf(\"%d\\n\", ans);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\n\nint main ()\n{\n long long int n,a,b,m=10,i,j,x,k,sum1=0,sum2=0,sum,count;\n scanf(\"%lld\",&n);\n b=n;\n for(i=1; i<=12; i++)\n {\n count=i;\n n=n/10;\n if(n==0)\n {\n break;\n }\n }\n for(j=1; j<=count-2; j++)\n {\n m=m*10;\n }\n a=(b%m)+1;\n b=b-a;\n for(k=1; k<=12; k++)\n {\n sum1=sum1+b%10;\n b=b/10;\n }\n for(x=1; x<=12; x++)\n {\n sum2=sum2+a%10;\n a=a/10;\n }\n sum=sum1+sum2;\n printf(\"%lld\\n\",sum);\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n\tchar s[15];\n\tint ans, len;\n\twhile (~scanf(\"%s\", s))\n\t{\n\t\tans = 0;\n\t\tlen = strlen(s);\n\t\tfor (int i = 0; i < len; i++)\n\t\t{\n\t\t\tif (s[i] - '0')\n\t\t\t{\n\t\t\t\tif (s[i] != '9')\n\t\t\t\t\tans += s[i] - '0' + (len - i - 1) * 9;\n\t\t\t\telse ans += s[i] - '0';\n\t\t\t}\n\t\t}\n\t\tprintf(\"%d\\n\", ans);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n long long int m;\n scanf(\"%lld\", &m);\n if(m<=18)\n {\n printf(\"%I64d\", m);\n return 0;\n }\n long long int x,y;\n x=m-1-(m%10);\n y=m-x;\n int count=0,j=0;\n while(x)\n {\n count+=x%10;\n x=x/10;\n }\n if(y==10)\n y=1;\n count+=y;\n printf(\"%d\", count);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nlong long sum(long long a)\n{\n long long s =0;\n while(a>0){\n s += a%10;\n a/=10;}\n return (s);\n}\n\nint main() {\n\t//code\n\t\n\tlong long n;\n\tscanf(\"%lld\\n\",&n);\n\tlong long tmp1 = n/2, tmp2 = n - (n/2);\n\t\n\tif(tmp1%10==0)\n\t{\n\t tmp1-=1;\n\t tmp2+=1; \n\t}\n\tif(tmp2%10==0)\n\t{\n\t tmp2-=1;\n\t tmp1+=1; \n\t}\n\t\n\tprintf(\"%lld\",sum(tmp1)+sum(tmp2));\n\t\n\t\n\treturn 0;\n}"}, {"source_code": "#include\n#include\n\nint deco(int x){\n int a = x;\n int n=0;\n while(a>=10){\n n+= a%10;\n a = a/10; \n }\n n+=a%10;\n return n;\n}\n\nint main(){\n long int a;\n scanf(\"%ld\",&a);\n long int max=0;\n long int x,y;\n long int b,d;\n for(long int c = 1;c<(a/2)+1;c++){\n x = deco(c);\n y = deco(a-c);\n if(x+y > max){\n\t max = x+y;\n\t b =c;\n\t d =a-c;\n\t}\n }\n printf(\"%ld %ld\\n\",b,d);\n printf(\"%ld\",max);\n}\n"}, {"source_code": "#include \n#include \n\nlong long sum(long long a)\n{\n long long s =0;\n while(a>0){\n s += a%10;\n a/=10;}\n return (s);\n}\n\nint main() {\n\t//code\n\t\n\tlong long n;\n\tscanf(\"%lld\\n\",&n);\n\tlong long tmp1 = n/2, tmp2 = n - (n/2);\n\t\n\tif(tmp1%10==0)\n\t{\n\t tmp1-=1;\n\t tmp2+=1; \n\t}\n\tif(tmp2%10==0)\n\t{\n\t tmp2-=1;\n\t tmp1+=1; \n\t}\n\t\n\tprintf(\"%lld\",sum(tmp1)+sum(tmp2));\n\t\n\t\n\treturn 0;\n}"}, {"source_code": "#include\nint main ()\n{\n\tlong long n,b,a;\n\tint s[12],s1[12],s2=0,i=0;\n\tscanf(\"%lld\",&n);\n\tif(n%2==0)\n\t{\n\t\ta=n/2+1;\n\t\tb=n/2-1;\n\t}\n\telse \n\t{\n\t\ta=n/2;\n\t\tb=a+1;\n\t}\n\tif(a>=0&&b<=n&&b>=0&&a<=n&&(a+b)==n)\n\t{\n \twhile(a&&b)\n \t{\n\t \ts[i]=a%10;\n\t \ta/=10;\n\t \ts1[i]=b%10;\n\t \tb/=10;\n\t \ts2=s2+s[i]+s1[i];\n\t \ti++;\n\t \n \t}\n }\n\tprintf(\"%d\\n\",s2);\n\t\n\t\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\n#define MAX_LIMIT 10e12\n\ntypedef long long LL;\n\nint sum_of_digit(LL x)\n{\n\tint sum = 0;\n\n\twhile (x != 0)\n\t{\n\t\tsum += x % 10;\n\t\tx /= 10;\n\t}\n\n\treturn sum;\n}\n\nLL get_highest_digit(LL x, LL *a)\n{\n\tLL temp = x;\n\t*a = 0;\n\twhile (x != 0)\n\t{\n\t\ttemp = x;\n\t\tx /= 10;\n\t\t(*a)++;\n\t}\n\n\treturn temp;\n}\n\nint main()\n{\n\t//input\n\tLL n, a, b;\n\tscanf(\"%I64d\", &n);\n\n\t//produce output\n\tLL digits;\n\tLL msb = get_highest_digit(n, &digits);\n\t\n\ta = msb * pow(10, digits-1);\n\ta--;\n\n\tb = n - a;\t\n\t\n\tprintf(\"%d\\n\", sum_of_digit(a) + sum_of_digit(b));\n}\n"}, {"source_code": "#include \n#include \n#include \nint main()\n{\n long long int m;\n scanf(\"%lld\", &m);\n if(m<=18)\n {\n printf(\"%I64d\", m);\n return 0;\n }\n long long int x,y;\n long long int p,a;\n int q=0;\n p=m;\n while(p)\n {\n q++;\n p=p/10;\n }\n a=pow(10,q-1);\n x=m-1-(m%a);\n y=m-x;\n int count=0;\n while(x)\n {\n count+=x%10;\n x=x/10;\n }\n while(y)\n {\n count+=y%10;\n y=y/10;\n }\n printf(\"%d\", count);\n return 0;\n}"}, {"source_code": "#include\n#include\n\nint main()\n{\n long long num,i,j,temp1,temp2;\n scanf(\"%I64d\",&num);\n if(num%2==0)\n {\n temp1=(num/2)-1;\n }\n else\n {\n temp1=num/2;\n }\n temp2=num-temp1;\n char str1[13],str2[13];\n sprintf(str1,\"%I64d\",temp1);\n sprintf(str2,\"%I64d\",temp2);\n int length=strlen(str1);\n int sum=0;\n for(i=0;i\n\nint digs(long long n) {\n\tint result = 0;\n\twhile (n > 0) {\n\t\tresult += n % 10;\n\t\tn /= 10;\n\t}\n\treturn result;\n}\n\nint main() {\n\tlong long n;\n\tscanf(\"%I64d\", &n);\n\n\tlong long a = 0;\n\tfor (a = 0; a < n; a=a*10+9) ;\n\ta = a/10;\n\n\tprintf(\"%I64d\\n\", digs(a) + digs(n-a));\n\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nint sum(long a);\nint num(long b);\nmain()\n{\n int n,i,j,total;\n long m,a,b;\n scanf(\"%ld\",&m);\n n=num(m);\n total=(n-1)*9;\n b=m-pow(10,n-1)+1;\n printf(\"%d\",total+sum(b));\n}\nint sum(long a)\n{\n int s=0;\n do\n {\n s+=a%10;\n a=a/10;\n }\n while(a!=0);\n return s;\n}\nint num(long a)\n{\n int s=0;\n do\n {\n s++;\n a=a/10;\n }\n while(a!=0);\n return s;\n}\n\n\n"}, {"source_code": "#include\nint main ()\n{\n\tlong long n,b,a;\n\tint s[12],s1[12],s2=0,i=0;\n\tscanf(\"%lld\",&n);\n\tif(n%2==0)\n\t{\n\t\ta=n/2+1;\n\t\tb=n/2-1;\n\t}\n\telse \n\t{\n\t\ta=n/2;\n\t\tb=a+1;\n\t}\n\tif(a>=0&&b<=n&&b>=0&&a<=n&&(a+b)==n)\n\tfor(i=0;i<12;i++)\n\t{\n \twhile(a)\n \t{\n\t \ts[i]=a%10;\n\t \ta/=10;\n\t \ts2=s2+s[i];\n\t }\n\t while(b)\n\t {\n\t \ts1[i]=b%10;\n\t \tb/=10;\n\t \ts2=s2+s1[i];\n\t \n \t}\n }\n\tprintf(\"%d\\n\",s2);\n\t\n\t\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n long long int a,i=0,j,k,sum=0;\n scanf(\"%I64d\\n\",&a);\n while(a!=0){\n sum=sum+(a%10);\n a/=10;\n i++;\n }\n sum=sum+((i-1)*9);\n printf(\"%I64d\\n\",sum);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \"stdint.h\"\n\nint main()\n{\n char a[12];\n char Char[100];\n int c,d;\n //read first number\n scanf(\"%s\",a);\n //read second number\n c=strlen(a);\n // digitcounter(a,&result);\n d=0;\n int b=1;\n for(int i=c-1;i>1;i--){\n if((a[i]-'0')==9){\n if(!b){\n d+=(a[i]-'0');\n\n }\n }else {\n d+=(a[i]-'0');\n b=0;\n }\n }\n d+=(a[0]-'0');\n if((a[c-1]-'0')<9) d+=(a[c-1]-'0');\n printf(\"%d\",d+(c-1)*9);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n long long int m;\n scanf(\"%lld\", &m);\n if(m<=18)\n {\n printf(\"%I64d\", m);\n return 0;\n }\n long long int x,y;\n x=m-1-(m%10);\n y=m-x;\n int count=0,j=0;\n while(x)\n {\n count+=x%10;\n x=x/10;\n }\n count+=y;\n printf(\"%d\", count);\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\n\nlong int deco(long int x){\n long int a = x;\n long int n = 0;\n while(a>=10){\n n+= a%10;\n a /= 10;\n }\n n+=a%10;\n return n;\n}\n\nlong int pot(long int x, long int y){\n long int a =1;\n for(int c = 0;c=10){\n n++;\n p = p/10; \n }\n for(int c = 0;c100){\n\tprintf(\"%ld\",n);\n\tprintf(\"%ld\\n\",res);\n\tprintf(\"%ld\\n\",a-res);\n\tprintf(\"%ld\\n\",x);\n\tprintf(\"%ld\\n\",y);\n }\n printf(\"%ld\",x+y);\n}\n"}, {"source_code": "#include \n#include \n\nint digitSum(int n) {\n int s = 0;\n while (n != 0) {\n s += n % 10;\n n /= 10;\n }\n return s;\n}\n\nint wrong(int n) {\n int r;\n if (n % 2 == 0) {\n int s0 = digitSum(n / 2) * 2;\n int s1 = digitSum(n / 2 + 1) + digitSum(n / 2 - 1);\n r = s0 > s1 ? s0 : s1;\n } else {\n int s = digitSum(n / 2) + digitSum(n / 2 + 1);\n r = s;\n }\n return r;\n}\n\nint sln(int n) {\n int i, m = 0;\n for (i = 0; i <= n / 2; i++) {\n int v = digitSum(i) + digitSum(n - i);\n if (v > m) {\n m = v;\n }\n }\n return m;\n}\n\nint cntdigit(int n) {\n int c = 0;\n while (n != 0) {\n c++;\n n /= 10;\n }\n return c;\n}\n\nint sln1(int n) {\n int c = cntdigit(n);\n int i, v = 1;\n for (i = 0; i != c; i++) {\n v *= 10;\n }\n v /= 10;\n v--;\n // printf(\"%d\\n\", v - 1);\n return digitSum(v) + digitSum(n - v);\n}\n\nint main() {\n int n;\n scanf(\"%d\", &n);\n int r = sln1(n);\n // int i;\n // for (i = 1; i != 10000; i++) {\n // int r1 = sln1(i);\n // int r2= sln(i);\n // if (r1 != r2) {\n // printf(\"%d: %d %d\\n\", i, r1, r2);\n // // return 0;\n // }\n // }\n printf(\"%d\\n\", r);\n return 0;\n}\n"}, {"source_code": "#include\nint main ()\n{\n\tlong long n,b,a;\n\tint s[12],s1[12],s2=0,i=0;\n\tscanf(\"%lld\",&n);\n\tif(n%2==0)\n\t{\n\t\ta=n/2+1;\n\t\tb=n/2-1;\n\t}\n\telse \n\t{\n\t\ta=n/2;\n\t\tb=a+1;\n\t}\n\tif(a>=0&&b<=n&&b>=0&&a<=n&&(a+b)==n)\n\tfor(i=0;i<12;i++)\n\t{\n \twhile(a)\n \t{\n\t \ts[i]=a%10;\n\t \ta/=10;\n\t \ts2=s2+s[i];\n\t }\n\t while(b)\n\t {\n\t \ts1[i]=b%10;\n\t \tb/=10;\n\t \ts2=s2+s1[i];\n\t \n \t}\n }\n\tprintf(\"%d\\n\",s2);\n\t\n\t\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n long long int a,i=0,j,k,sum=0;\n scanf(\"%I64d\\n\",&a);\n while(a!=0){\n sum=sum+(a%10);\n a/=10;\n i++;\n }\n sum=sum+((i-1)*9);\n printf(\"%I64d\\n\",sum);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint count (long long int n){\n\tlong long int sum=0;\n\twhile(n>0){\n\t\tsum+=(n%10);\n\t\tn=n/10;\n\t}\n\treturn sum;\n}\nint main(){\n\tlong long int n;\n\tscanf(\"%I64d\",&n);\n\tif(n>99){\n\t\tlong long int t=n,h=0;\n\t\twhile(t){\n\t\t\th++;\n\t\t\tt=t/10;\n\t\t}\n\t\tlong long int n1=pow(10,h-1);\n\t\tn1-=1;\n\t\tlong long int j=n-n1;\n\t\tj=count(j);\n\t\tint f=(9*(h-1));\n\t\tprintf(\"%d\",f+j);\n\t\treturn 0;\n\t}\n\telse{\n\t\tlong long int l,g;\n\t\tl=(n/2)+1;\n\t\tg=n-l;\n\t\tl=count(l);\n\t\tg=count(g);\n\t\tprintf(\"%I64d\",l+g);\n\t\treturn 0;\n\t\n\t}\n}"}, {"source_code": "#include\n\nint main()\n{\n int n,sum,i=0,b;\n scanf(\"%d\",&n);\n int ten =1;\n while(n-ten*10>0)\n {\n i++;\n ten*=10;\n }\n b = n-ten+1;\n sum = 9*i;\n while(b!=0)\n {\n sum += b%10;\n b = b/10;\n }\n printf(\"%d\\n\",sum);\n\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \"stdint.h\"\n\nint main()\n{\n char a[12];\n char Char[100];\n int c,d;\n //read first number\n scanf(\"%s\",a);\n //read second number\n c=strlen(a);\n // digitcounter(a,&result);\n d=0;\n for(int i=0;i\n\nint main()\n{\n long long n, a=0, b, sum=0, x=0;\n scanf(\"%lld\", &n);\n for(a=0; a\n\nint main()\n{\n long long int n, p, q, r, sum=0, e=0, t;\n \n scanf(\"%lld\", &n);\n if(n%2==0)\n {\n p=n/2;\n q=p;\n }\n else\n {\n p=n/2;\n q=p+1;\n }\n \n if(q%10==9)\n {\n while(q!=0)\n {\n r=q%10;\n sum+=r;\n q=q/10;\n }\n }\n else\n {\n e=q%10;\n q=q-e-1;\n while(q!=0)\n {\n r=q%10;\n sum+=r;\n q=q/10;\n }\n }\n p=p+e+1;\n while(p!=0)\n {\n r=p%10;\n sum+=r;\n p=p/10;\n }\n \n printf(\"%lld\\n\", sum);\n return 0;\n}"}, {"source_code": "#include\nint main ()\n{\n\tlong long n,m,t=1,b;\n\tint a=0,s2;\n\tscanf(\"%lld\",&n);\n\twhile(n-t*10>0)\n\t{\n\t\ta++;\n\t\tt*=10;\n\t}\n\tb=n-t+1;\n\ts2=9*a;\n\twhile(b!=0)\n\t{\n\t\ts2+=b%10;\n\t\tb/=10;\n\t}\n\tprintf(\"%d\\n\",s2);\n\t\n\t\n\treturn 0;\n}"}, {"source_code": "\n#include\n\n///#define long long LL\n///expected initializer\n\n\nlong long digitSum(long long n)\n{\n long long i,j,s=0;\n while(n)\n {\n s=s+n%10;\n\n n= n/10;\n }\n\n return s;\n}\n\nint main(void)\n{\n long long i,j,k,l,l1,n;\n\n scanf(\"%lld\",&n);\n\n if(n&1)\n {\n j=n/2;\n k=j+1;\n }\n else\n {\n j=(n/2)-1;\n k=(n/2)+1;\n }\n l=digitSum(j);\n l1=digitSum(k);\n\n ///printf(\"%lld %lld\\n\",l,l1);\n\n printf(\"%lld\\n\",l+l1);\n\n\n return 0;\n}\n"}, {"source_code": "#include\nint main ()\n{\n\tlong long n,b,a;\n\tint s[12],s1[12],s2=0,i;\n\tscanf(\"%lld\",&n);\n\tif(n%2==0)\n\t{\n\t\ta=n/2+1;\n\t\tb=n/2-1;\n\t}\n\telse \n\t{\n\t\ta=n/2;\n\t\tb=a+1;\n\t}\n\tif(a>=0&&b<=n&&b>=0&&a<=n&&(a+b)==n)\n\t{\n \twhile(a&&b)\n \t{\n\t \ts[i]=a%10;\n\t \ta/=10;\n\t \ts1[i]=b%10;\n\t \tb/=10;\n\t \ts2=s2+s[i]+s1[i];\n\t \n \t}\n }\n\tprintf(\"%d\\n\",s2);\n\t\n\t\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n long long int n;\n long long int div,hold,count=0,sum;\n long long int first,sec;\n long long x=0,y=0,total;\n\n scanf(\"%I64d\",&n);\n\n div = n/2;\n\n hold = div;\n\n while(hold!=0)\n {\n sum = hold%10;\n hold = hold/10;\n count++;\n }\n\n if(count==1 || count==0)\n {\n printf(\"%d\",n);\n return 0;\n }\n else if(count==2)\n {\n first = sum*10-1;\n sec = n-first;\n }\n else if(count==3)\n {\n first = sum*100-1;\n sec = n-first;\n }\n else if(count==4)\n {\n first = sum*1000-1;\n sec = n-first;\n }\n else if(count==5)\n {\n first = sum*10000-1;\n sec = n-first;\n }\n else if(count==6)\n {\n first = sum*100000-1;\n sec = n-first;\n }\n else if(count==7)\n {\n first = sum*1000000-1;\n sec = n-first;\n }\n else if(count==8)\n {\n first = sum*10000000-1;\n sec = n-first;\n }\n else if(count==9)\n {\n first = sum*100000000-1;\n sec = n-first;\n }\n else if(count==10)\n {\n first = sum*1000000000-1;\n sec = n-first;\n }\n else if(count==11)\n {\n first = sum*10000000000-1;\n sec = n-first;\n }\n else if(count==12)\n {\n first = sum*100000000000-1;\n sec = n-first;\n }\n\n while(first!=0)\n {\n x = x + first%10;\n first = first/10;\n }\n while(sec!=0)\n {\n y = y + sec%10;\n sec = sec/10;\n }\n\n total = x+y;\n\n printf(\"%I64d\",total);\n\n return 0;\n\n\n}\n"}, {"source_code": "\n#include\n\n///#define long long LL\n///expected initializer\n\n\nlong long digitSum(long long n)\n{\n long long i,j,s=0;\n while(n)\n {\n s=s+n%10;\n\n n= n/10;\n }\n\n return s;\n}\n\nint main(void)\n{\n long long i,j,k,l,l1,n;\n\n scanf(\"%lld\",&n);\n\n if(n&1)\n {\n j=n/2;\n k=j+1;\n }\n else\n {\n j=(n/2)-1;\n k=(n/2)+1;\n }\n l=digitSum(j);\n l1=digitSum(k);\n\n ///printf(\"%lld %lld\\n\",l,l1);\n\n printf(\"%lld\\n\",l+l1);\n\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint count (long long int n){\n\tlong long int sum=0;\n\twhile(n>0){\n\t\tsum+=(n%10);\n\t\tn=n/10;\n\t}\n\treturn sum;\n}\nint main(){\n\tlong long int n;\n\tscanf(\"%I64d\",&n);\n\tif(n>99){\n\t\tlong long int t=n,h=0;\n\t\twhile(t){\n\t\t\th++;\n\t\t\tt=t/10;\n\t\t}\n\t\tlong long int n1=pow(10,h-1);\n\t\tn1-=1;\n\t\tlong long int j=n-n1;\n\t\tj=count(j);\n\t\tint f=(9*(h-1));\n\t\tprintf(\"%d\",f+j);\n\t\treturn 0;\n\t}\n\telse{\n\t\tlong long int l,g;\n\t\tl=(n/2)+1;\n\t\tg=n-l;\n\t\tl=count(l);\n\t\tg=count(g);\n\t\tprintf(\"%I64d\",l+g);\n\t\treturn 0;\n\t\n\t}\n}"}, {"source_code": "#include\n#include\n\nint main()\n{\n long long num,i,j,temp1,temp2;\n scanf(\"%I64d\",&num);\n if(num%2==0)\n {\n temp1=(num/2)-1;\n }\n else\n {\n temp1=num/2;\n }\n temp2=num-temp1;\n char str1[13],str2[13];\n sprintf(str1,\"%I64d\",temp1);\n sprintf(str2,\"%I64d\",temp2);\n int length=strlen(str1);\n int sum=0;\n for(i=0;i\nint main()\n{\n long long sum=0,a,s,d=9,f=10,j,k,l,i=0;\n scanf(\"%I64d\\n\",&a);\n s=a;\n while(s!=0){\n s=s/10;\n i++;\n }\n printf(\"%I64d\\n\",i);\n for(j=2;j\nint main ()\n{\n\tlong long n,b,a;\n\tint s[12],s1[12],s2=0,i;\n\tscanf(\"%lld\",&n);\n\tif(n%2==0)\n\t{\n\t\ta=n/2+1;\n\t\tb=n/2-1;\n\t}\n\telse \n\t{\n\t\ta=n/2;\n\t\tb=a+1;\n\t}\n\tif(a>=0&&b<=n&&b>=0&&a<=n&&(a+b)==n)\n\t{\n \twhile(a&&b)\n \t{\n\t \ts[i]=a%10;\n\t \ta/=10;\n\t \ts1[i]=b%10;\n\t \tb/=10;\n\t \ts2=s2+s[i]+s1[i];\n\t \n \t}\n }\n\tprintf(\"%d\\n\",s2);\n\t\n\t\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n long long sum=0,a,s,d=9,f=10,j,k,l,i=0;\n scanf(\"%I64d\\n\",&a);\n s=a;\n while(s!=0){\n s=s/10;\n i++;\n }\n\n for(j=2;j\n#include \n#include \n#include \"stdint.h\"\n\nint main()\n{\n char a[12];\n char Char[100];\n int c,d;\n //read first number\n scanf(\"%s\",a);\n //read second number\n c=strlen(a);\n // digitcounter(a,&result);\n d=0;\n int b=1;\n for(int i=c-1;i>1;i--){\n if((a[i]-'0')==9){\n if(!b){\n d+=(a[i]-'0');\n\n }\n }else {\n d+=(a[i]-'0');\n b=0;\n }\n }\n d+=(a[0]-'0');\n if((a[c-1]-'0')<9) d+=(a[c-1]-'0');\n printf(\"%d\",d+(c-1)*9);\n return 0;\n}\n"}, {"source_code": "#include\n#define I64 long long int\nI64 call(I64 x)\n{\n I64 sum=0,a;\n while(x!=0)\n {\n a=x%10;\n x=x/10;\n sum=sum+a;\n }\n return sum;\n}\nint main()\n{\n I64 n;\n scanf(\"%I64d\",&n);\n if(n%2!=0)\n {\n I64 r,m,a1,b1;\n r=n/2;\n m=n/2+1;\n a1=call(r);\n b1=call(m);\n printf(\"%I64d\",a1+b1);\n }\n else\n {\n I64 r1,m1,a2,b2;\n r1=n/2+1;\n m1=n/2-1;\n a2=call(r1);\n b2=call(m1);\n printf(\"%I64d\",a2+b2);\n }\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n long long int n,y,x=1;\n scanf(\"%lld\",&n);\n y=n;\n int i,s=0,a[15],f=1;\n for(i=0;n!=0;i++)\n {\n n/=10;\n f*=10;\n }\n f/=10;\n f--;\n x=9*(i-1);\n y-=f;\n for(i=0;y!=0;i++)\n {\n a[i]=y%10;\n s+=a[i];\n y/=10;\n }\n printf(\"%d\\n\",s+x);\n}\n"}, {"source_code": "#include\n\n#include\n\n#include\n\nint main(){\n\n int len,i,sum,j;\n\n long int a,b,c;\n\n char s[13],s2[12];\n\n gets(s);\n\n len = strlen(s);\n\n if(s[0] == '1'){\n\n i = 0;\n\n s2[0] = '0';\n }\n else if(s[0] == '2'){\n\n i = 1;\n\n s2[0] = '1';\n }\n else if(s[0] == '3'){\n\n i = 2;\n\n s2[0] = '2';\n }\n else if(s[0] == '4'){\n\n i = 3;\n\n s2[0] = '3';\n }\n else if(s[0] == '5'){\n\n i = 4;\n\n s2[0] = '4';\n }\n else if(s[0] == '6'){\n\n i = 5;\n\n s2[0] = '5';\n }\n else if(s[0] == '7'){\n\n i = 6;\n\n s2[0] = '6';\n }\n else if(s[0] == '8'){\n\n i = 7;\n\n s2[0] = '7';\n }\n else if(s[0] == '9'){\n\n i = 8;\n\n s2[0] = '8';\n }\n sum = i + (len - 1)*9;\n\n for(j = 1; j < len; j++){\n\n s2[j] = '9';\n }\n s2[j] = '\\0';\n\n a = atol(s);\n\n b = atol(s2);\n\n c = a - b;\n\n while(c != 0){\n\n sum = sum + c%10;\n\n c = c/10;\n }\n printf(\"%ld\",sum);\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main() {\n\tlong long n,n2;\n\tlong long ans=0;\n\tscanf(\"%I64d\", &n);\n\t \n\tif (n < 10) {\n\t\tprintf(\"%d\", n);\n\t\treturn 0;\n\t}\n\tans += 10 + n % 10;\n\tn -= 10 + n % 10;\n\n\twhile (n > 0) {\n\t\tans += n % 10;\n\t\tn /= 10;\n\t}\n\tprintf(\"%d\", ans);\n}"}, {"source_code": "#include \n#include \n#include \n\ntypedef unsigned long long ll;\ntypedef long double LD;\n\n#define MAXN 101\n\n#define MIN(a,b) ((a)<(b)?(a):(b))\n\nchar arr[MAXN];\n\nint sumdigits(ll input)\n{\n int sum;\n sum = 0;\n while (input >0)\n {\n sum += input%10;\n input /= 10;\n }\n return (sum);\n}\n\nint main(void)\n{\n ll N;\n int ans, nines;\n int temp;\n\n\t#ifndef ONLINE_JUDGE\n FILE *fp;\n\tfp = freopen(\"..\\\\..\\\\1060\\\\B\\\\1060B.TXT\",\"r\",stdin);\n\t//fp = freopen(\"1047C.TXT\",\"r\",stdin);\n\tif (fp == NULL)\n {\n printf (\"Cannot open file\\n\\n\");\n exit(0);\n }\n\t#endif\n\n #ifndef ONLINE_JUDGE\n\n #else \n scanf(\"%I64d\",&N);\n #endif \n \n if (N<9)\n {\n ans = 9;\n }\n else\n {\n nines = 1;\n temp = N;\n while (temp > 10)\n {\n nines *= 10;\n temp /=10;\n }\n nines -=1;\n\n ans = sumdigits(nines) + sumdigits(N-nines); \n }\n printf (\"%d\",ans);\n \n return (0);\n}\n"}, {"source_code": "#include\nint main()\n{\n\tlong long int n, i, x=0;\n\tchar s[14];\n\t\n\tscanf(\"%lld\", &n);\n\t\n\tif(n<10)\n\t{\n\t\tprintf(\"%lld\", n);\n\t}\n\telse\n\t{\n\t\tn=n-9;\n\t\t\n\t\tsprintf(s, \"%lld\", n);\n\t\t\n\t\tfor(i=0; s[i]!='\\0'; i++)\n\t\t{\n\t\t\tx+=s[i]-'0';\n\t\t}\n\t\tprintf(\"%lld\", x+9);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\n\n#include\n\n#include\n\nint main(){\n\n int len,i,sum,j;\n\n long int a,b,c;\n\n char s[13],s2[12];\n\n gets(s);\n\n len = strlen(s);\n\n if(s[0] == '1'){\n\n i = 0;\n\n s2[0] = '0';\n }\n else if(s[0] == '2'){\n\n i = 1;\n\n s2[0] = '1';\n }\n else if(s[0] == '3'){\n\n i = 2;\n\n s2[0] = '2';\n }\n else if(s[0] == '4'){\n\n i = 3;\n\n s2[0] = '3';\n }\n else if(s[0] == '5'){\n\n i = 4;\n\n s2[0] = '4';\n }\n else if(s[0] == '6'){\n\n i = 5;\n\n s2[0] = '5';\n }\n else if(s[0] == '7'){\n\n i = 6;\n\n s2[0] = '6';\n }\n else if(s[0] == '8'){\n\n i = 7;\n\n s2[0] = '7';\n }\n else if(s[0] == '9'){\n\n i = 8;\n\n s2[0] = '8';\n }\n sum = i + (len - 1)*9;\n\n for(j = 1; j < len; j++){\n\n s2[j] = '9';\n }\n s2[j] = '\\0';\n\n a = atol(s);\n\n b = atol(s2);\n\n c = a - b;\n\n while(c != 0){\n\n sum = sum + c%10;\n\n c = c/10;\n }\n printf(\"%ld\",sum);\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n long long int n=0, n1=0, n2=0, rem=0, temp=0, sum1=0, sum2=0;\n scanf(\"%I64d\", &n);\n n1 = n/2;\n n2 = (n-n1);\n temp = n1;\n while(temp!=0)\n {\n rem = (temp%10);\n sum1 += rem;\n temp = temp/10;\n }\n temp = n2;\n while(temp!=0)\n {\n rem = (temp%10);\n sum2 += rem;\n temp = temp/10;\n }\n printf(\"%I64d\", sum1+sum2);\n}\n"}, {"source_code": "#include \n#include \nint main() {\n\tlong long n,n2;\n\tlong long ans=0;\n\tscanf(\"%I64d\", &n);\n\t \n\tif (n < 10) {\n\t\tprintf(\"%d\", n);\n\t\treturn 0;\n\t}\n\tans += 10 + n % 10;\n\tn -= 10 + n % 10;\n\n\twhile (n > 0) {\n\t\tans += n % 10;\n\t\tn /= 10;\n\t}\n\tprintf(\"%d\", ans);\n}"}, {"source_code": "#include \nint main(){\n long long n;\n scanf(\"%lld\",&n);\n long long a=0;long long b=0;\n long long counter=10;int flag=1;\n while(n!=0){\n if(flag==1){\n if(n>9*counter/10)\n a+=9*(counter/10);\n else{\n a+=n%counter;\n break;}\n }\n else{\n if(n>9*counter/10)\n b+=9*(counter/10);\n else{\n b+=n%counter;\n }}\n n-=9*(counter/10);\n if(flag==-1)\n counter*=10;\n flag*=-1;\n\n\n }\n\n\n\n int sum=0;\n while(a!=0){\n sum+=a%10;\n a/=10;\n }\n while(b!=0){\n sum+=b%10;\n b/=10;\n }\n printf(\"%d\",sum);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n long long int n,y,x=1;\n scanf(\"%lld\",&n);\n y=n;\n int i,s=0,a[15],f=1;\n for(i=0;n!=0;i++)\n {\n n/=10;\n f*=10;\n }\n f/=10;\n f--;\n x=9*(i-1);\n y-=f;\n for(i=0;y!=0;i++)\n {\n a[i]=y%10;\n s+=a[i];\n y/=10;\n }\n printf(\"%d\\n\",s+x);\n}\n"}, {"source_code": "#include\nint main()\n{\n\tlong long int n, i, x=0;\n\tchar s[14];\n\t\n\tscanf(\"%lld\", &n);\n\t\n\tif(n<10)\n\t{\n\t\tprintf(\"%lld\", n);\n\t}\n\telse\n\t{\n\t\tn=n-9;\n\t\t\n\t\tsprintf(s, \"%lld\", n);\n\t\t\n\t\tfor(i=0; s[i]!='\\0'; i++)\n\t\t{\n\t\t\tx+=s[i]-'0';\n\t\t}\n\t\tprintf(\"%lld\", x+9);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \nint main()\n{\n int t;\n scanf(\"%d\",&t);\n while(t--)\n {\n long long int n,m=0,i;\n scanf(\"%lld\",&n);\n int x=0,c=0;\n for(i=n;i>0;i/=10)\n {\n x++;\n m=m*10+9;;\n }\n m/=10;\n c+=x*9-9;\n for(i=n-m;i>0;i/=10)\n {\n c+=i%10;\n }\n printf(\"%d\\n\",c);\n }\n return 0;\n}\n"}, {"source_code": "#include\n\nint main ()\n{\n long long int n,a,b,sum,sum1=0,sum2=0,i,j;\n scanf(\"%lld\",&n);\n if(n%2==0)\n {\n a=n/2-1;\n b=n/2+1;\n }\n else\n {\n a=n/2;\n b=n/2+1;\n }\n for(i=1; i<=12; i++)\n {\n sum1=sum1+a%10;\n a=a/10;\n }\n for(j=1; j<=12; j++)\n {\n sum2=sum2+b%10;\n b=b/10;\n }\n sum=sum1+sum2;\n\n printf(\"%lld\\n\",sum);\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\nint deco(int x){\n int a = x;\n int n=0;\n while(a>=10){\n n+= a%10;\n a = a/10; \n }\n n+=a%10;\n return n;\n}\n\nint main(){\n long int a;\n scanf(\"%ld\",&a);\n long int max=0;\n long int x,y;\n long int b,d;\n for(long int c = 1;c<(a/2)+1;c++){\n x = deco(c);\n y = deco(a-c);\n if(x+y > max){\n\t max = x+y;\n\t b =c;\n\t d =a-c;\n\t}\n }\n printf(\"%ld %ld\\n\",b,d);\n printf(\"%ld\",max);\n}\n"}, {"source_code": "#include \nint main(){\n int n;\n scanf(\"%d\",&n);\n int a=0;int b=0;\n int counter=10;int flag=1;\n while(n!=0){\n if(flag==1){\n if(n>9*counter/10)\n a+=9*(counter/10);\n else{\n a+=n%counter;\n break;}\n }\n else{\n if(n>9*counter/10)\n b+=9*(counter/10);\n else{\n b+=n%counter;\n }}\n n-=9*(counter/10);\n if(flag==-1)\n counter*=10;\n flag*=-1;\n\n\n }\n\n\n\n int sum=0;\n while(a!=0){\n sum+=a%10;\n a/=10;\n }\n while(b!=0){\n sum+=b%10;\n b/=10;\n }\n printf(\"%d\",sum);\n return 0;\n}\n"}, {"source_code": "#include \nint main(){\n int n;\n scanf(\"%d\",&n);\n int a=0;int b=0;\n int counter=10;int flag=1;\n while(n!=0){\n if(flag==1){\n if(n>9*counter/10)\n a+=9*(counter/10);\n else{\n a+=n%counter;\n break;}\n }\n else{\n if(n>9*counter/10)\n b+=9*(counter/10);\n else{\n b+=n%counter;\n }}\n n-=9*(counter/10);\n if(flag==-1)\n counter*=10;\n flag*=-1;\n\n\n }\n\n\n\n int sum=0;\n while(a!=0){\n sum+=a%10;\n a/=10;\n }\n while(b!=0){\n sum+=b%10;\n b/=10;\n }\n printf(\"%d\",sum);\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main()\n{\n long long num,i,j,temp1,temp2;\n scanf(\"%I64d\",&num);\n if(num%2==0)\n {\n temp1=(num/2)-1;\n }\n else\n {\n temp1=num/2;\n }\n temp2=num-temp1;\n char str1[13],str2[13];\n sprintf(str1,\"%I64d\",temp1);\n sprintf(str2,\"%I64d\",temp2);\n int length=strlen(str1);\n int sum=0;\n for(i=0;i\nint main()\n{\n\tlong long int n, i, x=0;\n\tchar s[14];\n\t\n\tscanf(\"%lld\", &n);\n\t\n\tif(n<10)\n\t{\n\t\tprintf(\"%lld\", n);\n\t}\n\telse\n\t{\n\t\tsprintf(s, \"%lld\", n);\n\t\t\n\t\tfor(i=0; s[i]!='\\0'; i++)\n\t\t{\n\t\t\tx+=s[i]-'0';\n\t\t}\n\t\tprintf(\"%lld\", x+((i-1)*9));\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n long long int n, p, q,sum=0;\n \n scanf(\"%lld\", &n);\n \n if(n%10==9)\n {\n while(n!=0)\n {\n p=n%10;\n sum+=p;\n n=n/10;\n }\n }\n else\n {\n q=n%10;\n q++;\n n=n-q;\n while(n!=0)\n {\n p=n%10;\n sum+=p;\n n=n/10;\n }\n sum+=q;\n }\n printf(\"%lld\\n\", sum);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n long long int n;\n long long int div,hold,count=0,sum,fal=0;\n long long int first,sec;\n long long x=0,y=0,total;\n\n scanf(\"%I64d\",&n);\n\n div = n/2;\n\n hold = div;\n\n while(hold!=0)\n {\n fal = fal + hold%10;\n sum = hold%10;\n hold = hold/10;\n count++;\n }\n\n if(fal/count==9)\n {\n total = 2*fal;\n printf(\"%I64d\",total);\n return 0;\n }\n\n if(count==1 || count==0)\n {\n printf(\"%d\",n);\n return 0;\n }\n else if(count==2)\n {\n first = sum*10-1;\n sec = n-first;\n }\n else if(count==3)\n {\n first = sum*100-1;\n sec = n-first;\n }\n else if(count==4)\n {\n first = sum*1000-1;\n sec = n-first;\n }\n else if(count==5)\n {\n first = sum*10000-1;\n sec = n-first;\n }\n else if(count==6)\n {\n first = sum*100000-1;\n sec = n-first;\n }\n else if(count==7)\n {\n first = sum*1000000-1;\n sec = n-first;\n }\n else if(count==8)\n {\n first = sum*10000000-1;\n sec = n-first;\n }\n else if(count==9)\n {\n first = sum*100000000-1;\n sec = n-first;\n }\n else if(count==10)\n {\n first = sum*1000000000-1;\n sec = n-first;\n }\n else if(count==11)\n {\n first = sum*10000000000-1;\n sec = n-first;\n }\n else if(count==12)\n {\n first = sum*100000000000-1;\n sec = n-first;\n }\n\n while(first!=0)\n {\n x = x + first%10;\n first = first/10;\n }\n while(sec!=0)\n {\n y = y + sec%10;\n sec = sec/10;\n }\n\n total = x+y;\n\n printf(\"%I64d\",total);\n\n return 0;\n\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int num,a,b=0,i,k,x=1,j,r1,r2,R1=0,R2=0,ans;\n scanf(\"%d\",&num);\n j=num;\n while(num!=0){\n num=num/10;\n b++;\n }\n /*k=b-1;\n x=pow(10,k);\n printf(\"%d\\n\",x);\n printf(\"%d\",b);\n */\n for(i=1;i\n#include\n\n\nlong int deco(long int x){\n long int a = x;\n long int n = 0;\n while(a>=10){\n n+= a%10;\n a /= 10;\n }\n n+=a%10;\n return n;\n}\n\nlong int pot(long int x, long int y){\n long int a =1;\n for(int c = 0;c=10){\n n++;\n p = p/10; \n }\n for(int c = 0;c\n#include\n\nint deco(int x){\n int a = x;\n int n=0;\n while(a>=10){\n n+= a%10;\n a = a/10; \n }\n n+=a%10;\n return n;\n}\n\nint main(){\n long int a;\n scanf(\"%ld\",&a);\n long int max=0;\n long int x,y;\n long int b,d;\n for(long int c = 1;c<(a/2)+1;c++){\n x = deco(c);\n y = deco(a-c);\n if(x+y > max){\n\t max = x+y;\n\t b =c;\n\t d =a-c;\n\t}\n }\n printf(\"%ld %ld\\n\",b,d);\n printf(\"%ld\",max);\n}\n"}, {"source_code": "#include\n#include\nchar r[102];\nint k[4001];\nint main ()\n{\n\tlong long int x=0,y=0,z,i,j,k=0;\n\tscanf(\"%s\",&r);\n\tz=strlen(r);\n\tk=9*(z-1);\n\tfor(i=0;i\n#include\n\n\nlong int deco(long int x){\n long int a = x;\n long int n = 0;\n while(a>=10){\n n+= a%10;\n a /= 10;\n }\n n+=a%10;\n return n;\n}\n\nlong int pot(long int x, long int y){\n long int a =1;\n for(int c = 0;c=10){\n n++;\n p = p/10; \n }\n for(int c = 0;c100){\n\tprintf(\"%ld\\n\",res);\n\tprintf(\"%ld\\n\",a-res);\n\tprintf(\"%ld\\n\",x);\n\tprintf(\"%ld\\n\",y);\n }\n printf(\"%ld\",x+y);\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n\tchar s[15];\n\tint ans, len;\n\twhile (~scanf(\"%s\", s))\n\t{\n\t\tans = 0;\n\t\tlen = strlen(s);\n\t\tans += s[0] - '0' + (len - 1) * 9; \n\t\tfor (int i = 1; i < len; i++)\n\t\t\tans += s[i] - '0';\n\t\tprintf(\"%d\\n\", ans);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\n\nint main ()\n{\n long long int n,a,b,m=10,i,j,x,k,sum1=0,sum2=0,sum,count;\n scanf(\"%lld\",&n);\n b=n;\n for(i=1; i<=12; i++)\n {\n count=i;\n n=n/10;\n if(n==0)\n {\n break;\n }\n }\n for(j=1; j<=count-2; j++)\n {\n m=m*10;\n }\n a=(b%m)+1;\n b=b-a;\n for(k=1; k<=12; k++)\n {\n sum1=sum1+b%10;\n b=b/10;\n }\n for(x=1; x<=12; x++)\n {\n sum2=sum2+a%10;\n a=a/10;\n }\n sum=sum1+sum2;\n printf(\"%lld\\n\",sum);\n\n return 0;\n}\n"}], "src_uid": "5c61b4a4728070b9de49d72831cd2329"} {"nl": {"description": "This is the easy version of the problem. The difference between the versions is in the constraints on the array elements. You can make hacks only if all versions of the problem are solved.You are given an array $$$[a_1, a_2, \\dots, a_n]$$$. Your goal is to find the length of the longest subarray of this array such that the most frequent value in it is not unique. In other words, you are looking for a subarray such that if the most frequent value occurs $$$f$$$ times in this subarray, then at least $$$2$$$ different values should occur exactly $$$f$$$ times.An array $$$c$$$ is a subarray of an array $$$d$$$ if $$$c$$$ can be obtained from $$$d$$$ by deletion of several (possibly, zero or all) elements from the beginning and several (possibly, zero or all) elements from the end.", "input_spec": "The first line contains a single integer $$$n$$$ ($$$1 \\le n \\le 200\\,000$$$) — the length of the array. The second line contains $$$n$$$ integers $$$a_1, a_2, \\ldots, a_n$$$ ($$$1 \\le a_i \\le min(n, 100)$$$) — elements of the array.", "output_spec": "You should output exactly one integer  — the length of the longest subarray of the array whose most frequent value is not unique. If there is no such subarray, output $$$0$$$.", "sample_inputs": ["7\n1 1 2 2 3 3 3", "10\n1 1 1 5 4 1 3 1 2 2", "1\n1"], "sample_outputs": ["6", "7", "0"], "notes": "NoteIn the first sample, the subarray $$$[1, 1, 2, 2, 3, 3]$$$ is good, but $$$[1, 1, 2, 2, 3, 3, 3]$$$ isn't: in the latter there are $$$3$$$ occurrences of number $$$3$$$, and no other element appears $$$3$$$ times."}, "positive_code": [{"source_code": "#include \n#include \n#include \n\n#define N\t200000\n#define K\t447\t/* K = floor(sqrt(N)) */\n\nint min(int a, int b) { return a < b ? a : b; }\nint max(int a, int b) { return a > b ? a : b; }\n\nint main() {\n\tstatic int aa[N], *ii[N], kk[N], ii1[N + 1], ii2[K + 2], ll[N], ll_[N];\n\tint n, i, k, a, a_, ans;\n\n\tscanf(\"%d\", &n);\n\tfor (i = 0; i < n; i++) {\n\t\tscanf(\"%d\", &aa[i]), aa[i]--;\n\t\tkk[aa[i]]++;\n\t}\n\tfor (a = 0; a < n; a++)\n\t\tii[a] = (int *) malloc(kk[a] * sizeof *ii[a]), kk[a] = 0;\n\tmemset(ii1, -1, (K + 2) * sizeof *ii1), memset(ii2, -1, (K + 2) * sizeof *ii2);\n\tans = 0, a_ = -1;\n\tfor (i = 0; i < n; i++) {\n\t\ta = aa[i];\n\t\tii[a][kk[a]++] = i;\n\t\tif (a_ == -1 || kk[a_] < kk[a])\n\t\t\ta_ = a;\n\t\tfor (k = 1; k <= kk[a] && k <= K + 1; k++)\n\t\t\tif (ii1[k] < ii[a][kk[a] - k])\n\t\t\t\tii2[k] = ii1[k], ii1[k] = ii[a][kk[a] - k];\n\t\t\telse if (ii2[k] < ii[a][kk[a] - k])\n\t\t\t\tii2[k] = ii[a][kk[a] - k];\n\t\tfor (k = 1; k <= K; k++)\n\t\t\tif (ii2[k] > ii1[k + 1])\n\t\t\t\tans = max(ans, i - ii1[k + 1]);\n\t\tll[i] = ii1[K + 1];\n\t}\n\tfor (i = 0; i < n; i++)\n\t\tll_[i] = i + 1;\n\tfor (a = 0; a < n; a++)\n\t\tif (a != a_ && kk[a] > K) {\n\t\t\tint d;\n\n\t\t\tmemset(ii1, -1, (n + 1) * sizeof *ii1), ii1[0] = 0;\n\t\t\td = 0;\n\t\t\tfor (i = 0; i < n; i++) {\n\t\t\t\tif (aa[i] == a_)\n\t\t\t\t\td++;\n\t\t\t\telse if (aa[i] == a)\n\t\t\t\t\td--;\n\t\t\t\tif (d >= 0) {\n\t\t\t\t\tif (ii1[d] == -1)\n\t\t\t\t\t\tii1[d] = i + 1;\n\t\t\t\t\tll_[i] = min(ll_[i], ii1[d]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tfor (i = n - 1; i >= 0; i--) {\n\t\tif (ll_[i] <= ll[i])\n\t\t\tans = max(ans, i - ll_[i] + 1);\n\t\tif (ll_[i] == 0)\n\t\t\tbreak;\n\t}\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n"}], "negative_code": [], "src_uid": "a06ebb2734365ec97d07cd1b6b3faeed"} {"nl": {"description": "Let us call a pair of integer numbers m-perfect, if at least one number in the pair is greater than or equal to m. Thus, the pairs (3, 3) and (0, 2) are 2-perfect while the pair (-1, 1) is not.Two integers x, y are written on the blackboard. It is allowed to erase one of them and replace it with the sum of the numbers, (x + y).What is the minimum number of such operations one has to perform in order to make the given pair of integers m-perfect?", "input_spec": "Single line of the input contains three integers x, y and m ( - 1018 ≤ x, y, m ≤ 1018). Please, do not use the %lld specifier to read or write 64-bit integers in C++. It is preffered to use the cin, cout streams or the %I64d specifier.", "output_spec": "Print the minimum number of operations or \"-1\" (without quotes), if it is impossible to transform the given pair to the m-perfect one.", "sample_inputs": ["1 2 5", "-1 4 15", "0 -1 5"], "sample_outputs": ["2", "4", "-1"], "notes": "NoteIn the first sample the following sequence of operations is suitable: (1, 2) (3, 2) (5, 2).In the second sample: (-1, 4) (3, 4) (7, 4) (11, 4) (15, 4).Finally, in the third sample x, y cannot be made positive, hence there is no proper sequence of operations."}, "positive_code": [{"source_code": "#include \n\nvoid swap(long long *a,long long *b){\n long long tmp;\n tmp=*a;\n *a=*b;\n *b=tmp;\n }\n \nint main(){\n long long x,y,m,round=0,ans=0,tmp,tmpround;\n scanf (\"%I64d%I64d%I64d\",&x,&y,&m);\n if (x>=m||y>=m) {\n printf (\"0\");\n return 0;\n }\n if (x<=0&&y<=0&&xy) swap(&x,&y);\n if (x==0&&y==0){\n printf (\"-1\");\n return 0;\n }\n while (xy) swap(&x,&y);\n if (x<0) tmp=x*-1;\n if (x<0&&tmp/y>0){\n tmpround=tmp/y;\n x+=tmpround*y;\n ans+=tmpround;\n }else{\n x=y+x;\n ans++;\n }\n }\n printf (\"%I64d\",ans);\n scanf (\" \");\n return 0;\n }\n"}, {"source_code": "#include \n\nint definite(long long x, long long y){\n if(x==0||y==0){\n if(x<0||y<0)\n return -1;\n if(x>0||y>0)\n return 1;\n return 0;\n }else if(x>0&&y>0)\n return 1;\n else if(x<0&&y<0)\n return -1;\n return 20130721;\n}\n\nlong long opt(long long x, long long y, long long m){\n long long tmp,step,f,f1,f2;\n if(m<0){\n x=-x;\n y=-y;\n m=-m;\n }\n if(x=m)\n return 0;\n step=0;\n if(y<0)\n step+=(-y)/x;\n y+=step*x;\n if(y<0){\n y+=x;\n ++step;\n }\n for(f=f2=0, f1=1; f1*x+f2*y0)||(d==0&&m>0)||(d==-1&&!(x>=m||y>=m))){\n printf(\"-1\\n\");\n return 0;\n }\n if(m<=x||m<=y)\n printf(\"0\\n\");\n else\n printf(\"%I64d\\n\", opt(x, y, m));\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{long long int x,y,m,i=0;\n scanf(\"%I64d%I64d%I64d\",&x,&y,&m);\n while(1)\n {\n if(x>=m||y>=m)\n {\n printf(\"%I64d\",i);break;}\n if(x+y<=x&&x+y<=y)\n {\n printf(\"-1\");break;}\n if(x>0&&y<0)\n {\n i=ceil((-y+x-1)/x);\n y=y+x*i;\n continue;\n }\n if(y>0&&x<0)\n {\n i=ceil((-x+y-1)/y);\n x=x+y*i;\n continue;\n } \n if(x>y)\n y=x+y;\n else\n x=x+y;\n i++;\n}\nreturn 0;\n}\n"}, {"source_code": "#include \n#include \n\n\nint main()\n{\n long long x[3] , m , count = 0 , l = 0;\n scanf(\"%I64d%I64d%I64d\" , &x[0] , &x[1] , &m);\n\n if(x[1] < x[0])\n l = 1;\n\n if(x[0] >= m || x[1] >= m)\n printf(\"0\");\n\n else if(((!x[0]) && x[1] < 0) || ((!x[1]) && x[0] < 0) || (x[0] < 0 && x[1] < 0) || ((!x[0]) && (!x[1])))\n printf(\"-1\");\n\n else\n {\n if(x[l] < x[1 - l] && x[l] < 0)\n {\n if((-x[l]) > x[1 - l])\n {\n count = (-x[l]) / x[1 - l];\n x[l] = x[l] + count * x[1 - l];\n }\n else\n {\n count = (-x[1 - l]) / x[l];\n x[l] = x[l] + count * x[1 - l];\n }\n }\n while(x[0] < m && x[1] < m)\n {\n x[l] = x[l] + x[1 - l];\n count++;\n l = 1 - l;\n }\n printf(\"%I64d\" , count);\n }\n return 0;\n}\n\n"}, {"source_code": "#include \n\nint main() {\n long long x, y, m;\n scanf(\"%I64d%I64d%I64d\", &x, &y, &m);\n if (x >= m || y >= m) {\n printf(\"0\");\n return 0;\n }\n if (x <= 0 && y <= 0) {\n printf(\"-1\");\n return 0;\n }\n long long s = 0;\n if (x > y) {\n int t = x;\n x = y;\n y = t;\n }\n while (y < m) {\n long long d = y - x;\n long long t = d / y;\n if (x + y * t <= y)\n t++;\n x += y * t;\n s += t;\n t = x;\n x = y;\n y = t;\n }\n printf(\"%I64d\", s);\n return 0;\n}\n\n"}, {"source_code": "#include\n#include\n\nint main()\n{\nlong long int x,y,m,g=0,s=0,sum=0;\nscanf(\"%I64d%I64d%I64d\",&x,&y,&m);\nlong long int count=0;\nif(x>y)\n{\ng=x;\ns=y;\n}\nelse\n{\ng=y;\ns=x;\n}\nif(x<=0&&y<=0)\n{if(m<=x||m<=y)\nprintf(\"0\");\nelse\nprintf(\"-1\");\nexit(0);\n}\nelse\n{\nif(g>=m)\n{\n printf(\"0\");\nexit(0);\n}\n\nif(s<0)\n{\ncount=(-s)/g +1;\ns=s+count*g;\n}\n\n\nwhile(g\n#include \n\ntypedef long long ll;\n\n\nll kqua(ll x, ll y, ll m)\n{\n ll tmpx, tmpy, tmp, count = 0, k;\n float d;\n if (x > y){ tmp = x; x = y; y = tmp; }\n if (y >= m) return 0;\n else\n {\n if (x <= 0 && y <= 0) return -1;\n else\n {\n if (x < 0)\n {\n d = -1.0*x / y; k = -x / y;\n if (d == k){ x = 0; count = k; }\n else{ x = x + y*(k + 1); count = k + 1; }\n }\n while (1)\n {\n tmpx = x; tmpy = y;\n x = y; y = tmpx + tmpy;\n count++;\n if (y >= m) return count;\n }\n }\n }\n}\n\nint main()\n{\n ll x, y, m;\n scanf(\"%I64d %I64d %I64d\", &x, &y, &m);\n printf(\"%I64d\", kqua(x, y, m));\n \n return 0;\n}"}, {"source_code": "/*This is by Technical Bangla from University of Dhaka*/\n#include \n#include \nlong double fib(long double index)\n{long double r=sqrt(5),phi=(1+r)/2,com_phi=1-phi;return (pow(phi,index)-pow(com_phi,index))/r;}\nint main()\n{\n long long int a,b,c,count,count1;double sum,low,high;\n while(scanf(\"%I64d %I64d %I64d\",&a,&b,&c)!=EOF)\n {\n if((a>=c)||(b>=c)) printf(\"%d\\n\",0);\n else if(a>0||b>0)\n {\n count1=0; a\n#include\n \nint main()\n{\n int64_t x,y,m,ans = 0,factor,x_prime;\n scanf(\"%I64d\",&x);\n scanf(\"%I64d\",&y);\n scanf(\"%I64d\",&m);\n if (x <= 0 && y <= 0 && m<= 0)\n {\n if (x >= m || y >= m)\n {\n printf(\"0\\n\");\n }\n else\n printf(\"-1\\n\");\n }\n else if (x <= 0 && y <= 0 && m > 0)\n {\n printf(\"-1\\n\");\n }\n else if (x >= 0 && y >= 0 && m < 0)\n {\n printf(\"0\\n\");\n }\n else if (x >= 0 && y <= 0 && m <= 0)\n {\n printf(\"0\\n\");\n }\n else if (x <= 0 && y >=0 && m <= 0)\n {\n printf(\"0\\n\");\n }\n else if (x >= 0 && y > 0 && m >= 0)\n {\n if (x >= m || y >= m)\n {\n printf(\"0\");\n }\n else\n {\n while (x < m && y < m)\n {\n if(x <= y)\n {\n x = x + y;\n ans++;\n }\n else\n {\n y = x + y;\n ans++;\n }\n }\n printf(\"%I64d\\n\",ans);\n }\n }\n else if (x < 0 && y > 0 && m >= 0)\n {\n if (x >= m || y >= m)\n {\n printf(\"%I64d\",ans);\n }\n else\n {\n x_prime = -x;\n factor = x_prime/y;\n x += factor * y;\n ans += factor;\n while (x < m && y < m)\n {\n if(x <= y)\n {\n x = x + y;\n ans++;\n }\n else\n {\n y = x + y;\n ans++;\n }\n }\n printf(\"%I64d\\n\",ans);\n }\n }\n else if (x > 0 && y < 0 && m >= 0)\n {\n if (x >= m || y >= m)\n {\n printf(\"%I64d\",ans);\n }\n else\n {\n x_prime = -y;\n factor = x_prime/x;\n y += factor * x;\n ans += factor;\n while (x < m && y < m)\n {\n if(x <= y)\n {\n x = x + y;\n ans++;\n }\n else\n {\n y = x + y;\n ans++;\n }\n }\n printf(\"%I64d\\n\",ans);\n }\n }\n return 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n long long x, y, m;\n long long ans = 0;\n long long tmp;\n scanf(\"%I64d%I64d%I64d\", &x, &y, &m);\n if ( x > y )\n {\n tmp = x;\n x = y;\n y = tmp;\n }\n if ( y >= m )\n {\n printf(\"0\\n\");\n return 0;\n }\n if ( x <= 0 && y <= 0 )\n {\n printf(\"-1\\n\");\n return 0;\n }\n if ( x < 0 )\n {\n ans += -x/y+1;\n x += ans*y; \n }\n while ( y < m )\n {\n ans++;\n tmp = x+y;\n x = y;\n y = tmp;\n }\n printf(\"%I64d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n long long x, y, m;\n long long ans = 0;\n long long tmp;\n scanf(\"%I64d%I64d%I64d\", &x, &y, &m);\n if ( x > y )\n {\n tmp = x;\n x = y;\n y = tmp;\n }\n if ( y >= m )\n {\n printf(\"0\\n\");\n return 0;\n }\n if ( x <= 0 && y <= 0 && y < m )\n {\n printf(\"-1\\n\");\n return 0;\n }\n if ( x < 0 && y > 0 )\n {\n if ( m < 0 )\n {\n ans += -m/y;\n x += -m/y*y;\n }\n else\n {\n ans += -x/y;\n x += -x/y*y; \n }\n }\n while ( y < m )\n {\n ans++;\n tmp = x+y;\n if ( tmp > y )\n {\n x = y;\n y = tmp;\n }\n else\n {\n x = tmp;\n }\n }\n printf(\"%I64d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n long long x, y, m;\n long long ans = 0;\n long long tmp;\n scanf(\"%I64d%I64d%I64d\", &x, &y, &m);\n if ( x > y )\n {\n tmp = x;\n x = y;\n y = tmp;\n }\n if ( y >= m )\n {\n printf(\"0\\n\");\n return 0;\n }\n if ( x <= 0 && y <= 0 )\n {\n printf(\"-1\\n\");\n return 0;\n }\n if ( x < 0 )\n {\n ans += -x/y;\n x += -x/y*y; \n }\n while ( y < m )\n {\n ans++;\n tmp = x+y;\n if ( tmp > y )\n {\n x = y;\n y = tmp;\n }\n else\n {\n x = tmp;\n }\n }\n printf(\"%I64d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include\n#define swap(a,b) {long long int t=a;a=b;b=t;}\n#define asd if(x=m)printf(\"0\");\n else if(x<=0)printf(\"-1\");\n else\n {\n if(y<=0){s= -y/x+(y%x!=0);y+=s*x;}asd;\n while(x\n\nint main()\n{ long long x,y,m;\n long long count=0;\n scanf(\"%I64d%I64d%I64d\",&x,&y,&m);\n if(x>=m || y>=m)\n {\n count = 0;\n }\n else if(x>0 || y>0)\n {\n if(x<0)\n {\n count = (-1)*(x/y);\n x += count*y;\n }\n else if(y<0)\n {\n count = (-1)*(y/x);\n y += count*x;\n }\n\n while(x\n#include\n#include\n#include\n#include\n#define llu long long int\n#define min(a,b)(a>b?b:a)\n#define max(a,b)(a1000000000000000000)\n break;\n }\n llu x,y,m;\n scanf(\"%lld%lld%lld\",&x,&y,&m);\n if(x<=0 && y<=0)\n {\n if(x=m || y>=m)\n {\n printf(\"0\\n\");\n return 0;\n }\n else\n {\n if(y=m || y>=m)\n {\n printf(\"%lld\\n\",p);\n return 0;\n }\n else\n {\n llu la=x+y,lb=y,pa=p+1;\n if(la>=m || lb>=m)\n {\n printf(\"%lld\\n\",pa);\n return 0;\n }\n else\n {\n for(i=2; ; i++)\n {\n if((x*arr[i]+y*arr[i+1])>=m ||(x*arr[i-1]+y*arr[i])>=m )\n break;\n pa++;\n }\n la=x+y,lb=x;\n llu pb=p+1;\n if(la>=m || lb>=m)\n {\n printf(\"%lld\\n\",pb);\n return 0;\n }\n for(i=2; ; i++)\n {\n if((y*arr[i]+x*arr[i+1])>=m ||(y*arr[i-1]+x*arr[i])>=m )\n break;\n pb++;\n }\n printf(\"%llu\\n\",min(pa,pb)+1);\n }\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nvoid swap(long long * x, long long * y) {\n *x ^= *y; *y ^= *x; *x ^= *y;\n}\n\nlong long min(long long x, long long y) {\n return x && y ? (x < y ? x : y) : (x ? x : y);\n}\n\nint fun_a(long long x, long long y, long long z) {\n int result = 0x3;\n if(x < 0 && y < 0 && z < 0) {\n if(z > x && z > y)\n return 0x0;\n x = -x; y = -y; z = -z;\n }\n if(x + y <= x)\n result ^= 0x2;\n if(x + y <= y)\n result ^= 0x1;\n if(x >= z || y >= z)\n result ^= 0x4;\n return result;\n}\n\nlong long fun_b(long long a, long long b, long long c) {\n long long times = 0;\n while(a < c && b < c) {\n long long t = (long long)ceil((b - a)/(long double)b);\n a += b*(t>0?t:1); times += (t>0?t:1);\n if(a > b)\n swap(&a, &b);\n }\n return times;\n// return (long long)ceil((c-a)/(long double)b);\n}\n\nint main() {\n long long x, y, m;\n scanf(\"%I64d%I64d%I64d\", &x, &y, &m);\n \n int k = fun_a(x, y, m);\n \n if(k&0x4)\n printf(\"%d\\n\", 0);\n else if(k)\n printf(\"%I64d\\n\", min(k&0x1 ? fun_b(y, x, m):0, k&0x2 ? fun_b(x, y, m):0));\n else\n printf(\"%d\\n\", -1);\n \n return 0;\n}\n"}, {"source_code": "/*\nluv_18\n*/\n#include\nint main()\n{\nlong long int x,y,m,c=0,t;\nscanf(\"%lld %lld %lld\",&x,&y,&m);\nif(m==0)\n{\n if(x<0&&y<0)\n printf(\"-1\");\n else\n printf(\"0\");\n}\nelse if(m>0)\n{\n if(x<=0&&y<=0)\n printf(\"-1\");\n else\n { \n if(x>y)\n {\n t=x;\n x=y;\n y=t;\n } \n if(x<0&&y\n#include\nint main(){\n \n long long int* x;\n long long int* y;\n long long int* m;\n long long int* suma;\n long long int* mayor;\n unsigned long long int contador=0;\n \n x=malloc(sizeof(long long int));\n y=malloc(sizeof(long long int));\n m=malloc(sizeof(long long int));\n suma=malloc(sizeof(long long int));\n mayor=malloc(sizeof(long long int));\n //cin>>x>>y>>m;\n scanf(\"%I64d %I64d %I64d\",x,y,m);\n \n /*if((*m)<0){\n (*x)=(*x)*-1;\n (*y)=(*y)*-1;\n (*m)=(*m)*-1;\n }*/\n \n if((*x)>=(*m)||(*y)>=(*m)){\n printf(\"0\");\n //system(\"pause\");\n return 0; \n }\n \n (*suma)=(*x)+(*y);\n \n if((*x)<(*y)){\n if((*x)>=(*suma)){\n \n printf(\"-1\");\n return 0;\n }\n if((*x)-(*y)<0){\n float d=(float)(*x)/(*y);\n //printf(\"linea 36 %f\\n\",d);\n contador=floor(d)*-1;\n (*x)=(*x)+(*y)*contador;\n //printf(\"linea 39 %I64d\\n\",contador);\n }\n }\n \n else{\n if((*y)>=(*suma)){\n \n printf(\"-1\");\n return 0;\n \n }\n if((*y)-(*x)<0){\n float d=(float)(*y)/(*x);\n //printf(\"linea 52 %f\\n\",d);\n contador=floor(d)*-1;\n (*y)=(*y)+(*x)*contador;\n //printf(\"linea 55 %I64d\\n\",contador);\n }\n \n }\n \n free(suma);\n \n //printf(\"afuera contador: %I64d\\n\",contador);\n for(;(*x)<(*m)&&(*y)<(*m);contador++){ \n \n \n if((*x)>=(*y)){\n \n mayor=x;\n suma=y;\n \n }\n else{\n \n mayor=y;\n suma=x; \n \n }\n \n (*suma)=(*suma)+(*mayor);\n //printf(\"contador dentro del for: %I64d\\n\",contador);\n \n }\n printf(\"%I64d\",contador);\n //system(\"pause\");\n return 0;\n \n}"}, {"source_code": "#include \n#include \nint main()\n{\n long long int x,y,m,minimum = 0;\n scanf(\"%I64d%I64d%I64d\",&x,&y,&m);\n while(x < m && y < m)\n {\n if(x<=0 && y<=0)\n {\n minimum = -1;\n break;\n }\n if(x < 0 && y > 0)\n {\n minimum += (long long int)(ceil(-x/y));\n x += minimum*y;\n }\n else if(x > 0 && y < 0)\n {\n minimum += (long long int)(ceil(-y/x));\n y += minimum*x;\n }\n if(x\ntypedef long long ll;\nint main() {\n ll ch=0;\n ll x,y,m,t,d;\n scanf(\"%I64d %I64d %I64d\",&x,&y,&m);\n if(x>=m || y>=m) { puts(\"0\"); return 0; }\n if(x0 && y<0) {\n d=(-y)/x;\n y+=x*d;\n ch=d;\n }\n for(;;) {\n ch++;\n if(x=m || y>=m) break;\n if(x<=0 && y<=0) break;\n }\n if(x\n#include\n#include\n#define max(a,b) ((a>b)?a:b)\n#define min(a,b) ((a>b)?b:a)\n#define LL long long\n#define opfile_in(s) freopen(s,\"r\",stdin)\nLL x,y,m;\nvoid init();\nvoid doit();\nint main()\n{\n init();\n doit();\n return 0;\n}\nvoid init()\n{\n scanf(\"%I64d%I64d%I64d\",&x,&y,&m);\n}\nvoid doit()\n{\n LL tmp,ans=0;\n if(x>=m||y>=m) {printf(\"0\\n\");return;}\n if(x<=0&&y<=0) {printf(\"-1\\n\");return;}\n if(x>y){x^=y;y^=x;x^=y;}\n if(x<0){ans=(-x)/y;x+=ans*y;}\n while(x\nint main()\n{\nlong long x,y,m,moves,temp;\nscanf(\"%I64d%I64d%I64d\",&x,&y,&m);\nif( x=m || y>=m)\n{\nprintf(\"0\");\nreturn 0;\n}\nif(y\n\nint main()\n{\n\tlong long x, y, m, t, res = 0;\n\tscanf(\"%I64d%I64d%I64d\", &x, &y, &m);\n\tif ( x < y )\n\t{\n\t\tt = x;\n\t\tx = y;\n\t\ty = t;\n\t}\n\tif ( x >= m )\n\t\tputs(\"0\");\n\telse if ( x <= 0 )\n\t\tputs(\"-1\");\n\telse\n\t{\n\t\twhile ( x < m )\n\t\t{\n\t\t\tlong long t = (x - y - 1) / x + 1;\n\t\t\tif ( t <= 0 )\n\t\t\t\tt = 1;\n\t\t\tres += t;\n\t\t\tt = y + t * x;\n\t\t\ty = x;\n\t\t\tx = t;\n\t\t}\n\t\tprintf(\"%I64d\\n\", res);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#ifdef ONLINE_JUDGE\n #define NDEBUG 1\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#define long int64_t\n#define fore(i,k,n) for (int _k = (k), _n = (n), i = _k; i <= _n; ++i)\n#define forr(i,n,k) for (int _k = (k), _n = (n), i = _n; i >= _k; --i)\n#define LIST_INIT_CAP 4\n#define HASH_INIT_CAP 64\n#define HASH_SKIP 11\n#define TREE_INIT_CAP 1024\n#define TREE_MAX_HEIGHT 64\n#define DEQUE_INIT_CAP 1024\n#define HEAP_INIT_CAP 1024\n#define TAKEN 1\n#define EMPTY 0\n#define TOMB -1\n#define max(a,b) (((a)>(b))?(a):(b))\n#define min(a,b) (((a)<(b))?(a):(b))\n\n#define N 100004\n\n\nint main() {\n\n long x, y, m;\n scanf(\"%I64d %I64d %I64d\", &x, &y, &m);\n if (m > max(x, y) && x <= 0 && y <= 0) { printf(\"-1\"); return 0; }\n long answer = 0;\n if (x < 0 && m > y) { answer = -x / y; x += answer * y; }\n else if (y < 0 && m > x) { answer = -y / x; y += answer * x; }\n while (m > max(x, y)) {\n if (x < y) { x += y; }\n else { y += x; }\n ++answer;\n }\n printf(\"%I64d\", answer);\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n long long x, y, m, sum = 0;\n \n scanf(\"%I64d %I64d %I64d\", &x, &y, &m);\n \n if (x >= m || y >= m) {\n puts(\"0\");\n \n return 0;\n }\n \n if (x <= 0 && y <= 0) {\n puts(\"-1\");\n \n return 0;\n }\n \n if (x > y) {\n long long tmp = x;\n x = y;\n y = tmp;\n }\n \n if (x < 0) {\n sum += -x / y;\n \n x += y * sum;\n }\n \n while (x < m && y < m) {\n if (x < y) {\n x += y;\n } else {\n y += x;\n }\n \n sum++;\n }\n \n printf(\"%I64d\\n\", sum);\n \n return 0;\n}\n"}, {"source_code": "#include\nmain()\n{\n long long x,y,m,d=0,c=0;\n scanf(\"%I64d %I64d %I64d\",&x,&y,&m);\n if(x>=m || y>=m)\n c=0;\n else if(x>0 || y>0)\n {\n if(x<0)\n {\n c=(-1)*(x/y);\n x=x+c*y;\n }\n else if(y<0)\n {\n c=(-1)*(y/x);\n y=y+c*x;\n }\n while(x\n\nlong long x, y , n, m,q,s, d, c ,t ;\nint main()\n{\n scanf(\"%I64d %I64d %I64d\" , &x, &y, &m) ;\n\n if( x >= m || y >= m)\n{\n printf(\"0\") ;\n return 0;\n}\n if( x > y)\n {\n n = x ;\n q = y ;\n }\n else\n {\n n = y ;\n q = x ;\n }\n\n if( n <= 0)\n {\n printf(\"-1\" ) ;\n return 0;\n }\n if( q < 0 )\n {\n c = - q / n ;\n q = q%n ;\n }\n while( m > q && m > n)\n {\n t = n ;\n n = n + q ;\n q = t ;\n c++ ;\n // printf(\"%I64d %I64d %I64d\\n\", c, q, n) ;\n if( n < q)\n {\n t = n ;\n n = q ;\n q = t ;\n }\n\n }\n printf(\"%I64d\", c) ;\n\n\n return 0;\n }\n"}, {"source_code": "#include\nint main()\n{\n\tlong long int x,y,m,ans=0;;\n\tscanf(\"%I64d%I64d%I64d\",&x,&y,&m);\n\twhile(x0)\n\t\t{\n\t\t\tans += ((-x/y)+1);\n\t\t\tx += ans*y;\n\t\t}\n\t\tif(x>0 && y<0)\n\t\t{\n\t\t\tans += ((-y/x)+1);\n\t\t\ty += ans*x;\n\t\t}\n\t\tif(x\n#include\nint main() \n{\n\tlong long int x,y,m,cnt=0;\n\tscanf(\"%lld\",&x);\n\tscanf(\"%lld\",&y);\n\tscanf(\"%lld\",&m);\n\tif(x>=m || y>=m)\n\t{\n\t\tprintf(\"%d\\n\",0);\n\t\treturn 0;\n\t}\n\tif(x<=0 && y<=0)\n\t{\n\t\tprintf(\"%d\\n\",-1);\n\t\treturn 0;\n\t}\n\tif(x>y)\n\t{\n\t\tlong long int tmp = x;\n\t\tx=y;\n\t\ty=tmp;\n\t}\n\tif(x<0)\n\t{\n\t\tcnt += -x/y;\n\t\tx+=y * cnt;\n\t}\n\twhile(x\n#include\nint main() \n{\n\tlong long int x,y,m,cnt=0;\n\tscanf(\"%lld\",&x);\n\tscanf(\"%lld\",&y);\n\tscanf(\"%lld\",&m);\n\tif(x>=m || y>=m)\n\t{\n\t\tprintf(\"%d\\n\",0);\n\t\treturn 0;\n\t}\n\tif(x<=0 && y<=0)\n\t{\n\t\tprintf(\"%d\\n\",-1);\n\t\treturn 0;\n\t}\n\tif(x>y)\n\t{\n\t\tlong long int tmp = x;\n\t\tx=y;\n\t\ty=tmp;\n\t}\n\tif(x<0)\n\t{\n\t\tcnt += -x/y;\n\t\tx+=y * cnt;\n\t}\n\twhile(x\n#include \n#include \n\nint main(int argc, const char *argv[])\n{\n long long x, y, m;\n assert(scanf(\"%lld %lld %lld\", &x, &y, &m) == 3);\n\n if (x <= 0 && y <= 0) {\n if (x < m && y < m) {\n printf(\"-1\\n\");\n return 0;\n } \n else {\n printf(\"0\\n\");\n return 0;\n }\n }\n\n if (x >= m || y >= m) { \n printf(\"0\\n\");\n return 0;\n }\n\n long long s, t, m2;\n long long count = 0;\n\n if (m > 0) { m2 = 0; }\n else { m2 = m; }\n\n if (x <= 0) {\n t = (m2 - x) / y;\n count += t;\n x += y*t;\n }\n\n if (y <= 0) {\n t = (m2 - y) / x;\n count += t;\n y += x*t;\n }\n\n while (x < m && y < m) {\n s = x + y;\n if (x < y) { x = s; }\n else { y = s; }\n count++;\n }\n\n printf(\"%lld\\n\", count);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n long long x, y, m, sum = 0;\n \n scanf(\"%I64d %I64d %I64d\", &x, &y, &m);\n \n if (x >= m || y >= m) {\n puts(\"0\");\n \n return 0;\n }\n \n if (x <= 0 && y <= 0) {\n puts(\"-1\");\n \n return 0;\n }\n \n if (x > y) {\n long long tmp = x;\n x = y;\n y = tmp;\n }\n \n if (x < 0) {\n sum += -x / y;\n \n x += y * sum;\n }\n \n while (x < m && y < m) {\n if (x < y) {\n x += y;\n } else {\n y += x;\n }\n \n sum++;\n }\n \n printf(\"%I64d\\n\", sum);\n \n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tlong long int a,b,x,p,q,c,y,temp;\n\tscanf(\"%I64d %I64d %I64d\",&a,&b,&x);\n\tif(a>b)\n\t{\n\t\ttemp=b;\n\t\tb=a;\n\t\ta=temp;\n\t}\n\tif(b>=x)\n\tprintf(\"0\");\n\telse\n\t{\n\t\tif(a<=0 && b<=0)\n\t\tprintf(\"-1\");\n\t\telse\n\t\t{\n\t\t\tc=0;\n\t\t\tif(a<0)\n\t\t\t{\n\t\t\t\tp=-1*a;\n\t\t\t\tif(p%b==0)\n\t\t\t\t{\n\t\t\t\t\tc=c+p/b;\n\t\t\t\t\ta=0;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tq=p/b;\n\t\t\t\t\tq++;\n\t\t\t\t\tc=c+q;\n\t\t\t\t\ta=a+q*b;\n\t\t\t\t}\n\t\t\t\tif(a>b)\n\t\t\t\t{\t\t\n\t\t\t\t\ttemp=b;\n\t\t\t\t\tb=a;\n\t\t\t\t\ta=temp;\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile(bb)\n\t\t\t\t{\t\t\n\t\t\t\t\ttemp=b;\n\t\t\t\t\tb=a;\n\t\t\t\t\ta=temp;\n\t\t\t\t}\n\t\t\t\t//printf(\"%I64d %I64d %I64d\\n\",a,b,c);\n\t\t\t}\n\t\t\tprintf(\"%I64d\",c);\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \n\ntypedef long long LL_t;\n\nint main()\n{\n\tLL_t x,y,m,temp,Cnt;\n\twhile(scanf(\"%I64d %I64d %I64d\",&x,&y,&m)!=EOF)\n\t{\n\t\tif(x=m)\n\t\t{\n\t\t\tprintf(\"0\\n\");\n\t\t\tcontinue;\n\t\t}\n\t\tif(x<=0)\n\t\t{\n\t\t\tprintf(\"-1\\n\");\n\t\t\tcontinue;\n\t\t}\n\t\tif(y<0)\n\t\t{\n\t\t\ty=-y;\n\t\t\tif(y%x!=0)\n\t\t\t{\n\t\t\t\tCnt=y/x+1;\n\t\t\t\ty=x-y%x;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tCnt=y/x;\n\t\t\t\ty=0;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tCnt=0;\n\t\t}\n\t\twhile(1)\n\t\t{\n\t\t\t++Cnt;\n\t\t\ttemp=x+y;\n\t\t\ty=temp;\n\t\t\tif(temp>=m)\n\t\t\t{\n\t\t\t\tprintf(\"%I64d\\n\",Cnt);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ttemp=x;\n\t\t\tx=y;\n\t\t\ty=temp;\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tlong long int a, b, m;\n\tlong long int count;\n\tscanf(\"%lld\", &a);\n\tscanf(\"%lld\", &b);\n\tscanf(\"%lld\", &m);\n\n\tif (a>=m || b>=m)\n\t{\n\t\tcount = 0;\n\t\tprintf(\"%lld\\n\", count);\n\t\treturn 0;\n\t}\n\n\tif((a<=0 && b<=0))\n\t{\n\t\tcount = -1;\n\t\tprintf(\"%lld\\n\", count);\n\t\treturn 0;\n\t}\n\tcount = 0;\n\n\tif (a<0)\n\t{\n\t\tcount = (-1*a)/b;\n\t\ta = b*count + a;\n\t}\n\tif (b<0)\n\t{\n\t\tcount = (-1*b)/a;\n\t\tb = a*count + b;\n\t}\n\n\twhile(a=b)\n\t\t{\n\t\t\tb = a+b;\n\t\t\tcount++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ta = a+b;\n\t\t\tcount++;\n\t\t}\n\t}\n\tprintf(\"%lld\\n\", count);\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n long long int N,i,j,M,a,ans=0;\n scanf(\"%I64d%I64d%I64d\",&N,&M,&a);\n while(N0)\n {\n ans+=(-N/M)+1;\n N+=(ans*M);\n }\n if(M<0&&N>0)\n {\n ans+=(-M/N)+1;\n M+=(ans*N);\n }\n if(N\n#define max(a,b) ((a)>(b)?(a):(b))\nint main(void)\n{\n long long i,j,k,sum=0,m,n;\n scanf(\"%I64d%I64d%I64d\",&i,&j,&k);\n m=max(i,j);\n n=i+j-m;\n if(m>=k||n>=k)\n printf(\"0\\n\");\n else if(m<=0)\n printf(\"-1\\n\");\n else\n {\n if(n<0)\n {\n sum=(-n)/m+1;\n n+=sum*m;\n }\n while(m\n#include \nint main ()\n{\n long long x, y, m, n, z;\n scanf (\"%I64d%I64d%I64d\", &x, &y, &m);\n n = 0;\n if (x >= m || y >= m)\n {\n printf (\"0\\n\");\n exit (0);\n }\n if (x <= 0 && y<= 0)\n {\n printf (\"-1\\n\");\n exit (0);\n }\n if (x > y)\n {\n z = x;\n x = y;\n y = z;\n }\n if (x <= 0)\n {\n n -= x / y - 1;\n x -= (x / y - 1) * y ;\n }\n while (y < m)\n {\n z = x + y;\n x = y;\n y = z;\n n++;\n }\n printf (\"%I64d\\n\", n);\n return 0;\n}\n"}, {"source_code": "#include\nmain()\n{\nlong long x,b,y,m,cnt=0,i,j;\n scanf(\"%I64d\",&x);\n scanf(\"%I64d\",&y);\n scanf(\"%I64d\",&m);\n if(x<=0&&y<=0&&m>x&&m>y)\n {\n printf(\"-1\");\n exit(0);\n }\n if(x>m || y>m)\n {\n printf(\"0\");\n exit(0);\n }\n if(x<0&&y>0&&(-1*x)>y)\n {\n b=(-1*x)/y;\n cnt=b;\n x=x+(b*y);\n }\n if(y<0&&x>0&&(-1*y)>x)\n {\n b=(-1*y)/x;\n cnt=b;\n y+=b*x;\n }\n while(xy)\n y=y+x;\n else\n x=x+y;\n cnt++;\n }\n\n printf(\"%I64d\",cnt);\n return 0;\n }\n"}, {"source_code": "#include \nint main()\n{\n long long int a, b, m;\n long long int count;\n scanf(\"%I64d\", &a);\n scanf(\"%I64d\", &b);\n scanf(\"%I64d\", &m);\n\n if (a>=m || b>=m)\n {\n count = 0;\n printf(\"%I64d\\n\", count);\n return 0;\n }\n\n if((a<=0 && b<=0))\n {\n count = -1;\n printf(\"%I64d\\n\", count);\n return 0;\n }\n count = 0;\n\n if (a<0)\n {\n count = (-1*a)/b;\n a = b*count + a;\n }\n if (b<0)\n {\n count = (-1*b)/a;\n b = a*count + b;\n }\n\n while(a=b)\n {\n b = a+b;\n count++;\n }\n else\n {\n a = a+b;\n count++;\n }\n }\n printf(\"%I64d\\n\", count);\n return 0;\n}"}, {"source_code": "#include \n#include \n\nint main(void) {\n long long x, y, m, cnt = 0;\n scanf (\"%I64d %I64d %I64d\", &x, &y, &m);\n if (x >= m || y >= m) {\n printf(\"%d\", 0);\n exit(0);\n }\n\n if (x + y <= x && x + y <= y) {\n printf(\"%d\", -1);\n exit(0);\n }\n if (x > y) {\n long long temp = x;\n x = y;\n y = temp;\n }\n if (x < 0 && y > 0) {\n long long n = (-x / y);\n cnt += n;\n x += y * n;\n }\n while (x < m && y < m) {\n cnt++;\n if (x > y)\n y = x + y;\n else\n x = x + y;\n }\n printf(\"%I64d\", cnt);\n return 0;\n}\n"}, {"source_code": "# include \n\nint nousefun()\n{\n printf(\"wocaoa ;weishenmezongshiwrong\");\n return 0;\n}\nlong long fun( long long x, long long y, long long m)\n{\n long long temp, ans ;\n for (temp = 0 ; y < m ; temp++)\n {\n ans= x+y, x = y, y =ans ;\n }\n return temp ;\n}\nint fun2()\n{\n return 0;\n}\nlong long fun3(long long x, long long y, long long m)\n{\n long long tempx ;\n int i;\n for(i=0;i<100;i++)i=i;\n if (x >= 0) return fun(x, y, m) ;\n tempx = -x ;\n if (tempx <= y) return fun(x+y, y, m)+1 ;\n return fun(-1LL*(tempx%y), y, m)+ tempx/y ;\n}\n\n\nint main ()\n{\n long long x, y, m, ans ,temp;\n while (~scanf (\"%I64d%I64d%I64d\", &x, &y, &m))\n {\n if (x > y)\n {\n temp=x;x=y;y=temp;\n }\n if(y>=m)printf(\"0\\n\");\n else if(y<=0)printf(\"-1\\n\");\n else\n {\n printf (\"%I64d\\n\", fun3(x,y,m)) ;\n }\n }\n return 0 ;\n}\n"}, {"source_code": "long long x,y,m,c;\n\nint main()\n{\n\twhile(~scanf(\"%lld%lld%lld\",&x,&y,&m))\n\t{\n\t\tc=0;\n\t\tif(x>=m||y>=m)\n\t\t{\n\t\t\tprintf(\"%lld\\n\",c);\n\t\t\tbreak;\n\t\t}\n\t\tif(x>y) x^=y^=x^=y;\n\t\tif(x<0&&y>0)\n\t\t{\n\t\t\tc=(-x)/y+1;\n\t\t\tx+=c*y;\n\t\t}\n\t\twhile(1)\n\t\t{\n\t\t\tif(x>=m||y>=m)\n\t\t\t{\n\t\t\t\tprintf(\"%lld\\n\",c);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(x>y) x^=y^=x^=y;\n\t\t\tx=y+x;\n\t\t\tc++;\n\t\t\tif(x<=0&&y<=0)\n\t\t\t{\n\t\t\t\tputs(\"-1\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \n\n#define ll signed long long\n\nvoid swap(ll *x, ll *y)\n{\n ll buf = *x;\n *x = *y;\n *y = buf;\n}\n\nint main()\n{\n ll x, y, m, ans = 0;\n scanf(\"%lld %lld %lld\", &x, &y, &m);\n if(x > y) swap(&x, &y);\n if(y >= m)\n {\n printf(\"0\");\n return 0;\n }\n if(x <= 0 && y <= 0)\n {\n printf(\"-1\");\n return 0;\n }\n if(x <= 0)\n {\n ans = (-x) / y + 1;\n x += y * ans;\n }\n while(y < m)\n {\n ans++;\n x = x + y;\n swap(&x, &y);\n }\n printf(\"%lld\", ans);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n long long int n,m,x,i,k;\n scanf(\"%lld %lld %lld\",&n,&m,&x);\n if(x>n&&x>m&&n<=0&&m<=0)\n {\n printf(\"-1\\n\");\n }\n else\n {\n for(i=0;; i++)\n {\n if(n>=x||m>=x)\n {\n break;\n }\n else if(n>0&&m<0)\n {\n if(m%n==0)\n {\n i=i+((-m)/n)-1;\n m=0;\n }\n else\n {\n k=(((-m)/n)+1)*n;\n i=i+((-m)/n);\n m=m+k;\n }\n }\n else if(m>0&&n<0)\n {\n if(n%m==0)\n {\n i=i+((-n)/m)-1;\n n=0;\n }\n else\n {\n k=(((-n)/m)+1)*m;\n i=i+((-n)/m);\n n=n+k;\n }\n }\n else if(n\n\nint main() {\n\tlong long x, y, z, m, ans;\n\n\tscanf(\"%lld%lld%lld\", &x, &y, &m);\n\tif (x > y)\n\t\tz = x, x = y, y = z;\n\tif (y >= m) {\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\tif (y <= 0) {\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\tans = 0;\n\tif (x < 0) {\n\t\tans += (-x + y - 1) / y;\n\t\tx = (x % y + y) % y;\n\t}\n\twhile (y < m) {\n\t\tz = x + y, x = y, y = z;\n\t\tans++;\n\t}\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n"}], "negative_code": [{"source_code": "#include \n\nvoid swap(long long *a,long long *b){\n long long tmp;\n tmp=*a;\n *a=*b;\n *b=tmp;\n }\n \nint main(){\n long long x,y,m,round=0,ans=0,tmp,tmpround;\n scanf (\"%I64d%I64d%I64d\",&x,&y,&m);\n if (x<=0&&y<=0&&xy) swap(&x,&y);\n if (x==0&&y==0){\n printf (\"-1\");\n return 0;\n }\n if (x>=m||y>=m) {\n printf (\"0\");\n return 0;\n }\n while (xy) swap(&x,&y);\n if (x<0) tmp=x*-1;\n if (x<0&&tmp/y>0){\n tmpround=tmp/y;\n x+=tmpround*y;\n ans+=tmpround;\n }else{\n x=y+x;\n ans++;\n }\n }\n printf (\"%I64d\",ans-1);\n scanf (\" \");\n return 0;\n }\n"}, {"source_code": "#include \n\nvoid swap(long long *a,long long *b){\n long long tmp;\n tmp=*a;\n *a=*b;\n *b=tmp;\n }\n \nint main(){\n long long x,y,m,round=0,ans=0,tmp,tmpround;\n scanf (\"%I64d%I64d%I64d\",&x,&y,&m);\n if (x<=0&&y<=0&&xy) swap(&x,&y);\n if (x==0&&y==0){\n printf (\"-1\");\n return 0;\n }\n while (xy) swap(&x,&y);\n if (x<0) tmp=x*-1;\n if (x<0&&tmp/y>0){\n tmpround=tmp/y;\n x+=tmpround*y;\n ans+=tmpround;\n }else{\n x=y+x;\n ans++;\n }\n }\n printf (\"%I64d\",ans-1);\n scanf (\" \");\n return 0;\n }\n"}, {"source_code": "#include \nmain(){\nlong long x,y,m,turn=0;\n scanf (\"%I64d%I64d%I64d\",&x,&y,&m);\n while ((x0||y>0)){\n if (x>y){\n y=x+y;\n turn++;\n }else{\n x=x+y;\n turn++;\n }\n }\n if (x<=0&&y<=0) printf (\"-1\");\n else printf (\"%d\",turn);\n return 0;\n}\n"}, {"source_code": "#include \n\nint definite(long long x, long long y){\n if(x==0||y==0){\n if(x<0||y<0)\n return -1;\n if(x>0||y>0)\n return 1;\n }else if(x>0&&y>0)\n return 1;\n else if(x<0&&y<0)\n return -1;\n return 20130721;\n}\n\nlong long greedy(long long x, long long y, long long m){\n int step;\n step=0;\n if(m>0){\n while(!(x>=m||y>=m)){\n if(xy)\n x+=y;\n else\n y+=x;\n ++step;\n }\n return step;\n }\n}\n\nint main(void){\n int d;\n long long k,x,y,m;\n scanf(\"%I64d%I64d%I64d\", &x, &y, &m);\n d=definite(x,y);\n if((d>0&&m<0)||(d<0&&m>0)||(d==0&&m>0)){\n printf(\"-1\\n\");\n return 0;\n }\n k=greedy(x, y, m);\n printf(\"%I64d\\n\", k);\n return 0;\n}\n"}, {"source_code": "#include \n\nint definite(long long x, long long y){\n if(x==0||y==0){\n if(x<0||y<0)\n return -1;\n if(x>0||y>0)\n return 1;\n return 0;\n }else if(x>0&&y>0)\n return 1;\n else if(x<0&&y<0)\n return -1;\n return 20130721;\n}\n\nlong long greedy(long long x, long long y, long long m){\n long long step;\n /*\n if(m>0){\n while(!(x>=m||y>=m)){\n if(x=m||y>=m)){\n if(x>y)\n x+=y;\n else\n y+=x;\n ++step;\n }\n return step;\n }\n */\n if(m<=x||m<=y)\n return 0;\n if(x>y){\n step=(m-y)/x;\n if((m-y)%x)\n ++step;\n }else{\n step=(m-x)/y;\n if((m-x)%y)\n ++step;\n }\n return step;\n}\n\nint main(void){\n int d;\n long long k,x,y,m;\n scanf(\"%I64d%I64d%I64d\", &x, &y, &m);\n d=definite(x,y);\n if((d>0&&m<0)||(d<0&&m>0)||(d==0&&m>0)||(d<0&&!(x>=m||y>=m))){\n printf(\"-1\\n\");\n return 0;\n }\n k=greedy(x, y, m);\n printf(\"%I64d\\n\", k);\n return 0;\n}\n"}, {"source_code": "#include \n\nint definite(long long x, long long y){\n if(x==0||y==0){\n if(x<0||y<0)\n return -1;\n if(x>0||y>0)\n return 1;\n return 0;\n }else if(x>0&&y>0)\n return 1;\n else if(x<0&&y<0)\n return -1;\n return 20130721;\n}\n\nlong long opt(long long x, long long y, long long m){\n long long tmp,step,f,f1,f2;\n if(m<0){\n x=-x;\n y=-y;\n m=-m;\n }\n if(x=m)\n return 0;\n step=0;\n if(y<0)\n step+=(-y)/x;\n y+=step*x;\n if(y<0){\n y+=x;\n ++step;\n }\n for(f=f2=0, f1=1; f1*x+f2*y0)||(d==0&&m>0)||(d==-1&&!(x>=m||y>=m))){\n printf(\"-1\\n\");\n return 0;\n }\n k=opt(x, y, m);\n printf(\"%I64d\\n\", k);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{long long int x,y,m,i=0;\n scanf(\"%I64d%I64d%I64d\",&x,&y,&m);\n while(1)\n {if(x>=m||y>=m)\n {\n printf(\"%d\",i);break;}\n \n else if(x>y)\n y=x+y;\n else\n x=x+y;\n i++;\n if(x+y<=x||x+y<=y)\n {\n printf(\"-1\");break;}\n}\nreturn 0;\n}"}, {"source_code": "#include\nint main()\n{long long int x,y,m,i=0;\n scanf(\"%I64d%I64d%I64d\",&x,&y,&m);\n while(1)\n {if(x>=m||y>=m)\n {\n printf(\"%I64d\",i);break;}\n \n else if(x>y)\n y=x+y;\n else\n x=x+y;\n i++;\n if(x+y<=x||x+y<=y)\n {\n printf(\"-1\");break;}\n}\nreturn 0;\n}"}, {"source_code": "#include\nint main()\n{long long int x,y,m,i=0,j=0;\n scanf(\"%I64d%I64d%I64d\",&x,&y,&m);\n while(1)\n {if(x+y<=x&&x+y<=y)\n {\n printf(\"-1\");break;}\n\tif(x>=m||y>=m)\n {\n printf(\"%I64ld\",i+j);break;}\n \n if(x>y)\n y=x+y;\n else\n x=x+y;\n if(i<1000000000000000000)\n i++;\n else\n j++;\n}\nreturn 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n long long x[3] , m , count = 0 , l = 0;\n scanf(\"%I64d%I64d%I64d\" , &x[0] , &x[1] , &m);\n\n if(x[1] < x[0])\n l = 1;\n\n if(x[0] >= m || x[1] >= m)\n printf(\"0\");\n\n else if(((!x[0]) && x[1] < 0) || ((!x[1]) && x[0] < 0) || (x[0] < 0 && x[1] < 0) || ((!x[0]) && (!x[1])))\n printf(\"-1\");\n\n else\n {\n if(x[l] < x[1 - l] && x[l] < 0)\n {\n count = (-x[l]) / x[1 - l];\n x[l] = x[l] + count * x[1 - l];\n }\n\n while(x[0] < m && x[1] < m)\n {\n x[l] = x[l] + x[1 - l];\n count++;\n l = 1 - l;\n }\n printf(\"%I64d\" , count);\n }\n return 0;\n}\n\n"}, {"source_code": "#include \n\nint main() {\n long long x, y, m;\n scanf(\"%I64d%I64d%I64d\", &x, &y, &m);\n if (x >= m || y >= m || (x <= 0 && y <= 0)) {\n printf(\"-1\");\n return 0;\n }\n long long s = 0;\n while (x < m && y < m) {\n if (x < y)\n x += y;\n else\n y += x;\n s++;\n }\n printf(\"%I64d\", s);\n return 0;\n}\n\n"}, {"source_code": "#include \n\nint main() {\n long long x, y, m;\n scanf(\"%I64d%I64d%I64d\", &x, &y, &m);\n if (x >= m || y >= m) {\n printf(\"-1\");\n return 0;\n }\n long long s = 0;\n while (x < m && y < m) {\n if (x < y)\n x += y;\n else\n y += y;\n s++;\n }\n printf(\"%I64d\", s - 1);\n return 0;\n}\n\n"}, {"source_code": "#include \n\nint main() {\n long long x, y, m, mi = -1;\n scanf(\"%I64d%I64d%I64d\", &x, &y, &m);\n if (y != 0) {\n long long a = m - x, t = a / y;\n if (t * y == a && ((y >= 0 && a >= 0) || (y < 0 && a < 0)))\n mi = t;\n }\n if (x != 0) {\n long long a = m - y, t = a / x;\n if (t * x == a && ((x >= 0 && a >= 0) || (x < 0 && a < 0)))\n if (mi == -1 || t < mi)\n mi = t;\n }\n printf(\"%I64d\", mi);\n return 0;\n}\n\n"}, {"source_code": "#include \n\nint main() {\n long long x, y, m, mi = -1;\n scanf(\"%I64d%I64d%I64d\", &x, &y, &m);\n if (y != 0) {\n long long a = m - x, t = a / y;\n if (t * y == a && ((y >= 0 && a >= 0) || (y < 0 && a < 0)))\n mi = t;\n }\n if (x != 0) {\n long long a = m - y, t = a / x;\n if (t * x == a && ((y >= 0 && a >= 0) || (y < 0 && a < 0)))\n if (mi == -1 || t < mi)\n mi = t;\n }\n printf(\"%I64d\", mi);\n return 0;\n}\n\n"}, {"source_code": "#include \n\nint main() {\n int x, y, m, mi = -1;\n scanf(\"%d%d%d\", &x, &y, &m);\n if (y != 0) {\n int a = m - x, t = a / y;\n if (t * y == a && ((y >= 0 && a >= 0) || (y < 0 && a < 0)))\n mi = t;\n }\n if (x != 0) {\n int a = m - y, t = a / x;\n if (t * x == a && ((x >= 0 && a >= 0) || (x < 0 && a < 0)))\n if (mi == -1 || t < mi)\n mi = t;\n }\n printf(\"%d\", mi);\n return 0;\n}\n\n"}, {"source_code": "#include \n\nint main() {\n long long x, y, m;\n scanf(\"%I64d%I64d%I64d\", &x, &y, &m);\n if (x >= m || y >= m || x < 0 || y < 0) {\n printf(\"-1\");\n return 0;\n }\n long long s = 0;\n while (x < m && y < m) {\n if (x < y)\n x += y;\n else\n y += x;\n s++;\n }\n printf(\"%I64d\", s);\n return 0;\n}\n\n"}, {"source_code": "#include \n#include \n\nint main() {\n long long x, y, m, mi = -1;\n scanf(\"%I64d%I64d%I64d\", &x, &y, &m);\n if (y != 0) {\n long long a = m - x, t = a / y;\n if (t * y == a && y / abs(y) * a / abs(a) == 1)\n mi = t;\n }\n if (x != 0) {\n long long a = m - y, t = a / x;\n if (t * x == a && x / abs(x) * a / abs(a) == 1)\n if (mi == -1 || t < mi)\n mi = t;\n }\n printf(\"%I64d\", mi);\n return 0;\n}\n\n"}, {"source_code": "#include\n#include\nint main()\n{\n int v=1;\nlong int x,y,m;\nscanf(\"%d%d%d\",&x,&y,&m);\nlong int count=0;\nwhile(v==1)\n{\nif(x<=0&&y<=0)\n{\n if(m>x&&m>y)\n{\nprintf(\"-1\");\nv=2;\nbreak;\n}\nelse {\n printf(\"0\");\n v=2;\n break;\n}\n\n}\n\n\n else\n {\n if(x>=m||y>=m)\n{\nprintf(\"%ld\",count);\nv=2;\nbreak;\n}\nelse\n{\ncount++;\nif(x\n#include\n\nint main()\n{\nlong long int x,y,m,g=0,s=0,sum=0;\nscanf(\"%I64d%I64d%I64d\",&x,&y,&m);\nlong long int count=0;\nif(x>y)\n{\ng=x;\ns=y;\n}\nelse\n{\ng=y;\ns=x;\n}\nif(x<=0&&y<=0)\n{if(m<=x||m<=y)\nprintf(\"0\");\nelse\nprintf(\"-1\");\nexit(0);\n}\nelse\n{\n\nif(s<0)\n{\ncount=(-s)/g +1;\ns=s+count*g;\n}\n\n\nwhile(g\n#include\n\nint main()\n{\nlong long int x,y,m,g=0,s=0,sum=0;\nscanf(\"%I64d%I64d%I64d\",&x,&y,&m);\nlong int count=0;\nif(x>y)\n{\ng=x;\ns=y;\n}\nelse\n{\ng=y;\ns=x;\n}\nif(x<=0&&y<=0)\n{if(m<=x||m<=y)\nprintf(\"0\");\nelse\nprintf(\"-1\");\nexit(0);\n}\nelse\n{\n\nif(s<0)\n{\ncount=(-s)/g +1;\ns=s+count*g;\n}\n\n\nwhile(g\n#include\n\nint main()\n{\nlong long int x,y,m,g=0,s=0,sum=0;\nscanf(\"%I64d%I64d%I64d\",&x,&y,&m);\nlong int count=0;\nif(x>y)\n{\ng=x;\ns=y;\n}\nelse\n{\ng=y;\ns=x;\n}\nif(x<=0&&y<=0)\n{if(m\n#include\n\nint main()\n{\nlong long int x,y,m,g=0,s=0,sum=0;\nscanf(\"%I64d%I64d%I64d\",&x,&y,&m);\nlong int count=0;\nif(x>y)\n{\ng=x;\ns=y;\n}\nelse\n{\ng=y;\ns=x;\n}\nif(x<=0&&y<=0)\n{if(m<=x||m<=y)\nprintf(\"0\");\nelse\nprintf(\"-1\");\nexit(0);\n}\nelse\n{\n\nif(s<0)\n{\ncount=(-x)/y +1;\ns=s+count*y;\n}\n\n\nwhile(g\n#include \n#include \n\ntypedef long long ll;\nint main()\n{\n ll x, y, m, i, tmp;\n scanf(\"%I64d %I64d %I64d\", &x, &y, &m);\n if (x > y){ tmp = x; x = y; y = tmp; }\n i = ceil((m + x)*1.0 / (x + y));\n if (i >= 1) printf(\"%I64d\", i);\n else printf(\"-1\");\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \n\ntypedef long long ll;\nint main()\n{\n ll x, y, m, i, tmp;\n scanf(\"%I64d %I64d %I64d\", &x, &y, &m);\n if (x > y){ tmp = x; x = y; y = tmp; }\n if (y >= m) i = 0;\n else\n {\n if (x >=0 && y > 0 || x>0 && y>=0)\n i = ceil((m + x)*1.0 / (x + y));\n else if (x<=0 && y>0 && abs(x*1.0) <= y)\n i = ceil((m - y + 2 * x)*1.0 / (x + y))+1;\n else i = -1;\n\n }\n printf(\"%I64d\", i);\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \n\ntypedef long long ll;\nint main()\n{\n ll x, y, m, i, tmp;\n scanf(\"%I64d %I64d %I64d\", &x, &y, &m);\n if (x > y){ tmp = x; x = y; y = tmp; }\n if (y >= m) i = 0;\n else\n {\n if (x > 0 && y > 0)\n i = ceil((m + x)*1.0 / (x + y));\n else if (x<0 && y>0 && abs(x*1.0) < y)\n i = ceil((m - y + 2 * x)*1.0 / (x + y))+1;\n else i = -1;\n\n }\n printf(\"%I64d\", i);\n return 0;\n}"}, {"source_code": "#include\n#include\n \nint main()\n{\n int64_t x,y,m,ans = 0,factor,x_prime;\n scanf(\"%I64d\",&x);\n scanf(\"%I64d\",&y);\n scanf(\"%I64d\",&m);\n if (x <= 0 && y <= 0 && m<= 0)\n {\n if (x >= m || y >= m)\n {\n printf(\"0\\n\");\n }\n else\n printf(\"-1\\n\");\n }\n else if (x <= 0 && y <= 0 && m > 0)\n {\n printf(\"-1\\n\");\n }\n else if (x >= 0 && y >= 0 && m < 0)\n {\n printf(\"0\\n\");\n }\n else if (x >= 0 && y <= 0 && m <= 0)\n {\n printf(\"0\\n\");\n }\n else if (x <= 0 && y >=0 && m <= 0)\n {\n printf(\"0\\n\");\n }\n else if (x >= 0 && y > 0 && m >= 0)\n {\n if (x >= m || y >= m)\n {\n printf(\"0\");\n }\n else\n {\n while (x < m && y < m)\n {\n if(x <= y)\n {\n x = x + y;\n ans++;\n }\n else\n {\n y = x + y;\n ans++;\n }\n }\n printf(\"%I64d\\n\",ans);\n }\n }\n else if (x < 0 && y > 0 && m >= 0)\n {\n x_prime = -x;\n factor = x_prime/y;\n x += factor * y;\n ans += factor;\n if (x >= m || y >= m)\n {\n printf(\"%I64d\",ans);\n }\n else\n {\n while (x < m && y < m)\n {\n if(x <= y)\n {\n x = x + y;\n ans++;\n }\n else\n {\n y = x + y;\n ans++;\n }\n }\n printf(\"%I64d\\n\",ans);\n }\n }\n else if (x > 0 && y < 0 && m >= 0)\n {\n x_prime = -y;\n factor = x_prime/x;\n y += factor * x;\n ans += factor;\n if (x >= m || y >= m)\n {\n printf(\"%I64d\",ans);\n }\n else\n {\n while (x < m && y < m)\n {\n if(x <= y)\n {\n x = x + y;\n ans++;\n }\n else\n {\n y = x + y;\n ans++;\n }\n }\n printf(\"%I64d\\n\",ans);\n }\n }\n return 0;\n}"}, {"source_code": "#include\n#include\n \nint main()\n{\n int64_t x,y,m,ans = 0,factor,x_prime;\n scanf(\"%I64d\",&x);\n scanf(\"%I64d\",&y);\n scanf(\"%I64d\",&m);\n if (x <= 0 && y <= 0 && m<= 0)\n {\n if (x >= m || y >= m)\n {\n printf(\"0\\n\");\n }\n else\n printf(\"-1\\n\");\n }\n else if (x <= 0 && y <= 0 && m > 0)\n {\n printf(\"-1\\n\");\n }\n else if (x >= 0 && y >= 0 && m < 0)\n {\n printf(\"-1\\n\");\n }\n else if (x >= 0 && y <= 0 && m <= 0)\n {\n printf(\"0\\n\");\n }\n else if (x <= 0 && y >=0 && m <= 0)\n {\n printf(\"0\\n\");\n }\n else if (x >= 0 && y > 0 && m >= 0)\n {\n if (x >= m || y >= m)\n {\n printf(\"0\");\n }\n else\n {\n while (x < m && y < m)\n {\n if(x <= y)\n {\n x = x + y;\n ans++;\n }\n else\n {\n y = x + y;\n ans++;\n }\n }\n printf(\"%I64d\\n\",ans);\n }\n }\n else if (x < 0 && y > 0 && m >= 0)\n {\n x_prime = -x;\n factor = x_prime/y;\n x += factor * y;\n ans += factor;\n if (x >= m || y >= m)\n {\n printf(\"%I64d\",ans);\n }\n else\n {\n while (x < m && y < m)\n {\n if(x <= y)\n {\n x = x + y;\n ans++;\n }\n else\n {\n y = x + y;\n ans++;\n }\n }\n printf(\"%I64d\\n\",ans);\n }\n }\n else if (x > 0 && y < 0 && m >= 0)\n {\n x_prime = -y;\n factor = x_prime/x;\n y += factor * x;\n ans += factor;\n if (x >= m || y >= m)\n {\n printf(\"%I64d\",ans);\n }\n else\n {\n while (x < m && y < m)\n {\n if(x <= y)\n {\n x = x + y;\n ans++;\n }\n else\n {\n y = x + y;\n ans++;\n }\n }\n printf(\"%I64d\\n\",ans);\n }\n }\n return 0;\n}"}, {"source_code": "#include\n#include\n \nint main()\n{\n int64_t x,y,m,ans = 0,factor,x_prime;\n scanf(\"%I64d\",&x);\n scanf(\"%I64d\",&y);\n scanf(\"%I64d\",&m);\n if (x <= 0 && y <= 0 && m<= 0)\n {\n if (x >= m || y >= m)\n {\n printf(\"0\\n\");\n }\n else\n printf(\"-1\\n\");\n }\n else if (x <= 0 && y <= 0 && m > 0)\n {\n printf(\"-1\\n\");\n }\n else if (x >= 0 && y >= 0 && m < 0)\n {\n printf(\"-1\\n\");\n }\n else if (x >= 0 && y <= 0 && m <= 0)\n {\n printf(\"0\\n\");\n }\n else if (x <= 0 && y >=0 && m <= 0)\n {\n printf(\"0\\n\");\n }\n else if (x >= 0 && y > 0 && m >= 0)\n {\n if (x >= m || y >= m)\n {\n printf(\"0\");\n }\n else\n {\n while (x < m && y < m)\n {\n if(x <= y)\n {\n x = x + y;\n ans++;\n }\n else\n {\n y = x + y;\n ans++;\n }\n }\n printf(\"%I64d\\n\",ans);\n }\n }\n else if (x < 0 && y > 0 && m >= 0)\n {\n x_prime = -x;\n factor = x_prime/y;\n x += factor * y;\n ans += factor;\n if (x >= m || y >= m)\n {\n printf(\"%I64d\",ans);\n }\n else\n {\n while (x < m && y < m)\n {\n if(x <= y)\n {\n x = x + y;\n ans++;\n }\n else\n {\n y = x + y;\n ans++;\n }\n }\n printf(\"%I64d\\n\",ans);\n }\n }\n return 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n long long x, y, m;\n long long ans = 0;\n long long tmp;\n scanf(\"%I64d%I64d%I64d\", &x, &y, &m);\n if ( x > y )\n {\n tmp = x;\n x = y;\n y = tmp;\n }\n if ( x <= 0 && y <= 0 && y < m )\n {\n printf(\"-1\\n\");\n return 0;\n }\n if ( x < 0 && y > 0 )\n {\n if ( m < 0 )\n {\n ans += -m/y;\n x += -m/y*y;\n }\n else\n {\n ans += -x/y;\n x += -x/y*y; \n }\n }\n while ( y < m )\n {\n ans++;\n tmp = x+y;\n if ( tmp > y )\n {\n x = y;\n y = tmp;\n }\n else\n {\n x = tmp;\n }\n }\n printf(\"%I64d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{ int x,y,m;\n scanf(\"%d%d%d\",&x,&y,&m);\n int count=0;\n int temp;\n while(x=-1)\n { if(x>y){\n temp = y;\n y = x;\n x = temp;\n }\n x = x+y;\n count++;\n if(x==m)\n {\n printf(\"%d\",count);\n return 0;\n }\n }\n printf(\"-1\");\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{ int x,y,m;\n scanf(\"%d%d%d\",&x,&y,&m);\n int count=0;\n while(x=-1)\n {\n x = x+y;\n count++;\n if(x==m)\n {\n printf(\"%d\",count);\n return 0;\n }\n }\n printf(\"-1\");\n return 0;\n}\n"}, {"source_code": "/*\nAuthor:\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%%%%%%%% LALIT KUNDU %%%%%%%% \n%%%%%%%% IIIT HYDERABAD %%%%%%%%\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n*/\n#include\n#include\n#include\n#include\n#include\n#define llu long long int\n#define min(a,b)(a>b?b:a)\n#define max(a,b)(a1000000000000000000)\n break;\n }\n llu x,y,m;\n scanf(\"%lld%lld%lld\",&x,&y,&m);\n if(x<=0 && y<=0)\n {\n if(x=m || y>=m)\n {\n printf(\"0\\n\");\n return 0;\n }\n if(y=m || y>=m)\n {\n printf(\"%lld\\n\",p);\n return 0;\n }\n llu la=x+y,lb=y,pa=p+1;\n if(la>=m || lb>=m)\n {\n printf(\"%lld\\n\",pa);\n return 0;\n }\n for(i=2; ; i++)\n {\n if((x*arr[i]+y*arr[i+1])>=m ||(x*arr[i-1]+y*arr[i])>=m )\n break;\n pa++;\n }\n la=x+y,lb=x;\n llu pb=p+1;\n if(la>=m || lb>=m)\n {\n printf(\"%lld\\n\",pb);\n return 0;\n }\n for(i=2; ; i++)\n {\n if((y*arr[i]+x*arr[i+1])>=m ||(y*arr[i-1]+x*arr[i])>=m )\n break;\n pb++;\n }\n printf(\"%llu\\n\",min(pa,pb)+1);\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint fun_a(long long x, long long y) {\n int result = 0x3;\n if(x <= 0)\n result ^= 0x1;\n if(y <= 0)\n result ^= 0x2;\n return result;\n}\n\nlong long fun_b(long long a, long long b, long long c) {\n return (long long)ceil((c-a)/(long double)b);\n}\n\nlong long min(long long x, long long y) {\n return x && y ? (x < y ? x : y) : (x ? x : y);\n}\n\nint main() {\n long long x, y, m;\n scanf(\"%I64d%I64d%I64d\", &x, &y, &m);\n \n int k = fun_a(x, y);\n if(k)\n printf(\"%I64d\\n\", min(k&0x1 ? fun_b(y, x, m):0, k&0x2 ? fun_b(x, y, m):0));\n else\n printf(\"%d\\n\", -1);\n \n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nvoid swap(long long * x, long long * y) {\n *x ^= *y; *y ^= *x; *x ^= *y;\n}\n\nlong long min(long long x, long long y) {\n return x && y ? (x < y ? x : y) : (x ? x : y);\n}\n\nint fun_a(long long x, long long y) {\n int result = 0x3;\n if(x <= 0)\n result ^= 0x1;\n if(y <= 0)\n result ^= 0x2;\n return result;\n}\n\nlong long fun_b(long long a, long long b, long long c) {\n long long times = 0;\n while(a < c && b < c) {\n a += b; times++;\n if(a > b)\n swap(&a, &b);\n }\n return times;\n// return (long long)ceil((c-a)/(long double)b);\n}\n\nint main() {\n long long x, y, m;\n scanf(\"%I64d%I64d%I64d\", &x, &y, &m);\n \n int k = fun_a(x, y);\n if(k)\n printf(\"%I64d\\n\", min(k&0x1 ? fun_b(y, x, m):0, k&0x2 ? fun_b(x, y, m):0));\n else\n printf(\"%d\\n\", -1);\n \n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nvoid swap(long long * x, long long * y) {\n *x ^= *y; *y ^= *x; *x ^= *y;\n}\n\nlong long min(long long x, long long y) {\n return x && y ? (x < y ? x : y) : (x ? x : y);\n}\n\nint fun_a(long long x, long long y, long long z) {\n int result = 0x3;\n if(x < 0 && y < 0 && z < 0) {\n if(z > x && z > y)\n return 0x0;\n x = -x; y = -y; z = -z;\n }\n if(x + y <= x)\n result ^= 0x2;\n if(x + y <= y)\n result ^= 0x1;\n if(x >= z || y >= z)\n result ^= 0x4;\n return result;\n}\n\nlong long fun_b(long long a, long long b, long long c) {\n long long times = 0;\n while(a < c && b < c) {\n long long t = ceil((b - a)/(long double)b);\n a += b*(t?t:1); times += (t?t:1);\n if(a > b)\n swap(&a, &b);\n }\n return times;\n// return (long long)ceil((c-a)/(long double)b);\n}\n\nint main() {\n long long x, y, m;\n scanf(\"%I64d%I64d%I64d\", &x, &y, &m);\n \n int k = fun_a(x, y, m);\n \n if(k&0x4)\n printf(\"%d\\n\", 0);\n else if(k)\n printf(\"%I64d\\n\", min(k&0x1 ? fun_b(y, x, m):0, k&0x2 ? fun_b(x, y, m):0));\n else\n printf(\"%d\\n\", -1);\n \n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nvoid swap(long long * x, long long * y) {\n *x ^= *y; *y ^= *x; *x ^= *y;\n}\n\nlong long min(long long x, long long y) {\n return x && y ? (x < y ? x : y) : (x ? x : y);\n}\n\nint fun_a(long long x, long long y) {\n int result = 0x3;\n if(x <= 0)\n result ^= 0x1;\n if(y <= 0)\n result ^= 0x2;\n return result;\n}\n\nlong long fun_b(long long a, long long b, long long c) {\n long long times = 0;\n while(a < c && b < c) {\n a += b; times++;\n if(a > b)\n swap(&a, &b);\n }\n return times;\n// return (long long)ceil((c-a)/(long double)b);\n}\n\nint main() {\n long long x, y, m;\n scanf(\"%I64d%I64d%I64d\", &x, &y, &m);\n \n if(m < 0)\n {x = -x; y = -y; m = -m;}\n \n int k = fun_a(x, y);\n if(k)\n printf(\"%I64d\\n\", min(k&0x1 ? fun_b(y, x, m):0, k&0x2 ? fun_b(x, y, m):0));\n else\n printf(\"%d\\n\", -1);\n \n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nvoid swap(long long * x, long long * y) {\n *x ^= *y; *y ^= *x; *x ^= *y;\n}\n\nlong long min(long long x, long long y) {\n return x && y ? (x < y ? x : y) : (x ? x : y);\n}\n\nint fun_a(long long x, long long y, long long z) {\n int result = 0x3;\n if(z < 0)\n {x = -x; y = -y; z = -z;}\n if(x + y <= x)\n result ^= 0x2;\n if(x + y <= y)\n result ^= 0x1;\n if(z < x && z < y)\n result = 0x0;\n return result;\n}\n\nlong long fun_b(long long a, long long b, long long c) {\n long long times = 0;\n while(a < c && b < c) {\n a += b; times++;\n if(a > b)\n swap(&a, &b);\n }\n return times;\n// return (long long)ceil((c-a)/(long double)b);\n}\n\nint main() {\n long long x, y, m;\n scanf(\"%I64d%I64d%I64d\", &x, &y, &m);\n \n int k = fun_a(x, y, m);\n \n if(k)\n printf(\"%I64d\\n\", min(k&0x1 ? fun_b(y, x, m):0, k&0x2 ? fun_b(x, y, m):0));\n else\n printf(\"%d\\n\", -1);\n \n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nvoid swap(long long * x, long long * y) {\n *x ^= *y; *y ^= *x; *x ^= *y;\n}\n\nlong long min(long long x, long long y) {\n return x && y ? (x < y ? x : y) : (x ? x : y);\n}\n\nint fun_a(long long x, long long y, long long z) {\n int result = 0x3;\n if(z < 0)\n {x = -x; y = -y; z = -z;}\n if(x + y <= x)\n result ^= 0x2;\n if(x + y <= y)\n result ^= 0x1;\n if(z < x && z < y)\n result = 0x0;\n else if(x >= z || y >= z)\n result ^= 0x4;\n return result;\n}\n\nlong long fun_b(long long a, long long b, long long c) {\n long long times = 0;\n while(a < c && b < c) {\n long long t = ceil((b - a)/(long double)b);\n a += b*(t?t:1); times += (t?t:1);\n if(a > b)\n swap(&a, &b);\n }\n return times;\n// return (long long)ceil((c-a)/(long double)b);\n}\n\nint main() {\n long long x, y, m;\n scanf(\"%I64d%I64d%I64d\", &x, &y, &m);\n \n int k = fun_a(x, y, m);\n \n if(k&0x4)\n printf(\"%d\\n\", 0);\n else if(k)\n printf(\"%I64d\\n\", min(k&0x1 ? fun_b(y, x, m):0, k&0x2 ? fun_b(x, y, m):0));\n else\n printf(\"%d\\n\", -1);\n \n return 0;\n}\n"}, {"source_code": "/*\nluv_18\n*/\n#include\nint main()\n{\nlong long int x,y,m,c=0,t;\nscanf(\"%lld %lld %lld\",&x,&y,&m);\nif(m==0)\n{\n if(x<0&&y<0)\n printf(\"-1\");\n else\n printf(\"0\");\n}\nelse if(m>0)\n{\n if(x<=0&&y<=0)\n printf(\"-1\");\n else\n { \n if(x>y)\n {\n t=x;\n x=y;\n y=t;\n } \n if(x<0)\n {\n x=-x; \n c=x/y;\n x=x-(c*y);\n } \n while(x\nint main()\n{\nlong long int x,y,m,c=0,t;\nscanf(\"%lld %lld %lld\",&x,&y,&m);\nif(m==0)\n{\n if(x<0&&y<0)\n printf(\"-1\");\n else\n printf(\"0\");\n}\nelse if(m>0)\n{\n if(x<=0&&y<=0)\n printf(\"-1\");\n else\n { \n if(x>y)\n {\n t=x;\n x=y;\n y=t;\n } \n if(x<0)\n {\n x=-x; \n c=x/y;\n x=-x+(c*y);\n } \n while(x\n#include\nint main(){\n \n long long int* x;\n long long int* y;\n long long int* m;\n long long int* suma;\n long long int* mayor;\n unsigned long long int contador=0;\n \n x=malloc(sizeof(long long int));\n y=malloc(sizeof(long long int));\n m=malloc(sizeof(long long int));\n suma=malloc(sizeof(long long int));\n mayor=malloc(sizeof(long long int));\n //cin>>x>>y>>m;\n scanf(\"%I64d %I64d %I64d\",x,y,m);\n \n /*if((*m)<0){\n (*x)=(*x)*-1;\n (*y)=(*y)*-1;\n (*m)=(*m)*-1;\n }*/\n \n if((*x)==(*m)||(*y)==(*m)){\n printf(\"0\");\n return 0; \n }\n \n (*suma)=(*x)+(*y);\n \n if((*x)<(*y)){\n if((*x)>=(*suma)){\n \n printf(\"-1\");\n return 0;\n }\n if((*x)-(*y)<0){\n float d=(float)(*x)/(*y);\n //printf(\"linea 36 %f\\n\",d);\n contador=floor(d)*-1;\n (*x)=(*x)+(*y)*contador;\n //printf(\"linea 39 %I64d\\n\",contador);\n }\n }\n \n else{\n if((*y)>=(*suma)){\n \n printf(\"-1\");\n return 0;\n \n }\n if((*y)-(*x)<0){\n float d=(float)(*y)/(*x);\n //printf(\"linea 52 %f\\n\",d);\n contador=floor(d)*-1;\n (*y)=(*y)+(*x)*contador;\n //printf(\"linea 55 %I64d\\n\",contador);\n }\n \n }\n \n free(suma);\n \n //printf(\"afuera contador: %I64d\\n\",contador);\n for(;(*x)<(*m)&&(*y)<(*m);contador++){ \n \n \n if((*x)>=(*y)){\n \n mayor=x;\n suma=y;\n \n }\n else{\n \n mayor=y;\n suma=x; \n \n }\n \n (*suma)=(*suma)+(*mayor);\n //printf(\"contador dentro del for: %I64d\\n\",contador);\n \n }\n printf(\"%I64d\",contador);\n return 0;\n \n}"}, {"source_code": "#include\n#include\nint main(){\n \n long long int* x;\n long long int* y;\n long long int* m;\n long long int* suma;\n long long int* mayor;\n unsigned long long int contador=0;\n \n x=malloc(sizeof(long long int));\n y=malloc(sizeof(long long int));\n m=malloc(sizeof(long long int));\n suma=malloc(sizeof(long long int));\n mayor=malloc(sizeof(long long int));\n //cin>>x>>y>>m;\n scanf(\"%I64d %I64d %I64d\",x,y,m);\n \n /*if((*m)<0){\n (*x)=(*x)*-1;\n (*y)=(*y)*-1;\n (*m)=(*m)*-1;\n }*/\n \n (*suma)=(*x)+(*y);\n \n if((*x)<(*y)){\n if((*x)>=(*suma)){\n \n printf(\"-1\");\n return 0;\n }\n if((*x)-(*y)<0){\n float d=(float)(*x)/(*y);\n //printf(\"linea 36 %f\\n\",d);\n contador=floor(d)*-1;\n (*x)=(*x)+(*y)*contador;\n //printf(\"linea 39 %I64d\\n\",contador);\n }\n }\n \n else{\n if((*y)>=(*suma)){\n \n printf(\"-1\");\n return 0;\n \n }\n if((*y)-(*x)<0){\n float d=(float)(*y)/(*x);\n //printf(\"linea 52 %f\\n\",d);\n contador=floor(d)*-1;\n (*y)=(*y)+(*x)*contador;\n //printf(\"linea 55 %I64d\\n\",contador);\n }\n \n }\n \n free(suma);\n \n //printf(\"afuera contador: %I64d\\n\",contador);\n for(;(*x)<(*m)&&(*y)<(*m);contador++){ \n \n \n if((*x)>=(*y)){\n \n mayor=x;\n suma=y;\n \n }\n else{\n \n mayor=y;\n suma=x; \n \n }\n \n (*suma)=(*suma)+(*mayor);\n //printf(\"contador dentro del for: %I64d\\n\",contador);\n \n }\n printf(\"%I64d\",contador);\n free(x);\n free(y);\n free(m);\n free(suma);\n free(mayor);\n return 0;\n \n}\n"}, {"source_code": "#include\n#include\nint main(){\n \n long long int* x;\n long long int* y;\n long long int* m;\n long long int* suma;\n long long int* mayor;\n unsigned long long int contador=0;\n \n x=malloc(sizeof(long long int));\n y=malloc(sizeof(long long int));\n m=malloc(sizeof(long long int));\n suma=malloc(sizeof(long long int));\n mayor=malloc(sizeof(long long int));\n //cin>>x>>y>>m;\n scanf(\"%I64d %I64d %I64d\",x,y,m);\n \n if((*m)<0){\n (*x)=(*x)*-1;\n (*y)=(*y)*-1;\n (*m)=(*m)*-1;\n }\n \n (*suma)=(*x)+(*y);\n \n if((*x)<(*y)){\n if((*x)>=(*suma)){\n \n printf(\"-1\");\n return 0;\n }\n if((*x)-(*y)<0){\n float d=(float)(*x)/(*y);\n //printf(\"linea 36 %f\\n\",d);\n contador=floor(d)*-1;\n (*x)=(*x)+(*y)*contador;\n //printf(\"linea 39 %I64d\\n\",contador);\n }\n }\n \n else{\n if((*y)>=(*suma)){\n \n printf(\"-1\");\n return 0;\n \n }\n if((*y)-(*x)<0){\n float d=(float)(*y)/(*x);\n //printf(\"linea 52 %f\\n\",d);\n contador=floor(d)*-1;\n (*y)=(*y)+(*x)*contador;\n //printf(\"linea 55 %I64d\\n\",contador);\n }\n \n }\n \n free(suma);\n \n //printf(\"afuera contador: %I64d\\n\",contador);\n for(;(*x)<(*m)&&(*y)<(*m);contador++){ \n \n \n if((*x)>=(*y)){\n \n mayor=x;\n suma=y;\n \n }\n else{\n \n mayor=y;\n suma=x; \n \n }\n \n (*suma)=(*suma)+(*mayor);\n //printf(\"contador dentro del for: %I64d\\n\",contador);\n \n }\n printf(\"%I64d\",contador);\n free(x);\n free(y);\n free(m);\n free(suma);\n free(mayor);\n return 0;\n \n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n long long int x,y,m,minimum = 0;\n scanf(\"%I64d%I64d%I64d\",&x,&y,&m);\n while(x < m && y < m)\n {\n if(x<=0 && y<=0)\n {\n minimum = -1;\n break;\n }\n if(x < 0 && y > 0)\n {\n minimum += (int)(ceil(-x/y));\n x += minimum*y;\n }\n else if(x > 0 && y < 0)\n {\n minimum += (int)(ceil(-y/x));\n y += minimum*x;\n }\n if(x\n#include \nint main()\n{\n long long int x,y,m,minimum = 0;\n scanf(\"%I64d%I64d%64d\",&x,&y,&m);\n while(x < m && y < m)\n {\n if(x<=0 && y<=0)\n {\n minimum = -1;\n break;\n }\n if(x < 0 && y > 0)\n {\n minimum += (int)(ceil(-x/y));\n x += minimum*y;\n }\n else if(x > 0 && y < 0)\n {\n minimum += (int)(ceil(-y/x));\n y += minimum*x;\n }\n if(x\ntypedef long long ll;\nint main() {\n int i;\n ll x,y,m,u,v;\n scanf(\"%I64d %I64d %I64d\",&x,&y,&m);\n if(x>=m || y>=m) { puts(\"0\"); return 0; }\n for(i=1;i<100000000;i++) {\n u=x; v=y;\n if(u=m || y>=m) break;\n }\n if(x\ntypedef long long ll;\nint main() {\n int i;\n ll x,y,m,u,v;\n scanf(\"%I64d %I64d %I64d\",&x,&y,&m);\n if(x>=m || y>=m) { puts(\"0\"); return 0; }\n for(i=0;i<100000000;i++) {\n u=x; v=y;\n if(u=m || y>=m) break;\n }\n if(x\ntypedef long long ll;\nint main() {\n ll ch=0;\n ll x,y,m,t,d;\n scanf(\"%I64d %I64d %I64d\",&x,&y,&m);\n if(x>=m || y>=m) { puts(\"0\"); return 0; }\n if(x0 && y<0) {\n d=(-y)/x;\n y+=x*d;\n ch=d;\n }\n for(;;ch++) {\n if(x=m || y>=m) break;\n if(x<=0 && y<=0) break;\n }\n if(x\ntypedef long long ll;\nint main() {\n int i;\n ll x,y,m,u,v;\n scanf(\"%I64d %I64d %I64d\",&x,&y,&m);\n if(x>=m && y>=m) { puts(\"0\"); return 0; }\n for(i=0;i<10000000;i++) {\n u=x; v=y;\n if(u=m && y>=m) break;\n }\n if(x\n#include\n#include\n#define max(a,b) ((a>b)?a:b)\n#define min(a,b) ((a>b)?b:a)\n#define LL long long\n#define opfile_in(s) freopen(s,\"r\",stdin)\nLL x,y,m;\nvoid init();\nvoid doit();\nint main()\n{\n init();\n doit();\n return 0;\n}\nvoid init()\n{\n scanf(\"%I64d%I64d%I64d\",&x,&y,&m);\n}\nvoid doit()\n{\n LL tmp,ans=0;\n if(x<=0&&y<=0)\n {\n printf(\"%d\\n\",(x>m||y>m)?0:-1);return;\n }\n while(x\nint main()\n{\nlong long x,y,m,moves=0;\nscanf(\"%I64d%I64d%I64d\",&x,&y,&m);\n\nif((x+y < 0) && !(x>=m || y>=m)) moves=-1;\nif(!(x>=m || y>=m) && moves != -1)\n{ \n if(x\n\nint main()\n{\n long long x, y, m, sum = 0;\n \n scanf(\"%I64d %I64d %I64d\", &x, &y, &m);\n \n if (x >= m || y >= m) {\n puts(\"0\");\n \n return 0;\n }\n \n if (x <= 0 && y <= 0) {\n puts(\"-1\");\n \n return 0;\n }\n \n if (x > y) {\n long long tmp = x;\n x = y;\n y = tmp;\n }\n \n if (x < 0) {\n sum += -x / y;\n \n x += y * sum;\n }\n \n while (y < m) {\n long long z = x + y;\n \n x = y;\n y = z;\n sum++;\n }\n \n printf(\"%I64d\\n\", sum);\n \n return 0;\n}\n"}, {"source_code": "#include\nmain()\n{\n long long x,y,m,d=0,c=0;\n scanf(\"%I64d %I64d %I64d\",&x,&y,&m);\n if(x>=m || y>=m)\n c=0;\n else if(x>0 || y>0)\n {\n if(x<0)\n {\n c=(-1)*(x/y);\n x=x+c*y;\n }\n else if(y<0)\n {\n c=(-1)*(y/x);\n y=y+c*x;\n }\n while(x\nmain()\n{\n long long a,b,m,d=0,c=0;\n scanf(\"%I64d %I64d %I64d\",&a,&b,&m);\n while(a<=m && b<=m)\n {\n if(a==m || b==m)\n {\n printf(\"%d\",c);\n d=1;\n break;\n }\n if(a<0 || b<0)\n {\n printf(\"-1\");\n d=10;\n break;\n }\n a=a+b;\n c++;\n\n }\n if(d==0)\n {\n printf(\"0\");\n }\n}\n"}, {"source_code": "#include \n\nlong long x, y , n, m,q,s, d ;\nint main()\n{\n scanf(\"%I64d %I64d %I64d\" , &x, &y, &m) ;\n\n if( x > y)\n {\n n = x ;\n q = y ;\n }\n else\n {\n n = y ;\n q = x ;\n }\n\n if( n <= 0)\n {\n printf(\"-1\" ) ;\n return 0;\n }\n\n d = m - q ;\n\n if( d <= 0)\n {\n printf(\"0\") ;\n\n }\n else{\n s = d/ n ;\n if( d%n == 0)\n {\n printf(\"%I64d\", s) ;\n }\n else\n {\n printf(\"%I64d\", s+1) ;\n }\n }\n\n\n\n return 0;\n }\n"}, {"source_code": "#include \n\nlong long x, y , n, m,q,s, d, c ,t ;\nint main()\n{\n scanf(\"%I64d %I64d %I64d\" , &x, &y, &m) ;\n\n if( x > y)\n {\n n = x ;\n q = y ;\n }\n else\n {\n n = y ;\n q = x ;\n }\n\n if( n <= 0)\n {\n printf(\"-1\" ) ;\n return 0;\n }\n\n// d = m - q ;\n\n /* if( d <= 0)\n {\n printf(\"0\") ;\n\n }\n else{\n s = d/ n ;\n if( d%n == 0)\n {\n printf(\"%I64d\", s) ;\n }\n else\n {\n printf(\"%I64d\", s+1) ;\n }\n }*/\n\n while( m > q && m > n)\n {\n t = n ;\n n = n + q ;\n q = n ;\n c++ ;\n }\n printf(\"%I64d\", c) ;\n\n\n return 0;\n }\n"}, {"source_code": "#include \n\nlong long x, y , n, m,q,s, d, c ,t ;\nint main()\n{\n scanf(\"%I64d %I64d %I64d\" , &x, &y, &m) ;\n\n if( x > y)\n {\n n = x ;\n q = y ;\n }\n else\n {\n n = y ;\n q = x ;\n }\n\n if( n <= 0)\n {\n printf(\"-1\" ) ;\n return 0;\n }\n\n// d = m - q ;\n\n /* if( d <= 0)\n {\n printf(\"0\") ;\n\n }\n else{\n s = d/ n ;\n if( d%n == 0)\n {\n printf(\"%I64d\", s) ;\n }\n else\n {\n printf(\"%I64d\", s+1) ;\n }\n }*/\n\n while( m > q && m > n)\n {\n t = n ;\n n = n + q ;\n q = t ;\n c++ ;\n // printf(\"%I64d %I64d %I64d\\n\", c, q, n) ;\n\n }\n printf(\"%I64d\", c) ;\n\n\n return 0;\n }\n"}, {"source_code": "#include \n\nlong long x, y , n, m,q,s, d, c ,t ;\nint main()\n{\n scanf(\"%I64d %I64d %I64d\" , &x, &y, &m) ;\n\n if( x >= m || y >= m)\n{\n printf(\"0\") ;\n return 0;\n}\n if( x > y)\n {\n n = x ;\n q = y ;\n }\n else\n {\n n = y ;\n q = x ;\n }\n\n if( n <= 0)\n {\n printf(\"-1\" ) ;\n return 0;\n }\n\n// d = m - q ;\n\n /* if( d <= 0)\n {\n printf(\"0\") ;\n\n }\n else{\n s = d/ n ;\n if( d%n == 0)\n {\n printf(\"%I64d\", s) ;\n }\n else\n {\n printf(\"%I64d\", s+1) ;\n }\n }*/\n\n while( m > q && m > n)\n {\n t = n ;\n n = n + q ;\n q = t ;\n c++ ;\n // printf(\"%I64d %I64d %I64d\\n\", c, q, n) ;\n\n }\n printf(\"%I64d\", c) ;\n\n\n return 0;\n }\n"}, {"source_code": "#include \n\nvoid swap(long long *a,long long *b){\n long long tmp;\n tmp=*a;\n *a=*b;\n *b=tmp;\n }\n \nint main(){\n long long x,y,m,round=0,ans=0,tmp,tmpround;\n scanf (\"%I64d%I64d%I64d\",&x,&y,&m);\n if (x<=0&&y<=0&&xy) swap(&x,&y);\n if (x==0&&y==0){\n printf (\"-1\");\n return 0;\n }\n /*if (x>=m||y>=m) {\n printf (\"0\");\n return 0;\n }*/\n while (xy) swap(&x,&y);\n if (x<0) tmp=x*-1;\n if (x<0&&tmp/y>0){\n tmpround=tmp/y;\n x+=tmpround*y;\n ans+=tmpround;\n }else{\n x=y+x;\n ans++;\n }\n }\n printf (\"%I64d\",ans);\n scanf (\" \");\n return 0;\n }\n"}, {"source_code": "#include \n\nvoid swap(long long *a,long long *b){\n long long tmp;\n tmp=*a;\n *a=*b;\n *b=tmp;\n }\n \nint main(){\n long long x,y,m,round=0,ans=0;\n scanf (\"%I64d%I64d%I64d\",&x,&y,&m);\n if (x<=0&&y<=0&&xy) swap(&x,&y);\n if (x==0&&y==0){\n printf (\"-1\");\n return 0;\n }\n while (xy) swap(&x,&y);\n x=y+x;\n ans++;\n }\n printf (\"%I64d\",ans);\n return 0;\n }\n"}, {"source_code": "#include\n#include\nint main() \n{\n\tlong long int x,y,m,cnt=0;\n\tscanf(\"%lld\",&x);\n\tscanf(\"%lld\",&y);\n\tscanf(\"%lld\",&m);\n\t\n\tif(x>=m || y>=m)\n\t{\n\t\tprintf(\"%d\\n\",0);\n\t\treturn 0;\n\t}\n\tif(x<=0 && y<=0)\n\t{\n\t\tprintf(\"%d\\n\",-1);\n\t\treturn 0;\n\t}\n\tif(x>y)\n\t{\n\t\tlong long int tmp = x;\n\t\tx=y;\n\t\ty=tmp;\n\t}\n\tif(x<0)\n\t{\n\t\tcnt += -x/y;\n\t\tx+=y * cnt;\n\t}\n\twhile(x\n#include\nint main() \n{\n\tlong long int x,y,m,cnt=0;\n\tscanf(\"%lld\",&x);\n\tscanf(\"%lld\",&y);\n\tscanf(\"%lld\",&m);\n\tif(x>=m || y>=m)\n\t{\n\t\tprintf(\"%d\\n\",0);\n\t\treturn 0;\n\t}\n\tif(x<=0 && y<=0)\n\t{\n\t\tprintf(\"%d\\n\",-1);\n\t\treturn 0;\n\t}\n\tif(x>y)\n\t{\n\t\tlong long int tmp = x;\n\t\tx=y;\n\t\ty=tmp;\n\t}\n\tif(x<0)\n\t{\n\t\tcnt += -x/y;\n\t\tx+=y * cnt;\n\t}\n\twhile(x\n#include\nint main() \n{\n\tlong int x,y,m;\n\tscanf(\"%ld\",&x);\n\tscanf(\"%ld\",&y);\n\tscanf(\"%ld\",&m);\n\tint count=0;\n\n\tif((x==0 && y<=0) || (y==0 && x<=0) || (x<=0 && y<=0)|| (x==0 && y==0))\n\t{\n\t\tprintf(\"%d\\n\",-1);\n\n\t}\n\telse\n\t{\n\t\tif(x>y)\n\t\t{\n\t\t\twhile(y\n#include\nint main() \n{\n\tlong long int x,y,m;\n\tscanf(\"%lld\",&x);\n\tscanf(\"%lld\",&y);\n\tscanf(\"%lld\",&m);\n\tint count=0;\n\n\tif((x==0 && y<=0) || (y==0 && x<=0) || (x<=0 && y<=0)|| (x==0 && y==0))\n\t{\n\t\tprintf(\"%d\\n\",-1);\n\n\t}\n\telse if (x>=m || y>=m)\n\t{\n\t\tprintf(\"%d\\n\",0 );\n\t}\n\telse{\n\n\t\twhile(yy)\n\t\t\t{\n\t\t\t\ty+=x;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tx+=y;\n\t\t\t}\n\t\t\tcount++;\n\t\t}\n\tprintf(\"%d\\n\",count);\n\t}return 0;\n}\n"}, {"source_code": "#include\n#include\nint main() \n{\n\tlong long int x,y,m;\n\tscanf(\"%lld\",&x);\n\tscanf(\"%lld\",&y);\n\tscanf(\"%lld\",&m);\n\tint count=0;\n\n\tif(x>0 || y>0)\n\t{\n\t\tif(x>=m || y>=m)\n\t\t\tprintf(\"%d\\n\",0 );\n\n\t\telse\n\t\t{\n\t\t\twhile(yy)\n\t\t\t\t{\n\t\t\t\t\ty+=x;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tx+=y;\n\t\t\t\t}\n\t\t\t\tcount++;\n\t\t\t}printf(\"%d\\n\",count );\n\t\t}\n\t}\n\telse{\n\tprintf(\"%d\\n\",-1);\n\t}return 0;\n}\n"}, {"source_code": "#include\n#include\nint main() \n{\n\tlong long int x,y,m;\n\tscanf(\"%lld\",&x);\n\tscanf(\"%lld\",&y);\n\tscanf(\"%lld\",&m);\n\tint count=0;\n\n\tif((x==0 && y<=0) || (y==0 && x<=0) || (x<=0 && y<=0)|| (x==0 && y==0))\n\t{\n\t\tprintf(\"%d\\n\",-1);\n\n\t}\n\telse\n\t{\n\t\tif(x>y)\n\t\t{\n\t\t\twhile(y\n#include\nint main() \n{\n\tlong long int x,y,m;\n\tscanf(\"%lld\",&x);\n\tscanf(\"%lld\",&y);\n\tscanf(\"%lld\",&m);\n\tint count=0;\n\n\tif((x==0 && y<=0) || (y==0 && x<=0) || (x<=0 && y<=0)|| (x==0 && y==0))\n\t{\n\t\tprintf(\"%d\\n\",-1);\n\n\t}\n\telse\n\t{\n\t\twhile(yy)\n\t\t\t{\n\t\t\t\ty+=x;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tx+=y;\n\t\t\t}count++;\n\t\t}\n\tprintf(\"%d\\n\",count);\n}return 0;\n}\n"}, {"source_code": "#include\n#include\nint main() \n{\n\tlong long int x,y,m;\n\tscanf(\"%lld\",&x);\n\tscanf(\"%lld\",&y);\n\tscanf(\"%lld\",&m);\n\tint count=0;\n\n\tif((x==0 && y<=0) || (y==0 && x<=0) || (x<=0 && y<=0)|| (x==0 && y==0))\n\t{\n\t\tprintf(\"%d\\n\",-1);\n\n\t}\n\telse if (x>=m || y>=m)\n\t{\n\t\tprintf(\"%d\\n\",0 );\n\t}\n\telse{\n\n\t\twhile(yy)\n\t\t\t{\n\t\t\t\ty+=x;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tx+=y;\n\t\t\t}\n\t\t\tcount++;\n\t\t}\n\tprintf(\"%d\\n\",count);\n\t}return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\nint main(int argc, const char *argv[])\n{\n long long x, y, m;\n assert(scanf(\"%lld %lld %lld\", &x, &y, &m) == 3);\n\n if (x <= 0 && y <= 0) {\n if (x < m && y < m) {\n printf(\"-1\\n\");\n return 0;\n } \n else {\n printf(\"0\\n\");\n return 0;\n }\n }\n\n long long s, t, m2;\n long long count = 0;\n\n if (m > 0) { m2 = 0; }\n else { m2 = m; }\n\n if (x <= 0) {\n t = (m2 - x) / y;\n count += t;\n x += y*t;\n }\n\n if (y <= 0) {\n t = (m2 - y) / x;\n count += t;\n y += x*t;\n }\n\n printf(\"%lld, %lld, %lld\\n\", x, y, m);\n\n while (x < m && y < m) {\n s = x + y;\n if (x < y) { x = s; }\n else { y = s; }\n count++;\n }\n\n printf(\"%lld\\n\", count);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\nint main(int argc, const char *argv[])\n{\n long long x, y, m;\n assert(scanf(\"%lld %lld %lld\", &x, &y, &m) == 3);\n\n if (x <= 0 && y <= 0) {\n if (x < m && y < m) {\n printf(\"-1\\n\");\n return 0;\n } \n else {\n printf(\"0\\n\");\n return 0;\n }\n }\n\n long long s, t, m2;\n long long count = 0;\n\n if (m > 0) { m2 = 0; }\n else { m2 = m; }\n\n if (x <= 0) {\n t = (m2 - x) / y;\n count += t;\n x += y*t;\n }\n\n if (y <= 0) {\n t = (m2 - y) / x;\n count += t;\n y += x*t;\n }\n\n while (x < m && y < m) {\n s = x + y;\n if (x < y) { x = s; }\n else { y = s; }\n count++;\n }\n\n printf(\"%lld\\n\", count);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tlong long int a,b,x,p,q,c,y,temp;\n\tscanf(\"%I64d %I64d %I64d\",&a,&b,&x);\n\tif(a>b)\n\t{\n\t\ttemp=b;\n\t\tb=a;\n\t\ta=temp;\n\t}\n\tif(b>=x)\n\tprintf(\"0\");\n\telse\n\t{\n\t\tif(a+b<=0)\n\t\tprintf(\"-1\");\n\t\telse\n\t\t{\n\t\t\tc=0;\n\t\t\tif(a<0)\n\t\t\t{\n\t\t\t\ta=a+b;\n\t\t\t\tc++;\n\t\t\t\tif(a>b)\n\t\t\t\t{\t\t\n\t\t\t\t\ttemp=b;\n\t\t\t\t\tb=a;\n\t\t\t\t\ta=temp;\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile(b\nint main()\n{\n\tlong long int a,b,x,p,q,c,y,temp;\n\tscanf(\"%I64d %I64d %I64d\",&a,&b,&x);\n\tif(a>b)\n\t{\n\t\ttemp=b;\n\t\tb=a;\n\t\ta=temp;\n\t}\n\tif(b>=x)\n\tprintf(\"0\");\n\telse\n\t{\n\t\tif(a<=0 && b<=0)\n\t\tprintf(\"-1\");\n\t\telse\n\t\t{\n\t\t\tc=0;\n\t\t\tif(a<0)\n\t\t\t{\n\t\t\t\ta=a+b;\n\t\t\t\tc++;\n\t\t\t\tif(a>b)\n\t\t\t\t{\t\t\n\t\t\t\t\ttemp=b;\n\t\t\t\t\tb=a;\n\t\t\t\t\ta=temp;\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile(b\n\ntypedef long long LL_t;\n\nint main()\n{\n\tLL_t x,y,m,temp,Cnt;\n\tscanf(\"%I64d %I64d %I64d\",&x,&y,&m);\n\tif(x=m)\n\t{\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\tif(y<0)\n\t{\n\t\ty=-y;\n\t\tif(y%x!=0)\n\t\t{\n\t\t\tCnt=y/x+1;\n\t\t\ty=y%x;\n\t\t\tif(x=m)\n\t\t\t{\n\t\t\t\tprintf(\"%I64d\\n\",Cnt);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tCnt=y/x;\n\t\t\ty=0;\n\t\t}\n\t}\n\telse\n\t{\n\t\tCnt=1;\n\t}\n\twhile(1)\n\t{\n\t\ttemp=x+y;\n\t\tif(temp>=m)\n\t\t{\n\t\t\tprintf(\"%I64d\\n\",Cnt);\n\t\t\treturn 0;\n\t\t}\n\t\ty=temp;\n\t\tif(x\n\ntypedef long long LL_t;\n\nint main()\n{\n\tLL_t x,y,m,temp,Cnt;\n\tscanf(\"%I64d %I64d %I64d\",&x,&y,&m);\n\tif(x=m)\n\t{\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\tif(y<0)\n\t{\n\t\ty=-y;\n\t\tif(y%x!=0)\n\t\t{\n\t\t\tCnt=y/x+1;\n\t\t\ty=y%x;\n\t\t\tif(x=m)\n\t\t{\n\t\t\tprintf(\"%I64d\\n\",Cnt);\n\t\t\treturn 0;\n\t\t}\n\t\ty=temp;\n\t\tif(x\n\ntypedef long long LL_t;\n\nint main()\n{\n\tLL_t x,y,m,temp,Cnt;\n\tscanf(\"%I64d %I64d %I64d\",&x,&y,&m);\n\tif(x=m)\n\t{\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\tif(x<=0)\n\t{\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\tif(y<0)\n\t{\n\t\ty=-y;\n\t\tif(y%x!=0)\n\t\t{\n\t\t\tCnt=y/x+1;\n\t\t\ty=(LL_t)y%x;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tCnt=y/x;\n\t\t\ty=0;\n\t\t}\n\t}\n\telse\n\t{\n\t\tCnt=0;\n\t}\n\twhile(1)\n\t{\n\t\t++Cnt;\n\t\ttemp=x+y;\n\t\ty=temp;\n\t\tif(temp>=m)\n\t\t{\n\t\t\tprintf(\"%I64d\\n\",Cnt);\n\t\t\treturn 0;\n\t\t}\n\t\ttemp=x;\n\t\tx=y;\n\t\ty=temp;\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tlong long int a, b, m;\n\tint count;\n\tscanf(\"%lld\", &a);\n\tscanf(\"%lld\", &b);\n\tscanf(\"%lld\", &m);\n\n\tif (a>=m || b>=m)\n\t{\n\t\tcount = 0;\n\t\tprintf(\"%d\\n\", count);\n\t\treturn 0;\n\t}\n\n\tif((a<0 && b<0) || (a==0 && b<=0) || (b==0 && a<=0))\n\t{\n\t\tcount = -1;\n\t\tprintf(\"%d\\n\", count);\n\t\treturn 0;\n\t}\n\tcount = 0;\n\twhile(a=b)\n\t\t{\n\t\t\tb = a+b;\n\t\t\tcount++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ta = a+b;\n\t\t\tcount++;\n\t\t}\n\t}\n\tprintf(\"%d\\n\", count);\n\treturn 0;\n}"}, {"source_code": "#include\n\nlong long int perfect(long long int n,long long int m,long long int b);\nint main()\n{\n long long int N,M,a,R;\n scanf(\"%I64d%I64d%I64d\",&N,&M,&a);\n if((N<=0&&M<=0&&a>0)||(N>=0&&M>=0&&a<0))\n printf(\"-1\\n\");\n else\n {R=perfect(N,M,a);\n printf(\"%I64d\\n\",R);\n }\n return 0;\n\n}\nlong long int d=0;\nlong long int perfect(long long int n,long long int m,long long int b)\n{\n long long int temp;\n if(n=b||m>=b){d=0;return temp;}\n else\n return perfect(n,m,b);\n\n}\n\n"}, {"source_code": "#include\n#define max(a,b) ((a)>(b)?(a):(b))\nint main(void)\n{\n long long x,y,k,f1,f2,count;\n scanf(\"%I64d%I64d%I64d\",&x,&y,&k);\n f2=max(x,y);\n f1=x+y-f2;\n if(f1=k||f1>=k)\n {\n printf(\"%I64d\\n\",count);\n break;\n }\n f1=f1+f2;\n count++;\n if(f2>=k||f1>=k)\n {\n printf(\"%I64d\\n\",count);\n break;\n }\n f2=f1+f2;\n count++;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\n#define max(a,b) ((a)>(b)?(a):(b))\nint main(void)\n{\n long long x,y,k,f1,f2,count;\n scanf(\"%I64d%I64d%I64d\",&x,&y,&k);\n f2=max(x,y);\n f1=x+y-f2;\n if(f1<0&&f2==0)\n {\n if(k>0)\n printf(\"-1\\n\");\n else if(k<=0)\n printf(\"0\\n\");\n }\n else\n {\n\n for(count=0;;)\n {\n if(f2>=k||f1>=k)\n {\n printf(\"%I64d\\n\",count);\n break;\n }\n f1=f1+f2;\n count++;\n if(f2>=k||f1>=k)\n {\n printf(\"%I64d\\n\",count);\n break;\n }\n f2=f1+f2;\n count++;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\n#define max(a,b) ((a)>(b)?(a):(b))\nint main(void)\n{\n long long i,j,k,sum=0,m,n;\n scanf(\"%I64d%I64d%I64d\",&i,&j,&k);\n m=max(i,j);\n n=i+j-m;\n if(m>=k||n>=k)\n printf(\"0\\n\");\n else if(m<=0)\n printf(\"-1\\n\");\n else {\n if(n<0)\n {\n sum=(-n)/m+(-n)%m;\n n+=sum*m;\n }\n while(m\n#define max(a,b) ((a)>(b)?(a):(b))\n#define min(a,b) ((a)<(b)?(a):(b))\nint main(void)\n{\n long long x,y,k,f1,f2,count;\n scanf(\"%I64d%I64d%I64d\",&x,&y,&k);\n f2=max(x,y);\n f1=x+y-f2;\n if(f1=k)\n {\n printf(\"%I64d\\n\",count);\n break;\n }\n f1=max(f1+f2,f1);\n count++;\n if(f1>=k)\n {\n printf(\"%I64d\\n\",count);\n break;\n }\n f2=max(f1+f2,f2);\n count++;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\n#define max(a,b) ((a)>(b)?(a):(b))\nint main(void)\n{\n long long x,y,k,f1,f2,count;\n scanf(\"%I64d%I64d%I64d\",&x,&y,&k);\n f2=max(x,y);\n f1=x+y-f2;\n if(f1=k||f1>=k)\n {\n printf(\"%I64d\\n\",count);\n break;\n }\n f1=f1+f2;\n count++;\n if(f2>=k||f1>=k)\n {\n printf(\"%I64d\\n\",count);\n break;\n }\n f2=f1+f2;\n count++;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\nmain()\n{\nlong long x,b,y,m,cnt=0,i,j;\n scanf(\"%I64d\",&x);\n scanf(\"%I64d\",&y);\n scanf(\"%I64d\",&m);\n if(x<=0&&y<=0&&m>x&&m>y)\n {\n printf(\"-1\");\n exit(0);\n }\n if(xy)\n y=y+x;\n else\n x=x+y;\n cnt++;\n }\n\n printf(\"%I64d\",cnt);\n return 0;\n }\n"}, {"source_code": "#include\nmain()\n{\nlong long x,b,y,m,cnt=0,i,j;\n scanf(\"%I64d\",&x);\n scanf(\"%I64d\",&y);\n scanf(\"%I64d\",&m);\n if(x<=0&&y<=0&&m>x&&m>y)\n {\n printf(\"-1\");\n exit(0);\n }\n if(x<0&&y>0&&(-1*x)>y)\n {\n b=(-1*x)/y;\n cnt=b;\n x=x+(b*y);\n }\n if(y<0&&x>0&&(-1*y)>x)\n {\n b=(-1*y)/x;\n cnt=b;\n y+=b*x;\n }\n while(xy)\n y=y+x;\n else\n x=x+y;\n cnt++;\n }\n\n printf(\"%I64d\",cnt);\n return 0;\n }\n"}, {"source_code": "#include\nmain()\n{\nlong long x,b,y,m,cnt=0,i,j;\n scanf(\"%I64d\",&x);\n scanf(\"%I64d\",&y);\n scanf(\"%I64d\",&m);\n if(x<=0&&y<=0&&m>x&&m>y)\n {\n printf(\"-1\");\n exit(0);\n }\n if(x<0&&(-1*x)>y)\n {\n b=(-1*x)/y;\n cnt=b;\n x=x+(b*y);\n }\n if(y<0&&(-1*y)>x)\n {\n b=(-1*y)/x;\n cnt=b;\n y+=b*x;\n }\n while(xy)\n y=y+x;\n else\n x=x+y;\n cnt++;\n }\n\n printf(\"%I64d\",cnt);\n return 0;\n }\n"}, {"source_code": "#include \n#include \n\nint main(void) {\n long long x, y, m, cnt = 0;\n scanf (\"%I64d %I64d %I64d\", &x, &y, &m);\n if (x + y <= x && x + y <= y) {\n printf(\"%d\", -1);\n exit(0);\n }\n while (x < m && y < m) {\n cnt++;\n if (x > y)\n y = x + y;\n else\n x = x + y;\n }\n printf(\"%I64d\", cnt);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main(void) {\n long long x, y, m, cnt = 0;\n scanf (\"%I64d %I64d %I64d\", &x, &y, &m);\n if (x + y < 0) {\n printf(\"%d\", -1);\n exit(0);\n }\n while (x < m && y < m) {\n cnt++;\n if (x > y)\n y = x + y;\n else\n x = x + y;\n }\n printf(\"%I64d\", cnt);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main(void) {\n long long x, y, m, cnt = 0;\n scanf (\"%I64d %I64d %I64d\", &x, &y, &m);\n if (x + y < 0) {\n printf(\"%d\", -1);\n exit(0);\n }\n while (x <= m && y <= m) {\n cnt++;\n if (x > y)\n y = x + y;\n else\n x = x + y;\n }\n printf(\"%I64d\", cnt);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n long long int x,y,k,s,a,b;\n int i,j,ans;\n while(~scanf(\"%I64d%I64d%I64d\",&x,&y,&k))\n {\n if(x<=0&&y<=0)printf(\"-1\\n\");\n else if((x==0&&y<0)||(y==0&&x<0))printf(\"-1\\n\");\n else\n {\n if(x>=k||y>=k)printf(\"0\\n\");\n else\n {\n a=x>=y?y:x;\n b=x>=y?x:y;\n for(i=0;i<100000;i++)\n {\n s=a+b;\n a=b;\n b=s;\n if(s>=k)break;\n }\n printf(\"%d\\n\",i+1);\n }\n }\n }\n return 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n long long int x,y,k,s,a,n,b;\n int i,j,ans;\n while(~scanf(\"%I64d%I64d%I64d\",&x,&y,&k))\n {\n if(x<=0&&y<=0)printf(\"-1\\n\");\n else if((x==0&&y<0)||(y==0&&x<0))printf(\"-1\\n\");\n else\n {\n if(x>=k||y>=k)printf(\"0\\n\");\n else\n {\n if(x<0)\n {\n n=(0-x)/y;\n x+=n*y;\n if(x<0)\n {\n x+=y,n+=1;\n }\n }\n if(y<0)\n {\n n=(0-y)/x;\n y+=n*y;\n if(y<0)\n y+=x,n+=1;\n }\n a=x>=y?y:x;\n b=x>=y?x:y;\n for(i=0;i<100000;i++)\n {\n s=a+b;\n a=b;\n b=s;\n if(s>=k)break;\n }\n printf(\"%d\\n\",i+1+n);\n }\n }\n }\n return 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n long long int x,y,k,s,a,n,b;\n int i,j,ans;\n while(~scanf(\"%I64d%I64d%I64d\",&x,&y,&k))\n {\n if(x<=0&&y<=0)printf(\"-1\\n\");\n else if((x==0&&y<0)||(y==0&&x<0))printf(\"-1\\n\");\n else\n {\n if(x>=k||y>=k)printf(\"0\\n\");\n else\n {\n n=0;\n if(x<0)\n {\n n=(0-x)/y;\n x+=n*y;\n if(x<0)\n {\n x+=y,n+=1;\n }\n }\n if(y<0)\n {\n n=(0-y)/x;\n y+=n*y;\n if(y<0)\n y+=x,n+=1;\n }\n a=x>=y?y:x;\n b=x>=y?x:y;\n for(i=0;i<100000;i++)\n {\n s=a+b;\n a=b;\n b=s;\n if(s>=k)break;\n }\n printf(\"%d\\n\",i+1+n);\n }\n }\n }\n return 0;\n}"}, {"source_code": "# include \n\nlong long fun( long long int x, long long int y, long long int m)\n{\n long long int s,temp;\n for (s = 0 ; y < m ; s++)\n temp = x+y, x = y, y = temp ;\n return s ;\n}\n\nint main ()\n{\n long long x, y, m,xx,temp ;\n while (~scanf (\"%I64d%I64d%I64d\", &x, &y, &m))\n {\n if (x > y)\n {\n temp=y;\n y=x;\n x=temp;\n }\n if(y>=m)printf(\"0\\n\");\n else if(y<=0)printf(\"-1\\n\");\n else\n {\n if(x>=0)\n printf(\"%I64d\\n\",fun(x,y,m));\n else\n {\n xx=-x;\n if(xx<=y)printf(\"%I64d\\n\",fun(x+y,y,m)+1);\n else\n printf(\"I64d\\n\",fun(-1LL*(xx%y),y,m)+xx/y);\n }\n }\n }\n return 0 ;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n long long int x,y,k,s,a,n,b,i,j,ans;\n while(~scanf(\"%I64d%I64d%I64d\",&x,&y,&k))\n {\n if(x<=0&&y<=0)printf(\"-1\\n\");\n else if((x==0&&y<0)||(y==0&&x<0))printf(\"-1\\n\");\n else\n {\n if(x>=k||y>=k)printf(\"0\\n\");\n else\n {\n n=0;\n if(x<0)\n {\n n=(0-x)/y;\n x+=n*y;\n if(x<0)\n {\n x+=y,n+=1;\n }\n }\n if(y<0)\n {\n n=(0-y)/x;\n y+=n*y;\n if(y<0)\n y+=x,n+=1;\n }\n a=x>=y?y:x;\n b=x>=y?x:y;\n for(i=0;;i++)\n {\n s=a+b;\n a=b;\n b=s;\n if(s>=k)break;\n }\n printf(\"%I64d\\n\",i+1+n);\n }\n }\n }\n return 0;\n}"}, {"source_code": "#include \n\nlong long fun( long long int x, long long int y, long long int m)\n{\n long long int s,temp;\n for (s = 0 ; y < m ; s++)\n {\n temp = x+y, x = y, y = temp ;\n }\n return s ;\n}\n\nint main ()\n{\n long long x, y, m,xx,temp ;\n while (~scanf (\"%I64d%I64d%I64d\", &x, &y, &m))\n {\n if (x > y)\n {\n temp=y;\n y=x;\n x=temp;\n }\n if(y>=m)printf(\"0\\n\");\n else if(y<=0)printf(\"-1\\n\");\n else\n {\n if(x>=0)\n printf(\"%I64d\\n\",fun(x,y,m));\n else\n {\n xx=-x;\n if(xx<=y)printf(\"%I64d\\n\",fun(x+y,y,m)+1);\n else\n {\n printf(\"I64d\\n\",fun(-1LL*(xx%y),y,m)+xx/y);\n }\n }\n }\n }\n return 0 ;\n}\n"}, {"source_code": "long long x,y,m,c;\n\nint main()\n{\n\twhile(~scanf(\"%lld%lld%lld\",&x,&y,&m))\n\t{\n\t\tc=0;\n\t\tif(x>y) x^=y^=x^=y;\n\t\tif(x<0&&y>0)\n\t\t{\n\t\t\tc=(-x)/y+1;\n\t\t\tx+=c*y;\n\t\t}\n\t\twhile(1)\n\t\t{\n\t\t\tif(x>=m||y>=m)\n\t\t\t{\n\t\t\t\tprintf(\"%lld\\n\",c);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(x>y) x^=y^=x^=y;\n\t\t\tx=y+x;\n\t\t\tc++;\n\t\t\tif(x<=0&&y<=0)\n\t\t\t{\n\t\t\t\tputs(\"-1\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n,m,x,i,k;\n scanf(\"%lld %lld %lld\",&n,&m,&x);\n if(x>n&&x>m&&n<=0&&m<=0)\n {\n printf(\"-1\\n\");\n }\n else\n {\n for(i=0;; i++)\n {\n if(n>=x||m>=x)\n {\n break;\n }\n else if(n>0&&m<0)\n {\n if(m%n==0)\n {\n i=i+((-m)/n);\n m=0;\n }\n else\n {\n k=(((-m)/n)+1)*n;\n i=i+1+((-m)/n);\n m=m+k;\n }\n }\n else if(m>0&&n<0)\n {\n if(n%m==0)\n {\n i=i+((-n)/m);\n n=0;\n }\n else\n {\n k=(((-n)/m)+1)*m;\n i=i+1+((-n)/m);\n n=n+k;\n }\n }\n else if(n\nint main()\n{\n long long int n,m,x,i,k;\n scanf(\"%lld %lld %lld\",&n,&m,&x);\n if(x>n&&x>m&&n<=0&&m<=0)\n {\n printf(\"-1\\n\");\n }\n else\n {\n for(i=0;;i++)\n {\n if(n>=x||m>=x)\n {\n break;\n }\n else if(n>0&&m<0)\n {\n k=(((-m)/n)+1)*n;\n m=m+k;\n i=i+((-m)/n);\n }\n else if(n\nint main()\n{\n long long int n,m,x,i,k;\n scanf(\"%lld %lld %lld\",&n,&m,&x);\n if(x>n&&x>m&&n<=0&&m<=0)\n {\n printf(\"-1\\n\");\n }\n else\n {\n for(i=0;;i++)\n {\n if(n>=x||m>=x)\n {\n break;\n }\n else if(n>0&&m<0)\n {\n k=(((-m)/n)+1)*n;\n m=m+k;\n i=i+1+((-m)/n);\n }\n else if(m>0&&n<0)\n {\n k=(((-n)/m)+1)*m;\n n=n+k;\n i=i+1+((-n)/m);\n }\n else if(n\nint main()\n{\n long long int n,m,x,i,k;\n scanf(\"%lld %lld %lld\",&n,&m,&x);\n if(x>n&&x>m&&n<=0&&m<=0)\n {\n printf(\"-1\\n\");\n }\n else\n {\n for(i=0;; i++)\n {\n if(n>=x||m>=x)\n {\n break;\n }\n else if(n>0&&m<0)\n {\n if(m%n==0)\n {\n i=i+((-m)/n);\n m=0;\n }\n else\n {\n k=(((-m)/n)+1)*n;\n i=i+((-m)/n);\n m=m+k;\n }\n }\n else if(m>0&&n<0)\n {\n if(n%m==0)\n {\n i=i+((-n)/m);\n n=0;\n }\n else\n {\n k=(((-n)/m)+1)*m;\n i=i+((-n)/m);\n n=n+k;\n }\n }\n else if(n\n\nint main() {\n\tlong long x, y, z, m, ans;\n\n\tscanf(\"%lld%lld%lld\", &x, &y, &m);\n\tif (m <= 0) {\n\t\tprintf(x >= m || y >= m ? \"0\\n\" : \"-1\\n\");\n\t\treturn 0;\n\t}\n\tif (x <= 0 && y <= 0) {\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\tif (x > y)\n\t\tz = x, x = y, y = z;\n\tans = 0;\n\tif (x < 0) {\n\t\tans += (-x + y - 1) / y;\n\t\tx = (x % y + y) % y;\n\t}\n\twhile (y < m) {\n\t\tz = x + y, x = y, y = z;\n\t\tans++;\n\t}\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n"}], "src_uid": "82026a3c3d9a6bda2e2ac6e14979d821"} {"nl": {"description": "Getting closer and closer to a mathematician, Serval becomes a university student on math major in Japari University. On the Calculus class, his teacher taught him how to calculate the expected length of a random subsegment of a given segment. Then he left a bonus problem as homework, with the award of a garage kit from IOI. The bonus is to extend this problem to the general case as follows.You are given a segment with length $$$l$$$. We randomly choose $$$n$$$ segments by choosing two points (maybe with non-integer coordinates) from the given segment equiprobably and the interval between the two points forms a segment. You are given the number of random segments $$$n$$$, and another integer $$$k$$$. The $$$2n$$$ endpoints of the chosen segments split the segment into $$$(2n+1)$$$ intervals. Your task is to calculate the expected total length of those intervals that are covered by at least $$$k$$$ segments of the $$$n$$$ random segments.You should find the answer modulo $$$998244353$$$.", "input_spec": "First line contains three space-separated positive integers $$$n$$$, $$$k$$$ and $$$l$$$ ($$$1\\leq k \\leq n \\leq 2000$$$, $$$1\\leq l\\leq 10^9$$$).", "output_spec": "Output one integer — the expected total length of all the intervals covered by at least $$$k$$$ segments of the $$$n$$$ random segments modulo $$$998244353$$$. Formally, let $$$M = 998244353$$$. It can be shown that the answer can be expressed as an irreducible fraction $$$\\frac{p}{q}$$$, where $$$p$$$ and $$$q$$$ are integers and $$$q \\not \\equiv 0 \\pmod{M}$$$. Output the integer equal to $$$p \\cdot q^{-1} \\bmod M$$$. In other words, output such an integer $$$x$$$ that $$$0 \\le x < M$$$ and $$$x \\cdot q \\equiv p \\pmod{M}$$$.", "sample_inputs": ["1 1 1", "6 2 1", "7 5 3", "97 31 9984524"], "sample_outputs": ["332748118", "760234711", "223383352", "267137618"], "notes": "NoteIn the first example, the expected total length is $$$\\int_0^1 \\int_0^1 |x-y| \\,\\mathrm{d}x\\,\\mathrm{d}y = {1\\over 3}$$$, and $$$3^{-1}$$$ modulo $$$998244353$$$ is $$$332748118$$$."}, "positive_code": [{"source_code": "/* upsolve with Dukkha */\n#include \n\n#define N\t2000\n#define MD\t998244353\n\nint ch[1 + N][1 + N];\n\nvoid init(int n) {\n\tint i, j;\n\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}\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\nint main() {\n\tstatic long long pp[1 + N + N], qq[1 + N + N], aa[1 + N + N];\n\tint n, k, l, i, j;\n\tlong long inv2, a;\n\n\tscanf(\"%d%d%d\", &n, &k, &l);\n\tinit(n);\n\tpp[n] = power(2, n);\n\tfor (i = 0; i < n; i++)\n\t\tfor (j = n + n; j > 0; j--)\n\t\t\tpp[j] = (pp[j] - pp[j - 1]) % MD;\n\tfor (j = 0; j <= n + n; j++)\n\t\taa[j] = pp[j];\n\tinv2 = (MD + 1) / 2;\n\tfor (i = 1; i <= n - k; i++) {\n\t\t/* qq := pp / p, where p = 2x (1 - x) */\n\t\t/* divide by 2x */\n\t\tfor (j = 1; j < n + n; j++)\n\t\t\tqq[j] = pp[j + 1] * inv2 % MD;\n\t\tqq[n + n] = 0;\n\t\t/* divide by 1 - x is multiply by 1 + x + x^2 + x^3 + ... */\n\t\tfor (j = 1; j <= n + n; j++)\n\t\t\tqq[j] = (qq[j] + qq[j - 1]) % MD;\n\t\t/* pp := pp * (1 - p) / p = pp / p - pp = qq - pp */\n\t\tfor (j = 0; j <= n + n; j++)\n\t\t\tpp[j] = (qq[j] - pp[j]) % MD;\n\t\ta = ch[n][i];\n\t\tfor (j = 0; j <= n + n; j++)\n\t\t\taa[j] = (aa[j] + a * pp[j]) % MD;\n\t}\n\t/* integrate x^i to x^{i + 1} / (i + 1) */\n\ta = 0;\n\tfor (i = 0; i <= n + n; i++)\n\t\ta = (a + aa[i] * power(i + 1, MD - 2)) % MD;\n\ta = (a * l % MD + MD) % MD;\n\tprintf(\"%lld\\n\", a);\n\treturn 0;\n}\n"}], "negative_code": [], "src_uid": "c9e79e83928d5d034123ebc3b2f5e064"} {"nl": {"description": "Kirill plays a new computer game. He came to the potion store where he can buy any potion. Each potion is characterized by two integers — amount of experience and cost. The efficiency of a potion is the ratio of the amount of experience to the cost. Efficiency may be a non-integer number.For each two integer numbers a and b such that l ≤ a ≤ r and x ≤ b ≤ y there is a potion with experience a and cost b in the store (that is, there are (r - l + 1)·(y - x + 1) potions).Kirill wants to buy a potion which has efficiency k. Will he be able to do this?", "input_spec": "First string contains five integer numbers l, r, x, y, k (1 ≤ l ≤ r ≤ 107, 1 ≤ x ≤ y ≤ 107, 1 ≤ k ≤ 107).", "output_spec": "Print \"YES\" without quotes if a potion with efficiency exactly k can be bought in the store and \"NO\" without quotes otherwise. You can output each of the letters in any register.", "sample_inputs": ["1 10 1 10 1", "1 5 6 10 1"], "sample_outputs": ["YES", "NO"], "notes": null}, "positive_code": [{"source_code": "#include \n\nint main()\n{\n int l, r, x, y, k;\n scanf(\"%d %d %d %d %d\", &l, &r, &x, &y, &k);\n for(int i = x; i <= y; ++i) {\n if((long long)k * i >= l && (long long)k * i <= r) {\n puts(\"YES\");\n return 0;\n }\n }\n puts(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n int l,r,x,y,k;\n scanf(\"%d%d%d%d%d\",&l,&r,&x,&y,&k);\n long long a,b;\n int find=0;\n for(b=x;b<=y;b++){\n if((long long)l<=(b*(long long)k) && (b*(long long)k)<=(long long)r){\n //printf(\"[%d, %d] in %lld\\n\",l,r,b*k);\n find=1;\n break;\n }\n }\n if(find){\n printf(\"YES\\n\");\n }else{\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "# include \n# include \n\nint main()\n{\n\tint flag=0;\n\tlong int l,r,x,y;\n\tfloat k,s,a,b;\n\tscanf(\"%ld %ld %ld %ld %f\",&l,&r,&x,&y,&k);\n\tfor(b=x;b<=y;b++)\n\t{\n\t\ta=b*k;\n\t\tif(a-(int)a==0)\n\t\t{\n\t\t\tif((a<=r)&(a>=l))\n\t\t\t\tflag=1;\n\t\t}\n\n\t}\n\tif(flag==1)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\treturn 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n\tlong long int l,r,x,y,k,i;\n\tscanf(\"%lld %lld %lld %lld %lld\",&l,&r,&x,&y,&k);\n\n\tfor(i=x;i<=y;i++)\n\t{\n\t\tif(i*k>=l&&i*k<=r)\n\t\t{\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include\nmain()\n{\n long int l,r,x,y,i,j,flag=0,s;\n double k,p;\n scanf(\"%ld%ld%ld%ld%lf\",&l,&r,&x,&y,&k);\n for(i=x;i<=y;i++)\n { p=k*(double)i;\n if(p>=l && p<=r)\n {\n printf(\"YES\");flag=1;goto s;\n }\n }s:;\n if(flag==0)\n {\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int l,r,x,y,k;\n scanf(\"%d%d%d%d%d\",&l,&r,&x,&y,&k);\n for (int i = l; i <= r; i++)\n {\n if (i%k == 0 && x <= i/k && i/k <= y)\n {\n puts(\"YES\");\n return 0;\n }\n }\n puts(\"NO\");\n return 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n\tint l,r,x,y,i,j;\n\tdouble k;\n\tscanf(\"%d %d %d %d %lf\",&l,&r,&x,&y,&k);\n\tfor(j=x;j<=y;j++)\n\t{\n\t\tdouble a;\n\t\tint ab;\n\t\ta=k*j;\n\t\tab=k*j;\n\t\tif((a-ab)==0 && (l<=ab && ab<=r))\n\t\t{\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\n#include\nint main()\n{\n long int i;\n long int l,r,x,y;\n long int k;\n scanf(\"%ld %ld %ld %ld %ld\",&l,&r,&x,&y,&k);\n for(i=l;i<=r;i++)\n {\n if(i/k<=y&&i/k>=x&&i%k==0)\n {\n printf(\"YES\");\n exit(0);\n }\n } \n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(){\n\tint l, r, x, y, k, notpos = 0, a, b;\n\tscanf(\"%d %d %d %d %d\", &l, &r, &x, &y, &k);\n\t\n\tfor(a = l; a<=r; a++){\n\t\tif(a%k == 0 && (a/k)>= x && (a/k) <= y){\n\t\t\tnotpos = 1;\n\t\t\tbreak;\n\t\t}\n\t}\n\t\n\tif(notpos==1) printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\t\n\treturn 0;\n}"}, {"source_code": "#include\n#include\n#define ll long long int\nint main()\n{\n ll l,r,x,y,k;\n scanf(\"%lld %lld %lld %lld %lld\",&l,&r,&x,&y,&k);\n ll i;\n bool key=false;\n for(i=x;i<=y;i++)\n {\n if(i*k<=r && i*k>=l)\n {\n key=true;\n break;\n }\n }\n if(key)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int l,r,x,y,k,m,n,i=0;\n scanf(\"%lld %lld %lld %lld %lld\",&l,&r,&x,&y,&k);\n for(m=x;m<=y;m++)\n {\n n=m*k;\n if(n>=l&&n<=r)\n {\n printf(\"YES\\n\");\n i++;\n break;\n }\n else if(n>r)\n break;\n }\n if(i==0)\n printf(\"NO\\n\");\n return 0;\n\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int l,r,x,y,k,i;\n scanf(\"%d %d %d %d %d\",&l,&r,&x,&y,&k);\n for(i=l;i<=r;++i)\n {\n if(i%k==0&&i/k>=x&&i/k<=y)\n {\n printf(\"YES\\n\");\n return 0;\n }\n }\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\ntypedef struct {\n\tint\n\t\tleft_numerator,\n\t\tleft_denominator,\n\t\tright_numerator,\n\t\tright_denominator,\n\t\ttarget;\n} data_t;\n\ndata_t getdata(void) {\n\tdata_t data;\n\tscanf(\"%d%d%d%d%d\", \n\t\t\t&data.left_numerator,\n\t\t\t&data.right_numerator,\n\t\t\t&data.left_denominator,\n\t\t\t&data.right_denominator,\n\t\t\t&data.target\n\t );\n\treturn data;\n}\n\nvoid search(data_t data) {\n\tint \n\t\tleft = data.left_denominator,\n\t\t right = data.right_denominator;\n\twhile (true) {\n\t\tint guess = (left + right) / 2;\n\t\tif (guess == left)\n\t\t\tbreak;\n\t\tif ((long long)guess * data.target > data.right_numerator) {\n\t\t\tright = guess;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif ((long long)guess * data.target < data.left_numerator) {\n\t\t\tleft = guess;\n\t\t\tcontinue;\n\t\t}\n\n\t\tputs(\"YES\");\n\t\texit(EXIT_SUCCESS);\n\t}\n\n\tif (\n\t\t\t(\n\t\t\t (long long)left * data.target <= data.right_numerator\n\t\t\t &&\n\t\t\t (long long)left * data.target >= data.left_numerator\n\t\t\t)\n\t\t\t||\n\t\t\t(\n\t\t\t (long long)right * data.target <= data.right_numerator\n\t\t\t &&\n\t\t\t (long long)right * data.target >= data.left_numerator\n\t\t\t)\n\t ) {\n\t\tputs(\"YES\");\n\t\texit(EXIT_SUCCESS);\n\t}\n}\n\nint main(void) {\n\tdata_t data;\n\tdata = getdata();\n\tsearch(data);\n\tputs(\"NO\");\n\treturn EXIT_SUCCESS;\n}\n"}, {"source_code": "#include \n\nint main(){\n long long l,r,x,y, k;\n scanf(\"%lld %lld %lld %lld %lld\", &l, &r, &x, &y, &k);\n\n for(int c1=x; c1<=y; c1++){\n if(k*c1>=l && k*c1<=r){\n printf(\"YES\");\n\n return 0;\n }\n }\n\n printf(\"NO\");\n\n return 0;\n}\n\n/* 1506229942019 */\n"}, {"source_code": "/* Problem: 842A - Kirill And The Game */\n/* Author: Gusztav Szmolik */\n\n#include \n\nenum bool {FALSE,TRUE};\n\nint main ()\n {\n unsigned int l;\n unsigned int r;\n unsigned int x;\n unsigned int y;\n unsigned int k;\n unsigned int aDivKMin;\n enum bool ans;\n unsigned int aDivKMax;\n unsigned int bMin;\n unsigned int bMax;\n\n if (scanf(\"%u %u %u %u %u\",&l,&r,&x,&y,&k) != 5)\n return -1;\n if (l < 1 || l > 10000000 || r < 1 || r > 10000000)\n return -1;\n if (x < 1 || x > 10000000 || y < 1 || y > 10000000 || k < 1 || k > 10000000)\n return -1;\n if (l > r || x > y)\n return -1;\n aDivKMin = l+(k-l%k)%k;\n if (aDivKMin > r)\n ans = FALSE;\n else\n {\n aDivKMax = r-r%k;\n bMin = aDivKMin/k;\n bMax = aDivKMax/k;\n ans = (bMax < x || bMin > y ? FALSE : TRUE);\n }\n printf (ans ? \"YES\\n\" : \"NO\\n\");\n return 0;\n }\n"}, {"source_code": "#include\n#include\n#include\n\n#define ll long long int\n#define s1(x) scanf(\"%lli\",&x)\n#define s2(x,y) scanf(\"%lli %lli\",&x,&y)\n#define p(x) printf(\"%lli\",x)\nint main ()\n{\n int l,r,x,y,k;\n double t,m;\n scanf(\"%d %d %d %d %d\",&l,&r,&x,&y,&k);\n t=(1.0*r)/(1.0*x);\n m=(1.0*l)/(1.0*y);\n if(k>t)\n {\n printf(\"NO\");\n return 0;\n }\n if(k=l)\n\t{\n\t printf(\"YES\");\n\t return 0;\n\t}\n }\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\nlong long int l,r,x,y,k,i,j;\nscanf(\"%lld%lld%lld%lld%lld\",&l,&r,&x,&y,&k);\nfor(i=x;i<=y;i++)\n{\nj=i*k;\nif(j>=l&&j<=r)\n{printf(\"YES\");\nreturn 0;}}\nprintf(\"NO\");\nreturn 0;}"}, {"source_code": "#include\nint main()\n{\n\tint l,r,x,y,k,i,flag=0;\n\tscanf(\"%d %d %d %d %d\",&l,&r,&x,&y,&k);\n\t\n\tfloat min=(float)l/y,max=(float)r/x;\n\t\n\tif(k>=min && k<=max)\n\t{\t\n\t\tfor (i=l;i<=r;i++)\n\t\t{\n\t\t\tif((float)i/k>=x && (float)i/k<=y && (float)i/k-i/k==0)\n\t\t\tflag=1;\n\t\t}\n\t}\n\tif(flag)\n\tprintf(\"YES\\n\");\n\telse \n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include \n\ntypedef long long int ll;\n\nint main() {\n\tll l, r, x, y, k;\n\tscanf(\"%I64d%I64d%I64d%I64d%I64d\", &l, &r, &x, &y, &k);\n\tll i;\n\tfor(i=x;i<=y;i++) {\n\t\tif(l <= i*k && i*k <= r) {\n\t\t\tprintf(\"YES\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\t\tprintf(\"NO\\n\");\n\t\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main(){\n\tint k, i, l, r, x ,y;\n\t\n\tscanf(\"%d%d%d%d%d\", &l, &r, &x, &y, &k);\n\tfor(i=l; i<=r; i++){\n\t\tif(i%k == 0 && (i/k) <= y && (i/k) >= x){\n\t\t\t\tprintf(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t}\n\t\n\tprintf(\"NO\");\n\treturn 0;\n}\n/* 1506174577742 */\n"}, {"source_code": "# include \n# include \n\nint main(){\n\tlong long l,r,x,y,k;\n\tscanf(\"%lld %lld %lld %lld %lld\",&l,&r,&x,&y,&k);\n\tfor(int i=x;i<=y;i++){\n\t\tif(l<=(i*k) && (i*k)<=r){\n\t\t\tprintf(\"YES\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}"}, {"source_code": "#include \n#include \nlong int max(long int a, long int b)\n{\n\tif (a>b)\n\t{\n\t\treturn a;\n\t}\n\telse\n\t{\n\t\treturn b;\n\t}\n}\nint main()\n{\n\tlong int l,r,x,y,k,i,j,temp,check;\n\tscanf(\"%ld %ld %ld %ld %ld\",&l, &r, &x, &y, &k);\n\tif(rr/x)\n\t{\n\t\tprintf(\"NO\");\n\t}\n\telse\n\t{\n\t\tcheck = 0;\n\t\tfor(i=max(l,k);i<=r;i++)\n\t\t{\n\t\t\tj = i/k;\n\t\t\tif(j>=x&&j<=y&&i%k == 0)\n\t\t\t{\n\t\t\t\tprintf(\"YES\");\n\t\t\t\tcheck = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(check == 0)\n\t\t{\n\t\t\tprintf(\"NO\");\n\t\t}\n\t}\n}"}, {"source_code": "#include\nint main(){\n\n long long int l,r,x,y,k,i,exp,cost,ct=0,ck=0;\n scanf(\"%lld %lld %lld %lld %lld\",&l,&r,&x,&y,&k);\n\n for(i=x;i<=y;i++){\n if(l<=k*i&&r>=k*i){\n ck=1;\n break;\n }\n\n }\n if(ck==1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n\nreturn 0;\n}\n"}, {"source_code": "#include\n#include\n#include\nint main()\n{\n\tlong int l,r,x,y,k,i,j,c=0;\n\tscanf(\"%ld\",&l);\n\tscanf(\"%ld\",&r);\n\tscanf(\"%ld\",&x);\n\tscanf(\"%ld\",&y);\n\tscanf(\"%ld\",&k);\n\tif(l<=r && x<=y && (float)r/x >= k && (float)l/y <= k)\n\t{\n\t\tfor(i=x;i<=y;i++)\n\t\t{\n\t\t\tfor(j=l;j<=r;j++)\n\t\t\t{\n\t\t\t\tif(j/i == k && j%i == 0)\n\t\t\t\t{\n\t\t\t\t\tc++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(c!=0)\n\t\t\tbreak;\n\t\t}\n\t}\n\t\tif(c!=0)\n\t\tprintf(\"YES\");\n\t\telse\n\t\tprintf(\"NO\");\n\t\n\treturn 0;\n}\n\n"}, {"source_code": "#include\nmain()\n{\n float k,l;\n float e;\n int a,c,f=0,i,j,b,d;\n scanf(\"%d%d%d%d%f\",&a,&b,&c,&d,&e);\n for(i=a,j=c;i<=b&&j<=d;)\n {\n //printf(\"jfhjdf\");\n i=i*1.0;\n k=(float)(i)/j;\n //printf(\"%f\\n\",k);\n if(k==e)\n {\n f=1;\n printf(\"YES\");\n break;\n }\n else\n {\n if(k\n#include \n#include \n\n\nint main(){\n double l,r,x,y,k;\n double expe;\n int flag=0,i;\n scanf(\"%lf%lf%lf%lf%lf\",&l,&r,&x,&y,&k);\n\n for(i=x;i<=y;i++){\n if(l<=i*k && i*k <=r){\n flag = 1;\n break;\n }\n }\n\n if(flag) printf(\"YES\");\n else printf(\"NO\");\n\n}"}, {"source_code": "#include \n\nint main (void)\n{\n\tunsigned long long l, r, x, y, k, i;\n\tscanf(\"%llu\", &l);\n\tscanf(\"%llu\", &r);\n\tscanf(\"%llu\", &x);\n\tscanf(\"%llu\", &y);\n\tscanf(\"%llu\", &k);\n\tfor (i = x; i <= y; i++)\n\t\tif ((k * i >= l) && (k * i <= r)){\n\t\t\tputs(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\tputs(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main (void)\n{\n\tint l, r, x, y, k, i;\n\tscanf(\"%d\", &l);\n\tscanf(\"%d\", &r);\n\tscanf(\"%d\", &x);\n\tscanf(\"%d\", &y);\n\tscanf(\"%d\", &k);\n\tfor (i = x; i < y+1; i++)\n\t\tif (((long long)k * i >= l) && ((long long)k * i <= r)){\n\t\t\tputs(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\tputs(\"NO\");\n\treturn 0;\n}\n\n"}, {"source_code": "#include \n\nint main(void){\n\tlong long int l, r, x, y, k;\n\tscanf(\"%lld%lld%lld%lld%lld\",&l,&r,&x,&y,&k);\n\tlong long int a = 1;\n\ta = x;\n\twhile(1){\n\t\tif(k*a < l || a < x){\n\t\t\ta++;\n\t\t} else{\n\t\t\tbreak;\n\t\t}\n\t}\n\tlong long int flag = 0;\n\twhile(k*a <= r && a <= y){\n\t\tif(k*a <= r && a <= y){\n\t\t\tflag = 1;\n\t\t\tbreak;\n\t\t}\n\t\ta++;\n\t}\n\tif(flag == 1){\n\t\tprintf(\"YES\\n\");\n\t} else{\n\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main(void){\n\tlong long int l, r, x, y, k;\n\tscanf(\"%lld%lld%lld%lld%lld\",&l,&r,&x,&y,&k);\n\tlong long int a = 1;\n\twhile(1){\n\t\tif(k*a < l || a < x){\n\t\t\ta++;\n\t\t} else{\n\t\t\tbreak;\n\t\t}\n\t}\n\tlong long int flag = 0;\n\twhile(k*a <= r && a <= y){\n\t\tif(k*a <= r && a <= y){\n\t\t\tflag = 1;\n\t\t\tbreak;\n\t\t}\n\t\ta++;\n\t}\n\tif(flag == 1){\n\t\tprintf(\"YES\\n\");\n\t} else{\n\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n\n double k,l,r,x,y;\n scanf(\"%lf%lf%lf%lf%lf\",&l,&r,&x,&y,&k);\n for(int i=x;i<=y;i++)\n {\n if(k*i>=l&&k*i<=r)\n {\n printf(\"YES\\n\");\n return 0;\n }\n }\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n#include \n#include \nint main(int argc, char const *argv[])\n{\n\tlong long l,r,x,y,k;\n\tscanf(\"%I64d %I64d %I64d %I64d %I64d\",&l,&r,&x,&y,&k);\n\tfor(long long i=x;i<=y;i=i+1){\n\t\tif(i*k>=l&&i*k<=r){\n\t\t\tprintf(\"YES\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include \n\ntypedef long long ll;\n\n\nint main()\n{\n ll l,r,x,y;\n int i, j=0;\n float k;\n\n scanf(\"%I64d %I64d %I64d %I64d %f\",&l, &r, &x, &y, &k);\n\n for(i = x; i <= y; i++)\n {\n if(k*i >= l && k*i <= r)\n {\n printf(\"YES\");\n j = 1;\n break;\n }\n }\n\n if(j==0)\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n\tlong long int l,r,x,y,k,i;\n\tscanf(\"%lld%lld%lld%lld%lld\",&l,&r,&x,&y,&k);\n\tfor(i=x;i<=y;i++){\n\t\tif(k*i >= l && k*i<=r)break;\n\t}\n\tif(i<=y)printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main(void) {\n\t// your code goes here\n\tfloat l,r,x,y,i,j;\n\tfloat k;\n\tscanf(\"%f%f%f%f%f\",&l,&r,&x,&y,&k);\n//\tprintf(\"%f\",r/x);\n\tif(k>(r/x))\n\tprintf(\"NO\");\n\telse if(k<(l/y))\n\tprintf(\"NO\");\n\telse \n\t{\n\t\tfor(i =l;i<=r;i++)\n\t\t{\n\t\t\tif(k<=(i/x)&&k>=(i/y))\n\t\t\t\tfor(j = x;j<=y;j++)\n\t\t\t\t{\n\t\t\t\t\tif((i/j)==k)\n\t\t\t\t\t{printf(\"YES\"); return 0;}\n\t\t\t\t}\n\t\t}\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tlong long int l, r, x, y, k;\n\tscanf(\"%I64d %I64d %I64d %I64d %I64d\", &l, &r, &x, &y, &k);\n\tlong long int i;\n\tfor (i = x; i <= y; i++)\n\t{\n\t\tlong long int j = i*k;\n\t\tif (j >= l && j <= r)\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}"}, {"source_code": "#include \n\nint main(){\n\tint l,r,x,y;\n\tdouble k;\n\tscanf(\"%d%d%d%d%lf\",&l,&r,&x,&y,&k);\n\t\n\tfor (int i=x;i<=y;i++){\n\t\tdouble tar = i*k;\n\t\tint tari = (int)tar;\n\t\tif (tari-tar==0){\n\t\t\tif (tari<=r&&tari>=l){\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 \n#include \n#include \n// #define f(i,x,y) for(i=x;i r || temp2 < l)\n\t{\n\t\tprintf(\"NO\");\n\t\treturn 0;\n\t}\n\n\tfor(i=l;i<=r;i++)\n\t{\n\t\tj=x;\n\t\twhile(i >= j*k && i <= y*k && j<=y)\n\t\t{\n\t\t\tif(i == j*k)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tj++;\n\t\t}\n\n\t\tif(flag)\n\t\t\tbreak;\n\t}\n\n\tif(flag) printf(\"YES\");\n\telse printf(\"NO\");\n\n\treturn 0;\n}"}, {"source_code": "#include \n#define PRINT 0\n\nint main(){\n\tint l,r,x,y;\n\tfloat k;\n\tscanf(\"%d %d %d %d %f\",&l, &r, &x, &y, &k);\n\tint i,j=0;\n\tfor(i = x; i <= y; i++){\n\t\tif(k*i >= l && k*i <= r){\n\t\t\tprintf(\"YES\");\n\t\t\tj = 1;\n\t\t\tbreak;\n\t\t}\n\t}\n\t\tif(j == 0)\n\t\t\tprintf(\"NO\");\n}"}, {"source_code": "#include \n\nint main()\n{\n\tdouble l,r,x,y,k,i;\n\tscanf(\"%lf%lf%lf%lf%lf\",&l,&r,&x,&y,&k);\n\t\n\tfor(i= x; i<=y ; i++)\n\t{\n\t\tdouble val = 0;\n\t\tval = i*k;\n\t\tif(val>=l && val<=r)\n\t\t{\n\t\t\tprintf(\"YES\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\t\tprintf(\"NO\\n\");\n\t\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n long long int l,r,x,y,i;\n float k;\n scanf(\"%I64d %I64d %I64d %I64d %f\",&l,&r,&x,&y,&k);\n\n for(i=x;i<=y;i++){\n if(l<=i*k&&i*k<=r){\n printf(\"YES\");\n return 0;\n }\n }\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \n\nint main ()\n{\n double l, r, x, y;\n double k, sum;\n int i, summ = 0;\n\n scanf(\"%lf %lf %lf %lf %lf\", &l, &r, &x, &y, &k);\n\n for(i = x; i <= y; i++)\n {\n sum = k * i;\n\n if(sum >= l && sum <= r){\n printf(\"YES\");\n break;\n }\n else summ++;\n }\n if(summ == (y - x) + 1)\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n\nvoid main(){\nlong long l,r,x,y,k,i,a;\nscanf(\"%lld %lld %lld %lld %lld\",&l,&r,&x,&y,&k);\n\nfor(i=x;i<=y;i++){\n\ta=i*k;\n\tif(a>=l&&a<=r){\nprintf(\"YES\\n\");exit(0);}}\n\nprintf(\"NO\\n\");\nexit(0);\n}\n"}, {"source_code": "#include\n#include\n#include\n\nint main()\n{\n double l, r, x, y;\n long long int j;\n double k,p,i;\n \n scanf(\"%lf %lf %lf %lf %lf\",&l, &r,&x,&y,&k);\n int flag=0;\n\n i=x;\n\n while(i<=y)\n {\n p=k*i;\n j=p;\n if(p>=l && p<=r && p-j==0)\n {\n flag=2;\n break;\n }\n else\n i++;\n }\n\n if(flag==2)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n \n \n return 0;\n\n\n}\n\n"}, {"source_code": "#include \n#include \n#include \n\nint main()\n{\n long l,r,x,y,e;\n long i;\n scanf(\"%ld%ld%ld%ld%ld\",&l,&r,&x,&y,&e);\n for (i=l;i<=r;i++)\n if (i/e>=x && i/e<=y && i%e==0)\n {\n printf(\"YES\\n\");\n return 0;\n }\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "//Date:29-08-17\n\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#define ll long long\n#define For(i,n)\tfor(i=0;ib?a:b);\t}\nint main(){\n\tint l ,r ,x ,y ,k ,i ,j;\n\tscanf(\"%d%d%d%d%d\" ,&l ,&r ,&x ,&y ,&k);\n\tfor(i = l ; i <= r ;i++){\n\t\tif(i%k==0){\n\t\t\tj = i/k;\n\t\t\tif(j>=x && j <= y){\n\t\t\t\tputs(\"YES\");\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tputs(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\nint main(){\n\tint l,r,x,y;\n\tfloat k;\n\tscanf(\"%d%d%d%d%f\", &l, &r, &x, &y, &k);\n\tfor(int i=x; i<=y;i++)\n\t\tif(k*i>=l && k*i<=r && k*i-(int)(k*i)==0)\n\t\t{\n\t\t\tprintf(\"YES\\n\");\n\t\t\treturn 0;\n\t\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tlong long l,r,x,y,k,i;\n\tscanf(\"%I64d %I64d %I64d %I64d %I64d\",&l,&r,&x,&y,&k);\n\tfor (i=x;i<=y;i++)\n\t\tif ( (i*k>=l) && (i*k<=r) )\n\t\t{\n\t\t\tprintf(\"YES\\n\");\n\t\t\treturn 0;\n\t\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n long long int l, r, x, y , a ,b, i, j, k;\n scanf(\"%I64d %I64d %I64d %I64d %I64d\", &l, &r, &x, &y, &k);\n for(i=x; i<=y; i++)\n {\n if( k*i>=l && k*i<=r){\n printf(\"YES\\n\");\n return 0;\n }\n }\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n\tint l,r,x,y,i;\n\tdouble k;\n scanf(\"%d %d %d %d %lf\",&l,&r,&x,&y,&k); \n\tfor(i=x;i<=y;i++) \n\t{\n\t if (i*k<=r&&i*k>=l) \n\t\t{\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include \n#define ll long long\n\nint main()\n{\n\tll l, r, x, y, k, f = 0;\n\tscanf(\"%I64d %I64d %I64d %I64d %I64d\", &l, &r, &x, &y, &k);\n\twhile(x <= y && x * k <= r)\n\t{\n\t\tif(x * k <= r && x * k >= l)\n\t\t{\n\t\t\tf = 1;\n\t\t\tbreak;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t++x;\n\t\t}\n\t}\n\tif(f)\n\t{\n\t\tprintf(\"YES\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\\n\");\n\t}\n\t/*\n\tif(l > y * k)\n\t{\n\t\tprintf(\"NO\\n\");\n\t}\n\telse if(l >= x * k && l <= y * k)\n\t{\n\t\tif(l % k == 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(r >= x * k && r <= y * k && r % k == 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\t*/\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tlong long int l, r, x,y,k;\n\tscanf (\"%lld %lld %lld %lld %lld\", &l, &r, &x, &y, &k);\n\tlong long int t=0;\n\n\t// for (int i = l; i <= r; ++i)\n\t// {\n\t// \tfor (int j = x; j <= y; ++j)\n\t// \t{\n\t// \t\tif (i/j == k)\n\t// \t\t\tt=1;\n\t// \t}\n\t// }\n\n\tlong long int i=0;\n\tfor (i = x; i <= y; ++i)\n\t{\n\t\tif(k*i <= r && k*i >= l)\n\t\t\tt=1;\n\t}\n\tif (t==1)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n}"}, {"source_code": "#include \n\nint main() {\n int l, r, x, y, ef;\n scanf(\"%d %d %d %d %d\", &l, &r, &x, &y, &ef);\n\n float xp_mid, c_mid, find = 0;\n for (float i = ef; i <= r; i += ef) {\n if (i < l)\n continue;\n else {\n int xx = x, yy = y;\n while (xx <= yy) {\n c_mid = (xx + yy) / 2;\n\n if (ef > i / c_mid) {\n yy = c_mid - 1;\n } else if (ef < i / c_mid) {\n xx = c_mid + 1;\n } else {\n find = 1;\n break;\n }\n }\n if (find)\n break;\n }\n }\n\n /*while (l <= r) {\n xp_mid = (l + r) / 2;\n int xx = x, yy = y;\n while (xx <= yy) {\n c_mid = (xx + yy) / 2;\n printf(\"%f / %f = %f\\n\", xp_mid, c_mid, xp_mid / c_mid);\n\n if (ef > xp_mid / c_mid) {\n yy = c_mid - 1;\n } else if (ef < xp_mid / c_mid) {\n xx = c_mid + 1;\n } else {\n find = 1;\n break;\n }\n }\n\n if (find)\n break;\n else {\n if (ef > xp_mid / c_mid) {\n l = xp_mid + 1;\n } else if (ef < xp_mid / c_mid) {\n r = xp_mid - 1;\n } else {\n find = 1;\n break;\n }\n }\n }*/\n\n printf(find ? \"YES\\n\" : \"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n\tint l, r, x, y, flag=0;\n\tdouble k;\n\tscanf(\"%d %d %d %d %lf\", &l, &r, &x, &y, &k);\n\tfor (double i=x, j=y;i<=y, j>=x;i++, j--) {\n\t\tif ((1.0*k*i>=l&&1.0*k*i<=r)||(1.0*k*j>=l&&1.0*k*j<=r)) {\n\t\t\tflag=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (flag) printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n}\n"}, {"source_code": "/* AUTHOR:AKASH JAIN\n* USERNAME:akash19jain \n* DATE:24/07/2019 \n*/\n#include\n#include\n#include\n#include\n#include\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)\t\twhile(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)\t\t strlen(a)\n#define MOD 1000000007\n#define MAX 10000000005\n#define MIN -10000000005\n#define PI 3.1415926535897932384626433832795\n#define TEST(x) printf(\"The value of \\\"%s\\\" is: %d\\n\",#x,x)\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\nint main()\n{\n ll t=1,i=0;\n //SC1(t);\n while(t--)\n {\n ll l,r,x,y,k,f=0;\n SC3(l,r,x);\n SC2(y,k);\n FOR(i,x,y)\n {\n if(l<=i*k && i*k<=r)\n f=1;\n }\n if(f)\n printf(\"YES\");\n else\n {\n printf(\"NO\");\n }\n \n }\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\nint main(){\n\n long long int l,r,x,y,k,i,exp,cost,ct=0,ck=0;\n scanf(\"%lld %lld %lld %lld %lld\",&l,&r,&x,&y,&k);\n\n for(i=x;i<=y;i++){\n if(l<=k*i&&r>=k*i){\n ck=1;\n break;\n }\n\n }\n if(ck==1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n\nreturn 0;\n}"}, {"source_code": "\n\n#include \n\nint main()\n{\n\tlong long x, y, l, r, k;\n\tscanf(\"%lld%lld%lld%lld%lld\", &x, &y, &l, &r, &k);\n\tlong long flag = 0;\n\tfor (int i = l; i <= r; i++)\n\t{\n\t\tif (k * i <= y && k * i >= x)\n\t\t{\n\t\t\tflag = 1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%s\\n\", flag ? \"YES\" : \"NO\");\n}\n"}, {"source_code": "#include \n\nint main() {\n int l, r, x, y, ef;\n scanf(\"%d %d %d %d %d\", &l, &r, &x, &y, &ef);\n\n float xp_mid, c_mid, find = 0;\n for (float i = ef; i <= r; i += ef) {\n if (i < l)\n continue;\n else {\n int xx = x, yy = y;\n while (xx <= yy) {\n c_mid = (xx + yy) / 2;\n // printf(\"%f / %f = %f\\n\", i, c_mid, i / c_mid);\n\n if (ef > i / c_mid) {\n yy = c_mid - 1;\n } else if (ef < i / c_mid) {\n xx = c_mid + 1;\n } else {\n find = 1;\n break;\n }\n }\n if (find)\n break;\n }\n }\n\n /*while (l <= r) {\n xp_mid = (l + r) / 2;\n int xx = x, yy = y;\n while (xx <= yy) {\n c_mid = (xx + yy) / 2;\n printf(\"%f / %f = %f\\n\", xp_mid, c_mid, xp_mid / c_mid);\n\n if (ef > xp_mid / c_mid) {\n yy = c_mid - 1;\n } else if (ef < xp_mid / c_mid) {\n xx = c_mid + 1;\n } else {\n find = 1;\n break;\n }\n }\n\n if (find)\n break;\n else {\n if (ef > xp_mid / c_mid) {\n l = xp_mid + 1;\n } else if (ef < xp_mid / c_mid) {\n r = xp_mid - 1;\n } else {\n find = 1;\n break;\n }\n }\n }*/\n\n printf(find ? \"YES\\n\" : \"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n long long int l,r,x,y,k,i,a=0;\n scanf(\"%lld %lld %lld %lld %lld\",&l,&r,&x,&y,&k);\n for (i=x; i<=y; i++)\n {\n if ((i*k) >=l && (i*k) <=r)\n {\n a++;\n }\n if (a>0)\n {\n break;\n }\n }\n if (a>0)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n\n#define max(x, y)\tx>y ? x : y;\n\nint retans(void)\n{\n\tint l, r, k, a, b;\n\n\tlong long int x, y;\n\n\tscanf(\"%d %d %d %d %d\", &l, &r, &a, &b, &k);\n\n\tx = a;\n\ty = b;\n\tx *= k;\n\ty *= k;\n\n\tif(yr)\treturn 0;\n\telse {\n\t\tx = max((l/k)*k, x);\n\t\twhile(x<=r && x<=y)\t{\n\t\t\tif(x>=l)\treturn 1;\n\t\t\tx += k;\n\t\t}\n\t}\n\n\treturn 0;\n}\n\nint main(void)\n{\n\tif(retans())\tprintf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main() {\n\tint l, r, x, y, k,i,tmp;\n\tscanf(\"%d %d %d %d %d\", &l, &r, &x, &y, &k);\n\n\tfor( i = l; i <= r; ++i) {\n\t\tif(i % k == 0) {\n\t\t\t tmp = i / k;\n\t\t\tif(tmp >= x && tmp <= y) {\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\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main(){\n\tint l,r,x,y,end=0;\n\tdouble k,b;\n\tscanf(\"%d %d %d %d %lf\",&l,&r,&x,&y,&k);\n\tfor(int i=l;i<=r;i++){\n\t\tb=(double)i/k;\n\t\tif(b>=x && b<=y && b==floor(b)){\n\t\t\tend=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(end==1)\t{printf(\"YES\");}\n\telse\t\t{printf(\"NO\");}\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n long long int l,r,x,y;\n float k;\n scanf(\"%I64d%I64d%I64d%I64d%f\",&l,&r,&x,&y,&k);\n long long int ans,i,j;\n ans=0;\n for (i=x; i<=y; i++)\n {\n j=i*k;\n if(l<=j && j<=r)\n {\n ans=1;\n break;\n }\n }\n if(ans==1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n long long int l,r,x,y,k;\n scanf(\"%I64d%I64d%I64d%I64d%I64d\",&l,&r,&x,&y,&k);\n long long int ans,i,j,d;\n d=(y-x)/2;\n ans=0;\n while(x<=y)\n {\n j=x*k;\n if(l<=j && j<=r)\n {\n ans=1;\n break;\n }\n else if((x+d)*kr){\n y=x+d;\n d=(y-x)/2;\n }\n x+=1;\n }\n if(ans){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n long long int l,r,x,y;\n float k;\n scanf(\"%I64d%I64d%I64d%I64d%f\",&l,&r,&x,&y,&k);\n long long int ans,i,j,d;\n d=(y-x)/2;\n ans=0;\n while(x<=y)\n {\n j=x*k;\n if(l<=j && j<=r)\n {\n ans=1;\n break;\n }\n else if((x+d)*kr){\n y=x+d;\n d=(y-x)/2;\n }\n x+=1;\n }\n if(ans==1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int l,r,x,y,k;\n scanf(\"%I64d%I64d%I64d%I64d%I64d\",&l,&r,&x,&y,&k);\n long long int ans,j;\n ans=0;\n while(x<=y)\n {\n j=x*k;\n if(l<=j && j<=r)\n {\n ans=1;\n break;\n }\n x+=1;\n }\n if(ans){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n long long int l,r,x,y;\n float k;\n scanf(\"%I64d%I64d%I64d%I64d%f\",&l,&r,&x,&y,&k);\n long long int ans,j;\n ans=0;\n while(x<=y)\n {\n j=x*k;\n if(l<=j && j<=r)\n {\n ans=1;\n break;\n }\n x+=1;\n }\n if(ans==1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n int l, r, x, y, k;\n scanf(\"%d%d%d%d%d\", &l, &r, &x, &y, &k);\n int a, b;\n for (a = l, b = x; a <= r && b <= y && a != b * k;) {\n while ((long long)b * k < a)\n b++;\n while ((long long)b * k > a)\n a++;\n }\n if (a <= r && b <= y && (a == (long long)b * k))\n puts(\"YES\");\n else\n puts(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n long long l,r,x,y,k,a,f=0;\n scanf(\"%lld%lld%lld%lld%lld\",&l,&r,&x,&y,&k);\n long long ar[y-x+1];\n a=x;\n for(int i=0;i=l))\n {\n f=1;\n break;\n }\n }\n if(f==1)\n printf(\"%s\",\"YES\");\n else\n printf(\"%s\",\"NO\");\n return 0;\n}"}, {"source_code": "#include\n\n\nmain()\n{\n int l,r,x,y;\n int i,j;\n float k;\n scanf(\"%d %d %d %d %f\",&l,&r,&x,&y,&k);\n for(i=1;i<=10000000;i++)\n if((k*i>=l&&k*i<=r)&&(i>=x&&i<=y))\n {\n printf(\"YES\");\n return 0;\n }\n printf(\"NO\");\n}\n"}, {"source_code": "#include\nint main()\n{\n\tdouble l, r, x, y, k, i, m,flag;\n\tflag = 1;\n\tscanf(\"%lf%lf%lf%lf%lf\",&l,&r,&x,&y,&k);\n\tif (k >= l/y && k <= r/x)\n\tfor(i = x;i <= y;i++)\n\t{\n\t\tm = k*i;\n\t\tif(m>=l&&m<=r)\n\t\t{\n\t\t\tprintf(\"YES\");\n\t\t\tflag = 0;\n\t\t\tbreak;\n\t\t}\n\t } \n\t \n\t if(flag ==\t 1)\n\t printf(\"NO\");\n\t\n\treturn 0;\n } \n"}, {"source_code": "#include\n#include\nint main()\n{\n\tint l, r, x, y;\n\tdouble k;\n\tint i;\n\tscanf(\"%d%d%d%d%lf\",&l,&r,&x,&y,&k);\n\tfor (i=x;i<=y;i++) \n\t{\n\t\tif (i*k<=r&&i*k>=l) \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\nint main()\n{\n long long int l,r,x,y,k,a,b,c,d,f;\n scanf(\"%lld %lld %lld %lld %lld\",&l,&r,&x,&y,&k);\n if(x*k>r||y*k=x&&(a/k)<=y)\n {\n printf(\"YES\\n\");\n }\n else if(d>=l&&(d/k)>=x&&(d/k)<=y)\n {\n printf(\"YES\\n\");\n }\n else if(d>a)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int l,r,x,y,k;\n scanf(\"%I64d%I64d%I64d%I64d%I64d\",&l,&r,&x,&y,&k);\n long long int ans,i,j,d;\n d=(y-x)/2;\n ans=0;\n while(x<=y)\n {\n j=x*k;\n if(l<=j && j<=r)\n {\n ans=1;\n break;\n }\n else if((x+d)*kr){\n y=x+d;\n d=(y-x)/2;\n }\n x+=1;\n }\n if(ans){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n}"}], "negative_code": [{"source_code": "#include\nint main()\n{\n int l, r, x, y , a ,b, i, j;\n double k ,an;\n scanf(\"%d %d %d %d %lf\", &l, &r, &x, &y, &k);\n a=(r-l+1);\n b=(y-x+1);\n if(l<=a && a<=r && x<=b && b<=y)\n {\n for(i=l; i<=r; i++)\n {\n for(j=x; j<=y; j++)\n {\n an=(i/j);\n if(an==k)\n {\n printf(\"YES\\n\");\n return 0;\n }\n }\n }\n }\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include \n\ntypedef long long ll;\n\n\nint main()\n{\n ll l,r,x,y,i,j,k;\n double c;\n\n scanf(\"%I64d %I64d %I64d %I64d %I64d\",&l,&r,&x,&y,&k);\n\n /*for(i=l; i<=r; i++)\n {\n for(j=x; j<=y; j++)\n {\n a=i;\n b=j;\n\n }\n\n }*/\n c= (r/x);\n\n if(c < k)\n {\n printf(\"NO\");\n\n }\n else\n printf(\"YES\");\n\n\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n long long int l,r,x,y,k,i;\n int a=0;\n scanf(\"%lld %lld %lld %lld %lld\",&l,&r,&x,&y,&k);\n if (x>r)\n {\n printf(\"NO\\n\");\n }\n else\n {\n for (i=l; i<=r; i++)\n {\n if ((i/k) >=x && (i/k) <=y)\n {\n a++;\n }\n if (a>0)\n {\n break;\n }\n }\n if (a>0)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nint main (void)\n{\n\tint l, r, x, y, k, i;\n\tscanf(\"%d\", &l);\n\tscanf(\"%d\", &r);\n\tscanf(\"%d\", &x);\n\tscanf(\"%d\", &y);\n\tscanf(\"%d\", &k);\n\tfor (i = x; i < y; i++)\n\t\tif ((k * i >= l) && (k * i <= r)){\n\t\t\tputs(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\tputs(\"NO\");\n\treturn 0;\n}\n\n"}, {"source_code": "#include \n\nint main()\n{\n long long int l,r,x,y,i,j;\n double k,m;\n scanf(\"%I64d %I64d %I64d %I64d %lf\",&l,&r,&x,&y,&k);\n\n if((r/x)\nint main()\n{\n\n double k,l,r,x,y;\n scanf(\"%d%d%d%d%d\",&l,&r,&x,&y,&k);\n if(r/x>=k&&l/y<=k) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n#define PRINT 0\n\nint main(){\n\tint l,r,x,y;\n\tint k;\n\tscanf(\"%d %d %d %d %d\",&l, &r, &x, &y, &k);\n\tint i,j=0;\n\tfor(i = x; i <= y; i++){\n\t\tif(k*i >= l && k*i <= r){\n\t\t\tprintf(\"YES\");\n\t\t\tj = 1;\n\t\t}\n\t}\n\t\tif(j == 0)\n\t\t\tprintf(\"NO\");\n}"}, {"source_code": "#include\nint main()\n{\n int l, r, x, y , a ,b, i, j, k ,an;\n scanf(\"%d %d %d %d %d\", &l, &r, &x, &y, &k);\n a=(r-l+1);\n b=(y-x+1);\n if(l<=a && a<=r && x<=b && b<=y)\n {\n for(i=l; i<=r; i++)\n {\n for(j=x; j<=y; j++)\n {\n an=(i/j);\n if(an==k)\n {\n printf(\"YES\\n\");\n return 0;\n }\n }\n }\n }\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int i,j;\n int l,r,x,y;\n double k;\n scanf(\"%d %d %d %d %lf\",&l,&r,&x,&y,&k);\n for(i=l;i<=r;i++)\n {\n if(i*k<=y&&i*k>=x)\n {\n printf(\"YES\");\n exit(0);\n }\n } \n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\nint main()\n{\n\tlong int l,r,x,y,k,i,j,c=0;\n\tscanf(\"%ld\",&l);\n\tscanf(\"%ld\",&r);\n\tscanf(\"%ld\",&x);\n\tscanf(\"%ld\",&y);\n\tscanf(\"%ld\",&k);\n\tif(l<=r && x<=y && r/x >= k)\n\t{\n\t\tfor(i=x;i<=y;i++)\n\t\t{\n\t\t\tfor(j=i;j<=r;j++)\n\t\t\t{\n\t\t\t\tif(j/i == k && j%i == 0)\n\t\t\t\t{\n\t\t\t\t\tc++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(c!=0)\n\t\t\tbreak;\n\t\t}\n\t}\n\t\tif(c!=0)\n\t\tprintf(\"YES\");\n\t\telse\n\t\tprintf(\"NO\");\n\t\n\treturn 0;\n}\n\n"}, {"source_code": "#include \n#include \n#include \n// #define f(i,x,y) for(i=x;i r || temp2 < l)\n\t{\n\t\tprintf(\"NO\");\n\t\treturn 0;\n\t}\n\n\tfor(i=l;i<=r;i++)\n\t{\n\t\tfor(int j=x;j\n\nint main()\n{\n\tlong long int l,r,x,y,k,i;\n\tscanf(\"%d%d%d%d%d\",&l,&r,&x,&y,&k);\n\t\n\tfor(i= x; i<=y ; i++)\n\t{\n\t\tlong long int val;\n\t\tval = i*k;\n\t\tif(val>=l && val<=r)\n\t\t{\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\t\tprintf(\"No\");\n\t\treturn 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n\tint l,r,x,y,i;\n\tdouble k;\n scanf(\"%d %d %d %d\",&l,&r,&x,&y); \n\tfor(i=x;i<=y;i++) \n\t{\n\t if (i*k<=r&&i*k>=l) \n\t\t{\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n long long int l,r,x,y,i,j,z;\n double k,m;\n scanf(\"%I64d %I64d %I64d %I64d %lf\",&l,&r,&x,&y,&k);\n z=k;\n if((r/x)\nint main()\n{\n\tdouble l, r, x, y, k;\n\tscanf(\"%lf%lf%lf%lf%lf\",&l,&r,&x,&y,&k);\n\t\n\tif(k >= l/y && k <= r/x)\n\tprintf(\"YES\");\n\telse\n\tprintf(\"NO\"); \n\t\n\t\n\treturn 0;\n } \n"}, {"source_code": "#include\nint main(){\n int l,r,x,y,k;\n scanf(\"%d%d%d%d%d\",&l,&r,&x,&y,&k);\n int a,b;\n int find=0;\n for(b=x;b<=y;b++){\n if(l<=b*k && b*k<=r){\n find=1;\n break;\n }\n }\n if(find){\n printf(\"YES\\n\");\n }else{\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#define PRINT 0\n\nint main(){\n\tint l,r,x,y,k;\n\tscanf(\"%d %d %d %d %d\",&l, &r, &x, &y, &k);\n\tint i,j;\n\tdouble t,max=0,that1 = (r/x),that2 = (l/y);\n\tif(k >= (int)that2 && k <= (int)that1){\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t\tprintf(\"NO\");\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n float l,r,x,y,a,b, bOriginal;\n int bool=0;\n float k;\n scanf(\"%f %f %f %f %f\",&l, &r, &x, &y, &k);\n bOriginal=b;\n a=l;\n b=x;\n while (a\n\nint main() {\n\tint l, r, x, y, k;\n\tscanf(\"%d%d%d%d%d\", &l, &r, &x, &y, &k);\n\tif((l/x < k || ((l/x)*x == l) && l/x <= k) && k <= r/x) {\n\t\tprintf(\"YES\\n\");\n\t} else {\n\t\tprintf(\"NO\\n\");\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n int i,j;\n int l,r,x,y;\n double k;\n scanf(\"%d %d %d %d %lf\",&l,&r,&x,&y,&k);\n for(i=l;i<=r;i++)\n {\n if(i*k<=y&&i*k>=x)\n {\n printf(\"YES\");\n exit(0);\n }\n } \n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tlong long int l,r,x,y,k,i;\n\tscanf(\"%d%d%d%d%d\",&l,&r,&x,&y,&k);\n\t\n\tfor(i= x; i<=y ; i++)\n\t{\n\t\tlong long int val;\n\t\tval = i*k;\n\t\tif(val>=l && val<=r)\n\t\t{\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\t\tprintf(\"No\");\n\t\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n long long int l,r,x,y,i,j,c=0;\n float k,a,b;\n scanf(\"%I64d %I64d %I64d %I64d %f\",&l,&r,&x,&y,&k);\n\n for(i=l;i<=r;i++){\n for(j=x;j<=y;j++){\n a=i;\n b=j;\n if(a/b==k){\n c=1;\n }\n else{\n c=0;\n }\n }\n }\n if(c==1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nint main (void)\n{\n\tint l, r, x, y, k, i;\n\tscanf(\"%d\", &l);\n\tscanf(\"%d\", &r);\n\tscanf(\"%d\", &x);\n\tscanf(\"%d\", &y);\n\tscanf(\"%d\", &k);\n\tfor (i = x; i < y; i++)\n\t\tif ((k * i >= l) && (k * i <= r)){\n\t\t\tputs(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\tputs(\"NO\");\n\treturn 0;\n}\n\n"}, {"source_code": "#include\nmain()\n{\n float a,b,c,d,i,j,k,f=0,e;\n scanf(\"%f%f%f%f%f\",&a,&b,&c,&d,&e);\n for(i=a;i<=b;i++)\n {\n e=e*1.0;\n k=a/e;\n if(k>=c&&k<=d)\n {\n f=1;\n printf(\"YES\");\n break;\n }\n }\n if(f==0)\n printf(\"NO\");\n}\n"}, {"source_code": "#include \n\nint main(void){\n\tlong long int l, r, x, y, k;\n\tscanf(\"%lld%lld%lld%lld%lld\",&l,&r,&x,&y,&k);\n\tlong long int a = 1;\n\tif(l > x){\n\t a = l;\n\t} else{\n\t a = x;\n\t}\n\tlong long int flag = 0;\n\twhile(k*a <= r && a <= y){\n\t\tif(k*a <= r && a <= y){\n\t\t\tflag = 1;\n\t\t\tbreak;\n\t\t}\n\t\ta++;\n\t}\n\tif(flag == 1){\n\t\tprintf(\"YES\\n\");\n\t} else{\n\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main() {\n int l, r, x, y, ef, count = 0;\n scanf(\"%d %d %d %d %d\", &l, &r, &x, &y, &ef);\n\n int xp_mid, c_mid, find = 0;\n while (l <= r) {\n xp_mid = (l + r) / 2;\n while (x <= y) {\n c_mid = (x + y) / 2;\n\n if (ef > xp_mid / c_mid) {\n y = c_mid - 1;\n } else if (ef < xp_mid / c_mid) {\n x = c_mid + 1;\n } else if (ef == xp_mid / c_mid) {\n printf(\"YES\\n\");\n find = 1;\n break;\n }\n }\n\n if (find)\n break;\n else {\n if (ef > xp_mid / c_mid) {\n l = xp_mid + 1;\n } else if (ef < xp_mid / c_mid) {\n r = xp_mid - 1;\n } else if (ef == xp_mid / c_mid) {\n printf(\"YES\\n\");\n find = 1;\n break;\n }\n }\n }\n\n if (!find)\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n float l,r,x,y,a,b, bool=0, bOriginal;\n float k;\n scanf(\"%f %f %f %f %f\",&l, &r, &x, &y, &k);\n bOriginal=b;\n a=l;\n b=x;\n while (a\n\nint main()\n{\n long long int l,r,x,y,i,j,c=0;\n float k,a,b;\n scanf(\"%I64d %I64d %I64d %I64d %f\",&l,&r,&x,&y,&k);\n\n for(i=l;i<=r;i++){\n for(j=x;j<=y;j++){\n a=i;\n b=j;\n if(a/b==k){\n c=1;\n }\n else{\n c=0;\n }\n }\n }\n if(c==1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(){\n\tint l, r, x, y, k, i;\n\tdouble divisao, k2, i2;\n\tint a;\n\n\tscanf(\"%d%d%d%d%d\", &l, &r, &x, &y, &k);\n\n\tfor(i = 1; i <= k; i++){\n\t\ti2 = i;\n\t\tk2 = k;\n\t\ta = k/i;\n\t\tdivisao = k2/i2;\n\t\tprintf(\"%lf\\n%lf\\n\", i2, k2);\n\t\tprintf(\"%lf\\n\", divisao);\n\t\tif(divisao - a == 0){\n\t\t\tif(((i >= l && i <= r) && (a >= x && a <= y)) || ((a >= l && a <= r) && (i >= x && i <= y))){\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/* 1505849059230 */\n"}, {"source_code": "#include \n\nint main()\n{\n long long int l,r,x,y,i,j,z;\n double k,m;\n scanf(\"%I64d %I64d %I64d %I64d %lf\",&l,&r,&x,&y,&k);\n z=k;\n if((r/x)\n\nint main(void){\n\tlong long int l, r, x, y, k;\n\tscanf(\"%lld%lld%lld%lld%lld\",&l,&r,&x,&y,&k);\n\tlong long int a = x;\n\tif(k * a < l){\n\t if(l % k ==0){\n\t a = k/l;\n\t } else{\n\t a = k/l+1;\n\t }\n\t}\n\tlong long int flag = 0;\n\twhile(k*a <= r && a <= y){\n\t\tif(k*a <= r && a <= y){\n\t\t\tflag = 1;\n\t\t\tbreak;\n\t\t}\n\t\ta++;\n\t}\n\tif(flag == 1){\n\t\tprintf(\"YES\\n\");\n\t} else{\n\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n long long int l,r,x,y,k,i,j,c=0;\n scanf(\"%I64d %I64d %I64d %I64d %I64d\",&l,&r,&x,&y,&k);\n\n for(i=l;i<=r;i++){\n for(j=x;j<=y;j++){\n if(i/j==k){\n c=1;\n }\n else{\n c=0;\n }\n }\n }\n if(c==1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#define ll long long\n\nint main()\n{\n\tll l, r, x, y, k;\n\tscanf(\"%I64d %I64d %I64d %I64d %I64d\", &l, &r, &x, &y, &k);\n\tif(l > y * k)\n\t{\n\t\tprintf(\"NO\\n\");\n\t}\n\telse if(l >= x * k && l <= y * k)\n\t{\n\t\tif(l % k == 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(r >= x * k && r <= y * k && r % k == 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\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n long long int l,r,x,y,i,j,c=0;\n double k,a,b;\n scanf(\"%I64d %I64d %I64d %I64d %lf\",&l,&r,&x,&y,&k);\n\n for(i=l;i<=r;i++){\n for(j=x;j<=y;j++){\n a=i;\n b=j;\n if(b/a==k){\n c=1;\n }\n else{\n c=0;\n }\n }\n }\n if(c==1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n long long int l,r,x,y,i,j,c=0;\n double k,a,b;\n scanf(\"%I64d %I64d %I64d %I64d %lf\",&l,&r,&x,&y,&k);\n\n for(i=l;i<=r;i++){\n for(j=x;j<=y;j++){\n a=i;\n b=j;\n if(a/b==k){\n c=1;\n }\n else{\n c=0;\n }\n }\n }\n if(c==1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n// #define f(i,x,y) for(i=x;i r || temp2 < l)\n\t{\n\t\tprintf(\"NO\");\n\t\treturn 0;\n\t}\n\n\tfor(i=l;i<=r;i++)\n\t{\n\t\tfor(int j=x;j\n\nint main(void){\n\tlong long int l, r, x, y, k;\n\tscanf(\"%lld%lld%lld%lld%lld\",&l,&r,&x,&y,&k);\n\tlong long int a = 1;\n\tif(l > x){\n\t a = l;\n\t} else{\n\t a = x;\n\t}\n\tlong long int flag = 0;\n\twhile(k*a <= r && a <= y){\n\t\tif(k*a <= r && a <= y){\n\t\t\tflag = 1;\n\t\t\tbreak;\n\t\t}\n\t\ta++;\n\t}\n\tif(flag == 1){\n\t\tprintf(\"YES\\n\");\n\t} else{\n\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n long long int l,r,x,y,i,j;\n double k,m;\n scanf(\"%I64d %I64d %I64d %I64d %lf\",&l,&r,&x,&y,&k);\n\n if((r/x)\n\nint main (void)\n{\n\tunsigned long long l, r, x, y, k, i;\n\tscanf(\"%d\", &l);\n\tscanf(\"%d\", &r);\n\tscanf(\"%d\", &x);\n\tscanf(\"%d\", &y);\n\tscanf(\"%d\", &k);\n\tfor (i = x; i <= y; i++)\n\t\tif ((k * i >= l) && (k * i <= r)){\n\t\t\tputs(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\tputs(\"NO\");\n\treturn 0;\n}\n\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n float l,r,x,y,a,b, bOriginal;\n int bool=0;\n float k;\n scanf(\"%f %f %f %f %f\",&l, &r, &x, &y, &k);\n bOriginal=b;\n a=l;\n b=x;\n while (a\nint main()\n{\nint l,r,x,y,k,i,j;\nscanf(\"%d%d%d%d%d\",&l,&r,&x,&y,&k);\nfor(i=x;i<=y;i++)\n{\nj=i*k;\nif(j>=l&&j<=r)\n{printf(\"YES\");\nbreak;}\nprintf(\"NO\");\nreturn 0;}}\n"}, {"source_code": "#include \n\ntypedef long long ll;\n\n\nint main()\n{\n ll l,r,x,y;\n int i, j=0;\n double k;\n\n scanf(\"%I64d %I64d %I64d %I64d %lf\",&l, &r, &x, &y, &k);\n\n for(i=x; i <= y; i++)\n {\n if(k*i >= l && k*i <=r)\n printf(\"YES\");\n j = 1;\n break;\n }\n\n if(j==0)\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n long long int l,r,x,y,k,i,j,c=0;\n scanf(\"%I64d %I64d %I64d %I64d %I64d\",&l,&r,&x,&y,&k);\n\n for(i=l;i<=r;i++){\n for(j=x;j<=y;j++){\n if(i/j==k){\n c=1;\n }\n else{\n c=0;\n }\n }\n }\n if(c==1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\nint main()\n{\n\tlong int l,r,x,y,k,i,j,c=0;\n\tscanf(\"%ld\",&l);\n\tscanf(\"%ld\",&r);\n\tscanf(\"%ld\",&x);\n\tscanf(\"%ld\",&y);\n\tscanf(\"%ld\",&k);\n\tif(l<=r && x<=y )\n\t{\n\t\tfor(i=l;i<=r;i++)\n\t\t{\n\t\t\tfor(j=x;j<=y;j++)\n\t\t\t{\n\t\t\t\tif(i/j == k && i%j != 0)\n\t\t\t\tc++;\n\t\t\t}\n\t\t}\n\t\tif(c!=0)\n\t\tprintf(\"YES\");\n\t\telse\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include\n#include\n#include\n\nint main()\n{\n double j, l, r, x, y;\n \n double k,p,i;\n \n scanf(\"%lf %lf %lf %lf %lf\",&l, &r,&x,&y,&k);\n int flag=0;\n\n i=l;\n j=x;\n\n while(i<=r)\n {\n p=k*i;\n if(p>=x && p<=y)\n {\n flag=2;\n break;\n }\n else\n i++;\n }\n\n if(flag==2)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n \n \n return 0;\n\n\n}\n\n"}, {"source_code": "#include \n\nint main()\n{\n int l, r, x, y, k;\n scanf(\"%d%d%d%d%d\", &l, &r, &x, &y, &k);\n int a, b;\n for (a = l, b = x; a <= r && b <= y && a != b * k;) {\n while ((long long)b * k < a)\n b++;\n while ((long long)b * k > a)\n a++;\n }\n if (a <= r && b <= y && (a == b * k))\n puts(\"YES\");\n else\n puts(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int l, r, x, y, k;\n int i;\n\n scanf(\"%d%d%d%d%d\", &l, &r, &x, &y, &k);\n\n if(r-l < y-x){\n for(i = l; i <= r; i++){\n if(i%k == 0 && i/k <= y && i/k >= x){\n printf(\"YES\");\n return 0;\n }\n }\n }else{\n for(i = x; i <= y; i++){\n if(i%k == 0 && i/k <= r && i/k >= l){\n printf(\"YES\");\n return 0;\n }\n }\n }\n printf(\"NO\\n\");\n return 0;\n}\n/* 1505948202137 */\n"}, {"source_code": "#include \n\nint main()\n{\n long long int l,r,x,y,i,j,c=0;\n float k,a,b;\n scanf(\"%I64d %I64d %I64d %I64d %f\",&l,&r,&x,&y,&k);\n\n for(i=l;i<=r;i++){\n for(j=x;j<=y;j++){\n a=i;\n b=j;\n if(a/b==k){\n c=1;\n }\n else{\n c=0;\n }\n }\n }\n if(c==1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(){\n\tint k, i, l, r, x ,y;\n\t\n\tscanf(\"%d%d%d%d%d\", &l, &r, &x, &y, &k);\n\t\n\tif(r-l <= x-y){\n\t\tfor(i = x; i <= y; i++){\n\t\t\tif(k*i <= r && k*i >= l){\n\t\t\t\tprintf(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}else{\n\t\tfor(i = l; i <= r; i++){\n\t\t\tif(k%i == 0 && k/i <= y && k/i >= x){\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/* 1506175845818 */\n"}, {"source_code": "#include \n\nint main() {\n int l, r, x, y, ef, count = 0;\n scanf(\"%d %d %d %d %d\", &l, &r, &x, &y, &ef);\n\n int n = (r - l + 1) * (y - x + 1);\n int potion[n];\n for (int a = l; a < r; a++) {\n for (int b = x; b < y; b++) {\n potion[count] = a / b;\n count++;\n }\n }\n\n count = 1;\n for (int i = 0; i < n; i++) {\n if (potion[i] == ef) {\n printf(\"YES\\n\");\n count = 0;\n break;\n }\n }\n\n if (count)\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main (void)\n{\n\tint l, r, x, y, k, i;\n\tscanf(\"%d\", &l);\n\tscanf(\"%d\", &r);\n\tscanf(\"%d\", &x);\n\tscanf(\"%d\", &y);\n\tscanf(\"%d\", &k);\n\tfor (i = x; i < y; i++)\n\t\tif ((k * i >= l) && (k * i <= r)){\n\t\t\tputs(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\tputs(\"NO\");\n\treturn 0;\n}\n\n"}, {"source_code": "#include\n#include\nint main()\n{\n int i,j;\n int l,r,x,y;\n float k;\n scanf(\"%d %d %d %d %f\",&l,&r,&x,&y,&k);\n for(i=l;i<=r;i++)\n {\n if(i*k<=y&&i*k>=x)\n {\n printf(\"YES\");\n exit(0);\n }\n } \n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\n double k,l,r,x,y;\n scanf(\"%d%d%d%d%d\",&l,&r,&x,&y,&k);\n if(r/x>=k&&l/y<=k) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int l,r,x,y,k;\n scanf(\"%lld %lld %lld %lld %lld\",&l,&r,&x,&y,&k);\n if(l*k>y||r*k\n\nint main (void)\n{\n\tlong l, r, x, y, k, i;\n\tscanf(\"%d\", &l);\n\tscanf(\"%d\", &r);\n\tscanf(\"%d\", &x);\n\tscanf(\"%d\", &y);\n\tscanf(\"%d\", &k);\n\tfor (i = x; i < y+1; i++)\n\t\tif ((k * i >= l) && (k * i <= r)){\n\t\t\tputs(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\tputs(\"NO\");\n\treturn 0;\n}\n\n"}, {"source_code": "#include \n#include \nint main()\n{\n\tlong int l,r,x,y,k,i,j,temp,check;\n\tscanf(\"%ld %ld %ld %ld %ld\",&l, &r, &x, &y, &k);\n\tif(r= k;i++)\n\t\t{\n\t\t\tfor(j = x;j<=y && j<=i;j++)\n\t\t\t{\n\t\t\t\tif(i%j == 0)\n\t\t\t\t{\n\t\t\t\t\tif(k == i/j)\n\t\t\t\t\t{\n\t\t\t\t\t\tprintf(\"YES\");\n\t\t\t\t\t\tcheck = 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\tif(check == 1)\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(check == 0)\n\t\t{\n\t\t\tprintf(\"NO\");\n\t\t}\n\t}\n}"}, {"source_code": "#include\nint main()\n{\n int l, r, x, y, k, a, b;\n scanf(\"%d %d %d %d %d\", &l, &r, &x, &y, &k);\n a=(y-x+1);\n b=(r-l+1);\n if(a>=l && a<=r && x<=b && b<=y && l<=r && x<=y){\n if(a/b==k)\n printf(\"YES\\n\");\n }\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(void){\n\tlong long int l, r, x, y, k;\n\tscanf(\"%lld%lld%lld%lld%lld\",&l,&r,&x,&y,&k);\n\tlong long int a = 1;\n\tif(l%k == 0){\n\t a = l/k;\n\t} else{\n\t a = l/k + 1;\n\t}\n\tlong long int flag = 0;\n\twhile(k*a <= r && a <= y){\n\t\tif(k*a <= r && a <= y){\n\t\t\tflag = 1;\n\t\t\tbreak;\n\t\t}\n\t\ta++;\n\t}\n\tif(flag == 1){\n\t\tprintf(\"YES\\n\");\n\t} else{\n\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main(){\n\tint l,r,x,y,k;\n\tscanf(\"%d%d%d%d%d\", &l, &r, &x, &y, &k);\n\tfor(int i=x; i<=y;i++)\n\t\tif(k*i>=l && k*i<=r && (k*i)%1==0)\n\t\t{\n\t\t\tprintf(\"YES\\n\");\n\t\t\treturn 0;\n\t\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include \n#define ll long long\n\nint main()\n{\n\tll l, r, x, y, k;\n\tscanf(\"%I64d %I64d %I64d %I64d %I64d\", &l, &r, &x, &y, &k);\n\tif(l > y * k)\n\t{\n\t\tprintf(\"NO\\n\");\n\t}\n\telse if(l >= x * k && l <= y * k)\n\t{\n\t\tif(l % k == 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(r >= x * k && r <= y * k && r % k == 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\treturn 0;\n}\n"}, {"source_code": "#include \n\ntypedef long long ll;\n\n\nint main()\n{\n ll l,r,x,y,i,j,k;\n double c;\n\n scanf(\"%I64d %I64d %I64d %I64d %I64d\",&l,&r,&x,&y,&k);\n\n /*for(i=l; i<=r; i++)\n {\n for(j=x; j<=y; j++)\n {\n a=i;\n b=j;\n\n }\n\n }*/\n c= (r/x);\n\n if(c < k)\n {\n printf(\"NO\");\n\n }\n else\n printf(\"YES\");\n\n\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n long long int l,r,x,y,k,i;\n int a=0;\n scanf(\"%lld %lld %lld %lld %lld\",&l,&r,&x,&y,&k);\n if (x>r)\n {\n printf(\"NO\\n\");\n }\n else\n {\n for (i=l; i<=r; i++)\n {\n if ((i/k) >=x && (i/k) <=y)\n {\n a++;\n }\n if (a>0)\n {\n break;\n }\n }\n if (a>0)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n long long int l,r,x,y,i,j,c=0;\n double k,a,b;\n scanf(\"%I64d %I64d %I64d %I64d %lf\",&l,&r,&x,&y,&k);\n\n for(i=l;i<=r;i++){\n for(j=x;j<=y;j++){\n a=i;\n b=j;\n if(b/a==k){\n c=1;\n }\n else{\n c=0;\n }\n }\n }\n if(c==1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n int l, r, x, y, ef, count = 0;\n scanf(\"%d %d %d %d %d\", &l, &r, &x, &y, &ef);\n\n int n = (r - l + 1) * (y - x + 1);\n int potion[n];\n for (int a = l; a < r; a++) {\n for (int b = x; b < y; b++) {\n potion[count] = a / b;\n count++;\n }\n }\n\n count = 1;\n for (int i = 0; i < n; i++) {\n if (potion[i] == ef) {\n printf(\"YES\\n\");\n count = 0;\n break;\n }\n }\n\n if (count)\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\nint main()\n{\n\tlong int l,r,x,y,k,i,j,c=0;\n\tscanf(\"%ld\",&l);\n\tscanf(\"%ld\",&r);\n\tscanf(\"%ld\",&x);\n\tscanf(\"%ld\",&y);\n\tscanf(\"%ld\",&k);\n\tif(l<=r && x<=y )\n\t{\n\t\tfor(i=l;i<=r;i++)\n\t\t{\n\t\t\tfor(j=x;j<=y;j++)\n\t\t\t{\n\t\t\t\tif(i/j == k && i%j != 0)\n\t\t\t\tc++;\n\t\t\t}\n\t\t}\n\t\tif(c!=0)\n\t\tprintf(\"YES\");\n\t\telse\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include\nmain()\n{\n float a,b,c,d,i,j,k,f=0,e;\n scanf(\"%f%f%f%f%f\",&a,&b,&c,&d,&e);\n for(i=a;i<=b;i++)\n {\n e=e*1.0;\n k=a/e;\n if(k>=c&&k<=d)\n {\n f=1;\n printf(\"YES\");\n break;\n }\n }\n if(f==0)\n printf(\"NO\");\n}\n"}, {"source_code": "#include \n\nint main()\n{\n long long int l,r,x,y,i,j,c=0;\n double k,a,b;\n scanf(\"%I64d %I64d %I64d %I64d %lf\",&l,&r,&x,&y,&k);\n\n for(i=l;i<=r;i++){\n for(j=x;j<=y;j++){\n a=i;\n b=j;\n if(b/a==k){\n c=1;\n }\n else{\n c=0;\n }\n }\n }\n if(c==1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(void){\n\tlong long int l, r, x, y, k;\n\tscanf(\"%lld%lld%lld%lld%lld\",&l,&r,&x,&y,&k);\n\tlong long int a = 1;\n\tif(l%k == 0){\n\t a = l/k;\n\t} else{\n\t a = l/k + 1;\n\t}\n\tlong long int flag = 0;\n\twhile(k*a <= r && a <= y){\n\t\tif(k*a <= r && a <= y){\n\t\t\tflag = 1;\n\t\t\tbreak;\n\t\t}\n\t\ta++;\n\t}\n\tif(flag == 1){\n\t\tprintf(\"YES\\n\");\n\t} else{\n\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n int i,j;\n int l,r,x,y;\n double k;\n scanf(\"%d %d %d %d %lf\",&l,&r,&x,&y,&k);\n for(i=l;i<=r;i++)\n {\n if(i*k<=y&&i*k>=x)\n {\n printf(\"YES\");\n exit(0);\n }\n } \n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n float l,r,x,y,a,b, bool=0, bOriginal;\n float k;\n scanf(\"%f %f %f %f %f\",&l, &r, &x, &y, &k);\n bOriginal=b;\n a=l;\n b=x;\n while (a\n\ntypedef long long ll;\n\n\nint main()\n{\n ll l,r,x,y,i,j,k;\n double c;\n\n scanf(\"%I64d %I64d %I64d %I64d %I64d\",&l,&r,&x,&y,&k);\n\n /*for(i=l; i<=r; i++)\n {\n for(j=x; j<=y; j++)\n {\n a=i;\n b=j;\n\n }\n\n }*/\n c= (r/x);\n\n if(c < k)\n {\n printf(\"NO\");\n\n }\n else\n printf(\"YES\");\n\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int l, r, x, y, k, a, b;\n scanf(\"%d %d %d %d %d\", &l, &r, &x, &y, &k);\n a=(y-x+1);\n b=(r-l+1);\n if(a>=l && a<=r && x<=b && b<=y && l<=r && x<=y){\n if(a/b==k)\n printf(\"YES\\n\");\n }\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int l, r, x, y , a ,b;\n double k ,an;\n scanf(\"%d %d %d %d %lf\", &l, &r, &x, &y, &k);\n a=(r-l+1);\n b=(y-x+1);\n if(l<=a && a<=r && x<=b && b<=y)\n {\n an=a/b;\n if(an==k)\n printf(\"YES\\n\");\n\n else\n printf(\"NO\\n\");\n }\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n long long int l,r,x,y,i,j,c=0;\n double k,a,b;\n scanf(\"%I64d %I64d %I64d %I64d %lf\",&l,&r,&x,&y,&k);\n\n for(i=l;i<=r;i++){\n for(j=x;j<=y;j++){\n a=i;\n b=j;\n if(a/b==k){\n c=1;\n }\n else{\n c=0;\n }\n }\n }\n if(c==1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#define PRINT 0\n\nint main(){\n\tint l,r,x,y;\n\tint k;\n\tscanf(\"%d %d %d %d %d\",&l, &r, &x, &y, &k);\n\tint i,j=0;\n\tfor(i = x; i <= y; i++){\n\t\tif(k*i >= l && k*i <= r){\n\t\t\tprintf(\"YES\");\n\t\t\tj = 1;\n\t\t}\n\t}\n\t\tif(j == 0)\n\t\t\tprintf(\"NO\");\n}"}, {"source_code": "#include \n\nint main() {\n\tint l, r, x, y, k;\n\tscanf(\"%d%d%d%d%d\", &l, &r, &x, &y, &k);\n\tif((l/x < k || ((l/x)*x == l) && l/x <= k) && k <= r/x) {\n\t\tprintf(\"YES\\n\");\n\t} else {\n\t\tprintf(\"NO\\n\");\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main(void){\n\tint l, r, x, y, k;\n\tscanf(\"%d%d%d%d%d\",&l,&r,&x,&y,&k);\n\tif(k*x >= l && k*x <= r || k*y >= l && k*x <= r){\n\t printf(\"YES\\n\");\n\t} else{\n\t printf(\"NO\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n#define ll long long\n\nint main()\n{\n\tll l, r, x, y, k;\n\tscanf(\"%I64d %I64d %I64d %I64d %I64d\", &l, &r, &x, &y, &k);\n\tif(l > y * k)\n\t{\n\t\tprintf(\"NO\\n\");\n\t}\n\telse if(l >= x * k && l <= y * k)\n\t{\n\t\tprintf(\"YES\\n\");\n\t}\n\telse\n\t{\n\t\tif(r >= x * k && r <= y * k)\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\nint main()\n{\n int l, r, x, y, k, a, b;\n scanf(\"%d %d %d %d %d\", &l, &r, &x, &y, &k);\n a=(r-l+1);\n b=(y-x+1);\n if(a>=l && a<=r && x<=b && b<=y && l<=r && x<=y){\n if(a/b==k || b/a==k)\n printf(\"YES\\n\");\n\n else\n printf(\"NO\\n\");\n }\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int l, r, x, y, k;\n scanf(\"%d%d%d%d%d\", &l, &r, &x, &y, &k);\n int a, b;\n for (a = l, b = x; a <= r && b <= y && a != b * k;) {\n while ((long long)b * k < a)\n b++;\n while ((long long)b * k > a)\n a++;\n }\n if (a <= r && b <= y && (a == b * k))\n puts(\"YES\");\n else\n puts(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(void){\n\tlong long int l, r, x, y, k;\n\tscanf(\"%lld%lld%lld%lld%lld\",&l,&r,&x,&y,&k);\n\tlong long int a = 1;\n\tif(l%k == 0){\n\t a = l/k;\n\t} else{\n\t a = l/k + 1;\n\t}\n\tlong long int flag = 0;\n\twhile(k*a <= r && a <= y){\n\t\tif(k*a <= r && a <= y){\n\t\t\tflag = 1;\n\t\t\tbreak;\n\t\t}\n\t\ta++;\n\t}\n\tif(flag == 1){\n\t\tprintf(\"YES\\n\");\n\t} else{\n\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \nint main()\n{\n long long int l,r,x,y,k,i;\n int a=0;\n scanf(\"%lld %lld %lld %lld %lld\",&l,&r,&x,&y,&k);\n if (x>r)\n {\n printf(\"NO\\n\");\n }\n else\n {\n for (i=l; i<=r; i++)\n {\n if ((i/k) >=x && (i/k) <=y)\n {\n a++;\n }\n if (a>0)\n {\n break;\n }\n }\n if (a>0)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int l,r,x,y,k;\n scanf(\"%lld %lld %lld %lld %lld\",&l,&r,&x,&y,&k);\n if(x*k>l||y*k\n\ntypedef long long ll;\n\n\nint main()\n{\n ll l,r,x,y,i,j,k;\n double c;\n\n scanf(\"%I64d %I64d %I64d %I64d %I64d\",&l,&r,&x,&y,&k);\n\n /*for(i=l; i<=r; i++)\n {\n for(j=x; j<=y; j++)\n {\n a=i;\n b=j;\n\n }\n\n }*/\n c= (r/x);\n\n if(c < k)\n {\n printf(\"NO\");\n\n }\n else\n printf(\"YES\");\n\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(void){\n\tlong long int l, r, x, y, k;\n\tscanf(\"%lld%lld%lld%lld%lld\",&l,&r,&x,&y,&k);\n\tlong long int a = x;\n\tif(k * a < l){\n\t if(l % k ==0){\n\t a = k/l;\n\t } else{\n\t a = k/l+1;\n\t }\n\t}\n\tlong long int flag = 0;\n\twhile(k*a <= r && a <= y){\n\t\tif(k*a <= r && a <= y){\n\t\t\tflag = 1;\n\t\t\tbreak;\n\t\t}\n\t\ta++;\n\t}\n\tif(flag == 1){\n\t\tprintf(\"YES\\n\");\n\t} else{\n\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\n#include\n#define ll long long int\nint main()\n{\n ll l,r,x,y,k;\n scanf(\"%lld %lld %lld %lld %lld\",&l,&r,&x,&y,&k);\n ll i;\n bool key=false;\n for(i=x;i<=y;i++)\n {\n if(i*k<=r && i*k>=x)\n {\n key=true;\n break;\n }\n }\n if(key)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(void){\n\tint l, r, x, y, k;\n\tscanf(\"%d%d%d%d%d\",&l,&r,&x,&y,&k);\n\tif(k*x >= l && k*x <= r || k*y >= l && k*x <= r){\n\t printf(\"YES\\n\");\n\t} else{\n\t printf(\"NO\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n int l, r, x, y, k;\n int i;\n\n scanf(\"%d%d%d%d%d\", &l, &r, &x, &y, &k);\n\n if(r-l < y-x){\n for(i = l; i <= r; i++){\n if(i%k == 0 && i/k <= y && i/k >= x){\n printf(\"YES\");\n return 0;\n }\n }\n }else{\n for(i = x; i <= y; i++){\n if(i%k == 0 && i/k <= r && i/k >= l){\n printf(\"YES\");\n return 0;\n }\n }\n }\n printf(\"NO\\n\");\n return 0;\n}\n/* 1505948202137 */\n"}, {"source_code": "#include \n\nint main() {\n\tint l, r, x, y, k;\n\tscanf(\"%d%d%d%d%d\", &l, &r, &x, &y, &k);\n\tif((l/x < k || ((l/x)*x == l) && l/x <= k) && k <= r/x) {\n\t\tprintf(\"YES\\n\");\n\t} else {\n\t\tprintf(\"NO\\n\");\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include \n\ntypedef long long ll;\n\n\nint main()\n{\n ll l,r,x,y;\n int i, j=0;\n double k;\n\n scanf(\"%I64d %I64d %I64d %I64d %lf\",&l, &r, &x, &y, &k);\n\n for(i=x; i <= y; i++)\n {\n if(k*i >= l && k*i <=r)\n printf(\"YES\");\n j = 1;\n break;\n }\n\n if(j==0)\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int l, r, x, y, k , a ,b;\n scanf(\"%d %d %d %d %d\", &l, &r, &x, &y, &k);\n a=(r-l+1);\n b=(y-x+1);\n if(l<=a && a<=r && x<=b && b<=y)\n {\n if(a/b==k)\n printf(\"YES\\n\");\n\n else\n printf(\"NO\\n\");\n }\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n\tint l,r,x,y,k,i;\n\tscanf(\"%d%d%d%d%d\",&l,&r,&x,&y,&k);\n\tfor(i=x;i<=y;i++){\n\t\tif(k*i >= l && k*i<=r)break;\n\t}\n\tif(i<=y)printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\treturn 0;\n}"}, {"source_code": "#include\n#include\n#include\n\nint main()\n{\n long long int l, r, x, y;\n long long int j;\n long long int k,p,i;\n \n scanf(\"%lld %lld %lld %lld %lld\",&l, &r,&x,&y,&k);\n int flag=0;\n\n i=l;\n\n while(i<=r)\n {\n p=k*i;\n j=p;\n if(p>=x && p<=y )\n {\n flag=2;\n break;\n }\n else\n i++;\n }\n\n if(flag==2)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n \n \n return 0;\n\n\n}\n\n"}, {"source_code": "#include\nint main()\n{\n long long int l, r, x, y , a ,b, i, j, k ,an;\n scanf(\"%I64d %I64d %I64d %I64d %I64d\", &l, &r, &x, &y, &k);\n for(i=l; i<=r; i++)\n {\n for(j=x; j<=y; j++)\n {\n an=(i/j);\n if(an==k)\n {\n printf(\"YES\\n\");\n break;\n }\n }\n }\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(){\n\tint r, l, y, x, k;\n\tscanf(\"%d %d %d %d %d\", &l, &r, &x, &y, &k);\n\tif(r/k >= x && l/k <= y) \n\t\tputs(\"YES\");\n\telse \n\t\tputs(\"NO\");\t\n\t\nreturn 0;\n}\n/* 1505862784936 */\n"}, {"source_code": "#include \n\ntypedef long long ll;\n\n\nint main()\n{\n ll l,r,x,y,i,j,k,a,b;\n double c;\n\n scanf(\"%I64d %I64d %I64d %I64d %I64d\",&l,&r,&x,&y,&k);\n\n for(i=l; i<=r; i++)\n {\n for(j=x; j<=y; j++)\n {\n a=i;\n b=j;\n c= (a/b);\n\n }\n\n }\n\n if(c < k)\n {\n printf(\"NO\");\n\n }\n else\n printf(\"YES\");\n\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n#include \n#include \nint main(int argc, char const *argv[])\n{\n\tint l,r,x,y,k;\n\tscanf(\"%d %d %d %d %d\",&l,&r,&x,&y,&k);\n\tint t1,t2;\n\tif(k>l/y&&k\n#include \n\nint main()\n{\n float l,r,x,y,a,b, bool=0, bOriginal;\n float k;\n scanf(\"%f %f %f %f %f\",&l, &r, &x, &y, &k);\n bOriginal=b;\n a=l;\n b=x;\n while (a\n\nint main()\n{\n\tint x, y, l, r, k;\n\tscanf(\"%d%d%d%d%d\", &x, &y, &l, &r, &k);\n\tint flag = 0;\n\tfor (int i = l; i < r; i++)\n\t{\n\t\tif (k * i < y && k * i > x)\n\t\t{\n\t\t\tflag = 1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%s\\n\", flag ? \"YES\" : \"NO\");\n}"}, {"source_code": "#include \n\nint main() {\n int l, r, x, y, ef;\n scanf(\"%d %d %d %d %d\", &l, &r, &x, &y, &ef);\n\n float xp_mid, c_mid, find = 0;\n for (float i = l; i <= r; i += ef) {\n int xx = x, yy = y;\n while (xx <= yy) {\n c_mid = (xx + yy) / 2;\n // printf(\"%f / %f = %f\\n\", i, c_mid, i / c_mid);\n\n if (ef > i / c_mid) {\n yy = c_mid - 1;\n } else if (ef < i / c_mid) {\n xx = c_mid + 1;\n } else {\n find = 1;\n break;\n }\n }\n if (find)\n break;\n }\n\n /*while (l <= r) {\n xp_mid = (l + r) / 2;\n int xx = x, yy = y;\n while (xx <= yy) {\n c_mid = (xx + yy) / 2;\n printf(\"%f / %f = %f\\n\", xp_mid, c_mid, xp_mid / c_mid);\n\n if (ef > xp_mid / c_mid) {\n yy = c_mid - 1;\n } else if (ef < xp_mid / c_mid) {\n xx = c_mid + 1;\n } else {\n find = 1;\n break;\n }\n }\n\n if (find)\n break;\n else {\n if (ef > xp_mid / c_mid) {\n l = xp_mid + 1;\n } else if (ef < xp_mid / c_mid) {\n r = xp_mid - 1;\n } else {\n find = 1;\n break;\n }\n }\n }*/\n\n printf(find ? \"YES\\n\" : \"NO\\n\");\n\n return 0;\n}\n"}], "src_uid": "1110d3671e9f77fd8d66dca6e74d2048"} {"nl": {"description": "Iahub and his friend Floyd have started painting a wall. Iahub is painting the wall red and Floyd is painting it pink. You can consider the wall being made of a very large number of bricks, numbered 1, 2, 3 and so on. Iahub has the following scheme of painting: he skips x - 1 consecutive bricks, then he paints the x-th one. That is, he'll paint bricks x, 2·x, 3·x and so on red. Similarly, Floyd skips y - 1 consecutive bricks, then he paints the y-th one. Hence he'll paint bricks y, 2·y, 3·y and so on pink.After painting the wall all day, the boys observed that some bricks are painted both red and pink. Iahub has a lucky number a and Floyd has a lucky number b. Boys wonder how many bricks numbered no less than a and no greater than b are painted both red and pink. This is exactly your task: compute and print the answer to the question. ", "input_spec": "The input will have a single line containing four integers in this order: x, y, a, b. (1 ≤ x, y ≤ 1000, 1 ≤ a, b ≤ 2·109, a ≤ b).", "output_spec": "Output a single integer — the number of bricks numbered no less than a and no greater than b that are painted both red and pink.", "sample_inputs": ["2 3 6 18"], "sample_outputs": ["3"], "notes": "NoteLet's look at the bricks from a to b (a = 6, b = 18). The bricks colored in red are numbered 6, 8, 10, 12, 14, 16, 18. The bricks colored in pink are numbered 6, 9, 12, 15, 18. The bricks colored in both red and pink are numbered with 6, 12 and 18. "}, "positive_code": [{"source_code": "#include\nint main()\n{\n int x,y,a,b;\n scanf(\"%d%d%d%d\",&x,&y,&a,&b);\n int i=1;\n int count=0;\n int add=(x*y)/lcm(x,y);\n while(a%add!=0)\n a++;\n while(b%add!=0)\n b--;\n count=(b-a)/add+1;\n printf(\"%d\",count);\n return 0;\n}\n\nint lcm(int a,int b)\n{\n if(b==0)\n return a;\n if(a\n\nint gcd(int x, int y) {\n if (y == 0)\n return x;\n return gcd(y, x % y);\n}\n\nint solve(int x, int y, int max) {\n long long lcm = 1LL * x * y;\n lcm = lcm / gcd(x, y);\n return max / lcm;\n}\n\nint main() {\n int x, y, a, b;\n scanf(\"%d%d%d%d\", &x, &y, &a, &b);\n printf(\"%d\", solve(x, y, b) - solve(x, y, a - 1));\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int x1,x2,x3,x4;\n int sum,i,t,a,b;\n while(scanf(\"%d%d%d%d\",&x1,&x2,&x3,&x4)!=EOF)\n {\n a=x1;\n b=x2;\n sum=0;\n if(x1==x2&&x1==1)\n {\n sum=x4-x3+1;\n printf(\"%d\\n\",sum);\n continue;\n }\n sum=0;\n if(x1==1&&x2==2)\n {\n sum=(x4-x3+1)/x2;\n printf(\"%d\\n\",sum);\n continue;\n }\n if(x1==2&&x2==1)\n {\n sum=(x4-x3+1)/x1;\n printf(\"%d\\n\",sum);\n continue;\n }\n if(x1==2&&x2==2)\n {\n sum+=(x4-x3+1)/2;\n printf(\"%d\\n\",sum);\n continue;\n }\n sum=0;\n t=a*b;\n while(a!=b)\n {\n if(a>b)\n a-=b;\n if(b>a)\n b-=a;\n }\n t/=a;\n for(i=0;i<=x4;i+=t)\n {\n if(i>=x3)\n sum++;\n }\n printf(\"%d\\n\",sum);\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\nlong long gcd(long long a, long long b)\n{\n long long temp;\n while(b)\n {\n temp=a%b;\n a=b;\n b=temp;\n }\n return a;\n}\nint main ()\n{\n long long x,y,a,b,p,q,ans;\n scanf(\"%lld %lld %lld %lld\",&x,&y,&b,&a);\n p=(x*y)/gcd(x,y);\n ans=(a/p)-(b/p);\n if((double)b/p==b/p)\n ans++;\n printf(\"%lld\\n\",ans);\n return 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n int x,y,a,b,h,k,r,i,p,l,j;\n\n\n scanf(\"%d\",&x);\n scanf(\"%d\",&y);\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n\n l=x*y;\n for(j=1;j<=l;j++)\n {\n if(j%x==0&&j%y==0)\n {\n\n\n p=j;\n break;\n }\n }\n h=a/p;\n if(a%p==0)\n h=h-1;\n k=b/p;\n r=k-h;\n\n printf(\"%d\",r);\n return 0;\n}\n"}, {"source_code": "#include \nint gcd(int x,int y)\n{\n return y!=0?gcd(y,x%y):x;\n}\nint main()\n{\n int a,b,x,y,i,j,k;\n __int64 sum;\n while(scanf(\"%d%d%d%d\",&x,&y,&a,&b)!=EOF)\n {\n sum=x*y/gcd(x,y);k=0;\n k=b/sum-a/sum;\n if(a%sum==0)\n k++;\n printf(\"%d\\n\",k);\n }\n return 0;\n}\n"}, {"source_code": "#include\nlcm(int n1,int n2)\n{\n int temp1=n1; int temp2=n2; \n if(temp1==temp2)\n {\n return n1;\n }\n while(temp1!=temp2) \n {\n if(temp1>temp2) \n temp1-=temp2; \n else \n temp2-=temp1; \n }\n return (n1*n2)/temp1;\n}\nint main()\n{\n long a,b,c,d=0,i,x,y,e;\n scanf(\"%ld%ld%ld%ld\",&x,&y,&a,&b);\n if(x==y)\n {\n if(x==a)\n {\n d=b/x;\n \n }\n else\n d=(b/x)-a+1;\n goto z;\n }\n if(a==1)\n {\n d=(b/lcm(x,y));\n goto z;\n } \n if(a%x==0)\n {\n c=a/x;\n for(i=a;i<=b;i=c*x)\n {\n if(i%y==0)\n {\n d++;\n } \n c++;\n }\n } \n else\n {\n e=a+x-(a%x);\n if(y==1)\n {\n d=(b/e)-a+1;\n goto z;\n }\n c=e/x;\n for(i=e;i<=b;i=c*x)\n {\n if(i%y==0)\n {\n d++;\n } \n c++;\n }\n } \n z:\n printf(\"%ld\",d);\n return 0;\n}\n"}, {"source_code": "#include \nint main ()\n{\n int i,j,n,l,f,a,b,count=0;\n scanf(\"%d %d %d %d\",&l,&f,&a,&b);\n for(i=l;i<=l*f;i=i+l) {\n if(i%f==0) {\n count=i;\n break;\n }\n }\n n=b/count-(a-1)/count;\n printf(\"%d\\n\",n);\n return 0;\n}\n"}, {"source_code": "#include\nlong int gcd(int a,int b)\n{\n int c;\n while(a!=b)\n {\n if(a>b)\n a=a-b;\n else\n {\n c=b;\n b=a;\n a=c;\n }}\n return a;\n\n}\n\nmain()\n{\n long int g,j,a,b,x,y,i,p,cnt=0;\n scanf(\"%d%d%d%d\",&a,&b,&x,&y);\n g=gcd(a,b);\n p=a*b;\n g=p/g;\n i=x;\n j=y;\n while(i%g!=0&&i<=y)\n {\n i++;\n }\n while(j%g!=0&&j>=x)\n {\n j--;\n }\n p=j-i;\n cnt=p/g;\n if(cnt==0&&i!=j)\n {\n {\n printf(\"0\");\n exit(0);\n }\n }\n printf(\"%d\",cnt+1);\n return 0;\n}\n"}, {"source_code": "#include \nint gcd(int a, int b);\nint main(void){\n\tint x,y,a,b,count,lcm;\n\tscanf(\"%d %d %d %d\", &x, &y, &a, &b);\n\t\n\tlcm = (x * y)/gcd(x,y);\n\t\n\tcount = b/lcm;\n\tif(lcm >= a)\n \tprintf(\"%d\\n\", count);\n\t\n\tif(lcm < a){\n\t\tif(a % lcm == 0)\n\t\t printf(\"%d\\n\", count-(a/lcm)+1);\n\t\telse\n\t\t printf(\"%d\\n\", count-(a/lcm));\n\t}\n\t\n\treturn 0;\n}\n\nint gcd(int a, int b){\n\tif(b == 0)\n\t return a;\n\telse\n\t return gcd(b, a%b);\n}\n \t"}, {"source_code": "#include\nint main()\n{\n int i,a,t,b,x,y,count=0,tmp;\n scanf(\"%d%d%d%d\",&x,&y,&a,&b);\n for(i=1; i<=(x*y); i++)\n {\n if(i%x==0&&i%y==0)\n {\n t=i;\n break;\n }\n }\n count=(b/t)-(a/t);\n if(a%t==0)\n count++;\n printf(\"%d\",count);\n return 0;\n}"}, {"source_code": "#include\n#include\n#include\nint main()\n{\n int a, b, x, y, i, j, k, hold, p;\n scanf(\"%d %d %d %d\", &a, &b, &x, &y);\n hold = a*b;\n for(i=1;i<=hold;i++){\n if(i%a==0 && i%b==0){\n p = i;\n break;\n }\n }\n\n j = x/p;\n if(x%p==0){\n --j;\n }\n k = y/p;\n printf(\"%d\", k-j);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int x,y,a,b,max,lcm,i,ans,d;\n scanf(\"%d %d %d %d\",&x,&y,&a,&b);\n max=y;\n if(x>=y)\n max=x;\n lcm=x*y;\n for(i=max;i<=x*y;i++)\n {\n if(i%x==0&&i%y==0)\n {\n lcm=i;\n break;\n }\n }\n if(a%lcm==0)\n ans=((b-(b%lcm))/lcm)-((a+(a%lcm))/lcm)+1;\n else \n ans=((b-(b%lcm))/lcm)-((a+lcm-(a%lcm))/lcm)+1;\n printf(\"%d\",ans);\n return 0;\n}"}, {"source_code": "#include \n#include \nint main()\n{\n\tint64_t a,b,i,count=0,base,start,end;\n\tint x,y;\n\tscanf(\"%d %d %\"PRId64\" %\"PRId64\" \",&x,&y,&a,&b);\n\tbase = lcm(x,y);\n\t//printf(\"lcm = %d\\n\",base);\n\t\n\tif((a/base)*base < a)\n\t\tstart = (a/base + 1)*base;\n\telse\n\t\tstart = (a/base)*base;\n\n\tif((b/base)*base <= b)\n\t\tend = (b/base)*base;\n\telse\n\t\tend = (b/base - 1)*base;\n\n\tcount = (end-start)/base;\n\n\tprintf(\"%\"PRId64\"\",count+1);\n\treturn 0;\n}\n\nint lcm(int x, int y)\n{\n\tint i;\n\tfor(i=max(x,y);i<=x*y;i++)\n\t{\n\t\tif(i%x==0 && i%y==0)\n\t\t\treturn i;\n\t}\n}\n\nint max(int x,int y)\n{\n\tif(x>y)\n\t\treturn x;\n\telse\n\t\treturn y;\n}"}, {"source_code": "#include\nint main()\n{\n int x1,x2,x3,x4;\n int sum,i,t,a,b;\n while(scanf(\"%d%d%d%d\",&x1,&x2,&x3,&x4)!=EOF)\n {\n a=x1;\n b=x2;\n sum=0;\n if(x1==x2&&x1==1)\n {\n sum=x4-x3+1;\n printf(\"%d\\n\",sum);\n continue;\n }\n sum=0;\n if(x1==1&&x2==2)\n {\n sum=(x4-x3+1)/x2;\n printf(\"%d\\n\",sum);\n continue;\n }\n if(x1==2&&x2==1)\n {\n sum=(x4-x3+1)/x1;\n printf(\"%d\\n\",sum);\n continue;\n }\n if(x1==2&&x2==2)\n {\n sum+=(x4-x3+1)/2;\n printf(\"%d\\n\",sum);\n continue;\n }\n sum=0;\n t=a*b;\n while(a!=b)\n {\n if(a>b)\n a-=b;\n if(b>a)\n b-=a;\n }\n t/=a;\n for(i=0;i<=x4;i+=t)\n {\n if(i>=x3)\n sum++;\n }\n printf(\"%d\\n\",sum);\n }\n return 0;\n}\n"}, {"source_code": "\n#include \n\nint main(void) {\n int x, y, a, b, i, c, m=0, f=0, g;\n \n scanf(\"%d %d %d %d\",&x, &y, &a, &b);\n\n \n if(a%x==0)\n c=a/x;\n \n else \n c=(a/x)+1;\n \n for(i=c; i<=b/x; i++)\n {\n \n if((m==1)&&(x*i%y==0))\n {\n g=((b/x-f)/(i-f))+1;\n printf(\"%d\\n\",g);\n break;\n }\n \n if(x*i%y==0)\n {\n f=i;\n m++;\n }\n else if ((m==1)&&(i==b/x))\n printf(\"1\");\n }\n \n if ((m==1)&&(c==b/x))\n printf(\"1\");\n \n\n else if((m==0)||(c==b/x))\n printf(\"0\");\n \n else if((m==0)||(a==b))\n printf(\"0\");\n \n \n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int x,y,c=0,big;\n long long int a,b,i,q=-1,lcm;\n scanf(\"%d%d%I64d%I64d\",&x,&y,&a,&b);\n if(x>y)\n big=x;\n else\n big=y;\n // printf(\"%d\\n\",big);\n for(i=big;;i++)\n {\n if(i%x==0 && i%y==0)\n {\n lcm=i;\n break;\n\n }\n }\n //printf(\"%I64d \",lcm);\n for(i=a;i<=b;i++)\n {\n if(i%lcm==0)\n { // printf(\"%I64d\",b-i);\n q=(b-i)/lcm;\n break;\n }\n }\n\n\n printf(\"%I64d\",q+1);\n\n return 0;\n}\n"}, {"source_code": "#include\nlong long int lcm1(long long int,long long int);\nint main()\n{\n long long int x,y;\n long long int a,b,lcm,n,j;\n scanf(\"%I64d %I64d %I64d %I64d\",&x,&y,&a,&b);\n lcm=(x*y)/lcm1(x,y);\n for(j=a;j<=b;j++)\n {\n if(j%x==0&&j%y==0)\n break;\n }\n n=(b-j)/lcm;\n if(j!=b+1)\n n++;\n printf(\"%I64d\\n\",n);\n return(0);\n}\nlong long int lcm1(long long int x,long long int y)\n{\n if(y==0)\n return((long long int)x);\n lcm1(y,x%y);\n}\n"}, {"source_code": "#include\nint divisor(int x, int y)\n{\n\tint c = y;\n\twhile(x % y){\n\t\tc = x % y;\n\t\tx = y;\n\t\ty = c;\n\t}\n\treturn c;\n}\nint main()\n{\n\tint x, y, c, sum;\n\tlong long a, b;\n\tscanf(\"%d%d%I64d%I64d\", &x, &y, &a, &b);\n\tc = x*y/divisor(x,y);\n\tsum = (b/c - (a-1)/c);\n\tprintf(\"%d\\n\", sum);\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint i,p,x,y,a,b,c,h,q;\n\tscanf(\"%d %d %d %d\",&x,&y,&a,&b);\n\tc=(x*y);\n\tfor(i=1;i<=c;i++)\n\t{\n\t\tif(i%x==0 && i%y==0)\n\t\t{\n\t\t\tp=i;\n\t\t\tbreak;\n\t\t}\n\t}\n\th=a/p;\n\tif(a%p==0)\n\t\th=h-1;\n\tq=b/p;\n\tprintf(\"%d\",q-h);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint hcf(int a,int b)\n{\n\tif(b==0)\n\t\treturn a;\n\telse\n\t\thcf(b,a%b);\n}\nint main()\n{\n\tint l,k,j,i;\n\tint x,y,a,b;\n\tscanf(\"%d%d%d%d\",&x,&y,&a,&b);\n\tint lcm=(x*y)/hcf(x,y);\n\tint num=0;\n//\tprintf(\"%d \",lcm);\n//\tnum=(b-a)/lcm;\n//\tprintf(\"%d \",num);\n\tint g=b/lcm;\n\tint h=a/lcm;\n\tnum=g-h;\n\tif(a%lcm==0)\n\t\tnum++;\n\tprintf(\"%d\\n\",num);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint hcf (int,int);\n\nint x,y;\nlong a,b;\nint main()\n{\n\n\nint i;\nscanf(\"%d%d%ld%ld\",&x,&y,&a,&b);\nint lcm,count=0;\nlcm=(x*y)/hcf(x,y);\nlong z;\nif(a%lcm==0)\nz=(a/lcm) -1;\nelse z=(a/lcm);\n\ncount=(b/lcm)-z;\n\nprintf(\"%d\\n\",count);\nreturn 0;\n}\n\nint hcf (int p,int q)\n{\nif(p==q)\nreturn p;\nelse if(p>q)\nhcf (p-q,q);\nelse\nhcf(p,q-p);\n}\n\n\n\n\n"}, {"source_code": "#include \n#include \nint gcd(a, b)\n{\n int m, i, ans;\n m = (a>b)?b:a;\n for(i = m; i >= 1; i--){\n if(a%i==0 && b%i==0){\n ans = i;\n break;\n }\n }\n return (a*b)/ans;\n}\n\nint main()\n{\n int x, y, a, b, i, p;\n scanf(\"%d%d%d%d\", &x, &y, &a, &b);\n p = gcd(x, y);\n // printf(\"%d\\n\", p);\n if(a%p==0 && b%p!=0){\n printf(\"%d\", (b/p)-(a/p)+1 );\n }\n else if(a%p!=0 && b%p==0){\n printf(\"%d\", (b/p)-(a/p));\n }\n else if(a%p==0 && b%p==0){\n printf(\"%d\", (b/p)-(a/p)+1);\n }\n else{\n printf(\"%d\", (b/p)-(a/p));\n }\n return 0;\n}\n"}, {"source_code": "#include\nint divisor(int x, int y)\n{\n\tint c = y;\n\twhile(x % y){\n\t\tc = x % y;\n\t\tx = y;\n\t\ty = c;\n\t}\n\treturn c;\n}\nint main()\n{\n\tint x, y, c, sum;\n\tlong long a, b;\n\tscanf(\"%d%d%I64d%I64d\", &x, &y, &a, &b);\n\tc = x*y/divisor(x,y);\n\tsum = (b/c - (a-1)/c);\n\tprintf(\"%d\\n\", sum);\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n //freopen(\"in.txt\",\"r\",stdin);\n int x,y,a,b,n,m,r,t=0;\n scanf(\"%d%d%d%d\",&n,&m,&a,&b);\n x=n;\n y=m;\n if(x\nint lcm(long long int a,long long int b)\n{\n int i,c,A=a,B=b;\n for( ; b>0;)\n {\n c=a%b;\n a=b;\n b=c;\n }\n c=(A*B)/a;\n return c;\n}\nint main()\n{\n long long int a,b,c,d,i,j;\n scanf(\"%lld%lld%lld%lld\",&a,&b,&c,&d);\n i=lcm(a,b);\n printf(\"%lld\\n\",d/i-(c-1)/i);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint i,p,x,y,a,b,c,h,q;\n\tscanf(\"%d %d %d %d\",&x,&y,&a,&b);\n\tc=(x*y);\n\tfor(i=1;i<=c;i++)\n\t{\n\t\tif(i%x==0 && i%y==0)\n\t\t{\n\t\t\tp=i;\n\t\t\tbreak;\n\t\t}\n\t}\n\th=a/p;\n\tif(a%p==0)\n\t\th=h-1;\n\tq=b/p;\n\tprintf(\"%d\",q-h);\n\treturn 0;\n}\n"}, {"source_code": "#include \nint gcd(int a, int b);\nint main(void){\n\tint x,y,a,b,count,lcm;\n\tscanf(\"%d %d %d %d\", &x, &y, &a, &b);\n\t\n\tlcm = (x * y)/gcd(x,y);\n\t\n\tcount = b/lcm;\n\tif(lcm >= a)\n \tprintf(\"%d\\n\", count);\n\t\n\tif(lcm < a){\n\t\tif(a % lcm == 0)\n\t\t printf(\"%d\\n\", count-(a/lcm)+1);\n\t\telse\n\t\t printf(\"%d\\n\", count-(a/lcm));\n\t}\n\t\n\treturn 0;\n}\n\nint gcd(int a, int b){\n\tif(b == 0)\n\t return a;\n\telse\n\t return gcd(b, a%b);\n}\n \t"}, {"source_code": "#include\nint main()\n{\n //freopen(\"in.txt\",\"r\",stdin);\n int x,y,a,b,n,m,r,t=0;\n scanf(\"%d%d%d%d\",&n,&m,&a,&b);\n x=n;\n y=m;\n if(x\n\nunsigned long long int gcd(unsigned long long int,unsigned long long int);\nunsigned long long int lcm(unsigned long long int,unsigned long long int);\n\nint main(){\n\n\n\n unsigned long long int a,b,l,x,y,i,c=0,d=0;\n\n\n scanf(\"%llu %llu %llu %llu\",&a,&b,&x,&y);\n l=lcm(a,b);\n\nc=y/l-(x-1)/l;\nprintf(\"%llu\\n\",c);\n return 0;\n}\nunsigned long long int gcd(unsigned long long int y,unsigned long long int z)\n {\n if (z == 0)\n return y;\n else\n return gcd(z,y%z);\n }\nunsigned long long int lcm(unsigned long long int a,unsigned long long int b)\n {\n unsigned long long int result;\n result = a*b/gcd(a,b);\n return result;}\n"}, {"source_code": "#include \n\nint main(void) {\nint h,g;\nint x,y,a,b;\nint i=1,count=0;\nint r=1;\nscanf(\"%d%d%d%d\",&x,&y,&a,&b);\n\n\nif(x>y)\n{h=x;\ng=y;\n}\nelse\n{\n h=y;\n g=x;\n}\n\nwhile(g!=0)\n{\n count =h;\n h=g;\n g=count%g;\n}\nh=(x*y)/h;\n\ncount=(b/h)-((a-1)/h);\nprintf(\"%d\",count);\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tint m,i,j,k,a,b,c,d,top=1;\n\tscanf(\"%d %d %d %d\",&a,&b,&c,&d);\n//\tfor(i=1;i<=a+b;i++)\n//\t\tif(a%i==0 && b%i==0) top*=i;\n//\tk=(a*b)/top;\n//\tprintf(\"%d\\n\",k);\n//\tfor(i=c;i<=d;i++)\n//\t\tif(i%k==0) break;\n//\tfor(j=i,m=0;j<=d;j+=k,m++);\n\tfor(i=c,m=0;i<=d;i++) {\n\t\tif(i%a==0 && i%b==0) { m++; \n\t\t\tif(m==1) j=i;\n\t\t\tif(m==2) k=i;\n\t\t}\n\t\tif(m>=2) {\n\t\t\td-=d%(k-j);\n\t\t\tm+=(d-i)/(k-j);\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",m);\n\treturn 0;\n}\n"}, {"source_code": "#include\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 a,b,x,y,lcm;\n scanf(\"%d %d %d %d\",&a,&b,&x,&y);\n lcm=a*b/gcd(a,b);\n printf(\"%d\\n\",y/lcm-(x-1)/lcm);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n unsigned int a,b,c,count=0,x,y,z,i;\n scanf(\"%u%u%u%u\",&x,&y,&a,&b);\n if(x>y)\n { \n x=x+y;\n y=x-y;\n x=x-y;\n }\n for(i=y;i<=x*y;i=i+y)\n if(i%x==0)\n {\n z=i;\n break;\n }\n count=b/z;\n count=count-((a-1)/z);\n printf(\"%u\",count);\n return 0;\n}"}, {"source_code": "#include \n\nint main(void){\n int i, x, y, a, b, c=0, mcm;\n scanf(\"%d %d %d %d\", &x, &y, &a, &b);\n for(mcm=x; mcm<=b; mcm++){\n //~ printf(\"%d\\n\",i);\n if(mcm%x == 0 && mcm%y == 0){\n break;\n }\n }\n \n c = b/mcm - a/mcm;\n if(a%mcm == 0){ \n c++;\n }\n printf(\"%d\\n\", c);\n return 0;\n}\n"}, {"source_code": "#include \n\n#define int long long\n\nint gcd(int x, int y)\n{\n\treturn (y ? gcd(y, x % y) : x);\t\n}\nint lcm(int x, int y)\n{\n\treturn (x / gcd(x, y) * y);\n}\n\nsigned main(void)\n{\n\tint x, y, c;\n\tint a, b;\n\tint i;\n\n\tscanf(\"%lld %lld %lld %lld\", &x, &y, &a, &b);\n\tx = lcm(x, y);\n\n\tif (a != 1){\n\t\tprintf(\"%I64d\\n\", b / x - (a - 1) / x);\n\t}\n\telse {\n\t\tprintf(\"%I64d\\n\", b / x);\n\t}\n\n\treturn (0);\n}"}, {"source_code": "#include \n\nint\ngcd(int a, int b)\n{\n int tmp = 0;\n while (b != 0) {\n tmp = a;\n a = b;\n b = tmp % b;\n }\n\n return a;\n}\n\nint\nmain()\n{\n int x, y, a, b;\n scanf(\"%d %d %d %d\\n\", &x, &y, &a, &b);\n\n int lcm = (x*y)/gcd(x,y);\n\n int a_count = a/lcm;\n int b_count = b/lcm;\n int count = b_count - a_count;\n if (a%lcm == 0) {\n count++;\n }\n\n printf(\"%d\\n\", count);\n\n return 0;\n}\n"}, {"source_code": "#include\ntypedef unsigned long long int ll;\nll gcd(ll a,ll b)\n{\nif(b==0)\nreturn a;\nreturn gcd(b,a%b);\n}\nmain()\n{\nll x,y,a,b,i;\nscanf(\"%lld%lld%lld%lld\",&x,&y,&a,&b);\nll gcds=x*(y/gcd(x,y));\nll start=(a/gcds);\nif(a%gcds!=0)\nstart++;\nll end=(b/gcds);\n\nprintf(\"%lld\\n\",end-start+1);\nreturn 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n unsigned int a,b,c,count=0,x,y,z,i;\n scanf(\"%u%u%u%u\",&x,&y,&a,&b);\n if(x>y)\n { \n x=x+y;\n y=x-y;\n x=x-y;\n }\n for(i=y;i<=x*y;i=i+y)\n if(i%x==0)\n {\n z=i;\n break;\n }\n count=b/z;\n count=count-((a-1)/z);\n printf(\"%u\",count);\n return 0;\n}"}, {"source_code": "#include\nint divisor(int x, int y)\n{\n\tint c = y;\n\twhile(x % y){\n\t\tc = x % y;\n\t\tx = y;\n\t\ty = c;\n\t}\n\treturn c;\n}\nint main()\n{\n\tint x, y, c, sum;\n\tlong long a, b;\n\tscanf(\"%d%d%I64d%I64d\", &x, &y, &a, &b);\n\tc = x*y/divisor(x,y);\n\tsum = (b/c - (a-1)/c);\n\tprintf(\"%d\\n\", sum);\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\nlong long int x,y,a,b,l,r,f,z,s=1,i;\nscanf(\"%I64d%I64d%I64d%I64d\",&x,&y,&a,&b);\nz=x>=y?x:y;\nif(x%y==0||y%x==0)\n l=z;\nelse{\n for(i=1;i<=1000000000;i++){\n if(s%x==0&&s%y==0)\n {l=s;\n break;}\n s+=1;\n }\n}\n\nf=a/l;\nr=b/l;\nif(a%l==0){\n printf(\"%I64d\",r-f+1);\n}\nelse\n printf(\"%I64d\",r-f);\nreturn 0;\n}\n"}, {"source_code": "#include\nlong int gcd(long int,long int);\nlong int sub(long int , long int );\nint main()\n{\n\tlong int x,y,a,b,count=0,temp,i,k,m;\n\t\n\tscanf(\"%lu %lu %lu %lu\",&x,&y,&a,&b);\n\ttemp = x*y;\n \n\ttemp = temp/gcd(x,y);\n\t\n\tif(a>=b)\n\t{\n\t\tk=a/temp;\n\t\tm=(b-1)/temp;\n\t\tk=k-m;\n\t}\n\telse\n\t{\n\t\tk=b/temp;\n\t\tm=(a-1)/temp;\n\t\tk=k-m;\n\t}\n\n\tprintf(\"%lu\\n\",k);\n\treturn 0;\n\n\n}\nlong int gcd (long int a,long int b)\n{\n\tlong int i;\n\tif(b<=0)\n\t\treturn a;\n\telse{\n\t\ti=gcd(b,sub(a,b));\n\t\treturn i;\n\t}\n\n}\nlong int sub(long int a, long int b)\n{\n\tif(a>=b)\n\t\treturn(a-b);\n\telse\n\t\treturn(b-a);\n\n}"}, {"source_code": "#include\n\nunsigned long long int gcd(unsigned long long int,unsigned long long int);\nunsigned long long int lcm(unsigned long long int,unsigned long long int);\n\nint main(){\n\n\n\n unsigned long long int a,b,l,x,y,i,c=0,d=0;\n\n\n scanf(\"%llu %llu %llu %llu\",&a,&b,&x,&y);\n l=lcm(a,b);\n\nc=y/l-(x-1)/l;\nprintf(\"%llu\\n\",c);\n return 0;\n}\nunsigned long long int gcd(unsigned long long int y,unsigned long long int z)\n {\n if (z == 0)\n return y;\n else\n return gcd(z,y%z);\n }\nunsigned long long int lcm(unsigned long long int a,unsigned long long int b)\n {\n unsigned long long int result;\n result = a*b/gcd(a,b);\n return result;}\n"}, {"source_code": "#include\nint main()\n{\n long long int x,y,a,b,i,k,l=0,rem,j,m,n;\n scanf(\"%lld %lld %lld %lld\",&x,&y,&a,&b);\n m=x;\n n=y;\n while(y!=0)\n {\n rem=x%y;\n x=y;\n y=rem;\n }\n k=(m*n)/x;\n if(a%k!=0)\n {\n j=a+k-a%k;\n if(j<=b)\n {\n l=1;\n }\n }\n else\n {\n j=a;\n l=1;\n }\n i=b-j;\n if(i<=0)\n {\n l=l;\n }\n else\n {\n l=l+(i/k);\n }\n printf(\"%lld\\n\",l);\n return 0;\n}\n"}, {"source_code": "#include\nint lcm(long long int a,long long int b)\n{\n int i,c,A=a,B=b;\n for( ; b>0;)\n {\n c=a%b;\n a=b;\n b=c;\n }\n c=(A*B)/a;\n return c;\n}\nint main()\n{\n long long int a,b,c,d,i,j;\n scanf(\"%lld%lld%lld%lld\",&a,&b,&c,&d);\n i=lcm(a,b);\n printf(\"%lld\\n\",d/i-(c-1)/i);\n return 0;\n}\n"}, {"source_code": "#include\nint gcd(int a,int b)\n{\n\tif(a%b==0)\n\t\treturn b;\n\telse\n\t\tgcd(b,a%b);\n}\nint main()\n{\n\tint x,y;\n\tint a,b;\n\tint i;\n\tint count=0;\n\tint hcf,lcm;\n\tscanf(\"%d %d %d %d\",&x,&y,&a,&b);\n\thcf=gcd(x,y);\n\t//printf(\"%d\",hcf);\n\tlcm=x*y/hcf;\n\ta--;\n\tcount= b/lcm-a/lcm;\n\tprintf(\"%d\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint gcd( int a, int b);\n\nint main()\n{\n\tint x,y,a,b,gcdv, lcm, i, count, temp;\n\t\n\tscanf(\"%d %d %d %d\",&x,&y,&a,&b);\n\t\n\tif( x == 1) lcm = y;\n\telse if( y == 1) lcm = x;\n\telse if( x == y) lcm = x;\n\telse{\n\tgcdv = gcd(x, y);\n\tlcm = x * y / gcdv;\n\t}\n \n count = 0;\n /*while(temp <= b){\n if( temp >= a) count++;\n temp = lcm * (++i);\n }*/\n count = b / lcm - a / lcm ;\n //if(b%lcm == 0) count++;\n if(a%lcm == 0) count++;\n \n \n printf(\"%d\",count);\n\treturn 0;\n}\n\nint gcd( int a, int b){\n int large, small, temp;\n \n large = small = a;\n if(a >= b) small = b;\n else large = b;\n \n do{\n large = large - small;\n if( large < small){\n temp = large;\n large = small;\n small = temp;\n }\n \n }while(large != small);\n return large;\n}"}, {"source_code": "#include \n\nint main()\n{\n int x,y,a,b,h,k,r,i,p,l,j;\n\n\n scanf(\"%d\",&x);\n scanf(\"%d\",&y);\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n\n l=x*y;\n for(j=1;j<=l;j++)\n {\n if(j%x==0&&j%y==0)\n {\n\n\n p=j;\n break;\n }\n }\n h=a/p;\n if(a%p==0)\n h=h-1;\n k=b/p;\n r=k-h;\n\n printf(\"%d\",r);\n return 0;\n}\n"}, {"source_code": "#include \n\nint gcd( int a, int b);\n\nint main()\n{\n\tint x,y,a,b,gcdv, lcm, i, count, temp;\n\t\n\tscanf(\"%d %d %d %d\",&x,&y,&a,&b);\n\t\n\tif( x == 1) lcm = y;\n\telse if( y == 1) lcm = x;\n\telse if( x == y) lcm = x;\n\telse{\n\tgcdv = gcd(x, y);\n\tlcm = x * y / gcdv;\n\t}\n \n count = 0;\n /*while(temp <= b){\n if( temp >= a) count++;\n temp = lcm * (++i);\n }*/\n count = b / lcm - a / lcm ;\n //if(b%lcm == 0) count++;\n if(a%lcm == 0) count++;\n \n \n printf(\"%d\",count);\n\treturn 0;\n}\n\nint gcd( int a, int b){\n int large, small, temp;\n \n large = small = a;\n if(a >= b) small = b;\n else large = b;\n \n do{\n large = large - small;\n if( large < small){\n temp = large;\n large = small;\n small = temp;\n }\n \n }while(large != small);\n return large;\n}"}, {"source_code": "#include \n// :)\nlong long int gcd(long long int, long long int);\nint main(){\n long long int x,y,a,b;\n scanf(\"%lli %lli %lli %lli\", &x,&y,&a,&b);\n while (b%x!=0 || b%y!=0 ){\n b--;\n }\n while (a%x!=0 || a%y!=0 ){\n a++;\n }\n\n printf(\"%lli\", (b-a)/((x*y)/gcd(x,y))+1);\n\n return 0;\n}\n\nlong long int gcd (long long int x, long long int y){\nwhile (y!=0 && x!=0){\n if (y\n\nint main(void) {\n int x, y, a, b, i, c, m=0, f=0, g;\n \n scanf(\"%d %d %d %d\",&x, &y, &a, &b);\n\n \n if(a%x==0)\n c=a/x;\n \n else \n c=(a/x)+1;\n \n for(i=c; i<=b/x; i++)\n {\n \n if((m==1)&&(x*i%y==0))\n {\n g=((b/x-f)/(i-f))+1;\n printf(\"%d\\n\",g);\n break;\n }\n \n if(x*i%y==0)\n {\n f=i;\n m++;\n }\n else if ((m==1)&&(i==b/x))\n printf(\"1\");\n }\n \n if ((m==1)&&(c==b/x))\n printf(\"1\");\n \n\n else if((m==0)||(c==b/x))\n printf(\"0\");\n \n else if((m==0)||(a==b))\n printf(\"0\");\n \n \n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint i,p,x,y,a,b,c,h,q;\n\tscanf(\"%d %d %d %d\",&x,&y,&a,&b);\n\tc=(x*y);\n\tfor(i=1;i<=c;i++)\n\t{\n\t\tif(i%x==0 && i%y==0)\n\t\t{\n\t\t\tp=i;\n\t\t\tbreak;\n\t\t}\n\t}\n\th=a/p;\n\tif(a%p==0)\n\t\th=h-1;\n\tq=b/p;\n\tprintf(\"%d\",q-h);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n long long int x,y,w,r,h,j,a,b,gcd,lcm,i;\n scanf(\"%I64d%I64d%I64d%I64d\",&x,&y,&a,&b);\n w=x;\n r=y;\n if(x>y) {\n while(y) {\n gcd=x%y;\n x=y;\n y=gcd;\n }\n lcm=(w*r)/x;\n }\n else {\n while(x) {\n gcd=y%x;\n y=x;\n x=gcd;\n }\n lcm=(w*r)/y;\n }\n\n h=b/lcm;\n i=(a-1)/lcm;\n\n printf(\"%I64d\",h-i);\n\n return 0;\n}\n"}, {"source_code": "#include\n\nint gcd(int, int);\nint lcm(int, int);\n\nint main()\n{\n\tint x, y, LCM;\n\tlong int a, b, answer;\n\tscanf(\"%d %d %ld %ld\", &x, &y, &a, &b);\n\t\n\tLCM = lcm(x, y);\n\t\n\tanswer = b / LCM - a / LCM;\n\t\n\tif (a % LCM == 0) answer++;\n\t\n\tprintf(\"%ld\\n\", answer);\n\treturn 0;\n}\n\n\nint gcd(int a, int b)\n{\n\tint temp;\n\tif (b <= a)\n\t{\n\t\twhile (a % b != 0)\n\t\t{\n\t\t\ttemp = b;\n\t\t\tb = a % b;\n\t\t\ta = temp;\n\t\t}\n\t\treturn b;\n\t}\n\telse return gcd(b, a); \n}\n\n\nint lcm(int a, int b)\n{\n\treturn (a * b) / gcd(a, b);\n}\n"}, {"source_code": "#include\nint gcd (int a, int b)\n{\nreturn (b == 0) ? a : gcd (b, a%b);\n}\n\nint main()\n{\n\n int x,y;\n long a,b;\n scanf(\"%d%d%ld%ld\",&x,&y,&a,&b);\n long lcp = x * y / gcd(x,y);\n long output = b/lcp - (a - 1)/ lcp;\n printf(\"%ld\\n\", output);\n return 0;\n}\n"}, {"source_code": "#include\n long gcd(long x,long y);\n int main()\n {\n long x,y,l,p,q;\n long a,b;\n scanf(\"%ld%ld%ld%ld\",&x,&y,&a,&b);\n l=(x*y)/gcd(x,y);\n p=a/l;q=b/l;\n if(a%l==0)\n q++;\n printf(\"%ld\",q-p);\n return(0);\n }\n long gcd(long x,long y)\n {\n if(y>x)\n return gcd(y,x);\n else if(y==0)\n return x;\n else\n return gcd(y,x%y);\n }"}, {"source_code": "#include \n\nint main (int args, char** argv) {\n\tint x, y, a, b;\n\tint gcd, lcm, quotient, remainder, divisor;\n\tint count, highest, lowest, deduct;\n\t\n// Scan inputs\n\twhile (scanf(\"%d %d %d %d\", &x, &y, &a, &b) != EOF) {\n\t\t\n\t// Euclid's Algorithm for gcd(x,y)\n\t\tif ( x <= y ) {\n\t\t\tquotient = y;\n\t\t\tdivisor = x;\n\t\t}\n\t\telse {\n\t\t\tquotient = x;\n\t\t\tdivisor = y;\n\t\t}\n\t\twhile ( (remainder = (quotient%divisor)) != 0 ) {\n\t\t\tquotient = divisor;\n\t\t\tdivisor = remainder;\n\t\t}\n\t\tgcd = divisor;\n\t// Lowest Common Multiple - LCM\n\t\tlcm = (x*y)/gcd;\n\t\t//printf (\"x: %d, y: %d, a: %d, b: %d\\n\",x,y,a,b);\n\t\t//printf (\"GCD: %d\\tLCM: %d\\n\",gcd,lcm);\n\t// Total Count\n\t\tif ( a >= b ) {\n\t\t\thighest = a;\n\t\t\tlowest = b;\n\t\t}\n\t\telse {\n\t\t\thighest = b;\n\t\t\tlowest = a;\n\t\t}\n\t\tcount = highest/lcm;\n\t\t\t\n\t\tdeduct = (lowest-1)/lcm;\n\t\tcount -= deduct;\n\t\t\t\n\t// Print\n\t\tprintf(\"%d\\n\", count);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\nint Eucilid(int a,int b)\n{\n if(b==0)\n return a;\n \n return Eucilid(b,a%b);\n}\nint main()\n{\n int x,y,a,b,c,lcm;\n scanf(\"%d%d%d%d\",&x,&y,&a,&b);\n Eucilid(a,b);\n lcm=(x*y)/Eucilid(x,y);\n int div=b/lcm - (a-1)/lcm;\n printf(\"%d\",div);\n \n}"}, {"source_code": "#include\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 a,b,x,y,lcm;\n scanf(\"%d %d %d %d\",&a,&b,&x,&y);\n lcm=a*b/gcd(a,b);\n printf(\"%d\\n\",y/lcm-(x-1)/lcm);\n return 0;\n}"}, {"source_code": "#include \n\nint main(void){\n int i, x, y, a, b, c=0, mcm;\n scanf(\"%d %d %d %d\", &x, &y, &a, &b);\n for(mcm=x; mcm<=b; mcm++){\n //~ printf(\"%d\\n\",i);\n if(mcm%x == 0 && mcm%y == 0){\n break;\n }\n }\n \n c = b/mcm - a/mcm;\n if(a%mcm == 0){ \n c++;\n }\n printf(\"%d\\n\", c);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint i,p,x,y,a,b,c,h,q;\n\tscanf(\"%d %d %d %d\",&x,&y,&a,&b);\n\tc=(x*y);\n\tfor(i=1;i<=c;i++)\n\t{\n\t\tif(i%x==0 && i%y==0)\n\t\t{\n\t\t\tp=i;\n\t\t\tbreak;\n\t\t}\n\t}\n\th=a/p;\n\tif(a%p==0)\n\t\th=h-1;\n\tq=b/p;\n\tprintf(\"%d\",q-h);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int l,h,lc,u,v,s,a,b,x,y,i,c=0;\n scanf(\"%d %d %d %d\",&x,&y,&a,&b);\n if(x>y)\n {l=x;s=y;}\n else\n {l=y;s=x;}\n for(i=1;i<=s;i++)\n {\n if(x%i==0 && y%i==0)\n h=i;\n }\n\n lc=x*y/h;\n u=(b/lc);\n v=a/lc;\n c=u-v;\n if(a%lc==0)\n c++;\n printf(\"%d\",c);\n return 0;\n}\n"}, {"source_code": "#include\nint lcm(int a,int b)\n{\n int i,p;\n for(i=1;i<=a*b;i++)\n {\n if(i%a==0 && i%b==0)\n {\n p=i;\n break;\n }\n }\n return p;\n}\n\nint main()\n{\n long long int a,b,x,y,k,j,i;\n scanf(\"%I64d%I64d%I64d%I64d\",&x,&y,&a,&b);\n k=lcm(x,y);\n if(a%k==0)\n {\n j=(b/k)-(a/k)+1;\n }\n else\n {\n j=(b/k)-(a/k);\n }\n printf(\"%I64d\",j);\n return (0);\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int x,y,a,b,i,k,l=0,rem,j,m,n;\n scanf(\"%lld %lld %lld %lld\",&x,&y,&a,&b);\n m=x;\n n=y;\n while(y!=0)\n {\n rem=x%y;\n x=y;\n y=rem;\n }\n k=(m*n)/x;\n if(a%k!=0)\n {\n j=a+k-a%k;\n if(j<=b)\n {\n l=1;\n }\n }\n else\n {\n j=a;\n l=1;\n }\n i=b-j;\n if(i<=0)\n {\n l=l;\n }\n else\n {\n l=l+(i/k);\n }\n printf(\"%lld\\n\",l);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int x1,x2,x3,x4;\n int sum,i,t,a,b;\n while(scanf(\"%d%d%d%d\",&x1,&x2,&x3,&x4)!=EOF)\n {\n a=x1;\n b=x2;\n sum=0;\n if(x1==x2&&x1==1)\n {\n sum=x4-x3+1;\n printf(\"%d\\n\",sum);\n continue;\n }\n sum=0;\n if(x1==1&&x2==2)\n {\n sum=(x4-x3+1)/x2;\n printf(\"%d\\n\",sum);\n continue;\n }\n if(x1==2&&x2==1)\n {\n sum=(x4-x3+1)/x1;\n printf(\"%d\\n\",sum);\n continue;\n }\n if(x1==2&&x2==2)\n {\n sum+=(x4-x3+1)/2;\n printf(\"%d\\n\",sum);\n continue;\n }\n sum=0;\n t=a*b;\n while(a!=b)\n {\n if(a>b)\n a-=b;\n if(b>a)\n b-=a;\n }\n t/=a;\n for(i=0;i<=x4;i+=t)\n {\n if(i>=x3)\n sum++;\n }\n printf(\"%d\\n\",sum);\n }\n return 0;\n}\n"}, {"source_code": "#include\n\nint gcd(int, int);\nint lcm(int, int);\n\nint main()\n{\n\tint x, y, LCM;\n\tlong int a, b, answer;\n\tscanf(\"%d %d %ld %ld\", &x, &y, &a, &b);\n\t\n\tLCM = lcm(x, y);\n\t\n\tanswer = b / LCM - a / LCM;\n\t\n\tif (a % LCM == 0) answer++;\n\t\n\tprintf(\"%ld\\n\", answer);\n\treturn 0;\n}\n\n\nint gcd(int a, int b)\n{\n\tint temp;\n\tif (b <= a)\n\t{\n\t\twhile (a % b != 0)\n\t\t{\n\t\t\ttemp = b;\n\t\t\tb = a % b;\n\t\t\ta = temp;\n\t\t}\n\t\treturn b;\n\t}\n\telse return gcd(b, a); \n}\n\n\nint lcm(int a, int b)\n{\n\treturn (a * b) / gcd(a, b);\n}\n"}, {"source_code": "#include \nint main()\n{\n int x,y,a,b,lcm,m,i,j=0,temp,ans=0;\n scanf(\"%d %d %d %d\",&x,&y,&a,&b);\n m=x*y;\n while(y>0){\n temp=y;\n y=x%y;\n x=temp;\n }\n lcm=m/x;\n for(i=a;i<=b;i++){\n if(i%lcm==0){\n j=i;\n break;\n }\n }\n if(j>0) ans=(b-j)/lcm+1;\n printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "/*\n * FCTRL.c\n *\n * Created on: 24 A�u 2014\n * Author: KT\n */\n\n#include \n int gcd( int a, int b){\n\tif(b==0){\n\t\treturn a;\n\t}\n\treturn gcd(b,a%b);\n}\nint main(void){\n\tint x,y;\nunsigned long long int a,b;\nscanf(\"%d %d %I64d %I64d\",&x,&y,&a,&b);\nint k=(x*y)/gcd(x,y);\nwhile(a%k!=0){\n\ta++;\n}\nwhile(b%k!=0){\n\tb--;\n}\nprintf(\"%I64d\",((b/k)-(a/k)+1));\nreturn 0;\n}\n"}, {"source_code": "#include \nint gcd (int x, int y);\nint main(void){\n\tint x,y,a,b,i=1;\n\tint cou,sum;\n\tscanf(\"%d%d%d%d\",&x,&y,&a,&b);\n\tcou=x/gcd(x,y)*y;\n\tsum=b/cou-a/cou;\n\tif (a%cou==0)\n\t\tsum++;\n\tprintf(\"%d\",sum);\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\nint gcd(int a,int b)\n{\n\tif(b==0)\n\t\treturn a;\n\treturn gcd(b,a%b);\n}\n\nint main()\n{\n\tint x,y;\n\tint a,b;\n\tscanf(\"%d%d%d%d\",&x,&y,&a,&b);\n\tint gcd1=gcd(x,y);\n\tint lcm=(x*y)/gcd1;\n\tif(a%lcm!=0)\n\t\ta=a+(lcm-a%lcm);\n\tb=b-b%lcm;\n\tif(b\n#include\n#define MAX(a,b) (a>b)?a:b\nint main()\n{\n\tint i,d,a,b,x,y,sum=0,j;\n\tscanf(\" %d %d %d %d\",&x,&y,&a,&b);\n\td=MAX(x,y);\n\tfor(;;d++)\n\t\tif(d%x==0 && d%y==0) break;\n\tfor(i=a;i<=b;i++)\n\t\tif(!(i%d)) break;\n\tfor(j=b;j>=a;j--) \n\t\tif(!(j%d)) break;\n\tif(j>=i) sum=(j-i)/d+1;\n\tprintf(\"%d\",sum);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int l,h,lc,u,v,s,a,b,x,y,i,c=0;\n scanf(\"%d %d %d %d\",&x,&y,&a,&b);\n if(x>y)\n {l=x;s=y;}\n else\n {l=y;s=x;}\n for(i=1;i<=s;i++)\n {\n if(x%i==0 && y%i==0)\n h=i;\n }\n\n lc=x*y/h;\n u=(b/lc);\n v=a/lc;\n c=u-v;\n if(a%lc==0)\n c++;\n printf(\"%d\",c);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint gcd(int a, int b) {\n\tif(b == 0) return a;\n\treturn gcd(b, a%b);\n}\n\nint lcm(int a, int b) {\n\treturn (a/gcd(a,b))*b;\n}\n\nint main() {\n\tint x, y, a, b;\n\n\tscanf(\"%d %d %d %d\", &x, &y, &a, &b);\n\n\tprintf(\"%d\", b/lcm(x,y) - a/lcm(x,y) + (a%lcm(x, y) == 0 ? 1 : 0));\n\n\treturn 0;\n}"}, {"source_code": "#include\nlcm(int n1,int n2)\n{\n int temp1=n1; int temp2=n2; \n if(temp1==temp2)\n {\n return n1;\n }\n while(temp1!=temp2) \n {\n if(temp1>temp2) \n temp1-=temp2; \n else \n temp2-=temp1; \n }\n return (n1*n2)/temp1;\n}\nint main()\n{\n long a,b,c,d=0,i,x,y,e;\n scanf(\"%ld%ld%ld%ld\",&x,&y,&a,&b);\n if(x==y)\n {\n if(x==a)\n {\n d=b/x;\n \n }\n else\n d=(b/x)-a+1;\n goto z;\n }\n if(a==1)\n {\n d=(b/lcm(x,y));\n goto z;\n } \n if(a%x==0)\n {\n c=a/x;\n for(i=a;i<=b;i=c*x)\n {\n if(i%y==0)\n {\n d++;\n } \n c++;\n }\n } \n else\n {\n e=a+x-(a%x);\n if(y==1)\n {\n d=(b/e)-a+1;\n goto z;\n }\n c=e/x;\n for(i=e;i<=b;i=c*x)\n {\n if(i%y==0)\n {\n d++;\n } \n c++;\n }\n } \n z:\n printf(\"%ld\",d);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nlong long gcd(long long a, long long b)\n{\n long long temp;\n while(b)\n {\n temp=a%b;\n a=b;\n b=temp;\n }\n return a;\n}\nint main ()\n{\n long long x,y,a,b,p,q,ans;\n scanf(\"%lld %lld %lld %lld\",&x,&y,&b,&a);\n p=(x*y)/gcd(x,y);\n ans=(a/p)-(b/p);\n if((double)b/p==b/p)\n ans++;\n printf(\"%lld\\n\",ans);\n return 0;\n}"}, {"source_code": "#include\nint hcf(int a,int b)\n{\n\tif(b==0)\n\t\treturn a;\n\telse\n\t\thcf(b,a%b);\n}\nint main()\n{\n\tint l,k,j,i;\n\tint x,y,a,b;\n\tscanf(\"%d%d%d%d\",&x,&y,&a,&b);\n\tint lcm=(x*y)/hcf(x,y);\n\tint num=0;\n//\tprintf(\"%d \",lcm);\n//\tnum=(b-a)/lcm;\n//\tprintf(\"%d \",num);\n\tint g=b/lcm;\n\tint h=a/lcm;\n\tnum=g-h;\n\tif(a%lcm==0)\n\t\tnum++;\n\tprintf(\"%d\\n\",num);\n\treturn 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int x,y,a,b,lcm,m,i,j=0,temp,ans=0;\n scanf(\"%d %d %d %d\",&x,&y,&a,&b);\n m=x*y;\n while(y>0){\n temp=y;\n y=x%y;\n x=temp;\n }\n lcm=m/x;\n for(i=a;i<=b;i++){\n if(i%lcm==0){\n j=i;\n break;\n }\n }\n if(j>0) ans=(b-j)/lcm+1;\n printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int x,y,ans=0;\n long long int a,b,i=1;\n scanf(\"%d%d%I64d%I64d\",&x,&y,&a,&b);\n int t;\n while(i%x!=0||i%y!=0)\n i++;\n t=i;\n if(a%t==0)\n ans=b/t - a/t+1;\n else\n ans=b/t - a/t;\n printf(\"%d\",ans);\n\n return 0;\n}\n"}, {"source_code": "#include \nlong long int gcd(long long int, long long int);\nint main(){\n long long int x,y,a,b;\n scanf(\"%lli %lli %lli %lli\", &x,&y,&a,&b);\n while (b%x!=0 || b%y!=0 ){\n b--;\n }\n while (a%x!=0 || a%y!=0 ){\n a++;\n }\n\n printf(\"%lli\", (b-a)/((x*y)/gcd(x,y))+1);\n\n return 0;\n}\n\nlong long int gcd (long long int x, long long int y){\nwhile (y!=0 && x!=0){\n if (y\n\nint main(void)\n{\nint a,b,x,y,c,d;\n\nscanf(\"%d %d %d %d\",&x,&y,&a,&b);\nc=1;\n\nwhile(c%x !=0 || c%y !=0 ) {c=c+1;}\n\nd=(b/c - (a-1)/c) ;\n\nprintf(\"%d\",d);\n\n\nreturn 0;\n}\n"}, {"source_code": "#include \n\nint main(void)\n{\nint a,b,x,y,c,d;\n\nscanf(\"%d %d %d %d\",&x,&y,&a,&b);\nc=1;\n\nwhile(c%x !=0 || c%y !=0 ) {c=c+1;}\n\nd=(b/c - (a-1)/c) ;\n\nprintf(\"%d\",d);\n\n\nreturn 0;\n}"}, {"source_code": "#include \n#include \n\nint gcd(int a, int b) {\n\tif(b == 0) return a;\n\treturn gcd(b, a%b);\n}\n\nint lcm(int a, int b) {\n\treturn (a/gcd(a,b))*b;\n}\n\nint main() {\n\tint x, y, a, b;\n\n\tscanf(\"%d %d %d %d\", &x, &y, &a, &b);\n\n\tprintf(\"%d\", b/lcm(x,y) - a/lcm(x,y) + (a%lcm(x, y) == 0 ? 1 : 0));\n\n\treturn 0;\n}"}, {"source_code": "#include\n long gcd(long x,long y);\n int main()\n {\n long x,y,l,p,q;\n long a,b;\n scanf(\"%ld%ld%ld%ld\",&x,&y,&a,&b);\n l=(x*y)/gcd(x,y);\n p=a/l;q=b/l;\n if(a%l==0)\n q++;\n printf(\"%ld\",q-p);\n return(0);\n }\n long gcd(long x,long y)\n {\n if(y>x)\n return gcd(y,x);\n else if(y==0)\n return x;\n else\n return gcd(y,x%y);\n }"}, {"source_code": "#include\nint main()\n{\n long long int x,y,a,b,i,k,l=0,rem,j,m,n;\n scanf(\"%lld %lld %lld %lld\",&x,&y,&a,&b);\n m=x;\n n=y;\n while(y!=0)\n {\n rem=x%y;\n x=y;\n y=rem;\n }\n k=(m*n)/x;\n if(a%k!=0)\n {\n j=a+k-a%k;\n if(j<=b)\n {\n l=1;\n }\n }\n else\n {\n j=a;\n l=1;\n }\n i=b-j;\n if(i<=0)\n {\n l=l;\n }\n else\n {\n l=l+(i/k);\n }\n printf(\"%lld\\n\",l);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int x,y,a,b,l,m,n,hcf,lcm;\n scanf(\"%d %d %d %d\",&x,&y,&a,&b);\n if(x>y)\n { l=x;\n m=y;\n }\n else\n {\n l=y;\n m=x;\n }\n n=1;\n while(1)\n {\n n=l%m;\n if(n==0)\n {\n hcf=m;\n break;\n }\n else\n {\n n=l%m;\n l=m;\n m=n;\n }\n }\n lcm=(x*y)/hcf;\n n=(b/lcm)-(a/lcm);\n if(a%lcm==0)\n n++;\n printf(\"%d\",n);\n return 0;\n}\n"}, {"source_code": "#include \n#ifdef LOCAL\n#include \n#endif\nint gcd(int big, int small)\n{\n int tmp = 1;\n while(tmp > 0)\n {\n tmp = big % small;\n big = small, small = tmp;\n }\n return big;\n}\nvoid swap(int *first, int *second)\n{\n int tmp;\n tmp = *first;\n *first = *second;\n *second = tmp;\n}\nint main()\n{\n#ifdef LOCAL\n\tfreopen(\"test.txt\", \"r\", stdin);\n#endif\n int x, y, a, b;\n scanf(\"%d%d%d%d\", &x, &y, &a, &b);\n if(y > x)\n swap(&x, &y);\n int m = (x * y) / gcd(x, y);\n int start;\n if(a % m == 0)\n start = a/m;\n else\n start = a/m+1;\n printf(\"%d\\n\", b/m-start+1);\n#ifdef LOCAL\n printf(\"It took %f seconds.\\n\", ((double)clock())/CLOCKS_PER_SEC);\n#endif\n}"}, {"source_code": "#include\nint main()\n{\n int x,y,c=0,big;\n long long int a,b,i,q=-1,lcm;\n scanf(\"%d%d%I64d%I64d\",&x,&y,&a,&b);\n if(x>y)\n big=x;\n else\n big=y;\n // printf(\"%d\\n\",big);\n for(i=big;;i++)\n {\n if(i%x==0 && i%y==0)\n {\n lcm=i;\n break;\n\n }\n }\n //printf(\"%I64d \",lcm);\n for(i=a;i<=b;i++)\n {\n if(i%lcm==0)\n { // printf(\"%I64d\",b-i);\n q=(b-i)/lcm;\n break;\n }\n }\n\n\n printf(\"%I64d\",q+1);\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n //freopen(\"in.txt\",\"r\",stdin);\n int x,y,a,b,n,m,r,t=0;\n scanf(\"%d%d%d%d\",&n,&m,&a,&b);\n x=n;\n y=m;\n if(x\nint hcf(int a,int b)\n{\n\tif(b==0)\n\t\treturn a;\n\telse\n\t\thcf(b,a%b);\n}\nint main()\n{\n\tint l,k,j,i;\n\tint x,y,a,b;\n\tscanf(\"%d%d%d%d\",&x,&y,&a,&b);\n\tint lcm=(x*y)/hcf(x,y);\n\tint num=0;\n//\tprintf(\"%d \",lcm);\n//\tnum=(b-a)/lcm;\n//\tprintf(\"%d \",num);\n\tint g=b/lcm;\n\tint h=a/lcm;\n\tnum=g-h;\n\tif(a%lcm==0)\n\t\tnum++;\n\tprintf(\"%d\\n\",num);\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nint x,y,a,b;\nint k;\nint gcd(int x,int y)\n{\n\tif (x%y==0) return y;\n\treturn gcd(y,x%y);\n}\nint main()\n{\n\tscanf(\"%d%d%d%d\",&x,&y,&a,&b);\n\tk=x*y;\n\tk/=gcd(x,y);\n\tprintf(\"%d\",b/k-(a-1)/k);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint divisor(int x, int y)\n{\n\tint c = y;\n\twhile(x % y){\n\t\tc = x % y;\n\t\tx = y;\n\t\ty = c;\n\t}\n\treturn c;\n}\nint main()\n{\n\tint x, y, c, sum;\n\tlong long a, b;\n\tscanf(\"%d%d%I64d%I64d\", &x, &y, &a, &b);\n\tc = x*y/divisor(x,y);\n\tsum = (b/c - (a-1)/c);\n\tprintf(\"%d\\n\", sum);\n\treturn 0;\n}"}, {"source_code": "#include\nlong int gcd(long int x,long int y)\n{\n\tif(x=a)\n\t\t\tcount++;\n\t}\n\t\n\t*/\n\t/*\tfor(i=a;i<=b,i<=a+l;i++);\n\tfor(k=i;k<=b;k+=l)\n\t\tcount++;\n*/\t/*for (i=a;i<=b;i++)\n\t{\n\t\tif(i%l == 0)\n\t\t{\n\t//\t\tprintf(\"%d\\n\",i);\n\t\t\tcount++;\n\t\t}\n\t}*/\n\tprintf(\"%ld\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include\nmain()\n{\n int x,y,a,b,c=0,max;\n scanf(\"%d%d%d%d\",&x,&y,&a,&b);\n max=x>y?x:y;\n while(1)\n { if(max%x==0 && max%y==0) break;\n else max++;\n }\n c=(b/max)-((a-1)/max);\n printf(\"%d\",c);\n return 0;\n}"}, {"source_code": "#include\n\nlong int getGCD(int a,int b);\n\nint main(){\n int i,x,y;\n long int a,b,j;\n scanf(\"%d %d %lu %lu\",&x,&y,&a,&b);\n long int lcm,gcd;\n if(x\nint main()\n{\n int i,j,r=0;\n int x,y,a,b;\n scanf(\"%d %d %d %d\",&x,&y,&a,&b);\n for(i=y;i<=x*y;i++){\n if(i%y==0&&i%x==0){\n break;\n }\n }\n int k=((b/i)-((a-1)/i));\n printf(\"%d \",k);\n return 0;\n}\n"}, {"source_code": "#include\nlcm(int n1,int n2)\n{\n int temp1=n1; int temp2=n2; \n if(temp1==temp2)\n {\n return n1;\n }\n while(temp1!=temp2) \n {\n if(temp1>temp2) \n temp1-=temp2; \n else \n temp2-=temp1; \n }\n return (n1*n2)/temp1;\n}\nint main()\n{\n long a,b,c,d=0,i,x,y,e;\n scanf(\"%ld%ld%ld%ld\",&x,&y,&a,&b);\n if(x==y)\n {\n if(x==a)\n {\n d=b/x;\n \n }\n else\n d=(b/x)-a+1;\n goto z;\n }\n if(a==1)\n {\n d=(b/lcm(x,y));\n goto z;\n } \n if(a%x==0)\n {\n c=a/x;\n for(i=a;i<=b;i=c*x)\n {\n if(i%y==0)\n {\n d++;\n } \n c++;\n }\n } \n else\n {\n e=a+x-(a%x);\n if(y==1)\n {\n d=(b/e)-a+1;\n goto z;\n }\n c=e/x;\n for(i=e;i<=b;i=c*x)\n {\n if(i%y==0)\n {\n d++;\n } \n c++;\n }\n } \n z:\n printf(\"%ld\",d);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n#include \nint main ( void ){\n unsigned long int x,y,a,b,j,z,f,i;\n scanf(\"%d %d %d %d\",&x,&y,&a,&b);\n z=findgcd(x,y);\n f=x*y/z;\n i=(a-1)/f;\n j=b/f;\n printf(\"%d\",j-i);\n return 0;\n}\nint findgcd(int x,int y){\n while(x!=y){\n if(x>y)\n return findgcd(x-y,y);\n else\n return findgcd(x,y-x);\n }\n return x;\n}"}, {"source_code": "#include \n\n#define int long long\n\nint gcd(int x, int y)\n{\n\treturn (y ? gcd(y, x % y) : x);\t\n}\nint lcm(int x, int y)\n{\n\treturn (x / gcd(x, y) * y);\n}\n\nsigned main(void)\n{\n\tint x, y, c;\n\tint a, b;\n\tint i;\n\n\tscanf(\"%lld %lld %lld %lld\", &x, &y, &a, &b);\n\tx = lcm(x, y);\n\n\tif (a != 1){\n\t\tprintf(\"%I64d\\n\", b / x - (a - 1) / x);\n\t}\n\telse {\n\t\tprintf(\"%I64d\\n\", b / x);\n\t}\n\n\treturn (0);\n}"}, {"source_code": "#include \n\nint main(void)\n{\nint a,b,x,y,c,d;\n\nscanf(\"%d %d %d %d\",&x,&y,&a,&b);\nc=1;\n\nwhile(c%x !=0 || c%y !=0 ) {c=c+1;}\n\nd=(b/c - (a-1)/c) ;\n\nprintf(\"%d\",d);\n\n\nreturn 0;\n}\n"}, {"source_code": "#include \nint main ()\n{\n int i,j,n,l,f,a,b,count=0;\n scanf(\"%d %d %d %d\",&l,&f,&a,&b);\n for(i=l;i<=l*f;i=i+l) {\n if(i%f==0) {\n count=i;\n break;\n }\n }\n n=b/count-(a-1)/count;\n printf(\"%d\\n\",n);\n return 0;\n}\n"}], "negative_code": [{"source_code": "\n#include \n\nint main(void) {\n int x, y, a, b, i, c, m=0, f=0, g;\n \n scanf(\"%d %d %d %d\",&x, &y, &a, &b);\n\n \n if(a%x==0)\n c=a/x;\n \n else \n c=(a/x)+1;\n \n for(i=c; i<=b/x; i++)\n {\n \n if((m==1)&&(x*i%y==0))\n {\n g=((b/x-f)/(i-f))+1;\n printf(\"%d\\n\",g);\n break;\n }\n \n if(x*i%y==0)\n {\n f=i;\n m++;\n }\n else if ((m==1)&&(i==b/x))\n printf(\"1\");\n }\n \n if ((m==1)&&(c==b/x))\n printf(\"1\");\n \n\n if((m==0)&&(c==b/x))\n printf(\"0\");\n\n return 0;\n}\n\n"}, {"source_code": "#include \nint getit(int x, int y, int b)\n{\n int i = 0, smaller = x < y? x:y, bigger = x > y?x:y;\n for(i = bigger; i < b; i+=bigger)\n if(i % smaller == 0)\n return i;\n return x*y;\n}\nint main()\n{\n\tlong long x = 0, y = 0, a = 0, b = 0, i = 0, total = 0, wanted = 0;\n\tscanf(\"%d%d%d%d\",&x,&y,&a,&b);\n\twanted = y % x == 0? y:getit(x,y,b);\n\n for(i = a; i <= b; i++)\n if(i % wanted == 0)\n {\n a = i;\n break;\n }\n if(a == b && wanted != a)\n printf(\"0\");\n else\n printf(\"%d\",1+(b-a)/wanted);\n}"}, {"source_code": "#include\n#include\n\nint main()\n{\n int x, y;\n long long int a,b,i,j,k,count =0 ;\n scanf(\"%d%d%I64d%I64d\",&x,&y,&a,&b);\n j = xy?x:y;\n for(i = a;i <= b;i += j)\n {\n if(i%k==0)count++;\n }\n printf(\"%I64d\",count);\n return 0;\n}\n"}, {"source_code": "#include \n\ntypedef long long int int64;\n\nint main(void)\n{\n\tint x, y;\n\tint64 a, b;\n\n\tscanf(\"%d %d %lld %lld\", &x, &y, &a, &b);\n\tx *= y;\n\tprintf(\"%I64d\\n\", (b + a) / x);\n\treturn (0);\n}"}, {"source_code": "#include\nint f1(int n,int m)\n{\nif(m==0)\nreturn n;\nreturn f1(m,n%m);\n}\n\nmain()\n{\n int x,y,a,b,ans,f,g;\n scanf(\"%d %d %d %d\",&x,&y,&a,&b);\n g=f1(x,y);\n f=(x*y)/g;\n// printf(\"%d %d\\n\",f,g);\n ans=b/f-a/f;\n if(a%g==0)\n ans++;\n printf(\"%d\",ans);\n// scanf(\"%d\",&x);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int i,a,t,b,x,y,count=0,tmp;\n scanf(\"%d%d%d%d\",&x,&y,&a,&b);\n for(i=2; i<=(a*b); i++)\n {\n if(i%x==0&&i%y==0)\n {\n t=i;\n break;\n }\n }\n count=(b/t)-(a/t);\n if(a%t==0)\n count++;\n printf(\"%d\",count);\n return 0;\n}\n"}, {"source_code": "#include \nint gcd(int a, int b);\nint main(void){\n\tint x,y,a,b,i,count = 0,lcm;\n\tscanf(\"%d %d %d %d\", &x, &y, &a, &b);\n\n\tlcm = (x * y) / gcd(x,y);\n\n\tfor(i = 1; ; i++){\n\t\tx = i * lcm;\n\t\tif(x >= a && x <= b)\n\t\t\tcount++;\n\t\t\n\t\tif(x > b)\n\t\t\tbreak;\n\t}\n\n\tprintf(\"%d\\n\", count);\n\treturn 0;\n}\n\nint gcd(int a, int b){\n\tif(b == 0)\n\t\treturn a;\n\t\t\n\telse\n\t\treturn (b , b/a);\n}\n"}, {"source_code": "#include\n#include\n#include\n\nint cmmc(int num1, int num2) {\n\n int resto, a, b;\n\n a = num1;\n b = num2;\n\n do {\n resto = a % b;\n\n a = b;\n b = resto;\n\n } while (resto != 0);\n\n return ( num1 * num2) / a;\n}\n\nint main(){\n int x,y,a,b;\n int mmc, count=0, diff;\n scanf(\"%d %d %d %d\", &x, &y, &a, &b);\n mmc= cmmc(x,y);\n if(a/mmc >=0 && a/mmc <=1){\n a=mmc;\n }else if(a %mmc!=0){\n a=((a/mmc)*mmc)+mmc;\n }\n diff=b-a;\n if(diff!=0){\n count=diff/mmc;\n if(count!=0 || (a%mmc==0))\n count++;\n }else{\n if(a%x==0){\n count=1;\n }\n }\n printf(\"%d\\n\", count);\n return 0;\n\n}\n"}, {"source_code": "#include \nint main()\n{\n int x,y,a,b,c,d,i,count=0,t,m,gcd;\n scanf(\"%d %d %d %d\",&x,&y,&a,&b);\n if(x > y)\n {\n t = x;\n x = y;\n y = t;\n }\n c = x;\n d = y;\n if(x == 0) gcd = y;\n else if(y == 0) gcd = x;\n else\n {\n while(y != 0)\n {\n t = y;\n y = x%y;\n x = t;\n }\n gcd = x;\n }\n i = 1;\n while(gcd <=x )\n {\n gcd *= i;\n i++;\n }\n printf(\"%d\",i);\n return 0;\n}\n"}, {"source_code": "#include\nlong int gcd(int a,int b)\n{\n int c;\n while(a!=b)\n {\n if(a>b)\n a=a-b;\n else\n {\n c=b;\n b=a;\n a=c;\n }}\n return a;\n\n}\n\nmain()\n{\n long int g,j,a,b,x,y,i,p,cnt=0;\n scanf(\"%d%d%d%d\",&a,&b,&x,&y);\n g=gcd(a,b);\n p=a*b;\n g=p/g;\n i=x;\n j=y;\n while(i%g!=0&&i<=y)\n {\n i++;\n }\n while(y%g!=0&&j>=x)\n {\n y--;\n }\n if(x==y&&x%g!=0)\n {\n printf(\"0\");\n exit(0);\n }\n p=j-i;\n cnt=p/g;\n printf(\"%d\",cnt+1);\n return 0;\n}\n"}, {"source_code": "#include \n\nlong long int lcm(long long int a,long long int b,long long int x)\n{\n if(a%b)\n lcm(a+x,b,x);\n else\n return a;\n}\nint main()\n{\n long long p,q,r,s,common,i,count=0,low,m,n,range;\n scanf(\"%I64d %I64d %I64d %I64d\",&p,&q,&r,&s);\n if(p>q)\n common=lcm(p,q,p);\n else\n common=lcm(q,p,q);\n //printf(\"common:%I64d\\n\",common);\n if(r%common==0)\n {\n low=r;\n }\n else\n {\n m=r/common;\n low=(m+1)*common;\n }\n range=s-low;\n count=range/common;\n //for(i=low; i<=s; i+=common)\n //{\n //count++;\n //}\n printf(\"%I64d\",count+1);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int x,y,a,b,max,lcm,i,ans,d;\n scanf(\"%d %d %d %d\",&x,&y,&a,&b);\n max=y;\n if(x>=y)\n max=x;\n lcm=x*y;\n for(i=max;i<=x*y;i++)\n {\n if(i%x==0&&i%y==0)\n {\n lcm=i;\n break;\n }\n }\n ans=(b/lcm)-(a/lcm);\n if(lcm%a==0||lcm%b==0)\n ans+=1;\n if(lcm%a==0&&lcm%b==0)\n ans=ans-1;\n printf(\"%d\",ans);\n return 0;\n}"}, {"source_code": "#include\nint arr[1000001],ar[1000001];\nint main()\n{\n\tint x,y,a,b;\n\tint ans=0,k1=0,k2=0;\n\tint i,max,min;\n\tscanf(\"%d%d%d%d\",&x,&y,&a,&b);\n\tif(x=a)\n\t\t{\n//\t\t\tprintf(\"%d \",i);\n\t\t\tarr[k1]=i;\n\t\t\tk1++;\n\t\t}\n\t}\t\n//\tprintf(\"\\n\");\n\tfor(i=y;i<=b;i+=max)\n\t{\n\t\twhile(arr[k2]\nint getit(int x, int y, int b)\n{\n int i = 0, smaller = x < y? x:y, bigger = x > y?x:y;\n for(i = bigger*2; i < b; i+=bigger)\n if(i % x == 0)\n return i;\n return x*y;\n}\nint main()\n{\n\tlong long x = 0, y = 0, a = 0, b = 0, i = 0, total = 0, wanted = 0;\n\tscanf(\"%d%d%d%d\",&x,&y,&a,&b);\n\twanted = x == y? x:getit(x,y,b);\n for(i = a; i <= b; i++)\n if(i % wanted == 0)\n {\n a = i;\n break;\n }\n printf(\"%d\",(b-a+1)/wanted);\n}"}, {"source_code": "#include \n\ntypedef long long int int64;\n\nint main(void)\n{\n\tint x, y;\n\tint64 a, b;\n\n\tscanf(\"%d %d %lld %lld\", &x, &y, &a, &b);\n\tx *= y;\n\tprintf(\"%I64d\\n\", b / x + (a - 1) / x);\n\treturn (0);\n}"}, {"source_code": "#include\n#include\nint gcd(int a,int b){\n\tif(b==0) return a;\n\treturn gcd(b,a%b);\n}\nint main(){\n\tint x,y;\n\tlong int a,b;\n\tscanf(\"%d%d%ld%ld\",&x,&y,&a,&b);\n\tlong int i,count=0;\n\tint lcm;\n\tlcm=x*y;\n\tlcm=lcm/(gcd(x,y));\n\tfor(i=a;i<=b;i++){\n\t\tif(i%x==0 && i%y==0) {\n\t\t\tcount++;\n\t\t\tbreak;\n\t\t}\n\t}\n\tfor(;i<=b;i=i+lcm)\n\t\tcount++;\n\tprintf(\"%ld\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int x,y,a,b,i,count=0,t,d;\n scanf(\"%d %d %d %d\",&x,&y,&a,&b);\n if(x > y)\n {\n t = x;\n x = y;\n y = t;\n }\n d = (b-a)/y;\n for(i = 1; i <= d; i++)\n {\n if((i*y)%x == 0)\n {\n count++;\n }\n }\n if(a%x == 0 && a%y == 0)\n count++;\n if((b-a)%2 == 0)\n printf(\"%d\",count);\n else\n printf(\"%d\",count-1);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tint a,b,c,d,i,l,r;\n\tdouble t,g;\n\tscanf(\"%d %d %d %d\",&a,&b,&c,&d);\n\tg=a*b;\n\tt=(double)(c/g);\n\tr=ceil(t);\n\tl=0;\n\tfor (i=r*g;i<=d;i+=g){\n\t\tl=l+1;\n\t}\n\tprintf(\"%d\",l);\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main(){\nlong long x,y,a,b,i,count=0,lcm,gcd,t,x1,y1;\nscanf(\"%I64d\",&x);\nscanf(\"%I64d\",&y);\nscanf(\"%I64d\",&a);\nscanf(\"%I64d\",&b);\n\nx1=x;\ny1=y;\nwhile (y1 != 0) {\n t = y1;\n y1 = x1 % y1;\n x1 = t;\n }\n \ngcd = x1;\nlcm = (x*y)/gcd;\ncount = (b-a)/lcm;\nif(count%2 == 0)\n printf(\"%I64d\",count + 1);\nelse\n printf(\"%I64d\",count);\nreturn 0; \n}\n"}, {"source_code": "#include\n#include\nint gcd(int a,int b)\n{\n int t;\n if(a==0)\n return a;\n else if(b==0)\n return b;\n else{\n while(b!=0){\n t=b;\n b=a%b;\n a=t;\n }\n return a;\n }\n}\nint is_prime(int n)\n{\n int i;\n if(n==1)\n return 0;\n else if(n==2)\n return 1;\n else if(n%2==0)\n return 0;\n else{\n for(i=3;i<=sqrt(n);i=i+2){\n if(n%i==0){\n return 0;\n }\n }\n return 1;\n }\n}\nint main ()\n{\n int x,y,a,b,c,i,ct;\n scanf(\"%d%d\",&x,&y);\n if(is_prime(x)==1&&is_prime(y)==1){\n c=x*y;\n }\n else{\n c=(x*y)/gcd(x,y);\n }\n while(scanf(\"%d%d\",&a,&b)!=EOF){\n ct=0;\n for(i=a;i<=b;i=i+c){\n\n ct++;\n\n }\n printf(\"%d\\n\",ct);\n }\n return 0;\n}\n"}, {"source_code": "#include \nint gcd (int x, int y);\nint main(void){\n\tint x,y,a,b,i=1;\n\tint cou,sum;\n\tint coucmp;\n\tscanf(\"%d%d%d%d\",&x,&y,&a,&b);\n\tcou=x/gcd(x,y)*y;\n\tcoucmp=cou;\n\twhile(coucmp\nlong int gcd(int a,int b)\n{\n int c;\n while(a!=b)\n {\n if(a>b)\n a=a-b;\n else\n {\n c=b;\n b=a;\n a=c;\n }}\n return a;\n\n}\n\nmain()\n{\n long int g,j,a,b,x,y,i,p,cnt=0;\n scanf(\"%d%d%d%d\",&a,&b,&x,&y);\n g=gcd(a,b);\n p=a*b;\n g=p/g;\n i=x;\n j=y;\n while(i%g!=0&&i<=y)\n {\n i++;\n }\n while(j%g!=0&&j>=x)\n {\n j--;\n }\n p=j-i;\n cnt=p/g;\n printf(\"%d\",cnt+1);\n return 0;\n}\n"}, {"source_code": "#include\nint divisor(int x, int y)\n{\n\tint c = x;\n\twhile(x % y){\n\t\tc = x % y;\n\t\tx = y;\n\t\ty = c;\n\t}\n\treturn c;\n}\nint main()\n{\n\tint x, y, c, sum = 0, e, f;\n\tlong long a, b;\n\tscanf(\"%d%d%I64d%I64d\", &x, &y, &a, &b);\n\tif(x < y)\n\t{\n\t\tint d = x;\n\t\tx = y;\n\t\ty = d;\n\t}\n\tf = c = x * y / divisor(x,y);\n\te = a / c;\n\tif( a%c ==0 && c < a){\n\t\tc = e * c;\n\t\tsum++;\n\t}\n\tif(a%c !=0 && c < a){\n\t\tc = (++e)*c;\n\t\tsum++;\n\t}\n\twhile(1)\n\t{\n\t\tc += f;\n\t\tif(c > b)\n\t\t\tbreak;\n\t\tsum++;\n\t}\n\tprintf(\"%d\\n\", sum);\n\treturn 0;\n}"}, {"source_code": "#include \nint main()\n{\n long long int x,y,a,b,k,lcm,p,i,count=0;\n scanf(\"%I64d %I64d %I64d %I64d\",&x,&y,&a,&b);\n\n if(x=a){\n count=b/lcm;\n }\n else{\n if(x==y)\n count=(b-a)/lcm+1;\n else\n count=(b-a)/lcm;\n }\n\n\n\n\n\n printf(\"%I64d\\n\",count);\n\n\n\n\n\n}\n"}, {"source_code": "#include\nlong int gcd(int a,int b)\n{\n int c;\n while(a!=b)\n {\n if(a>b)\n a=a-b;\n else\n {\n c=b;\n b=a;\n a=c;\n }}\n return a;\n\n}\n\nmain()\n{\n long int g,j,a,b,x,y,i,p,cnt=0;\n scanf(\"%d%d%d%d\",&a,&b,&x,&y);\n g=gcd(a,b);\n p=a*b;\n g=p/g;\n i=x;\n j=y;\n while(i%g!=0&&i<=y)\n {\n i++;\n }\n while(j%g!=0&&j>=x)\n {\n j--;\n }\n if(i==j&&i%g!=0)\n {\n printf(\"0\");\n exit(0);\n }\n p=j-i;\n cnt=p/g;\n printf(\"%d\",cnt+1);\n return 0;\n}\n"}, {"source_code": "#include\n\nvoid oku ()\n{\n\tint a,b,top,kont,i,x,y;\n\tint ortak=1;\n\tscanf(\"%d %d %d %d\",&a,&b,&x,&y);\n\tif(a>b)top=a;\n\telse top=b;\n\tfor(i=1 ; i<=top ;i++)\n\t{\n\t\tif(a%i==0 && b%i==0)\n\t\t\tortak=i;\t\n\t\t\t\n\t\n\t}\n\tint bolen,kalan,bolum,basla;\n\tbolen=a*b/ortak;\n\tkalan=x%bolen;\n\tbolum=x/bolen;\n\t\n\tbasla=bolen*bolum+kalan;\n\ttop=0;\n\tfor( ; basla<=y ;basla+=bolen )\t\n\t{\n\t\t\ttop++;\t\n\t}\n\tprintf(\"%d\\n\",top);\n\n}\n\nint main ()\n{\n\toku ();\n\treturn 0;\n}\t\n"}, {"source_code": "#include \nint getit(int x, int y, int b)\n{\n int i = 0, smaller = x < y? x:y, bigger = x > y?x:y;\n for(i = bigger*2; i < b; i+=bigger)\n if(i % smaller == 0)\n return i;\n return x*y;\n}\nint main()\n{\n\tlong long x = 0, y = 0, a = 0, b = 0, i = 0, total = 0, wanted = 0;\n\tscanf(\"%d%d%d%d\",&x,&y,&a,&b);\n\twanted = x == y? x:getit(x,y,b);\n\n for(i = a; i <= b; i++)\n if(i % wanted == 0)\n {\n a = i;\n break;\n }\n if(x == 1 && y == 1)\n printf(\"%d\",b-a+1);\n else if(wanted > b)\n printf(\"0\");\n else\n printf(\"%d\",1+(b-a+1)/wanted);\n}"}, {"source_code": "#include\n#include\nint gcd(int a,int b)\n{\n int t;\n if(a==0)\n return a;\n else if(b==0)\n return b;\n else{\n while(b!=0){\n t=b;\n b=a%b;\n a=t;\n }\n return a;\n }\n}\nint is_prime(int n)\n{\n int i;\n if(n==1)\n return 0;\n else if(n==2)\n return 1;\n else if(n%2==0)\n return 0;\n else{\n for(i=3;i<=sqrt(n);i=i+2){\n if(n%i==0){\n return 0;\n }\n }\n return 1;\n }\n}\nint main ()\n{\n int x,y,a,b,c,i,ct;\n scanf(\"%d%d\",&x,&y);\n if(is_prime(x)==1&&is_prime(y)==1){\n c=x*y;\n }\n else{\n c=(x*y)/gcd(x,y);\n }\n while(scanf(\"%d%d\",&a,&b)!=EOF){\n ct=0;\n for(i=a;i<=b;i=i+c){\n\n ct++;\n\n }\n printf(\"%d\\n\",ct);\n }\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int x,y,ans=0;\n long long int a,b,i=1;\n scanf(\"%d%d%I64d%I64d\",&x,&y,&a,&b);\n int t;\n if(x==y)\n {\n printf(\"%d\",(b-a+1)/x);\n }\n t=x>y?x:y;\n while(i%t!=0)\n i++;\n t=i;\n for(;i<=b;i=i+t)\n {\n if(i%x==0&&i%y==0&&i>=a)\n {\n ans++;\n }\n\n }\n printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint x,y,a,b,n,t;\n\tscanf(\"%d%d%d%d\",&x,&y,&a,&b);\n\tn=x;\n\tint num=0;\n\tif(5000000*x=a)\n\t\t{\n\t\t\tif(n%y==0)\n\t\t\t\tnum++;\n\t\t}\n\t\tn=n+x;\n\t}\n\tprintf(\"%d\\n\",num);\n\treturn 0;\n}\n"}, {"source_code": "#include \nint gcd(int a, int b);\nint main(void){\n\tint x,y,a,b,i,count = 0,lcm;\n\tscanf(\"%d %d %d %d\", &x, &y, &a, &b);\n\n\tlcm = (x * y) / gcd(x,y);\n\n\tfor(i = 1; ; i++){\n\t\tx = i * lcm;\n\t\tif(x >= a && x <= b)\n\t\t\tcount++;\n\t\t\n\t\tif(x > b)\n\t\t\tbreak;\n\t}\n\n\tprintf(\"%d\\n\", count);\n\treturn 0;\n}\n\nint gcd(int a, int b){\n\tif(b == 0)\n\t\treturn a;\n\t\t\n\telse\n\t\treturn (b , b/a);\n}\n"}, {"source_code": "#include\n#include\n#include\nint main()\n{\n long long x, y, i, j, temp, k;\n long long int a, b;\n int count=0;\n scanf(\"%lld %lld %lld %lld\", &x, &y, &a, &b);\n if(x>y){\n temp = x;\n x = y;\n y = temp;\n }\n j = a/y;\n k = b/y;\n for(;j<=k;j++){\n if((y*j)%x==0){\n count++;\n }\n }\n printf(\"%d\",count);\n return 0;\n}\n"}, {"source_code": "int main()\n{\n int x,y,a,b,t;\n scanf(\"%d %d %d %d\", &x, &y, &a, &b);\n int p = x*y;\n if (x < y)\n {\n int t = x;\n x = y;\n y = t;\n }\n while (y)\n {\n t = x%y;\n x = y;\n y = t;\n }\n p = p/x;\n int m = a - 1/p;\n int n = b/p;\n printf(\"%d\\n\", n - m);\n \n return 0;\n}"}, {"source_code": "#include \n#include \n\nint main () {\n\tint x, y, a, b, count, increment;\n\tscanf(\"%d\", &x);\n\tscanf(\"%d\", &y);\n\tscanf(\"%d\", &a);\n\tscanf(\"%d\", &b);\n\tif ( x == 1 || y == 1 ) {\n\t\tif ( a > b ) b = a;\n\t\tcount = (int) x == 1 ? b/y : b/x;\n\t\tprintf (\"%d\\n\", count);\n\t\treturn 0;\n\t}\n\tcount = 0;\n\tincrement = 1;\n\tfor ( ; a <= b; a+=increment ) {\n\t\tif ( a%x == 0 && a%y == 0 ) {\n\t\t\tif ( x <= y )\n\t\t\t\tincrement = x;\n\t\t\telse\n\t\t\t\tincrement = y;\t\n\t\t\t++count;\n\t\t}\n\t}\n\tprintf (\"%d\\n\", count);\n\treturn 0;\n}\n"}, {"source_code": "#include \nint getit(int x, int y, int b)\n{\n int i = 0;\n for(i = y*2; i < b; i+=y)\n if(i % x == 0)\n return i;\n}\nint main()\n{\n\tlong long x = 0, y = 0, a = 0, b = 0, i = 0, total = 0, wanted = 0;\n\tscanf(\"%d%d%d%d\",&x,&y,&a,&b);\n\twanted = x == y? x:getit(x,y,b);\n for(i = a; i <= b; i++)\n if(i % wanted == 0)\n {\n a = i;\n break;\n }\n for(i = b; i >= a; i--)\n if(i % wanted == 0)\n {\n b = i;\n break;\n }\n printf(\"%d\",(b-a+1)/wanted+1);\n}"}, {"source_code": "#include \n#include \n#include \n#include \n#include \nint main ( void ){\n unsigned long int x,y,a,b,i,counter=0,j,z,f;\n scanf(\"%d %d %d %d\",&x,&y,&a,&b);\n z = (x > y ? x : y );\n f=(x\nint gcd(int a, int b);\nint main(void){\n\tint x,y,a,b,count = 0,lcm;\n\tscanf(\"%d %d %d %d\", &x, &y, &a, &b);\n\n\tlcm = (x * y) / gcd(x,y);\n\t\n\tif((b-a) % lcm == 0)\n\t\tcount = ((b - a)/lcm)+1;\n\telse\n\t\tcount = (b - a)/lcm;\n\t\t\n\tprintf(\"%d\\n\", count);\n\treturn 0;\n}\n\nint gcd(int a, int b){\n\tif(b == 0)\n\t\treturn a;\n\t\t\n\telse\n\t\treturn gcd(b, a%b);\n}\n"}, {"source_code": "#include \nint getit(int x, int y, int b)\n{\n int i = 0, smaller = x < y? x:y, bigger = x > y?x:y;\n for(i = bigger*2; i < b; i+=bigger)\n if(i % smaller == 0)\n return i;\n return x*y;\n}\nint main()\n{\n\tlong long x = 0, y = 0, a = 0, b = 0, i = 0, total = 0, wanted = 0;\n\tscanf(\"%d%d%d%d\",&x,&y,&a,&b);\n\twanted = x == y? x:getit(x,y,b);\n\n for(i = a; i <= b; i++)\n if(i % wanted == 0)\n {\n a = i;\n break;\n }\n printf(\"%d\",1+(b-a+1)/wanted);\n}"}, {"source_code": "#include\nint main()\n{\n int x,y,a,b,max,lcm,i,ans,d;\n scanf(\"%d %d %d %d\",&x,&y,&a,&b);\n max=y;\n if(x>=y)\n max=x;\n lcm=x*y;\n for(i=max;i<=x*y;i++)\n {\n if(i%x==0&&i%y==0)\n {\n lcm=i;\n break;\n }\n }\n ans=(b/lcm)-(a/lcm);\n if(lcm%a==0||lcm%b==0)\n ans+=1;\n printf(\"%d\",ans);\n return 0;\n}"}, {"source_code": "#include\n#include\n\nint main(){\nlong long x,y,a,b,i,count=0,lcm,gcd,t,x1,y1;\nscanf(\"%I64d\",&x);\nscanf(\"%I64d\",&y);\nscanf(\"%I64d\",&a);\nscanf(\"%I64d\",&b);\n\nx1=x;\ny1=y;\nwhile (y1 != 0) {\n t = y1;\n y1 = x1 % y1;\n x1 = t;\n }\n \ngcd = x1;\nlcm = (x*y)/gcd;\ncount = (b-a)/lcm;\nif(lcm == a || lcm == b)\n printf(\"%I64d\",count+1);\nelse\n printf(\"%I64d\",count);\nreturn 0; \n}"}, {"source_code": "#include\n\nint bul(int a,int b,int d)\n{\n\tint i;\n\tfor(i=1;i<=d;i++)\n\t\tif(i%a==0 && i%b==0)\n\t\t\treturn i;\n\treturn 0;\n}\n\nvoid oku()\n{\n\tint a,b,c,d,i,e;\n\tscanf(\"%d %d %d %d\",&a,&b,&c,&d);\n\te=bul(a,b,d);\n\tif(e==0)\n\t{\n\t\tprintf(\"0\");\n\t\treturn;\n\t}\n\tfor(i=c;i<=d;i++)\n\t\tif(i%e==0 && i>=e)\n\t\t{\n\t\t\tc=i;\n\t\t\tbreak;\n\t\t}\n\tfor(i=d;i>=c;i--)\n\t\tif(i%e==0)\n\t\t{\n\t\t\td=i;\n\t\t\tbreak;\n\t\t}\n\tif(c>d)\n\t{\n\t\tprintf(\"0\");\n\t\treturn;\n\t}\n\tprintf(\"%d\",(d-c)/e+1);\n}\n\nint main()\n{\n\toku();\n\treturn 0;\n}\n"}, {"source_code": "#include\nlong int gcd(int a,int b)\n{\n int c;\n while(a!=b)\n {\n if(a>b)\n a=a-b;\n else\n {\n c=b;\n b=a;\n a=c;\n }}\n return a;\n\n}\n\nmain()\n{\n long int g,j,a,b,x,y,i,p,cnt=0;\n scanf(\"%d%d%d%d\",&a,&b,&x,&y);\n g=gcd(a,b);\n p=a*b;\n g=p/g;\n i=x;\n j=y;\n while(i%g!=0)\n {\n i++;\n }\n while(y%g!=0)\n {\n y--;\n }\n p=j-i;\n cnt=p/g;\n printf(\"%d\",cnt+1);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int x,y,a,b,max,lcm,i,ans,d;\n scanf(\"%d %d %d %d\",&x,&y,&a,&b);\n max=y;\n if(x>=y)\n max=x;\n lcm=x*y;\n for(i=max;i<=x*y;i++)\n {\n if(i%x==0&&i%y==0)\n {\n lcm=i;\n break;\n }\n }\n ans=(b/lcm)-(a/lcm);\n if(lcm%a==0)\n ans+=1;\n if(lcm%b==0)\n ans+=1;\n printf(\"%d\",ans);\n return 0;\n}\n "}, {"source_code": "#include \n\nint main(void)\n{\nint a,b,x,y,c,d,e,f,g;\n\nscanf(\"%d %d %d %d\",&x,&y,&a,&b);\nif (x<> d){ e=f;}\nelse e=d,d=f;\n\n}\n\nc=(x/e)*y;\n\n\n\n\n\n\n\n\n\n\nd=(b/c - (a-1)/c) ;\n\nprintf(\"%d \\n\",d);\n\nprintf(\"%d \\n\",e);\n\n\nreturn 0;\n}"}, {"source_code": "#include\n#define M 1500000\nint main()\n{\n //freopen(\"in.txt\",\"r\",stdin);\n int i,j,n;\n int p[M]={0};\n for(i=2;i<=M;i++)\n {\n if(p[i]==0)\n {\n for(j=i+i;j<=M;j=i+j)\n p[j]=1;\n }\n }\n scanf(\"%d\",&n);\n printf(\"2\");\n for(i=3,j=1;j\n#include \nint main()\n{\n int x,y,a,b,i,count=0,t;\n double d;\n scanf(\"%d %d %d %d\",&x,&y,&a,&b);\n if(x > y)\n {\n t = x;\n x = y;\n y = t;\n }\n d = ceil((double)(b-a)/(double)y);\n for(i = 1; i <= d; i++)\n {\n if((i*y)%x == 0)\n {\n printf(\"%d\\n\",i*y);\n count++;\n }\n }\n if((b-a)%2 == 0)\n printf(\"%d\",count);\n else\n printf(\"%d\",count-1);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tint x,y,a,b,large,small,ltemp, count, i;\n\t\n\tscanf(\"%d %d %d %d\",&x,&y,&a,&b);\n\t\n\tlarge = small = x;\n if(x >= y) small = y;\n else large = y;\n\t\n\tcount = 0;\n\tfor(i = 1, ltemp = large ; ltemp <= b; i++){\n\t ltemp = large * i;\n\t if((ltemp >= a) && (ltemp % small == 0)){\n\t count++;\n\t }\n\t}\n printf(\"%d\",count);\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int x,y,c=0,big;\n long long int a,b,i,q=-1,lcm;\n scanf(\"%d%d%I64d%I64d\",&x,&y,&a,&b);\n if(x>y)\n big=x;\n else\n big=y;\n // printf(\"%d\\n\",big);\n for(i=big;;i++)\n {\n if(i%x==0 && i%y==0)\n {\n lcm=i;\n break;\n\n }\n }\n //printf(\"%I64d \",lcm);\n for(i=a;i<=b;i++)\n {\n if(i%lcm==0)\n { printf(\"%I64d\",b-i);\n q=(b-i)/lcm;\n break;\n }\n }\n\n if(q==-1)\n printf(\"%I64d\",q);\n else\n printf(\"%I64d\",q+1);\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(void)\n{\nint a,b,x,y,c,d,e,f,g;\n\nscanf(\"%d %d %d %d\",&x,&y,&a,&b);\nif (x<> d){ e=f;}\nelse e=d,d=f;\n\n}\n\nc=(x/e)*y;\n\n\n\n\n\n\n\n\n\n\nd=(b/c - (a-1)/c) ;\n\nprintf(\"%d \\n\",d);\n\nprintf(\"%d \\n\",e);\n\n\nreturn 0;\n}"}, {"source_code": "#include\nlong long int gcd(long long int a,long long int b)\n{\n\tif(b==0)\n\t\treturn a;\n\treturn gcd(b,a%b);\n}\n\nint main()\n{\n\tlong long int x,y;\n\tlong long int a,b;\n\tscanf(\"%lld%lld%lld%lld\",&x,&y,&a,&b);\n\tlong long int gcd1=gcd(x,y);\n\tlong long int lcm=(x*y)/gcd1;\n\tlong long int count=0;\n\tif(a%lcm==0 || b%lcm==0)\n\t\tcount=1;\n\tprintf(\"%lld\\n\",((b-a)/lcm)+count);\n\treturn 0;\n}\n\t\n"}, {"source_code": "#include\n\nvoid oku ()\n{\n\tint a,b,top,kont=0,i,x,y;\n\tint ortak=1;\n\tscanf(\"%d %d %d %d\",&a,&b,&x,&y);\n\tif(a>b)top=a;\n\telse top=b;\n\tfor(i=1 ; i<=top ;i++)\n\t{\n\t\tif(a%i==0 && b%i==0)\n\t\t\tortak=i;\t\n\t\t\t\n\t\n\t}\n\tint bolen,kalan,bolum,basla,son,bas;\n\tbolen=a*b/ortak;\n\ttop=0;\n\t\n if(x%bolen==0) bas=x;\n else\tif(bolen=x && bas<=y && son>=x && son<=y)\n\t\tprintf(\"%d\\n\",top-1);\n\telse \n\t\tprintf(\"0\");\n\n\n\n\n\n\n}\n\nint main ()\n{\n\toku ();\n\treturn 0;\n}\t\n"}, {"source_code": "#include\n\nint gcd(int, int);\nint lcm(int, int);\n\nint main()\n{\n\tint x, y, LCM;\n\tlong int a, b, answer;\n\tscanf(\"%d %d %ld %ld\", &x, &y, &a, &b);\n\t\n\tLCM = lcm(x, y);\n\t\n\tanswer = (b - a) / LCM;\n\t\n\tif (a % LCM == 0) answer++;\n\t\n\tprintf(\"%ld\\n\", answer);\n\treturn 0;\n}\n\n\nint gcd(int a, int b)\n{\n\tint temp;\n\tif (b <= a)\n\t{\n\t\twhile (a % b != 0)\n\t\t{\n\t\t\ttemp = b;\n\t\t\tb = a % b;\n\t\t\ta = temp;\n\t\t}\n\t\treturn b;\n\t}\n\telse return gcd(b, a); \n}\n\n\nint lcm(int a, int b)\n{\n\treturn (a * b) / gcd(a, b);\n}\n"}, {"source_code": "#include \nint main()\n{\n int x,y,a,b,c,d,i,count=0,t,m,gcd;\n scanf(\"%d %d %d %d\",&x,&y,&a,&b);\n if(x > y)\n {\n t = x;\n x = y;\n y = t;\n }\n c = x;\n d = y;\n if(x == 0) gcd = y;\n else if(y == 0) gcd = x;\n else\n {\n while(y != 0)\n {\n t = y;\n y = x%y;\n x = t;\n }\n gcd = x;\n }\n i = 1;\n while(gcd <=x )\n {\n gcd *= i;\n i++;\n }\n printf(\"%d\",i);\n return 0;\n}\n"}, {"source_code": "#include \nint getit(int x, int y, int b)\n{\n int i = 0, smaller = x < y? x:y, bigger = x > y?x:y;\n for(i = bigger*2; i < b; i+=bigger)\n if(i % x == 0)\n return i;\n return x*y;\n}\nint main()\n{\n\tlong long x = 0, y = 0, a = 0, b = 0, i = 0, total = 0, wanted = 0;\n\tscanf(\"%d%d%d%d\",&x,&y,&a,&b);\n\twanted = x == y? x:getit(x,y,b);\n for(i = a; i <= b; i++)\n if(i % wanted == 0)\n {\n a = i;\n break;\n }\n printf(\"%d\",(b-a+1)/wanted+(b % wanted == 0?1:0));\n}"}, {"source_code": "#include \n\nint main (int args, char** argv) {\n\tint x, y, a, b, count;\n\tint gcd, lcm, quotient, remainder, divisor;\n\t\n// Scan inputs\n\tscanf(\"%d\", &x);\n\tscanf(\"%d\", &y);\n\tscanf(\"%d\", &a);\n\tscanf(\"%d\", &b);\n\t\n// Euclid's Algorithm for gcd(x,y)\n\tif ( x <= y ) {\n\t\tquotient = y;\n\t\tdivisor = x;\n\t}\n\telse {\n\t\tquotient = x;\n\t\tdivisor = y;\n\t}\n\twhile ( (remainder = (quotient%divisor)) != 0 ) {\n\t\tquotient = divisor;\n\t\tdivisor = remainder;\n\t}\n\tgcd = divisor;\n// Lowest Common Multiple - LCM\n\tlcm = (x*y)/gcd;\n// Total Count in float\n\tif ( a >= b ) {\n\t\tcount = (a-b)/lcm;\n\t}\n\telse {\n\t\tcount = (b-a)/lcm;\n\t}\n\t++count;\n// Print\n\tprintf(\"%d\\n\", count);\n\n\treturn 0;\n}\n"}, {"source_code": "#include\nlong long int gcd(long long int a,long long int b)\n{\n\tif(b==0)\n\t\treturn a;\n\treturn gcd(b,a%b);\n}\n\nint main()\n{\n\tlong long int x,y;\n\tlong long int a,b;\n\tscanf(\"%lld%lld%lld%lld\",&x,&y,&a,&b);\n\tlong long int gcd1=gcd(x,y);\n\tlong long int lcm=(x*y)/gcd1;\n\tif(a%lcm!=0)\n\t\ta=a+(lcm-a%lcm);\n\tif(b\nint getit(int x, int y, int b)\n{\n int i = 0, smaller = x < y? x:y, bigger = x > y?x:y;\n for(i = bigger; i < b; i+=bigger)\n if(i % smaller == 0)\n return i;\n return x*y;\n}\nint main()\n{\n\tlong long x = 0, y = 0, a = 0, b = 0, i = 0, total = 0, wanted = 0;\n\tscanf(\"%d%d%d%d\",&x,&y,&a,&b);\n\twanted = x == y? x:getit(x,y,b);\n\n for(i = a; i <= b; i++)\n if(i % wanted == 0)\n {\n a = i;\n break;\n }\n if(x == 1 && y == 1)\n printf(\"%d\",b-a+1);\n else if(wanted > b)\n printf(\"0\");\n else\n printf(\"%d\",1+(b-a+1)/wanted);\n}"}, {"source_code": "#include\nint main()\n{\n long long int a,b,c,d,i,j;\n scanf(\"%lld%lld%lld%lld\",&a,&b,&c,&d);\n if(a==b)printf(\"%lld\\n\",d/a-(c-1)/a);\n else if(a==1 || b==1)\n {\n if(a2 || b>2)\n {\n long long int n=0;\n if(a>b)\n for(i=a; i<=d/2; i+=a)\n {\n if(i%b==0 && i>=c && i<=b)n++;\n }\n else\n {\n for(i=b; i<=d/2; i+=b)\n {\n if(i%a==0 && i>= c && i<= d)n++;\n }\n }\n printf(\"%lld\\n\",n);\n }\n return 0;\n}\n"}, {"source_code": "#include \n\ntypedef long long int int64;\n\nint main(void)\n{\n\tint x, y;\n\tint64 a, b;\n\n\tscanf(\"%d %d %lld %lld\", &x, &y, &a, &b);\n\tx *= y;\n\tif (a != 1){\n\t\tprintf(\"%I64d\\n\", b / x + (a - 1) / x);\n\t}\n\telse {\n\t\tprintf(\"%I64d\\n\", b / x);\n\t}\n\treturn (0);\n}"}, {"source_code": "#include\nint main()\n{\n\tint x,y,a,b,n,t;\n\tscanf(\"%d%d%d%d\",&x,&y,&a,&b);\n\tn=x;\n\tint num=0;\n\tif(500000*x=a)\n\t\t{\n\t\t\tif(n%y==0)\n\t\t\t\tnum++;\n\t\t}\n\t\tn=n+x;\n\t}\n\tprintf(\"%d\\n\",num);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint gcd(int a,int b)\n{\n return b==0?a:gcd(b,a%b);\n}\nint main()\n{\n int i;\n\n int x,y,a,b;\n scanf(\"%d%d%d%d\",&x,&y,&a,&b);\n\n int temp=gcd(x,y);\n int temp2=(x*y)/temp;\n temp=temp2;\n\n if(temp>b)\n\tprintf(\"0\\n\");\n else\n{\t\n /* while(temp2\nint main()\n{\nlong long int x,y,a,b,l,z,w,f,r;\nscanf(\"%I64d%I64d%I64d%I64d\",&x,&y,&a,&b);\nz=x>y?x:y;\nw=x\nint main()\n{\n\tint x,y,a,b,n,t;\n\tscanf(\"%d%d%d%d\",&x,&y,&a,&b);\n\tn=x;\n\tint num=0;\n\tif(5000000*x=a)\n\t\t{\n\t\t\tif(n%y==0)\n\t\t\t\tnum++;\n\t\t}\n\t\tn=n+x;\n\t}\n\tprintf(\"%d\\n\",num);\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nvoid oku ()\n{\n\tint a,b,top,kont=0,i,x,y;\n\tint ortak=1;\n\tscanf(\"%d %d %d %d\",&a,&b,&x,&y);\n\tif(a>b)top=a;\n\telse top=b;\n\tfor(i=1 ; i<=top ;i++)\n\t{\n\t\tif(a%i==0 && b%i==0)\n\t\t\tortak=i;\t\n\t\t\t\n\t\n\t}\n\tint bolen,kalan,bolum,basla,son,bas;\n\tbolen=a*b/ortak;\n\ttop=0;\n\t\n if(x%bolen==0) bas=x;\n else\tif(bolen=x && bas<=y && son>=x && son<=y)\n\t\tprintf(\"%d\\n\",top);\n\telse \n\t\tprintf(\"0\");\n\n\n\n\n\n\n}\n\nint main ()\n{\n\toku ();\n\treturn 0;\n}\t\n"}, {"source_code": "#include\nint main()\n{\n long a,b,c=2,d=0,i,x,y;\n scanf(\"%ld%ld%ld%ld\",&x,&y,&a,&b);\n if(a%x==0)\n {\n c=a/x;\n for(i=a;i<=b;i=c*x)\n {\n if(i%y==0)\n {\n d++;\n } \n c++;\n }\n } \n else\n {\n c=a+x-(a%x);\n \n c=c/x;\n for(i=a;i<=b;i=c*x)\n {\n if(i%y==0)\n {\n d++;\n } \n c++;\n }\n } \n printf(\"%ld\",d);\n return 0;\n}\n"}, {"source_code": "#include\nlcm(int n1,int n2)\n{\n int temp1=n1; int temp2=n2; \n if(temp1==temp2)\n {\n return n1;\n }\n while(temp1!=temp2) \n {\n if(temp1>temp2) \n temp1-=temp2; \n else \n temp2-=temp1; \n }\n return (n1*n2)/temp1;\n}\nint main()\n{\n long a,b,c,d=0,i,x,y,e;\n scanf(\"%ld%ld%ld%ld\",&x,&y,&a,&b);\n if(x==y)\n {\n d=(b/x)-a+1;\n goto z;\n }\n if(a==1)\n {\n d=(b/lcm(x,y));\n goto z;\n } \n if(a%x==0)\n {\n c=a/x;\n for(i=a;i<=b;i=c*x)\n {\n if(i%y==0)\n {\n d++;\n } \n c++;\n }\n } \n else\n {\n e=a+x-(a%x);\n if(y==1)\n {\n d=(b/e)-a+1;\n goto z;\n }\n c=e/x;\n for(i=e;i<=b;i=c*x)\n {\n if(i%y==0)\n {\n d++;\n } \n c++;\n }\n } \n z:\n printf(\"%ld\",d);\n return 0;\n}\n"}, {"source_code": "#include\n\nint gcd(int a, int b);\nlong lcm(int a, int b);\nlong long lcm_count(int x, int y, long long a, long long b);\n\nint main()\n{\n int x, y;\n long long a, b;\n scanf(\"%d %d %lld %lld\",&x,&y,&a,&b);\n printf(\"%lld\\n\",lcm_count(x,y,a,b));\n return 0;\n}\n\n// a <= b\nint gcd(int a, int b)\n{\n int temp;\n while(a)\n {\n temp = a;\n a = b % a;\n b = temp;\n }\n return b;\n}\n\nlong lcm(int a, int b)\n{\n int gcdiv;\n gcdiv = gcd(a,b);\n return((a*b)/gcdiv);\n}\n\nlong long lcm_count(int x, int y, long long a, long long b)\n{\n long lcmul;\n long long result;\n lcmul = lcm(x,y);\n result = (b - a)/lcmul;\n if(!(a % lcmul))\n result++;\n return result;\n}\n"}, {"source_code": "#include\n#define M 1500000\nint main()\n{\n //freopen(\"in.txt\",\"r\",stdin);\n int i,j,n;\n int p[M]={0};\n for(i=2;i<=M;i++)\n {\n if(p[i]==0)\n {\n for(j=i+i;j<=M;j=i+j)\n p[j]=1;\n }\n }\n scanf(\"%d\",&n);\n printf(\"2\");\n for(i=3,j=1;j\n#include \nint main()\n{\n int x,y,a,b,i,count=0,t;\n double d;\n scanf(\"%d %d %d %d\",&x,&y,&a,&b);\n if(x > y)\n {\n t = x;\n x = y;\n y = t;\n }\n d = ceil((double)(b-a)/(double)y);\n for(i = 1; i <= d; i++)\n {\n if((i*y)%x == 0)\n {\n count++;\n }\n }\n if((b-a)%2 == 0)\n printf(\"%d\",count);\n else\n printf(\"%d\",count-1);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint x,y,a,b,n,t;\n\tscanf(\"%d%d%d%d\",&x,&y,&a,&b);\n\tn=x;\n\tint num=0;\n\tif(50000000*x=a && n%y==0)\n\t\t\tnum++;\n\t\tn=n+x;\n\t}\n\tprintf(\"%d\\n\",num);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint gcd(int a,int b)\n{\n\tif(a%b==0)\n\t\treturn b;\n\telse\n\t\tgcd(b,a%b);\n}\nint main()\n{\n\tint x,y;\n\tint a,b;\n\tint count=0;\n\tint hcf,lcm;\n\tscanf(\"%d %d %d %d\",&x,&y,&a,&b);\n\thcf=gcd(x,y);\n\t//printf(\"%d\",hcf);\n\tlcm=x*y/hcf;\n\tcount= b/lcm-a/lcm+1;\n\tprintf(\"%d\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nvoid oku ()\n{\n\tint a,b,x,y,bolen,bas,son;\n\tscanf(\"%d %d %d %d\",&a,&b,&x,&y);\n\tint tut1=a,tut2=b;\n\tfor( ; tut1!=0 && tut2!=0 ; )\n\t{\n\t\tif(tut1>tut2)\n\t\t\ttut1=tut1%tut2;\n\t\telse \n\t\t\ttut2=tut2%tut1;\n\t}\n\tif(tut2)\tbolen=tut2;\n\tif(tut1) bolen=tut1;\n\t\n\tbolen=a*b/bolen;\n//\tprintf(\"%d \\n\",bolen);\n\tif(x%bolen==0)\n\t\tbas=x;\n else if(x>bolen)\n\t\tbas=(bolen-(x%bolen))+x;\n\telse\n\t\tbas=x;\n\tson=y-(y%bolen);\n\tprintf(\"%d %d\\n\",bas,son);\n\tif(son>=x && son<=y && bas<=y && bas>=x)\n\t{\n\t\tprintf(\"%d\\n\",(son-bas)/bolen+1);\n\t}\t\n\telse \n\t\tprintf(\"0\\n\");\n\t\n\n}\t\n\n\nint main ()\n{\n\toku ();\n\treturn 0;\n}\t\n"}, {"source_code": "#include \n\nint main(){\n\tint x,y,a,b;\n\tscanf(\"%d %d %d %d\",&x,&y,&a,&b);\n\tint i, k = x*y, l = 0;\n\tfor(i = a;i<=b;i++){\n\t\tif(i%k == 0) l++;\n\t}\t\n\tprintf(\"%d\\n\",l);\n\treturn 0;\n}\n/* 1503093722564 */\n"}, {"source_code": "#include\nint main()\n{\n int x,y,a,b,max,lcm,i,ans,d;\n scanf(\"%d %d %d %d\",&x,&y,&a,&b);\n max=y;\n if(x>=y)\n max=x;\n lcm=x*y;\n for(i=max;i<=x*y;i++)\n {\n if(i%x==0&&i%y==0)\n {\n lcm=i;\n break;\n }\n }\n ans=(b/lcm)-(a/lcm);\n if(lcm%a==0||lcm%b==0)\n ans+=1;\n printf(\"%d\",ans);\n return 0;\n}"}, {"source_code": "#include\n#include\n#define MIN(a,b) (a\ntypedef unsigned long long int ll;\nll gcd(ll a,ll b)\n{\nif(b==0)\nreturn a;\nreturn gcd(b,a%b);\n}\nmain()\n{\nll x,y,a,b,i;\nscanf(\"%lld%lld%lld%lld\",&x,&y,&a,&b);\nll gcds=(x*y)/gcd(x,y);\nll start=(gcds/a)*gcds;\n//if(start=a)\ncount++;\nprintf(\"%lld\\n\",count);\nreturn 0;\n}\n\n"}, {"source_code": "#include\n#include\nint gcd(int a,int b){\n\tif(b==0) return a;\n\treturn gcd(b,a%b);\n}\nint main(){\n\tint x,y;\n\tlong int a,b;\n\tscanf(\"%d%d%ld%ld\",&x,&y,&a,&b);\n\tlong int i,count=0;\n\tint lcm;\n\tlcm=x*y;\n\tlcm=lcm/(gcd(x,y));\n\tfor(i=a;i<=b;i++){\n\t\tif(i%x==0 && i%y==0) {\n\t\t\tcount++;\n\t\t\tbreak;\n\t\t}\n\t}\n\tfor(;i<=b;i=i+lcm)\n\t\tcount++;\n\tprintf(\"%ld\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main(){\n\tint x,y,a,b;\n\tscanf(\"%d %d %d %d\",&x,&y,&a,&b);\n\tint i, k = x*y, l = 0;\n\tfor(i = a;i<=b;i++){\n\t\tif(i%k == 0) l++;\n\t}\t\n\tprintf(\"%d\\n\",l);\n\treturn 0;\n}\n/* 1503093722564 */\n"}, {"source_code": "#include \n\nint main(void)\n{\nint n,m,k,a,b,c,d,e,f;\nscanf(\"%d %d %d\",&n,&m,&k);\na=(n-m);\n\nb=n/k;\nf=0;\n\nif (a >= b) f=m;\nelse {\n\n \n e=(b-a);\n while (e!=0){ \n f=(f+k-1)*2;\n e=e-1;\n } \n\nf=f+m-(b-a)*k;\n}\n\n\nprintf(\"%d\",f);\n\n\nreturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n long long int a,b,c,d;\n scanf(\"%lld%lld%lld%lld\",&a,&b,&c,&d);\n if(a==b)printf(\"%lld\\n\",d/a-(c-1)/a);\n else {\n a=a*b;\n printf(\"%lld\\n\",d/a-(c-1)/a);\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int x,y,a,b,max,lcm,i,ans,d;\n scanf(\"%d %d %d %d\",&x,&y,&a,&b);\n max=y;\n if(x>=y)\n max=x;\n lcm=x*y;\n for(i=max;i<=x*y;i++)\n {\n if(i%x==0&&i%y==0)\n {\n lcm=i;\n break;\n }\n }\n ans=(((b-(b%lcm))-(a+a%lcm))/lcm)+1;\n printf(\"%d\",ans);\n return 0;\n}"}, {"source_code": "#include \nint getit(int x, int y, int b)\n{\n int i = 0, smaller = x < y? x:y, bigger = x > y?x:y;\n for(i = bigger; i < b; i+=bigger)\n if(i % smaller == 0)\n return i;\n return x*y;\n}\nint main()\n{\n\tlong long x = 0, y = 0, a = 0, b = 0, i = 0, total = 0, wanted = 0;\n\tscanf(\"%d%d%d%d\",&x,&y,&a,&b);\n\twanted = y % x == 0? y:getit(x,y,b);\n\n for(i = a; i <= b; i++)\n if(i % wanted == 0)\n {\n a = i;\n break;\n }\n if(wanted > b || wanted < a)\n printf(\"0\");\n else\n printf(\"%d\",1+(b-a)/wanted);\n}"}, {"source_code": "#include\nint main()\n{\n int x,y,a,b,max,lcm,i,ans,d;\n scanf(\"%d %d %d %d\",&x,&y,&a,&b);\n max=y;\n if(x>=y)\n max=x;\n lcm=x*y;\n for(i=max;i<=x*y;i++)\n {\n if(i%x==0&&i%y==0)\n {\n lcm=i;\n break;\n }\n }\n ans=((b-(b%lcm))/lcm)-((a+lcm-(a%lcm))/lcm)+1;\n printf(\"%d\",ans);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n long long int a,b,c,d,i,j;\n scanf(\"%lld%lld%lld%lld\",&a,&b,&c,&d);\n if(a==b)printf(\"%lld\\n\",d/a-(c-1)/a);\n else if(a==1 || b==1)\n {\n if(a2 || b>2)\n {\n long long int n=0;\n if(a>b)\n for(i=a; i<=d/2; i+=a)\n {\n if(i%b==0 && i>=c && i<=b)n++;\n }\n else\n {\n for(i=b; i<=d/2; i+=b)\n {\n if(i%a==0 && i>= c && i<= d)n++;\n }\n }\n printf(\"%lld\\n\",n);\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\nlong long int x,y,a,b,l,z,w,f,r;\nscanf(\"%I64d%I64d%I64d%I64d\",&x,&y,&a,&b);\nz=x>y?x:y;\nw=x\ntypedef unsigned long long int ll;\nll gcd(ll a,ll b)\n{\nif(b==0)\nreturn a;\nreturn gcd(b,a%b);\n}\nmain()\n{\nll x,y,a,b,i;\nscanf(\"%lld%lld%lld%lld\",&x,&y,&a,&b);\nll gcds=x*(y/gcd(x,y));\nll start=(gcds/a)*gcds;\n//if(start=a)\ncount++;\nprintf(\"%lld\\n\",count);\nreturn 0;\n}\n\n"}, {"source_code": "#include\n\nint main()\n{\n int a,b,x,y,p,r;\n scanf(\"%d %d %d %d\",&x,&y,&a,&b);\n p=x*y;\n r=(b/p)-((a-1)/p);\n printf(\"%d\\n\",r);\n}"}, {"source_code": "#include\nunsigned long long int gcd(unsigned long long int x,unsigned long long int y){\n unsigned long long int i;\n for(i=x;i>=1;i--){\n if(x%i==0&&y%i==0){\n break;\n }\n }\n return i;\n}\nint main()\n{\n unsigned long long int x,a,b,n,y,i,k,m,z,t,count=0,s;\n scanf(\"%llu%llu%llu%llu\",&x,&y,&a,&b);\n if(x==y)\n {\n m=(b-a)/x;\n if(a%x==0||b%x==0)\n m=m+1;\n printf(\"%llu\\n\",m);\n }\n else if(x>y)\n {\n k=gcd(y,x);\n if(k==1)\n {\n s=x*y;\n m=(b-a)/(x*y);\n if(a%s==0||b%s==0)\n m=m+1;\n printf(\"%llu\\n\",m);\n }\n else{\n if(a%x==0)\n i=a;\n else\n {\n t=a/x;\n i=(t*x)+x;\n }\n while(i\n#include\n#include\nint main()\n{\n long long int a, b, x,y , temp;\n double j, k;\n int count=0;\n scanf(\"%lld %lld %lld %lld\", &x, &y, &a, &b);\n if(x>y){\n temp = x;\n x = y;\n y = temp;\n }\n j = ceil(a/y);\n k = floor(b/y);\n for(;j<=k;j++){\n if((y*(int)j)%x==0){\n count++;\n }\n }\n if(count==180){\n --count;\n }\n printf(\"%d\",count);\n return 0;\n}\n"}, {"source_code": "#include\nmain()\n{\n int x,y,a,b,c=0;\n scanf(\"%d%d%d%d\",&x,&y,&a,&b);\n c=(b/(x*y))-(a/(x*y))+1;\n printf(\"%d\",c);\n return 0;\n}\n"}, {"source_code": "#include\n\nint bul(int a,int b,int d)\n{\n\tint i;\n\tfor(i=1;i<=d;i++)\n\t\tif(i%a==0 && i%b==0)\n\t\t\treturn i;\n\treturn 0;\n}\n\nvoid oku()\n{\n\tint a,b,c,d,i,e;\n\tscanf(\"%d %d %d %d\",&a,&b,&c,&d);\n\te=bul(a,b,d);\n\tif(e==0)\n\t{\n\t\tprintf(\"0\");\n\t\treturn;\n\t}\n\tfor(i=c;i<=d;i++)\n\t\tif(i%e==0 && i>=e)\n\t\t{\n\t\t\tc=i;\n\t\t\tbreak;\n\t\t}\n\tfor(i=d;i>=c;i--)\n\t\tif(i%e==0)\n\t\t{\n\t\t\td=i;\n\t\t\tbreak;\n\t\t}\n\tif(c>d)\n\t{\n\t\tprintf(\"0\");\n\t\treturn;\n\t}\n\tprintf(\"%d\",(d-c)/e+1);\n}\n\nint main()\n{\n\toku();\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main() {\n\tint x, y, a, b;\n\n\tscanf(\"%d %d %d %d\", &x, &y, &a, &b);\n\n\tprintf(\"%d\", b/(x*y) - a/(x*y) + (a%(x*y) == 0 ? 1 : 0));\n\n\treturn 0;\n}"}, {"source_code": "#include\n\nunsigned long long int lcm(unsigned long long int,unsigned long long int);\n\nint main(){\n\n\n\n unsigned long long int a,b,l,x,y,i,c=0;\n\n\n scanf(\"%llu %llu %llu %llu\",&a,&b,&x,&y);\n\n if(a>b)\n l = lcm(a,b);\n else\n l = lcm(b,a);\ni=1;\nwhile(l*i>=x&&l*i<=y)\n{\n c++;\n i++;\n}\nprintf(\"%lld\",c);\n return 0;\n}\n\nunsigned long long int lcm(unsigned long long int a,unsigned long long int b){\n\n int temp = a;\n\n while(1){\n if(temp % b == 0 && temp % a == 0)\n break;\n temp++;\n }\n\n return temp;\n}\n"}, {"source_code": "#include \nint gcd(int a,int b)\n{\n return b==0?a:gcd(b,a%b);\n}\nint main()\n{\n __int64 a,b;\n int x,y,n,i;\n while(scanf(\"%d%d%I64d%I64d\",&x,&y,&a,&b)!=EOF)\n {\n n=x*y/gcd(x,y);\n if(n==1)\n {\n printf(\"%I64d\\n\",b-a+1);\n continue;\n }\n for(i=a;i<=b;i++)\n {\n if(i%n==0)\n break;\n }\n if(n>b)\n {\n printf(\"0\\n\");\n continue;\n }\n printf(\"%I64d\\n\",(b-i)/n+1);\n }\n}"}, {"source_code": "#include\nlong long int gcd(long long int a,long long int b)\n{\n\tif(b==0)\n\t\treturn a;\n\treturn gcd(b,a%b);\n}\n\nint main()\n{\n\tlong long int x,y;\n\tlong long int a,b;\n\tscanf(\"%lld%lld%lld%lld\",&x,&y,&a,&b);\n\tlong long int gcd1=gcd(x,y);\n\tlong long int lcm=(x*y)/gcd1;\n\tif(a%lcm!=0)\n\t\ta=a+(lcm-a%lcm);\n\tb=b-b%lcm;\n\tif(b\n\nint gcd(int, int);\nint lcm(int, int);\n\nint main()\n{\n\tint x, y, LCM;\n\tlong int a, b, answer;\n\tscanf(\"%d %d %ld %ld\", &x, &y, &a, &b);\n\t\n\tLCM = lcm(x, y);\n\t\n\tanswer = (b - a) / LCM;\n\t\n\tif (a % LCM == 0) answer++;\n\t\n\tprintf(\"%ld\\n\", answer);\n\treturn 0;\n}\n\n\nint gcd(int a, int b)\n{\n\tint temp;\n\tif (b <= a)\n\t{\n\t\twhile (a % b != 0)\n\t\t{\n\t\t\ttemp = b;\n\t\t\tb = a % b;\n\t\t\ta = temp;\n\t\t}\n\t\treturn b;\n\t}\n\telse return gcd(b, a); \n}\n\n\nint lcm(int a, int b)\n{\n\treturn (a * b) / gcd(a, b);\n}\n"}, {"source_code": "#include\n#include\n\nint main(){\nlong long x,y,a,b,i,count=0,lcm,gcd,t,x1,y1;\nscanf(\"%I64d\",&x);\nscanf(\"%I64d\",&y);\nscanf(\"%I64d\",&a);\nscanf(\"%I64d\",&b);\n\nx1=x;\ny1=y;\nwhile (y1 != 0) {\n t = y1;\n y1 = x1 % y1;\n x1 = t;\n }\n \ngcd = x1;\nlcm = (x*y)/gcd;\ncount = (b-a)/lcm;\nprintf(\"%I64d\",count + 1);\nreturn 0; \n}\n"}, {"source_code": "#include\n\nunsigned long long int lcm(unsigned long long int,unsigned long long int);\n\nint main(){\n\n\n\n unsigned long long int a,b,l,x,y,i,c=0,d=0;\n\n\n scanf(\"%llu %llu %llu %llu\",&a,&b,&x,&y);\n\n if(a>b)\n l = lcm(a,b);\n else\n l = lcm(b,a);\ni=1;\nwhile(l*i>=x&&l*i<=y)\n{\n c++;\n i++;\n}\n\nprintf(\"%llu\\n\",c);\n return 0;\n}\n\nunsigned long long int lcm(unsigned long long int a,unsigned long long int b){\n\n unsigned long long int temp = a;\n\n while(1){\n if(temp % b == 0 && temp % a == 0)\n break;\n temp++;\n }\n\n return temp;\n}\n"}, {"source_code": "#include\nint main()\n{\n int x,y,c=0,big;\n long long int a,b,i,q=0,lcm;\n scanf(\"%d%d%I64d%I64d\",&x,&y,&a,&b);\n if(x>y)\n big=x;\n else\n big=y;\n // printf(\"%d\\n\",big);\n for(i=big;;i++)\n {\n if(i%x==0 && i%y==0)\n {\n lcm=i;\n break;\n\n }\n }\n printf(\"%I64d\",lcm);\n for(i=a;i<=b;i++)\n {\n if(i%lcm==0)\n {\n q=(b-i)/lcm;\n break;\n }\n }\n\n if(q==0)\n printf(\"%I64d\",q);\n else\n printf(\"%I64d\",q+1);\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main(){\nlong long x,y,a,b,i,count=0,k;\nscanf(\"%I64d\",&x);\nscanf(\"%I64d\",&y);\nscanf(\"%I64d\",&a);\nscanf(\"%I64d\",&b);\nif( (x%y==0) )\n{\n k = x;\n}\nelse \nif( (y%x==0) )\n{\n k = y;\n}\nelse \n{\n k = (x*y);\n}\ncount = (b-a)/k;\nprintf(\"%I64d\",(count + 1));\nreturn 0;\n}\n"}], "src_uid": "c7aa8a95d5f8832015853cffa1374c48"} {"nl": {"description": "Mr. Bender has a digital table of size n × n, each cell can be switched on or off. He wants the field to have at least c switched on squares. When this condition is fulfilled, Mr Bender will be happy.We'll consider the table rows numbered from top to bottom from 1 to n, and the columns — numbered from left to right from 1 to n. Initially there is exactly one switched on cell with coordinates (x, y) (x is the row number, y is the column number), and all other cells are switched off. Then each second we switch on the cells that are off but have the side-adjacent cells that are on.For a cell with coordinates (x, y) the side-adjacent cells are cells with coordinates (x - 1, y), (x + 1, y), (x, y - 1), (x, y + 1).In how many seconds will Mr. Bender get happy?", "input_spec": "The first line contains four space-separated integers n, x, y, c (1 ≤ n, c ≤ 109; 1 ≤ x, y ≤ n; c ≤ n2).", "output_spec": "In a single line print a single integer — the answer to the problem.", "sample_inputs": ["6 4 3 1", "9 3 8 10"], "sample_outputs": ["0", "2"], "notes": "NoteInitially the first test has one painted cell, so the answer is 0. In the second test all events will go as is shown on the figure. ."}, "positive_code": [{"source_code": "#include \n\nlong long min(long long a, long long b)\n{\n if (a < b) {\n return a;\n } else {\n return b;\n }\n}\n\nint main()\n{\n int n, x, y, c;\n long long l, r, m;\n \n scanf(\"%d %d %d %d\", &n, &x, &y, &c);\n \n x--;\n y--;\n \n l = -1;\n r = n * 2;\n m = (l + r) / 2;\n \n while (r - l > 1) {\n long long sum = m * m * 2 + m * 2 + 1;\n \n if (x < m) sum -= (m - x) * (m - x);\n if (y < m) sum -= (m - y) * (m - y);\n if (n - x - 1 < m) sum -= (m - n + x + 1) * (m - n + x + 1);\n if (n - y - 1 < m) sum -= (m - n + y + 1) * (m - n + y + 1);\n \n if (m - x - y - 1 > 0) {\n long long z = m - x - y - 1;\n \n sum += z * (z + 1) / 2;\n }\n \n if (m - x - n + y > 0) {\n long long z = m - x - n + y;\n \n sum += z * (z + 1) / 2;\n }\n \n if (m - y - n + x > 0) {\n long long z = m - y - n + x;\n \n sum += z * (z + 1) / 2;\n }\n \n if (m + x + y - n * 2 + 1 > 0) {\n long long z = m + x + y - n * 2 + 1;\n \n sum += z * (z + 1) / 2;\n }\n \n if (sum >= c) {\n r = m;\n m = (l + r) / 2;\n } else {\n l = m;\n m = (l + r) / 2;\n }\n }\n \n printf(\"%d\\n\", r);\n \n return 0;\n}\n"}, {"source_code": "#include \n\nlong long min(long long a, long long b)\n{\n if (a < b) {\n return a;\n } else {\n return b;\n }\n}\n\nint main()\n{\n int n, x, y, c;\n long long l, r, m;\n \n scanf(\"%d %d %d %d\", &n, &x, &y, &c);\n \n x--;\n y--;\n \n l = -1;\n r = n * 2;\n m = (l + r) / 2;\n \n while (r - l > 1) {\n long long sum = m * m * 2 + m * 2 + 1;\n \n if (x < m) sum -= (m - x) * (m - x);\n if (y < m) sum -= (m - y) * (m - y);\n if (n - x - 1 < m) sum -= (m - n + x + 1) * (m - n + x + 1);\n if (n - y - 1 < m) sum -= (m - n + y + 1) * (m - n + y + 1);\n \n if (m - x - y - 1 > 0) {\n long long z = m - x - y - 1;\n \n sum += z * (z + 1) / 2;\n }\n \n if (m - x - n + y > 0) {\n long long z = m - x - n + y;\n \n sum += z * (z + 1) / 2;\n }\n \n if (m - y - n + x > 0) {\n long long z = m - y - n + x;\n \n sum += z * (z + 1) / 2;\n }\n \n if (m + x + y - n * 2 + 1 > 0) {\n long long z = m + x + y - n * 2 + 1;\n \n sum += z * (z + 1) / 2;\n }\n \n if (sum >= c) {\n r = m;\n m = (l + r) / 2;\n } else {\n l = m;\n m = (l + r) / 2;\n }\n }\n \n printf(\"%d\\n\", r);\n \n return 0;\n}\n"}, {"source_code": "#include\n\nint n,x,y,k;\n\nlong long min(long long a,long long b)\n{\n return (a0)\n return a*b-t*(t+1)/2;\n else return a*b;\n }\n}\n\nint check(int nn,int xx,int yy,int kk,int mm)\n{\n long long left,right,down,up;\n long long n=(long long)nn,x=(long long)xx,y=(long long)yy,k=(long long)kk,m=(long long)mm;\n long long sum=0;\n \n left=min(m,x-1);\n right=min(m,n-x);\n down=min(m,y-1);\n up=min(m,n-y);\n \n sum=left+right+up+down+1;\n \n sum+=square(left,down,m);\n sum+=square(left,up,m);\n sum+=square(right,down,m);\n sum+=square(right,up,m);\n \n if(sum>=k)\n return 1;\n else return 0;\n}\n\nint erfen(int a,int b)\n{\n int mid;\n \n if(a==b)\n return a;\n \n mid=(a+b)/2;\n if(check(n,x,y,k,mid))\n return erfen(a,mid);\n else return erfen(mid+1,b);\n}\n\nint main()\n{\n scanf(\"%d%d%d%d\",&n,&x,&y,&k);\n \n printf(\"%d\\n\",erfen(0,k));\n \n //system(\"pause\");\n return 0;\n}\n\n"}, {"source_code": "/* practice with Dukkha */\n#include \n\nlong long count(int n, int x, int y, int r) {\n\tlong long a = 2LL * r * r + 2 * r + 1;\n\tint w;\n\n\tif ((w = 1 - (x - r)) > 0)\n\t\ta -= (long long) w * w;\n\tif ((w = 1 - (y - r)) > 0)\n\t\ta -= (long long) w * w;\n\tif ((w = (x + r) - n) > 0)\n\t\ta -= (long long) w * w;\n\tif ((w = (y + r) - n) > 0)\n\t\ta -= (long long) w * w;\n\tif ((w = r - 1 - (x - 1) - (y - 1)) > 0)\n\t\ta += (long long) w * (w + 1) / 2;\n\tif ((w = r - 1 - (x - 1) - (n - y)) > 0)\n\t\ta += (long long) w * (w + 1) / 2;\n\tif ((w = r - 1 - (n - x) - (y - 1)) > 0)\n\t\ta += (long long) w * (w + 1) / 2;\n\tif ((w = r - 1 - (n - x) - (n - y)) > 0)\n\t\ta += (long long) w * (w + 1) / 2;\n\treturn a;\n}\n\nint main() {\n\tint n, x, y, c, lower, upper, r;\n\n\tscanf(\"%d%d%d%d\", &n, &x, &y, &c);\n\tlower = -1, upper = c;\n\twhile (upper - lower > 1) {\n\t\tr = (lower + upper) / 2;\n\t\tif (count(n, x, y, r) >= c)\n\t\t\tupper = r;\n\t\telse\n\t\t\tlower = r;\n\t}\n\tprintf(\"%d\\n\", upper);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#define max(a,b) ((a)>(b)?(a):(b))\n#define min(a,b) ((a)<(b)?(a):(b))\nint main()\n{\n\tint now=1,tt=0,n,x,y,c;\n\tscanf(\"%d%d%d%d\",&n,&x,&y,&c);\n\twhile(now\n#define max(a,b) ((a)>(b)?(a):(b))\n#define min(a,b) (a+b-max(a,b))\nint ans,t,n,x,y,c,k;\nint main()\n{\n\tscanf(\"%d%d%d%d\",&n,&x,&y,&c);\n\twhile (ans\n\nint main(void)\n{\n\t\tint arr[2], conn, count = 0;\n\t\tscanf(\"%d %d \", &arr[0], &arr[1]);\n\n\t\tconn = (arr[1] < arr[0]);\n\n\t\twhile (arr[0] > 0 && arr[1] > 0 && (arr[0] > 1 || arr[1] > 1)){\n\t\t\t\tarr[conn] += 1;\n\t\t\t\tarr[1-conn] -= 2;\n\t\t\t\tcount++;\n\t\t\t\tconn = (arr[1] < arr[0]);\n\t\t}\n\n\t\tprintf(\"%d\\n\", count);\n\t\treturn 0;\n}\n"}, {"source_code": "#include\nint main(){\n\tint a,b,plug;\n\tlong long int time;\n\tscanf(\"%d%*c%d\",&a,&b);\n\tplug=(a0) && (b>0)){\n\t//\tprintf(\"%d %d \\n\",a,b);\n\tif(a==1 && b==1){\n\t\tbreak;\n\t}\n\t\tif(plug==1){\n\t\t\ta++;\n\t\t\tb=b-2;\n\t\t}\n\t\telse if(plug==2){\n\t\t\tb++;\n\t\t\ta=a-2;\n\t\t}\n\t\ttime++;\n\t\tif(a<=2){\n\t\t\tplug=1;\n\t\t}\n\t\telse if(b<=2){\n\t\t\tplug=2;\n\t\t}\n\t}\n\tprintf(\"%64Id\",(time));\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main(void) {\n long a,b,count=0;\n scanf(\"%ld%ld\",&a,&b);\n while(a>1 || b>1){\n if(a>b && b>0){\n b++;\n a -=2;\n }\n else if(a<=b && a>0){\n a++;\n b -=2;\n }\n else break;\n //printf(\"%ld %ld\\n\",a,b);\n count++;\n }\n printf(\"%ld\\n\",count);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,m,count=0,t;\n scanf(\"%d %d\",&n,&m);\n if(n>m)\n {\n t=n;\n n=m;\n m=t;\n\n }\n while(1)\n {\n if(n==1 && m==1)\n break;\n\n n=n+1;\n m=m-2;\n count++;\n if(m==0)\n break;\n else if(m<=2)\n {\n while(1)\n {\n n=n-2;\n m=m+1;\n count++;\n if(n<=2)\n break;\n }\n if(n==0)\n break;\n }\n\n }\n printf(\"%d\\n\",count);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int a;\n int b;\n scanf(\"%d %d\",&a,&b);\n int c=0;\n int min=0;\n if(a==1 && b==1)\n {\n printf(\"0\");\n exit(0);\n }\n else if(a==2 && b==2)\n {\n printf(\"1\");\n exit(0);\n }\n if(a0 && b>0)\n {\n if(c==0)\n {\n min++;\n a+=1;\n b-=2;\n if(b==1 || b==2)\n {\n c=1;\n continue;\n }\n else\n {\n continue;\n }\n }\n else if(c==1)\n {\n min++;\n a-=2;\n b+=1;\n if(a==1 || a==2)\n {\n c=0;\n continue;\n }\n else\n {\n continue;\n }\n }\n }\n printf(\"%d\",min);\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int x,y,i,count=0;\n scanf(\"%d%d\",&x,&y);\n for (i=1;i<=1000;i++)\n {\n if (x>y)\n {\n if(x>=2 && y>0)\n {\n\n y+=1;\n x-=2;\n count++;\n }\n }\n\n else if (y>=2 && x>0)\n {\n x+=1;\n y-=2;\n count++;\n }\n }\n printf(\"%d\",count);\n}\n"}, {"source_code": "#include\nint Calc(int a, int b)\n{\n int i,j;\n int static cnt = 1;\n\n i = ( a >= b ) ? a : b;\n j = ( a <= b ) ? a : b;\n\n if((j==1&&i==2)||(j==2&&i==2))\n {\n printf(\"%d\",cnt);\n return 0;\n }\n else if(i==1&&j==1)\n {\n printf(\"0\");\n return 0;\n }\n\n i = i - 2;\n a = i;\n j = j + 1;\n b = j;\n cnt++;\n\n Calc(a,b);\n}\n\nint main()\n{\n int a,b,i,j;\n scanf(\"%d %d\",&a,&b);\n\n Calc(a,b);\n\n return 0;\n}\n"}, {"source_code": "/*40ve*/\n#include\n#include \nint main()\n{\n int a,b,i=0;\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n if((a==1&&b==1)||a<=0||b<=0)\n {\n printf(\"%d\",i);\n }\n else {\n do{\n if(a>b){\n a=a-2;\n b=b+1;\n }\n else{\n a=a+1;\n b=b-2;\n }\n i++;\n }while(a>0&&b>0);\n printf(\"%d\",i);\n }\n}\n"}, {"source_code": "#include \nint main()\n{\n\tint a1, a2, time=0;\n\tscanf(\"%d%d\", &a1, &a2);\n\twhile(a1>0 && a2>0)\n\t{\n\t\tif(a1==1 &&a2==1)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\tif(a1>a2)\n\t\t{\n\t\t\ta1-=2;\n\t\t\ta2++;\n\t\t\ttime++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ta2-=2;\n\t\t\ta1++;\n\t\t\ttime++;\n\t\t}\n\t\t\n\t\t\n\t\t\n\t}\n\tprintf(\"%d\\n\", time);\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n} "}, {"source_code": "#include \n\nint main()\n{\n int x,y,i,count=-1;\n scanf(\"%d%d\",&x,&y);\n if (x==1&& y==1)\n {\n printf(\"0\");\n }\n else\n {\n for (i=1;i<=1000;i++)\n {\n\n if (x>y)\n {\n if(x>=2)\n {\n\n y+=1;\n x-=2;\n count++;\n\n\n }\n }\n\n else if (y>=2)\n {\n x+=1;\n y-=2;\n count++;\n }\n\n }\n printf(\"%d\",count);\n }\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main(void)\n{\n\tint a1, a2, count = 0;\n\tscanf(\"%d %d\", &a1, &a2);\n\twhile(a1 > 0 && a2 > 0)\n\t{\n\t\tif(a1 > a2) { a2 += 1; a1 -=2; }\n\t\telse { a1 += 1; a2 -= 2; }\n\t\tcount += 1;\n\t}\n\tif(a1 < 0 || a2 < 0) count -= 1;\n\tprintf(\"%d\\n\", count);\n\treturn 0; \t\t\t\n}\t\n\t\t"}, {"source_code": "#include\nint main()\n{\n\tint a1,a2;\n\tscanf(\"%d%d\",&a1,&a2);\n\tint flag=1;\n\tint count=0;\n\twhile(flag&&!(a1==1&&a2==1))\n\t{\n\t\tif(a1>=a2)\n\t\t{\n\t\t\ta1=a1-2;\n\t\t\ta2++;\n\t\t\tcount++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ta2=a2-2;\n\t\t\ta1++;\n\t\t\tcount++;\n\t\t}\n\t\tif((a1==00||a2==0))\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%d\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \nint checker(int a1,int a2);\nint main()\n{\n int a1,a2,maxx=0;\n scanf(\"%d\",&a1);\n scanf(\"%d\",&a2);\n if(a1==1&&a2==1){maxx=0;}\n else {maxx=checker(a1,a2);}\n printf(\"\\n%d\",maxx);\n return 0;\n}\n\nint checker(int a1,int a2){\n int max,min,x,maxxx=0;\n\nif(a1>a2){\n\n max=a1; min=a2;\n }\n else {max=a2; min=a1;}\n for(;;){\n if(max\nint main(void)\n{\n\tint a,b,t,i=0; \n\tscanf(\"%d%d\",&a,&b);\n\tint max,min;\n\tmax=a>b?a:b;\n\tmin=a=1&&max>1)\n\t{\n\t\ti++;\n\t\tmax=max-2;\n\t\tmin=min+1;\n\t\tt=max;\n\tmax=max>min?max:min;\n\tmin=t>min?min:t;\n\t\t\n\t}\n\tprintf(\"%d\",i);\n } "}, {"source_code": "#include \n#include \n#include \n#include \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\tint a,b,ans=0;\n\tscanf(\"%d%d\",&a,&b);\n\twhile(1)\n\t{\n\t\tif(a<=0||b<=0)\n\t\t\tbreak;\n\n\t\tif(a<=b)\n\t\t{\n\t\t\ta+=1;\n\t\t\tb-=2;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ta-=2;\n\t\t\tb+=1;\n\n\t\t}\n\t\tans++;\n\t}\n\tif(a<0 || b<0)\n\t\tans--;\n\tprintf(\"%d\\n\",ans );\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n int x,y,i,count=0;\n scanf(\"%d%d\",&x,&y);\n for (i=1;i<=1000;i++)\n {\n if (x>y)\n {\n if(x>=2 && y>0)\n {\n\n y+=1;\n x-=2;\n count++;\n }\n }\n\n else if (y>=2 && x>0)\n {\n x+=1;\n y-=2;\n count++;\n }\n }\n printf(\"%d\",count);\n}\n"}, {"source_code": "#include\nchar min_char(int a,int b){\n\tif(a>b)\n\t\treturn 'b';\n\telse\n\t\treturn 'a';\n}\nint main(){\n\tint a,b,min=0;\n\tchar ch = 'a';\n\tscanf(\"%d%d\",&a,&b);\n\t\n\tif(a>b)\n\t\tch = 'b';\n\telse\n\t\tch = 'a';\n\t\t\n\twhile(a>=1 && b>=1){\n\t\tch = min_char(a,b);\n\t\tif(a==1 && b==1)\n\t\t\tbreak;\n\t\t\t\n\t\tif(a==1){\n\t\t\ta += 1;\n\t\t\tb -= 2;\n\t\t\tch = 'a';\n\t\t}else if(b==1){\n\t\t\ta -= 2;\n\t\t\tb += 1;\n\t\t\tch = 'b';\n\t\t}else if(ch=='a'){\n\t\t\ta += 1;\n\t\t\tb -= 2;\n\t\t}else if(ch=='b'){\n\t\t\ta -= 2;\n\t\t\tb += 1; \n\t\t}\n\t\t//printf(\"%d %d\\n\",a,b);\n\t\tmin++;\n\t}\n\tprintf(\"%d\",min);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint compute(int, int, int (*)[200]);\nint main(void){\n\n\tint count[200][200]={0};\n\n\tint a, b;\n\tscanf(\"%d%d\",&a,&b);\n printf(\"%d\\n\",compute(a,b,count));\n\n\treturn 0;\n}\n\nint compute(int a, int b, int (*count)[200]){\n int t = a>b?a:b;\n b = a+b-t;\n a = t;\n if( a < 0 || b < 0)\n\t return 0;\n if(a <=2 && b <=2){\n\t if ( a < 2 && b < 2)\n\t\t return 0;\n\t else\n\t\t return count[a][b]=1;\n }\n\n if(count[a][b])\n\t return count[a][b];\n int m = compute(a+1, b-2, count);\n int l = compute(a-2,b+1, count);\n\n\n\treturn count[a][b] = 1+(m>l?m:l);\n}\n"}, {"source_code": "#include \n\nint main(void) {\n long a,b,count=0;\n scanf(\"%ld%ld\",&a,&b);\n while(a>1 || b>1){\n if(a>b && b>0){\n b++;\n a -=2;\n }\n else if(a<=b && a>0){\n a++;\n b -=2;\n }\n else break;\n //printf(\"%ld %ld\\n\",a,b);\n count++;\n }\n printf(\"%ld\\n\",count);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{ int a1,a2,c1,c2,t=0;\nscanf(\"%d%d\",&a1,&a2);\nc1=a1;\nc2=a2;\nwhile(c1>0&&c2>0)\n{\n if(c1==1&&c2==1)\n break;\nif(c1\n#include\nmain()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n int count=0;\n while(a>0&&b>0)\n { if(a==1&&b==1)\n break;\n else if(a<3)\n {a=a+1;\n b=b-2;\n }\n else if(b<3)\n {a=a-2;\n b=b+1;\n \n }\n else if(a>b)\n {\n a=a+1;\n b=b-2;\n }\n else\n {\n a=a-2;\n b=b+1;\n }\n count++;\n }\n printf(\"%d\",count);\n}"}, {"source_code": "#include\n\nint main(){\n int n,m,i=0;\n scanf(\"%d %d\",&n,&m);\n while(n>0&&m>0){\n if(n>=m){\n if(n==1&&m==1){\n break;\n }\n n=n-2;\n m++;\n \n i++;\n }\n \n else{\n m=m-2;\n n++;\n \ni++;\n }\n }\n printf(\"%d\\n\",i);\n return 0;\n}\n"}, {"source_code": "\n#include\n#include\nmain()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n int count=0;\n while(a>0&&b>0)\n { if(a==1&&b==1)\n break;\n else if(a<3)\n {a=a+1;\n b=b-2;\n }\n else if(b<3)\n {a=a-2;\n b=b+1;\n \n }\n else if(a>b)\n {\n a=a+1;\n b=b-2;\n }\n else\n {\n a=a-2;\n b=b+1;\n }\n count++;\n }\n printf(\"%d\",count);\n}"}, {"source_code": "#include \n#include \nint n,m;\nint f[220][220];\nint max(int a,int b)\n{\n\treturn a>b?a:b;\n}\nint dp(int x,int y)\n{\n\tif(x<=0||y<=0||x+y<=2) return 0;\n\tif(f[x][y]>=0) return f[x][y];\n\treturn f[x][y] = max(dp(x-2,y+1),dp(x+1,y-2))+1;\n}\nint main()\n{\n\tint i,j;\n\tmemset(f,-1,sizeof(f));\n\tscanf(\"%d%d\",&n,&m);\n\tprintf(\"%d\",dp(n,m));\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{ int a1,a2,nb=0;\n\n do{\n\n scanf(\"%d\",&a1);\n }while((a1<1)&&(a1>100));\n\n do{\n\n scanf(\"%d\",&a2);\n }while((a2<1)&&(a2>100));\n\ndo{\n\n\n if(a1>=a2)\n {\n a1=a1-2;\n a2++;\n }else if(a1=0)&&(a2>=0))\nnb++;\n\n}while((a1>0)&&(a2>0));\n\nprintf(\"%d\",nb);\n\n\n\n return 0;\n}\n"}, {"source_code": "#include\n\n\nint main()\n{\n\tint a,b,n=0;\n\tscanf(\"%d\",&a);\n\tscanf(\"%d\",&b);\n\tif(a*b==0 || a*b==1)\n\t{\n\t\tn=0;\n\t}\n\telse\n\t{\n\t\twhile(a>0 && b>0)\n\t\t{\n\t\t\tn++;\n\t\t\tif(a>b)\n\t\t\t{\n\t\t\t\ta=a-2;\n\t\t\t\tb++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\ta++;\n\t\t\t\tb=b-2;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\\n\",n);\n\treturn 0;\n}\n\n"}, {"source_code": "#include \nint main(){\n int ch1,ch2;\n scanf(\"%d%d\",&ch1,&ch2);\n int count=0;\n while(ch1>0 && ch2>0){\n if(ch1>ch2){\n ch2++;\n ch1=ch1-2;\n }\n else{\n ch1++;\n ch2=ch2-2;\n }\n if(ch1>=0 && ch2>=0) count++;\n }\n printf(\"%d\",count);\n\n}\n"}, {"source_code": "#include \n#include \n \n \nint main() \n{\n\t int stick1, stick2, i;\n\t int count = 0;\n\t int control = 1;\n\t scanf(\"%d%d\",&stick1, &stick2);\n\t if(stick1 > stick2)\n\t {\n\t\t control = 0;\n\t }\n\t for(;;)\n\t {\n\t\t if(stick1 <= 0 || stick2 <= 0)break;\n\t\t if(1 == control) \n\t\t {\n\t\t\t stick1++;\n\t\t\t stick2 -= 2;\n\t\t }\n\t\t else\n\t\t {\n\t\t\t stick2++;\n\t\t\t stick1 -= 2;\n\t\t }\n\t\t if(0 == control && stick1 < stick2 &&stick1 -2 <= 0 )\n\t\t {\n\t\t\t control = 1;\n\t\t }\n\t\t else if(1 == control && stick2 < stick1 &&stick2 - 2 <= 0)\n\t {\n\t\t\t control = 0;\n\t\t }\n\t\t if(stick1 >= 0 && stick2 >= 0)count++;\n\t\t \n\t }\n\t printf(\"%d\\n\",count);\n return EXIT_SUCCESS;\n}\n"}, {"source_code": "#include \n#include \nint main(){\n\tint n,m;\n\tscanf(\"%d%d\",&n,&m);\n int num=0,f=0;\n\tif(m==2&&n<2){\n\t\tnum++;\n\tf++;\n\t}\n\telse if(n==2&&m<2){\n num++;\n\tf++;\n\t}\n else if(n==2&&m==2){\n \tnum++;\n\tf++;\n\t}\n\telse{\n\twhile(m>2||n>2){\n\t\twhile(n>2){\n\t\t\tn-=2;\n\t\t\tm+=1;\n\t\t\tnum++;\n\t\t}\n\t\twhile(m>2){\n\t\t\tm-=2;\n\t\t\tn+=1;\n\t\t\tnum++;\n\t\t}\n\t}\n}\n\tif(num==0){\n\t\tprintf(\"%d\",num);\n\t}\n\telse{\n if(f==0)\t\t\n\tprintf(\"%d\",num+1);\nelse\nprintf(\"%d\",num);\n}\n}"}, {"source_code": "/* AUTHOR:AKASH JAIN\n* USERNAME:akash19jain \n* DATE:27/07/2019 \n*/\n#include\n#include\n#include\n#include\n#include\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)\t\twhile(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)\t\t 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\nint main()\n{\n ll a,b,ans=0;\n SC2(a,b);\n while(a>0 && b>0)\n {\n if(a=2)\n {\n a++;\n b-=2;\n }\n else if(a>=2)\n {\n b++;\n a-=2;\n }\n else\n {\n break;\n }\n ans++;\n }\n PF1(ans);\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\nint main()\n{\n\tint a,b;\n\tscanf(\"%d %d\",&a,&b);\n\tint count=1;\n\t\n\twhile(a>0 && b>0)\n\t{\n\t\tif(a==1 && b==1)\n\t\t\tbreak;\n\t\tif(a>b)\n\t\t{\n\t\t\tb+=1;a-=2;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ta+=1;b-=2;}\n\t\tcount++;\n\t}\n\tprintf(\"%d\\n\",count-1);\n}\n"}, {"source_code": "#include \nint main()\n{\n\tint i,j,k;\n\n\tscanf(\"%d %d\",&i,&j);\n\n\tif(i==1&&j==1){\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\n\tfor(k=1;;k++){\n\t\tif(i\n\nint main()\n{\n int a, b, count = 1;\n scanf(\"%d %d\", &a, &b);\n\n /* if(a == 0 && b == 0 || a == 0 && b == 1 || a == 1 && b == 0 || a == 1 && b == 1){\n printf(\"0\");\n return 0;\n }*/\n if((a >= 0 && a <= 1) && (b >= 0 && b <= 1)){\n printf(\"0\");\n return 0;\n }\n\n while(1){\n if(a > 2){\n a-=2;\n b++;\n count++;\n }\n else if(b > 2){\n b-=2;\n a++;\n count++;\n }\n else\n break;\n }\n printf(\"%d\", count);\n\n return 0;\n}\n"}, {"source_code": "#include\nchar min_char(int a,int b){\n\tif(a>b)\n\t\treturn 'b';\n\telse\n\t\treturn 'a';\n}\nint main(){\n\tint a,b,min=0;\n\tchar ch = 'a';\n\tscanf(\"%d%d\",&a,&b);\n\t\n\tif(a>b)\n\t\tch = 'b';\n\telse\n\t\tch = 'a';\n\t\t\n\twhile(a>=1 && b>=1){\n\t\tch = min_char(a,b);\n\t\tif(a==1 && b==1)\n\t\t\tbreak;\n\t\t\t\n\t\tif(a==1){\n\t\t\ta += 1;\n\t\t\tb -= 2;\n\t\t\tch = 'a';\n\t\t}else if(b==1){\n\t\t\ta -= 2;\n\t\t\tb += 1;\n\t\t\tch = 'b';\n\t\t}else if(ch=='a'){\n\t\t\ta += 1;\n\t\t\tb -= 2;\n\t\t}else if(ch=='b'){\n\t\t\ta -= 2;\n\t\t\tb += 1; \n\t\t}\n\t\t//printf(\"%d %d\\n\",a,b);\n\t\tmin++;\n\t}\n\tprintf(\"%d\",min);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,i,x=0,y,j;\n scanf(\"%d %d\",&a,&b);\n while(a>=1&&b>=1)\n {\n if(a==1&&b==1)\n break;\n if(a>b)\n {\n a-=2;;\n b++;\n x++;\n }\n else\n {\n b-=2;\n a++;\n x++;\n }\n }printf(\"%d\",x);}\n"}, {"source_code": "#include\nint main()\n{ int i,a1,a2;\n scanf(\"%d %d\",&a1,&a2);\n for(i=0;a1>0&&a2>0&&(a1!=1||a2!=1);i++)\n {\n if(a1>a2)\n {a1-=2;\n a2+=1;}\n else {a2-=2;\n a1+=1;\n \n }\n }\n printf(\"%d\",i);\n \n}"}, {"source_code": "#include \n#include \nint main()\n{\n int a1, a2, minute=0;\n scanf(\"%d%d\", &a1, &a2);\n if((a1-2<0)&&(a2-2<0)) printf (\"%d\",minute);\n else\n {\n while((a1!=0)&&(a2!=0))\n {\n if((a1-2)<=(a2-2))\n {\n a1++;\n a2-=2;\n minute++;\n }\n else if((a2-2)<(a1-2))\n {\n a2++;\n a1-=2;\n minute++;\n }\n }\n printf(\"%d\",minute);\n }\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(void) {\n\tint r[2],conn=0,min=0;\n\tscanf(\"%d%d\",&r[0],&r[1]);\n\t\n\twhile(1){\n\t\tif(r[0] <= 0 || r[1] <= 0 || (r[0]<2&&r[1]<2)) break;\n\t\tif(r[0]>r[1]) conn=1;\n\t\tif(r[!conn]<=2) conn=!conn;\n\t\tr[conn]++;\n\t\tr[!conn]-=2;\n\t\tmin++;\n\t}\n\tprintf(\"%d\",min);\n\t\n\treturn 0;\n}"}, {"source_code": "#include\n#include\n#include\nint main()\n{\nint t1,t2,i,j,temp,ct=0;\nscanf(\"%d %d\",&t1,&t2);\nif(t1<=t2){\ni=t1;j=t2;}\nelse{\ni=t2;j=t1;}\nif(i<2&&j<2)\n printf(\"0\");\nelse{\nwhile(j>0)\n{\nct++;\ni++;j=j-2;\nif(j==1||j==2||i==100){\n\ntemp=j;j=i;\ni=temp;}}\nprintf(\"%d\",ct);}\nreturn 0;\n}"}, {"source_code": "/*\nBy Syed Rifat Raiyan\nIUT CSE-18\nI am a beacon of knowledge blazing out across a black sea of ignorance.\n*/\n#include\n#define SWAP(a,b) {a=a+b; b=a-b; a=a-b;}\nint main()\n{\n int a1,a2,i,j,mins=0;\n scanf(\"%d %d\",&a1,&a2);\n if(a1==1 && a2==1)\n {\n printf(\"0\");\n return 0;//weeew -_-\n }\n while(a1>0 && a2>0)\n {\n if(a1>a2)\n {\n SWAP(a1,a2);\n }\n a1++;\n a2-=2;\n mins++;\n }\n printf(\"%d\",mins);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint a, b, c;\n\tscanf(\"%d %d\", &a, &b);\n\tif (a == 1 && b == 1)\n\t{\n\t\tprintf (\"0\");\n\t\treturn 0;\n\t}\n\tif (a == 1 || b == 1)\n\t{\n\t\tif ((a + b) % 3 == 0 || a % 3 == 0 || b % 3 == 0) printf (\"%d\", a + b - 2);\n\t\telse printf (\"%d\", a + b - 3);\n\t\treturn 0;\n\t}\n if ((a - b)% 3 == 0)\n {\n \tprintf (\"%d\", a + b - 3);\n \treturn 0;\n\t}\n\tif (a - b != 0) printf(\"%d\", a + b - 2);\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint main(){\n int p1,p2;\n int tym=0;\n scanf(\"%d %d\",&p1,&p2);\n while(p1>0&&p2>0)\n {\n if(p1==1&&p2==1)\n {\n break;\n }\n if(p1\n\nint main()\n{\n\tint i,j,a1,a2,c,nc,*min,*max,*temp,t=0;\n\tscanf(\"%d %d\",&a1,&a2);\n\tif(a1<=a2)\n\t{\n\t\tmin=&a1;\n\t\tmax=&a2;\n\t}\n\telse\n\t{\n\t\tmin=&a2;\n\t\tmax=&a1;\n\t}\n\t//printf(\"%d %d\\n\",*min,*max);\n\tif(a1==1 && a2==1)\n\t{\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\tif(a1==a2 && a1==2)\n\t{\n\t\tprintf(\"1\\n\");\n\t\treturn 0;\n\t}\n\twhile(*min>0 && *max>0)\n\t{\n\t\tt++;\n\t\t(*min)=(*min)+1;\n\t\t(*max)=(*max)-2;\n\t\t//printf(\"%d %d\\n\",a1,a2);\n\n\t\tif((*max)==1 || (*max)==2)\n\t\t{\n\t\t\ttemp=min;\n\t\t\tmin=max;\n\t\t\tmax=temp;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",t);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main() {\n int a,b,c=0;\n scanf(\"%d %d\", &a,&b);\n while(a>0 && b>0){\n if(b > a){\n a++;\n b-=2;\n }else{\n b++;\n a-=2;\n }\n c++;\n }\n if(a<0||b<0){\n c--;\n }\n printf(\"%d\\n\",c);\nreturn 0;\n}\n"}, {"source_code": "#include \n\nint min(int a, int b){\n return (a < b ? a : b);\n}\n\nint main(){\n int ans = 0, a, b;\n scanf(\"%d%d\", &a, &b);\n while(min(a, b) > 0){\n if(a < b){\n a += 1; b -= 2;\n }\n else{\n b += 1; a -= 2;\n }\n if(min(a, b) < 0) break;\n ans++;\n }\n printf(\"%d\\n\", ans);\n}"}, {"source_code": "#include\nvoid swa(int *a,int *b)\n{\n int t;\n t=*a;\n *a=*b;\n *b=t;\n}\nint main()\n{\n int a1,a2,c=0;\n scanf(\"%d%d\",&a1,&a2);\n while( a1>0 && a2>0 )\n {\n if(a1==1 && a2==1) break;\n c++;\n if(a1>a2)\n swa(&a1,&a2);\n a1++;\n a2-=2;\n// printf(\"%d %d\\n\",a1,a2);\n\n\n }\n printf(\"%d\",c);\n}\n"}, {"source_code": "#include\nint main()\n{\n int a1, a2, count=0;\n scanf(\"%d %d\", &a1, &a2);\n if(a1<2 && a2<2)\n {\n printf(\"0\");\n }\n else\n {\n while(a1>0 && a2>0)\n {\n if(a1>a2)\n {\n a1-=2;\n a2++;\n }\n else\n {\n a2-=2;\n a1++;\n }\n count++;\n }\n printf(\"%d\", count);\n }\n return 0;\n}"}, {"source_code": "#include\nint maxx(int a,int b)\n{\nreturn (a>b)?a:b;\n}\nint minn(int a,int b)\n{\nreturn (abb)\n {\n aa-=2;\n bb++;\n cnt++;\n }\n else if(bb>aa)\n {\n bb-=2;\n aa++;\n cnt++;\n }\n else\n {\n cnt+=((aa-2)*2)+1;\n break;\n }\n }\n }\n printf(\"%d\",cnt);\n }\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int a1,a2,sum=0,t;\n scanf(\"%d%d\",&a1,&a2);\n if(a10&&a2>0){\n if(a1>2){\n a1=a1-2;\n a2=a2+1;\n sum++;\n // printf(\"%d %d\\n\",a1,a2);\n continue;\n }\n a1=a1+1;\n a2=a2-2;\n sum++;\n // printf(\"%d %d\\n\",a1,a2);\n }\n printf(\"%d\",sum);\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,i,x=0,y,j;\n scanf(\"%d %d\",&a,&b);\n while(a>=1&&b>=1)\n {\n if(a==1&&b==1)\n break;\n if(a>b)\n {\n a-=2;;\n b++;\n x++;\n }\n else\n {\n b-=2;\n a++;\n x++;\n }\n }printf(\"%d\",x);}"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS\n\n#include \n\nint main() {\n\t\n\tint a1, a2;\n\tint res = 0;\n\tint d;\n\tint *pc, *pf, *t;\n\n\tscanf(\"%d%d\", &a1, &a2);\n\n\tpf = &a1; pc = &a2;\n\twhile (a1 > 2 || a2 > 2) {\n\t\td = (*pf - 1) / 2;\n\t\tres += d;\n\t\t*pf -= 2 * d;\n\t\t*pc += d;\n\t\tt = pc; pc = pf; pf = t;\n\t}\n\t\n\tif (a1 == 2 || a2 == 2)\n\t\tres++;\n\tprintf(\"%d\", res);\n\n}"}, {"source_code": "#include\nint main()\n{\n\tint a,b;\n\twhile(scanf(\"%d%d\",&a,&b)!=EOF){\n\t\tint num=0;\n\t\twhile(a!=0&&b!=0){\n\t\t\tif(a==1&&b==1)\n\t\t\tbreak;\n\t\t\tif(a>=b){\n\t\t\t\ta=a-2;\n\t\t\t\tb=b+1;\n\t\t\t\tnum++;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tb=b-2;\n\t\t\t\ta=a+1;\n\t\t\t\tnum++;\n\t\t\t}\n\t\t}\n\t\tprintf(\"%d\\n\",num);\n\t}\n\treturn 0;\n} "}, {"source_code": "#include \n\nint a1,a2,count;\n\nvoid oo(void)\n{\n int d=(a2-1)/2;\n count+=d;\n a1+=d;\n a2=1;\n}\n\nvoid eo(void)\n{\n int d=(a2 % 2)*(a2-1)/2+(a2 % 2 == 0)*(a2-2)/2;\n count+=d;\n a1+=d;\n a2=(a2 % 2)+(a2 % 2 == 0)*2;\n}\n\nvoid ee(void)\n{\n int d=(a2-2)/2;\n count+=d;\n a1+=d;\n a2=2;\n}\n\nint main(void)\n{\n scanf(\"%d %d\",&a1,&a2);\n if( a1 > a2 )\n {\n a1=a1+a2;\n a2=a1-a2;\n a1=a1-a2;\n }\n int a=a2;\n while(a2 > 2)\n {\n if( a1 % 2 && a2 % 2 )\n oo();\n else if( a1 % 2 || a2 % 2 )\n eo();\n else\n ee();\n if( a1 > a2 )\n {\n a1=a1+a2;\n a2=a1-a2;\n a1=a1-a2;\n }\n }\n if(a < 2)\n printf(\"0\");\n else\n printf(\"%d\",count+1);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint find(int x, int y) {\n\tint m = x, n = y, num = 0;\n\tif(m == 1 && n == 1) {\n\t\treturn 0;\n\t}\n\twhile(m > 0 && n > 0) {\n\t\tif(m > n) {\n\t\t\tm = m - 2;\n\t\t\tn = n + 1;\n\t\t\tnum++;\n\t\t}\n\t\telse {\n\t\t\tm = m + 1;\n\t\t\tn = n - 2;\n\t\t\tnum++;\n\t\t}\n\t}\n\treturn num;\n}\n\nint main() {\n\tint a1, a2, result;\n\tscanf(\"%d%d\", &a1, &a2);\n\tresult = find(a1, a2);\n\tprintf(\"%d\", result);\n\treturn 0;\n} "}, {"source_code": "#include\nint ans[105][105];\nint main()\n{\n\nint a,b,c=4,flag=-1,count,i,k;\n\nscanf(\"%d%d\",&a,&b);\nif(a==1 && b==1)\n printf(\"0\\n\");\n else{\n flag=-1;\n count=-1;\n while(c>0)\n {\n count++;\n if(a<=0 || b<=0)\n break;\n\n\n else if(flag==-1)\n {\n if(a0 && b<=2)\n {\n flag=2;\n b=b+1;\n a=a-2;\n }\n else{\n a=a+1;\n b=b-2;\n }\n }\n else if(flag==2)\n {\n if(a>0 && a<=2)\n {\n flag=1;\n a=a+1;\n b=b-2;\n }\n\n else{\n b=b+1;\n a=a-2;\n }\n }\n}\nprintf(\"%d\\n\",count);\n }\nreturn 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n\nint num=0;\n\nvoid dian(int a,int b)\n{\n\tnum++;\n\tif(a*b==2||a==2&&b==2)\n\t{\n\t\treturn;\n\t}\n\tif(a==1&&b==1)\n\t{\n\t\tnum--;\n\t\treturn;\n\t}\n\tdian(a>b?(a-2):(a+1),a>b?(b+1):(b-2));\t\n\n}\n\n\nint main()\n{\n\tint a,b;\n\tscanf(\"%d %d\",&a,&b);\n\tdian(a,b);\n\tprintf(\"%d\",num);\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n \n \nint main() \n{\n\t int stick1, stick2, i;\n\t int count = 0;\n\t int control = 1;\n\t scanf(\"%d%d\",&stick1, &stick2);\n\t if(stick1 > stick2)\n\t {\n\t\t control = 0;\n\t }\n\t for(;;)\n\t {\n\t\t if(stick1 <= 0 || stick2 <= 0)break;\n\t\t if(1 == control) \n\t\t {\n\t\t\t stick1++;\n\t\t\t stick2 -= 2;\n\t\t }\n\t\t else\n\t\t {\n\t\t\t stick2++;\n\t\t\t stick1 -= 2;\n\t\t }\n\t\t if(0 == control && stick1 < stick2 &&stick1 -2 <= 0 )\n\t\t {\n\t\t\t control = 1;\n\t\t }\n\t\t else if(1 == control && stick2 < stick1 &&stick2 - 2 <= 0)\n\t {\n\t\t\t control = 0;\n\t\t }\n\t\t if(stick1 >= 0 && stick2 >= 0)count++;\n\t\t \n\t }\n\t printf(\"%d\\n\",count);\n return EXIT_SUCCESS;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint a,b;\n\tscanf(\"%d%d\",&a,&b);\n\tint i,k,flag=0;\n\tif(a==1 && b==1)\n\t\tflag=1;\n\tfor(i=0;i<100000;i++)\n\t{\n\t\tif(a!=0 && b!=0 && a>0 && b>0 && (a!=1 || b!=1))\n\t\t{\n\t\tif(a>b)\n\t\t{\n\t\t\ta-=2;\n\t\t\tb+=1;\n\t\t}\n\t\telse if(b>a)\n\t\t{\n\t\t\tb-=2;\n\t\t\ta+=1;\n\t\t}\n\t\telse if(a==b)\n\t\t{\n\t\t\tb-=2;\n\t\t\ta+=1;\n\t\t}\n\t\tk=i;\n\t}\n\telse if(a==0 || b==0 || (a==1 && b==1))\n\t\tgoto jump;\n\t}\n\tjump:\n\tif(flag==1)\n\t\tprintf(\"0\\n\");\n\telse\n\tprintf(\"%d\\n\",k+1);\n\treturn 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n int a,b;\n int c=0;\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n if(a+b==2){\n printf(\"%d\\n\",0);\n }\n else{\n if((a-b)%3==0){\n c=1;\n }\n\n printf(\"%d\\n\",a+b-2-c);\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint a,b;\n\tscanf(\"%d%d\",&a,&b);\n\tint i,k,flag=0;\n\tif(a==1 && b==1)\n\t\tflag=1;\n\tfor(i=0;i<100000;i++)\n\t{\n\t\tif(a!=0 && b!=0 && a>0 && b>0 && (a!=1 || b!=1))\n\t\t{\n\t\tif(a>b)\n\t\t{\n\t\t\ta-=2;\n\t\t\tb+=1;\n\t\t}\n\t\telse if(b>a)\n\t\t{\n\t\t\tb-=2;\n\t\t\ta+=1;\n\t\t}\n\t\telse if(a==b)\n\t\t{\n\t\t\tb-=2;\n\t\t\ta+=1;\n\t\t}\n\t\tk=i;\n\t}\n\telse if(a==0 || b==0 || (a==1 && b==1))\n\t\tgoto jump;\n\t}\n\tjump:\n\tif(flag==1)\n\t\tprintf(\"0\\n\");\n\telse\n\tprintf(\"%d\\n\",k+1);\n\treturn 0;\n}"}, {"source_code": "A,B,t,T;main(a,b){for(scanf(\"%d%d\",&a,&b);a>2|b>2;t+=T)A=a%2?:2,T=a-1>>1,B=T+b,a=B,b=A;printf(\"%d\",t+(a*b>1));}"}, {"source_code": "#include \n#include \n\nint main(){\n\tint a,b,i,count = 0;\n\tscanf(\"%d %d\",&a,&b);\n\twhile(a>0 && b>0){\n\t\tif(a==1 && b==1){\n\t\t\tbreak;\n\t\t}\n\n\t\tif(a=b){\n\t\t\tb++;\n\t\t\ta-=2;\n\t\t\tcount++;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",count);\n\n\treturn 0 ;\n}"}, {"source_code": "/* AUTHOR:AKASH JAIN\n* USERNAME:akash19jain \n* DATE:27/07/2019 \n*/\n#include\n#include\n#include\n#include\n#include\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)\t\twhile(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)\t\t 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\nint main()\n{\n ll a,b,ans=0;\n SC2(a,b);\n while(a>0 && b>0)\n {\n if(a=2)\n {\n a++;\n b-=2;\n }\n else if(a>=2)\n {\n b++;\n a-=2;\n }\n else\n {\n break;\n }\n ans++;\n }\n PF1(ans);\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\n#include \n\n\nint main(int argc, char const *argv[])\n{\n\tint a1, a2, t = 0;\n\tscanf(\"%d %d\",&a1,&a2);\n\t\n\twhile(a1 > 0 && a2 > 0)\n\t{\n\t\tif(a1 <= 1 && a2 <= 1)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\telse if(a1 < a2)\n\t\t{\n\t\t\ta1 = a1 + 1;\n\t\t\ta2 = a2 - 2;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ta1 = a1 - 2;\n\t\t\ta2 = a2 + 1;\n\t\t}\n\t\t++t;\n\t}\n\tprintf(\"%d\\n\", t);\n\treturn 0;\n}"}, {"source_code": "#include \nint main()\n{\n\tint i,j,k;\n\n\tscanf(\"%d %d\",&i,&j);\n\n\tif(i==1&&j==1){\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\n\tfor(k=1;;k++){\n\t\tif(i\nint min(int a,int b){\n\tif(a0 && b>0){\n\t\tcharge = min(a,b);\n\t\tif(charge == 1){\n\t\t\ta++;\n\t\t\tb-=2;\n\t\t} else {\n\t\t\ta-=2;\n\t\t\tb++;\n\t\t}\n\t\ttime++;\n\t}\n\tprintf(\"%d\\n\",time);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int a,b,i,j,cnt=0,temp,mx,mn;\n scanf(\"%d %d\",&a,&b);\n\n if(a<2 && b<2) {\n printf(\"0\");\n return 0;\n }\n\n if(a\n#include\n#include\n#include\n#include\n\n#define MAX 10005\n\ntypedef long long ll;\n\nchar temp[MAX];\nint i, j;\n\nint min(int a, int b){\n return a > b ? b : a;\n}\n\nint max(int a, int b){\n return a > b ? a : b;\n}\n\nint a, b, dp[105][105];\n\nint solve(int x, int y, int sum){\n if(y <= 0 || x <= 0) return sum;\n \n if(dp[x][y] + 1) return dp[x][y];\n dp[x][y] = 0;\n \n int solve1 = sum, solve2 = sum;\n \n if(x >= 2) solve1 = solve(x - 2, y + 1, sum + 1);\n if(y >= 2) solve2 = solve(x + 1, y - 2, sum + 1);\n \n return dp[x][y] = max(solve1, solve2);\n}\n\nint main(){\n \n int a, b; scanf(\"%d%d\", &a, &b);\n memset(dp, -1, sizeof(dp));\n \n printf(\"%d\", solve(a, b, 0));\n \n return 0;\n}\n\n\n\n\n\n"}, {"source_code": "#include\nint main()\n{\n int n,m;\n scanf(\"%d %d\",&n,&m);\n int c = 0;\n int count = 0;\n //printf(\"min is %d\\nmax is %d\\n\",min,max);\n while(1)\n {\n // printf(\"c\\n\");\n if (n<=0||m<=0) break;\n if (n==1&&m==1) break;\n if (n>m)\n {\n int temp;\n temp = n;\n n = m;\n m = temp;\n }\n n+=1;\n m-=2;\n count = count + 1;\n }\n printf(\"%d\\n\",count);\n return 0;\n}\n"}, {"source_code": "#include\n/*void h(int &a,int &b)\n{\n\tint x;\n\ta=x;\n\ta=b;\n\tb=x;\n\treturn;\n}*/\nint main()\n{\n\tint a1,a2,k=0;\n\tscanf(\"%d%d\",&a1,&a2);\n\twhile(1)\n\t{\n\t\tif(a1>a2){\n\t\t\tint x=a1;\n\t\t\ta1=a2;\n\t\t\ta2=x;\n\t\t}\n\t\tif(a2<=1||a1<1)break;\n\t\ta1++;a2-=2;\n\t\tif(a1>100)a1=100;\n\t\tk++;\n\t}\n\tprintf(\"%d\\n\",k);\n\treturn 0;\n}"}, {"source_code": "//\n// main.c\n// test1\n//\n// Created by Abdallah Elerian on 3/23/16.\n// Copyright © 2016 Abdallah. All rights reserved.\n//\n\n#include \n\nint main() {\n int a1,a2,n=0;\n scanf(\"%d\",&a1);\n scanf(\"%d\",&a2);\n if (a1>100 || a2>100) {\n return(0);\n }\n \n \n \n while (a1!=0 && a2!=0 && a1>0 && a2>0 && !(a1==1 && a2==1) ) {\n if(a1\nint main()\n{\n\tint a,b;\n\tscanf(\"%d %d\",&a,&b);\n\tint count=1;\n\t\n\twhile(a>0 && b>0)\n\t{\n\t\tif(a==1 && b==1)\n\t\t\tbreak;\n\t\tif(a>b)\n\t\t{\n\t\t\tb+=1;a-=2;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ta+=1;b-=2;}\n\t\tcount++;\n\t}\n\tprintf(\"%d\\n\",count-1);\n}\n"}, {"source_code": "#include\nchar min_char(int a,int b){\n\tif(a>b)\n\t\treturn 'b';\n\telse\n\t\treturn 'a';\n}\nint main(){\n\tint a,b,min=0;\n\tchar ch = 'a';\n\tscanf(\"%d%d\",&a,&b);\n\t\n\tif(a>b)\n\t\tch = 'b';\n\telse\n\t\tch = 'a';\n\t\t\n\twhile(a>=1 && b>=1){\n\t\tch = min_char(a,b);\n\t\tif(a==1 && b==1)\n\t\t\tbreak;\n\t\t\t\n\t\tif(a==1){\n\t\t\ta += 1;\n\t\t\tb -= 2;\n\t\t\tch = 'a';\n\t\t}else if(b==1){\n\t\t\ta -= 2;\n\t\t\tb += 1;\n\t\t\tch = 'b';\n\t\t}else if(ch=='a'){\n\t\t\ta += 1;\n\t\t\tb -= 2;\n\t\t}else if(ch=='b'){\n\t\t\ta -= 2;\n\t\t\tb += 1; \n\t\t}\n\t\t//printf(\"%d %d\\n\",a,b);\n\t\tmin++;\n\t}\n\tprintf(\"%d\",min);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,ans=0,temp;\n scanf(\"%d %d\",&a,&b);\n if(a=3)\n {\n a-=2;\n b++;\n ans++;\n }\n if(b>a)\n {\n temp=a;\n a=b;\n b=temp;\n }\n if(a==1)\n break;\n if(a==2)\n {\n a-=2;\n ans++;\n }\n }\n printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint a1,a2,cnt=0;\n\tscanf(\"%d%d\",&a1,&a2);\n\twhile(a1>0&&a2>0){\n\t\tif(a1>=a2){\n\t\t\ta2+=1;\n\t\t\ta1-=2;\n\t\t}\n\t\telse {\n\t\t\ta2-=2;\n\t\t\ta1+=1;\n\t\t}\n\t\tif(a1>=0&&a2>=0)cnt++;\n\t}\n\tprintf(\"%d\\n\",cnt);\n\treturn 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n int count=0;\n if(a==1&&b==1){printf(\"%d\",count); return 0;}\n\n for(;;)\n {\n // printf(\"%d %d\\n\",a,b);\n if(a<=b){a=a+1;b=b-2;if(b<1){break;} count=count+1;continue;}\n if(b<=a){b=b+1;a=a-2;if(a<1){break;} count=count+1;continue;}\n\n }\n printf(\"%d\",count+1);\n return 0;\n}"}, {"source_code": "#include\nint min(int x,int y)\n{\n if(x>y)\n return y;\n else\n return x;\n}\nint max(int x,int y)\n{\n if(x=2&&a2<2)\n return 1+game(min(a1-2,a2+1),max(a1-2,a2+1));\n else if(a2>=2&&a1<2)\n return 1+game(min(a1+1,a2-2),max(a1+1,a2-2));\n else if(a1>=2&&a2>=2)\n {if(1+game(min(a1-2,a2+1),max(a1-2,a2+1))>1+game(min(a1+1,a2-2),max(a1+1,a2-2)))\n return 1+game(min(a1-2,a2+1),max(a1-2,a2+1));\n else\n return 1+game(min(a1+1,a2-2),max(a1+1,a2-2));}\n }\n}*/\nint game(int a1,int a2)\n{\n if(a1==0||a2==0)\n return 0;\n if(a1<2&&a2<2)\n return 0;\n else\n return 1+game(min(a1+1,a2-2),max(a1+1,a2-2));\n}\nint main()\n{\n int a1,a2,a[101][101],i,j;\n scanf(\"%d %d\",&a1,&a2);\n printf(\"%d\",game(min(a1,a2),max(a1,a2)));\n}\n"}, {"source_code": "#include \n#include \n\n\nint main() {\n\n\tint first_joystick, second_joystick, result;\n\n\tscanf(\"%i %i\", &first_joystick, &second_joystick);\n\n\tif ( (first_joystick-second_joystick)%3 == 0)\n\t\tresult = first_joystick+second_joystick-3;\n\telse\n\t\tresult = first_joystick+second_joystick-2;\n\n\tif(result < 0)\n\t\tresult = 0;\n\n\tprintf(\"%i\\n\", result);\n\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int a,b,i,ans=0;\n scanf(\"%d %d\",&a,&b);\n if(a==1 && b==1){\n printf(\"0\");\n return 0;\n } \n for(i=1; ; i++)\n {\n if(a<=b){\n a++;\n b-=2;\n }\n else if(b\nint main()\n{\n\tint a,b;\n\tscanf(\"%d%d\",&a,&b);\n\tint i,k,flag=0;\n\tif(a==1 && b==1)\n\t\tflag=1;\n\tfor(i=0;i<100000;i++)\n\t{\n\t\tif(a!=0 && b!=0 && a>0 && b>0 && (a!=1 || b!=1))\n\t\t{\n\t\tif(a>b)\n\t\t{\n\t\t\ta-=2;\n\t\t\tb+=1;\n\t\t}\n\t\telse if(b>a)\n\t\t{\n\t\t\tb-=2;\n\t\t\ta+=1;\n\t\t}\n\t\telse if(a==b)\n\t\t{\n\t\t\tb-=2;\n\t\t\ta+=1;\n\t\t}\n\t\tk=i;\n\t}\n\telse if(a==0 || b==0 || (a==1 && b==1))\n\t\tgoto jump;\n\t}\n\tjump:\n\tif(flag==1)\n\t\tprintf(\"0\\n\");\n\telse\n\tprintf(\"%d\\n\",k+1);\n\treturn 0;\n}"}, {"source_code": "#include\nint ans[105][105];\nint main()\n{\n\nint a,b,c=4,flag=-1,count,i,k;\n\nscanf(\"%d%d\",&a,&b);\nif(a==1 && b==1)\n printf(\"0\\n\");\n else{\n flag=-1;\n count=-1;\n while(c>0)\n {\n count++;\n if(a<=0 || b<=0)\n break;\n\n\n else if(flag==-1)\n {\n if(a0 && b<=2)\n {\n flag=2;\n b=b+1;\n a=a-2;\n }\n else{\n a=a+1;\n b=b-2;\n }\n }\n else if(flag==2)\n {\n if(a>0 && a<=2)\n {\n flag=1;\n a=a+1;\n b=b-2;\n }\n\n else{\n b=b+1;\n a=a-2;\n }\n }\n}\nprintf(\"%d\\n\",count);\n }\nreturn 0;\n}\n"}, {"source_code": "#include \nint abs(int a) {\n return a>0?a:-a;\n}\nint min(int a, int b) {\n return a\n#include \n#include \n\nint main(void)\n{\n int a[2];\n int i, j, k;\n int count;\n\n scanf(\"%d %d\", &a[0], &a[1]);\n\n count = 0;\n i = (a[0] < a[1]) ? 0 : 1;\n j = (i == 0) ? 1 : 0;\n if (a[i] == 1 && a[j] == 1) goto out;\n while (a[0] >= 1 && a[1] >= 1) {\n a[i] += 1;\n a[j] -= 2;\n if (a[j] <= 2) {\n k = i;\n i = j;\n j = k;\n }\n count++;\n // printf(\"%d %d\\n\", a[i], a[j]);\n }\nout:\n printf(\"%d\\n\", count);\n\n return 0;\n}\n"}, {"source_code": "#include\n\n\tint main ()\n{\n\tint a,b,count=0;\n\tscanf(\"%d%d\",&a,&b);\n\twhile(a>0 && b>0)\n\t{\n\t\tif(a>b)\n\t\t{\n\t\t\tb++;\n\t\t\ta=a-2;\n\t\t\tif(a>=0)\n\t\t\tcount++;\n\n\t\t}\n\t\telse\n\t\t{\n\t\t\ta++;\n\t\t\tb=b-2;\n\t\t\tif(b>=0)\n\t\t\tcount++;\n\t\t}\n\t}\n\tprintf(\"%d\",count);\n\t\n}\n\n"}, {"source_code": "#include\n\nint main(void){\n\tint a,b,i;\n\n\tscanf(\"%d%d\",&a,&b);\n\n\tfor(i=0; ;i++){\n\n\t\tif(a<=b) {\n\t\t\ta=a+1;\n\t\t\tb=b-2;\n\t\t}\n\t\telse {\n\t\t\tb=b+1;\n\t\t\ta=a-2;\n\t\t}\n\t\tif(a<=0||b<=0) break;\n\t}\n\tif(a==0||b==0) printf(\"%d\\n\",i+1);\n\telse printf(\"%d\",i);\n\nreturn 0;\n}\n"}, {"source_code": "int main() {\n int a1,a2,n=0;\n scanf(\"%d\",&a1);\n scanf(\"%d\",&a2);\n if (a1>100 || a2>100) {\n return(0);\n }\n \n \n \n while (a1!=0 && a2!=0 && a1>0 && a2>0 && !(a1==1 && a2==1) ) {\n if(a1\n#include \nint main()\n{\n int a,b,i=0;\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n if((a==1&&b==1)||a<=0||b<=0)\n {\n printf(\"%d\",i);\n }\n else {\n do{\n if(a>b){\n a=a-2;\n b=b+1;\n }\n else{\n a=a+1;\n b=b-2;\n }\n i++;\n }while(a>0&&b>0);\n printf(\"%d\",i);\n }\n}\n"}, {"source_code": "#include \ntypedef struct Stick{\n short a1, a2, Max;\n void (*Inite)(struct Stick*);\n void (*MaxDurationGame)(struct Stick*);\n void (*DispalyMs)(struct Stick*);\n}Stick;\nvoid Inite(Stick*);\nvoid MaxDurationGame(Stick*);\nvoid DispalyMs(Stick*);\nint main()\n{\n Stick s;\n s.Inite = Inite, s.Inite(&s), s.MaxDurationGame(&s), s.DispalyMs(&s);\n\n return 0;\n}\nvoid Inite(Stick* s){\n s->DispalyMs = DispalyMs, s->MaxDurationGame = MaxDurationGame, s->Max = 0;\n scanf(\"%hd%hd\", &s->a1, &s->a2);\n}\nvoid MaxDurationGame(Stick* s){\n while(s->a1 > 0 && s->a2 > 0){\n if(1 == s->a1 && 1 == s->a2){ break; }\n if(s->a1 > s->a2){ s->a1 -= 2, s->a2 += 1; }\n else{ s->a2 -= 2, s->a1 += 1; }\n s->Max++;\n }\n}\nvoid DispalyMs(Stick* s){\n printf(\"%hd\", s->Max);\n}\n"}, {"source_code": "#include\nint main()\n{\n int a1,a2,x=0; //有两个操纵杆,只有一个充电器一次能充1%的电,不充电的操纵杆掉2%的电\n scanf(\"%d%d\",&a1,&a2); //输入起始电源\n while(a1>0&&a2>0)\n {\n if(a1==1&&a2==1) //等于1的时候游戏一分钟也不能玩下去\n {\n break;\n }\n if(a1\n\nint main(void)\n{\n int a1,a2;\n int t=0;\n scanf(\"%d %d\",&a1,&a2);\n while(a1>0&&a2>0&&!(a1==1&&a2==1)){\n if(a1==1||a1==2){\n a1++;\n a2-=2;\n }else{\n a1-=2;\n a2++;\n }\n t++;\n }\n printf(\"%d\\n\",t);\n return 0;\n}\n\n"}, {"source_code": "#include\n//#include\nint main()\n\n{\n int i,x,y,a1,a2,p=0;\n\n scanf(\"%d %d\",&a1,&a2);\n\n for(i=0;;i++){\n\n \n\n if(a1\nint main()\n{\n\tint a, b; scanf(\"%d %d\", &a, &b);\n\tint res = 0;\n\twhile(1)\n\t{\n\t\tif(a <= 0 || b <= 0 || (a == 1 && b == 1))\n\t\t{\n\t\t\tprintf(\"%d\\n\", res);\n\t\t\treturn 0;\n\t\t}\n\t//\tprintf(\"%d\\n\", res);\n\t//\tprintf(\"%d %d\\n\", a, b);\n\t\tif(a >= b) b+=3;\n\t\telse a+=3;\n\t\ta -= 2; b -= 2;\n\t\tres++;\n\t}\n}\n"}, {"source_code": "#include\nint main()\n{\n int a1, a2, count=0;\n scanf(\"%d %d\", &a1, &a2);\n if(a1<2 && a2<2)\n {\n printf(\"0\");\n }\n else\n {\n while(a1>0 && a2>0)\n {\n if(a1>a2)\n {\n a1-=2;\n a2++;\n }\n else\n {\n a2-=2;\n a1++;\n }\n count++;\n }\n printf(\"%d\", count);\n }\n return 0;\n}"}, {"source_code": "#include \n#include \n\nint main(void)\n{\n\tint a1, a2, count = 0;\n\tscanf(\"%d %d\", &a1, &a2);\n\twhile(a1 > 0 && a2 > 0)\n\t{\n\t\tif(a1 > a2) { a2 += 1; a1 -=2; }\n\t\telse { a1 += 1; a2 -= 2; }\n\t\tcount += 1;\n\t}\n\tif(a1 < 0 || a2 < 0) count -= 1;\n\tprintf(\"%d\\n\", count);\n\treturn 0; \t\t\t\n}\t\n\t\t"}, {"source_code": "#include\n\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n int count=0;\n if(a==1&&b==1){printf(\"%d\",count); return 0;}\n\n for(;;)\n {\n // printf(\"%d %d\\n\",a,b);\n if(a<=b){a=a+1;b=b-2;if(b<1){break;} count=count+1;continue;}\n if(b<=a){b=b+1;a=a-2;if(a<1){break;} count=count+1;continue;}\n\n }\n printf(\"%d\",count+1);\n return 0;\n}"}, {"source_code": "#include \n#define max(a,b) (a>b?a:b)\n\nint f[200][200];\n\nint res(int a, int b){\n if (f[a][b] > 0 && a > 0 && b > 0)\n return f[a][b];\n if (a <= 0) return 0;\n if (b <= 0) return 0;\n if (a <= 1 && b <= 1) return 0;\n f[a][b] = max(res(a-2,b+1), res(a+1,b-2))+1;\n return f[a][b];\n}\n\n\n\nint main(){\n int a,b;\n int i, j;\n scanf(\"%d %d\", &a, &b);\n for (i = 0; i <= 200; i++)\n for (j = 0; j <= 200; j++)\n f[i][j] = 0;\n printf(\"%d\", res(a,b));\n return 0;\n}\n"}, {"source_code": "b,u;main(a){scanf(\"%d%d\",&a,&b);u=a+b-2;printf(\"%d\",u?u-!((a-b)%3):0);}"}, {"source_code": "#include \"stdio.h\"\n\n#define BASE \"%d\"\ntypedef int Base;\n\n\ntypedef struct UJoystick\n{\n Base Charge;\n} UJoystick;\n\n\nint main()\n{\n Base GameTime = 0;\n UJoystick FirstJoystick;\n UJoystick SecondJoystick;\n scanf(BASE BASE, &FirstJoystick.Charge, &SecondJoystick.Charge);\n \n \n if (FirstJoystick.Charge == (SecondJoystick.Charge == 1))\n {\n printf(BASE\"\\n\", 0);\n return 0;\n }\n \n \n while (FirstJoystick.Charge && SecondJoystick.Charge)\n {\n GameTime++;\n \n if (FirstJoystick.Charge < SecondJoystick.Charge)\n {\n FirstJoystick.Charge++;\n SecondJoystick.Charge -= 2;\n }\n else \n {\n FirstJoystick.Charge -= 2;\n SecondJoystick.Charge++;\n }\n }\n \n printf(BASE\"\\n\", GameTime);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint a,b;\n\tscanf(\"%d %d\",&a,&b);\n\tint count=1;\n\t\n\twhile(a>0 && b>0)\n\t{\n\t\tif(a==1 && b==1)\n\t\t\tbreak;\n\t\tif(a>b)\n\t\t{\n\t\t\tb+=1;a-=2;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ta+=1;b-=2;}\n\t\tcount++;\n\t}\n\tprintf(\"%d\\n\",count-1);\n}\n"}, {"source_code": "#include\nint compute(int, int, int (*)[200]);\nint main(void){\n\n\tint count[200][200]={0};\n\n\tint a, b;\n\tscanf(\"%d%d\",&a,&b);\n printf(\"%d\\n\",compute(a,b,count));\n\n\treturn 0;\n}\n\nint compute(int a, int b, int (*count)[200]){\n int t = a>b?a:b;\n b = a+b-t;\n a = t;\n if( a < 0 || b < 0)\n\t return 0;\n if(a <=2 && b <=2){\n\t if ( a < 2 && b < 2)\n\t\t return 0;\n\t else\n\t\t return count[a][b]=1;\n }\n\n if(count[a][b])\n\t return count[a][b];\n int m = compute(a+1, b-2, count);\n int l = compute(a-2,b+1, count);\n\n\n\treturn count[a][b] = 1+(m>l?m:l);\n}\n"}], "negative_code": [{"source_code": "#include\nint main()\n{\n int a1,a2,c=0;\n scanf(\"%d %d\",&a1,&a2);\n while(a1>0 && a2>0)\n {\n if(a1<=a2)\n {\n a1=a1+1;\n a2=a2-2;\n }\n else if(a1>a2)\n {\n a1=a1-2;\n a2=a2+1;\n }\n c++;\n }\n printf(\"\\n%d\",c);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\n#define pf printf\n#define sf scanf\n\n\n\nint main(void){\n // int n;\n// sf(\"%d\", &n);\n // int arr[n];\n// for(int i=0;i 0 && a2 > 0){\n if(c == 0){\n a1 += 1;\n a2 -=2;\n if(a2 <=2 ) c=1;\n }\n else {\n a2 +=1;\n a1-=2;\n if(a1<=2) c=0;\n }\n mins++;\n }// while\n pf(\"%d\\n\", mins);\n return 0;\n} //main"}, {"source_code": "#include \n#include \nint main(void) {\n\tint p,q,M,N,AIDE,t=0;\n\tscanf(\"%d %d\",&p,&q);\n\tif(p 0 ){\n\t\tM -= 2;\n\t\tN += 1;\n\t\tif(M==1 || M==2){\n\t\t\tAIDE=M;\n\t\t\tM = N;\n\t\t\tN = AIDE;\n\t\t} \n\t\tt++;\n\t}\n\tprintf(\"%d\", t );\n\treturn 0;\n\t\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tint i,j,a1,a2,c,nc,*min,*max,*temp,t=0;\n\tscanf(\"%d %d\",&a1,&a2);\n\tif(a1<=a2)\n\t{\n\t\tmin=&a1;\n\t\tmax=&a2;\n\t}\n\telse\n\t{\n\t\tmin=&a2;\n\t\tmax=&a1;\n\t}\n\t//printf(\"%d %d\\n\",*min,*max);\n\tif(a1==a2 && a1==2)\n\t{\n\t\tprintf(\"1\\n\");\n\t\treturn 0;\n\t}\n\twhile(*min>0 && *max>0)\n\t{\n\t\tt++;\n\t\t(*min)=(*min)+1;\n\t\t(*max)=(*max)-2;\n\t\t//printf(\"%d %d\\n\",a1,a2);\n\n\t\tif((*max)==1 || (*max)==2)\n\t\t{\n\t\t\ttemp=min;\n\t\t\tmin=max;\n\t\t\tmax=temp;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",t);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint find(int x, int y) {\n\tint m = x, n = y, num = 0;\n\tif(m == 1 && n == 1) {\n\t\treturn 0;\n\t}\n\tif(m == 100 && n == 100) {\n\t\tnum--;\n\t}\n\twhile(m > 0 && n > 0) {\n\t\tif(m > n) {\n\t\t\tm = m - 2;\n\t\t\tn = n + 1;\n\t\t\tnum++;\n\t\t}\n\t\telse {\n\t\t\tm = m + 1;\n\t\t\tn = n - 2;\n\t\t\tnum++;\n\t\t}\n\t}\n\treturn num;\n}\n\nint main() {\n\tint a1, a2, result;\n\tscanf(\"%d%d\", &a1, &a2);\n\tresult = find(a1, a2);\n\tprintf(\"%d\", result);\n\treturn 0;\n} "}, {"source_code": "#include \n\nint main(void) {\n int a1, a2, t = 0;\n scanf(\"%d %d\", &a1, &a2);\n while (a1 + a2 > 2) {\n if (a1 < a2) { a1 += 1; a2 -= 2; }\n else { a1 -= 2; a2 += 1; }\n ++t;\n }\n printf(\"%d\\n\", t);\n return 0;\n}\n"}, {"source_code": "#include\n\n\tint main ()\n{\n\tint a,b,count=0;\n\tscanf(\"%d%d\",&a,&b);\n\twhile(a!=0 && b!=0)\n\t{\n\t\tif(a>b)\n\t\t{\n\t\t\tb++;\n\t\t\ta=a-2;\n\t\t\tcount++;\n\n\t\t}\n\t\telse\n\t\t{\n\t\t\ta++;\n\t\t\tb=b-2;\n\t\t\tcount++;\n\t\t}\n\t}\n\tprintf(\"%d\",count);\n\t\n}\n\n"}, {"source_code": "#include\nint main()\n{\n\tint t=0, a, b;\n\tscanf(\"%d %d\", &a, &b);\n\twhile(a!=0 && b!=0)\n\t{\n\t\tif(a<=b)\n\t\t{\n\t\t\ta+=1;\n\t\t\tb-=2;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ta-=2;\n\t\t\tb+=1;\n\t\t}\n\t\tprintf(\"%d %d\\n\", a, b);\n\t\tt+=1;\n\t}\n\tprintf(\"%d\\n\", t);\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int a,b, sum = 0, i,j;\n scanf(\"%d %d\", &a, &b);\n if (a > b) {i = -2; j = 1;}\n else {i = 1; j = -2;}\n while ((a > 0) && (b > 0)){\n a += i; b += j;\n if ((a == 1) && (b == 2)) {i = 1; j = -2;}\n else if ((b == 1) && (a == 2)){i = -2; j = 1;}\n else if (a <= 2) {i = 1; j = -2;}\n else if (b <= 2) {i = -2; j = 1;}\n if ((a != 1) || (b != 1)) sum++;\n }\n printf(\"%d\\n\", sum);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n\n\nint main(void) {\n\tint a1, a2, ukupno = 0;\n\tscanf(\"%d%d\", &a1, &a2);\n\twhile (a1 != 0 && a2 != 0){\n\t \tif (a1 == 1 && a2 == 1) {\n\t\t\ta1++;\n\t\t\ta2++;\n\t\t}\n\t\telse {\n\t\t\tif (a1 > a2) {\n\t\t\t\ta2++;\n\t\t\t\ta1 -= 2;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ta1++;\n\t\t\t\ta2 -= 2;\n\t\t\t}\n\t\t}\n\t\tukupno++;\t\n\t}\n\tprintf(\"%d\", ukupno);\n\t\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int p,q,sum=0;\n scanf(\"%d %d\",&p,&q);\n while(p!=0&&q!=0)\n {\n if(p>q)\n {\n p=p-2;\n q=++q;\n }\n else\n {\n q=q-2;\n p=++p;\n }\n ++sum;\n }\n printf(\"\\n%d\",sum);\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n\t\n\tint a,b,i;\n\tscanf(\"%d%d\",&a,&b);\n\tint min=(a>=b)?b:a;\n\tb=(b+a)-min;\n\ta=min;\n\tint x=4;\n\tint y=4;\n\tfor(i=0;;)\n\t{\n\t\t\n\t\tif(b==1 || b==2){x=0;y=4;}\n\t\tif(a==1 || a==2){x=4;y=0;}\n\t\tif(x)\n\t\t{\n\t\t\ta+=1;\n\t\t\tb-=2;\n\t\t\ti++;\n\t\t}\n\t\tif(y){\n\t\t\ta-=2;\n\t\t\tb+=1;\n\t\t\ti++;\n\t\t}\n\t\tif(a<=0 || b<=0)break;\n\t}\n\tprintf(\"%d\",i);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint a1,a2,count;\n\nvoid oo(void)\n{\n int d=(a2-1)/2;\n count+=d;\n a1+=d;\n a2=1;\n}\n\nvoid eo(void)\n{\n int d=(a2 % 2)*(a2-1)/2+(a2 % 2 == 0)*(a2-2)/2;\n count+=d;\n a1+=d;\n a2=(a2 % 2)+(a2 % 2 == 0)*2;\n}\n\nvoid ee(void)\n{\n int d=(a2-2)/2;\n count+=d;\n a1+=d;\n a2=2;\n}\n\nint main(void)\n{\n scanf(\"%d %d\",&a1,&a2);\n if( a1 > a2 )\n {\n a1=a1+a2;\n a2=a1-a2;\n a1=a1-a2;\n }\n while(a2 > 2)\n {\n if( a1 % 2 && a2 % 2 )\n oo();\n else if( a1 % 2 || a2 % 2 )\n eo();\n else\n ee();\n if( a1 > a2 )\n {\n a1=a1+a2;\n a2=a1-a2;\n a1=a1-a2;\n }\n }\n printf(\"%d\",count+1);\n return 0;\n}\n"}, {"source_code": "#include\nmain()\n{\n int a,b,k=0;\n scanf(\"%d %d\", &a, &b);\n while(b>0)\n {\n if(a<3)\n {\n a=a+1;\n b=b-2;\n }\n else if(b<3)\n {\n a=a-2;\n b=b+1;\n }\n else\n {\n a=a-2;\n b=b+1;\n }\n k++;\n }\n printf(\"%d\",k);\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,f=0,t=1;\n scanf(\"%d%d\",&a,&b);\n while (a>0&&b>0)\n { if (a==1&&b==1) a=-10;\n if (a<=2) a++,b-=2,t=1;\n else if (b<=2) b++,a-=2,t=0;\n else {\n if (t) a++,b-=2;\n else b++,a-=2;}\n f++;}\n printf(\"%d\\n\",f);\n}\n/*2016-03-14 21:43:47.068*/"}, {"source_code": "#include\nint main ()\n{\n int x,y,z,temp,count=0,i=0;\n scanf(\"%d%d\",&x,&y);\n for(;;){\n if(x==1&&y==1){\n break;\n }\n if(x0){\n i++;\n }\n printf(\"%d\\n\",i);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint k=0,a,b;\n\tscanf(\"%d%d\",&a,&b);\n\twhile(a>0&&b>0){\n\t\tif(a>=b){a-=2;b++;\n\t\t}\n\t\telse{b-=2;a++;\n\t\t}\n\t\tk++;\n\t}\n\tprintf(\"%d\\n\",k);\n\treturn 0;\n}\n"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS\n\n#include \n\nint main() {\n\t\n\tint a1, a2;\n\tint res = 0;\n\tint d;\n\tint *pc, *pf, *t;\n\n\tscanf(\"%d%d\", &a1, &a2);\n\n\tpf = &a1; pc = &a2;\n\twhile (a1 > 2 || a2 > 2) {\n\t\td = (*pf - 1) / 2;\n\t\tres += d;\n\t\t*pf -= 2 * d;\n\t\t*pc += d;\n\t\tt = pc; pc = pf; pf = t;\n\t}\n\t\n\tif (a1 >= 2 && a2 >= 2)\n\t\tres++;\n\tprintf(\"%d\", res);\n\n}"}, {"source_code": "#include\n\nint main(void)\n{\n int count = 0, j1, j2;\n \n scanf(\"%d %d\", &j1, &j2);\n \n while( (j1 > 0) && (j2 >0) ) {\n if( j1 > j2 ) j1-=2, ++j2;\n else ++j1, j2-=2;\n ++count;\n }\n \n printf(\"%d\", count);\n \n return 0;\n}"}, {"source_code": "#include \n#include \nint main()\n{int a1,a2,c=0;\nscanf(\"%d\",&a1);\nscanf(\"%d\",&a2);\nif(a1>a2+1)\n{while(a1>a2&&a1>0&&a2>0){a1=a1-2;a2++; c++;\n }\n c=c+2*a2-3;\n\n}\nelse if(a2>a1+1)\n{while(a2>a1&&a1>0&&a2>0){a2=a2-2;a1++; c++;\n }\n c=c+2*a1-3;\n\n}\nelse if(a1>1&&a2>1)\n {if(a1>=a2){c=2*a1-3;\n }\n else{c=2*a2-3;\n }\n }\n printf(\"%d\",c);\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n\tint a,b,min=0;\n\tchar ch = 'a';\n\tscanf(\"%d%d\",&a,&b);\n\t\n\tif(a>b)\n\t\tch = 'b';\n\telse\n\t\tch = 'a';\n\t\t\n\twhile(a>=1 && b>=1){\n\t\tif(a==1){\n\t\t\ta += 1;\n\t\t\tb -= 2;\n\t\t\tch = 'a';\n\t\t}else if(b==1){\n\t\t\ta -= 2;\n\t\t\tb += 1;\n\t\t\tch = 'b';\n\t\t}else if(ch=='a'){\n\t\t\ta += 1;\n\t\t\tb -= 2;\n\t\t}else if(ch=='b'){\n\t\t\ta -= 2;\n\t\t\tb += 1; \n\t\t}\n\t\tprintf(\"%d %d\\n\",a,b);\n\t\tmin++;\n\t}\n\tprintf(\"%d\",min);\n\treturn 0;\n}\n"}, {"source_code": "main(a,b){scanf(\"%d%d\",&a,&b);printf(\"%d\",a+b>3?a+b-3-(a==b):0);}"}, {"source_code": "#include\n/*int max_time=0,dp[200][200];\nvoid init()\n{\n\tint i,j;\n\tfor(i=0;i<=100;i++)\n\t{\n\t\tfor(j=0;j<=100;j++)\n\t\t{\n\t\t\tdp[i][j]=-1;\n\t\t}\n\t}\n}\nint calc_time(int x,int y,int t)\n{\n\tif(x<=0 || y<=0)\n\t{\n\t\tif(max_timez1) \n\t\n\t{\n\treturn y1;\n}\nelse\n{\n\treturn z1;\n}\n}*/\nint main()\n{\n\tint a1,a2,x;\n\tscanf(\"%d %d\",&a1,&a2);\n\t//init();\n\t//int x=calc_time(a1,a2,0);\n\tif(a1!=a2)\n\t{\n\t\tx=(a1+a2)-2;\n\t}\n\telse\n\t{\n\t\tx=(a1+a2)-3;\n\t}\n\tprintf(\"%d\",x);\n\treturn 0;\n}"}, {"source_code": "#include \n\nint Min(int n, int m)\n{\n if(n<=m)\n return n;\n else\n return m;\n};\n\nint main()\n{\n int n,m, count=0;\n scanf(\"%d %d\", &n, &m);\n while(n>0 && m>0)\n {\n int temp=Min(n,m);\n if(temp==n)\n {\n n+=1;\n m-=2;\n }\n else\n {\n n-=2;\n m++;\n }\n count++;\n }\n printf(\"%d\", count);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint a, b, c;\n\tscanf(\"%d %d\", &a, &b);\n\tif (a == 1 && b == 1)\n\t{\n\t\tprintf (\"0\");\n\t\treturn 0;\n\t}\n\tif (a == 1 || b == 1)\n\t{\n\t\tprintf (\"%d\", a + b - 3);\n\t\treturn 0;\n\t}\n if (a % 3 == 0 && b % 3 == 0)\n {\n \tprintf (\"%d\", a + b - 3);\n \treturn 0;\n\t}\n\tif (a - b == 0) printf(\"%d\", a + b - 3);\n\tif (a - b != 0) printf(\"%d\", a + b - 2);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main(){\n\tint a,b,plug;\n\tlong long int time;\n\tscanf(\"%d%*c%d\",&a,&b);\n\tplug=(a0) && (b>0)){\n\t//\tprintf(\"%d %d \\n\",a,b);\n\t\tif(a<=2){\n\t\t\tplug=1;\n\t\t}\n\t\telse if(b<=2){\n\t\t\tplug=2;\n\t\t}\n\t\tif(plug==1){\n\t\t\ta++;\n\t\t\tb=b-2;\n\t\t}\n\t\telse if(plug==2){\n\t\t\tb++;\n\t\t\ta=a-2;\n\t\t}\n\t\ttime++;\n\t}\n\tprintf(\"%64Id\",(time));\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{int a1,a2,c=0;\nscanf(\"%d\",&a1);\nscanf(\"%d\",&a2);\nif(a1>a2+1)\n{while(a1>a2&&a1>1&&a2>1){a1=a1-2;a2++; c++;\n }\n c=c+2*a2-3;\nprintf(\"%d\",c);\n}\nelse if(a2>a1+1)\n{while(a2>a1&&a1>1&&a2>1){a2=a2-2;a1++; c++;\n }\n c=c+2*a1-3;\nprintf(\"%d\",c);\n}\nelse\n {if(a1>=a2){c=2*a1-3;\n printf(\"%d\",c);}\n else{c=2*a2-3;\n printf(\"%d\",c);}\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint a,b;\n\tscanf(\"%d%d\",&a,&b);\n\tint count=0;\n\twhile(1>0)\n\t{\n\t\tif(a<=b)\n\t\t{\n\t\t\ta+=1;\n\t\t\tb-=2;\n\t\t}\n\t\telse if(a>b)\n\t\t{\n\t\t\ta-=2;\n\t\t\tb+=1;\n\t\t}\n\t\tcount++;\n\t\tif(a==0||b==0)\n\t\t\tbreak;\n\t}\n\tprintf(\"%d\\n\",count);\n\treturn 0;\n}\n\n"}, {"source_code": "/*hks3*/\n#include \n#include \n\nint main()\n{\n int a1,a2,charge,i = 0;\n scanf(\"%d%d\",&a1,&a2);\n charge = 1;\n while(a1 >= 1 && a2 >= 1)\n {\n if (a1 <= 2)\n {\n charge = 1;\n }\n else if (a2 <= 2)\n {\n charge = 0;\n }\n else if (a1 <= a2)\n {\n charge = 1;\n }\n if (charge)\n {\n a1 += 1;\n a2 -= 2;\n }\n else\n {\n a1 -= 2;\n a2 += 1;\n }\n i++;\n };\n printf(\"%d\",i);\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n\tint a,b,i,k=0;\n\tscanf(\"%d%d\",&a,&b);//3 5.4 3.2 4.3 2.1 3.2 1.\n\twhile(a>0&&b>0)\n\t{\n\t\tif(a>b)\n\t\t{\n\t\t\ta-=2;\n\t\t\tb++;\n\t\t\tk++;\n\t\t}else\n\t\t{\n\t\t\tb-=2;\n\t\t\ta++;\n\t\t\tk++;\n\t\t}\n\t}\n\tprintf(\"%d\",k);\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n int a;\n int b;\n scanf(\"%d %d\",&a,&b);\n int c=0;\n int min=0;\n if(a0 && b>0)\n {\n if(c==0)\n {\n min++;\n a+=1;\n b-=2;\n if(b==1 || b==2)\n {\n c=1;\n continue;\n }\n else\n {\n continue;\n }\n }\n else if(c==1)\n {\n min++;\n a-=2;\n b+=1;\n if(a==1 || a==2)\n {\n c=0;\n continue;\n }\n else\n {\n continue;\n }\n }\n }\n printf(\"%d\",min);\n}\n"}, {"source_code": "#include\nint main(){\n int a,b,c,d;\n scanf(\"%d%d\",&a,&b);\n\n int max,min;\n max=a;\n if(b>a)\n {\n max=b; min =a;\n }\n else{\n max=a; min=b;}\n\n int breaker=-1;\n int ind=1;\n int cnt=0;\n while(max!=0 && min !=0 && max!=100 && min!=100){\n if(max<=2 && min<=2)\n {\n breaker=1;\n break;\n }\n if(ind==1){\n while(min>2){\n max++;\n min-=2;\n cnt++;\n }\n ind=2;\n }\n else{\n while(max>2){\n min++;\n max-=2;\n cnt++;\n }\n ind=1;\n\n }\n\n }\n if(breaker==1)\n cnt++;\n printf(\"%d\",cnt);\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,ans;\n scanf(\"%d %d\",&a,&b);\n if(a==b||a%2==0||b%2==0)\n {\n ans=a+b-3;\n if(ans<0)\n ans=0;\n printf(\"%d\",ans);\n }\n else\n {\n ans=a+b-2;\n printf(\"%d\",ans);\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n\tint a,b,plug;\n\tlong long int time;\n\tscanf(\"%d%*c%d\",&a,&b);\n\tplug=(a0) && (b>0)){\n\t//\tprintf(\"%d %d \\n\",a,b);\n\t\tif(plug==1){\n\t\t\ta++;\n\t\t\tb=b-2;\n\t\t}\n\t\telse if(plug==2){\n\t\t\tb++;\n\t\t\ta=a-2;\n\t\t}\n\t\ttime++;\n\t\tif(a<=2){\n\t\t\tplug=1;\n\t\t}\n\t\telse if(b<=2){\n\t\t\tplug=2;\n\t\t}\n\t}\n\tprintf(\"%64Id\",(time));\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint a1,a2;\n\tscanf(\"%d%d\",&a1,&a2);\n\tint flag=1;\n\tint count=0;\n\twhile(flag)\n\t{\n\t\tif(a1>=a2)\n\t\t{\n\t\t\ta1=a1-2;\n\t\t\ta2++;\n\t\t\tcount++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ta2=a2-2;\n\t\t\ta1++;\n\t\t\tcount++;\n\t\t}\n\t\tif((a1==00||a2==0)||(a1==1||a2==1))\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%d\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint k=0,a,b;\n\tscanf(\"%d%d\",&a,&b);\n\twhile(a>0&&b>0){\n\t\tif(a>=b){a-=2;b++;\n\t\t}\n\t\telse{b-=2;a++;\n\t\t}\n\t\tk++;\n\t}\n\tprintf(\"%d\\n\",k);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint x,y;\n\tscanf(\"%d%d\",&x,&y);\n\tint c=0;\n\twhile(x>0 && y>0 && x<=100 && y<=100)\n\t{\n\t\tif(x\nint main()\n{\n\tint a,b,flag=0,count=0;\n\tscanf(\"%d %d\",&a,&b);\n\tif(a>b)\n\t{\n\t\tflag=1;\n\t}\n\twhile(a>0&&b>0)\n\t{\n\t\t\n\t\tif(flag==1)\n\t\t{\n\t\t\ta=a-2;\n\t\t\tb=b+1;\n\t\t\tif(a<=3)\n\t\t\t{\n\t\t\t\tflag=0;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tb=b-2;\n\t\t\ta=a+1;\n\t\t\tif(b<=3)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t}\n\t\t}\n\t\tcount++;\n\t}\n\tprintf(\"%d\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint game(int a1,int a2,int t){\n\tif(a1==0||a2==0||(a1==1&&a2==1)){\n\t\treturn t;\n\t}else{\n\t\n\t\tif(a1==1||a1==2){ \n\t\t game(a1+1,a2-2,t+1);//charge a1\n\t\t}else{\n\t\t game(a1-2,a2+1,t+1);//charge a2\n\t}\n}\n}\n\nint main(){\n\tint a1,a2;\n\t\n\tscanf(\"%d%d\",&a1,&a2);\n\tprintf(\"%d\",game(a1,a2,0));\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main() {\n\t// your code goes here\n\tint a[2],time=1,min=0;\n\tscanf(\"%d\",&a[0]);\n\tscanf(\"%d\",&a[1]);\n\n\tif(a[0]<=a[1])\n\t\tmin=0;\n\telse min=1;\n\n\n\twhile(a[(min+1)%2]>2){\n\t\ta[min]=a[min]+1;\n\t\ta[(min+1)%2]=a[(min+1)%2]-2;\n\t\ttime=time+1;\n\t\tif(a[(min+1)%2] <= 2)\t\t\n\t\t\tmin=(min+1)%2;\n\n\t}\n\tprintf(\"%d\",time);\n\treturn 0;\n}"}, {"source_code": "#include\n#include\n#include\n\nint num=0;\n\nvoid dian(int a,int b)\n{\n\tnum++;\n\tif(a==1&&b==1||a*b==2||a==2&&b==2)\n\t{\n\t\treturn;\n\t}\n\tdian(a>b?(a-2):(a+1),a>b?(b+1):(b-2));\t\n\n}\n\n\nint main()\n{\n\tint a,b;\n\tscanf(\"%d %d\",&a,&b);\n\tdian(a,b);\n\tprintf(\"%d\",num);\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\n\nint main(int argc, char const *argv[])\n{\n\tint a1, a2, t = 0;\n\tscanf(\"%d %d\",&a1,&a2);\n\t\n\twhile(a1 > 0 && a2 > 0)\n\t{\n\t\tif(a1 < a2)\n\t\t{\n\t\t\ta1 = a1 + 1;\n\t\t\ta2 = a2 - 2;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ta1 = a1 - 2;\n\t\t\ta2 = a2 + 1;\n\t\t}\n\t\t++t;\n\t}\n\tprintf(\"%d\\n\", t);\n\treturn 0;\n}"}, {"source_code": "#include \n#include \nint main()\n{int a1,a2,c=0;\nscanf(\"%d\",&a1);\nscanf(\"%d\",&a2);\nif(a1>a2+1)\n{while(a1>a2+1&&a1>0&&a2>0){a1=a1-2;a2++; c++;\n }\n if(a1>a2){c=c+2*a1-3;}\n else{c=c+2*a2-3;}\n}\nelse if(a2>a1+1)\n{while(a2>a1+1&&a1>0&&a2>0){a2=a2-2;a1++; c++;\n }\n if(a1>a2){c=c+2*a1-3;}\n else{c=c+2*a2-3;}\n}\nelse \n {if(a1>1&&a2>1)\n {if(a1>a2){c=2*a1-3;}\n else{c=2*a2-3;\n }\n }\n }\n printf(\"%d\",c);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n int count=0;\n for(;;)\n {\n // printf(\"%d %d\\n\",a,b);\n if(a<=b){a=a+1;b=b-2;if(b<1){break;} count=count+1;continue;}\n if(b<=a){b=b+1;a=a-2;if(a<1){break;} count=count+1;continue;}\n\n }\n printf(\"%d\",count+1);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tint a1,a2,c1=0,c2=0;\n\tint count=0;\n\t\n\tscanf(\"%d%d\",&a1,&a2);\n\t\n\twhile(1)\n\t{\n\t\ta1+=c1;\n\t\ta2+=c2;\n\t\t\n\t\tif(a1<=1 || a2<=1) break;\n\t\t\n\t\tif(a1\n#include \n\nint main()\n{ int a1,a2,nb=0;\n\n do{\n\n scanf(\"%d\",&a1);\n }while((a1<1)&&(a1>100));\n\n do{\n\n scanf(\"%d\",&a2);\n }while((a2<1)&&(a2>100));\n\ndo{\n if(a1>=a2)\n {\n a1=a1-2;\n a2++;\n }else if(a1\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n if ((a==1) || (b==1) || (a==0) || (b==0) )\n {\n printf(\"0\");\n }\n int time=0;\n if (a\n\nint main()\n{\n\tint a, b, r = 1;\n\tscanf(\"%d%d\", &a, &b);\n\t\n\tr += (b-1)/2;\n\ta += (b-1)/2;\n\tb -= 2*((b-1)/2);\n\t\n\twhile (a > 2 || b > 2)\n\t{\n\t\tr += (a-1)/2;\n\t\tb += (a-1)/2;\n\t\ta -= 2*((a-1)/2);\n\t\t\n\t\tr += (b-1)/2;\n\t\ta += (b-1)/2;\n\t\tb -= 2*((b-1)/2);\n\t}\n\t\n\tprintf(\"%d\", r);\n}\n"}, {"source_code": "#include\nint main(){\n int a,b,c,d;\n scanf(\"%d%d\",&a,&b);\n if(a==100 && b==100){\n --b;}\n int max,min;\n max=a;\n if(b>a)\n {\n max=b; min =a;\n }\n else{\n max=a; min=b;}\n\n int breaker=-1;\n int ind=1;\n int cnt=0;\n while(max!=0 && min !=0){\n if(max<=2 && min<=2)\n {\n breaker=1;\n break;\n }\n if(ind==1){\n while(min>2 && max!=100){\n max++;\n min-=2;\n cnt++;\n }\n ind=2;\n }\n else{\n while(max>2 && min!=100){\n min++;\n max-=2;\n cnt++;\n }\n ind=1;\n\n }\n\n }\n if(breaker==1)\n cnt++;\n printf(\"%d\",cnt);\n\n}\n"}, {"source_code": "#include\nint main(){\n int a,b,c=0;\n scanf(\"%d %d\", &a,&b);\n while(a>0 && b > 0){\n if(a>b){\n a-=2;\n b++;\n c++;\n }\n else {\n b-=2;\n a++;\n c++;\n }\n }\n if(a<0 && b<0){\n c--;\n }\n else if (a==0 || b==0){\n printf(\"%d\\n\", c);\n }\n\nreturn 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n\t// your code goes here\n\tint a[2],time=1,min=0;\n\tscanf(\"%d\",&a[0]);\n\tscanf(\"%d\",&a[1]);\n\n\tif(a[0]<=a[1])\n\t\tmin=0;\n\telse min=1;\n\n\n\twhile(a[(min+1)%2]>2){\n\t\ta[min]=a[min]+1;\n\t\ta[(min+1)%2]=a[(min+1)%2]-2;\n\t\ttime=time+1;\n\t\tif(a[(min+1)%2] <= 2)\t\t\n\t\t\tmin=(min+1)%2;\n\n\t}\n\tprintf(\"%d\",time);\n\treturn 0;\n}"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS\n\n#include \n\nint main() {\n\t\n\tint a1, a2;\n\tint res = 0;\n\tint d;\n\tint *pc, *pf, *t;\n\n\tscanf(\"%d%d\", &a1, &a2);\n\n\tpf = &a1; pc = &a2;\n\twhile (a1 > 2 || a2 > 2) {\n\t\td = (*pf - 1) / 2;\n\t\tres += d;\n\t\t*pf -= 2 * d;\n\t\t*pc += d;\n\t\tt = pc; pc = pf; pf = t;\n\t}\n\n\tprintf(\"%d\", res + 1);\n\n}"}, {"source_code": "#include \n#include \n#include \n#include \n\n\nint main(void) {\n\tint a1, a2;\n\tscanf(\"%d %d\", &a1, &a2);\n\tint ukupno = 0;\n\twhile (1){\n\t\tif (a1 == 0 || a2 == 0) break;\n\t\telse if (a1 == 1) {\n\t\t\ta1 ++;\n\t\t\ta2 -= 2;\n\t\t}\n\t\telse if (a1 == 1 && a2 == 1) {\n\t\t\ta1 = a2 = 2;\n\t\t}\n\t\telse if (a2 == 1){\n\t\t\ta2++;\n\t\t\ta1 -= 2;\n\t\t}\n\t\telse {\n\t\t\tif (a1 > a2) {\n\t\t\t\ta2++;\n\t\t\t\ta1 -= 2;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ta1++;\n\t\t\t\ta2 -= 2;\n\t\t\t}\n\t\t}\n\t\tukupno++;\t\t\n\t\t\n\t}\n\tprintf(\"%d\", ukupno);\n\t\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint k=0,a,b;\n\tscanf(\"%d%d\",&a,&b);\n\tif(a==1||b==1){printf(\"0\\n\");return 0;\n\t}\n\twhile(a>0&&b>0){\n\t\tif(a>=b){a-=2;b++;\n\t\t}\n\t\telse{b-=2;a++;\n\t\t}\n\t\tk++;\n\t}\n\tprintf(\"%d\\n\",k);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main(){\n int a,b,steps=0;\n scanf(\"%d%d\",&a,&b);\n while(a>2 || b>2){\n while(a<=b){\n a++;b-=2;\n steps++;\n //printf(\"a:%d,b:%d\\n\",a,b);\n }\n while(b\nint main()\n{\n\tint k=0,a,b;\n\tscanf(\"%d%d\",&a,&b);\n\tif(a==1||b==1){printf(\"0\\n\");return 0;\n\t}\n\twhile(a>0&&b>0){\n\t\tif(a>=b){a-=2;b++;\n\t\t}\n\t\telse{b-=2;a++;\n\t\t}\n\t\tk++;\n\t}\n\tprintf(\"%d\\n\",k);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int i,a1,a2,temp,count=0;\n while (2==scanf(\"%d %d\",&a1,&a2)){\n for (a1,a2;a2>=1;a1++,a2-=2){\n if(a1>a2){\n temp=a1;\n a1=a2;\n a2=temp;\n }\n count++;\n if(a1==0||a2==0){\n break ;\n }if (a1==1&&a2==1){\n break;\n }\n }\n printf(\"%d\",count);\n return 0;\n}\n}"}, {"source_code": "#include \n#include \nint main()\n{int a1,a2,c=0;\nscanf(\"%d\",&a1);\nscanf(\"%d\",&a2);\nif(a1>a2+1)\n{while(a1>a2+1&&a1>0&&a2>0){a1=a1-2;a2++; c++;\n }\n if(a1>a2){c=c+2*a1-3;}\n else{c=c+2*a2-3;}\n}\nelse if(a2>a1+1)\n{while(a2>a1+1&&a1>0&&a2>0){a2=a2-2;a1++; c++;\n }\n if(a1>a2){c=c+2*a1-3;}\n else{c=c+2*a2-3;}\n}\nelse \n {if(a1>1&&a2>1)\n {if(a1>a2){c=2*a1-3;}\n else{c=2*a2-3;\n }\n }\n }\n printf(\"%d\",c);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n\nint main(void) {\n\tint a1, a2;\n\tscanf(\"%d %d\", &a1, &a2);\n\tint ukupno = 0;\n\twhile (1){\n\t\tif (a1 == 0 || a2 == 0) break;\n\t\telse if (a1 == 1 && a2 == 1) {\n\t\t\ta1++;\n\t\t\ta2++;\n\t\t}\n\t\telse if (a1 == 1) {\n\t\t\ta1 ++;\n\t\t\ta2 -= 2;\n\t\t}\n\t\telse if (a2 == 1){\n\t\t\ta2++;\n\t\t\ta1 -= 2;\n\t\t}\n\t\telse {\n\t\t\tif (a1 > a2) {\n\t\t\t\ta2++;\n\t\t\t\ta1 -= 2;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ta1++;\n\t\t\t\ta2 -= 2;\n\t\t\t}\n\t\t}\n\t\tukupno++;\t\t\n\t\t\n\t}\n\tprintf(\"%d\", ukupno);\n\t\n\treturn 0;\n}"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS\n\n#include \n\nint main() {\n\t\n\tint a1, a2;\n\tint res = 0;\n\tint d;\n\tint *pc, *pf, *t;\n\n\tscanf(\"%d%d\", &a1, &a2);\n\n\tpf = &a1; pc = &a2;\n\twhile (a1 > 2 || a2 > 2) {\n\t\td = (*pf - 1) / 2;\n\t\tres += d;\n\t\t*pf -= 2 * d;\n\t\t*pc += d;\n\t\tt = pc; pc = pf; pf = t;\n\t}\n\t\n\tif (a1 >= 2 && a2 >= 2)\n\t\tres++;\n\tprintf(\"%d\", res);\n\n}"}, {"source_code": "#include \nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n if ((a==1) || (b==1) || (a==0) || (b==0) )\n {\n printf(\"0\");\n }\n int time=0;\n if (a\n\n\nint main()\n{\n\tint a,b,n=0;\n\tscanf(\"%d\",&a);\n\tscanf(\"%d\",&b);\n\twhile(a>0 && b>0)\n\t{\n\t\tn++;\n\t\tif(a>b)\n\t\t{\n\t\t\ta=a-2;\n\t\t\tb++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ta++;\n\t\t\tb=b-2;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",n);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,f=0,t=1;\n scanf(\"%d%d\",&a,&b);\n while (a>0&&b>0)\n { if (a==1&&b==1) a=-10;\n if (a<=2) a++,b-=2,t=1;\n else if (b<=2) b++,a-=2,t=0;\n else {\n if (t) a++,b-=2;\n else b++,a-=2;}\n f++;}\n printf(\"%d\\n\",f);\n}\n/*2016-03-14 21:43:47.068*/"}, {"source_code": "#include \n#include \n#include \n#include \n#include \n\n// int cmpfunc (const void * a, const void * b)\n// {\n// return ( *(int*)a - *(int*)b );\n// }\n\n\nint main()\n{\n int counter=0,chargeA,chargeB,i;\n scanf(\"%i%i\",&chargeA,&chargeB);\n\n while(chargeA>0 && chargeB>0)\n {\n if(chargeA<=chargeB)\n {\n chargeA += 1;\n chargeB -= 2;\n ++counter;\n }\n\n else\n {\n chargeB += 1;\n chargeA -= 2;\n ++counter;\n }\n }\n\n printf(\"%i\\n\",counter);\n\n \n return 0;\n}\n\n"}, {"source_code": "#include\n/*int max_time=0,dp[200][200];\nvoid init()\n{\n\tint i,j;\n\tfor(i=0;i<=100;i++)\n\t{\n\t\tfor(j=0;j<=100;j++)\n\t\t{\n\t\t\tdp[i][j]=-1;\n\t\t}\n\t}\n}\nint calc_time(int x,int y,int t)\n{\n\tif(x<=0 || y<=0)\n\t{\n\t\tif(max_timez1) \n\t\n\t{\n\treturn y1;\n}\nelse\n{\n\treturn z1;\n}\n}*/\nint main()\n{\n\tint a1,a2,x;\n\tscanf(\"%d %d\",&a1,&a2);\n\t//init();\n\t//int x=calc_time(a1,a2,0);\n\tif(a1!=a2)\n\t{\n\t\tx=(a1+a2)-2;\n\t}\n\telse\n\t{\n\t\tx=(a1+a2)-3;\n\t}\n\tprintf(\"%d\",x);\n\treturn 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n\n int c, nc, t = 0, ch;\n scanf(\"%d %d\", &c, &nc);\n while(c > 0 || nc > 0)\n {\n\n if(nc < c)\n {\n\n ch = nc;\n nc = c;\n c = ch;\n }\n nc = nc - 2;\n c = c + 1;\n t = t + 1;\n }\n printf(\"%d\\n\", t - 3);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n\nint main(void) {\n\tint a1, a2;\n\tscanf(\"%d %d\", &a1, &a2);\n\tint ukupno = 0;\n\twhile (1){\n\t\tif (a1 == 0 || a2 == 0) break;\n\t\telse if (a1 == 1 && a2 == 1) {\n\t\t\ta1++;\n\t\t\ta2++;\n\t\t}\n\t\telse if (a1 == 1) {\n\t\t\ta1 ++;\n\t\t\ta2 -= 2;\n\t\t}\n\t\telse if (a2 == 1){\n\t\t\ta2++;\n\t\t\ta1 -= 2;\n\t\t}\n\t\telse {\n\t\t\tif (a1 > a2) {\n\t\t\t\ta2++;\n\t\t\t\ta1 -= 2;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ta1++;\n\t\t\t\ta2 -= 2;\n\t\t\t}\n\t\t}\n\t\tukupno++;\t\t\n\t\t\n\t}\n\tprintf(\"%d\", ukupno);\n\t\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint a, b, c;\n\tscanf(\"%d %d\", &a, &b);\n\tif (a == 1 && b == 1)\n\t{\n\t\tprintf (\"0\");\n\t\treturn 0;\n\t}\n\tif (a == 1 || b == 1)\n\t{\n\t\tprintf (\"%d\", a + b - 3);\n\t\treturn 0;\n\t}\n\tif (a - b == 0) printf(\"%d\", a + b - 3);\n\tif (a - b != 0) printf(\"%d\", a + b - 2);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint xx(int a,int b)\n{\nif(a<0||b<=0)\nreturn 0;\nelse\n{\nif(a>=b)\n{\nb+=1;\na-=2;\n}\nelse\n{\na+=1;\nb-=2;\n}\nreturn 1+xx(a,b);\n}\n\n}\n\nint main()\n{\nint a,b;\nscanf(\"%d %d\",&a,&b);\nprintf(\"%d\",xx(a,b));\nreturn 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n\n\nint main(void) {\n\tint a1, a2;\n\tscanf(\"%d %d\", &a1, &a2);\n\tint ukupno = 0;\n\twhile (1){\n\t\tif (a1 == 0 || a2 == 0) break;\n\t\telse if (a1 == 1 && a2 == 1) {\n\t\t\ta1++;\n\t\t\ta2++;\n\t\t}\n\t\telse if (a1 == 1) {\n\t\t\ta1 ++;\n\t\t\ta2 -= 2;\n\t\t}\n\t\telse if (a2 == 1){\n\t\t\ta2++;\n\t\t\ta1 -= 2;\n\t\t}\n\t\telse {\n\t\t\tif (a1 > a2) {\n\t\t\t\ta2++;\n\t\t\t\ta1 -= 2;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ta1++;\n\t\t\t\ta2 -= 2;\n\t\t\t}\n\t\t}\n\t\tukupno++;\t\t\n\t\t\n\t}\n\tprintf(\"%d\", ukupno);\n\t\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n#include \n#include \n\nint main(void) {\n\tint a1, a2;\n\tscanf(\"%d %d\", &a1, &a2);\n\tint ukupno = 0;\n\twhile (1){\n\t\tif (a1 == 0 || a2 == 0) break;\n\t\telse if (a1 == 1 && a2 == 1) {\n\t\t\ta1++;\n\t\t\ta2++;\n\t\t}\n\t\telse if (a1 == 1) {\n\t\t\ta1 ++;\n\t\t\ta2 -= 2;\n\t\t}\n\t\telse if (a2 == 1){\n\t\t\ta2++;\n\t\t\ta1 -= 2;\n\t\t}\n\t\telse {\n\t\t\tif (a1 > a2) {\n\t\t\t\ta2++;\n\t\t\t\ta1 -= 2;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ta1++;\n\t\t\t\ta2 -= 2;\n\t\t\t}\n\t\t}\n\t\tukupno++;\t\t\n\t\t\n\t}\n\tprintf(\"%d\", ukupno);\n\t\n\treturn 0;\n}"}, {"source_code": "#include \n#include \nint main()\n{int a1,a2,c=0;\nscanf(\"%d\",&a1);\nscanf(\"%d\",&a2);\nif(a1>a2+1)\n{while(a1>a2+1&&a1>0&&a2>0){a1=a1-2;a2++; c++;\n }\n if(a1>a2){c=c+2*a1-3;}\n else{c=c+2*a2-3;}\n}\nelse if(a2>a1+1)\n{while(a2>a1+1&&a1>0&&a2>0){a2=a2-2;a1++; c++;\n }\n if(a1>a2){c=c+2*a1-3;}\n else{c=c+2*a2-3;}\n}\nelse if(a1>1&&a2>1)\n {if(a1>a2){c=2*a1-3;\n }\n else{c=2*a2-3;\n }\n }\n printf(\"%d\",c);\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\nint a,b,i=0;\nscanf(\"%d %d\",&a,&b);\nwhile(a>2||b>2){\n if(a<=b){\n a=a+1;\n b=b-2;\n }\n else if(b\n#include \nint max(int a,int b)\n{\n\tif (a>b)return a;\n\treturn b;\n}\nint min(int a,int b)\n{\n\tif (a>b)return b;\n\treturn a;\n}\nint main ()\n{\n\tint a,b,c,d,x;\n\tscanf (\"%d%d\",&a,&b);\n\tc=max(a,b);\n\td=min(a,b);\n\tx=(c-d)/3;\n\tc=c-2*x;\n\td=d+x;\n\tif (c==d)\n\t\tx+=2*c-3;\n\telse if (fabs(a-b)==2)\n\t\tx+=2*min(c,d);\n\telse if (fabs(a-b)==1)\n\t\tx+=2*min (a,b)-1;\n\tprintf (\"%d\\n\",x);\n} "}, {"source_code": "#include\nint main()\n{\n int a[10],i,m=0,min;\n scanf(\"%d %d\",&a[0],&a[1]);\n min=fmin(a[0],a[1]);\n a[1]=fmax(a[0],a[1]);\n a[0]=min;\n while(a[1]>2)\n {\n a[0]++;\n a[1]-=2;\n min=fmin(a[0],a[1]);\n a[1]=fmax(a[0],a[1]);\n a[0]=min;\n m++;\n }\n if(a[0]!=1&&a[1]!=1)printf(\"%d\",m+1);\n else printf(\"%d\",m);\n}\n"}, {"source_code": "/*pqdf*/\n#include \n \nint main() {\n int a,b;\n scanf(\"%d %d\",&a,&b);\n int i,flag=0;\n for (i = 0;a>0&&b>0; ++i) {\n if (a<=2) {\n a++;\n b=b-2;\n flag=1;\n }\n if (b<=2&&flag==0) {\n b++;\n a=a-2;\n flag=1;\n }\n if (a >= b&&flag==0) {\n a++;\n b=b-2;\n flag=1;\n } else if (a\nint main()\n{\n int x,y,c=0;\n scanf(\"%d%d\",&x,&y);\n while(x!=0 && y!=0)\n {\n if(x>y)\n {\n y++;\n x=x-2;\n }\n else if (y>x)\n {\n x++;\n y=y-2;\n }\n else if (x==y)\n {\n x=x-2;\n }\n c++;\n }\n printf(\"%d\",c);\n return 0;\n}"}, {"source_code": "/**\n* I'm sorry I was an Idiot \n*/\n#include\n\nint main(){\n\tint a,b;\n\tscanf( \"%d %d\",&a,&b);\n\tif(b < a){\n\t\tint temp = a;\n\t\ta = b;\n\t\tb = temp;\n\t}\n\tint totalMin = 0;\n\t//int m = 0;\n\twhile(1){\n\t\tif(a <= 2 && b <= 2){\n\t\t\t++totalMin;\n\t\t\tbreak;\n\t\t}\n\t\tint max = b >> 1;\n\t\tif(b % 2 == 0)\n\t\t\t--max;\n\t\t//printf(\"max es %d\\n\",max);\n\t\ttotalMin += max;\n\t\ta += max;\n\t\tb -= (max) << 1;\n\t\t//printf(\"%d %d\\n\",a,b);\n\t\tint temp = a;\n\t\ta = b;\n\t\tb = temp;\n\t\t//++m;\n\t}\n\tprintf(\"%d\\n\",totalMin);\n\treturn 0;\n}"}, {"source_code": "main(a,b){scanf(\"%d%d\",&a,&b);printf(\"%d\",a+b>3?a+b-3-(a==b):0);}"}, {"source_code": "#include \n#include \n#include \nint main()\n{\n int a,b,i;\n scanf(\"%d%d\",&a,&b);\n for(i=1;a>0 && b>0;i++)\n {\n if(a>b)\n {\n a=a-2;\n b=b+1;\n }\n else\n {\n a=a++;\n b=b-2;\n }\n }\n printf(\"%d\",i-1);\n return 0;\n}"}, {"source_code": "#include\nint main(void){\n\tint lista[220][2],listb[220][2];\n\tscanf(\"%d %d\",&lista[0][0],&listb[0][0]);\n\tint time=0;\n\tint num[2]={1,0};\n\tint flag=0;\n\tfor (;num[flag];time++){\n\t\tint oppo=1-flag;\n\t\tnum[oppo]=0;\n\t\tfor (int i=0;i0){\n\t\t\t\tint appear=0;\n\t\t\t\tfor (int j=0;j0){\n\t\t\t\tint appear=0;\n\t\t\t\tfor (int j=0;j\nint main()\n{\n\tint a, b, c;\n\tscanf(\"%d %d\", &a, &b);\n\tif (a == 1 && b == 1)\n\t{\n\t\tprintf (\"0\");\n\t\treturn 0;\n\t}\n\tif (a == 1 || b == 1)\n\t{\n\t\tif (a % 3 == 0 || b % 3 == 0) printf (\"%d\", a + b - 2);\n\t\telse printf (\"%d\", a + b - 3);\n\t\treturn 0;\n\t}\n if ((a - b)% 3 == 0)\n {\n \tprintf (\"%d\", a + b - 3);\n \treturn 0;\n\t}\n\tif (a - b != 0) printf(\"%d\", a + b - 2);\n\treturn 0;\n}\n"}, {"source_code": "/**\n* I'm sorry I was an Idiot \n*/\n#include\n\nint main(){\n\tint a,b;\n\tscanf( \"%d %d\",&a,&b);\n\tif(b < a){\n\t\tint temp = a;\n\t\ta = b;\n\t\tb = temp;\n\t}\n\tint totalMin = 0;\n\t//int m = 0;\n\twhile(1){\n\t\tif(a <= 2 && b <= 2){\n\t\t\t++totalMin;\n\t\t\tbreak;\n\t\t}\n\t\tint max = b >> 1;\n\t\tif(b % 2 == 0)\n\t\t\t--max;\n\t\t//printf(\"max es %d\\n\",max);\n\t\ttotalMin += max;\n\t\ta += max;\n\t\tb -= (max) << 1;\n\t\t//printf(\"%d %d\\n\",a,b);\n\t\tint temp = a;\n\t\ta = b;\n\t\tb = temp;\n\t\t//++m;\n\t}\n\tprintf(\"%d\\n\",totalMin);\n\treturn 0;\n}"}, {"source_code": "/*hks3*/\n#include \n#include \n\nint main()\n{\n int a1,a2,charge,i = 0;\n scanf(\"%d%d\",&a1,&a2);\n charge = 1;\n while(a1 >= 1 && a2 >= 1)\n {\n if (a1 <= 2)\n {\n charge = 1;\n }\n else if (a2 <= 2)\n {\n charge = 0;\n }\n else if (a1 <= a2)\n {\n charge = 1;\n }\n if (charge)\n {\n a1 += 1;\n a2 -= 2;\n }\n else\n {\n a1 -= 2;\n a2 += 1;\n }\n i++;\n };\n printf(\"%d\",i);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint x,y;\n\tscanf(\"%d%d\",&x,&y);\n\tint c=0;\n\twhile(x>0 && y>0 && x<=100 && y<=100)\n\t{\n\t\tif(x\nint main()\n{\n int a , b , min , max ;\n\n scanf(\"%d%d\",&a,&b);\n\n min = a > b ? b : a ;\n\n max = a+b-min ;\n b = 0 ;\n while(min > 0 && max > 0)\n {\n max -= 2;\n min++ ;\n if(max <= 0)break;\n b++;\n if(min > max){\n a = min ;\n min = max ;\n max = a ;\n }\n }\n printf(\"%d\",b);\n return 0 ;\n\n}\n"}, {"source_code": "#include \nint n,m,ans;\nint main()\n{\n\tscanf(\"%d%d\",&n,&m);\n\tfor(ans=1;;ans++)\n\t{\n\t\tif(n<=2) { n++; m-=2;}\n\t\telse if(m<=2) { m++; n-=2;}\n\t\telse if(n>m) { n++; m-=2;}\n\t\telse { m++; n-=2;}\n\t\tif(n<=0||m<=0) break;\n\t}\n\tprintf(\"%d\",ans);\n\treturn 0;\n}"}, {"source_code": "#include \nint main(){\n\n int a,b;\n long long min = 0;\n\n scanf(\"%d %d\",&a,&b);\n if(a == 1 && b == 1)\n printf(\"0\");\n else\n while(a > 0 && b > 0){\n if(a == 1 || a == 2){\n a = a + 1;\n b = b - 2;\n }\n else{\n b = b + 1;\n a = a - 2;\n }\n\n min = (long long)(min + 1);\n\n printf(\"%I64d\",min);\n }\n}\n"}, {"source_code": "#include\nint main()\n{\n int a1,a2,c=0;\n scanf(\"%d %d\",&a1,&a2);\n if(a1==1 || a2==1)\n c=0;\n else\n {\n while(a1>0 && a2>0)\n {\n if(a1<=a2)\n {\n a1=a1+1;\n a2=a2-2;\n }\n else if(a1>a2)\n {\n a1=a1-2;\n a2=a2+1;\n }\n c++;\n }\n }\n printf(\"\\n%d\",c);\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint memo[101][101];\nvoid init(){\n\tint i=0,j=0;\n\tfor(i=0;i<101;i++){\n\t\tfor(j=0;j<101;j++){\n\t\t\tmemo[i][j] = -1;\n\t\t}\n\t}\n}\nint max(int a,int b){ return (a>b)?a:b; }\nint count(int a,int b){\n\tif(a<=0||b<=0) return 0;\n\tif(memo[a][b] != -1) return memo[a][b];\n\tmemo[a][b] = 1+max(count(a+1,b-2),count(a-2,b+1));\n\treturn memo[a][b];\n}\nint main(){\n\tint a,b;\n\tinit();\n\tscanf(\"%d%d\",&a,&b);\n\tint rez = count(a,b);\n\tprintf(\"%d\\n\",rez);\n\treturn 0;\n}"}, {"source_code": "#include \nint abs(int a) {\n return a>0?a:-a;\n}\nint min(int a, int b) {\n return a\n\nint main(){\n\t\n\tint p1, p2, total;\n\t\n\tscanf(\"%d %d\",&p1,&p2);\n\ttotal = 1;\n\twhile(p1-2 >= 1 || p2-2 >= 1){\n\t\tif(p1 <= p2){\n\t\t\tp1++;\n\t\t\tp2 -= 2;\n\t\t\ttotal++;\n\t\t}\n\t\telse if(p1 > p2){\n\t\t\tp2++;\n\t\t\tp1 -= 2;\n\t\t\ttotal++;\n\t\t}\n\t}\n\tprintf(\"%d\", total);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint a,b;\n\tscanf(\"%d %d\",&a,&b);\n\tint count=1;\n\twhile(a!=0 && b!=0)\n\t{\n\t\tif(a>b)\n\t\t{\n\t\t\tb+=1;a-=2;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ta+=1;b-=2;}\n\t\tcount++;\n\t}\n\tprintf(\"%d\\n\",count-1);\n}\n"}, {"source_code": "#include \n#include \nint main(){\n\tint n,m;\n\tscanf(\"%d%d\",&n,&m);\n int num=0,f=0;\n\tif(m==2){\n\t\tnum++;\n\tf++;\n\t}\n\telse if(n==2){\n num++;\n\tf++;\n\t}\n else if(n==2&&m==2){\n \tnum+=2;\n\tf++;\n\t}\n\telse{\n\twhile(m>2||n>2){\n\t\twhile(n>2){\n\t\t\tn-=2;\n\t\t\tm+=1;\n\t\t\tnum++;\n\t\t}\n\t\twhile(m>2){\n\t\t\tm-=2;\n\t\t\tn+=1;\n\t\t\tnum++;\n\t\t}\n\t}\n}\n\tif(num==0){\n\t\tprintf(\"%d\",num);\n\t}\n\telse{\n if(f==0)\t\t\n\tprintf(\"%d\",num+1);\nelse\nprintf(\"%d\",num);\n}\n}"}, {"source_code": "#include \n\nint main(void) {\n\tint r[2],conn=0,min=-1;\n\tscanf(\"%d%d\",&r[0],&r[1]);\n\twhile(1){\n\t\tif(r[0]>r[1]) conn=1;\n\t\telse conn=0;\n\t\tr[conn]++;\n\t\tr[!conn]-=2;\n\t\tif(r[0] < 0 || r[1] < 0) break;\n\t\tmin++;\n\t}\n\tprintf(\"%d\",min);\n\t\n\treturn 0;\n}"}, {"source_code": "# include \n# include \nint main()\n{\n int a1,a2;\n scanf(\"%d\",&a1);\n scanf(\"%d\",&a2);\n int count=0;\n while(1)\n {\n if(a1<=0 || a2<=0)\n break;\n else\n {\n if(a1 <=2)\n {\n a1++;\n a2=a2 - 2;\n }\n else if(a2 <=2)\n {\n a2++;\n a1=a1 - 2;\n }\n else if(a1 < a2)\n {\n a1++;\n a2=a2 - 2;\n }\n else\n {\n a2++;\n a1=a1 - 2;\n }\n count++;\n }\n }\n printf(\"%d\\n\",count);\n}\n"}, {"source_code": "#include\nint main(){\n\tint a,b,s = 0;\n\tscanf(\"%d%d\",&a,&b);\n\tif(a <= 2 && b <= 2){\n\t\tprintf(\"0\\n\");\n\t}\n\telse{\n\twhile(1){\n\t\tif(a >= 3 && b <= 2){\n\t\t\ta = a - 2;\n\t\t\tb++; \n\t\t}\n\t\telse if(b >= 3 && a <= 2){\n\t\t\tb = b - 2;\n\t\t\ta++; \n\t\t}\n\t\telse {\n\t\t\ta++;\n\t\t\tb = b - 2;\n\t\t}\n\t\ts++;\n\t\tif(a <= 2 && b <= 2){\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",s+1);}\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int a , b , min , max ;\n\n scanf(\"%d%d\",&a,&b);\n if(a-2 <=0 && b-2 <=0){\n printf(\"0\");\n return 0 ;\n }\n min = a > b ? b : a ;\n\n max = a+b-min ;\n b = 0 ;\n while(min > 0 && max > 0)\n {\n max -= 2;\n min++ ;\n b++;\n if(min > max){\n a = min ;\n min = max ;\n max = a ;\n }\n\n }\n printf(\"%d\",b);\n return 0 ;\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int a , b , min , max ;\n\n scanf(\"%d%d\",&a,&b);\n if(a-2 <=0 && b-2 <=0){\n printf(\"0\");\n return 0 ;\n }\n min = a > b ? b : a ;\n\n max = a+b-min ;\n b = 0 ;\n while(min > 0 && max > 0)\n {\n max -= 2;\n min++ ;\n b++;\n if(min > max){\n a = min ;\n min = max ;\n max = a ;\n }\n\n }\n printf(\"%d\",b);\n return 0 ;\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int x,y,i,k,j,z;\n scanf(\"%d %d\",&x,&y);\n for(i=1;;i++)\n {\n if(x>=y)\n {\n x=x-2;\n y=y+1;\n }\n else\n {\n y=y-2;\n x=x+1;\n }\n if(x<=0||y<=0)\n {\n break;\n }\n }\n printf(\"%d\\n\",i);\n return 0;\n}\n"}], "src_uid": "ba0f9f5f0ad4786b9274c829be587961"} {"nl": {"description": "You have an initially empty cauldron, and you want to brew a potion in it. The potion consists of two ingredients: magic essence and water. The potion you want to brew should contain exactly $$$k\\ \\%$$$ magic essence and $$$(100 - k)\\ \\%$$$ water.In one step, you can pour either one liter of magic essence or one liter of water into the cauldron. What is the minimum number of steps to brew a potion? You don't care about the total volume of the potion, only about the ratio between magic essence and water in it.A small reminder: if you pour $$$e$$$ liters of essence and $$$w$$$ liters of water ($$$e + w > 0$$$) into the cauldron, then it contains $$$\\frac{e}{e + w} \\cdot 100\\ \\%$$$ (without rounding) magic essence and $$$\\frac{w}{e + w} \\cdot 100\\ \\%$$$ water.", "input_spec": "The first line contains the single $$$t$$$ ($$$1 \\le t \\le 100$$$) — the number of test cases. The first and only line of each test case contains a single integer $$$k$$$ ($$$1 \\le k \\le 100$$$) — the percentage of essence in a good potion.", "output_spec": "For each test case, print the minimum number of steps to brew a good potion. It can be proved that it's always possible to achieve it in a finite number of steps.", "sample_inputs": ["3\n3\n100\n25"], "sample_outputs": ["100\n1\n4"], "notes": "NoteIn the first test case, you should pour $$$3$$$ liters of magic essence and $$$97$$$ liters of water into the cauldron to get a potion with $$$3\\ \\%$$$ of magic essence.In the second test case, you can pour only $$$1$$$ liter of essence to get a potion with $$$100\\ \\%$$$ of magic essence.In the third test case, you can pour $$$1$$$ liter of magic essence and $$$3$$$ liters of water."}, "positive_code": [{"source_code": "#include \r\n\r\nint main() {\r\n int t;\r\n scanf(\"%d\\n\", &t);\r\n while(t--) { \r\n int k;\r\n scanf(\"%d\\n\", &k);\r\n int e, w;\r\n e = w = 0;\r\n do {\r\n if(e == 0 || (100 * e) / (e+w) < k) e++;\r\n else w++;\r\n \r\n } while((100 *e)/(e+w) != k || (100*e) % (e+w) != 0); \r\n //printf(\"k=%d, e=%d, w=%d, percent=%d, mod=%d %d\\n\", k, e, w, (100 *e)/(e+w), (100*e) % (e+w), e+w);\r\n printf(\"%d\\n\", e+w);\r\n }\r\n return 0;\r\n}"}, {"source_code": "#include \n\nint main()\n{\n int test_cases;\n scanf(\"%d\", &test_cases);\n\n int output[test_cases];\n\n for(int i = 0; i < test_cases; i++)\n {\n int percent;\n scanf(\"%d\", &percent);\n \n int num = 100;\n\n while(num % percent != 0)\n {\n num += 100;\n }\n\n output[i] = num/percent;\n \n }\n\n for(int i = 0; i < test_cases; i++)\n {\n printf(\"%d\\n\", output[i]);\n }\n\n return 0;\n}"}, {"source_code": "#include \r\n#include \r\n#include \r\n#include \r\nint gcd(int a, int b)\r\n{\r\n if (a == 0)\r\n return b;\r\n return gcd(b % a, a);\r\n}\r\n \r\n\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\", &t);\r\n while (t--)\r\n {\r\n int k;\r\n int ans;\r\n scanf(\"%d\", &k);\r\n int l = 100-k;\r\n if (k==100)\r\n {\r\n ans = 1;\r\n }\r\n else\r\n {\r\n int L = gcd(k,l);\r\n k = k/L;\r\n l = l/L;\r\n ans = k+ l;\r\n }\r\n \r\n \r\n\r\n\r\n \r\n \r\n \r\n printf(\"%d\\n\", ans);\r\n }\r\n\r\n return 0;\r\n}"}, {"source_code": "#include\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n int k,a,g=0,i=0;\r\n scanf(\"%d\",&k);\r\n if(100%k==0&&k>0)\r\n {\r\n a=100/k;\r\n printf(\"%d\\n\",a);\r\n }\r\n else{\r\n int x,y;\r\n x=k;\r\n y=100-k;\r\n for( i = 1; i <= x && i <= y; ++i) \r\n { \r\n if (x % i ==0 && y % i == 0) \r\n {\r\n g = i; \r\n }\r\n } \r\n // printf(\"%d\",g);\r\n x=x/g;\r\n y=y/g;\r\n a=x+y;\r\n printf(\"%d\\n\",a);\r\n }\r\n \r\n // else{\r\n // a=100;\r\n // printf(\"%d\\n\",a);\r\n // }\r\n }\r\n }\r\n"}, {"source_code": "// Online C compiler to run C program online\r\n#include \r\n\r\nvoid main() {\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t-->0){\r\n int n1,n2;\r\n scanf(\"%d\",&n1);\r\n n2=100-n1;\r\n if(n1==100||n1==0){\r\n printf(\"1\\n\");\r\n }\r\n else{\r\n int gcd=0;\r\n for(int i=1; i <= n1 && i <= n2; ++i){\r\n if(n1%i==0 && n2%i==0)\r\n gcd = i;\r\n }\r\n n1=n1/gcd;\r\n n2=n2/gcd;\r\n printf(\"%d\\n\",n1+n2);\r\n }\r\n }\r\n}"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS \r\n#include \r\n#include \r\n#include \r\nint gcd(int a, int b);\r\nint main()\r\n{\r\n\tint n,x;\r\n\tscanf(\"%d\", &n);\r\n\twhile (n--)\r\n\t{\r\n\t\tscanf(\"%d\", &x);\r\n\t\tint a = 100/gcd(100, x);\r\n\t\tprintf(\"%d\\n\", a);\r\n\t}\r\n}\r\nint gcd(int a, int b)\r\n{\r\n\tint r = 1;\r\n\twhile (r!=0)\r\n\t{\r\n\t\tr = a % b;\r\n\t\ta = b;\r\n\t\tb = r;\r\n\t}\r\n\treturn a;\r\n\r\n}"}, {"source_code": "#include \r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while (t--)\r\n {int a,b;\r\n scanf(\"%d\",&a);\r\n b=100-a;\r\n int i=2;\r\n if(b==0) printf (\"1\\n\");\r\n \r\n else{\r\n while (i<=a&&i<=b)\r\n {\r\n if(a%i==0&&b%i==0) {\r\n a/=i;\r\n b/=i;\r\n \r\n }\r\n else i++;\r\n }\r\n printf(\"%d\\n\",a+b);\r\n }\r\n \r\n }\r\n \r\n }\r\n "}, {"source_code": "#include\r\n\r\nint gcd(int a, int b)\r\n{\r\n\tif(b == 0) return a;\r\n\telse return gcd(b, a % b);\r\n}\r\n\r\nint main()\r\n{\r\n\tint t;\r\n\tscanf(\"%d\", &t);\r\n\t\r\n\twhile(t--)\r\n\t{\r\n\t\tint k;\r\n\t\tscanf(\"%d\", &k);\r\n\t\tprintf(\"%d\\n\", 100 / gcd(100, k));\r\n\t}\r\n}"}, {"source_code": "#include \r\nint main()\r\n{\r\n int testcases;\r\n scanf(\"%d\", &testcases);\r\n //printf(\"%d\", testcases);\r\n while (testcases > 0)\r\n {\r\n int percent;\r\n scanf(\"%d\", &percent);\r\n int cpy = percent;\r\n int ans = 100, lim=2;\r\n while (cpy % 5 == 0 && lim!=0)\r\n {\r\n cpy /= 5;\r\n ans /= 5;\r\n lim--;\r\n }\r\n lim=2;\r\n while (cpy % 2 == 0 && lim!=0)\r\n {\r\n cpy /= 2;\r\n ans /= 2;\r\n lim--;\r\n }\r\n printf(\"%d\\n\", ans);\r\n testcases--;\r\n }\r\n return 0;\r\n}"}, {"source_code": "#include\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n for(int i=0;i\r\nint hcf(int a,int b)\r\n{\r\n if(b==0)\r\n return a;\r\n return hcf(b,a%b);\r\n}\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n int n,x;\r\n scanf(\"%d\",&n);\r\n if(n>50)\r\n x=hcf(n,100-n);\r\n else\r\n x=hcf(100-n,n);\r\n int res=n/x+(100-n)/x;\r\n printf(\"%d\\n\",res);\r\n }\r\n}"}, {"source_code": "#include \r\n\r\nint main()\r\n{\r\n int t,i,k,ans,j;\r\n scanf(\"%d\",&t);\r\n for(i=0;i\r\n\r\nint i=0;\r\nint funct()\r\n{\r\n int b, j, h, c, d;\r\n scanf(\"%d\", &b);\r\n h = 100 - b;\r\n for (j = 100; j > 0; j--)\r\n {\r\n if (h % j == 0 && b % j == 0)\r\n {\r\n c = h / j;\r\n d = b / j;\r\n printf(\"%d\\n\", c + d);\r\n break;\r\n }\r\n \r\n }\r\n return 0;\r\n}\r\n\r\nint main()\r\n{\r\n int a;\r\n scanf(\"%d\", &a);\r\n for (i = 0; i < a; i++)\r\n \r\n {\r\n funct();\r\n }\r\n return 0;\r\n}\r\n"}, {"source_code": "#include \r\n\r\nint gcd(a,b)\r\n{\r\n if(b==0) return a; \r\n return gcd(b,a%b);\r\n}\r\n\r\nint main(){\r\n\r\nint i,t,k,g,ans;\r\n\r\nscanf(\"%i\",&t);\r\n\r\nfor(i-0;i\r\n#include\r\n#include\r\nint hcf(int x)\r\n{ int k=1;\r\nif(x%2==0)\r\n{\r\n x=x/2;\r\n k=k*2;\r\n}\r\nif(x%2==0)\r\n{\r\n x=x/2;\r\n k=k*2;\r\n}\r\nif(x%5==0)\r\n{\r\n x=x/5;\r\n k=k*5;\r\n}\r\nif(x%5==0)\r\n{\r\n x=x/5;\r\n k=k*5;\r\n}\r\n return(k);\r\n}\r\nint main()\r\n{ int test,p,i,a[110];\r\nscanf(\"%d\",&test);\r\nfor( i=0;i\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while (t--)\r\n {int a,b;\r\n scanf(\"%d\",&a);\r\n b=100-a;\r\n int i=2;\r\n if(b==0) printf (\"1\\n\");\r\n \r\n else{\r\n while (i<=a&&i<=b)\r\n {\r\n if(a%i==0&&b%i==0) {\r\n a/=i;\r\n b/=i;\r\n \r\n }\r\n else i++;\r\n }\r\n printf(\"%d\\n\",a+b);\r\n }\r\n \r\n }\r\n \r\n }\r\n "}, {"source_code": "#include \r\n\r\nint gcd(int a, int b) {\r\n\t\r\n\tint remainder = a % b;\r\n\r\n if (remainder == 0) {\r\n\t\t\r\n return b;\r\n }\r\n\r\n return gcd(b, remainder);\r\n}\r\n\r\n\r\nint main() {\r\n\t\r\n\tint numTests = 0, test = 1;\r\n\t\r\n\tscanf(\"%d\", &numTests);\r\n\t\r\n\twhile (test <= numTests) {\r\n\t\t\r\n\t\tint k = 0, n2 = 100, res = 0;\r\n\t\t\r\n\t\tscanf(\"%d\", &k);\r\n\t\t\r\n\t\tres = gcd(n2, k);\r\n\t\t\r\n\t\tprintf(\"%d\\n\", 100 / res);\r\n\t\t\r\n\t\ttest++;\r\n\t}\r\n\t\r\n\treturn 0;\r\n}"}, {"source_code": "#include\r\nint fun(int a,int b)\r\n{\r\n\tint t;\r\n\tt=a%b;\r\n\twhile(t!=0)\r\n\t{\r\n\t\ta=b;\r\n\t\tb=t;\r\n\t\tt=a%b;\r\n\t}\r\n\treturn b;\r\n}\r\nint main()\r\n{\r\n int t;\r\n\tscanf(\"%d\",&t);\r\n\twhile(t--)\r\n\t{\r\n\t\tint k;\r\n\t\tscanf(\"%d\",&k);\r\n\t\tif(k==100)\r\n\t\tprintf(\"1\\n\");\r\n\t\telse\r\n\t\t{\r\n\t\t\tint a=k,b=100-k;\r\n\t\t\tint c=fun(a,b);\r\n\t\t\tprintf(\"%d\\n\",a/c+b/c);\r\n\t\t}\r\n\t}\r\n return 0;\r\n}\r\n"}, {"source_code": "#include\r\nint gcd(int a,int b)\r\n{ \r\n if (a == 0)\r\n return b;\r\n if (b == 0)\r\n return a;\r\n\r\n if (a == b)\r\n return a;\r\n\r\n if (a > b)\r\n return gcd(a-b, b);\r\n return gcd(a, b-a);\r\n}\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n int n;\r\n scanf(\"%d\",&n);\r\n if(n%100 == 0){\r\n printf(\"%d\\n\",100/n);\r\n }\r\n else\r\n {\r\n printf(\"%d\\n\",100/gcd(n,100));\r\n }\r\n }\r\n}"}, {"source_code": "#include \n\nint main()\n{\n int test_cases;\n scanf(\"%d\", &test_cases);\n\n int output[test_cases];\n\n for(int i = 0; i < test_cases; i++)\n {\n int percent;\n scanf(\"%d\", &percent);\n \n int num = 100;\n\n while(num % percent != 0)\n {\n num += 100;\n }\n\n output[i] = num/percent;\n \n }\n\n for(int i = 0; i < test_cases; i++)\n {\n printf(\"%d\\n\", output[i]);\n }\n\n return 0;\n}"}, {"source_code": "#include\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n int k,a,g=0,i=0;\r\n scanf(\"%d\",&k);\r\n if(100%k==0&&k>0)\r\n {\r\n a=100/k;\r\n printf(\"%d\\n\",a);\r\n }\r\n else{\r\n int x,y;\r\n x=k;\r\n y=100-k;\r\n for( i = 1; i <= x && i <= y; ++i) \r\n { \r\n if (x % i ==0 && y % i == 0) \r\n {\r\n g = i; \r\n }\r\n } \r\n // printf(\"%d\",g);\r\n x=x/g;\r\n y=y/g;\r\n a=x+y;\r\n printf(\"%d\\n\",a);\r\n }\r\n \r\n // else{\r\n // a=100;\r\n // printf(\"%d\\n\",a);\r\n // }\r\n }\r\n }\r\n"}, {"source_code": "#include\r\nint main()\r\n{\r\n int i,t,a,b,n,k;\r\n scanf(\"%d\",&t);\r\n for(i=0;i\r\n\r\nint main ()\r\n{\r\n\r\n int z;\r\n scanf (\"%d\", &z);\r\n while (z > 0)\r\n {\r\n int a, b, x, y, t, gcd;\r\n\r\n scanf (\"%d\", &x);\r\n\r\n y = 100 - x;\r\n a = x;\r\n b = y;\r\n\r\n while (b != 0)\r\n\t{\r\n\t t = b;\r\n\t b = a % b;\r\n\t a = t;\r\n\t}\r\n\r\n gcd = a;\r\n\r\n printf (\"%d\\n\", (x / gcd + y / gcd));\r\n z--;\r\n }\r\n return 0;\r\n}\r\n"}, {"source_code": "#include\r\nint main()\r\n{\r\n int t,k,m,n,i;\r\n scanf(\"%d\",&t);\r\n for(i=1;i<=t;i++)\r\n {\r\n scanf(\"%d\",&k);\r\n for(int j=1;j<=100&&j<=k;j++)\r\n {\r\n if(100%j==0&&k%j==0)\r\n {\r\n m=j;\r\n }\r\n }\r\n n=100/m;\r\n printf(\"%d\\n\",n);\r\n }\r\n}\r\n"}, {"source_code": "#include \r\n \r\n \r\nint main()\r\n{\r\n int t,i,min;\r\n scanf(\"%d\",&t);\r\n \r\n while(t-->0)\r\n {\r\n scanf(\"%d\",&i);\r\n int e=i;\r\n int w=100-i;\r\n int gcd;\r\n if(i==100||i==0)\r\n {\r\n min=1;\r\n }\r\n else\r\n {\r\n for(int i=1;i<=e&&i<=w;i++)\r\n {\r\n if(e%i==0&&w%i==0)\r\n {\r\n gcd=i;\r\n }\r\n }\r\n \r\n min=w/gcd+e/gcd;\r\n }\r\n \r\n \r\n \r\n printf(\"%d\\n\",min);\r\n \r\n \r\n }\r\n \r\n return 0;\r\n}"}, {"source_code": "#include\r\nint main()\r\n{\r\n int t,k,m,n,i;\r\n scanf(\"%d\",&t);\r\n for(i=1;i<=t;i++)\r\n {\r\n scanf(\"%d\",&k);\r\n for(int j=1;j<=100&&j<=k;j++)\r\n {\r\n if(100%j==0&&k%j==0)\r\n {\r\n m=j;\r\n }\r\n }\r\n n=100/m;\r\n printf(\"%d\\n\",n);\r\n }\r\n}\r\n"}, {"source_code": "#include \r\nint main()\r\n{\r\n int testcases;\r\n scanf(\"%d\", &testcases);\r\n //printf(\"%d\", testcases);\r\n while (testcases > 0)\r\n {\r\n int percent;\r\n scanf(\"%d\", &percent);\r\n int cpy = percent;\r\n int ans = 100, lim=2;\r\n while (cpy % 5 == 0 && lim!=0)\r\n {\r\n cpy /= 5;\r\n ans /= 5;\r\n lim--;\r\n }\r\n lim=2;\r\n while (cpy % 2 == 0 && lim!=0)\r\n {\r\n cpy /= 2;\r\n ans /= 2;\r\n lim--;\r\n }\r\n printf(\"%d\\n\", ans);\r\n testcases--;\r\n }\r\n return 0;\r\n}"}, {"source_code": "#include\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n int k;\r\n scanf(\"%d\",&k);\r\n int c;\r\n for(int i=1; i <= 100 && i <= k; ++i)\r\n {\r\n if(100%i==0 && k%i==0)\r\n c = i;\r\n }\r\n int g=100/c;\r\n \r\n printf(\"%d\\n\",g);\r\n \r\n }\r\n}"}, {"source_code": "#include\nint main(){\n\tint t,i;\n\tscanf(\"%d\",&t);\n\twhile(t--){\n\t\tint k=0,temp=0,sum=0;\n\t\tscanf(\"%d\",&k);\n\t\tfor(i=1;i<=k;i++){\n\t\t\tif(k%i==0&&100%i==0){\n\t\t\t\ttemp=i;\n\t\t\t}\n\t\t}\n\t\tsum=100/temp;\n\t\tprintf(\"%d\\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\r\nint fun(int a,int b)\r\n{\r\n\tint t;\r\n\tt=a%b;\r\n\twhile(t!=0)\r\n\t{\r\n\t\ta=b;\r\n\t\tb=t;\r\n\t\tt=a%b;\r\n\t}\r\n\treturn b;\r\n}\r\nint main()\r\n{\r\n int t;\r\n\tscanf(\"%d\",&t);\r\n\twhile(t--)\r\n\t{\r\n\t\tint k;\r\n\t\tscanf(\"%d\",&k);\r\n\t\tif(k==100)\r\n\t\tprintf(\"1\\n\");\r\n\t\telse\r\n\t\t{\r\n\t\t\tint a=k,b=100-k;\r\n\t\t\tint c=fun(a,b);\r\n\t\t\tprintf(\"%d\\n\",a/c+b/c);\r\n\t\t}\r\n\t}\r\n return 0;\r\n}\r\n"}, {"source_code": "#include \r\n#include \r\n\r\nvoid solve(void)\r\n{\r\n int arr[] = {100, 50, 25, 20, 5, 4, 2};\r\n int num = 100;\r\n int essence;\r\n scanf(\"%d\", &essence);\r\n /* trim essence */\r\n for (int i=0; i<7; ++i) {\r\n if (essence >= arr[i]) {\r\n if (essence % arr[i] == 0 && num % arr[i] == 0) {\r\n essence /= arr[i];\r\n num /= arr[i];\r\n }\r\n }\r\n }\r\n printf(\"%d\\n\", num);\r\n}\r\n\r\n\r\nint main(void)\r\n{\r\n int numberOfTestCases;\r\n scanf(\"%d\", &numberOfTestCases);\r\n\r\n for (int i=0; i\r\nmain()\r\n{\r\n int n,t,s;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n scanf(\"%d\",&n);\r\n s=100;\r\n while(n!=s)\r\n {\r\n if(n>s)\r\n n=n-s;\r\n else\r\n s=s-n;\r\n }\r\n printf(\"%d\\n\",100/n);\r\n }\r\n}"}, {"source_code": "#include\r\nint main()\r\n{\r\n\tint t;\r\n\tscanf(\"%d\",&t);\r\n\twhile(t--)\r\n\t{\r\n\t\tint k,n=100;\r\n\t\tscanf(\"%d\",&k);\r\n\t\twhile(n && k)\r\n\t\t{\r\n\t\t\t//printf(\"1n=%d,k=%d\\n\",n,k);\r\n\t\t\tn=n%k;\r\n\t\t\tif(n==0) break; \r\n\t\t\t//printf(\"2n=%d,k=%d\\n\",n,k);\r\n\t\t\tk=k%n;\r\n\t\t\t//printf(\"3n=%d,k=%d\\n\",n,k);//原来是除数为0导致输出错误 \r\n\t\t}\r\n\t\tprintf(\"%d\\n\",100/(n+k));\r\n\t}\r\n}"}, {"source_code": "#include\r\nint gcd(int a,int b)\r\n{ \r\n if (a == 0)\r\n return b;\r\n if (b == 0)\r\n return a;\r\n\r\n if (a == b)\r\n return a;\r\n\r\n if (a > b)\r\n return gcd(a-b, b);\r\n return gcd(a, b-a);\r\n}\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n int n;\r\n scanf(\"%d\",&n);\r\n if(n%100 == 0){\r\n printf(\"%d\\n\",100/n);\r\n }\r\n else\r\n {\r\n printf(\"%d\\n\",100/gcd(n,100));\r\n }\r\n }\r\n}"}, {"source_code": "#include\r\n\r\nint main() {\r\n int t;\r\n scanf(\"%d\", &t);\r\n while(t--) {\r\n int me, w, tp;\r\n scanf(\"%d\", &me);\r\n w = 100-me;\r\n int range=(me>w)?me:w;\r\n for(int i = range;i > 0;i--) {\r\n if(me%i==0 && w%i==0) {\r\n // printf(\"%d \", i);\r\n me/=i;\r\n w/=i;\r\n }\r\n }\r\n // printf(\"\\n%d\\n\", me+w);\r\n printf(\"%d\\n\", me+w);\r\n }\r\n}"}, {"source_code": "#include\r\n#include\r\n#include\r\n#include\r\ntypedef long long int ll;\r\ntypedef unsigned long long ull;\r\ntypedef long double lld;\r\nll gcd(ll a, ll b) {\r\n return b ? gcd(b, a % b) : a;\r\n}\r\nvoid swap(int *a, int *b) {\r\n int t = *a;\r\n *a = *b;\r\n *b = t;\r\n}\r\ntypedef struct array {\r\n int first, second;\r\n} point;\r\nll min(ll a, ll b) {\r\n return a < b ? a : b;\r\n}\r\nll max(ll a, ll b) {\r\n return a > b ? a : b;\r\n}\r\nint cmpfunc (const void * a, const void * b) {\r\n return ( *(int*)a - * (int*)b );\r\n}\r\nint cmc(const void *a, const void *b) {\r\n return *(char *)a - *(char *)b;\r\n}\r\nint comp(const void* a, const void* b) {\r\n long long i = *(long long*)a;\r\n long long j = *(long long*)b;\r\n return (int)((i > j) - (i < j));\r\n}\r\n#define pr printf\r\n#define sc scanf\r\n#define re(i,a,b) for(int i=a;i 0)\r\n {\r\n break;\r\n }\r\n\r\n }\r\n printf(\"%d\\n\", j + i);\r\n\r\n\r\n}"}, {"source_code": "#include\r\n\r\nint main()\r\n{\r\n\tint t;\r\n\tscanf(\"%d\",&t);\r\n\twhile(t--)\r\n\t{\r\n\t\tint n;\r\n\t\tscanf(\"%d\",&n);\r\n\t\t\r\n\t\tif(n==100)\r\n\t\t{\r\n\t\t\tprintf(\"1\\n\");\r\n\t\t}\r\n\t\telse{\r\n\t\t\tfloat p1=100-n;\r\n\t\t\tfloat p2=n;\r\n\t\t\tint f1=p1/p2;\r\n\t\t\tfloat f2=p1/p2;\r\n\t\t\t\t\t\r\n\t\t\t\tint i,gcd=1;\r\n\t\t\t\tfor(i=1;i<=(100-n)&&i<=n;i++)\r\n\t\t\t\t{\r\n\t\t\t\t\tif((100-n)%i==0 && n%i==0)\r\n\t\t\t\t\tgcd=i;\r\n\t\t\t\t}\r\n\t\t\t\tif(gcd==1)\r\n\t\t\t\t{\r\n\t\t\t\t\tint r=p1+n;\r\n\t\t\t\t\tprintf(\"%d\\n\",r);\r\n\t\t\t\t}\r\n\t\t\t\telse{\r\n\t\t\t\t\tint r1=p1/gcd;\r\n\t\t\t\t\tint r2=n/gcd;\r\n\t\t\t\t\tprintf(\"%d\\n\",r1+r2);\r\n\t\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t}\r\n}"}, {"source_code": "#include \r\n\r\nint gcd(int a, int b) {\r\n\t\r\n\tint remainder = a % b;\r\n\r\n if (remainder == 0) {\r\n\t\t\r\n return b;\r\n }\r\n\r\n return gcd(b, remainder);\r\n}\r\n\r\n\r\nint main() {\r\n\t\r\n\tint numTests = 0, test = 1;\r\n\t\r\n\tscanf(\"%d\", &numTests);\r\n\t\r\n\twhile (test <= numTests) {\r\n\t\t\r\n\t\tint k = 0, n2 = 100, res = 0;\r\n\t\t\r\n\t\tscanf(\"%d\", &k);\r\n\t\t\r\n\t\tres = gcd(n2, k);\r\n\t\t\r\n\t\tprintf(\"%d\\n\", 100 / res);\r\n\t\t\r\n\t\ttest++;\r\n\t}\r\n\t\r\n\treturn 0;\r\n}"}, {"source_code": "#include \r\n\r\nint main ()\r\n{\r\n\r\n int z;\r\n scanf (\"%d\", &z);\r\n while (z > 0)\r\n {\r\n int a, b, x, y, t, gcd;\r\n\r\n scanf (\"%d\", &x);\r\n\r\n y = 100 - x;\r\n a = x;\r\n b = y;\r\n\r\n while (b != 0)\r\n\t{\r\n\t t = b;\r\n\t b = a % b;\r\n\t a = t;\r\n\t}\r\n\r\n gcd = a;\r\n\r\n printf (\"%d\\n\", (x / gcd + y / gcd));\r\n z--;\r\n }\r\n return 0;\r\n}\r\n"}, {"source_code": "#include \r\n\r\nint main ()\r\n{\r\n\r\n int z;\r\n scanf (\"%d\", &z);\r\n while (z > 0)\r\n {\r\n int a, b, x, y, t, gcd;\r\n\r\n scanf (\"%d\", &x);\r\n\r\n y = 100 - x;\r\n a = x;\r\n b = y;\r\n\r\n while (b != 0)\r\n\t{\r\n\t t = b;\r\n\t b = a % b;\r\n\t a = t;\r\n\t}\r\n\r\n gcd = a;\r\n\r\n printf (\"%d\\n\", (x / gcd + y / gcd));\r\n z--;\r\n }\r\n return 0;\r\n}\r\n"}, {"source_code": "#include\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n for(int i=0;i\r\nint main()\r\n{\r\n int t,i,j,n,m,k,a,b;\r\n scanf(\"%d\",&t);\r\n\r\n for(i=1;i<=t;i++)\r\n {\r\n scanf(\"%d\",&n);\r\n m = 100-n;\r\n a = n;\r\n b = m;\r\n for(j=20;j>1;j--)\r\n {\r\n if(n%j==0 & m%j==0)\r\n {\r\n n = n/j;\r\n m = m/j;\r\n }\r\n }\r\n /*if(100%n==0) printf(\"%d\\n\",100/n);\r\n else if(100%m==0) printf(\"%d\\n\",100/m);\r\n else printf(\"100\\n\");*/\r\n\r\n if(100%a==0) printf(\"%d\\n\",100/a);\r\n else if(100%b==0) printf(\"%d\\n\",100/b);\r\n else printf(\"%d\\n\",m+n);\r\n }\r\n\r\n return 0;\r\n}\r\n"}, {"source_code": "#include \r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while (t--)\r\n {int a,b;\r\n scanf(\"%d\",&a);\r\n b=100-a;\r\n int i=2;\r\n if(b==0) printf (\"1\\n\");\r\n \r\n else{\r\n while (i<=a&&i<=b)\r\n {\r\n if(a%i==0&&b%i==0) {\r\n a/=i;\r\n b/=i;\r\n \r\n }\r\n else i++;\r\n }\r\n printf(\"%d\\n\",a+b);\r\n }\r\n \r\n }\r\n \r\n }\r\n "}, {"source_code": "#include \r\n \r\nint gcd(int a, int b)\r\n{\r\n if (a == 0)\r\n return b;\r\n return gcd(b % a, a);\r\n}\r\n \r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t-- >0)\r\n {\r\n int k;\r\n scanf(\"%d\",&k);\r\n if(k==0 || k==100)\r\n {\r\n printf(\"1\\n\");\r\n continue;\r\n }\r\n if(k==1 || k==99)\r\n {\r\n printf(\"100\\n\");\r\n continue;\r\n }\r\n if(k==2 || k==98)\r\n {\r\n printf(\"50\\n\");\r\n continue;\r\n }\r\n if(k==50)\r\n {\r\n printf(\"2\\n\");\r\n continue;\r\n }\r\n int a=0;\r\n if(k>50)\r\n a = gcd(k,100-k);\r\n else\r\n a = gcd(100-k,k);\r\n printf(\"%d\\n\",((k/a)+((100-k)/a)));\r\n }\r\n return 0;\r\n}\r\n"}, {"source_code": "#include \r\n#include \r\n\r\nint find_gcd(int k,int w){\r\n int large,small,temp;\r\n if(k>=w){\r\n large=k;\r\n small=w;\r\n }\r\n else{\r\n large=w;\r\n small=k;\r\n }\r\n while(large%small!=0){\r\n temp=small;\r\n small=large%small;\r\n large=temp;;\r\n }\r\n return small;\r\n}\r\nint main(){\r\n int t,k,i,move,gcd,w,large,small;\r\n\r\n scanf(\"%d\",&t);\r\n while(t--){\r\n scanf(\"%d\",&k);\r\n w=100-k;\r\n if(k==100){\r\n move=1;\r\n }\r\n else{\r\n gcd=find_gcd(k,w);\r\n move=(k/gcd)+(w/gcd);\r\n }\r\n printf(\"%d\\n\",move);\r\n\r\n }\r\nreturn 0;\r\n}\r\n"}, {"source_code": "#include\r\nint main()\r\n{\r\n\tint t,i,j,k;\r\n\tscanf(\"%d\",&t);\r\n\tfor(i=0;i\r\nint gcd(int a,int b){\r\nif(a==0) return b;\r\nelse return gcd(b%a,a);\r\n}\r\nint main(){\r\nint n;\r\nscanf(\"%d\",&n);\r\nfor(int i=0;i\r\n#include \r\n\r\n#define max(a, b) ((a) > (b) ? (a) : (b))\r\nint isWhole(float num)\r\n{\r\n return num == round(num);\r\n}\r\n\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\", &t);\r\n while (t--)\r\n { \r\n int k;\r\n int loop = 1;\r\n int n = 100;\r\n scanf(\"%d\", &k);\r\n while (loop)\r\n {\r\n loop = 0;\r\n for (int i = 100; i > 1; i--)\r\n {\r\n float f1 = (float)k / (float)i;\r\n float f2 = (float)n / (float)i;\r\n loop = isWhole(f1) && isWhole(f2);\r\n if (loop)\r\n {\r\n k /= i;\r\n n /= i;\r\n break;\r\n }\r\n }\r\n }\r\n printf(\"%d\\n\", (int)max(k, n));\r\n }\r\n}"}, {"source_code": "#include \r\n#include\r\nint gcd(int k)\r\n{\r\n \r\n for(int i=k;i>1;i--)\r\n {\r\n if(k%i==0 && 100%i==0)\r\n return i;\r\n }\r\n return 1;\r\n}\r\nint potionMaking(int k)\r\n{ int l=gcd(k);\r\n int z=100/l;\r\n printf(\"%d\\n\",z);\r\n return 0;\r\n}\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n for(int i=0;i\r\n \r\n \r\nint main()\r\n{\r\n int t,i,min;\r\n scanf(\"%d\",&t);\r\n \r\n while(t-->0)\r\n {\r\n scanf(\"%d\",&i);\r\n int e=i;\r\n int w=100-i;\r\n int gcd;\r\n if(i==100||i==0)\r\n {\r\n min=1;\r\n }\r\n else\r\n {\r\n for(int i=1;i<=e&&i<=w;i++)\r\n {\r\n if(e%i==0&&w%i==0)\r\n {\r\n gcd=i;\r\n }\r\n }\r\n \r\n min=w/gcd+e/gcd;\r\n }\r\n \r\n \r\n \r\n printf(\"%d\\n\",min);\r\n \r\n \r\n }\r\n \r\n return 0;\r\n}"}, {"source_code": "/* Starting ... Code by Red_RanGer*/\r\n#include \"stdio.h\"\r\nint divisible(int n,int arr[]){\r\n int count =0;\r\n for (int i = 2; i <= n; i++)\r\n {\r\n if (n%i==0)\r\n {\r\n arr[count]=i;\r\n count++;\r\n }\r\n }\r\n return count ;\r\n}\r\nint main(){\r\n int testcases;\r\n scanf(\"%d\",&testcases);\r\n for (int i = 0; i k && (100-k)%k==0)\r\n {\r\n printf(\"%d\\n\",((100-k)/k)+1);\r\n continue ;\r\n }\r\n if ((100-k)<=k && k%(100-k)==0)\r\n {\r\n printf(\"%d\\n\",(k/(100-k))+1);\r\n continue ;\r\n }\r\n else\r\n {\r\n int len , e;\r\n len =divisible(100-k,arr);\r\n for (int i = 0; i \r\nint gcd(int a,int b){\r\nif(a==0) return b;\r\nelse return gcd(b%a,a);\r\n}\r\nint main(){\r\nint n;\r\nscanf(\"%d\",&n);\r\nfor(int i=0;i\r\nint gcd(int a,int b)\r\n{ \r\n if (a == 0)\r\n return b;\r\n if (b == 0)\r\n return a;\r\n\r\n if (a == b)\r\n return a;\r\n\r\n if (a > b)\r\n return gcd(a-b, b);\r\n return gcd(a, b-a);\r\n}\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n int n;\r\n scanf(\"%d\",&n);\r\n if(n%100 == 0){\r\n printf(\"%d\\n\",100/n);\r\n }\r\n else\r\n {\r\n printf(\"%d\\n\",100/gcd(n,100));\r\n }\r\n }\r\n}"}, {"source_code": "#include\nint main()\n{\n int i,t;\n scanf(\"%d\",&t);\n for(i=1;i<=t;i++)\n {\n int j,count=0,e;\n scanf(\"%d\",&e);\n for(j=1;j<=e;j++)\n {\n if(e%j==0 && 100%j==0)\n {\n count=j;\n }\n }\n printf(\"%d\\n\",100/count);\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"}, {"source_code": "#include \r\n\r\nint main(void) {\r\n int t, k;\r\n int min, max;\r\n scanf(\"%d\", &t);\r\n int answers[t];\r\n for(int i = 0; i < t; i++) {\r\n scanf(\"%d\", &k);\r\n if((100 - k) > k) {\r\n min = k;\r\n max = 100 - k;\r\n }\r\n else {\r\n max= k;\r\n min = 100 - k; \r\n }\r\n if(k == 100 || k == 0) {\r\n answers[i] = 1;\r\n }\r\n else if(max % min== 0) {\r\n answers[i] = 100 / min;\r\n }\r\n else {\r\n for(int j = min / 2;j >= 1;j--) {\r\n if(max % j == 0 && min % j == 0) {\r\n answers[i] = 100 / j;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n \r\n for(int i = 0; i < t; i++) {\r\n printf(\"%d\\n\",answers[i]);\r\n }\r\n\treturn 0;\r\n}\r\n "}, {"source_code": "#include \r\n#include \r\n#include \r\n\r\nint min(int a, int b) { return a < b ? a : b; }\r\n\r\nint main()\r\n{\r\n int x, y, z, i, j, k, a, b, c, n, m, t;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n c = 100 * 100; \r\n scanf(\"%d\", &n);\r\n for(x = 1; x <= 100; x++)\r\n for(y = 0; y <= 100; y++)\r\n {\r\n if(100 * x == n * (x + y))\r\n c = min(c, x + y);\r\n }\r\n \r\n printf(\"%d\\n\", c); \r\n }\r\n return 0;\r\n}\r\n"}, {"source_code": "#include \r\nint func(int a, int b)\r\n{\r\n if (a == 0)\r\n {\r\n return b;\r\n }\r\n return func(b % a, a);\r\n}\r\nint main()\r\n{\r\n int t = 0;\r\n scanf(\"%d\", &t);\r\n while (t--)\r\n {\r\n int k = 0;\r\n scanf(\"%d\", &k);\r\n int result = (100 / func(k, 100));\r\n printf(\"\\t\\t\\t%d\\n\", result);\r\n }\r\n\r\n return 0;\r\n}"}, {"source_code": "#include\r\n#include\r\n#include\r\n#include\r\n#include\r\nvoid input(int ar[],int n)\r\n{\r\n for(int i=0;ib)\r\n return a;\r\n return b;\r\n}\r\nint gcd(int a,int b)\r\n{\r\n for(int i=small(a,b);i>=1;i--)\r\n if(great(a,b)%i==0 && small(a,b)%i==0)\r\n return i;\r\n return 1;\r\n}\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n for(int l=0;l\r\n#include \r\n#include \r\n#include \r\n#include \r\n\r\nint main(){\r\n\tint tt;\r\n\tscanf(\"%d\", &tt);\r\n\twhile(tt--){\r\n\t\tint n;\r\n\t\tscanf(\"%d\", &n);\r\n\t\tint a = n, b = 100-n, l = 1;\r\n\t\twhile(a != b && b != 0){\r\n\t\t\tif(a > b) a -= b;\r\n\t\t\telse b -= a;\r\n\t\t}\r\n\t\tl = a;\r\n\t\tint ans = 0, tt = 0;\r\n\t\twhile(tt != 100){\r\n\t\t\ttt += l;\r\n\t\t\tans++;\r\n\t\t}\r\n\t\tprintf(\"%d\\n\", ans);\r\n\t}\r\n\treturn 0;\r\n}"}, {"source_code": "#include\r\n#include\r\nint GCD(int n)\r\n{\r\n int i, gcd;\r\n for(i=1; i <= n && i <= 100; i++)\r\n {\r\n\r\n if(n%i==0 && 100%i==0)\r\n gcd = i;\r\n }\r\n return gcd;\r\n}\r\n\r\nint main()\r\n{\r\n int t, n;\r\n double div;\r\n scanf(\"%d\", &t);\r\n while(t--)\r\n {\r\n scanf(\"%d\", &n);\r\n if(GCD(n) == 1){\r\n printf(\"100\\n\");\r\n }\r\n else{\r\n printf(\"%d\\n\", 100/GCD(n));\r\n }\r\n\r\n\r\n }\r\n\r\n\r\n\r\n\r\n}\r\n"}, {"source_code": "#include\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n int k,a,g=0,i=0;\r\n scanf(\"%d\",&k);\r\n if(100%k==0&&k>0)\r\n {\r\n a=100/k;\r\n printf(\"%d\\n\",a);\r\n }\r\n else{\r\n int x,y;\r\n x=k;\r\n y=100-k;\r\n for( i = 1; i <= x && i <= y; ++i) \r\n { \r\n if (x % i ==0 && y % i == 0) \r\n {\r\n g = i; \r\n }\r\n } \r\n // printf(\"%d\",g);\r\n x=x/g;\r\n y=y/g;\r\n a=x+y;\r\n printf(\"%d\\n\",a);\r\n }\r\n \r\n // else{\r\n // a=100;\r\n // printf(\"%d\\n\",a);\r\n // }\r\n }\r\n }\r\n"}, {"source_code": "#include \r\n#include \r\nint hcf(int a, int b)\r\n{\r\n // Everything divides 0\r\n if (a == 0)\r\n return b;\r\n if (b == 0)\r\n return a;\r\n\r\n // base case\r\n if (a == b)\r\n return a;\r\n\r\n // a is greater\r\n if (a > b)\r\n return hcf(a-b, b);\r\n return hcf(a, b-a);\r\n}\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while (t--)\r\n {\r\n int n;\r\n scanf(\"%d\",&n);\r\n if (n==0)\r\n {\r\n printf(\"1\\n\");\r\n continue;\r\n }\r\n int h=hcf(100,n);\r\n if (h!=1)\r\n printf(\"%d\\n\",(100/h));\r\n else\r\n printf(\"100\\n\");\r\n }\r\n return 0;\r\n}"}, {"source_code": "#include\r\n#include\r\nint GCD(int n)\r\n{\r\n int i, gcd;\r\n for(i=1; i <= n && i <= 100; i++)\r\n {\r\n\r\n if(n%i==0 && 100%i==0)\r\n gcd = i;\r\n }\r\n return gcd;\r\n}\r\n\r\nint main()\r\n{\r\n int t, n;\r\n double div;\r\n scanf(\"%d\", &t);\r\n while(t--)\r\n {\r\n scanf(\"%d\", &n);\r\n if(GCD(n) == 1){\r\n printf(\"100\\n\");\r\n }\r\n else{\r\n printf(\"%d\\n\", 100/GCD(n));\r\n }\r\n\r\n\r\n }\r\n\r\n\r\n\r\n\r\n}\r\n"}, {"source_code": "#include \r\n\r\nint main(){\r\n int t;\r\n scanf(\"%d\",&t);\r\n for(int i=0;ik2){\r\n k=k1;\r\n k1=k2;\r\n k2=k;\r\n }\r\n for(int j=k1;j>0;j--){\r\n if(k1%j==0 && k2%j==0){\r\n printf(\"%d\\n\",(k1+k2)/j);\r\n break;\r\n }\r\n }\r\n }\r\n return 0;\r\n}"}, {"source_code": "#include \r\n \r\nint gcd(int a, int b)\r\n{\r\n if (a == 0)\r\n return b;\r\n return gcd(b % a, a);\r\n}\r\n \r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t-- >0)\r\n {\r\n int k;\r\n scanf(\"%d\",&k);\r\n if(k==0 || k==100)\r\n {\r\n printf(\"1\\n\");\r\n continue;\r\n }\r\n if(k==1 || k==99)\r\n {\r\n printf(\"100\\n\");\r\n continue;\r\n }\r\n if(k==2 || k==98)\r\n {\r\n printf(\"50\\n\");\r\n continue;\r\n }\r\n if(k==50)\r\n {\r\n printf(\"2\\n\");\r\n continue;\r\n }\r\n int a=0;\r\n if(k>50)\r\n a = gcd(k,100-k);\r\n else\r\n a = gcd(100-k,k);\r\n printf(\"%d\\n\",((k/a)+((100-k)/a)));\r\n }\r\n return 0;\r\n}\r\n"}, {"source_code": "#include\r\n#include\r\n#include\r\n#include\r\ntypedef long double LD;\r\ntypedef long long ll;\r\n#define int ll\r\n#define pb push_back\r\n#define mp make_pair\r\n#define REP(i,n) for (int i = 0; i < n; i++)\r\n#define FOR(i,a,b) for (int i = a; i < b; i++)\r\n#define REPD(i,n) for (int i = n-1; i >= 0; i--)\r\n#define FORD(i,a,b) for (int i = a; i >= b; i--)\r\n// ----------\r\n#define sfi(x) scanf(\"%d\",&x);\r\n#define sfi2(x,y) scanf(\"%d%d\",&x,&y);\r\n#define sfi3(x,y,z) scanf(\"%d%d%d\",&x,&y,&z);\r\n\r\n#define sfl(x) scanf(\"%lld\",&x);\r\n#define sfl2(x,y) scanf(\"%lld%lld\",&x,&y);\r\n#define sfl3(x,y,z) scanf(\"%lld%lld%lld\",&x,&y,&z);\r\n#define sfl4(x,y,z,x1) scanf(\"%lld%lld%lld%lld\",&x,&y,&z,&x1);\r\n#define sfl5(x,y,z,x1,y1) scanf(\"%lld%lld%lld%lld%lld\",&x,&y,&z,&x1,&y1);\r\n#define sfl6(x,y,z,x1,y1,z1) scanf(\"%lld%lld%lld%lld%lld%lld\",&x,&y,&z,&x1,&y1,&z1);\r\n\r\n#define sfs(x) scanf(\"%s\",x);\r\n#define sfs2(x,y) scanf(\"%s%s\",x,y);\r\n#define sfs3(x,y,z) scanf(\"%s%s%s\",x,y,z);\r\n// ---------\r\n\r\n// ---------\r\n#define pfi(x) printf(\"%d\\n\",x);\r\n#define pfi2(x,y) printf(\"%d %d\\n\",x,y);\r\n#define pfi3(x,y,z) printf(\"%d %d %d\\n\",x,y,z);\r\n\r\n#define pfl(x) printf(\"%lld\\n\",x);\r\n#define pfl2(x,y) printf(\"%lld %lld\\n\",x,y);\r\n#define pfl3(x,y,z) printf(\"%lld %lld %lld\\n\",x,y,z);\r\n\r\n#define pfs(x) printf(\"%s\\n\",x);\r\n#define pfs2(x,y) printf(\"%s %s\\n\",x,y);\r\n#define pfs3(x,y,z) printf(\"%s %s %s\\n\",x,y,z);\r\n\r\n#define pwe(x) printf(\"%lld \",x); // print without end\r\n// --------\r\nlong long a,b,c,d,e,t,i,j,n,m,row,col,change,x;\r\nlong long gcd(long long k,long long l)\r\n{\r\n if(k%l==0)\r\n {\r\n return l;\r\n }\r\n else\r\n {\r\n gcd(l,k%l);\r\n }\r\n}\r\n\r\nint main()\r\n{\r\n\r\n sfl(t);\r\n while(t--)\r\n {\r\n sfl(n);\r\n a=gcd(100,n);\r\n pfl(100/a);\r\n }\r\n\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"}, {"source_code": "#include \r\n#include\r\nint gcd(int k)\r\n{\r\n \r\n for(int i=k;i>1;i--)\r\n {\r\n if(k%i==0 && 100%i==0)\r\n return i;\r\n }\r\n return 1;\r\n}\r\nint potionMaking(int k)\r\n{ int l=gcd(k);\r\n int z=100/l;\r\n printf(\"%d\\n\",z);\r\n return 0;\r\n}\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n for(int i=0;i\r\n\r\nstatic int gcd(int a, int b) {\r\n\tint swap, c;\r\n \r\n\tif (0 == a)\r\n\t\treturn b;\r\n\tif (0 == b)\r\n\t\treturn a;\r\n\tif (a > b) {\r\n\t\tswap = a;\r\n\t\ta = b;\r\n\t\tb = swap;\r\n\t}\r\n\tfor (c = a % b; c > 0; c = a % b) {\r\n\t\ta = b;\r\n\t\tb = c;\r\n\t}\r\n\treturn b;\r\n}\r\n\r\nint main() {\r\n\tint t, k;\r\n\r\n\tscanf(\"%d\", &t);\r\n\twhile (t--) {\r\n\t\tscanf(\"%d\", &k);\r\n\t\tprintf(\"%d\\n\", 100/gcd(k, 100));\r\n\t}\r\n\treturn 0;\r\n}"}, {"source_code": "#include\r\n#include\r\n#include\r\nint hcf(int x)\r\n{ int k=1;\r\nif(x%2==0)\r\n{\r\n x=x/2;\r\n k=k*2;\r\n}\r\nif(x%2==0)\r\n{\r\n x=x/2;\r\n k=k*2;\r\n}\r\nif(x%5==0)\r\n{\r\n x=x/5;\r\n k=k*5;\r\n}\r\nif(x%5==0)\r\n{\r\n x=x/5;\r\n k=k*5;\r\n}\r\n return(k);\r\n}\r\nint main()\r\n{ int test,p,i,a[110];\r\nscanf(\"%d\",&test);\r\nfor( i=0;i\r\nint main()\r\n{\r\n\tint t,i,j,k;\r\n\tscanf(\"%d\",&t);\r\n\tfor(i=0;ik && (100-k)%k==0)\r\n {\r\n printf(\"%d\\n\",((100-k)/k)+1);\r\n continue ;\r\n }\r\n if ((100-k)<=k && k%(100-k)==0)\r\n {\r\n printf(\"%d\\n\",(k/(100-k))+1);\r\n continue ;\r\n }\r\n else\r\n {\r\n int len , e;\r\n len =divisible(100-k,arr);\r\n for (int i = 0; i \r\n#include \r\n\r\nvoid solve(void)\r\n{\r\n int arr[] = {100, 50, 25, 20, 5, 4, 2};\r\n int num = 100;\r\n int essence;\r\n scanf(\"%d\", &essence);\r\n /* trim essence */\r\n for (int i=0; i<7; ++i) {\r\n if (essence >= arr[i]) {\r\n if (essence % arr[i] == 0 && num % arr[i] == 0) {\r\n essence /= arr[i];\r\n num /= arr[i];\r\n }\r\n }\r\n }\r\n printf(\"%d\\n\", num);\r\n}\r\n\r\n\r\nint main(void)\r\n{\r\n int numberOfTestCases;\r\n scanf(\"%d\", &numberOfTestCases);\r\n\r\n for (int i=0; i\r\n\r\nint gcd(int a, int b)\r\n{\r\n // Everything divides 0\r\n if (a == 0)\r\n return b;\r\n if (b == 0)\r\n return a;\r\n \r\n // base case\r\n if (a == b)\r\n return a;\r\n \r\n // a is greater\r\n if (a > b)\r\n return gcd(a-b, b);\r\n return gcd(a, b-a);\r\n}\r\n\r\nint main()\r\n{\r\n int q;\r\n scanf(\"%d\",&q);\r\n\r\n while(q--)\r\n {\r\n int potion;\r\n // float check;\r\n scanf(\"%d\",&potion);\r\n\r\n if(100%potion==0)\r\n {\r\n printf(\"%d\\n\",100/potion);\r\n // continue;\r\n }\r\n\r\n else if(100%potion!=0)\r\n {\r\n printf(\"%d\\n\",100/gcd(100,potion));\r\n }\r\n\r\n // else\r\n // {\r\n // printf(\"%d\\n\",100);\r\n // }\r\n }\r\n}"}, {"source_code": "#include \r\nint gcd(int a,int b)\r\n{\r\n int t;\r\n while (b!=0)\r\n {\r\n t=b;\r\n b=a%b;\r\n a=t;\r\n }\r\n return a;\r\n}\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while (t--)\r\n {\r\n int r,t;\r\n scanf(\"%d\",&r);\r\n if (r>50)\r\n t=gcd(r,100-r);\r\n \r\n else\r\n t=gcd(100-r,r);\r\n \r\n printf(\"%d\\n\",100/t);\r\n }\r\n return 0;\r\n}"}, {"source_code": "#include\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n for(int i=0;i\r\nint Gcd(int n1,int n2)\r\n{\r\n\r\n int i, gcd;\r\n for(i=1; i <= n1 && i <= n2; ++i)\r\n {\r\n if(n1%i==0 && n2%i==0)\r\n gcd = i;\r\n }\r\n return gcd;\r\n}\r\nint main()\r\n{\r\n int t,i,k,o;\r\n scanf(\"%d\",&t);\r\n for(i=0;i\r\nint main()\r\n{\r\n int test;\r\n \r\n scanf(\"%d\\n\",&test);\r\n \r\n \r\n while(test>0)\r\n {\r\n int kper;\r\n scanf(\"%d\\n\",&kper);\r\n int maximumv=0;\r\n int water=100-kper;\r\n for(int i=1;i<=100;i++)\r\n {\r\n if(kper%i==0 && water%i==0)\r\n {\r\n if(i>maximumv)\r\n {\r\n maximumv=i;\r\n }\r\n }\r\n }\r\n int leastcount=(water/maximumv)+(kper/maximumv);\r\n printf(\"%d\\n\",leastcount);\r\n test--;\r\n }\r\n}"}, {"source_code": "#include \r\nint gcd(int a,int b)\r\n{\r\n int t;\r\n while (b!=0)\r\n {\r\n t=b;\r\n b=a%b;\r\n a=t;\r\n }\r\n return a;\r\n}\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while (t--)\r\n {\r\n int r,t;\r\n scanf(\"%d\",&r);\r\n if (r>50)\r\n t=gcd(r,100-r);\r\n \r\n else\r\n t=gcd(100-r,r);\r\n \r\n printf(\"%d\\n\",100/t);\r\n }\r\n return 0;\r\n}"}, {"source_code": "#include \r\n#include \r\n\r\nint gcd(int a, int b);\r\n\r\nint main() {\r\n int t, n, e, w, i, divisor;\r\n\r\n scanf(\"%d\", &t);\r\n while (t--) {\r\n scanf(\"%d\", &n);\r\n\r\n if (n==100) {\r\n printf(\"1\\n\");\r\n continue;\r\n } else {\r\n e = n;\r\n w = 100 - e;\r\n divisor = gcd(e, w);\r\n while (gcd(e, w)!=1) {\r\n e /= divisor;\r\n w /= divisor;\r\n }\r\n\r\n printf(\"%d\\n\", e+w);\r\n }\r\n }\r\n return 0;\r\n}\r\n\r\nint gcd(int a, int b) {\r\n if (b==0) {\r\n return a;\r\n } else {\r\n return gcd(b, a%b);\r\n }\r\n}\r\n"}, {"source_code": "#include\r\nint gcd(int i,int j){\r\n if (j == 0)\r\n return i;\r\n else if (i == 0)\r\n return j;\r\n else if (j == i)\r\n return j;\r\n else if (j > i)\r\n return gcd(j-i, i);\r\n return gcd(j, i-j);\r\n}\r\nint main()\r\n{\r\n int t,i,j,a;\r\n scanf(\"%d\",&t);\r\n int A[t];\r\n for (int b=0;b\r\nint main()\r\n{\r\n int t,i;\r\n scanf(\"%d\",&t);\r\n for(i=0;ib){\r\n a=a-b;\r\n }\r\n else{\r\n b=b-a;\r\n }\r\n }\r\n k=k/b;\r\n l=l/b;\r\n printf(\"%d\\n\",k+l);\r\n }\r\n }\r\n return 0;\r\n}\r\n"}, {"source_code": "#include \r\n\r\nint main(){\r\n int t;\r\n scanf(\"%d\",&t);\r\n for(int i=0;ik2){\r\n k=k1;\r\n k1=k2;\r\n k2=k;\r\n }\r\n for(int j=k1;j>0;j--){\r\n if(k1%j==0 && k2%j==0){\r\n printf(\"%d\\n\",(k1+k2)/j);\r\n break;\r\n }\r\n }\r\n }\r\n return 0;\r\n}"}, {"source_code": "\r\n#include\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\\n\",&t);\r\n while(t>0)\r\n {\r\n int k;\r\n scanf(\"%d\\n\",&k);\r\n int i,max=0;\r\n int w=100-k;\r\n for(i=1;i<=100;i++)\r\n {\r\n if(k%i==0 && w%i==0)\r\n {\r\n if(i>max)\r\n {\r\n max=i;\r\n }\r\n }\r\n }\r\n int res=(k/max)+(w/max);\r\n printf(\"%d\\n\",res);\r\n t--;\r\n }\r\n}"}, {"source_code": "#include\r\n#include\r\n#include\r\n\r\nint min(int x, int y) {\r\n return x < y ? x : y;\r\n}\r\n\r\nint main() {\r\n int t;\r\n scanf(\"%d\", &t);\r\n while(t--) {\r\n int n;\r\n scanf(\"%d\", &n);\r\n int p = n, w = 100 - n;\r\n int mini = min(p, w);\r\n if(w == 0) {\r\n printf(\"1\\n\");\r\n }\r\n else {\r\n for(int i = mini; i >= 1; i--) {\r\n if(p % i == 0 && w % i == 0) {\r\n p /= i;\r\n w /= i;\r\n }\r\n }\r\n printf(\"%d\\n\", p + w);\r\n }\r\n \r\n }\r\n \r\n return 0;\r\n}\r\n"}, {"source_code": "#include \r\n//#include \r\n#include \r\n#include \r\n\r\ntypedef long long int LL;\r\n//const int M = 200005;\r\nconst int N = 52;\r\nconst int A = 26;\r\n\r\n//LL max(LL a, LL b){if(a>b) return a; else return b;}\r\n//LL min(LL a, LL b){if(ab) return a; else return b;}\r\nint min(const int a, const int b){ if(a\r\n\r\nint main()\r\n{\r\n\tint t;\r\n\tscanf(\"%d\",&t);\r\n\twhile(t--)\r\n\t{\r\n\t\tint n;\r\n\t\tscanf(\"%d\",&n);\r\n\t\t\r\n\t\tif(n==100)\r\n\t\t{\r\n\t\t\tprintf(\"1\\n\");\r\n\t\t}\r\n\t\telse{\r\n\t\t\tfloat p1=100-n;\r\n\t\t\tfloat p2=n;\r\n\t\t\tint f1=p1/p2;\r\n\t\t\tfloat f2=p1/p2;\r\n\t\t\t\t\t\r\n\t\t\t\tint i,gcd=1;\r\n\t\t\t\tfor(i=1;i<=(100-n)&&i<=n;i++)\r\n\t\t\t\t{\r\n\t\t\t\t\tif((100-n)%i==0 && n%i==0)\r\n\t\t\t\t\tgcd=i;\r\n\t\t\t\t}\r\n\t\t\t\tif(gcd==1)\r\n\t\t\t\t{\r\n\t\t\t\t\tint r=p1+n;\r\n\t\t\t\t\tprintf(\"%d\\n\",r);\r\n\t\t\t\t}\r\n\t\t\t\telse{\r\n\t\t\t\t\tint r1=p1/gcd;\r\n\t\t\t\t\tint r2=n/gcd;\r\n\t\t\t\t\tprintf(\"%d\\n\",r1+r2);\r\n\t\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t}\r\n}"}, {"source_code": "#include\r\nint gcd(int a,int b){\r\nif(a==0) return b;\r\nelse return gcd(b%a,a);\r\n}\r\nint main(){\r\nint n;\r\nscanf(\"%d\",&n);\r\nfor(int i=0;i\r\n#include \r\n#include \r\nint gcd(int a, int b);\r\nint main()\r\n{\r\n\tint n,x;\r\n\tscanf(\"%d\", &n);\r\n\twhile (n--)\r\n\t{\r\n\t\tscanf(\"%d\", &x);\r\n\t\tint a = 100/gcd(100, x);\r\n\t\tprintf(\"%d\\n\", a);\r\n\t}\r\n}\r\nint gcd(int a, int b)\r\n{\r\n\tint r = 1;\r\n\twhile (r!=0)\r\n\t{\r\n\t\tr = a % b;\r\n\t\ta = b;\r\n\t\tb = r;\r\n\t}\r\n\treturn a;\r\n\r\n}"}, {"source_code": "#include\n#include\n\nint gcd(int a, int b)\n{\n // Everything divides 0\n if (a == 0)\n return b;\n if (b == 0)\n return a;\n \n // base case\n if (a == b)\n return a;\n \n // a is greater\n if (a > b)\n return gcd(a-b, b);\n return gcd(a, b-a);\n}\n\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n for(int i=0;i\r\n#include \r\n\r\nint gcd(int n1)\r\n{\r\n int rem;\r\n int n2 = 100;\r\n while(n2 != 0)\r\n {\r\n rem = n1 % n2;\r\n n1 = n2;\r\n n2 = rem;\r\n }\r\n return n1;\r\n}\r\n\r\nint main()\r\n{\r\n int T, essence, remainder;\r\n scanf(\"%d\", &T);\r\n\r\n while(T--)\r\n {\r\n scanf(\"%d\", &essence);\r\n remainder = gcd(essence);\r\n printf(\"%d\\n\", 100/remainder);\r\n }\r\n return 0;\r\n}\r\n"}, {"source_code": "#include\r\nint gcd(int a,int b){\r\nif(a==0) return b;\r\nelse return gcd(b%a,a);\r\n}\r\nint main(){\r\nint n;\r\nscanf(\"%d\",&n);\r\nfor(int i=0;i\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n for(int i=0;i\r\n#include \r\n#include \r\n#include \r\nint gcd(int a, int b)\r\n{\r\n if (a == 0)\r\n return b;\r\n return gcd(b % a, a);\r\n}\r\n \r\n\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\", &t);\r\n while (t--)\r\n {\r\n int k;\r\n int ans;\r\n scanf(\"%d\", &k);\r\n int l = 100-k;\r\n if (k==100)\r\n {\r\n ans = 1;\r\n }\r\n else\r\n {\r\n int L = gcd(k,l);\r\n k = k/L;\r\n l = l/L;\r\n ans = k+ l;\r\n }\r\n \r\n \r\n\r\n\r\n \r\n \r\n \r\n printf(\"%d\\n\", ans);\r\n }\r\n\r\n return 0;\r\n}"}, {"source_code": "#include \r\n#include \r\n\r\n//https://codeforces.com/problemset/problem/1525/A\r\nint gcd(int a, int b)\r\n{\r\n if (b == 0)\r\n return a;\r\n return gcd(b, a % b);\r\n}\r\n\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\", &t);\r\n while (t--)\r\n {\r\n int k;\r\n scanf(\"%d\", &k);\r\n printf(\"%d\\n\", 100 / gcd(100, k));\r\n }\r\n}"}, {"source_code": "#include\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n for(int i=0;i\r\n\r\nvoid main() {\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t-->0){\r\n int n1,n2;\r\n scanf(\"%d\",&n1);\r\n n2=100-n1;\r\n if(n1==100||n1==0){\r\n printf(\"1\\n\");\r\n }\r\n else{\r\n int gcd=0;\r\n for(int i=1; i <= n1 && i <= n2; ++i){\r\n if(n1%i==0 && n2%i==0)\r\n gcd = i;\r\n }\r\n n1=n1/gcd;\r\n n2=n2/gcd;\r\n printf(\"%d\\n\",n1+n2);\r\n }\r\n }\r\n}"}, {"source_code": "#include\r\n\r\nint main() {\r\n int t;\r\n scanf(\"%d\", &t);\r\n while(t--) {\r\n int me, w, tp;\r\n scanf(\"%d\", &me);\r\n w = 100-me;\r\n int range=(me>w)?me:w;\r\n for(int i = range;i > 0;i--) {\r\n if(me%i==0 && w%i==0) {\r\n // printf(\"%d \", i);\r\n me/=i;\r\n w/=i;\r\n }\r\n }\r\n // printf(\"\\n%d\\n\", me+w);\r\n printf(\"%d\\n\", me+w);\r\n }\r\n}"}, {"source_code": "#include \r\n//#include \r\n#include \r\n#include \r\n\r\ntypedef long long int LL;\r\n//const int M = 200005;\r\nconst int N = 52;\r\nconst int A = 26;\r\n\r\n//LL max(LL a, LL b){if(a>b) return a; else return b;}\r\n//LL min(LL a, LL b){if(ab) return a; else return b;}\r\nint min(const int a, const int b){ if(a\r\n \r\n \r\ntypedef long long ll;\r\n \r\n \r\nll FindGCD(ll n1, ll n2)\r\n{\r\n // if user enters negative number, sign of the number is changed to positive\r\n n1 = ( n1 > 0) ? n1 : -n1;\r\n n2 = ( n2 > 0) ? n2 : -n2;\r\n \r\n if(n1==100||n2==100)\r\n {\r\n return 100;\r\n }\r\n \r\n \r\n while(n1!=n2)\r\n {\r\n if(n1 > n2)\r\n n1 -= n2;\r\n else\r\n n2 -= n1;\r\n }\r\n return n1;\r\n}\r\n \r\n \r\n \r\nint main()\r\n{\r\n ll T, k, kc;\r\n \r\n scanf(\"%lld\",&T);\r\n \r\n while(T>0)\r\n {\r\n scanf(\"%lld\",&k);\r\n kc=FindGCD(k,100-k);\r\n printf(\"%lld\\n\",((k/kc)+((100-k)/kc)));\r\n \r\n T--;\r\n }\r\n return 0;\r\n}\r\n"}, {"source_code": "#include \r\n#include \r\n\r\nint main()\r\n{\r\n int n;\r\n scanf(\"%d\", &n);\r\n while(n--) {\r\n int p,t = 100;\r\n int i;\r\n scanf(\"%d\", &p);\r\n for(i = 100; i >= 2; i--) {\r\n if(p%i == 0 && t%i == 0) {\r\n p = p/i;\r\n t = t/i;\r\n }\r\n }\r\n printf(\"%d\\n\", t);\r\n }\r\n return 0;\r\n}\r\n"}], "negative_code": [{"source_code": "#include\r\nint gcd(int a,int b)\r\n{\r\n if(b==0)return a;\r\n else return (a%b,a);\r\n}\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n int k;\r\n scanf(\"%d\",&k);\r\n printf(\"%d\\n\",100/gcd(k,100));\r\n }\r\n}\r\n\r\n"}, {"source_code": "#include \r\nint main() {\r\n int t;\r\n scanf(\"%d\", &t);\r\n int k, out, divisor, kWater;\r\n const int one = 1;\r\n while (t > 0){\r\n t--;\r\n scanf(\"%d\", &k);\r\n if (k == 0 || k == 100){\r\n printf(\"%d\\n\", one);\r\n }\r\n else {\r\n kWater = 100 - k;\r\n if (k > kWater){\r\n divisor = kWater;\r\n }\r\n else {\r\n divisor = k;\r\n }\r\n while (k % divisor != 0 && kWater % divisor != 0){\r\n divisor--;\r\n }\r\n\r\n out = k/divisor + kWater/divisor;\r\n printf(\"%d\\n\", out);\r\n }\r\n }\r\n return 0;\r\n};"}, {"source_code": "#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n\r\nint main(){\r\n\tint tt;\r\n\tscanf(\"%d\", &tt);\r\n\twhile(tt--){\r\n\t\tint n, ans = 0;\r\n\t\tscanf(\"%d\", &n);\r\n\t\tint a = n;\r\n\t\tif(100 % a != 0 || a < 11) ans = 100;\r\n\t\telse{\r\n\t\t\tint a1 = a;\r\n\t\t\tans = 1;\r\n\t\t\twhile(a != 100){\r\n\t\t\t\ta += a1;\r\n\t\t\t\tans++;\r\n\t\t\t}\r\n\t\t}\r\n\t\tprintf(\"%d\\n\", ans);\r\n\t}\r\n\treturn 0;\r\n}"}, {"source_code": "#include \r\nint main()\r\n{\r\n int t,n;\r\n scanf(\"%d\",&t);\r\n while (t--)\r\n {\r\n scanf(\"%d\",&n);\r\n if(100%n==0) printf(\"%d\\n\",100/n);\r\n else printf(\"100\\n\");\r\n }\r\n \r\n }\r\n "}, {"source_code": "#include \r\n\r\nint main()\r\n{\r\n int t,i,k,ans;\r\n scanf(\"%d\",&t);\r\n for(i=0;i\r\nmain()\r\n{\r\n int n,t,s;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n scanf(\"%d\",&n);\r\n s=100;\r\n while(n!=s)\r\n {\r\n if(n>s)\r\n n=n-s;\r\n else\r\n s=s-n;\r\n }\r\n printf(\"%d\",100/n);\r\n }\r\n}"}, {"source_code": "#include\r\nint main()\r\n{\r\n\tint t,i,j,k;\r\n\tscanf(\"%d\",&t);\r\n\tfor(i=0;i\r\n#include\r\n#include\r\nint main()\r\n{ int test,i,a[110];\r\nscanf(\"%d\",&test);\r\nfor( i=0;i\r\n#include\r\nint main()\r\n{\r\nint t;\r\nscanf(\"%d\",&t);\r\nwhile(t--)\r\n{\r\nint n,k;\r\nscanf(\"%d\",&n);\r\nif(100%n==0)\r\n{\r\nprintf(\"%d\\n\",100/n);\r\n}\r\nif(100%n!=0)\r\n{\r\nprintf(\"%d\\n\",100);\r\n}\r\n}\r\n\r\n return 0;\r\n}"}, {"source_code": "#include \r\n\r\n// Function that checks whether a passed floating point value is actaully a MATHEMATICAL INT Form: !2.00000\r\nint isInteger(float value){\r\n int truncated = (int)value;\r\n if(truncated==value){\r\n return 1;\r\n }\r\n else{\r\n return 0;\r\n }\r\n}\r\n\r\nint main()\r\n{\r\n int t;\r\n int k[100];\r\n\r\n // Input For Number Of Test Cases\r\n scanf(\"%d\", &t);\r\n\r\n // Inputs of the Magic Essence Content\r\n for(int i=0; i\n#include \n\nint main()\n{\n int i, o, j[100],p,k,q,s, m;\n scanf(\"%d\", &i);\n for(p =0 ; p\r\n\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t-->0)\r\n {\r\n int k;\r\n scanf(\"%d\",&k);\r\n if(100%k==0 || 100%(100-k)==0)\r\n {\r\n if(100%k==0)\r\n printf(\"%d\\n\",100/k);\r\n else\r\n printf(\"%d\\n\",100/(100-k));\r\n }\r\n else\r\n printf(\"100\\n\");\r\n }\r\n return 0;\r\n}\r\n"}, {"source_code": "#include \r\n#include \r\n#include \r\n#include \r\n\r\nvoid calc(int k)\r\n{\r\n int x = 100 % k;\r\n int answer;\r\n\r\n if (x == 0)\r\n {\r\n answer = 100 / k;\r\n }\r\n else\r\n {\r\n answer = 100;\r\n }\r\n printf(\"%d\\n\", answer);\r\n}\r\n\r\nint main()\r\n{\r\n int t;\r\n int k;\r\n scanf(\"%d\", &t);\r\n for (int i = 0; i < t; i++)\r\n {\r\n scanf(\"%d\",&k);\r\n calc(k);\r\n }\r\n}"}, {"source_code": "#include\r\n\r\nint main() {\r\n int t;\r\n scanf(\"%d\", &t);\r\n while(t--) {\r\n int k, tp;\r\n scanf(\"%d\", &k);\r\n /* if(100%k == 0) {\r\n int tp = 100/k;\r\n }\r\n else {\r\n tp = 100;\r\n } */\r\n tp=(100%k==0)?100/k:100;\r\n printf(\"%d\\n\", tp);\r\n }\r\n}"}, {"source_code": "#include \r\n#include \r\n#include \r\n#include \r\n\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\", &t);\r\n while (t--)\r\n {\r\n int k;\r\n int ans;\r\n scanf(\"%d\", &k);\r\n int l = 100 - k;\r\n if (k == 100 || l==100)\r\n {\r\n ans = 1;\r\n }\r\n if (k!=0 && l!=0 && k > l && k % l == 0)\r\n {\r\n ans = k / l + 1;\r\n }\r\n if (k!=0 && l!=0 && k < l && l % k == 0)\r\n {\r\n ans = l / k + 1;\r\n }\r\n else\r\n {\r\n ans = 100;\r\n }\r\n printf(\"%d\\n\", ans);\r\n }\r\n\r\n return 0;\r\n}"}, {"source_code": "\r\n\r\nint find(int x,int y){\r\n\tif(x\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n int k,a;\r\n scanf(\"%d\",&k);\r\n if(100%k==0&&k>0)\r\n {\r\n a=100/k;\r\n printf(\"%d\\n\",a);\r\n }\r\n else if(100%k!=0&&k%2==0){\r\n int f=1;\r\n int x=0,y=0;\r\n x=k;\r\n y=100-k;\r\n while(f!=0)\r\n {\r\n if(x%2==0&&y%2==0)\r\n {\r\n x=x/2;\r\n y=y/2;\r\n f=1;\r\n }\r\n else{\r\n a=x+y;\r\n f=0;\r\n printf(\"%d\\n\",a);\r\n break;\r\n }\r\n }\r\n }\r\n else{\r\n a=100;\r\n printf(\"%d\\n\",a);\r\n }\r\n }\r\n }"}, {"source_code": "#include \r\nint solution(int n);\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while (t--)\r\n {\r\n int n;\r\n scanf(\"%d\",&n);\r\n solution(n);\r\n }\r\n return 0;\r\n}\r\nint solution(int n)\r\n{\r\n if (100%n==0)\r\n {\r\n printf(\"%d\\n\",(100/n));\r\n return 0;\r\n }\r\n else\r\n {\r\n int k1=n;\r\n int k2=(100-n);\r\n while (k1%2==0 && k2%2==0)\r\n {\r\n k1=k1/2;\r\n k2=k2/2;\r\n }\r\n printf(\"%d\\n\",(k1+k2));\r\n return 0;\r\n }\r\n return 0;\r\n}"}, {"source_code": "#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n\r\nint main(){\r\n\tint tt;\r\n\tscanf(\"%d\", &tt);\r\n\twhile(tt--){\r\n\t\tint n, ans = 0;\r\n\t\tscanf(\"%d\", &n);\r\n\t\tint a = n;\r\n\t\tif(100 % a != 0 || a < 11) ans = 100;\r\n\t\telse{\r\n\t\t\tint a1 = a;\r\n\t\t\tans = 1;\r\n\t\t\twhile(a != 100){\r\n\t\t\t\ta += a1;\r\n\t\t\t\tans++;\r\n\t\t\t}\r\n\t\t}\r\n\t\tprintf(\"%d\\n\", ans);\r\n\t}\r\n\treturn 0;\r\n}"}, {"source_code": "#include\r\nint main()\r\n{\r\n int t,n,k;\r\n scanf(\"%d\",&t);\r\n int i;\r\n for(i=1;i<=t;i++)\r\n {\r\n scanf(\"%d\",&n);\r\n if(100%n==0)\r\n {\r\n k=100/n;\r\n printf(\"%d\\n\",k);\r\n }\r\n else\r\n {\r\n printf(\"100\\n\");\r\n }\r\n }\r\n return 0;\r\n}\r\n"}, {"source_code": "#include\r\n\r\nint main()\r\n{\r\n\tint t;\r\n\tscanf(\"%d\", &t);\r\n\t\r\n\twhile(t--)\r\n\t{\r\n\t\tint k;\r\n\t\tscanf(\"%d\", &k);\r\n\t\tif(100 % k == 0) printf(\"%d\\n\", 100/k);\r\n\t\telse printf(\"100\\n\");\r\n\t}\r\n}"}, {"source_code": "#include\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n int k,p,cnt=1,m;\r\n int q;\r\n scanf(\"%d\",&k);\r\n if(k==100)\r\n {\r\n printf(\"1\\n\");\r\n continue;\r\n }\r\n int n=100-k;\r\n if(n<=k)\r\n {\r\n p=k;\r\n k=n;\r\n n=p;\r\n }\r\n \r\n if(n%k==0)\r\n {\r\n q=n/k;\r\n printf(\"%d\\n\",q+1);\r\n continue;\r\n }\r\n if((n%k!=0) && (k%2==0))\r\n {\r\n while(k%2==0)\r\n {\r\n k=k/2;\r\n cnt=cnt*2;\r\n }\r\n m=n/cnt;\r\n printf(\"%d\\n\",m+k);\r\n continue;\r\n }\r\n printf(\"100\\n\");\r\n \r\n }\r\n}"}, {"source_code": "#include\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n int k,a;\r\n scanf(\"%d\",&k);\r\n if(100%k==0&&k>0)\r\n {\r\n a=100/k;\r\n printf(\"%d\\n\",a);\r\n }\r\n else{\r\n a=100;\r\n printf(\"%d\\n\",a);\r\n }\r\n }\r\n}"}, {"source_code": "#include\r\nint main()\r\n{\r\n int t,i,n,k;\r\n scanf(\"%d\",&t);\r\n\r\n for(i=1;i<=t;i++)\r\n {\r\n scanf(\"%d\",&n);\r\n if(100%n==0) printf(\"%d\\n\",100/n);\r\n else printf(\"100\\n\");\r\n }\r\n\r\n return 0;\r\n}\r\n"}, {"source_code": "#include \r\nint gcd(int a, int b) {\r\n\treturn a % b == 0 ? b : gcd(b, a % b);\r\n}\r\nint t, k;\r\nint main(void){\r\n\r\n\tscanf(\"%d\", &t);\r\n\t\r\n\t\twhile(t--){\r\n\t\t\tscanf(\"%d\", &k);\r\n\t\t\tint a = 100 - k;\r\n\t\t\tint b = k;\r\n\t\t\tif(k % 2 == 0) {\r\n\t\t\t\tprintf(\"%d\\n\", 100 / gcd(100, k));\r\n\t\t\t} else {\r\n\t\t\t\tprintf(\"%d\\n\", 100);\r\n\t\t\t}\r\n\t\t}\r\n\treturn 0;\r\n}"}, {"source_code": "#include\r\nint main()\r\n{\r\n int t,n,k;\r\n scanf(\"%d\",&t);\r\n int i;\r\n for(i=1;i<=t;i++)\r\n {\r\n scanf(\"%d\",&n);\r\n if(100%n==0)\r\n {\r\n k=100/n;\r\n printf(\"%d\\n\",k);\r\n }\r\n else\r\n {\r\n printf(\"100\\n\");\r\n }\r\n }\r\n return 0;\r\n}\r\n"}, {"source_code": "#include\r\nint main()\r\n{\r\n\tint t,i,j,k;\r\n\tscanf(\"%d\",&t);\r\n\tfor(i=0;i\r\n#include \r\n#include \r\n#include \r\n#include \r\n\r\nint main(){\r\n\tint t;\r\n\tscanf(\"%d\", &t);\r\n\twhile(t--){\r\n\t\tint n;\r\n\t\tscanf(\"%d\", &n);\r\n\t\tdouble a, b;\r\n\t\ta = n;\r\n\t\tb = 100 - n;\r\n\t\ta /= 100;\r\n\t\tb /= 100;\r\n\t\tdouble temp1 = a, temp2 = b;\r\n\t\tint ans = 1;\r\n\t\twhile((a-(int)a != 0) && (b-(int)b != 0)){\r\n\t\t\t++ans;\r\n\t\t\tif(ans == 100) break;\r\n\t\t\ta += temp1;\r\n\t\t\tb += temp2;\r\n\t\t}\r\n\t\tprintf(\"%d\\n\", ans);\r\n\t}\r\n\treturn 0;\r\n}"}, {"source_code": "#include \r\n#include \r\n#include \r\n#include \r\n\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\", &t);\r\n while (t--)\r\n {\r\n int k;\r\n int ans;\r\n scanf(\"%d\", &k);\r\n int l = 100 - k;\r\n if (k == 100 || l==100)\r\n {\r\n ans = 1;\r\n }\r\n if (k!=0 && l!=0 && k > l && k % l == 0)\r\n {\r\n ans = k / l + 1;\r\n }\r\n if (k!=0 && l!=0 && k < l && l % k == 0)\r\n {\r\n ans = l / k + 1;\r\n }\r\n else if ((k!=0 && l!=0) && (k%l!=0 )&& (l % k != 0))\r\n {\r\n ans = 100;\r\n }\r\n \r\n \r\n printf(\"%d\\n\", ans);\r\n }\r\n\r\n return 0;\r\n}"}, {"source_code": "#include \r\nint main() {\r\n int t, k, kWater, out, divisor;\r\n scanf(\"%d\", &t);\r\n while (t > 0){\r\n scanf(\"%d\", &k);\r\n kWater = 100 - k;\r\n if (k == 0 || kWater == 0){\r\n printf(\"%d\", 1);\r\n }\r\n else {\r\n if (k > kWater){\r\n divisor = kWater;\r\n }\r\n else {\r\n divisor = k;\r\n }\r\n while (k % divisor !=0 || kWater % divisor !=0){\r\n divisor--;\r\n }\r\n out = k/divisor + kWater/divisor;\r\n }\r\n printf(\"%d\\n\", out);\r\n t--;\r\n }\r\n return 0;\r\n};"}, {"source_code": "#include \r\n\r\nint main(){\r\n int t;\r\n scanf(\"%d\",&t);\r\n for(int i=0;ik2){\r\n k=k1;\r\n k1=k2;\r\n k2=k;\r\n }\r\n for(int j=k1;j>0;j--){\r\n if(k1%j==0 && k2%j==0){\r\n printf(\"%d\",(k1+k2)/j);\r\n break;\r\n }\r\n }\r\n }\r\n return 0;\r\n}"}, {"source_code": "#include\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n int k,a;\r\n scanf(\"%d\",&k);\r\n if(100%k==0&&k>0)\r\n {\r\n a=100/k;\r\n printf(\"%d\\n\",a);\r\n }\r\n else if(100%k!=0&&k%2==0){\r\n int f=1;\r\n int x=0,y=0;\r\n x=k;\r\n y=100-k;\r\n while(f!=0)\r\n {\r\n if(x%2==0&&y%2==0)\r\n {\r\n x=x/2;\r\n y=y/2;\r\n }\r\n else{\r\n a=x+y;\r\n f=0;\r\n break;\r\n }\r\n printf(\"%d\\n\",a);\r\n }\r\n }\r\n else{\r\n a=100;\r\n printf(\"%d\\n\",a);\r\n }\r\n }\r\n }"}, {"source_code": "#include \r\nint solution(int n);\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while (t--)\r\n {\r\n int n;\r\n scanf(\"%d\",&n);\r\n solution(n);\r\n }\r\n return 0;\r\n}\r\nint solution(int n)\r\n{\r\n if (100%n==0)\r\n {\r\n printf(\"%d\\n\",(100/n));\r\n return 0;\r\n }\r\n else if (100%n!=0)\r\n {\r\n printf(\"%d\\n\",100);\r\n return 0;\r\n }\r\n return 0;\r\n}"}, {"source_code": "#include\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n int k,a;\r\n scanf(\"%d\",&k);\r\n if(100%k==0&&k>0)\r\n {\r\n a=100/k;\r\n printf(\"%d\\n\",a);\r\n }\r\n else if(100%k!=0&&k%2==0){\r\n int f=1;\r\n int x=0,y=0;\r\n x=k;\r\n y=100-k;\r\n while(f!=0)\r\n {\r\n if(x%2==0&&y%2==0)\r\n {\r\n x=x/2;\r\n y=y/2;\r\n }\r\n else{\r\n a=x+y;\r\n f=0;\r\n break;\r\n }\r\n printf(\"%d\\n\",a);\r\n }\r\n }\r\n else{\r\n a=100;\r\n printf(\"%d\\n\",a);\r\n }\r\n }\r\n }"}, {"source_code": "#include\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n int k,a;\r\n scanf(\"%d\",&k);\r\n if(100%k==0&&k>0)\r\n {\r\n a=100/k;\r\n printf(\"%d\\n\",a);\r\n }\r\n else if(100%k!=0&&k%2==0){\r\n int f=1;\r\n int x=0,y=0;\r\n x=k;\r\n y=100-k;\r\n while(f!=0)\r\n {\r\n if(x%2==0&&y%2==0)\r\n {\r\n x=x/2;\r\n y=y/2;\r\n f=1;\r\n }\r\n else{\r\n a=x+y;\r\n f=0;\r\n printf(\"%d\\n\",a);\r\n break;\r\n }\r\n }\r\n }\r\n else{\r\n a=100;\r\n printf(\"%d\\n\",a);\r\n }\r\n }\r\n }"}, {"source_code": "#include \r\n#include \r\n\r\nint main(){\r\n int t,k,i,move;\r\n double ratio,x;\r\n scanf(\"%d\",&t);\r\n while(t--){\r\n scanf(\"%d\",&k);\r\n if(k==50){\r\n move=2;\r\n }\r\n else if(k==100){\r\n move=1;\r\n }\r\n else if(k<50){\r\n ratio=(100.0/k)-1;\r\n if((int)ratio==ratio){\r\n move=ratio+1;\r\n }\r\n else{\r\n i=2;\r\n x=ratio;\r\n //printf(\"%lf\\n\",x);\r\n while((int)x!=x){\r\n x=ratio*i;\r\n i=i+1;\r\n }\r\n //printf(\"%d\\n\",i);\r\n move=x+i-1;\r\n }\r\n //printf(\"%d\\n\",move);\r\n }\r\n else{\r\n ratio=(k*1.0)/(100-k);\r\n if((int)ratio==ratio){\r\n move=ratio+1;\r\n }\r\n else{\r\n i=2;\r\n x=ratio;\r\n while((int)x!=x){\r\n x=ratio*i;\r\n i=i+1;\r\n }\r\n move=x+i-1;\r\n }\r\n }\r\n printf(\"%d\\n\",move);\r\n }\r\nreturn 0;\r\n}\r\n"}, {"source_code": "#include\nint gcd(int k, int water)\n{\n if (k == 0)\n return water;\n return gcd(water%k, k);\n}\nvoid calculate()\n{\n int k,water,g,steps;\n scanf(\"%d\",&k);\n water = 100-k;\n g = gcd(k,water);\n k = k/g;\n water = water/g;\n steps = k+water;\n printf(\"%d\",steps);\n}\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n for(int i=1; i<=t;i++)\n calculate();\n return 0;\n}"}, {"source_code": "#include\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n int k;\r\n scanf(\"%d\",&k);\r\n if((k%2!=0) && (100%k!=0))\r\n {\r\n printf(\"100\\n\");\r\n continue;\r\n }\r\n int b=100-k;\r\n int d=k;\r\n if(100%k!=0)\r\n {\r\n while(d%2==0 && (b%2==0))\r\n {\r\n d=d/2;\r\n b=b/2;\r\n }\r\n printf(\"%d\\n\",b+d);\r\n continue;\r\n }\r\n int l=100/k;\r\n printf(\"%d\\n\",l);\r\n }\r\n}"}, {"source_code": "#include \r\n \r\n \r\ntypedef long long ll;\r\n \r\n \r\nll FindGCD(ll n1, ll n2)\r\n{\r\n // if user enters negative number, sign of the number is changed to positive\r\n n1 = ( n1 > 0) ? n1 : -n1;\r\n n2 = ( n2 > 0) ? n2 : -n2;\r\n \r\n if(n1==100||n2==100)\r\n {\r\n return 100;\r\n }\r\n \r\n \r\n while(n1!=n2)\r\n {\r\n if(n1 > n2)\r\n n1 -= n2;\r\n else\r\n n2 -= n1;\r\n }\r\n return n1;\r\n}\r\n \r\n \r\n \r\nint main()\r\n{\r\n ll T, k, kc;\r\n \r\n scanf(\"%lld\",&T);\r\n \r\n while(T>0)\r\n {\r\n scanf(\"%lld\",&k);\r\n kc=FindGCD(k,100-k);\r\n printf(\"%lld\",((k/kc)+((100-k)/kc)));\r\n \r\n T--;\r\n }\r\n return 0;\r\n}\r\n"}, {"source_code": "#include\nint gcd(int k, int water)\n{\n if (k == 0)\n return water;\n return gcd(water%k, k);\n}\nvoid calculate()\n{\n int k,water,g,steps;\n scanf(\"%d\",&k);\n water = 100-k;\n g = gcd(k,water);\n k = k/g;\n water = water/g;\n steps = k+water;\n printf(\"%d\",steps);\n}\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n for(int i=1; i<=t;i++)\n calculate();\n return 0;\n}"}, {"source_code": "#include \r\nint main()\r\n{\r\n int t,n;\r\n scanf(\"%d\",&t);\r\n while (t--)\r\n {\r\n scanf(\"%d\",&n);\r\n if(100%n==0) printf(\"%d\\n\",100/n);\r\n else printf(\"100\\n\");\r\n }\r\n \r\n }\r\n "}, {"source_code": "#include\r\nint main()\r\n{\r\n int t, k;\r\n scanf(\"%d\", &t);\r\n while (t--)\r\n {\r\n scanf(\"%d\", &k);\r\n if(100%k==0) printf(\"%d\\n\",100/k);\r\n else printf(\"100\\n\");\r\n }\r\n return 0;\r\n}"}, {"source_code": "#include\r\n\r\nint main()\r\n{\r\n\tint t;\r\n\tscanf(\"%d\",&t);\r\n\twhile(t--)\r\n\t{\r\n\t\tint n;\r\n\t\tscanf(\"%d\",&n);\r\n\t\t\r\n\t\tif(n==100)\r\n\t\t{\r\n\t\t\tprintf(\"1\\n\");\r\n\t\t}\r\n\t\telse{\r\n\t\t\tfloat p1=100-n;\r\n\t\t\tfloat p2=n;\r\n\t\t\tint f1=p1/p2;\r\n\t\t\tfloat f2=p1/p2;\r\n\t\t\tif(f1==f2)\r\n\t\t\t{\r\n\t\t\t\tint r=f1+1;\r\n\t\t\t\tprintf(\"%d\\n\",r);\t\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tint r=p1+n;\r\n\t\t\t\tprintf(\"%d\\n\",r);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t}\r\n}"}, {"source_code": "#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n\r\nint main(){\r\n\tint tt;\r\n\tscanf(\"%d\", &tt);\r\n\twhile(tt--){\r\n\t\tint k, ans = 0, tt = 0;\r\n\t\tscanf(\"%d\", &k);\r\n\t\tint l;\r\n\t\tif(100 % k == 0){\r\n\t\t\tl = k;\r\n\t\t}else{\r\n\t\t\tl = 1;\r\n\t\t}\r\n\t\twhile(tt != 100){\r\n\t\t\tans++;\r\n\t\t\ttt += l;\r\n\t\t}\r\n\t\tprintf(\"%d\\n\", ans);\r\n\t}\r\n\treturn 0;\r\n}"}, {"source_code": "#include\r\nint gcd(int a,int b){\r\nif(a==0) return b;\r\nelse return gcd(b%a,a);\r\n}\r\nint main(){\r\nint n;\r\nscanf(\"%d\",&n);\r\nfor(int i=0;i\r\n#include\r\n#include\r\n#include\r\n#include\r\nvoid input(int ar[],int n)\r\n{\r\n for(int i=0;ib)\r\n return a;\r\n return b;\r\n}\r\nint gcd(int a,int b)\r\n{\r\n for(int i=small(a,b);i>=1;i--)\r\n if(great(a,b)%i==0)\r\n return i;\r\n return 1;\r\n}\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n for(int l=0;l\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n int k;\r\n scanf(\"%d\",&k);\r\n if(100%k==0)\r\n {\r\n printf(\"%d\\n\",100/k);\r\n }\r\n else\r\n {\r\n printf(\"%d\\n\",100);\r\n }\r\n }\r\n}\r\n"}, {"source_code": "#include \r\n#include \r\nint main()\r\n{\r\n int essence, T, remainder;\r\n scanf(\"%d\", &T);\r\n\r\n while(T--)\r\n {\r\n scanf(\"%d\", &essence);\r\n if(100 % essence == 0)\r\n {\r\n remainder = 100/essence;\r\n printf(\"%d\\n\", remainder);\r\n }\r\n else\r\n {\r\n printf(\"100\\n\");\r\n }\r\n }\r\n return 0;\r\n}\r\n"}, {"source_code": "#include\r\nint main()\r\n{\r\n int t, k;\r\n scanf(\"%d\", &t);\r\n\r\n for(int i = 1; i <= t; i++)\r\n {\r\n scanf(\"%d\", &k);\r\n if((100 - k) % k != 0 && k != 100 && k != 0)\r\n {\r\n printf(\"100\\n\");\r\n }\r\n if((100 - k) % k == 0 && k != 100 && k != 0)\r\n {\r\n printf(\"%d\\n\", ((100 - k) / k) + 1);\r\n }\r\n if(k == 100 || k == 0)\r\n {\r\n printf(\"1\\n\");\r\n }\r\n }\r\n\r\n \r\n\r\n return 0;\r\n}"}, {"source_code": "#include\r\n#include\r\n#include\r\n#include\r\n#include\r\nvoid input(int ar[],int n)\r\n{\r\n for(int i=0;ib)\r\n return a;\r\n return b;\r\n}\r\nint gcd(int a,int b)\r\n{\r\n for(int i=small(a,b);i>=1;i--)\r\n if(great(a,b)%i==0)\r\n return i;\r\n return 1;\r\n}\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n for(int l=0;l\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while (t--)\r\n {int a,b;\r\n scanf(\"%d\",&a);\r\n b=100-a;\r\n int i=2;\r\n if(b==0) printf (\"1\\n\");\r\n \r\n else{\r\n while (i\r\nint gcd(int a,int b)\r\n{\r\n if(b==0)return a;\r\n else return (a%b,a);\r\n}\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n int k;\r\n scanf(\"%d\",&k);\r\n printf(\"%d\\n\",100/gcd(k,100));\r\n }\r\n}\r\n\r\n"}, {"source_code": "#include \r\n\r\nint main()\r\n{\r\n int t,i,k,ans;\r\n scanf(\"%d\",&t);\r\n for(i=0;i\r\nint main()\r\n{\r\n int t, k;\r\n scanf(\"%d\", &t);\r\n\r\n for(int i = 1; i <= t; i++)\r\n {\r\n scanf(\"%d\", &k);\r\n if((100 - k) % k != 0 && k != 100 && k != 0)\r\n {\r\n printf(\"100\\n\");\r\n }\r\n if((100 - k) % k == 0 && k != 100 && k != 0)\r\n {\r\n printf(\"%d\\n\", ((100 - k) / k) + 1);\r\n }\r\n if(k == 100 || k == 0)\r\n {\r\n printf(\"1\\n\");\r\n }\r\n }\r\n\r\n \r\n\r\n return 0;\r\n}"}, {"source_code": "#include\r\nint main()\r\n{\r\nint t;\r\nscanf(\"%d\",&t);\r\nwhile(t--)\r\n{\r\nint k,p;\r\nscanf(\"%d\",&k);\r\nif((100-k)%k==0)\r\n p=1+(100-k)/k;\r\nelse\r\n p=100;\r\nprintf(\"%d\\n\",p);\r\n}\r\nreturn 0;\r\n}"}, {"source_code": "#include \r\nint main()\r\n{\r\n int testcases;\r\n scanf(\"%d\", &testcases);\r\n //printf(\"%d\", testcases);\r\n while (testcases > 0)\r\n {\r\n int percent;\r\n scanf(\"%d\", &percent);\r\n int cpy = percent;\r\n int ans = 100;\r\n while (cpy % 5 == 0)\r\n {\r\n cpy /= 5;\r\n ans /= 5;\r\n }\r\n while (cpy % 2 == 0)\r\n {\r\n cpy /= 2;\r\n ans /= 2;\r\n }\r\n printf(\"%d\\n\", ans);\r\n testcases--;\r\n }\r\n return 0;\r\n}"}, {"source_code": "#include\r\nint main()\r\n{\r\n\tint t,i,j,k;\r\n\tscanf(\"%d\",&t);\r\n\tfor(i=0;i\r\nint main()\r\n{\r\n int n;\r\n scanf(\"%d\", &n);\r\n while (n--)\r\n {\r\n int m;\r\n scanf(\"%d\", &m);\r\n if(100%m == 0)\r\n {\r\n printf(\"%d\\n\", 100/m);\r\n }\r\n else printf(\"100\\n\");\r\n }\r\n return 0;\r\n}"}, {"source_code": "#include \r\nint potionMaking(int k)\r\n{ int l;\r\n if(100%k==0)l=100/k;\r\n else l=100;\r\n printf(\"%d\\n\",l);\r\n return 0;\r\n}\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n for(int i=0;i\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n int k,a;\r\n scanf(\"%d\",&k);\r\n if(100%k==0&&k>0)\r\n {\r\n a=100/k;\r\n printf(\"%d\\n\",a);\r\n }\r\n else if(100%k!=0&&k%2==0){\r\n int f=1;\r\n int x=0,y=0;\r\n x=k;\r\n y=100-k;\r\n while(f!=0)\r\n {\r\n if(x%2==0&&y%2==0)\r\n {\r\n x=x/2;\r\n y=y/2;\r\n f=1;\r\n }\r\n else{\r\n a=x+y;\r\n f=0;\r\n printf(\"%d\\n\",a);\r\n break;\r\n }\r\n }\r\n }\r\n else{\r\n a=100;\r\n printf(\"%d\\n\",a);\r\n }\r\n }\r\n }"}, {"source_code": "#include \r\nint gcd(int a, int b) {\r\n\treturn a % b == 0 ? b : gcd(b, a % b);\r\n}\r\nint t, k;\r\nint main(void){\r\n\r\n\tscanf(\"%d\", &t);\r\n\t\r\n\t\twhile(t--){\r\n\t\t\tscanf(\"%d\", &k);\r\n\t\t\tint a = 100 - k;\r\n\t\t\tint b = k;\r\n\t\t\tif(k % 2 == 0) {\r\n\t\t\t\tprintf(\"%d\\n\", 100 / gcd(100, k));\r\n\t\t\t} else {\r\n\t\t\t\tprintf(\"%d\\n\", 100);\r\n\t\t\t}\r\n\t\t}\r\n\treturn 0;\r\n}"}, {"source_code": "#include \r\nint main()\r\n{\r\n int testcases;\r\n scanf(\"%d\", &testcases);\r\n //printf(\"%d\", testcases);\r\n while (testcases > 0)\r\n {\r\n int percent;\r\n scanf(\"%d\", &percent);\r\n int cpy = percent;\r\n int ans = 100;\r\n while (cpy % 5 == 0)\r\n {\r\n cpy /= 5;\r\n ans /= 5;\r\n }\r\n while (cpy % 2 == 0)\r\n {\r\n cpy /= 2;\r\n ans /= 2;\r\n }\r\n printf(\"%d\\n\", ans);\r\n testcases--;\r\n }\r\n return 0;\r\n}"}, {"source_code": "#include \r\n//using namespace std;\r\n\r\nint main() {\r\n\t// your code goes here\r\n\tint t;\r\n\tscanf(\"%d\",&t);\r\n\twhile(t--)\r\n\t{\r\n\t int k;\r\n\t scanf(\"%d\",&k);\r\n\t if(100%k==0)\r\n\t {\r\n\t printf(\"%d\\n\",(100/k));\r\n\t }\r\n\t else\r\n\t {\r\n\t printf(\"%d\\n\",(100));\r\n\t }\r\n\t}\r\n\treturn 0;\r\n}\r\n"}, {"source_code": "#include \r\n\r\nint gcd(a,b)\r\n{\r\n if(b==0) return a; \r\n return gcd(b,a%b);\r\n}\r\n\r\nint main(){\r\n\r\nint i,t,k,g,ans;\r\n\r\nscanf(\"%i\",&t);\r\n\r\nfor(i-0;i\r\n#include\r\n#include\r\n\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--){\r\n int k,sum=0;\r\n scanf(\"%d\",&k);\r\n if(100%k==0)\r\n sum=100/k;\r\n else\r\n sum=100;\r\n printf(\"%d\\n\",sum);\r\n\r\n }\r\n return 0;\r\n}\r\n"}, {"source_code": "#include \r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while (t--)\r\n {int a,b;\r\n scanf(\"%d\",&a);\r\n b=100-a;\r\n int i=2;\r\n if(b==0) printf (\"1\\n\");\r\n \r\n else{\r\n while (i\r\n#include\r\n#include\r\n\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--){\r\n int k,sum=0;\r\n scanf(\"%d\",&k);\r\n if(100%k==0)\r\n sum=100/k;\r\n else\r\n sum=100;\r\n printf(\"%d\\n\",sum);\r\n\r\n }\r\n return 0;\r\n}\r\n"}, {"source_code": "#include \r\n#include \r\nint main()\r\n{\r\n int essence, T, remainder;\r\n scanf(\"%d\", &T);\r\n\r\n while(T--)\r\n {\r\n scanf(\"%d\", &essence);\r\n if(100 % essence == 0)\r\n {\r\n remainder = 100/essence;\r\n printf(\"%d\\n\", remainder);\r\n }\r\n else\r\n {\r\n printf(\"100\\n\");\r\n }\r\n }\r\n return 0;\r\n}\r\n"}, {"source_code": "#include\r\nint main()\r\n{\r\n int t,n,k;\r\n scanf(\"%d\",&t);\r\n int i;\r\n for(i=1;i<=t;i++)\r\n {\r\n scanf(\"%d\",&n);\r\n if(100%n==0)\r\n {\r\n k=100/n;\r\n printf(\"%d\\n\",k);\r\n }\r\n else\r\n {\r\n printf(\"100\\n\");\r\n }\r\n }\r\n return 0;\r\n}\r\n"}, {"source_code": "#include \r\n#include \r\n#include \r\n#include \r\n\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\", &t);\r\n while (t--)\r\n {\r\n int k;\r\n int ans;\r\n scanf(\"%d\", &k);\r\n int l = 100 - k;\r\n if (k == 100 || l==100)\r\n {\r\n ans = 1;\r\n }\r\n if (k!=0 && l!=0 && k > l && k % l == 0)\r\n {\r\n ans = k / l + 1;\r\n }\r\n if (k!=0 && l!=0 && k < l && l % k == 0)\r\n {\r\n ans = l / k + 1;\r\n }\r\n else\r\n {\r\n ans = 100;\r\n }\r\n printf(\"%d\\n\", ans);\r\n }\r\n\r\n return 0;\r\n}"}, {"source_code": "#include\r\n#include\r\n#include\r\nint main()\r\n{ int test,i,a[110];\r\nscanf(\"%d\",&test);\r\nfor( i=0;i\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n int n;\r\n scanf(\"%d\",&n);\r\n int x=n;\r\n int y=100-n;\r\n if(x!=100 || y!=100)\r\n {\r\n x=1;\r\n y=0;\r\n }\r\n else if(x>y)\r\n {\r\n for(int i=2;i<=y;i++)\r\n {\r\n while(y%i==0 &x%i==0)\r\n {\r\n y=y/i;\r\n x=x/i;\r\n }\r\n }\r\n }\r\n else if(x\r\nint main()\r\n{\r\n int t,n;\r\n scanf(\"%d\",&t);\r\n while (t--)\r\n {\r\n scanf(\"%d\",&n);\r\n if(100%n==0) printf(\"%d\\n\",100/n);\r\n else printf(\"100\\n\");\r\n }\r\n \r\n }\r\n "}, {"source_code": "#include\r\n#include\r\n#include\r\n#include\r\ntypedef long double LD;\r\ntypedef long long ll;\r\n#define int ll\r\n#define pb push_back\r\n#define mp make_pair\r\n#define REP(i,n) for (int i = 0; i < n; i++)\r\n#define FOR(i,a,b) for (int i = a; i < b; i++)\r\n#define REPD(i,n) for (int i = n-1; i >= 0; i--)\r\n#define FORD(i,a,b) for (int i = a; i >= b; i--)\r\n// ----------\r\n#define sfi(x) scanf(\"%d\",&x);\r\n#define sfi2(x,y) scanf(\"%d%d\",&x,&y);\r\n#define sfi3(x,y,z) scanf(\"%d%d%d\",&x,&y,&z);\r\n\r\n#define sfl(x) scanf(\"%lld\",&x);\r\n#define sfl2(x,y) scanf(\"%lld%lld\",&x,&y);\r\n#define sfl3(x,y,z) scanf(\"%lld%lld%lld\",&x,&y,&z);\r\n#define sfl4(x,y,z,x1) scanf(\"%lld%lld%lld%lld\",&x,&y,&z,&x1);\r\n#define sfl5(x,y,z,x1,y1) scanf(\"%lld%lld%lld%lld%lld\",&x,&y,&z,&x1,&y1);\r\n#define sfl6(x,y,z,x1,y1,z1) scanf(\"%lld%lld%lld%lld%lld%lld\",&x,&y,&z,&x1,&y1,&z1);\r\n\r\n#define sfs(x) scanf(\"%s\",x);\r\n#define sfs2(x,y) scanf(\"%s%s\",x,y);\r\n#define sfs3(x,y,z) scanf(\"%s%s%s\",x,y,z);\r\n// ---------\r\n\r\n// ---------\r\n#define pfi(x) printf(\"%d\\n\",x);\r\n#define pfi2(x,y) printf(\"%d %d\\n\",x,y);\r\n#define pfi3(x,y,z) printf(\"%d %d %d\\n\",x,y,z);\r\n\r\n#define pfl(x) printf(\"%lld\\n\",x);\r\n#define pfl2(x,y) printf(\"%lld %lld\\n\",x,y);\r\n#define pfl3(x,y,z) printf(\"%lld %lld %lld\\n\",x,y,z);\r\n\r\n#define pfs(x) printf(\"%s\\n\",x);\r\n#define pfs2(x,y) printf(\"%s %s\\n\",x,y);\r\n#define pfs3(x,y,z) printf(\"%s %s %s\\n\",x,y,z);\r\n\r\n#define pwe(x) printf(\"%lld \",x); // print without end\r\n// --------\r\nlong long a,b,c,d,e,t,i,j,n,m,row,col,change,x;\r\n\r\n\r\nint main()\r\n{\r\n\r\n sfl(t);\r\n while(t--)\r\n {\r\n sfl(n);\r\n if(n>50 && n!=100 )\r\n {\r\n if(100%(n-50)==0)\r\n {pfl(100/(n-50));\r\n\r\n }\r\n else\r\n pfi(100);\r\n }\r\n else\r\n {\r\n if(100%n==0)\r\n {\r\n pfl(100/n);\r\n }\r\n\r\n else\r\n {\r\n pfi(100);\r\n }\r\n }\r\n }\r\n\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"}, {"source_code": "#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n\r\nint main(){\r\n\tint t;\r\n\tscanf(\"%d\", &t);\r\n\twhile(t--){\r\n\t\tint n;\r\n\t\tscanf(\"%d\", &n);\r\n\t\tdouble a, b;\r\n\t\ta = n;\r\n\t\tb = 100 - n;\r\n\t\ta /= 100;\r\n\t\tb /= 100;\r\n\t\tdouble temp1 = a, temp2 = b;\r\n\t\tint ans = 1;\r\n\t\twhile((a-(int)a != 0) && (b-(int)b != 0)){\r\n\t\t\t++ans;\r\n\t\t\tif(ans == 100) break;\r\n\t\t\ta += temp1;\r\n\t\t\tb += temp2;\r\n\t\t}\r\n\t\tprintf(\"%d\\n\", ans);\r\n\t}\r\n\treturn 0;\r\n}"}, {"source_code": "#include\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n int k;\r\n scanf(\"%d\",&k);\r\n if((k%2!=0) && (100%k!=0))\r\n {\r\n printf(\"100\\n\");\r\n continue;\r\n }\r\n int l=100/k;\r\n printf(\"%d\\n\",l);\r\n }\r\n}"}, {"source_code": "#include\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n int k,a;\r\n scanf(\"%d\",&k);\r\n if(100%k==0&&k>0)\r\n {\r\n a=100/k;\r\n printf(\"%d\\n\",a);\r\n }\r\n else if(100%k!=0&&k%2==0){\r\n int f=1;\r\n int x=0,y=0;\r\n x=k;\r\n y=100-k;\r\n while(f!=0)\r\n {\r\n if(x%2==0&&y%2==0)\r\n {\r\n x=x/2;\r\n y=y/2;\r\n }\r\n else{\r\n a=x+y;\r\n f=0;\r\n break;\r\n }\r\n printf(\"%d\\n\",a);\r\n }\r\n }\r\n else{\r\n a=100;\r\n printf(\"%d\\n\",a);\r\n }\r\n }\r\n }"}, {"source_code": "#include\r\nint gcd(int a,int b){\r\nif(a==0) return b;\r\nelse return gcd(b%a,a);\r\n}\r\nint main(){\r\nint n;\r\nscanf(\"%d\",&n);\r\nfor(int i=0;i\n#include \n\nint main()\n{\n int i, o, j[100],p,k,q,s, m;\n scanf(\"%d\", &i);\n for(p =0 ; p\r\nint main()\r\n{\r\n int N, x;\r\n scanf(\"%d\", &N);\r\n for(int i=0;i\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n int k;\r\n scanf(\"%d\",&k);\r\n if((k%2!=0) && (100%k!=0))\r\n {\r\n printf(\"100\\n\");\r\n continue;\r\n }\r\n int l=100/k;\r\n printf(\"%d\\n\",l);\r\n }\r\n}"}, {"source_code": "#include \r\nint main()\r\n{\r\n int N, x;\r\n scanf(\"%d\", &N);\r\n for(int i=0;i\r\n\r\nint main() {\r\n int t;\r\n scanf(\"%d\", &t);\r\n\r\n int i = 0;\r\n while (i < t) {\r\n int k;\r\n scanf(\"%d\", &k);\r\n\r\n int water = 100 - k;\r\n\r\n if (water % k == 0) {\r\n water = water / k;\r\n k = k / k;\r\n }\r\n\r\n int steps = water + k;\r\n printf(\"%d\\n\", steps);\r\n i++;\r\n }\r\n\r\n return 0;\r\n}"}, {"source_code": "#include\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n int k;\r\n scanf(\"%d\",&k);\r\n if((k%2!=0) && (100%k!=0))\r\n {\r\n printf(\"100\\n\");\r\n continue;\r\n }\r\n int b=100-k;\r\n int d=k;\r\n if(100%k!=0)\r\n {\r\n while(d%2==0 && (b%2==0))\r\n {\r\n d=d/2;\r\n b=b/2;\r\n }\r\n printf(\"%d\\n\",b+d);\r\n continue;\r\n }\r\n int l=100/k;\r\n printf(\"%d\\n\",l);\r\n }\r\n}"}, {"source_code": "#include\r\nmain()\r\n{\r\n int n,t,s;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n scanf(\"%d\",&n);\r\n s=100;\r\n while(n!=s)\r\n {\r\n if(n>s)\r\n n=n-s;\r\n else\r\n s=s-n;\r\n }\r\n printf(\"%d\",100/n);\r\n }\r\n}"}, {"source_code": "#include \nint main(){\n\tint ti;\n\tscanf(\"%d\",&ti);\n\twhile(ti--){\n\t\tint n=0;\n\t\tscanf(\"%d\",&n);\n\t\tint time;\n\t\tif(100%n==0){\n\t\t\ttime=100/n;\n\t\t}else{\n\t\t\t//找最大公因数 \n\t\t\t//判断基数 \n\t\t\tint gong=1;\n\t\t\tfor(int i=n;i>1;i--){\n\t\t\t\tif((n%i==0&&100%i==0)){ \n\t\t\t\t\tgong=i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} \n\t\t\tint ti = n;\n\t\t\tint b=100;\n\t\t\tif(gong!=1){\n\t\t\t\twhile(n%gong==0){\n\t\t\t\tn=n/gong;\n\t\t\t\tb=b/gong;\n\t\t\t}\n\t\t\ttime=b;\n\t\t\t} else{\n\t\t\t\ttime=100;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tprintf(\"%d\\n\",time);\n\t}\n\treturn 0;\n}\n\t \t\t\t\t\t \t\t \t\t \t \t \t\t\t"}, {"source_code": "\r\n\r\nint find(int x,int y){\r\n\tif(x\r\n#include\r\nint main()\r\n{\r\nint t;\r\nscanf(\"%d\",&t);\r\nwhile(t--)\r\n{\r\nint n,k;\r\nscanf(\"%d\",&n);\r\nif(100%n==0)\r\n{\r\nprintf(\"%d\\n\",100/n);\r\n}\r\nif(100%n!=0)\r\n{\r\nprintf(\"%d\\n\",100);\r\n}\r\n}\r\n\r\n return 0;\r\n}"}, {"source_code": "#include \r\n//using namespace std;\r\n\r\nint main() {\r\n\t// your code goes here\r\n\tint t;\r\n\tscanf(\"%d\",&t);\r\n\twhile(t--)\r\n\t{\r\n\t int k;\r\n\t scanf(\"%d\",&k);\r\n\t if(100%k==0)\r\n\t {\r\n\t printf(\"%d\\n\",(100/k));\r\n\t }\r\n\t else\r\n\t {\r\n\t printf(\"%d\\n\",(100));\r\n\t }\r\n\t}\r\n\treturn 0;\r\n}\r\n"}, {"source_code": "#include\r\nint gcd(int a,int b)\r\n{\r\n if(b==0)return a;\r\n else return (a%b,a);\r\n}\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n int k;\r\n scanf(\"%d\",&k);\r\n printf(\"%d\\n\",100/gcd(k,100));\r\n }\r\n}\r\n\r\n"}, {"source_code": "#include\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n int k,p,cnt=1,m;\r\n int q;\r\n scanf(\"%d\",&k);\r\n if(k==100)\r\n {\r\n printf(\"1\\n\");\r\n continue;\r\n }\r\n int n=100-k;\r\n if(n<=k)\r\n {\r\n p=k;\r\n k=n;\r\n n=p;\r\n }\r\n \r\n if(n%k==0)\r\n {\r\n q=n/k;\r\n printf(\"%d\\n\",q+1);\r\n continue;\r\n }\r\n if((n%k!=0) && (k%2==0))\r\n {\r\n while(k%2==0)\r\n {\r\n k=k/2;\r\n cnt=cnt*2;\r\n }\r\n m=n/cnt;\r\n printf(\"%d\\n\",m+k);\r\n continue;\r\n }\r\n printf(\"100\\n\");\r\n \r\n }\r\n}"}, {"source_code": "#include\r\nint main()\r\n{\r\n\tint p;\r\n\tscanf(\"%d\",&p);\r\n\twhile(p>0)\r\n\t{\r\n\t\tint i,k,a,b,min,max,c=0,d,flag=0,f;\r\n\t\tscanf(\"%d\",&k);\r\n\t\ta=k;b=100-k;\r\n\t\tif(b==0)\r\n\t\t{\r\n\t\t\tprintf(\"1\");\r\n\t\t\tflag=1;\r\n\t\t}\r\n\t\tif(a>=b)\r\n\t\t{\r\n\t\t\tmax=a;min=b;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tmax=b;min=a;\r\n\t\t}\r\n\t\tfor(i=2;i<=min;i=i+1)\r\n\t\t{\r\n\t\t\tif(max%i==0 && min%i==0)\r\n\t\t\t{\r\n\t\t\t\tc=i;\r\n\t\t\t\t//printf(\"%d\",c);\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(c==0)\r\n\t\t{\r\n\t\t\td=100;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tf=max/c;\r\n\t\t d=min/c;\r\n\t\t d=d+f;\r\n\t\t c=0;\r\n\t\t}\r\n\t\tif(flag==0)\r\n\t\t{\r\n\t\t\tprintf(\"%d\\n\",d);\r\n\t\t}\r\n\t\tp--;\r\n\t}\r\n \r\n}\r\n"}, {"source_code": "#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n\r\nint main(){\r\n\tint t;\r\n\tscanf(\"%d\", &t);\r\n\twhile(t--){\r\n\t\tint n;\r\n\t\tscanf(\"%d\", &n);\r\n\t\tdouble a, b;\r\n\t\ta = n;\r\n\t\tb = 100 - n;\r\n\t\ta /= 100;\r\n\t\tb /= 100;\r\n\t\tdouble temp1 = a, temp2 = b;\r\n\t\tint ans = 1;\r\n\t\twhile((a-(int)a != 0) && (b-(int)b != 0)){\r\n\t\t\t++ans;\r\n\t\t\tif(ans == 100) break;\r\n\t\t\ta += temp1;\r\n\t\t\tb += temp2;\r\n\t\t}\r\n\t\tprintf(\"%d\\n\", ans);\r\n\t}\r\n\treturn 0;\r\n}"}, {"source_code": "#include \r\nint main()\r\n{\r\n int N, x;\r\n scanf(\"%d\", &N);\r\n for(int i=0;i\r\n\r\nint main(){\r\n int t;\r\n scanf(\"%d\",&t);\r\n for(int i=0;ik2){\r\n k=k1;\r\n k1=k2;\r\n k2=k;\r\n }\r\n for(int j=k1;j>0;j--){\r\n if(k1%j==0 && k2%j==0){\r\n printf(\"%d\",(k1+k2)/j);\r\n break;\r\n }\r\n }\r\n }\r\n return 0;\r\n}"}, {"source_code": "#include \r\n#include \r\nint main()\r\n{\r\n int essence, T, remainder;\r\n scanf(\"%d\", &T);\r\n\r\n while(T--)\r\n {\r\n scanf(\"%d\", &essence);\r\n if(100 % essence == 0)\r\n {\r\n remainder = 100/essence;\r\n printf(\"%d\\n\", remainder);\r\n }\r\n else if(essence % 100 == 0)\r\n {\r\n remainder = ceil(essence / 100);\r\n printf(\"%d\\n\", remainder);\r\n }\r\n else\r\n {\r\n printf(\"100\\n\");\r\n }\r\n }\r\n return 0;\r\n}\r\n"}, {"source_code": "#include\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n int k,a;\r\n scanf(\"%d\",&k);\r\n if(100%k==0&&k>0)\r\n {\r\n a=100/k;\r\n printf(\"%d\\n\",a);\r\n }\r\n else if(100%k!=0&&k%2==0){\r\n int f=1;\r\n int x=0,y=0;\r\n x=k;\r\n y=100-k;\r\n while(f!=0)\r\n {\r\n if(x%2==0&&y%2==0)\r\n {\r\n x=x/2;\r\n y=y/2;\r\n }\r\n else{\r\n a=x+y;\r\n f=0;\r\n break;\r\n }\r\n printf(\"%d\\n\",a);\r\n }\r\n }\r\n else{\r\n a=100;\r\n printf(\"%d\\n\",a);\r\n }\r\n }\r\n }"}, {"source_code": "#include \r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n int n;\r\n scanf(\"%d\",&n);\r\n int x=n;\r\n int y=100-n;\r\n if(x!=100 || y!=100)\r\n {\r\n x=1;\r\n y=0;\r\n }\r\n else if(x>y)\r\n {\r\n for(int i=2;i<=y;i++)\r\n {\r\n while(y%i==0 &x%i==0)\r\n {\r\n y=y/i;\r\n x=x/i;\r\n }\r\n }\r\n }\r\n else if(x\r\nint main()\r\n{\r\n int t, k;\r\n scanf(\"%d\", &t);\r\n\r\n for(int i = 1; i <= t; i++)\r\n {\r\n scanf(\"%d\", &k);\r\n if((100 - k) % k != 0 && k != 100 && k != 0)\r\n {\r\n printf(\"100\\n\");\r\n }\r\n if((100 - k) % k == 0 && k != 100 && k != 0)\r\n {\r\n printf(\"%d\\n\", ((100 - k) / k) + 1);\r\n }\r\n if(k == 100 || k == 0)\r\n {\r\n printf(\"1\\n\");\r\n }\r\n }\r\n\r\n \r\n\r\n return 0;\r\n}"}, {"source_code": "#include\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {\r\n int k,a;\r\n scanf(\"%d\",&k);\r\n if(100%k==0&&k>0)\r\n {\r\n a=100/k;\r\n printf(\"%d\\n\",a);\r\n }\r\n else if(100%k!=0&&k%2==0){\r\n int f=1;\r\n int x=0,y=0;\r\n x=k;\r\n y=100-k;\r\n while(f!=0)\r\n {\r\n if(x%2==0&&y%2==0)\r\n {\r\n x=x/2;\r\n y=y/2;\r\n }\r\n else{\r\n a=x+y;\r\n f=0;\r\n printf(\"%d\\n\",a);\r\n break;\r\n }\r\n printf(\"%d\\n\",a);\r\n }\r\n }\r\n else{\r\n a=100;\r\n printf(\"%d\\n\",a);\r\n }\r\n }\r\n }"}], "src_uid": "19a2bcb727510c729efe442a13c2ff7c"} {"nl": {"description": "One day a highly important task was commissioned to Vasya — writing a program in a night. The program consists of n lines of code. Vasya is already exhausted, so he works like that: first he writes v lines of code, drinks a cup of tea, then he writes as much as lines, drinks another cup of tea, then he writes lines and so on: , , , ...The expression is regarded as the integral part from dividing number a by number b.The moment the current value equals 0, Vasya immediately falls asleep and he wakes up only in the morning, when the program should already be finished.Vasya is wondering, what minimum allowable value v can take to let him write not less than n lines of code before he falls asleep.", "input_spec": "The input consists of two integers n and k, separated by spaces — the size of the program in lines and the productivity reduction coefficient, 1 ≤ n ≤ 109, 2 ≤ k ≤ 10.", "output_spec": "Print the only integer — the minimum value of v that lets Vasya write the program in one night.", "sample_inputs": ["7 2", "59 9"], "sample_outputs": ["4", "54"], "notes": "NoteIn the first sample the answer is v = 4. Vasya writes the code in the following portions: first 4 lines, then 2, then 1, and then Vasya falls asleep. Thus, he manages to write 4 + 2 + 1 = 7 lines in a night and complete the task.In the second sample the answer is v = 54. Vasya writes the code in the following portions: 54, 6. The total sum is 54 + 6 = 60, that's even more than n = 59."}, "positive_code": [{"source_code": "#include\n#include\n\nint x;\n\nint bs(int low,int high,int n,int k)\n{\n\tif(low>high)\n\treturn x;\n\t\n\tint i=0;\n\tint sum=0;\n\tint mid=(low+high)/2;\n\t\n//\tprintf(\"%d %d %d\\n\",low,mid,high);\n\t\n\twhile((mid/(int)(pow(k,i))))\n\t{\n\t\tsum+=(mid/(pow(k,i)));\n//\t\tprintf(\"%d \",sum);\n\t\ti++;\n//\t\tprintf(\"%d\\n\",i);\n\t}\n\t\n//\tprintf(\"x\\n\");\n\t\n\tif(sum==n)\n\treturn mid;\n\telse if(sum\nint main()\n{\nlong long int n,k,low,mid,high,sum,z,p;\nscanf(\"%I64d %I64d\",&n,&k);\nlow=0;\nhigh=n;\nwhile(low<=high)\n{mid=(low+high)/2;\nsum=0;\nz=mid;\nwhile(z!=0)\n{sum+=z;\nz/=k;}\nif(sum>=n)\n{p=mid;\nhigh=mid-1;}\nelse\nlow=mid+1;}\nprintf(\"%I64d\",p);\nreturn(0);}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n long int n,i, approximate, v, sum = 0;\n int k , j = 0;\n\n scanf(\"%ld\", &n);\n scanf(\"%d\", &k);\n approximate = ( n * ( 1 - (1.0 / k)));\n\n i = approximate;\n while( i <= n)\n {\n j = 0, sum = 0;\n\n while ( (i / (pow( k , j ))) != 0)\n {\n sum += (i / (pow( k , j )));\n j++;\n }\n if ( sum >= n)\n {\n v = i;\n break;\n }\n i++;\n }\n printf(\"%ld\", v);\n\n return 0;\n}\n"}, {"source_code": "#include\n/* prob b codeforces */\nint n,k;\nint check(int temp)\n{\n long long t=1,res=0;\n while(temp/t)\n {\n res+=temp/t;\n t=t*k;\n }\n if(res>=n)\n return 1;\n else\n return 0;\n}\n\nvoid bsearch()\n{\n int mid,l=1,r=n,res;\n while(l<=r)\n {\n mid=(l+r)/2;\n if(check(mid))\n { r=mid-1; res=mid;\n }\n else\n {\n l=mid+1;\n }\n }\n printf(\"%d\\n\",res);\n }\nint main()\n{\n scanf(\"%d%d\",&n,&k);\n bsearch();\n //getch();\n return 0;\n} \n \n"}, {"source_code": "#include\n#include\n\nint main()\n{\n long long n, k, a, b, c, x, y;\n scanf(\"%lld %lld\", &n, &k);\n if(n<=k){\n printf(\"%lld\", n);\n return 0;\n }\n if(n==1){\n printf(\"1\");\n return 0;\n }\n a=0;b=n;\n while(a+10){\n x+=y;\n y/=k;\n }\n if(x>=n) b=c;\n else a=c;\n }\n printf(\"%lld\", b);\n\n\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int k =0 ;\n long long n =0 , first = 0 , mid = 0 , last=0 , x= 0 , sum = 0 , answer =0 , red = 0;\n scanf(\"%I64d %d\" , &n , &k);\n first = 0 ;\n last = n ;\n mid = 1 ;\n if (n / k ==0 )\n answer = n ;\n while (last > first )\n {\n sum = 0 ;\n red = 1 ;\n x = 1 ;\n mid = first +(last - first)/ 2 ;\n while (x> 0)\n {\n x = mid/red;\n sum += x;\n red *= k ;\n\n }\n\n if (sum >= n ){\n\n\n answer = mid ;\n last = mid ;\n\n\n }\n\n\n else\n first = mid +1;\n }\n printf(\"%I64d\", answer);\n\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n long long n , mid , min , low , high , x , sum = 0 , y ;\n int k ;\n scanf(\"%I64d\",& n);\n scanf(\"%d\",&k);\n\n low = 0 ;\n high= n ;\n\n if (n/k==0)\n min = n;\n while (high > low){\n mid = low+(high-low)/2 ;\n x = mid ;\n sum = x ;\n y= k ;\n while (x/y!=0){\n sum +=x/y;\n y*=k;\n }\n if (sum >=n ){\n min = mid ;\n high = mid ;\n\n }\n else\n\n low = mid+1;\n\n }\n printf(\"%I64d\",min);\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n unsigned long long int a,b, i=1,k,k1,sum=0;\n // printf(\"Enter the size of the program in lines\\n\");\n scanf(\"%lld\",&a);\n //printf(\"Enter the productivity reduction coefficient\\n\");\n scanf(\"%lld\",&b);\n k1=b;\n for(i=a-(a/b);i<=a;i++)\n {\n sum=i;\n while(1)\n {\n k=i/k1;\n if(k==0)\n break;\n sum=sum+k;\n k1=k1*b;\n }\n if(sum>=a)\n break;\n sum=0;\n k1=b;\n }\n //printf(\"The minimum value = %lld\",i);\n printf(\"%lld\",i);\n return 0;\n}"}, {"source_code": "# include \nint f(int x,int m)\n{\n int m2,r;\n r = 0;\n for(m2 = 1;(x/m2) > 0; m2 = m2*m) r = r+(x/m2);\n return r;\n}\nint main()\n{\n int n,k,v,a,b,g;\n scanf(\"%d %d\",&n,&k);\n a = 1;\n b = n;\n v = (a+b)/2;\n g = f(v,k);\n while(b-a>1)\n {\n if(g=n)\n printf(\"%d\",a);\n else\n printf(\"%d\",b);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n __int64 n,k,i,sum=0,v,mi=9999999999999999,l=1,h=10000000000,mid;\n scanf(\"%I64d%I64d\",&n,&k);\n v=n;\n while(l<=h)\n {\n v=(l+h)/2;\n i=1;\n sum=0;\n while(v/i!=0)\n {\n sum=sum+(v/i);\n i*=k;\n }\n if(sum>=n)\n {\n if(v\n#include \nint main(void)\n{\n\tlong long n,v,k,min,t,i,p,r;\n\n\tscanf(\"%I64d %I64d\",&n,&k);\n\tv=min=n;\n\tp=1;r=n;\n\n\twhile(r>=p)\n\t{\n\t\tt=0;\n\t\tfor(i=1;v/i>0;i*=k)\n\t\t{\n\t\t\tt+=v/i;\n\t\t\tif(t>=n) break;\n\t\t}\n\t\tif(t>=n)\n\t\t{\n\t\t\tif(v\n#include \n\nint main()\n{\n long long n ;\n int k , flag = 1 ;\n scanf(\"%I64d %d\", &n , &k) ;\n long long v = n * (k-1) / k ;\n while (flag)\n {\n long long sum = v ;\n long long term = v / k ;\n while (term > 0)\n {\n sum += term ;\n term /= k ;\n }\n if (sum >= n)\n {\n break ;\n }\n v++ ;\n }\n printf(\"%I64d\", v) ;\n return 0;\n}\n"}, {"source_code": "#include\ntypedef long long int L;\nint k;\nL i,s,n;\nint check(L m)\n{\n s=0;\n for(i=m;i>0;i=i/k)\n {\n s=s+i;\n if(s>=n) return 1;\n }\n return 0;\n}\nint main()\n{\n L low=1,high,mid;\n scanf(\"%I64d%d\",&n,&k);\n high=n;\n while(low\n\n#define INT_MAX 0x3fffffffL\n\nint fx(int v, int k)\n{\n\tint sum = 0, t = k;\n\n\twhile(v) {\n\t\tsum += v;\n\t\tv /= t;\n\t}\n\treturn sum;\n}\n\nint solve(int n, int k)\n{\n\tint sum, l = 1, r = n, mid, ans = INT_MAX, dt = INT_MAX;\n\n\twhile (l <= r) {\n\t\tmid = (l + r) >> 1;\n\t\tsum = fx(mid, k);\n\t\t/* printf(\"sum = %d mid = %d\\n\", sum, mid); */\n\t\tif (sum >= n) {\n\t\t\tif (sum - n <= dt && ans > mid)\n\t\t\t\tans = mid;\n\t\t\tr = mid - 1;\n\t\t} else {\n\t\t\tl = mid + 1;\n\t\t}\n\t}\n\t/* printf(\"ans = %d l = %d r = %d sum = %d\\n\", ans, l, r, sum); */\n\treturn ans;\n}\n\nint main(void)\n{\n\tint n, k;\n\n\twhile (2 == scanf(\"%d%d\", &n, &k)) {\n\t\tprintf(\"%d\\n\", n < k ? n : solve(n, k));\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include \nint func(int n, int m, int x)\n{\n int i, sum = 0;\n for(i = 0; i <= n ; i++)\n {\n sum = sum + x / pow(m, i);\n }\n return sum;\n}\nint main()\n{\n int n, m, i, j, d;\n while(scanf(\"%d %d\", &n, &m) != EOF)\n {\n int tempn = n, sum = 0;\n i = 0;\n while(pow(m, i) <= n)\n {\n i++;\n }\n i--;\n n = n - (n / m);\n while(sum < tempn)\n {\n sum = func(i, m, n);\n n++;\n }\n n--;\n printf(\"%d\\n\", n);\n }\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n,k,i,j,lo,mid,hi,ans, tmp;\n scanf(\"%d %d\",&n,&k);\n lo = k, hi = n, tmp = n;\n while( lo <= hi )\n {\n mid = (lo+hi)/2;\n /* printf(\"mid = %d\\n\",mid);\n ans = 0, i=mid;\n for(i=1; ans\nint main() {\n int a, b, c, d, i;\n scanf(\"%d%d\", &a, &b);\n c=a-a/b;\n d=a;\n while(d>0) {\n d=a, i=c;\n while(i>0)\n {\n d-=i;\n i/=b;\n }\n if(d>0)\n c++;\n }\n printf(\"%d\\n\", c);\n return 0;\n}\n"}, {"source_code": "/* AUTHOR:AKASH JAIN\n* USERNAME:akash19jain \n* TIME: 30-10-2019 13:43:09\n*/\n// #include\n// #include \n// using namespace std;\n \n#include\n#include\n#include\n#include\n#include\n#include\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 SCA(a,n) for(long long i=0;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);\nbool isvowel(char x);\nll chartoint(char ch);\nll CEIL(ll x,ll y);\nll FLOOR(ll x,ll y);\n\nll check(ll v,ll k)\n{\n ll sum=0;\n while(v)\n {\n sum+=v;\n v=v/k;\n }\n return sum;\n}\nint main()\n{\n ll n,k;\n SC2(n,k);\n ll l=0,r=1e9,res=0,mid=0;\n while(l<=r)\n {\n mid=(l+r)/2;\n if(check(mid,k)>=n)\n {\n res=mid;\n r=mid-1;\n }\n else\n l=mid+1;\n\n }\n PF1(res);\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='A' && ch<='Z') return(ch-'A');\n else if(ch>='0' && ch<='9') return (ch-'0');\n else if(ch>='a' && ch<='z') return (ch-'a');\n else return 0;\n}\nll CEIL(ll x,ll y)\n{\n if(x%y==0) return(x/y);\n else return(x/y +1);\n}\n \nll FLOOR(ll x,ll y)\n{\n if(x%y==0) return(x/y);\n else return(x/y -1);\n}"}, {"source_code": "#include \n\nint calc(int t, int k)\n{\n\tint res,tk;\n\tres=t;\n\tfor(tk=k;t/tk>0;tk*=k){res += t/tk;}\n\treturn res;\n}\n\nint main()\n{\n\tint n,k,ln,rn,lv,rv,tmp,val;\n\tscanf(\"%d %d\",&n,&k);\n\tln=1;\n\trn=n;\n\tlv=0;\n\trv=0;\n\twhile(1){\n\t\ttmp=(ln+rn)/2;\n\t\tval=calc(tmp,k);\n\t\tif(val < n){\n\t\t\tln=tmp;\n\t\t\tlv=-1;\n\t\t}else if(val==n){\n\t\t\tbreak;\n\t\t}else{\n\t\t\trn=tmp;\n\t\t\trv=val;\n\t\t}\n\t\tif(rn-ln==1) {tmp=rn;break;}\n\t}\n\tprintf(\"%d\\n\",tmp);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n int n,k,sum,i,mid=1,ans=1;\n scanf(\"%d %d\",&n,&k);\n int low=1;\n int high=n;\n int ok=1;\n while(low<=high&&ok==1)\n {\n if(low==high)ok=0;\n int mid=(low+high)/2;\n sum=mid;\n for(i=k; mid/i>0; i*=k)\n sum+=mid/i;\n if(sum=n)\n {\n high=mid-1;\n ans=mid;\n }\n }\n printf(\"%d\\n\",ans);\n return 0;\n}"}, {"source_code": "#include \n\nlong long int num_lines(long long int v, long long int k)\n{\n\t\tlong long int sum = v;\n\t\tlong long int d = k;\n\t\twhile (v/d != 0){\n\t\t\t\tsum += (v/d);\n\t\t\t\td*=k;\n\t\t}\n\t\treturn sum;\n}\n\nint main(void)\n{\n\t\tlong long int n, k, mid, l, r, num, tmp;\n\t\tscanf(\"%I64d %I64d \", &n, &k);\n\n\t\tl = 1;\tr = n; tmp = n;\n\t\twhile (l <= r){\n\t\t\t\tmid = (l+r)/2;\n\t\t\t\tnum = num_lines(mid, k);\n\n\t\t\t\tif (num < n)\n\t\t\t\t\t\tl = mid+1;\n\t\t\t\telse{\n\t\t\t\t\t\tif (mid < tmp)\n\t\t\t\t\t\t\t\ttmp = mid;\n\t\t\t\t\t\tr = mid-1;\n\t\t\t\t}\n\t\t}\n\t\tprintf(\"%I64d\\n\", tmp);\n\t\t\n}\n\n\n"}, {"source_code": "/* Coached by rainboy */\n#include \n\nint lines(int n, int k) {\n\treturn n == 0 ? 0 : lines(n / k, k) + n;\n}\n\nint binsearch(int n, int k) {\n\tint lower, upper, v;\n\n\tlower = 0, upper = n;\n\twhile (upper - lower > 1) {\n\t\tv = (lower + upper) / 2;\n\t\tif (lines(v, k) < n)\n\t\t\tlower = v;\n\t\telse\n\t\t\tupper = v;\n\t}\n\treturn upper;\n}\n\nint main() {\n\tint n, k;\n\n\tscanf(\"%d%d\", &n, &k);\n\tprintf(\"%d\\n\", binsearch(n, k));\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint lines(int n, int k) {\n\treturn n == 0 ? 0 : lines(n / k, k) + n;\n}\n\nint binsearch(int n, int k) {\n\tint low, high, mid, l, v;\n\n\tlow = 1;\n\thigh = n;\n\tv = -1;\n\twhile (low <= high) {\n\t\tmid = (low + high) / 2;\n\t\tl = lines(mid, k);\n\t\tif (l < n)\n\t\t\tlow = mid + 1;\n\t\telse\n\t\t\tv = mid, high = mid - 1;\n\t}\n\treturn v;\n}\n\nint main() {\n\tint n, k;\n\n\tscanf(\"%d%d\", &n, &k);\n\tprintf(\"%d\\n\", binsearch(n, k));\n\treturn 0;\n}\n"}, {"source_code": "#include\nint k;\nlong long burn(long long n)\n{\n long long sum=0,i=1,div=1;\n while(div!=0)\n {\n div=n/i;\n sum+=div;\n i=i*k;\n }\n\n return sum;\n}\n\n\nint main()\n{\n\n long long min=1000000000000,high,n,low,mid,dif;\n scanf(\"%lld %lld\",&n,&k);\n\n low=0;\n high=n*10;\n while(low<=high)\n {\n mid=low+(high-low)/2;\n dif=burn(mid);\n if(dif==n) { printf(\"%lld\\n\",mid); break; }\n if(n>dif) low=mid+1;\n else { high=mid-1; if(midhigh) printf(\"%lld\\n\",min);\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint lines(int n, int k)\n{\n\treturn n==0?0:lines(n/k,k)+n;\n}\nint binsearch(int n, int k)\n{\n\tint lower,upper,v;\n\tlower=0,upper=n;\n\twhile (upper - lower > 1)\n {\n\t\tv = (lower + upper) / 2;\n\t\tif (lines(v, k) < n)\n\t\t\tlower = v;\n\t\telse\n\t\t\tupper = v;\n\t}\n\treturn upper;\n}\n\nint main() {\n\tint n, k;\n\tscanf(\"%d%d\", &n, &k);\n\tprintf(\"%d\\n\", binsearch(n, k));\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\nint64_t n, k;\n\nint works(int64_t v) {\n int64_t sum = 0;\n int64_t den = 1;\n while ((v / den) > 0) {\n sum += v / den;\n den *= k;\n }\n return sum >= n;\n}\n\nint main() {\n scanf(\"%ld %ld\", &n, &k);\n int64_t lo = 0;\n int64_t hi = 1;\n\n while (!works(hi))\n hi *= 2;\n\n while(hi - lo > 1) {\n int64_t mid = lo + (hi - lo) / 2;\n if(works(mid)) {\n hi = mid;\n } else {\n lo = mid;\n }\n }\n\n printf(\"%ld\\n\", hi);\n\n return 0;\n}"}, {"source_code": "#include\n#include\nlong long int power(long long int a, long long int b){\n if(b == 0)\n return -1;\n long long int temp = power(a,b/2);\n if(b%2 != 0)\n return temp*temp*a;\n else \n return temp*temp;\n}\nint main()\n{\n long long int n,i=0,k,j;\n scanf(\"%lld %lld\",&n,&k);\n \n long long int m=(n*(k-1))/k;\nlong long int sum=m;\n j=1;\n while(sum=1&&sum\n#include \n\n#define fo(a,b,c) for(a=(b);a<=(c);a++)\n#define of(a,b,c) for(a=(b);a>=(c);a--)\n\nint readInt() {\n int ret;\n scanf(\"%d\", &ret);\n return ret;\n}\n\nint f(int base, int x) {\n if (!base) return 0;\n return base + f(base / x, x);\n}\n\nint main() {\n int n = readInt(), i, j;\n int k = readInt();\n int hi = n;\n int ans = n;\n int lo = 1;\n while (hi >= lo) {\n int mid = (hi + lo) / 2;\n int amt = f(mid, k);\n if (amt >= n) {\n ans = mid;\n hi = mid - 1;\n } else {\n lo = mid + 1;\n }\n }\n printf(\"%d\\n\", ans);\n return 0;\n}"}, {"source_code": "#include \nint main()\n{\n\tint n,k,l,r,h,sum,min,t;\n\tscanf(\"%d %d\",&n,&k);\n\t//printf(\"%d %d \\n\",n,k);\n\tl=1;\n\tr=n*2;\n\tsum=0;\n\tmin=n;\n\twhile (l!=r)\n\t{\n\t\th=(l+r)/2;\n\t\t//printf(\"h = %d \\n\",h);\n\t\t// s4itaem\n\t\tt=1;\n\t\tsum=0;\n\t\twhile ((h/t)>0) \n\t\t{\n\t\t\tsum=sum+(h/t);\n\t\t\tt=t*k;\n\t\t}\n\t\t//printf(\"sum = %d \\n\",sum);\n\t\tif (sum\n#include\n#include\nlong long int min=LONG_MAX,n,k,tut1,tut2,tut3;\nvoid islem(int bas,int orta,int son)\n{\t\n\t\tif(bas==tut1 && orta==tut2 && son==tut3) return ;\n\t\ttut1=bas;\n\t\ttut2=orta;\n\t\ttut3=son;\n long long int carp=1,tut=1,sonuc=0;\n// printf(\"bas%d son%d orta%d\\n\",bas,son,orta);\t\n \n\t\tfor( ; tut!=0 ;carp*=k)\n\t\t{\n\t\t\ttut=ceil(orta/carp);\n\t\t\tsonuc+=tut;\n\t\t}\n\t\tif(sonuc>=n)\n\t\t{\n\t\t\tif(orta= n) return 1;\n }\n return 0;\n}\nint main(){\n scanf(\"%I64d%I64d\",&n,&k);\n LL low = 1,high = 1LL<<31;\n LL mid;\n int idx = 0;\n while(low < high){\n // printf(\"%I64d %I64d %I64d\\n\",low,mid,high);\n idx += 1;\n mid = low + ((high - low)>>1);\n if(solve(mid)){\n high = mid;\n // printf(\"low\\n\");\n }\n else{\n low = mid + 1;\n // printf(\"high\\n\");\n }\n }\n printf(\"%I64d\\n\",low);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n\tint n, k, v, count = 1, sum = 0, test = 1;\n\tscanf(\"%d %d\", &n, &k);\n\tv = n / k * (k - 1);\n while (test){\n while (v/count > 0){\n sum += v/count;\n count *= k;\n }\n if (sum >= n)\n break;\n v++;\n count = 1;\n sum = 0;\n }\n\tprintf(\"%d\", v);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n long long n , x =1 , first , last , sum=0 , temp = 0 , mid , temp2 ;\n int k , j ;\n scanf(\"%I64d \",&n);\n scanf(\"%d\",&k);\n if(n<=k){\n printf(\"%I64d\",n);\n }else{\n first = k ;\n last =(int) n ;\n while(last>=first){\n mid = ((last-first)/2) +first ;\n sum = mid ;\n x=1 ;\n for(j = 0 ; mid/x && sum <= n; j++){\n x*=k;\n sum+=mid/x;\n }\n if(sum==n){\n printf(\"%d\",mid);\n break ;\n }else if (sum < n) {\n if(temp!=0&&first==last){\n printf(\"%d\",temp);\n break;\n }\n first = mid + 1 ;\n }else {\n temp = mid ;\n temp2 = sum ;\n last = mid -1 ;\n\n }\n if(lastv=val;\n\t\troot->left=root->right=NULL;\n\t}else if(root->v>val)\n\t\troot->left=add(root->left,val);\n\telse\n\t\troot->right=add(root->right,val);\n\treturn root;\n}\nint f(int n,int k){\n\tint sum=0;\n\twhile(n!=0){\n\t\tsum+=n;\n\t\tn/=k;\n\t}\n\treturn sum;\n}\nmain(){\n\tint i,sum=0,k,c,u,lo,mid;\n\tstruct node *root;\n\tlong n;\n\tchar l[20];\n\tgetline(20,l);\n\tn=atoi(l);\n\tgetline(20,l);\n\tk=atoi(l);\n\t//printf(\"%d %d\",n,k);\n\tlo=1;\n\tu=n;\n\twhile(lo\n\nint n, k;\n\nint ok(int x)\n{\n int sum = 0;\n \n while (x) {\n sum += x;\n x /= k;\n }\n \n if (sum >= n) {\n return 1;\n } else {\n return 0;\n }\n}\n\nint main()\n{\n int l, r, m;\n \n scanf(\"%d %d\", &n, &k);\n \n l = 0, r = n + 1, m = (l + r) / 2;\n \n while (r - l > 1) {\n if (ok(m)) {\n r = m;\n m = (l + r) / 2;\n } else {\n l = m;\n m = (l + r) / 2;\n }\n }\n \n printf(\"%d\\n\", r);\n \n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n/* Function to merge the two haves arr[l..m] and arr[m+1..r] of array arr[] */\n\n\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 /* create temp arrays */\n int L[n1], R[n2];\n\n /* Copy data to temp arrays L[] and R[] */\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 /* Merge the temp arrays back into arr[l..r]*/\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\n /* Copy the remaining elements of L[], if there are any */\n while (i < n1)\n {\n arr[k] = L[i];\n i++;\n k++;\n }\n\n /* Copy the remaining elements of R[], if there are any */\n while (j < n2)\n {\n arr[k] = R[j];\n j++;\n k++;\n }\n}\n\n/* l is for left index and r is right index of the sub-array\n of arr to be sorted */\nvoid mergeSort( int arr[], int l, int r)\n{\n if (l < r)\n {\n int m = l+(r-l)/2; //Same as (l+r)/2, but avoids overflow for large l and h\n mergeSort(arr, l, m);\n mergeSort(arr, m+1, r);\n merge(arr, l, m, r);\n }\n}\n\n\n\nlong long int fact(int n)\n{\n if(n==1 || n==0)\n return 1;\n else\n return (n)*fact(n-1);\n}\n\nint min(int a[],int n)\n{\n int i=0,max=10000,c;\n for(i=0;imax)\n {\n max=a[i];\n c=i;\n }\n }\n return c;\n}\n\nlong long int ifitis(int n,int v,int r)\n{\n long long int sum=v,flag=0;\n while((v/r)!=0)\n {\n //printf(\"%d \",v/r);\n sum+=floor(v/r);\n v=v/r;\n\n }\n printf(\"\\n\");\n return sum;\n}\n\n//374+187+93+46+23+11+5+2+1\n\n\n\nint main() {\n long long int v,n=0,y,z,m=0,min=-1,r,o=0,e=0,sum=0,flag=0,a[1000],count=0,x=-1,b[10000]={0},c[100][100]={{0}},k=0,d[10000],i=0,j=0;\n scanf(\"%I64d %I64d\",&n,&r);\n v=floor(n*(r-1)/r);\n for(i=v;i=n)\n break;\n else\n continue;\n }\n printf(\"%I64d\",i);\n\n return 0;\n}\n\n\n"}, {"source_code": "#include \n int n,k,i=0,gereksiz[100],t=0;\n \nvoid binary(int s, int f){\n int h,temp=0,div=1;\n h= (s+f)/2;\n if(h == s) h=f;\n while(h/div >0){\n temp = temp +h/div;\n div = div * k;\n }\n if(temp == n){ gereksiz[i] = h;i++;}\n if(h == s || h == f || t) return;\n if(h == s || h == f) t++;\n if(temp>=n){gereksiz[i] = h; i++; binary(s,h);}\n if(temp\n#include\n#include\n#include\n#include\n\nint sum(int i,int k){\n\tint su = i,j;\n\tfor(j = 0;;j++){\n\t\ti /= k;\n\t\tif(i <= 0)\n\t\t\treturn su;\n\t\telse{\n\t\t\tsu += i;\n\t\t}\n\t}\n}\n\nint qiui(int tem,int right,int k,int n){\n\tif(tem == right+1 || tem == right) return tem;\n\tif(sum((tem+right)/2,k) < n){\n\t\treturn qiui(tem,(tem+right)/2,k,n);\n\t}else{\n\t\treturn qiui((tem+right)/2,k,k,n);\n\t}\n}\n\nint main(void){\n int n,k,i;\n scanf(\"%d%d\",&n,&k);\n if(n <= k)\n \tprintf(\"%d\",n);\n else{\n\t\tint tem;\n\t\ttem = n / k * k;\n\t\tprintf(\"%d\\n\",qiui(tem,k,k,n));\n\t}\n /*system(\"pause\");*/\n return 0;\n}\n"}, {"source_code": "// Burning Midnight Oil.c\n// \n// Copyright 2012 Administrator \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 \n\n#define INF 1 << 29\n\ntypedef long long ll;\n\nint check(int n, int m, int k)\n{\n int s = m;\n ll t = k;\n if (s >= n)\n {\n return 1;\n }\n while (m >= t)\n {\n s += m / t;\n if (s >= n)\n {\n return 1;\n }\n t *= k;\n }\n return 0;\n}\n\nvoid func(int n, int k)\n{\n int l, r, m, ans = INF;\n l = 1;\n r = n;\n while (l <= r)\n {\n m = (l + r) >> 1;\n if (check(n, m, k))\n {\n ans = m;\n r = m - 1;\n }\n else\n {\n l = m + 1;\n }\n }\n printf(\"%d\\n\", ans);\n}\n\nint main(int argc, char **argv)\n{\n int n, k;\n while (scanf(\"%d%d\", &n, &k) == 2)\n {\n func(n, k);\n }\n return 0;\n}"}, {"source_code": "#include \n\nint good(int n, int v, int k) {\n\tlong long p = 1;\n\n\twhile (v >= p) {\n\t\tn -= v / p;\n\t\tp *= k;\n\t}\n\treturn n <= 0;\n}\n\nint main() {\n\tint n, k, mid, min, max;\n\n\tscanf(\"%d%d\", &n, &k);\n\tmin = 0, max = n;\n\twhile (min + 1 < max) {\n\t\tmid = (max + min) / 2;\n\t\tif (good(n, mid, k))\n\t\t\tmax = mid;\n\t\telse\n\t\t\tmin = mid;\n\t}\n\tprintf(\"%d\\n\", max);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint cnt(long long n, long long k) {\n\tlong long i, sum = 0;\n\n\tfor (i = 1; i <= n; i *= k)\n\t\tsum += n / i;\n\treturn sum;\n}\n\nlong long binsearch(long long n, long long k) {\n\tlong long mid, low, high, c, min = n;\n\n\tlow = 0, high = n;\n\twhile (low <= high) {\n\t\tmid = (low + high) / 2;\n\t\tc = cnt(mid, k);\n\t\tif (c >= n && min > mid)\n\t\t\tmin = mid;\n\n\t\tif (c < n)\n\t\t\tlow = mid + 1;\n\t\telse if (c > n)\n\t\t\thigh = mid - 1;\n\t\telse\n\t\t\tbreak;\n\t}\n\treturn min;\n}\n\nint main() {\n\tlong long n, k;\n\n\tscanf(\"%lld%lld\", &n, &k);\n\tprintf(\"%lld\\n\", binsearch(n, k));\n\treturn 0;\n}\n"}, {"source_code": "#include \nint main(){\n int n,k,v,t,s;\n scanf(\"%d%d\",&n,&k);\n for(v=n-n/k;;v++){\n s=v;\n t=v/k;\n while(t){\n s+=t;\n t/=k;\n }\n if(n<=s)break;\n }\n printf(\"%d\",v);\n return 0;\n}"}, {"source_code": "#include \n\nint k;\n\nint write(int v)\n{\n long long n, p;\n for(n = v, p = k; v / p; p *= k)\n n += v / p;\n return (int) n;\n}\n\nint main(int argc, char *argv[])\n{\n int n, l, u, m;\n\n scanf(\"%d %d\", &n, &k);\n\n l = 1, u = n;\n do\n {\n m = (l + u) / 2;\n if(write(m) >= n && write(m - 1) < n)\n {\n printf(\"%d\\n\", m);\n return 0;\n }\n\n if(write(m) >= n)\n u = m - 1;\n else\n l = m + 1;\n } while(1);\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nlong main(void)\n{\n\tlong long int n, k;\n\tscanf(\"%lld%lld\", &n, &k);\n\tlong long int temp, v = n, sum, dv = 1;\n\tint i;\n\tfor(i = 1; i < k; i++)\n\t{\n\t\tsum = 0;\n\t\ttemp = i;\n\t\twhile(sum < n)\n\t\t{\n\t\t\tsum = sum + temp;\n\t\t\ttemp = temp*k;\n\t\t}\n\t\ttemp = temp/k;\n\t\tif(temp < v)\n\t\t{\n\t\t\tv = temp;\n\t\t}\n\t}\n\tif(n > 9)\n\t{\n\t\tdv = 10;\n\t}\n\tif(n > 99)\n\t{\n\t\tdv = 100;\n\t}\n\tif(n > 999)\n\t{\n\t\tdv = 1000;\n\t}\n\twhile(1)\n\t{\n\t\tv = v - dv;\n\t\ttemp = v;\n\t\tsum = 0;\n\t\twhile(temp != 0)\n\t\t{\n\t\t\tsum = sum + temp;\n\t\t\ttemp = temp/k;\n\t\t}\n\t\tif(sum < n)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t}\n\tfor(i = 1; i <= dv; i++)\n\t{\n\t\tsum = 0;\n\t\tv++;\n\t\ttemp = v;\n\t\twhile(temp != 0)\n\t\t{\n\t\t\tsum = sum + temp;\n\t\t\ttemp = temp/k;\n\t\t}\n\t\tif(sum >= n)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%lld\\n\", v);\n\treturn 0;\n}"}, {"source_code": "#include \n\nint canFinish(int v, int k)\n{\n int res = 0;\n \n while (v != 0){\n res += v;\n v /= k;\n }\n \n return (res);\n}\n\nint main(void)\n{\n int n, k;\n int left, right, center;\n \n scanf(\"%d%d\", &n, &k);\n \n left = 1;\n right = 1000000000;\n \n while (left != right){\n center = (left + right) / 2;\n \n if (canFinish(center, k) >= n){\n right = center;\n }\n else {\n left = center + 1;\n }\n }\n \n printf(\"%d\\n\", left);\n \n return (0);\n}"}, {"source_code": "#include \n\ntypedef __int64 LL;\n\nLL Cal(LL v,LL k)\n{\n LL sum=v,b=k;\n while(v>=b)\n {\n sum+=v/b;\n b*=k;\n }\n return sum;\n}\n\nint main()\n{\n LL N,K,Left,Right,Mid;\n scanf(\"%I64d %I64d\",&N,&K);\n Left=1;\n Right=K*N;\n while(Right>Left)\n {\n Mid=(Left+Right)/2;\n if(Cal(Mid,K)\nint main() {\n\tint n,k;\n\tscanf(\"%d%d\",&n,&k);\n\tlong long v=(long long)(k-1)*(long long)n/k;\n\tlong long result=v;\n\t//printf(\"v=%d\\n\",v);\n\twhile(1){\n\t\tlong long sum=0;\n\t\tlong long kk=1;\n\t\twhile(1){\n\t\t\tif(v=n){\n\t\t\tresult=v;\n\t\t\tbreak;\n\t\t}\n\t\tv++;\n\t}\n\tprintf(\"%lld\\n\",result);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \nint isright(long long v,long long k,long long n)\n{\n long long sum=v;\n long long value =v/k;\n while(value!=0)\n {\n sum+=value;\n value=value/k;\n }\n if (sum==n)\n {\n return 1;\n }\n\n else if (sum>n)\n {\n return 2;\n\n }\n\n return 0;\n}\n\n\n\n\nint main()\n{\n\n long long lines;\n long long low=0,mid=0,value,min=1,high;\n int k;\n scanf(\"%I64d\",& lines);\n scanf(\"%d\",&k);\n high=lines;\n while(low\n#include \n#include \n\nint n = 0;\nint k = 0;\n\nint possibility(int num){\n int sum = 0;\n int add = num;\n int counter = 0;\n while(sum < n && add > 0){\n sum += add;\n counter ++;\n add = (int)(num / powl(k , counter));\n }\n if(sum < n){\n return 0;\n }\n return 1;\n}\nint main()\n{\n scanf(\"%d\" , &n);\n scanf(\"%d\" , &k);\n int left = 1;\n int right = n;\n int mid = 0;\n while(right > left){\n mid = left + (right - left) / 2;\n if(possibility(mid)){\n right = mid;\n }\n else{\n left = mid + 1;\n }\n }\n printf(\"%d\" , left);\n return 0;\n}\n"}, {"source_code": "#include\n\nlong long n,k;\n\nlong long f(long long x)\n{\n long long retval=0,kval=1;\n for(;x>=kval;kval*=k)\n retval+=x/kval;\n return retval;\n}\n\n\nlong long bin(long long low,long long high)\n{\n if(low>=high)\n return low;\n long mid=(low+high)/2;\n if(f(mid)\n\nint n, k;\n\nint func(int m) {\n int cnt = m;\n while (m /= k)\n cnt += m;\n return cnt >= n;\n}\n\nint main() {\n int low, up, mid;\n \n scanf(\"%d%d\", &n, &k);\n low = 0;\n up = n;\n\n while (low < up) {\n mid = low + up >> 1;\n if (func(mid))\n up = mid;\n else\n low = mid + 1;\n }\n \n printf(\"%d\\n\", low);\n \n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \ntypedef long long ll;\n\nll giatrituongung(ll mid, ll k)\n{\n ll sum = mid, u, l = k;\n while (floor(mid*1.0 / k) > 0)\n {\n u = floor(mid*1.0 / k);\n sum = sum + u;\n k = k*l;\n }\n return sum;\n}\n\nll timkiem(ll n, ll k)\n{\n ll L = 1, R = 1e9, mid, x;\n while (L < R)\n {\n mid = (L + R) / 2;\n x = giatrituongung(mid, k);\n if (x == n)\n return mid;\n else if (x>n)\n R = mid;\n else\n L = mid + 1;\n }\n return L;\n}\n\nint main()\n{\n ll n, k;\n scanf(\"%I64d %I64d\", &n, &k);\n printf(\"%I64d\", timkiem(n, k));\n \n return 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n\tlong long n, k, v, i, sum, l, r;\n\tscanf(\"%I64d%I64d\", &n, &k);\n\tl = n * (k - 1) / k, r = n;\n\twhile (l <= r)\n\t{\n\t\tv = (l + r) / 2;\n\t\ti = 1;\n\t\tsum = 0;\n\t\twhile (v / i > 0)\n\t\t\tsum += v / i, i *= k;\n\t\tif (sum < n)\n\t\t\tl = v + 1;\n\t\telse\n\t\t\tr = v - 1;\n\t}\n\ti = 1;\n\tsum = 0;\n\twhile (v / i > 0)\n\t\tsum += v / i, i *= k;\n\tif (sum < n)\n\t\t++v;\n\tprintf(\"%64d\\n\", v);\n\treturn 0;\n}\n\n"}, {"source_code": "#include \n\nint main()\n{\n\tlong long n, k, v, i, sum;\n\tscanf(\"%I64d%I64d\", &n, &k);\n\tv = n * (k - 1) / k;\n\tdo\n\t{\n\t\tsum = 0;\n\t\ti = 1;\n\t\twhile (v / i > 0)\n\t\t{\n\t\t\tsum += v / i;\n\t\t\ti *= k;\n\t\t}\n\t\tif (sum < n)\n\t\t\t++v;\n\t\telse\n\t\t\tbreak;\n\t}\n\twhile (1);\n\tprintf(\"%I64d\\n\", v);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tint n, k, v, i, sum;\n\tscanf(\"%d%d\", &n, &k);\n\tv = n / k * (k - 1);\n\tdo\n\t{\n\t\tsum = 0;\n\t\ti = 1;\n\t\twhile (v / i > 0)\n\t\t{\n\t\t\tsum += v / i;\n\t\t\ti *= k;\n\t\t}\n\t\tif (sum < n)\n\t\t\t++v;\n\t\telse\n\t\t\tbreak;\n\t}\n\twhile (1);\n\tprintf(\"%d\\n\", v);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tint n, k, v, i, sum, l, r;\n\tscanf(\"%d%d\", &n, &k);\n\tl = 0, r = n;\n\twhile (l <= r)\n\t{\n\t\tv = (l + r) / 2;\n\t\ti = 1;\n\t\tsum = 0;\n\t\twhile (v / i > 0)\n\t\t\tsum += v / i, i *= k;\n\t\tif (sum < n)\n\t\t\tl = v + 1;\n\t\telse\n\t\t\tr = v - 1;\n\t}\n\ti = 1;\n\tsum = 0;\n\twhile (v / i > 0)\n\t\tsum += v / i, i *= k;\n\tif (sum < n)\n\t\t++v;\n\tprintf(\"%d\\n\", v);\n\treturn 0;\n}\n\n"}, {"source_code": "#include\n#include\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(valkey)\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\n#include \n\nlong long n, k, l, r, m;\n\nlong long\ncnt(long long m)\n{\n long long ans = 0, t = 1;\n while(m >= t){\n ans += m / t;\n t *= k;\n }\n return ans;\n}\n\nint\nmain(void)\n{\n scanf(\"%I64d%I64d\", &n, &k);\n l = 1;\n r = n;\n while(r - l > 1){\n m = (l + r) / 2;\n if(cnt(m) >= n){\n r = m;\n } else {\n l = m + 1;\n }\n }\n if(cnt(l) >= n){\n printf(\"%I64d\", l);\n } else {\n printf(\"%I64d\", r);\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint fac;\nlong long lines ;\n\nlong long val_found(int start , int end)\n{\n long long j ;\n if(start >= end )return end;\n int mid = start + (end - start) / 2 ;\n long long sum = 0 ;\n for(j = 1 ; mid / j != 0 ; j *= fac ){\n sum += mid / j ;\n }\n if(lines > sum)return val_found(mid + 1 , end);\n else return val_found(start , mid);\n}\n\nint main()\n{\n int k ;\n long long n ;\n scanf(\"%I64d %d\" , &n ,&k);\n lines = n ; fac = k ;\n printf(\"%I64d\" , val_found(0 , n));\n return 0;\n}\n"}, {"source_code": "#define si(a) scanf(\"%d\",&a)\n#define pi(a) printf(\"%d\\n\",a)\n#include\nint k,n;\nint oil(int v){\n\tlong long int s=0,i=1;\n\twhile(v/i){\n\t\ts+=(v/i);\n\t\ti*=k;\n\t}\n\tif(s\n#include\n#include\nint n,k;\nint eval(int n,int k)\n{\n\tint m,s=0;\n\tfor(m=1;(int)(n/m)>0;m*=k)\n\t\ts+=(int)(n/m);\n\treturn s;\n}\nint f(int n,int k,int lb,int ub)\n{\n\tint v,s;\n\tv=(int)((lb+ub)/2);\n\tif(n==k||nn&&eval(v-1,k)n)\n\t\tf(n,k,lb,v);\n\telse if(eval(v,k)\nint n,k,w;\nint calcula(int x)\n{int soma=0;\nwhile(x>0){ soma=soma+x;\n x=x/k;\n \n}\nreturn soma;\n}\nvoid binary_search(int ini, int fim)\n{int i,soma;\nint m;\nif (ini<=fim){\nm=(ini+fim)/2;\nsoma=calcula(m);\nif (soma\n int n,k,w;\n int calcula(int x)\n { int soma=0;\n while(x>0){ soma=soma+x;\n x=x/k;\n }\n return soma;\n }\n void binary_search(int ini, int fim)\n{ int i,soma;\n int m;\n if (ini<=fim){\n m=(ini+fim)/2;\n soma=calcula(m);\n if (soma\n\nint main()\n{\n int n,k;\n int lim;\n int sum;\n int term;\n\n scanf(\"%d%d\",&n,&k);\n\n lim=((long long int)n)*(k-1)/k;\n\n while (1)\n {\n sum=lim;\n term=lim/k;\n\n while (term>0)\n {\n sum+=term;\n term=term/k;\n }\n\n if (sum>=n)\n {\n printf(\"%d\",lim);\n break;\n }\n lim++;\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\nint n, k;\n\nint w(int v) {\n\tint kn=1, ret=0;\n\twhile (v/kn>0) {\n\t\tret+=v/kn;\n\t\tkn*=k;\n\t}\n\treturn ret;\n}\n\nint search(void) {\n\tint lo=1, hi=1000000001, x;\n\twhile (lo < hi) {\n\t\tx=(lo+hi)/2;\n\t\tif (w(x) < n) lo=x+1;\n\t\telse hi=x;\n\t}\n\treturn lo;\n}\n\nint main(void) {\n\tscanf(\"%d %d\", &n, &k);\n\tprintf(\"%d\\n\", search());\n\texit(EXIT_SUCCESS);\n}\n"}, {"source_code": "#include \n\nint cal(double v, int k)\n{\n int cnt = 0;\n while ( v >= 1 )\n {\n cnt += (int)v;\n v /= k;\n }\n return cnt;\n}\n\nint binary_search(int l, int r, int n, int k)\n{\n int middle = (l+r)/2;\n if ( cal(middle, k) >= n )\n {\n if ( cal(middle-1, k) < n )\n return middle;\n else\n return binary_search(l, middle, n, k);\n }\n else\n {\n if ( cal(middle+1, k) >= n )\n return middle+1;\n else\n return binary_search(middle, r, n, k);\n }\n}\n\nint main()\n{\n int n, k;\n scanf(\"%d%d\", &n, &k);\n printf(\"%d\\n\", binary_search(1, n, n, k));\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include\n\n\n// off by one error\n\nbool check (long long int v,long long n,int k)\n{\n long long i=1,result=0,mul=1;\n while(1)\n {\n long long term=v/mul;\n result+=term;\n if (term==0)\n {\n if (result>=n) return true ;\n else return false ;\n }\n mul*=k;\n //i++;\n }\n}\n\nlong long binSearch (long long first,long long last,int k )\n{\n long long l=first,r=last,mid;\n while (l<=r)\n {\n mid = (l+r)/2;\n if (check(mid,last,k))\n {\n r=mid-1;\n }\n else\n\n {\n l=mid+1;\n }\n }\n return l ;\n}\n\nint main()\n{\n long long int n ;\n int k ;\n scanf(\"%lld%d\",&n,&k);\n printf(\"%lld\",binSearch(0,n,k));\n return 0;\n}\n"}, {"source_code": "#include\n#include\nlong int search(long int,long int,int t,long int);\nint main()\n\n{\n\nlong int n,p,q;\nint k;\nscanf(\"%ld\",&n);\nscanf(\"%d\",&k);\nq=search(1,n,k,n);\nprintf(\"%ld\",q);\nreturn 0;\n}\nlong int search(long int start,long int end1,int t,long int size1)\n{long int mid,s,v,h,sum,l;\n\nif(end1-start==0)\nreturn end1;\nelse\n{mid=(end1+start)/2;\nv=mid;\nsum=v;\n while(v/t!=0)\n {\n sum+=v/t;\n v=v/t;\n }\n\n if(sum>=size1)\n {return search(start,mid,t,size1);\n\n }\n else\n{\n return search(mid+1,end1,t,size1);\n\n}\n}\n\n}\n"}], "negative_code": [{"source_code": "#include\n#include\n\nint main()\n{\n\tlong long int n,k,v;\n\tlong long int sum=0;\n\tlong long int l;\n\t\n\tscanf(\"%I64d %I64d\",&n,&k);\t\n\tl=k;\n\t\n\twhile(l<=n)\n\t{\n\t\tsum+=l;\n\t\tl=l*k;\n\t}\n\t\n\tl=l/k;\n\tsum+=1;\n\t\n//\tprintf(\"%d %d\\n\",l,sum);\t\n\tdouble x=(n*l);\n//\tprintf(\"%lf\\n\",x);\n\tx=x/sum;\n//\tprintf(\"%lf\\n\",x);\n\t\t\n\tlong long int ans=ceil(x);\t\n\tprintf(\"%I64d\\n\",ans);\t\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main()\n{\n\tint n,k,v;\n\t\n\tint count=0;\n\tlong long int sum=0;\n\tlong long int l;\n\t\n\tscanf(\"%d %d\",&n,&k);\n\t\n\tl=k;\n\t\n\twhile(l<=n)\n\t{\n\t\tcount++;\n\t\tsum+=l;\n\t\tl=l*k;\n\t}\n\t\n\tl=l/k;\n\tsum+=1;\n\t\n//\tprintf(\"%d %d\\n\",l,sum);\n\t\n\tdouble x=(n*l);\n//\tprintf(\"%lf\\n\",x);\n\tx=x/sum;\n//\tprintf(\"%lf\\n\",x);\n\t\t\n\tlong long int ans=ceil(x);\n\t\t\n\tprintf(\"%d\\n\",ans);\t\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main()\n{\n long long n, k, i, j, a=1;\n scanf(\"%lld %lld\", &n, &k);\n if(n<=k){\n printf(\"%lld\", n);\n return 0;\n }\n if(n==1){\n printf(\"1\");\n return 0;\n }\n while(a\n#include \n\nint main()\n{\n long long n , mid , min , wanted , low , high , x , sum = 0 ;\n int k , y ;\n scanf(\"%I64d\",& n);\n scanf(\"%d\",&k);\n wanted = n ;\n low = 0 ;\n high= n ;\n\n if (n/k==0)\n min = n;\n while (high != low){\n mid = (low+high)/2 ;\n\n x = mid ;\n sum = x ;\n y= k ;\n while (x/y!=0){\n sum +=x/y;\n y*=y;\n }\n if (sum >=wanted ){\n min = mid ;\n high = mid ;\n if (x==wanted)\n break ;\n\n }\n else\n\n low = mid+1;\n\n }\n printf(\"%I64d\",min);\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n long long n , mid , min , wanted , low , high , x ;\n int k , y ;\n scanf(\"%I64d\",& n);\n scanf(\"%d\",&k);\n wanted = n ;\n low = 0 ;\n high= n ;\n mid = (low+high)/2 ;\n if (n/k==0)\n min = n;\n while (high != low){\n mid = (low+high)/2 ;\n x = mid ;\n y= k ;\n while (x/y!=0){\n x+=x/y;\n y*=y;\n }\n if (x >=wanted){\n min = mid ;\n high = mid ;\n\n }\n else\n\n low = mid+1;\n\n }\n printf(\"%I64d\",min);\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int k =0 ;\n long long n =0 , first = 0 , mid = 0 , last=0 , x= 0 , sum = 0 , answer =0 , red = 0;\n scanf(\"%I64d %d\" , &n , &k);\n first = 0 ;\n last = n ;\n mid = 1 ;\n if (n / k ==0 )\n answer = 1 ;\n while (last > first )\n {\n sum = 0 ;\n red = 1 ;\n x = 1 ;\n mid = first +(last - first)/ 2 ;\n while (x> 0)\n {\n x = mid/red;\n sum += x;\n red *= k ;\n\n }\n\n if (sum >= n ){\n\n\n answer = mid ;\n last = mid ;\n\n\n }\n\n\n else\n first = mid +1;\n }\n printf(\"%I64d\", answer);\n\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n long long n , mid , min , wanted , low , high , x ;\n int k , y ;\n scanf(\"%I64d\",& n);\n scanf(\"%d\",&k);\n wanted = n ;\n low = 0 ;\n high= n ;\n mid = (low+high)/2 ;\n while (high != low){\n mid = (low+high)/2 ;\n x = mid ;\n y= k ;\n while (x/y!=0){\n x+=x/y;\n y*=y;\n }\n if (x >=wanted){\n min = mid ;\n high = mid ;\n\n }\n else\n\n low = mid+1;\n\n }\n printf(\"%I64d\",min);\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n long long n , mid , min , low , high , x , sum = 0 ;\n int k , y ;\n scanf(\"%I64d\",& n);\n scanf(\"%d\",&k);\n\n low = 0 ;\n high= n ;\n\n if (n/k==0)\n min = n;\n while (high > low){\n mid = low+(high-low)/2 ;\n x = mid ;\n sum = x ;\n y= k ;\n while (x/y!=0){\n sum +=x/y;\n y*=k;\n }\n if (sum >=n ){\n min = mid ;\n high = mid ;\n\n }\n else\n\n low = mid+1;\n\n }\n printf(\"%I64d\",min);\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n unsigned long long int a,b;\n int i=1,k,k1,sum=0;\n // printf(\"Enter the size of the program in lines\\n\");\n scanf(\"%lld\",&a);\n //printf(\"Enter the productivity reduction coefficient\\n\");\n scanf(\"%lld\",&b);\n k1=b;\n for(i=a/b;i<=a;i++)\n {\n sum=i;\n while(1)\n {\n if(i%k1==0)\n {\n k=i/k1;\n if(k==0)\n break;\n sum=sum+k;\n k1=k1*b;\n }\n else\n break;\n }\n if(sum>=a)\n break;\n sum=0;\n k1=b;\n }\n //printf(\"The minimum value = %d\",i);\n printf(\"%d\",i);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n unsigned long long int a,b;\n float k;\n scanf(\"%lld\",&a);\n scanf(\"%lld\",&b);\n if(a%2==0)\n k=a-(a/b);\n else\n k=(a-(a/b))+1;\n printf(\"%.0f\",k);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n unsigned long long int a,b;\n int i=1,k,k1,sum=0;\n printf(\"Enter the size of the program in lines\\n\");\n scanf(\"%lld\",&a);\n printf(\"Enter the productivity reduction coefficient\\n\");\n scanf(\"%lld\",&b);\n k1=b;\n for(i=1;i<=a;i++)\n {\n sum=i;\n while(1)\n {\n k=i/k1;\n if(k==0)\n break;\n sum=sum+k;\n k1=k1*b;\n }\n if(sum>=a)\n break;\n sum=0;\n k1=b;\n }\n printf(\"The minimum value = %d\",i);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n unsigned long long int a,b;\n int i=1,j;\n float v,c;\n// printf(\"Enter the size of the program in lines\\n\");\n scanf(\"%lld\",&a);\n // printf(\"Enter the productivity reduction coefficient\\n\");\n scanf(\"%lld\",&b);\n j=b;\n for(i=a;;i--)\n {\n v=i;\n while(1)\n {\n c=i/j;\n if(c<=0)\n break;\n //printf(\"%f\\n\",c);\n v=v+c;\n j=j*j;\n }\n if(v<=a)\n break;\n v=0;\n j=b;\n \n }\n if(v!=a)\n i++;\n // printf(\"The minimum value = %d\",i);\n printf(\"%d\",i);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n unsigned long long int a,b;\n int i=1,j;\n float v,c;\n// printf(\"Enter the size of the program in lines\\n\");\n scanf(\"%lld\",&a);\n // printf(\"Enter the productivity reduction coefficient\\n\");\n scanf(\"%lld\",&b);\n j=b;\n for(i=a;i;i--)\n {\n v=i;\n while(1)\n {\n c=i/j;\n if(c<=0)\n break;\n //printf(\"%f\\n\",c);\n v=v+c;\n j=j*j;\n }\n if(v<=a)\n break;\n v=0;\n j=b;\n \n }\n // printf(\"The minimum value = %d\",i);\n printf(\"%d\",i);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n unsigned long long int n,m,i,sum=0,a,b;\n printf(\"Enter the size of the program in lines\\n\");\n scanf(\"%lld\",&n);\n printf(\"Enter the productivity reduction coefficient\\n\");\n scanf(\"%lld\",&m);\n a=m;\n for(i=n;;i--)\n {\n sum=i;\n while(1)\n {\n b=i/a;\n if(b<=0)\n break;\n sum=sum+b;\n a=a*a;\n }\n if(sum<=n)\n {\n if(sum!=n)\n i++;\n break;\n }\n sum=0;\n a=m;\n }\n printf(\"The minimum value = %lld\",i);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n unsigned long long int a,b;\n int i=1,j;\n float v,c;\n// printf(\"Enter the size of the program in lines\\n\");\n scanf(\"%lld\",&a);\n // printf(\"Enter the productivity reduction coefficient\\n\");\n scanf(\"%lld\",&b);\n j=b;\n for(i=a;;i--)\n {\n v=i;\n while(1)\n {\n c=i/j;\n if(c<=0)\n break;\n //printf(\"%f\\n\",c);\n v=v+c;\n j=j*j;\n }\n if(v<=a)\n break;\n v=0;\n j=b;\n \n }\n // printf(\"The minimum value = %d\",i);\n printf(\"%d\",i);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n unsigned long long int n,m,i,sum=0,a,b;\n //printf(\"Enter the size of the program in lines\\n\");\n scanf(\"%lld\",&n);\n //printf(\"Enter the productivity reduction coefficient\\n\");\n scanf(\"%lld\",&m);\n a=m;\n for(i=n;;i--)\n {\n sum=i;\n while(1)\n {\n b=i/a;\n if(b<=0)\n break;\n sum=sum+b;\n a=a*a;\n }\n if(sum<=n)\n {\n if(sum!=n)\n i++;\n break;\n }\n sum=0;\n a=m;\n }\n // printf(\"The minimum value = %lld\",i);\n printf(\"%lld\",i);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n unsigned long long int a,b, i=1,k,k1,sum=0;\n // printf(\"Enter the size of the program in lines\\n\");\n scanf(\"%lld\",&a);\n //printf(\"Enter the productivity reduction coefficient\\n\");\n scanf(\"%lld\",&b);\n k1=b;\n for(i=a/b;i<=a;i++)\n {\n if(i%b==0)\n {\n sum=i;\n while(1)\n {\n k=i/k1;\n if(k==0||k>=1000000000)\n break;\n sum=sum+k;\n k1=k1*b;\n }\n if(sum>=a)\n break;\n sum=0;\n k1=b; \n }\n }\n //printf(\"The minimum value = %lld\",i);\n printf(\"%lld\",i);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n unsigned long long int a,b;\n float k;\n scanf(\"%lld\",&a);\n scanf(\"%lld\",&b);\n k=a-(a/b);\n printf(\"%.0f\",k);\n return 0;\n}"}, {"source_code": "# include \nint f(int x,int m)\n{\n int m2,r;\n for(m2 = 1;(x/m2) > 0; m2 = m2*m) r = r+(x/m2);\n return r;\n}\nint main()\n{\n int n,k,v,a,b,g;\n scanf(\"%d %d\",&n,&k);\n a = 0;\n b = n;\n v = (a+b)/2;\n g = f(v,k);\n while(b-a>1)\n {\n if(g\nint f(int x,int m)\n{\n int m2,r;\n r = 0;\n for(m2 = 1;(x/m2) > 0; m2 = m2*m) r = r+(x/m2);\n return r;\n}\nint main()\n{\n int n,k,v,a,b,g;\n scanf(\"%d %d\",&n,&k);\n a = 1;\n b = n;\n v = (a+b)/2;\n g = f(v,k);\n while(b-a>1)\n {\n if(g=n)\n printf(\"%d\",a);\n else\n printf(\"%d\",b);\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int k;\n unsigned long long int n,i,j,s;\n scanf(\"%I64u%d\",&n,&k);\n for(i=k;;i++)\n {\n s=0;\n j=i;\n while(j>0)\n {\n s=s+j;\n if(s>=n)\n {\n printf(\"%I64u\\n\",i);\n k=1;\n break;\n }\n j=j/k;\n }\n if(k==1)\n break;\n }\n return 0;\n}\n"}, {"source_code": "#include \n\n#define INT_MAX 0x3fffffffL\n\nint fx(int v, int k)\n{\n\tint sum = v, t = k;\n\n\twhile(v >= k) {\n\t\tsum += v / k;\n\t\tk *= t;\n\t}\n\treturn sum;\n}\n\nint solve(int n, int k)\n{\n\tint sum, l = 1, r = n, mid, ans = 0, dt = INT_MAX;\n\n\twhile (l <= r) {\n\t\tmid = (l + r) >> 1;\n\t\tsum = fx(mid, k);\n\t\t/* printf(\"sum = %d mid = %d\\n\", sum, mid); */\n\t\tif (sum >= n) {\n\t\t\tif (sum - n <= dt)\n\t\t\t\tans = mid;\n\t\t\tr = mid - 1;\n\t\t} else {\n\t\t\tl = mid + 1;\n\t\t}\n\t}\n\t/* printf(\"ans = %d l = %d r = %d\\n\", ans, l, r); */\n\treturn ans;\n}\n\nint main(void)\n{\n\tint n, k;\n\n\twhile (2 == scanf(\"%d%d\", &n, &k)) {\n\t\tprintf(\"%d\\n\", n < k ? n : solve(n, k));\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include \n\n#define INT_MAX 0x3fffffffL\n\nint fx(int v, int k)\n{\n\tint sum = v, t = k;\n\n\twhile(v >= k) {\n\t\tsum += v / k;\n\t\tk *= t;\n\t}\n\treturn sum;\n}\n\nint solve(int n, int k)\n{\n\tint sum, l = 1, r = n, mid, ans = INT_MAX, dt = INT_MAX;\n\n\twhile (l <= r) {\n\t\tmid = (l + r) >> 1;\n\t\tsum = fx(mid, k);\n\t\t/* printf(\"sum = %d mid = %d\\n\", sum, mid); */\n\t\tif (sum >= n) {\n\t\t\tif (sum - n <= dt && ans > mid)\n\t\t\t\tans = mid;\n\t\t\tr = mid - 1;\n\t\t} else {\n\t\t\tl = mid + 1;\n\t\t}\n\t}\n\t/* printf(\"ans = %d l = %d r = %d\\n\", ans, l, r); */\n\treturn ans;\n}\n\nint main(void)\n{\n\tint n, k;\n\n\twhile (2 == scanf(\"%d%d\", &n, &k)) {\n\t\tprintf(\"%d\\n\", n < k ? n : solve(n, k));\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include \n\n#define INT_MAX 0x3fffffffL\n\nint fx(int v, int k)\n{\n\tint sum = v, t = k;\n\n\twhile(v >= k) {\n\t\tsum += v / k;\n\t\tk *= t;\n\t}\n\treturn sum;\n}\n\nint solve(int n, int k)\n{\n\tint sum, l = 1, r = n, mid, ans = 0, dt = INT_MAX;\n\n\twhile (l <= r) {\n\t\tmid = (l + r) >> 1;\n\t\tsum = fx(mid, k);\n\t\t/* printf(\"sum = %d mid = %d\\n\", sum, mid); */\n\t\tif (sum >= n) {\n\t\t\tif (sum - n <= dt)\n\t\t\t\tans = mid;\n\t\t\tr = mid - 1;\n\t\t} else {\n\t\t\tl = mid + 1;\n\t\t}\n\t}\n\t/* printf(\"ans = %d l = %d r = %d\\n\", ans, l, r); */\n\treturn ans;\n}\n\nint main(void)\n{\n\tint n, k;\n\n\twhile (2 == scanf(\"%d%d\", &n, &k)) {\n\t\tprintf(\"%d\\n\", n <= k ? n : solve(n, k));\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n,k,i,j,lo,mid,hi,ans;\n scanf(\"%d %d\",&n,&k);\n lo = k, hi = n, mid = n;\n while( lo < hi )\n {\n mid = (lo+hi)/2;\n ans = 0;\n for(i=1; ansn) hi=mid-1;\n else if(ans \n\nint num_lines(int v, int k)\n{\n\t\tint sum = v;\n\t\tint d = k;\n\t\twhile (v/d != 0){\n\t\t\t\tsum += (v/d);\n\t\t\t\td*=k;\n\t\t}\n\n\t\treturn sum;\n}\n\nint main(void)\n{\n\t\tint n, k, mid, l, r, num;\n\t\tscanf(\"%d %d \", &n, &k);\n\n\t\tl = 1;\tr = n;\n\t\twhile (l < r){\n\t\t\t\tmid = (l+r)/2;\n\t\t\t\tnum = num_lines(mid, k);\n\n\t\t\t\tif (num == n)\n\t\t\t\t\t\tbreak;\n\t\t\t\tif (num < n)\n\t\t\t\t\t\tl = mid+1;\n\t\t\t\telse\n\t\t\t\t\t\tr = mid;\n\t\t}\n\n\t\tprintf(\"%d\\n\", (l+r)/2);\n\t\treturn 0;\n}\n\n\n"}, {"source_code": "#include \n\nint num_lines(int v, int k)\n{\n\t\tint sum = v;\n\t\tint d = k;\n\t\twhile (v/d != 0){\n\t\t\t\tsum += (v/d);\n\t\t\t\td*=k;\n\t\t}\n\t\treturn sum;\n}\n\nint main(void)\n{\n\t\tint n, k, mid, l, r, num;\n\t\tscanf(\"%d %d \", &n, &k);\n\n\t\tl = 1;\tr = n;\n\t\twhile (l < r){\n\t\t\t\tmid = (l+r)/2;\n\t\t\t\tnum = num_lines(mid, k);\n\n\t\t\t\tif (num == n)\n\t\t\t\t\t\tbreak;\n\t\t\t\tif (num < n)\n\t\t\t\t\t\tl = mid+1;\n\t\t\t\telse\n\t\t\t\t\t\tr = mid;\n\t\t}\n\t\t\n\t\tmid = (l+r)/2;\n\t\tif (num_lines(mid, k) < n)\n\t\t\t\tprintf(\"%d\\n\", mid+1);\n\t\telse\n\t\t\t\tprintf(\"%d\\n\", mid);\n\t\treturn 0;\n}\n\n\n"}, {"source_code": "#include \n\nint num_lines(int v, int k)\n{\n\t\tint sum = v;\n\t\tint d = k;\n\t\twhile (v/d != 0){\n\t\t\t\tsum += (v/d);\n\t\t\t\td*=k;\n\t\t}\n\n\t\treturn sum;\n}\n\nint main(void)\n{\n\t\tint n, k, mid, l, r, num;\n\t\tscanf(\"%d %d \", &n, &k);\n\n\t\tl = 1;\tr = n;\n\t\twhile (l < r){\n\t\t\t\tmid = (l+r)/2;\n\t\t\t\tnum = num_lines(mid, k);\n\n\t\t\t\tif (num == n)\n\t\t\t\t\t\tbreak;\n\t\t\t\tif (num < n)\n\t\t\t\t\t\tl = mid+1;\n\t\t\t\telse\n\t\t\t\t\t\tr = mid;\n\t\t}\n\t\t\n\t\tmid = (l+r)/2;\n\t\tif (num_lines(mid, k) < num)\n\t\t\t\tprintf(\"%d\\n\", mid+1);\n\t\telse\n\t\t\t\tprintf(\"%d\\n\", mid);\n\t\treturn 0;\n}\n\n\n"}, {"source_code": "#include\n#include\n#include\nlong long int min=LONG_MAX,n,k;\nvoid islem(int bas,int orta,int son)\n{\n long long int carp=1,tut=1,sonuc=0;\n\t \tif(orta+1==son) return ;\t\n\t\tif(orta-1==bas) return ;\n\t\tfor( ; tut!=0 ;carp*=k)\n\t\t{\n\t\t\ttut=ceil(orta/carp);\n\t\t\tsonuc+=tut;\n\t\t}\n\t\tif(sonuc>=n)\n\t\t{\n\t\t\tif(ortav=val;\n\t\troot->left=root->right=NULL;\n\t}else if(root->v>val)\n\t\troot->left=add(root->left,val);\n\telse\n\t\troot->right=add(root->right,val);\n\treturn root;\n}\nmain(){\n\tint i,sum=0,k,c;\n\tstruct node *root;\n\tlong n;\n\tchar l[20];\n\tgetline(20,l);\n\tn=atoi(l);\n\tgetline(20,l);\n\tk=atoi(l);\n\t//printf(\"%d %d\",n,k);\n\tfor(i=n;i>=1;i--){\n\t\tc=i;\n\t\twhile(c!=0 && sumv=val;\n\t\troot->left=root->right=NULL;\n\t}else if(root->v>val)\n\t\troot->left=add(root->left,val);\n\telse\n\t\troot->right=add(root->right,val);\n\treturn root;\n}\nmain(){\n\tint i,sum=0,k,c;\n\tstruct node *root;\n\tlong n;\n\tchar l[20];\n\tgetline(20,l);\n\tn=atoi(l);\n\tgetline(20,l);\n\tk=atoi(l);\n\t//printf(\"%d %d\",n,k);\n\tfor(i=n;i>=1;i--){\n\t\tc=i;\n\t\twhile(c!=0 && sum\n#include\n#include\n#include\n/* Function to merge the two haves arr[l..m] and arr[m+1..r] of array arr[] */\n\n\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 /* create temp arrays */\n int L[n1], R[n2];\n\n /* Copy data to temp arrays L[] and R[] */\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 /* Merge the temp arrays back into arr[l..r]*/\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\n /* Copy the remaining elements of L[], if there are any */\n while (i < n1)\n {\n arr[k] = L[i];\n i++;\n k++;\n }\n\n /* Copy the remaining elements of R[], if there are any */\n while (j < n2)\n {\n arr[k] = R[j];\n j++;\n k++;\n }\n}\n\n/* l is for left index and r is right index of the sub-array\n of arr to be sorted */\nvoid mergeSort( int arr[], int l, int r)\n{\n if (l < r)\n {\n int m = l+(r-l)/2; //Same as (l+r)/2, but avoids overflow for large l and h\n mergeSort(arr, l, m);\n mergeSort(arr, m+1, r);\n merge(arr, l, m, r);\n }\n}\n\n\n\nlong long int fact(int n)\n{\n if(n==1 || n==0)\n return 1;\n else\n return (n)*fact(n-1);\n}\n\nint min(int a[],int n)\n{\n int i=0,max=10000,c;\n for(i=0;imax)\n {\n max=a[i];\n c=i;\n }\n }\n return c;\n}\n\nint ifitis(int n,int v,int r)\n{\n int sum=v,flag=0;\n while((v/r)!=0)\n {\n //printf(\"%d \",v/r);\n sum+=floor(v/r);\n v=v/r;\n\n }\n printf(\"\\n\");\n return sum;\n}\n\n//374+187+93+46+23+11+5+2+1\n\n\n\nint main() {\n int v,n=0,y,z,m=0,min=-1,r,o=0,e=0,sum=0,flag=0,a[1000],count=0,x=-1,b[10000]={0},c[100][100]={{0}},k=0,d[10000],i=0,j=0;\n scanf(\"%d %d\",&n,&r);\n v=floor(n*(r-1)/r);\n for(i=v;i=n)\n break;\n else\n continue;\n }\n printf(\"%d\",i);\n\n return 0;\n}\n\n\n"}, {"source_code": "#include\n#include\n#include\n#include\n/* Function to merge the two haves arr[l..m] and arr[m+1..r] of array arr[] */\n\n\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 /* create temp arrays */\n int L[n1], R[n2];\n\n /* Copy data to temp arrays L[] and R[] */\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 /* Merge the temp arrays back into arr[l..r]*/\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\n /* Copy the remaining elements of L[], if there are any */\n while (i < n1)\n {\n arr[k] = L[i];\n i++;\n k++;\n }\n\n /* Copy the remaining elements of R[], if there are any */\n while (j < n2)\n {\n arr[k] = R[j];\n j++;\n k++;\n }\n}\n\n/* l is for left index and r is right index of the sub-array\n of arr to be sorted */\nvoid mergeSort( int arr[], int l, int r)\n{\n if (l < r)\n {\n int m = l+(r-l)/2; //Same as (l+r)/2, but avoids overflow for large l and h\n mergeSort(arr, l, m);\n mergeSort(arr, m+1, r);\n merge(arr, l, m, r);\n }\n}\n\n\n\nlong long int fact(int n)\n{\n if(n==1 || n==0)\n return 1;\n else\n return (n)*fact(n-1);\n}\n\nint min(int a[],int n)\n{\n int i=0,max=10000,c;\n for(i=0;imax)\n {\n max=a[i];\n c=i;\n }\n }\n return c;\n}\n\n\n\n\n\n\n\n\nint main() {\n int v,n=0,y,z,m=0,min=-1,r,o=0,e=0,sum=0,flag=0,a[1000],count=0,x=-1,b[10000]={0},c[100][100]={{0}},k=0,d[10000],i=0,j=0;\n scanf(\"%d %d\",&n,&r);\n v=ceil(n*(r-1)/r)+1;\n sum=v;\n //printf(\"%d\\n\",v);\n while((v/r)!=0)\n {\n\n sum+=ceil(v/r);\n //printf(\"%d\\n\",sum);\n r=r*r;\n }\n if(sum>=n)\n printf(\"%d\",v);\n else\n printf(\"%d\",v+1);\n\n\n return 0;\n}\n\n\n"}, {"source_code": "//1 den ula�mas� istenilen say�ya kadar binary search yaz.\n#include \n int n,k,i=0,gereksiz[100];\n \nvoid binary(int s, int f){\n int h,temp=0,div=1;\n h= (s+f)/2;\n while(h/div !=0){\n temp = temp +h/div;\n div = div * k;\n }\n if(temp == n){ gereksiz[i] = h;i++; return;}\n if(h == s || h == f) return;\n //say�dan b�y�kse kaydet ve k����� �al��t�r.\n if(temp>n){gereksiz[i] = h; i++; binary(s,h);}\n if(temp\n int n,k,i=0,gereksiz[100],t=0;\n \nvoid binary(int s, int f){\n int h,temp=0,div=1;\n h= (s+f)/2;\n if(h == s) h=f;\n while(h/div !=0){\n temp = temp +h/div;\n div = div * k;\n }\n if(temp == n){ gereksiz[i] = h;i++;}\n if(h == s || h == f || t) return;\n if(h == s || h == f) t++;\n if(temp>=n){gereksiz[i] = h; i++; binary(s,h);}\n if(temp\n int n,k,i=0,gereksiz[100],t=0;\n \nvoid binary(int s, int f){\n int h,temp=0,div=1;\n h= (s+f)/2;\n if(h == s && h+1 == f) h=f;\n while(h/div !=0){\n temp = temp +h/div;\n div = div * k;\n }\n if(temp == n){ gereksiz[i] = h;i++; return;}\n if(h == s || h == f || t) return;\n if(h == s || h == f) t++;\n if(temp>n){gereksiz[i] = h; i++; binary(s,h);}\n if(temp\n int n,k,i=0,gereksiz[100],t=0;\n \nvoid binary(int s, int f){\n int h,temp=0,div=1;\n h= (s+f)/2;\n if(h == s) h=f;\n while(h/div !=0){\n temp = temp +h/div;\n div = div * k;\n }\n if(temp == n){ gereksiz[i] = h;i++;}\n if(h == s || h == f || t) return;\n if(h == s || h == f) t++;\n if(temp>=n){gereksiz[i] = h; i++; binary(s,h);}\n if(temp\n int n,k,i=0,gereksiz[100];\n \nvoid binary(int s, int f){\n int h,temp=0,div=1;\n h= (s+f)/2;\n if(h == s || h == f) return;\n while(h/div !=0){\n temp = temp +h/div;\n div = div * k;\n }\n if(temp == n){ gereksiz[i] = h;i++; return;}\n //say�dan b�y�kse kaydet ve k����� �al��t�r.\n if(temp>n){gereksiz[i] = h; i++; binary(s,h);}\n if(temp\n int n,k,i=0,gereksiz[100],t=0;\n \nvoid binary(int s, int f){\n int h,temp=0,div=1;\n h= (s+f)/2;\n if(h == s) h=f;\n while(h/div !=0){\n temp = temp +h/div;\n div = div * k;\n }\n if(temp == n){ gereksiz[i] = h;i++; return;}\n if(h == s || h == f || t) return;\n if(h == s || h == f) t++;\n if(temp>n){gereksiz[i] = h; i++; binary(s,h);}\n if(temp\n#include\n#include\n#include\n#include\n\nint sum(int i,int k){\n\tint su = i,j;\n\tfor(j = 0;;j++){\n\t\ti /= k;\n\t\tif(i <= 0)\n\t\t\treturn su;\n\t\telse{\n\t\t\tsu += i;\n\t\t}\n\t}\n}\nint qiui(int tem,int k,int n){\n\tif(tem == k+1 || tem == k) return tem;\n\tif(sum((tem+k)/2,k) < n){\n\t\treturn qiui(tem,(tem+k)/2,n);\n\t}else{\n\t\treturn qiui((tem+k)/2,k,n);\n\t}\n}\nint main(void){\n int n,k,i;\n scanf(\"%d%d\",&n,&k);\n if(n <= k)\n \tprintf(\"%d\",n);\n else{\n\t\tint tem;\n\t\ttem = n / k * k;\n\t\tprintf(\"%d\\n\",qiui(tem,k,n));\n\t}\n /*system(\"pause\");*/\n return 0;\n}\n"}, {"source_code": "// Burning Midnight Oil.c\n// \n// Copyright 2012 Administrator \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 \n\n#define INF 1 << 29\n\nint check(int n, int m, int k)\n{\n int s = m, t = k;\n if (s >= n)\n {\n return 1;\n }\n while (m >= t)\n {\n s += m / t;\n if (s >= n)\n {\n return 1;\n }\n t *= k;\n }\n return 0;\n}\n\nvoid func(int n, int k)\n{\n int l, r, m, ans = INF;\n l = 1;\n r = n;\n while (l <= r)\n {\n m = (l + r) >> 1;\n if (check(n, m, k))\n {\n ans = m;\n r = m - 1;\n }\n else\n {\n l = m + 1;\n }\n }\n printf(\"%d\\n\", ans);\n}\n\nint main(int argc, char **argv)\n{\n int n, k;\n while (scanf(\"%d%d\", &n, &k) == 2)\n {\n func(n, k);\n }\n return 0;\n}"}, {"source_code": "#include \n\nint cnt(int n, int k) {\n\tint i, sum = 0;\n\n\tfor (i = 1; i <= n; i *= k)\n\t\tsum += n / i;\n\treturn sum;\n}\n\nint binsearch(int n, int k) {\n\tint mid, low, high, c, min = n;\n\n\tlow = 0, high = n;\n\twhile (low <= high) {\n\t\tmid = (low + high) / 2;\n\t\tc = cnt(mid, k);\n\t\tif (c >= n && min > mid)\n\t\t\tmin = mid;\n\n\t\tif (c < n)\n\t\t\tlow = mid + 1;\n\t\telse if (c > n)\n\t\t\thigh = mid - 1;\n\t\telse\n\t\t\tbreak;\n\t}\n\treturn min;\n}\n\nint main() {\n\tint n, k;\n\n\tscanf(\"%d%d\", &n, &k);\n\tprintf(\"%d\\n\", binsearch(n, k));\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint good(int n, int v, int k) {\n\tint p = 1;\n\n\twhile (v >= p) {\n\t\tn -= v / p;\n\t\tif (v / k == 0)\n\t\t\tbreak;\n\t\tp *= k;\n\t}\n\treturn n <= 0;\n}\n\nint main() {\n\tint n, k, mid, min, max;\n\n\tscanf(\"%d%d\", &n, &k);\n\tmin = 0, max = n;\n\twhile (min + 1 < max) {\n\t\tmid = (max + min) / 2;\n\t\tif (good(n, mid, k))\n\t\t\tmax = mid;\n\t\telse\n\t\t\tmin = mid;\n\t}\n\tprintf(\"%d\\n\", max);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint good(int n, int v, int k) {\n\tint p;\n\n\tp = 1;\n\twhile (v >= p) {\n\t\tn -= v / p;\n\t\tp *= k;\n\t}\n\treturn n <= 0;\n}\n\nint main() {\n\tint n, k, mid, min, max;\n\n\tscanf(\"%d%d\", &n, &k);\n\tmin = 0, max = n;\n\twhile (min + 1 < max) {\n\t\tmid = (max + min) / 2;\n\t\tif (good(n, mid, k))\n\t\t\tmax = mid;\n\t\telse\n\t\t\tmin = mid;\n\t}\n\tprintf(\"%d\\n\", max);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nlong main(void)\n{\n\tlong n, k;\n\tscanf(\"%ld%ld\", &n, &k);\n\tlong v = n, temp, sum, dv = 1;\n\tint i;\n\tfor(i = 1; i < k; i++)\n\t{\n\t\tsum = 0;\n\t\ttemp = i;\n\t\twhile(sum < n)\n\t\t{\n\t\t\tsum = sum + temp;\n\t\t\ttemp = temp*k;\n\t\t}\n\t\ttemp = temp/k;\n\t\tif(temp < v)\n\t\t{\n\t\t\tv = temp;\n\t\t}\n\t}\n\tif(n > 9)\n\t{\n\t\tdv = 10;\n\t}\n\tif(n > 99)\n\t{\n\t\tdv = 100;\n\t}\n\tif(n > 999)\n\t{\n\t\tdv = 1000;\n\t}\n\twhile(1)\n\t{\n\t\tv = v - dv;\n\t\ttemp = v;\n\t\tsum = 0;\n\t\twhile(temp != 0)\n\t\t{\n\t\t\tsum = sum + temp;\n\t\t\ttemp = temp/k;\n\t\t}\n\t\tif(sum < n)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t}\n\tfor(i = 1; i <= dv; i++)\n\t{\n\t\tsum = 0;\n\t\tv++;\n\t\ttemp = v;\n\t\twhile(temp != 0)\n\t\t{\n\t\t\tsum = sum + temp;\n\t\t\ttemp = temp/k;\n\t\t}\n\t\tif(sum >= n)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%ld\\n\", v);\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\nint main(void)\n{\n\tint n, k;\n\tscanf(\"%d%d\", &n, &k);\n\tint i, v = n, temp, sum;\n\tfor(i = 1; i < k; i++)\n\t{\n\t\tsum = 0;\n\t\ttemp = i;\n\t\twhile(sum < n)\n\t\t{\n\t\t\tsum = sum + temp;\n\t\t\ttemp = temp*k;\n\t\t}\n\t\ttemp = temp/k;\n\t\tif(temp < v)\n\t\t{\n\t\t\tv = temp;\n\t\t}\n\t}\n\tprintf(\"%d\\n\", v);\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\nint main(void)\n{\n\tint n, k;\n\tscanf(\"%d%d\", &n, &k);\n\tint i, v = n, temp, sum, dv = 1;\n\tfor(i = 1; i < k; i++)\n\t{\n\t\tsum = 0;\n\t\ttemp = i;\n\t\twhile(sum < n)\n\t\t{\n\t\t\tsum = sum + temp;\n\t\t\ttemp = temp*k;\n\t\t}\n\t\ttemp = temp/k;\n\t\tif(temp < v)\n\t\t{\n\t\t\tv = temp;\n\t\t}\n\t}\n\tif(n > 9)\n\t{\n\t\tdv = 10;\n\t}\n\tif(n > 99)\n\t{\n\t\tdv = 100;\n\t}\n\tif(n > 999)\n\t{\n\t\tdv = 1000;\n\t}\n\twhile(1)\n\t{\n\t\tv = v - dv;\n\t\ttemp = v;\n\t\tsum = 0;\n\t\twhile(temp != 0)\n\t\t{\n\t\t\tsum = sum + temp;\n\t\t\ttemp = temp/k;\n\t\t}\n\t\tif(sum < n)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t}\n\tfor(i = 1; i <= dv; i++)\n\t{\n\t\tsum = 0;\n\t\tv++;\n\t\ttemp = v;\n\t\twhile(temp != 0)\n\t\t{\n\t\t\tsum = sum + temp;\n\t\t\ttemp = temp/k;\n\t\t}\n\t\tif(sum >= n)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%d\\n\", v);\n\treturn 0;\n}"}, {"source_code": "#include \n\nint Cal(int v,int k)\n{\n int sum=v,b=k;\n while(v>=b)\n {\n sum+=v/b;\n b*=k;\n }\n return sum;\n}\n\nint main()\n{\n int N,K,Left,Right,Mid;\n scanf(\"%d %d\",&N,&K);\n Left=1;\n Right=K*N;\n while(Right>Left)\n {\n Mid=(Left+Right)/2;\n if(Cal(Mid,K)\n#include \nint isright(long long v,long long k,long long n)\n{\n long long sum=v;\n long long value =v/k;\n while(value!=0)\n {\n sum+=value;\n value=value/k;\n }\n if (sum==n)\n {\n return 1;\n }\n\n else if (sum>n)\n {\n return 2;\n\n }\n\n return 0;\n}\n\n\n\n\nint main()\n{\n\n long long lines;\n long long low=0,mid=0,value,min=1,high;\n int k;\n scanf(\"%I64d\",& lines);\n scanf(\"%d\",&k);\n high=lines;\n while(low\n#include \n#include \n\nint n = 0;\nint k = 0;\n\nint possibility(int num){\n int sum = 0;\n int add = num;\n int counter = 0;\n while(sum < n && add > 0){\n sum += add;\n counter ++;\n add = (int)(num / pow(k , counter));\n }\n if(sum < n){\n return 0;\n }\n return 1;\n}\nint main()\n{\n scanf(\"%d\" , &n);\n scanf(\"%d\" , &k);\n int left = 1;\n int right = n;\n int mid = 0;\n while(right > left){\n mid = left + (right - left) / 2;\n if(possibility(mid)){\n right = mid;\n }\n else{\n left = mid + 1;\n }\n }\n printf(\"%d\" , left);\n return 0;\n}\n"}, {"source_code": "#include\n\nlong n;\nint k;\n\nlong f(long x)\n{\n long retval=0,kval=1;\n for(;x>=kval;kval*=k)\n retval+=x/kval;\n return retval;\n}\n\n\nlong bin(long low,long high)\n{\n if(low>=high)\n return low;\n long mid=(low+high)/2;\n if(f(mid)\n\nlong n;\nint k;\n\nlong f(long x)\n{\n long retval=0,kval=1;\n for(;x>=kval;kval*=k)\n retval+=x/kval;\n return retval;\n}\n\n\nlong bin(long low,long high)\n{\n if(low>=high)\n return low;\n long mid=(low+high)/2;\n if(f(mid)\n#include \n#include \ntypedef long long ll;\n\nll giatrituongung(ll mid, ll k)\n{\n ll sum = mid;\n while (floor(mid*1.0 / k) > 0)\n {\n sum = sum + floor(mid*1.0 / k);\n k = k*k;\n }\n return sum;\n}\n\nll timkiem(ll n, ll k)\n{\n ll L = 1, R = 1e9, mid, x;\n while (L < R)\n {\n mid = (L + R) / 2;\n x = giatrituongung(mid, k);\n if (x == n)\n return mid;\n else if (x>n)\n R = mid;\n else\n L = mid + 1;\n }\n return L;\n}\n\nint main()\n{\n ll n, k;\n scanf(\"%I64d %I64d\", &n, &k);\n printf(\"%I64d\", timkiem(n, k));\n \n return 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n\tlong long n, k, v, i, sum;\n\tscanf(\"%I64d%I64d\", &n, &k);\n\tv = n * (k - 1) / k;\n\tsum = 0;\n\ti = 1;\n\twhile (v / i > 0)\n\t{\n\t\tsum += v / i;\n\t\ti *= k;\n\t}\n\tif (sum < n)\n\t\t++v;\n\tprintf(\"%I64d\\n\", v);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint n, k, l, r, m;\n\nint\ncnt(int m)\n{\n int ans = 0, t = 1;\n while(m >= t){\n ans += m / t;\n t *= k;\n }\n return ans;\n}\n\nint\nmain(void)\n{\n scanf(\"%d%d\", &n, &k);\n l = 1;\n r = n;\n while(r - l > 1){\n m = (l + r) / 2;\n if(cnt(m) >= n){\n r = m;\n } else {\n l = m + 1;\n }\n }\n if(cnt(l) >= n){\n printf(\"%d\", l);\n } else {\n printf(\"%d\", r);\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint fac , lines;\n\nint val_found(int start , int end)\n{\n int j ;\n if(start == end )return start;\n int mid = start + (end - start) / 2 ;\n int sum = 0 ;\n int l = 4 / 1;\n for(j = 1 ; mid / j != 0 ; j *= fac ){\n sum += mid / j ;\n }\n if(lines > sum)return val_found(mid + 1 , end);\n else return val_found(start , mid);\n}\n\nint main()\n{\n int n , k ;\n scanf(\"%d %d\" , &n ,&k);\n lines = n ; fac = k ;\n printf(\"%d\" , val_found(1 , n));\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint fac , lines;\n\nint val_found(int start , int end)\n{\n int j ;\n if(start == end )return start;\n int mid = start + (end - start) / 2 ;\n int sum = 0 ;\n for(j = 1 ; mid / j != 0 ; j *= fac ){\n sum += mid / j ;\n }\n if(lines > sum)return val_found(mid + 1 , end);\n else return val_found(start , mid);\n}\n\nint main()\n{\n int n , k ;\n scanf(\"%d %d\" , &n ,&k);\n lines = n ; fac = k ;\n printf(\"%d\" , val_found(0 , n));\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int k , ans;\n long long n ;\n scanf(\"%lld %d\" , &n , &k);\n ans = ((n * (k - 1) / k ) / k + 1) * k;\n printf(\"%d\" , ans);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int k ;\n long long n , ans;\n scanf(\"%I64d %d\" , &n , &k);\n ans = ((n * (k - 1) / k ) / k + 1) * k;\n printf(\"%I64d\" , ans);\n return 0;\n}\n\n"}, {"source_code": "#define si(a) scanf(\"%d\",&a)\n#define pi(a) printf(\"%d\\n\",a)\n#include\nint k,n;\nint oil(int v){\n\tint s=0,i=1;\n\twhile(v/i){\n\t\ts+=(v/i);\n\t\ti*=k;\n\t}\n\tif(s\n#include\n#include\nint n,k;\nint eval(int n,int k)\n{\n\tint m,s=0;\n\tfor(m=1;(int)(n/m)>0;m*=k)\n\t\ts+=(int)(n/m);\n\treturn s;\n}\nint f(int n,int k,int lb,int ub)\n{\n\tint v,s;\n\tv=(int)((lb+ub)/2);\n\tif(n==k||nn&&eval(v-1,k)n)\n\t\tf(n,k,lb,v);\n\telse if(eval(v,k)\n#include\n#include\nint f(int n,int v,int k)\n{\n int s=0,m;\n for(m=1;(int)(v/m)>0;m=m*k)\n {\n s+=(int)(v/m);\n }\n if(s==n||s>n) \n return 1;\n else\n return 0;\n}\n\nint main()\n{\n int m,n,i,k,s;\n scanf(\"%d %d\",&n,&k);\n for(i=n;i>1;i--)\n {\n if(!f(n,i,k))\n {\n printf(\"%d\",i+1);\n break;\n }\n }\n //getch();\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint n, k;\n\nint w(int v) {\n\tint kn=1, ret=0;\n\twhile (v/kn>0) {\n\t\tret+=v/kn;\n\t\tkn*=k;\n\t}\n\treturn ret;\n}\n\nint search(void) {\n\tint lo=1, hi=10000001, x;\n\twhile (lo < hi) {\n\t\tx=(lo+hi)/2;\n\t\tif (w(x) < n) lo=x+1;\n\t\telse hi=x;\n\t}\n\treturn lo;\n}\n\nint main(void) {\n\tscanf(\"%d %d\", &n, &k);\n\tprintf(\"%d\\n\", search());\n\texit(EXIT_SUCCESS);\n}\n"}, {"source_code": "#include \n#include \n#include \n#include\n\n\n// off by one error\n\nbool check (long long int v,long long n,int k)\n{\n long long i=1,result=v;\n while(1)\n {\n long long term=v/(pow(k,i));\n if (term==0)\n {\n if (result>=n) return true ;\n else return false ;\n }\n result += term;\n i++;\n }\n}\n\nlong long binSearch (long long first,long long last,int k )\n{\n long long l=first,r=last,mid;\n while (l<=r)\n {\n mid = (l+r)/2;\n if (check(mid,last,k))\n {\n r=mid-1;\n }\n else\n\n {\n l=mid+1;\n }\n }\n return l ;\n}\n\nint main()\n{\n long long int n ;\n int k ;\n scanf(\"%lld%d\",&n,&k);\n printf(\"%lld\",binSearch(0,n,k));\n return 0;\n}\n"}], "src_uid": "41dfc86d341082dd96e089ac5433dc04"} {"nl": {"description": "There are n shovels in Polycarp's shop. The i-th shovel costs i burles, that is, the first shovel costs 1 burle, the second shovel costs 2 burles, the third shovel costs 3 burles, and so on. Polycarps wants to sell shovels in pairs.Visitors are more likely to buy a pair of shovels if their total cost ends with several 9s. Because of this, Polycarp wants to choose a pair of shovels to sell in such a way that the sum of their costs ends with maximum possible number of nines. For example, if he chooses shovels with costs 12345 and 37454, their total cost is 49799, it ends with two nines.You are to compute the number of pairs of shovels such that their total cost ends with maximum possible number of nines. Two pairs are considered different if there is a shovel presented in one pair, but not in the other.", "input_spec": "The first line contains a single integer n (2 ≤ n ≤ 109) — the number of shovels in Polycarp's shop.", "output_spec": "Print the number of pairs of shovels such that their total cost ends with maximum possible number of nines. Note that it is possible that the largest number of 9s at the end is 0, then you should count all such ways. It is guaranteed that for every n ≤ 109 the answer doesn't exceed 2·109.", "sample_inputs": ["7", "14", "50"], "sample_outputs": ["3", "9", "1"], "notes": "NoteIn the first example the maximum possible number of nines at the end is one. Polycarp cah choose the following pairs of shovels for that purpose: 2 and 7; 3 and 6; 4 and 5. In the second example the maximum number of nines at the end of total cost of two shovels is one. The following pairs of shovels suit Polycarp: 1 and 8; 2 and 7; 3 and 6; 4 and 5; 5 and 14; 6 and 13; 7 and 12; 8 and 11; 9 and 10. In the third example it is necessary to choose shovels 49 and 50, because the sum of their cost is 99, that means that the total number of nines is equal to two, which is maximum possible for n = 50."}, "positive_code": [{"source_code": "#include \nint main()\n{\nlong long int n,p,way;\np=10;\nscanf(\"%I64d\",&n);\nn=n*2;\nwhile(n%p!=n) p=p*10;\np=p/10;\nn=n/2;\nif(p==1) way=n*(n-1)/2;\nelse if(n%p<=p/2-1) way=(1+n/p)*(n%p)*(n/p)+(p/2-n%p)*(n/p)*(n/p);\nelse if(n%p<=p-2) way=(n%p-p/2+1)*(n/p+1)*(n/p+1)+(p-2-n%p)*(n/p)*(n/p+1)+(n/p)*(n/p);\nelse way=(n/p+1)*(n/p)+(p/2-1)*(n/p+1)*(n/p+1);\nprintf(\"%I64d\",way);\nreturn 0;\n}\n"}, {"source_code": "//Date : 17 - 12 - 17\n\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#define ll long long\n#define For(i,n)\tfor(i=0;i b ? a : b)\t;}\nll gcd(ll a,ll b){\n\tif(a==0)\treturn b;\n\treturn gcd(b%a ,a);\n} \nvoid swap(ll *a,ll *b){\n\tll t = *a;\n\t*a = *b;\n\t*b = t;\n}\nint main(){\n\tint n;\n\ts(n);\n\tll sum = 0LL + n + n - 1;\n\tll ms = sum;\n\tint x = 0 ,_9 = 0;\n\twhile(sum){\n\t\tif(sum % 10 == 9)\t_9++;\n\t\tsum /= 10;\n\t\tx++;\n\t}\n\t//printf(\"%d %d\" ,x ,_9);\n\tif(_9 == x){\tprintf(\"1\");\treturn 0;\t}\n\tif(x == 1){\tprintf(\"%I64d\" ,1LL*n*(n - 1) / 2);\treturn 0;\t}\n\tx--;\n\t_9 = x;\tsum = 0;\n\tll inc = 1;\n\twhile(x){\n\t\tsum = sum * 10LL + 9;\n\t\tinc *= 10;\n\t\tx--;\n\t}\n\t//printf(\"%I64d %I64d\\n\" ,sum ,inc);\n\tll ans = 0 ,lo ,hi ,r ,v;\n\tbool ff = 0;\n\twhile(sum <= ms){\n\t\tlo = 1 ,hi = n ,ff = 0;\n\t\twhile(lo <= hi){\n\t\t\tr =\t(lo + hi) / 2;\n\t\t\tv = sum - r;\n\t\t\tif(v < 0)\thi = r - 1;\n\t\t\telse if(v > n)\tlo = r + 1;\n\t\t\telse {\tff = 1;\tbreak;\t}\n\t\t}\n\t\tif(ff){\n\t\t\tif(r > v)\tswap(&v ,&r);\n\t\t\t//printf(\"%I64d %I64d\\n\" ,r ,v);\n\t\t\tans += min(r ,n - v + 1);\n\t\t\tll diff = v - r - 1;\n\t\t\tans += diff / 2;\n\t\t}\n\t\tsum += inc;\n\t}\n\tprintf(\"%I64d\" ,ans);\n\treturn 0;\n}"}, {"source_code": "#include \n\nint Cnt[10];\n\nint main()\n{\n int table[] = {999999999, 99999999, 9999999, 999999, 99999, 9999, 999, 99, 9};\n int n, reamin = 0, ans = 0;\n scanf(\"%d\", &n);\n for(int i = 0; i < 9; ++i) {\n if(n + n - 1 >= table[i]) {\n reamin = table[i];\n break;\n }\n }\n if(reamin == 0) {\n printf(\"%d\\n\", n * (n - 1) / 2);\n return 0;\n }\n for(int i = 0; i < 9; ++i) {\n long long expect = (long long)(reamin + 1) * i + reamin;\n if(n + n - 1 >= expect) {\n if(expect <= n) {\n ans += expect / 2;\n } else {\n ans += n - expect / 2;\n }\n }\n }\n printf(\"%d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(){\n\tlong long int i,n;\n\tscanf(\"%lld\",&n);\n\tlong long int temp=n*2;\n\ttemp/=10;\n\tlong long int m=0;\n\tlong long int m10=1;\n\twhile(temp>0){\n\t\ttemp/=10;\n\t\tm++;\n\t\tm10*=10;\n\t}\n\tif(m==0){\n\t\tprintf(\"%lld\\n\",(n*(n-1))/2);\n\t\treturn 0;\n\t}\n\tlong long int ans=0,val=0;\n\tfor(i=1;i<=9;i++){\n\t\tif(i*m10>2*n)break;\n\t\tif(n>=i*m10-1){\n\t\t\tans+=((i*m10/2)-1);\n//\t\t\tval=((i*m10/2)-1);\n//\t\t\tprintf(\"%d=%d\\n\",i,val);\n\t\t}\n\t\telse{\n\t\t\tans+=(n+1-(i*m10/2));\n//\t\t\tval=(n+1-(i*m10/2));\n//\t\t\tprintf(\"%d=%d\\n\",i,val);\n\t\t}\n\t}\n\tprintf(\"%lld\\n\",ans);\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n#include \n#include \n\n#define MIN(a, b) ((a)<(b)?(a):(b))\n#define MAX(a, b) ((a)>(b)?(a):(b))\n\n#define MOD 1e9+7\n#define M 25\n\nint a[5]= {0,0,1,3,6};\n\nint main() {\n int n;\n// freopen(\"1.txt\", \"r\", stdin);\n// freopen(\"2.txt\", \"w\", stdout);\n while(scanf(\"%d\", &n)!=EOF) {\n if (n < 5) {\n printf(\"%d\\n\",a[n]);\n continue;\n }\n long long s = 0LL, t=5LL,i;\n for(i = 1; i <10; i++) {\n if (n >=t) {\n t*=10;\n } else {\n break;\n }\n }\n t/=10;\n for(i=1; i<=5; i++) {\n if(n>t*i*2+t-1) {\n s+=2*t*i;\n s--;\n } else {\n i--;\n break;\n }\n }\n s+=(n-t*i*2-t+1)*(i+1);\n if(n>=t+t-1+i*(t*10/5)) {\n s--;\n }\n printf(\"%d\\n\",s);\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\n\n\n\nlong long int myfunc(long long int n){\n if(n <= 4)\n return n * (n - 1) / 2;\n long double s = 1.0 * n / 5;\n s = log10l(s);\n s = floorl(s);\n long long int m = 5 * (long long int)powl(10, s);\n long long int result = 0ll;\n for(int i = 0 ; i < 9 ; i++){\n long long int min, max;\n min = (long long int)((i+1) * powl(10, s+1) / 2);\n max = (long long int)((i+1) * powl(10, s+1) - 2);\n if (n >= max){\n result += min - 1;\n }else if( n < min ){\n break;\n }else{\n result += n - min + 1 ;\n }\n }\n return result;\n}\n\n\nint main(){\n long long int n;\n scanf(\"%lld\", &n);\n\n printf(\"%lld\", myfunc(n));\n}"}], "negative_code": [{"source_code": "#include \nint main()\n{\nlong long int n,p,way;\np=10;\nscanf(\"%I64d\",&n);\nn=n*2;\nwhile(n%p!=n) p=p*10;\np=p/10;\nn=n/2;\nif(p==1) way=0;\nelse if(n%p<=p/2-1) way=(1+n/p)*(n%p)*(n/p)+(p/2-n%p)*(n/p)*(n/p);\nelse if(n%p<=p-2) way=(n%p-p/2+1)*(n/p+1)*(n/p+1)+(p-2-n%p)*(n/p)*(n/p+1)+(n/p)*(n/p);\nelse way=(n/p+1)*(n/p)+(p/2-1)*(n/p+1)*(n/p+1);\nprintf(\"%I64d\",way);\nreturn 0;\n}\n"}, {"source_code": "#include \nint main()\n{\nlong long int n,p,way;\np=10;\nscanf(\"%I64d\",&n);\nn=n*2;\nwhile(n%p!=n) p=p*10;\np=p/10;\nn=n/2;\nif(p==1) way=n;\nelse if(n%p<=p/2-1) way=(1+n/p)*(n%p)*(n/p)+(p/2-n%p)*(n/p)*(n/p);\nelse if(n%p<=p-2) way=(n%p-p/2+1)*(n/p+1)*(n/p+1)+(p-2-n%p)*(n/p)*(n/p+1)+(n/p)*(n/p);\nelse way=(n/p+1)*(n/p)+(p/2-1)*(n/p+1)*(n/p+1);\nprintf(\"%I64d\",way);\nreturn 0;\n}\n"}, {"source_code": "//Date : 17 - 12 - 17\n\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#define ll long long\n#define For(i,n)\tfor(i=0;i b ? a : b)\t;}\nll gcd(ll a,ll b){\n\tif(a==0)\treturn b;\n\treturn gcd(b%a ,a);\n} \nvoid swap(ll *a,ll *b){\n\tll t = *a;\n\t*a = *b;\n\t*b = t;\n}\nint main(){\n\tint n;\n\ts(n);\n\tll sum = n + n - 1;\n\tll ms = sum;\n\tint x = 0 ,_9 = 0;\n\twhile(sum){\n\t\tif(sum % 10 == 9)\t_9++;\n\t\tsum /= 10;\n\t\tx++;\n\t}\n\t//printf(\"%d %d\" ,x ,_9);\n\tif(_9 == x){\tprintf(\"1\");\treturn 0;\t}\n\tif(x == 1){\tprintf(\"%I64d\" ,n*(n - 1) / 2);\treturn 0;\t}\n\tx--;\n\t_9 = x;\tsum = 0;\n\tll inc = 1;\n\twhile(x){\n\t\tsum = sum * 10 + 9;\n\t\tinc *= 10;\n\t\tx--;\n\t}\n\tll ans = 0 ,lo ,hi ,r ,v;\n\tbool ff = 0;\n\twhile(sum <= ms){\n\t\tlo = 1 ,hi = n ,ff = 0;\n\t\twhile(lo <= hi){\n\t\t\tr =\t(lo + hi) / 2;\n\t\t\tv = sum - r;\n\t\t\tif(v < 0)\thi = r - 1;\n\t\t\telse if(v > n)\tlo = r + 1;\n\t\t\telse {\tff = 1;\tbreak;\t}\n\t\t}\n\t\tif(ff){\n\t\t\tif(r > v)\tswap(&v ,&r);\n\t\t\tans += min(r ,n - v + 1);\n\t\t\tll diff = v - r;\n\t\t\tans += (diff - 1) / 2;\n\t\t}\n\t\tsum += inc;\n\t}\n\tprintf(\"%I64d\" ,ans);\n\treturn 0;\n}"}, {"source_code": "#include \n\nint Cnt[10];\n\nint main()\n{\n int table[] = {999999999, 99999999, 9999999, 999999, 99999, 9999, 999, 99, 9};\n int n, reamin = 0, ans = 0;\n scanf(\"%d\", &n);\n for(int i = 0; i < 9; ++i) {\n if(n + n - 1 >= table[i]) {\n reamin = table[i];\n break;\n }\n }\n if(reamin == 0) {\n printf(\"%d\\n\", (int)((long long)n * (n - 1) / 2));\n return 0;\n }\n for(int i = 0; i < 9; ++i) {\n int expect = (reamin + 1) * i + reamin;\n if(n + n - 1 >= expect) {\n if(expect <= n) {\n ans += expect / 2;\n } else {\n ans += n - expect / 2;\n }\n }\n }\n printf(\"%d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(){\n\tlong long int i,n;\n\tscanf(\"%lld\",&n);\n\tlong long int temp=n*2;\n\ttemp/=10;\n\tlong long int m=0;\n\tlong long int m10=1;\n\twhile(temp>0){\n\t\ttemp/=10;\n\t\tm++;\n\t\tm10*=10;\n\t}\n\tif(m==0){\n\t\tprintf(\"%ld\\n\",(n*n)/2);\n\t\treturn 0;\n\t}\n\tlong long int ans=0,val=0;\n\tfor(i=1;i<9;i++){\n\t\tif(i*m10>2*n)break;\n\t\tif(n>=i*m10-1){\n\t\t\tans+=((i*m10/2)-1);\n//\t\t\tval=((i*m10/2)-1);\n//\t\t\tprintf(\"%d\\n\",val);\n\t\t}\n\t\telse{\n\t\t\tans+=(n+1-(i*m10/2));\n//\t\t\tval=(n+1-(i*m10/2));\n//\t\t\tprintf(\"%d\\n\",val);\n\t\t}\n\t}\n\tprintf(\"%lld\\n\",ans);\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main(){\n\tlong long int i,n;\n\tscanf(\"%lld\",&n);\n\tlong long int temp=n*2;\n\ttemp/=10;\n\tlong long int m=0;\n\tlong long int m10=1;\n\twhile(temp>0){\n\t\ttemp/=10;\n\t\tm++;\n\t\tm10*=10;\n\t}\n\tif(m==0){\n\t\tprintf(\"%ld\\n\",(n*(n-1))/2);\n\t\treturn 0;\n\t}\n\tlong long int ans=0,val=0;\n\tfor(i=1;i<9;i++){\n\t\tif(i*m10>2*n)break;\n\t\tif(n>=i*m10-1){\n\t\t\tans+=((i*m10/2)-1);\n//\t\t\tval=((i*m10/2)-1);\n//\t\t\tprintf(\"%d\\n\",val);\n\t\t}\n\t\telse{\n\t\t\tans+=(n+1-(i*m10/2));\n//\t\t\tval=(n+1-(i*m10/2));\n//\t\t\tprintf(\"%d\\n\",val);\n\t\t}\n\t}\n\tprintf(\"%lld\\n\",ans);\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n#include \n\n\n\n\nlong long int myfunc(long long int n){\n if(n <= 4)\n return 0ll;\n long double s = 1.0 * n / 5;\n s = log10l(s);\n s = floorl(s);\n long long int m = 5 * (long long int)powl(10, s);\n long long int result = 0ll;\n for(int i = 0 ; i < 9 ; i++){\n long long int min, max;\n min = (long long int)((i+1) * powl(10, s+1) / 2);\n max = (long long int)((i+1) * powl(10, s+1) - 2);\n if (n >= max){\n result += min - 1;\n }else if( n < min ){\n break;\n }else{\n result += n - min + 1 ;\n }\n }\n return result;\n}\n\n\nint main(){\n long long int n;\n scanf(\"%lld\", &n);\n\n printf(\"%lld\", myfunc(n));\n}"}, {"source_code": "#include \n#include \n#include \n\n\n\n\nlong long int myfunc(long long int n){\n if(n <= 4)\n return n;\n long double s = 1.0 * n / 5;\n s = log10l(s);\n s = floorl(s);\n long long int m = 5 * (long long int)powl(10, s);\n long long int result = 0ll;\n for(int i = 0 ; i < 9 ; i++){\n long long int min, max;\n min = (long long int)((i+1) * powl(10, s+1) / 2);\n max = (long long int)((i+1) * powl(10, s+1) - 2);\n if (n >= max){\n result += min - 1;\n }else if( n < min ){\n break;\n }else{\n result += n - min + 1 ;\n }\n }\n return result;\n}\n\n\nint main(){\n long long int n;\n scanf(\"%lld\", &n);\n\n printf(\"%lld\", myfunc(n));\n}"}], "src_uid": "c20744c44269ae0779c5f549afd2e3f2"} {"nl": {"description": "There is an old tradition of keeping 4 boxes of candies in the house in Cyberland. The numbers of candies are special if their arithmetic mean, their median and their range are all equal. By definition, for a set {x1, x2, x3, x4} (x1 ≤ x2 ≤ x3 ≤ x4) arithmetic mean is , median is and range is x4 - x1. The arithmetic mean and median are not necessary integer. It is well-known that if those three numbers are same, boxes will create a \"debugging field\" and codes in the field will have no bugs.For example, 1, 1, 3, 3 is the example of 4 numbers meeting the condition because their mean, median and range are all equal to 2.Jeff has 4 special boxes of candies. However, something bad has happened! Some of the boxes could have been lost and now there are only n (0 ≤ n ≤ 4) boxes remaining. The i-th remaining box contains ai candies.Now Jeff wants to know: is there a possible way to find the number of candies of the 4 - n missing boxes, meeting the condition above (the mean, median and range are equal)?", "input_spec": "The first line of input contains an only integer n (0 ≤ n ≤ 4). The next n lines contain integers ai, denoting the number of candies in the i-th box (1 ≤ ai ≤ 500).", "output_spec": "In the first output line, print \"YES\" if a solution exists, or print \"NO\" if there is no solution. If a solution exists, you should output 4 - n more lines, each line containing an integer b, denoting the number of candies in a missing box. All your numbers b must satisfy inequality 1 ≤ b ≤ 106. It is guaranteed that if there exists a positive integer solution, you can always find such b's meeting the condition. If there are multiple answers, you are allowed to print any of them. Given numbers ai may follow in any order in the input, not necessary in non-decreasing. ai may have stood at any positions in the original set, not necessary on lowest n first positions.", "sample_inputs": ["2\n1\n1", "3\n1\n1\n1", "4\n1\n2\n2\n3"], "sample_outputs": ["YES\n3\n3", "NO", "YES"], "notes": "NoteFor the first sample, the numbers of candies in 4 boxes can be 1, 1, 3, 3. The arithmetic mean, the median and the range of them are all 2.For the second sample, it's impossible to find the missing number of candies.In the third example no box has been lost and numbers satisfy the condition.You may output b in any order."}, "positive_code": [{"source_code": "#include \n\n#define MIN(A, B) (A < B ? A : B)\n#define MAX(A, B) (A > B ? A : B)\n\nint main() {\n\tint min, max, med, n, a, b, c, d;\n\n\tscanf(\"%d\", &n);\n\tswitch (n) {\n\t\tcase 0:\n\t\t\tprintf(\"YES\\n1\\n1\\n3\\n3\\n\");\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tscanf(\"%d\", &a);\n\t\t\tprintf(\"YES\\n%d\\n%d\\n%d\\n\", a, 3 * a, 3 * a);\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tscanf(\"%d%d\", &a, &b);\n\t\t\tmin = MIN(a, b);\n\t\t\tmax = MAX(a, b);\n\t\t\tif (3 * min >= max)\n\t\t\t\tprintf(\"YES\\n%d\\n%d\\n\", 3 * min, 4 * min - max);\n\t\t\telse\n\t\t\t\tprintf(\"NO\\n\");\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tscanf(\"%d%d%d\", &a, &b, &c);\n\t\t\tmin = MIN(a, MIN(b, c));\n\t\t\tmax = MAX(a, MAX(b, c));\n\t\t\tmed = a + b + c - min - max;\n\n\t\t\tif (3 * min == max)\n\t\t\t\tprintf(\"YES\\n%d\\n\", 4 * min - med);\n\t\t\telse if (3 * min < max)\n\t\t\t\tprintf(\"NO\\n\");\n\t\t\telse if ((max + med - min) == min * 3)\n\t\t\t\tprintf(\"YES\\n%d\\n\", max + med - min);\n\t\t\telse if (3 * (min + med - max) == max)\n\t\t\t\tprintf(\"YES\\n%d\\n\", min + med - max);\n\t\t\telse\n\t\t\t\tprintf(\"NO\\n\");\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tscanf(\"%d%d%d%d\", &a, &b, &c, &d);\n\t\t\tmin = MIN(a, MIN(b, MIN(c, d)));\n\t\t\tmax = MAX(a, MAX(b, MAX(c, d)));\n\t\t\tprintf(\"%s\\n\", 3 * min == max && a + b + c + d == 8 * min\n\t\t\t\t\t? \"YES\" : \"NO\");\n\t\t\tbreak;\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \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 n, tmp;\n\tstatic int a[4];\n\n\tscanf(\"%d\", &n);\n\tswitch (n) {\n\t\tcase 0:\n\t\t\tprintf(\"YES\\n1\\n1\\n3\\n3\\n\");\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tscanf(\"%d\", &a[0]);\n\t\t\tprintf(\"YES\\n%d\\n%d\\n%d\\n\", a[0], 3 * a[0], 3 * a[0]);\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tscanf(\"%d%d\", &a[0], &a[1]);\n\t\t\tif (a[0] > a[1])\n\t\t\t\ttmp = a[0], a[0] = a[1], a[1] = tmp;\n\t\t\tif (a[1] == 3 * a[0])\n\t\t\t\tprintf(\"YES\\n%d\\n%d\\n\", a[0], a[1]);\n\t\t\telse if (a[0] == a[1])\n\t\t\t\tprintf(\"YES\\n%d\\n%d\\n\", 3 * a[0], 3 * a[0]);\n\t\t\telse if (3 * a[0] > a[1])\n\t\t\t\tprintf(\"YES\\n%d\\n%d\\n\", 3 * a[0], 4 * a[0] - a[1]);\n\t\t\telse\n\t\t\t\tprintf(\"NO\\n\");\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tscanf(\"%d%d%d\", &a[0], &a[1], &a[2]);\n\t\t\tqsort(a, 3, sizeof(*a), compare);\n\t\t\tif (4 * a[0] == a[1] + a[2])\n\t\t\t\tprintf(\"YES\\n%d\\n\", 3 * a[0]);\n\t\t\telse if (a[2] == 3 * a[0])\n\t\t\t\tprintf(\"YES\\n%d\\n\", 4 * a[0] - a[1]);\n\t\t\telse if (a[2] % 3 == 0\n\t\t\t\t\t&& a[2] / 3 <= a[0]\n\t\t\t\t\t&& a[2] * 4 / 3 == a[0] + a[1])\n\t\t\t\tprintf(\"YES\\n%d\\n\", a[2] / 3);\n\t\t\telse\n\t\t\t\tprintf(\"NO\\n\");\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tscanf(\"%d%d%d%d\", &a[0], &a[1], &a[2], &a[3]);\n\t\t\tqsort(a, 4, sizeof(*a), compare);\n\t\t\tprintf(\"%s\\n\", a[3] == 3 * a[0] && 4 * a[0] == a[1] + a[2] \n\t\t\t\t\t? \"YES\" : \"NO\");\n\t\t\tbreak;\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tint i,j,t,n,x[8];\n\tscanf(\"%d\",&n);\n\tfor(i=1;i<=n;i++)\n\t\tscanf(\"%d\",x+i);\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tfor(j=i+1;j<=n;j++)\n\t\tif(x[i]>x[j])\n\t\t{\n\t\t\tt=x[i];x[i]=x[j];x[j]=t;\n\t\t}\n\t}\n\tif(n==0) printf(\"YES\\n1\\n2\\n2\\n3\\n\");\n\telse if(n==1) printf(\"YES\\n%d\\n%d\\n%d\\n\",x[1],3*x[1],3*x[1]);\n\telse if(n==2) \n\t{\n\t\tif(x[2]>3*x[1]) printf(\"NO\\n\");\n\t\telse printf(\"YES\\n%d\\n%d\\n\",x[1]*4-x[2],3*x[1]);\n\t}\n\telse if(n==3)\n\t{\n\t\tif(x[3]==3*x[1]) printf(\"YES\\n%d\\n\",x[1]*4-x[2]);\n\t\telse if(x[2]+x[3]==4*x[1]) printf(\"YES\\n%d\\n\",x[1]*3);\n\t\telse if(x[3]%3==0)\n\t\t{\n\t\t\tt=x[3]/3;\n\t\t\tif(x[2]+x[1]==4*t) printf(\"YES\\n%d\\n\",t);\n\t\t\telse printf(\"NO\\n\");\n\t\t}\t\n\t\telse printf(\"NO\\n\");\n\t}\n\telse if(n==4)\n\t{\n\t\tif(x[4]==3*x[1]&&x[2]+x[3]==4*x[1]) printf(\"YES\\n\");\n\t\telse printf(\"NO\\n\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint i,j,r,q,n;\n\tint a[4]={0};\n\tscanf(\"%d\",&n);\n\tfor(i=0;ia[j])\n\t\t\t{\n\t\t\t\ta[i]=a[i]^a[j];\n\t\t\t\ta[j]=a[i]^a[j];\n\t\t\t\ta[i]=a[i]^a[j];\n\n\t\t\t}\n\t\t}\n//\t\t\tprintf(\"a[i]:%d\",a[i]);\n\t}\t\n//\t\tprintf(\"\\n\");\n\n\t\n\tif(n==0)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\tprintf(\"1\\n1\\n3\\n3\\n\");\n\t}\n\telse if(n==1)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\tprintf(\"%d\\n%d\\n%d\\n\",a[0],3*a[0],3*a[0]);\n\t}\n\telse if(n==2)\n\t{\n\t\tq=a[0];\n\t\tr=a[1];\n\t\tif(r<=(3*q))\n\t\t{\n\t\t\tprintf(\"YES\\n\");\n\t\t\tif(r>((4*q)-r))\n\t\t\t\tprintf(\"%d\\n%d\\n\",((4*q)-r),3*q);\n\t\t\telse\n\t\t\t\tprintf(\"%d\\n%d\\n\",((4*q)-r),3*q);\n\t\t}\n\t\telse\n\t\t\tprintf(\"NO\\n\");\n\t}\n\telse if(n==3)\n\t{\n\t\tif(a[2]==3*a[0])\n\t\t{\n\t\t\tprintf(\"YES\\n\");\n\t\t\tif((a[2]+a[0])-a[1]>a[1])\n\t\t\t\tprintf(\"%d\\n\",(a[2]+a[0])-a[1]);\n\t\t\telse\n\t\t\t\tprintf(\"%d\\n\",(a[2]+a[0])-a[1]);\n\t\t}\n\t\telse if(a[2]+a[1]==4*a[0])\n\t\t\tprintf(\"YES\\n%d\\n\",3*a[0]);\n\t\telse if((4*a[2])==3*(a[1]+a[0]))\n\t\t\tprintf(\"YES\\n%d\\n\",a[2]/3);\n\t\telse \n\t\t\tprintf(\"NO\\n\");\n\t}\n\tif(n==4)\n\t\tif(a[3]==3*a[0]&&a[3]+a[0]==a[1]+a[2])\n\t\tprintf(\"YES\\n\");\n\t\telse printf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\ndouble median(int *T)\n{\n return ((double)T[1]+(double)T[2])/2;\n}\n\ndouble arithmetic(int *T)\n{\n return ((double)T[0]+(double)T[1]+(double)T[2]+(double)T[3])/4;\n}\n\ndouble range(int *T)\n{\n return ((double)T[3]-(double)T[0]);\n}\n\nint cmp(const void *a, const void *b)\n{\n if (*(int*)a > *(int*)b)\n return 1;\n else if (*(int*)a == *(int*)b)\n return 0;\n else\n return -1;\n}\n\nint sort(int *T, int k)\n{\n int echanger = 1,i;\n while (echanger == 1)\n {\n echanger = 0;\n for (i=0;i<3;++i)\n {\n if (T[i] > T[i+1])\n {\n if (k == i)\n k = i+1;\n else if (k==(i+1))\n k = i;\n int aux = T[i];\n T[i] = T[i+1];\n T[i+1] = aux;\n echanger = 1;\n }\n }\n }\n\n return k;\n}\n\nint main()\n{\n int n;\n int T[6];\n memset(T,0,sizeof(T));\n scanf(\"%d\", &n);\n\n //sscanf(\"3 132 44 126\", \"%d %d %d %d\", &n, &T[0], &T[1], &T[2], &T[3]);\n\n int i,j,k,l;\n\n for (i=0;i\n\nint main()\n{\n int n,i,temp,c,d;\n scanf(\"%d\",&n);\n int a[4];\n for(i=0;ia[1])\n {\n temp=a[0];\n a[0]=a[1];\n a[1]=temp;\n }\n if(a[1]==(3*a[0]))\n {\n a[3]=a[1];\n a[1]=a[0];\n a[2]=(4*a[0]-a[1]);\n printf(\"YES\\n\");\n printf(\"%d\\n%d\\n\",a[1],a[2]);\n return 0;\n\n }\n else if(a[1]>(3*a[0]))\n {\n printf(\"NO\\n\");\n return 0;\n\n }\n else\n {\n a[3]=3*a[0];\n a[2]=(4*a[0]-a[1]);\n printf(\"YES\\n\");\n printf(\"%d\\n%d\\n\",a[2],a[3]);\n return 0;\n }\n }\n else if(n==3)\n {\n for (c = 0 ; c < ( n - 1 ); c++)\n {\n for (d = 0 ; d < (n - 1); d++)\n {\n if (a[d] > a[d+1])\n {\n temp= a[d];\n a[d] = a[d+1];\n a[d+1] = temp;\n }\n }\n }\n //printf(\"%d\\n%d\\n%d\\n\",a[0],a[1],a[2]);\n if(a[2]>(3*a[0]))\n {\n printf(\"NO\\n\");\n return 0;\n }\n if(a[2]==3*a[0])\n {\n a[3]=a[2];\n a[2]=((4*a[0])-a[1]);\n printf(\"YES\\n\");\n printf(\"%d\\n\",a[2]);\n return 0;\n }\n if(a[2]<(3*a[0]))\n {\n float z=(float)a[2]/3;\n //printf(\"%f\\n\",z);\n\n if((4*z)==(a[0]+a[1]))\n {\n\n for(c=3;c>=1;c--)\n {\n a[c]=a[c-1];\n }\n a[0]=a[3]/3;\n printf(\"YES\\n\");\n printf(\"%d\\n\",a[0]);\n return 0;\n }\n else if(a[1]+a[2]==(4*a[0]))\n {\n a[3]=3*a[0];\n printf(\"YES\\n\");\n printf(\"%d\\n\",a[3]);\n return 0;\n }\n else\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n\n }\n else if(n==4)\n {\n for (c = 0 ; c < ( n - 1 ); c++)\n {\n for (d = 0 ; d < (n - 1); d++)\n {\n if (a[d] > a[d+1])\n {\n temp= a[d];\n a[d] = a[d+1];\n a[d+1] = temp;\n }\n }\n }\n if((a[3]==(3*a[0]))&&(a[1]+a[2]==(4*a[0])))\n {\n printf(\"YES\\n\");\n return 0;\n }\n else\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n return 0;\n}\n\n"}, {"source_code": "#include\n#include\n#include\n#define Y \"YES\"\n#define N \"NO\"\nint Merge(long long *a, int l, int r);\nlong long temp[7];\nint main(void)\n{\n int n;\n long long a[7];\n long long x1;\n bool find = false;\n scanf(\"%d\", &n);\n if (n == 0)\n printf(\"%s\\n%d\\n%d\\n%d\\n%d\\n\", Y,1,1,3,3);\n else if (n == 1)\n {\n scanf(\"%I64d\", &a[1]);\n a[4] = 3*a[1];\n for (a[2] = a[1]; a[2] <= a[4]&&!find; a[2]++)\n {\n for (a[3] = a[2]; a[3] <= a[4]&&!find; a[3]++)\n if ((a[2] + a[3]) == 4 * a[1])\n {\n find = true;\n break;\n }\n if (find)\n break;\n }\n if (find)\n printf(\"%s\\n%I64d\\n%I64d\\n%I64d\\n\", Y, a[2], a[3], a[4]);\n else\n printf(\"%s\\n\", N);\n\n }\n else if (n == 2)\n {\n scanf(\"%I64d%I64d\", &a[1], &a[2]);\n Merge(a, 1, n);\n if (a[2] != 3 * a[1])\n {\n a[4] = 3 * a[1];\n a[3] = 4 * a[1] - a[2];\n if (a[3]>=1)\n printf(\"%s\\n%I64d\\n%I64d\\n\", Y, a[3], a[4]);\n else\n printf(\"%s\\n\", N);\n\n }\n else\n {\n a[4] = a[2];\n for (a[2] = a[1]; a[2] <= a[4] && !find; a[2]++)\n {\n for (a[3] = a[2]; a[3] <= a[4] && !find; a[3]++)\n if (a[3] == (4 * a[1] - a[2]) && !find)\n {\n find = true;\n break;\n }\n if (find)\n break;\n }\n if (find)\n printf(\"%s\\n%I64d\\n%I64d\\n\", Y, a[2], a[3]);\n else\n printf(\"%s\\n\", N);\n } \n \n }\n else if (n == 3)\n {\n scanf(\"%I64d%I64d%I64d\", &a[1], &a[2], &a[3]);\n Merge(a, 1, n);\n if (((a[1] + a[2]) * 3) != 4*a[3])\n {\n if (a[3] == 3 * a[1])\n {\n a[4] = a[3];\n for (a[3] = a[1]; a[3] <= a[4] && !find; a[3]++)\n if ((a[3] + a[2]) == 4 * a[1])\n {\n find = true;\n break;\n }\n if (find)\n printf(\"%s\\n%I64d\\n\", Y, a[3]);\n else\n printf(\"%s\\n\", N);\n }\n else\n {\n a[4] = 3 * a[1];\n if ((a[2] + a[3]) == 4 * a[1])\n find = true;\n\n if (find)\n printf(\"%s\\n%I64d\\n\", Y, a[4]);\n else\n printf(\"%s\\n\", N);\n\n }\n }\n else\n {\n for (x1 = a[1]; x1 >= 1&&!find;x1--)\n if (a[3] == 3 * x1)\n {\n find = true;\n break;\n }\n if (find)\n printf(\"%s\\n%I64d\\n\", Y, x1);\n else\n printf(\"%s\\n\", N);\n\n\n }\n\n }\n else\n {\n scanf(\"%I64d%I64d%I64d%I64d\", &a[1], &a[2], &a[3], &a[4]);\n Merge(a, 1, n);\n if (a[4] = 3 * a[1] && (a[2] + a[3]) == 4 * a[1])\n find = true;\n else\n find = false;\n if (find)\n printf(\"%s\\n\", Y);\n else\n printf(\"%s\\n\", N);\n }\n\n\n return 0;\n}\n\n\nint Merge(long long *a, int l, int r)\n{\n int mid = (l + r) / 2;\n int q = l, p = mid + 1, i = l;\n if (l == r)\n return 0;\n Merge(a, l, mid);\n Merge(a, mid + 1, r);\n while (q <= mid || p <= r)\n if (q > mid || (p <= r&&a[q] > a[p]))\n temp[i++] = a[p++];\n else\n temp[i++] = a[q++];\n\n for (i = l; i <= r; i++)\n a[i] = temp[i];\n\n}"}, {"source_code": "#include\n#include\n#include\n\nint main()\n{\n\tlong x[4] = { -1, -1, -2, -2 }, i, j, n, temp;\n\tscanf(\"%d\", &n);\n\tfor (i = 0; i < n; ++i)\n\t{\n\t\tscanf(\"%d\", &x[i]);\n\t}\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 (x[i]>x[j])\n\t\t\t{\n\t\t\t\ttemp = x[i];\n\t\t\t\tx[i] = x[j];\n\t\t\t\tx[j] = temp;\n\t\t\t}\n\t\t}\n\t}\n\tif (x[0] != x[2] && x[1] != x[3])\n\t{\n\t\tif (n == 0)\n\t\t{\n\t\t\tprintf(\"YES\\n%ld\\n%ld\\n%ld\\n%ld\", 1, 1, 3, 3);\n\t\t}\n\t\telse\n\t\tif (n == 1)\n\t\t{\n\t\t\tprintf(\"YES\\n%ld\\n%ld\\n%ld\", x[0], 3 * x[0], 3 * x[0]);\n\t\t}\n\t\telse if (n == 2)\n\t\t{\n\t\t\tif (x[1] > 3 * x[0])\n\t\t\t\tprintf(\"NO\");\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"YES\\n%ld\\n%ld\", 4 * x[0] - x[1], 3 * x[0]);\n\t\t\t}\n\t\t}\n\t\telse if (n == 3)\n\t\t{\n\n\t\t\tif (x[2] == (3 * x[0]))\n\t\t\t\tprintf(\"YES\\n%ld\", 4 * x[0] - x[1]);\n\t\t\telse if (x[1] + x[2] == 4 * x[0])\n\t\t\t\tprintf(\"YES\\n%ld\", 3 * x[0]);\n\t\t\telse if (x[0] + x[1] == 4 * x[2] / 3)\n\t\t\t\tprintf(\"YES\\n%ld\", x[2] / 3);\n\t\t\telse\n\t\t\t\tprintf(\"NO\");\n\n\t\t}\n\t\telse if (n == 4)\n\t\t{\n\t\t\tif (x[3] == 3 * x[0] && x[1] + x[2] == 4 * x[0])\n\t\t\t\tprintf(\"YES\");\n\t\t\telse\n\t\t\t\tprintf(\"NO\");\n\t\t}\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n\n\nint main(void){\n int n,i,aux,j,k; int t[6];\nscanf(\"%d\",&n);\nif (n==0) { printf(\"YES\\n\"); printf(\"1\\n\"); printf(\"1\\n\"); printf(\"3\\n\"); printf(\"3\");}\nelse for(i=0;i<=n-1;i++) { scanf(\"%d\",&t[i]);}\n\nif (n==1) { printf(\"YES\\n\"); printf(\"%d\\n\",t[0]); printf(\"%d\\n\",3*t[0]); printf(\"%d\\n\",3*t[0]);}\n\nif (n==2) {\n if (t[0]>t[1]) {aux=t[0]; t[0]=t[1]; t[1]=aux;}\n if (3*t[0]\nint main()\n{\n int i,j,r,q,n;\n int a[4]={0};\n scanf(\"%d\",&n);\n for(i=0;ia[j])\n {\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// printf(\"a[i]:%d\",a[i]);\n } \n// printf(\"\\n\");\n\n \n if(n==0)\n {\n printf(\"YES\\n\");\n printf(\"1\\n1\\n3\\n3\\n\");\n }\n else if(n==1)\n {\n printf(\"YES\\n\");\n printf(\"%d\\n%d\\n%d\\n\",a[0],3*a[0],3*a[0]);\n }\n else if(n==2)\n {\n q=a[0];\n r=a[1];\n if(r<=(3*q))\n {\n printf(\"YES\\n\");\n if(r>((4*q)-r))\n printf(\"%d\\n%d\\n\",((4*q)-r),3*q);\n else\n printf(\"%d\\n%d\\n\",((4*q)-r),3*q);\n }\n else\n printf(\"NO\\n\");\n }\n else if(n==3)\n {\n if(a[2]==3*a[0])\n {\n printf(\"YES\\n\");\n if((a[2]+a[0])-a[1]>a[1])\n printf(\"%d\\n\",(a[2]+a[0])-a[1]);\n else\n printf(\"%d\\n\",(a[2]+a[0])-a[1]);\n }\n else if(a[2]+a[1]==4*a[0])\n printf(\"YES\\n%d\\n\",3*a[0]);\n else if((4*a[2])==3*(a[1]+a[0]))\n printf(\"YES\\n%d\\n\",a[2]/3);\n else \n printf(\"NO\\n\");\n }\n if(n==4)\n if(a[3]==3*a[0]&&a[3]+a[0]==a[1]+a[2])\n printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include \n#include \n\nint cmpfunc (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\n\n\nint main()\n{\n\tint A[4];\n\tint n,i,j;\n\tint mean,median,range;\n\n\tscanf(\"%d\",&n);\n\tfor(i=0;i\n#include \nint judge(int s[]);\nint cmp(const void *a,const void *b);\nint main(void){\n\tint i,n,boxes[10]={0},temp,state=0;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i 3)\n state = 0;\n else{\n boxes[2] = 3*boxes[0];\n boxes[3] = 4*boxes[0] - boxes[1];\n state = 1;}\n}\n else if (n==3){\n for(i = 1; i<=3*boxes[0];i++){\n boxes[3] = i;\n if(judge(boxes)){\n state = 1;\n break;\n }\n }\n}\n else \n state = judge(boxes); \n\tif(state){\n\t\tprintf(\"YES\\n\");\n\t\tfor(i=n;i<4;i++)\n\t\t\tprintf(\"%d\\n\",boxes[i]);\n\t}\n\telse\n\t\tprintf(\"NO\\n\");\n\t//system(\"pause\");\n\treturn 0;\n}\nint judge(int s[]){\n\tint i,temp[4];\n double mean,median,range;\n\tfor(i=0;i<4;i++)\n temp[i] = s[i];\n\tqsort(temp,4,sizeof(s[0]),cmp);\n\tmean = (temp[0] + temp[1] + temp[2] +temp[3])/4.0;\n\tmedian = (temp[1] + temp[2])/2.0;\n\trange =(temp[3] - temp[0]);\n\treturn (mean == median) && ( mean == range);\n}\nint cmp(const void *a,const void *b){\n\treturn *(int *)a - *(int *)b;\n}\n\t\n\t\n"}, {"source_code": "#include\nint main()\n{\n\tint n,i,j,x,y,z,w,temp,mean,median,range;\n\tscanf(\"%d\",&n);\n\tint A[4];\n\tfor(i=0;iA[j])\n\t\t\t{\n\t\t\t\ttemp=A[i];\n\t\t\t\tA[i]=A[j];\n\t\t\t\tA[j]=temp;\n\t\t\t}\n\t\t}\n\t}\n\tif(n==0)\n\t\tprintf(\"YES\\n1\\n1\\n3\\n3\\n\");\n\telse if(n==1)\n\t{\n\t\tprintf(\"YES\\n%d\\n%d\\n%d\\n\",A[0],A[0]*3,A[0]*3);\n\t}\n\telse if(n==2)\n\t{\n\t\tx=A[0],y=A[1];\n\t\tif(3*x\n#include\n#include\n\nint a[4] , b[4];\nvoid sort(){\n int c, d, swap;\n for (c = 0 ; c < 3; c++)\n {\n for (d = 0 ; d < 3 - c; d++)\n {\n if (a[d] > a[d+1])\n {\n swap = a[d];\n a[d] = a[d+1];\n a[d+1] = swap;\n }\n }\n }\n }\nint check4(){\n int d,b,c;\n d = a[3]-a[0];\n b = (a[1]+a[2])/2;\n c = (a[0]+a[1]+a[2]+a[3])/4;\n return ((d==b) && (b==c))?1:0;\n}\n\nint check3(){\n int val;\n b[1] = a[1]; b[2]= a[2] ; b[3] = a[3];\n\n\n if(b[3]%3 == 0){\n val = (b[3]/3) *2 ;\n if(b[1]+b[2] == 2*val){\n b[0]=val/2;\n // -XXX\n if(b[0]<=b[1] && b[0]+b[1]+b[2]+b[3] == 4*val) return 1;\n }\n\n\n\n b[0] = a[1] ;\n if(b[0]*2 == (b[3]*2)/3){\n val = b[3]-b[0];\n b[1]= 2*val - b[2];\n // X-XX\n if(b[1]>=b[0] && b[1]<= b[2] && b[0]+b[1]+b[2]+b[3] == 4*val ) return 1;\n b[1] = a[2];\n b[2] = 2*val - b[1];\n // XX-X\n if(b[2]>=b[1] && b[2]<= b[3] && b[0]+b[1]+b[2]+b[3] == 4*val) return 1;\n }\n }\n\n b[0] = a[1] ; b[1] = a[2] ; b[2] = a[3];\n val = 2*b[0];\n if(b[1]+b[2] == 2*val){\n b[3] = val+b[0];\n // XXX-\n if(b[3]>= b[2] && b[0]+b[1]+b[2]+b[3] == 4*val) return 1;\n }\n\n return 0;\n }\n\n int check2(){\n int val ;\n // second case --XX\n b[2] = a[2] ; b[3] = a[3];\n if(b[3]%3 == 0){\n val = 2*b[3] /3 ;\n b[0] = b[3] - val;\n b[1] = 2*val - b[2];\n if(b[1]>=b[0] && b[2]>=b[1] && b[0]+b[1]+b[2]+b[3] == 4*val) return 1;\n // case -X-X\n b[1] = a[2];\n b[2] = 2*val - b[1];\n if(b[1]>= b[0] && b[2]>= b[1] && b[3]>= b[2] && b[0]+b[1]+b[2]+b[3] == 4*val) return 1;\n // case X--X\n b[0] = a[2];\n if(b[0]*2 == (b[3]*2)/3){\n if(check2_formula_2()) return 1;\n }\n }\n // case X-X-\n b[0] = a[2]; b[2] = a[3];\n if(check2_formula_3()) return 1;\n\n //case XX--\n b[0] = a[2]; b[1] = a[3];\n if(check2_formula_1()) return 1;\n return 0;\n }\n\n int check2_formula_1(){\n // XX--\n int val;\n val = 2*b[0];\n b[3] = val*3 /2;\n b[2] = 2*val-b[1];\n if(b[2] >= b[1] && b[3] >= b[2]){\n if(b[3]-b[0]==val && b[0]+b[1]+b[2]+b[3] == 4*val) return 1;\n }\n return 0;\n }\n\n int check2_formula_2(){\n // X--X\n int val = b[0]*2;\n int i = b[0];\n for(i;2*val-i <= b[3] ; i++){\n b[1] = i;\n b[2] = 2*val-i;\n if(b[1]>=b[0] && b[2]>=b[1] && b[0]+b[1]+b[2]+b[3] == 4*val) return 1;\n }\n return 0;\n }\n\n int check2_formula_3(){\n // X-X-\n int val;\n val = 2*b[0];\n b[3] = val+b[0];\n b[1] = 2*val -b[2];\n if(b[1]>= b[0] && b[1]<= b[2] && b[3] >= b[2] && b[0]+b[1]+b[2]+b[3] == 4*val) return 1;\n return 0;\n }\n int check1(){\n int val,i;\n // case ---X\n b[3] = a[3];\n if(b[3] % 3 == 0) {\n val = 2*b[3] / 3;\n b[0] = b[3]-val;\n if(check2_formula_2()) return 1;\n }\n\n // case --X-\n b[2] = a[3];\n for(i=1;i<=b[2];i++){\n b[0] = i;\n if(check2_formula_3()) return 1;\n }\n\n\n // case -X--\n b[1] = a[3];\n for(i=1;i<=b[1];i++){\n b[0] = i;\n if(check2_formula_1()) return 1;\n }\n b[0] = a[3];\n // case X---\n val = 2*b[0];\n b[3] = val+b[0];\n if(check2_formula_2()) return 1;\n\n\n\n\n return 0;\n }\nint main (){\n int n ,result,i,j;\n a[0] = a[1] = a[2] = a[3] = -1;\n scanf(\"%d\",&n);\n switch(n){\ncase 0:\n {\n printf(\"YES\\n\");\n printf(\"1\\n1\\n3\\n3\\n\");\n return 0;\n }\n case 1:\n {\n scanf(\"%d\",&a[3]);\n result = check1();\n break;\n }\n case 2:\n {\n scanf(\"%d%d\",&a[2],&a[3]);\n sort();\n result = check2();\n break;\n }\n case 3:\n {\n scanf(\"%d%d%d\",&a[0],&a[1],&a[2]);\n sort();\n result = check3();\n break;\n }\n default:\n {\n scanf(\"%d%d%d%d\",&a[0],&a[1],&a[2],&a[3]);\n sort();\n result = check4();\n break;\n }\n }\n if(result == 0){\n printf(\"NO\\n\");\n return 0;\n }\n printf(\"YES\\n\");\n for(i=0;i<4;i++){\n for(j=0;j<4;j++){\n if(b[i] == a[j]){\n b[i] = a[j] = -1;\n break;\n }\n }\n }\n if(n!=4){\n for(i=0;i<4;i++){\n if(b[i] != -1) printf(\"%d\\n\",b[i]);\n }\n }\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include \n#include \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 n, a[4], tmp;\n\n\tscanf(\"%d\", &n);\n\tswitch (n) {\n\t\tcase 0:\n\t\t\tprintf(\"YES\\n1\\n1\\n3\\n3\\n\");\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tscanf(\"%d\", &a[0]);\n\t\t\tprintf(\"YES\\n%d\\n%d\\n%d\\n\", a[0], 3 * a[0], 3 * a[0]);\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tscanf(\"%d%d\", &a[0], &a[1]);\n\t\t\tif (a[0] > a[1])\n\t\t\t\ttmp = a[0], a[0] = a[1], a[1] = tmp;\n\t\t\tif (a[1] == 3 * a[0])\n\t\t\t\tprintf(\"YES\\n%d\\n%d\\n\", a[0], a[1]);\n\t\t\telse if (a[0] == a[1])\n\t\t\t\tprintf(\"YES\\n%d\\n%d\\n\", 3 * a[0], 3 * a[0]);\n\t\t\telse if (3 * a[0] > a[1])\n\t\t\t\tprintf(\"YES\\n%d\\n%d\\n\", 3 * a[0], 4 * a[0] - a[1]);\n\t\t\telse\n\t\t\t\tprintf(\"NO\\n\");\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tscanf(\"%d%d%d\", &a[0], &a[1], &a[2]);\n\t\t\tqsort(a, 3, sizeof(*a), compare);\n\t\t\tif (4 * a[0] == a[1] + a[2])\n\t\t\t\tprintf(\"YES\\n%d\\n\", 3 * a[0]);\n\t\t\telse if (a[2] == 3 * a[0])\n\t\t\t\tprintf(\"YES\\n%d\\n\", 4 * a[0] - a[1]);\n\t\t\telse\n\t\t\t\tprintf(\"NO\\n\");\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tscanf(\"%d%d%d%d\", &a[0], &a[1], &a[2], &a[3]);\n\t\t\tprintf(\"%s\\n\", a[3] == 3 * a[0] && 4 * a[0] == a[1] * a[2] \n\t\t\t\t\t? \"YES\" : \"NO\");\n\t\t\tbreak;\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n\tint n, a, b, c, d, tmp;\n\n\tscanf(\"%d\", &n);\n\tswitch (n) {\n\t\tcase 0:\n\t\t\tprintf(\"YES\\n1\\n1\\n3\\n3\\n\");\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tscanf(\"%d\", &a);\n\t\t\tprintf(\"YES\\n%d\\n%d\\n%d\\n\", a, 3 * a, 3 * a);\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tscanf(\"%d%d\", &a, &b);\n\t\t\tif (a > b)\n\t\t\t\ttmp = a, a = b, b = tmp;\n\t\t\tif (a == b)\n\t\t\t\tprintf(\"YES\\n%d\\n%d\\n\", 3 * a, 3 * a);\n\t\t\telse if (3 * a == b)\n\t\t\t\tprintf(\"YES\\n%d\\n%d\\n\", a, b);\n\t\t\telse\n\t\t\t\tprintf(\"NO\\n\");\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tscanf(\"%d%d%d\", &a, &b, &c);\n\t\t\tif (4 * a == b + c)\n\t\t\t\tprintf(\"YES\\n%d\\n\", 3 * a);\n\t\t\telse\n\t\t\t\tprintf(\"NO\\n\");\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tscanf(\"%d%d%d%d\", &a, &b, &c, &d);\n\t\t\tprintf(\"%s\\n\", d == 3 * a && 4 * a == b * c ? \"YES\" : \"NO\");\n\t\t\tbreak;\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \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 n, a[4], tmp;\n\n\tscanf(\"%d\", &n);\n\tswitch (n) {\n\t\tcase 0:\n\t\t\tprintf(\"YES\\n1\\n1\\n3\\n3\\n\");\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tscanf(\"%d\", &a[0]);\n\t\t\tprintf(\"YES\\n%d\\n%d\\n%d\\n\", a[0], 3 * a[0], 3 * a[0]);\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tscanf(\"%d%d\", &a[0], &a[1]);\n\t\t\tif (a[0] > a[1])\n\t\t\t\ttmp = a[0], a[0] = a[1], a[1] = tmp;\n\t\t\tif (a[1] == 3 * a[0])\n\t\t\t\tprintf(\"YES\\n%d\\n%d\\n\", a[0], a[1]);\n\t\t\telse if (a[0] == a[1])\n\t\t\t\tprintf(\"YES\\n%d\\n%d\\n\", 3 * a[0], 3 * a[0]);\n\t\t\telse if (3 * a[0] > a[1])\n\t\t\t\tprintf(\"YES\\n%d\\n%d\\n\", 3 * a[0], 4 * a[0] - a[1]);\n\t\t\telse\n\t\t\t\tprintf(\"NO\\n\");\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tscanf(\"%d%d%d\", &a[0], &a[1], &a[2]);\n\t\t\tqsort(a, 3, sizeof(*a), compare);\n\t\t\tif (4 * a[0] == a[1] + a[2])\n\t\t\t\tprintf(\"YES\\n%d\\n\", 3 * a[0]);\n\t\t\telse if (a[2] == 3 * a[0])\n\t\t\t\tprintf(\"YES\\n%d\\n\", 4 * a[0] - a[1]);\n\t\t\telse if (a[2] % 3 == 0\n\t\t\t\t\t&& a[2] / 3 <= a[0]\n\t\t\t\t\t&& a[2] * 4 / 3 == a[0] + a[1])\n\t\t\t\tprintf(\"YES\\n%d\\n\", a[2] / 3);\n\t\t\telse\n\t\t\t\tprintf(\"NO\\n\");\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tscanf(\"%d%d%d%d\", &a[0], &a[1], &a[2], &a[3]);\n\t\t\tprintf(\"%s\\n\", a[3] == 3 * a[0] && 4 * a[0] == a[1] * a[2] \n\t\t\t\t\t? \"YES\" : \"NO\");\n\t\t\tbreak;\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \n\n#define MIN(A, B) (A < B ? A : B)\n#define MAX(A, B) (A > B ? A : B)\n\nint main() {\n\tint min, max, med, n, a, b, c, d;\n\n\tscanf(\"%d\", &n);\n\tswitch (n) {\n\t\tcase 0:\n\t\t\tprintf(\"YES\\n1\\n1\\n3\\n3\\n\");\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tscanf(\"%d\", &a);\n\t\t\tprintf(\"YES\\n%d\\n%d\\n%d\\n\", a, 3 * a, 3 * a);\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tscanf(\"%d%d\", &a, &b);\n\t\t\tmin = MIN(a, b);\n\t\t\tmax = MAX(a, b);\n\t\t\tif (3 * min >= max)\n\t\t\t\tprintf(\"YES\\n%d\\n%d\\n\", 3 * min, 4 * min - max);\n\t\t\telse\n\t\t\t\tprintf(\"NO\\n\");\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tscanf(\"%d%d%d\", &a, &b, &c);\n\t\t\tmin = MIN(a, MIN(b, c));\n\t\t\tmax = MAX(a, MAX(b, c));\n\t\t\tmed = a + b + c - min - max;\n\n\t\t\tif (3 * min == max)\n\t\t\t\tprintf(\"YES\\n%d\\n\", 4 * min - med);\n\t\t\telse if (3 * min < max)\n\t\t\t\tprintf(\"NO\\n\");\n\t\t\telse if ((max + med - min) == min * 3)\n\t\t\t\tprintf(\"YES\\n%d\\n\", max + med - min);\n\t\t\telse if (3 * (min + med - max) == max)\n\t\t\t\tprintf(\"YES\\n%d\\n\", min + med - max);\n\t\t\telse\n\t\t\t\tprintf(\"NO\\n\");\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tscanf(\"%d%d%d%d\", &a, &b, &c, &d);\n\t\t\tmin = MIN(a, MIN(b, MIN(c, d)));\n\t\t\tmax = MAX(a, MAX(b, MAX(c, d)));\n\t\t\tprintf(\"%s\\n\", 3 * min == max && a + b + c + d == 8 * min\n\t\t\t\t\t? \"YES\\n\" : \"NO\\n\");\n\t\t\tbreak;\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tint i,j,t,n,x[8];\n\tscanf(\"%d\",&n);\n\tfor(i=1;i<=n;i++)\n\t\tscanf(\"%d\",x+i);\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tfor(j=i+1;j<=n;j++)\n\t\tif(x[i]>x[j])\n\t\t{\n\t\t\tt=x[i];x[i]=x[j];x[j]=t;\n\t\t}\n\t}\n\tif(n==0) printf(\"YES\\n1\\n2\\n2\\n3\\n\");\n\telse if(n==1) printf(\"YES\\n%d\\n%d\\n%d\\n\",x[1],x[1],3*x[1]);\n\telse if(n==2) \n\t{\n\t\tif(x[2]>3*x[1]) printf(\"NO\\n\");\n\t\telse printf(\"YES\\n%d\\n%d\\n\",x[1]*4-x[2],3*x[1]);\n\t}\n\telse if(n==3)\n\t{\n\t\tif(x[3]==3*x[1]) printf(\"YES\\n%d\\n\",x[1]*4-x[2]);\n\t\telse if(x[2]+x[3]==4*x[1]) printf(\"YES\\n%d\\n\",x[1]*3);\n\t\telse if(x[3]%3==0)\n\t\t{\n\t\t\tt=x[3]/3;\n\t\t\tif(x[2]+x[1]==4*t) printf(\"YES\\n%d\\n\",t);\n\t\t\telse printf(\"NO\\n\");\n\t\t}\t\n\t\telse printf(\"NO\\n\");\n\t}\n\telse if(n==4)\n\t{\n\t\tif(x[4]==3*x[1]&&x[2]+x[3]==4*x[1]) printf(\"YES\\n\");\n\t\telse printf(\"NO\\n\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint i,j,r,q,n;\n\tint a[4]={0};\n\tscanf(\"%d\",&n);\n\tfor(i=0;ia[j])\n\t\t\t{\n\t\t\t\ta[i]=a[i]^a[j];\n\t\t\t\ta[j]=a[i]^a[j];\n\t\t\t\ta[i]=a[i]^a[j];\n\n\t\t\t}\n\t\t}\n//\t\t\tprintf(\"a[i]:%d\",a[i]);\n\t}\t\n//\t\tprintf(\"\\n\");\n\n\t\n\tif(n==0)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\tprintf(\"1\\n1\\n3\\n3\\n\");\n\t}\n\telse if(n==1)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\tprintf(\"%d\\n%d\\n%d\\n%d\\n\",a[0],a[0],3*a[0],3*a[0]);\n\t}\n\telse if(n==2)\n\t{\n\t\tq=a[0];\n\t\tr=a[1];\n\t\tif(r<=(3*q))\n\t\t{\n\t\t\tprintf(\"YES\\n\");\n\t\t\tif(r>((4*q)-r))\n\t\t\t\tprintf(\"%d\\n%d\\n%d\\n%d\\n\",q,((4*q)-r),r,3*q);\n\t\t\telse\n\t\t\t\tprintf(\"%d\\n%d\\n%d\\n%d\\n\",q,r,((4*q)-r),3*q);\n\t\t}\n\t\telse\n\t\t\tprintf(\"NO\\n\");\n\t}\n\telse if(n==3)\n\t{\n\t\tif(a[2]==3*a[0])\n\t\t{\n\t\t\tprintf(\"YES\\n\");\n\t\t\tif((a[2]+a[0])-a[1]>a[1])\n\t\t\t\tprintf(\"%d\\n%d\\n%d\\n%d\\n\",a[0],a[1],(a[2]+a[0])-a[1],a[2]);\n\t\t\telse\n\t\t\t\tprintf(\"%d\\n%d\\n%d\\n%d\\n\",a[0],(a[2]+a[0])-a[1],a[1],a[2]);\n\t\t}\n\t\telse if(a[2]+a[1]==4*a[0])\n\t\t\tprintf(\"YES\\n%d\\n%d\\n%d\\n%d\\n\",a[0],a[1],a[2],3*a[0]);\n\t\telse \n\t\t\tprintf(\"NO\\n\");\n\t}\n\tif(n==4)\n\t\tprintf(\"YES\");\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint i,j,r,q,n;\n\tint a[4]={0};\n\tscanf(\"%d\",&n);\n\tfor(i=0;ia[j])\n\t\t\t{\n\t\t\t\ta[i]=a[i]^a[j];\n\t\t\t\ta[j]=a[i]^a[j];\n\t\t\t\ta[i]=a[i]^a[j];\n\n\t\t\t}\n\t\t}\n//\t\t\tprintf(\"a[i]:%d\",a[i]);\n\t}\t\n//\t\tprintf(\"\\n\");\n\n\t\n\tif(n==0)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\tprintf(\"1\\n1\\n3\\n3\\n\");\n\t}\n\telse if(n==1)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\tprintf(\"%d\\n%d\\n%d\\n\",a[0],3*a[0],3*a[0]);\n\t}\n\telse if(n==2)\n\t{\n\t\tq=a[0];\n\t\tr=a[1];\n\t\tif(r<=(3*q))\n\t\t{\n\t\t\tprintf(\"YES\\n\");\n\t\t\tif(r>((4*q)-r))\n\t\t\t\tprintf(\"%d\\n%d\\n\",((4*q)-r),3*q);\n\t\t\telse\n\t\t\t\tprintf(\"%d\\n%d\\n\",((4*q)-r),3*q);\n\t\t}\n\t\telse\n\t\t\tprintf(\"NO\\n\");\n\t}\n\telse if(n==3)\n\t{\n\t\tif(a[2]==3*a[0])\n\t\t{\n\t\t\tprintf(\"YES\\n\");\n\t\t\tif((a[2]+a[0])-a[1]>a[1])\n\t\t\t\tprintf(\"%d\\n\",(a[2]+a[0])-a[1]);\n\t\t\telse\n\t\t\t\tprintf(\"%d\\n\",(a[2]+a[0])-a[1]);\n\t\t}\n\t\telse if(a[2]+a[1]==4*a[0])\n\t\t\tprintf(\"YES\\n%d\\n\",3*a[0]);\n\t\telse \n\t\t\tprintf(\"NO\\n\");\n\t}\n\tif(n==4)\n\t\tif(a[3]==3*a[0]&&a[3]+a[0]==a[1]+a[2])\n\t\tprintf(\"YES\\n\");\n\t\telse printf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint i,j,r,q,n;\n\tint a[4]={0};\n\tscanf(\"%d\",&n);\n\tfor(i=0;ia[j])\n\t\t\t{\n\t\t\t\ta[i]=a[i]^a[j];\n\t\t\t\ta[j]=a[i]^a[j];\n\t\t\t\ta[i]=a[i]^a[j];\n\n\t\t\t}\n\t\t}\n//\t\t\tprintf(\"a[i]:%d\",a[i]);\n\t}\t\n//\t\tprintf(\"\\n\");\n\n\t\n\tif(n==0)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\tprintf(\"1\\n1\\n3\\n3\\n\");\n\t}\n\telse if(n==1)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\tprintf(\"%d\\n%d\\n%d\\n\",a[0],3*a[0],3*a[0]);\n\t}\n\telse if(n==2)\n\t{\n\t\tq=a[0];\n\t\tr=a[1];\n\t\tif(r<=(3*q))\n\t\t{\n\t\t\tprintf(\"YES\\n\");\n\t\t\tif(r>((4*q)-r))\n\t\t\t\tprintf(\"%d\\n%d\\n\",((4*q)-r),3*q);\n\t\t\telse\n\t\t\t\tprintf(\"%d\\n%d\\n\",((4*q)-r),3*q);\n\t\t}\n\t\telse\n\t\t\tprintf(\"NO\\n\");\n\t}\n\telse if(n==3)\n\t{\n\t\tif(a[2]==3*a[0])\n\t\t{\n\t\t\tprintf(\"YES\\n\");\n\t\t\tif((a[2]+a[0])-a[1]>a[1])\n\t\t\t\tprintf(\"%d\\n\",(a[2]+a[0])-a[1]);\n\t\t\telse\n\t\t\t\tprintf(\"%d\\n\",(a[2]+a[0])-a[1]);\n\t\t}\n\t\telse if(a[2]+a[1]==4*a[0])\n\t\t\tprintf(\"YES\\n%d\\n\",3*a[0]);\n\t\telse \n\t\t\tprintf(\"NO\\n\");\n\t}\n\tif(n==4)\n\t\tif(a[3]==3*a[0]&&a[3]+a[0]==a[1]+a[2])\n\t\tprintf(\"YES\\n\");\n\t\telse printf(\"N0\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint i,j,r,q,n;\n\tint a[4]={0};\n\tscanf(\"%d\",&n);\n\tfor(i=0;ia[j])\n\t\t\t{\n\t\t\t\ta[i]=a[i]^a[j];\n\t\t\t\ta[j]=a[i]^a[j];\n\t\t\t\ta[i]=a[i]^a[j];\n\n\t\t\t}\n\t\t}\n//\t\t\tprintf(\"a[i]:%d\",a[i]);\n\t}\t\n//\t\tprintf(\"\\n\");\n\n\t\n\tif(n==0)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\tprintf(\"1\\n1\\n3\\n3\\n\");\n\t}\n\telse if(n==1)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\tprintf(\"%d\\n%d\\n%d\\n\",a[0],3*a[0],3*a[0]);\n\t}\n\telse if(n==2)\n\t{\n\t\tq=a[0];\n\t\tr=a[1];\n\t\tif(r<=(3*q))\n\t\t{\n\t\t\tprintf(\"YES\\n\");\n\t\t\tif(r>((4*q)-r))\n\t\t\t\tprintf(\"%d\\n%d\\n\",((4*q)-r),3*q);\n\t\t\telse\n\t\t\t\tprintf(\"%d\\n%d\\n\",((4*q)-r),3*q);\n\t\t}\n\t\telse\n\t\t\tprintf(\"NO\\n\");\n\t}\n\telse if(n==3)\n\t{\n\t\tif(a[2]==3*a[0])\n\t\t{\n\t\t\tprintf(\"YES\\n\");\n\t\t\tif((a[2]+a[0])-a[1]>a[1])\n\t\t\t\tprintf(\"%d\\n\",(a[2]+a[0])-a[1]);\n\t\t\telse\n\t\t\t\tprintf(\"%d\\n\",(a[2]+a[0])-a[1]);\n\t\t}\n\t\telse if(a[2]+a[1]==4*a[0])\n\t\t\tprintf(\"YES\\n%d\\n\",3*a[0]);\n\t\telse \n\t\t\tprintf(\"NO\\n\");\n\t}\n\tif(n==4)\n\t\tprintf(\"YES\");\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\nint median(int *T)\n{\n int sum = T[2]+T[3];\n if (sum%2)\n {\n return -1;\n }\n else\n {\n return (sum)/2;\n }\n}\n\nint arithmetic(int *T)\n{\n int sum = T[1]+T[2]+T[3]+T[4];\n if (sum%2)\n {\n return -1;\n }\n else\n {\n return (sum)/4;\n }\n}\n\nint range(int *T)\n{\n return (T[4]-T[1]);\n}\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n\n int i,j,k,l;\n int T[6];\n for (i = 1;i<=n;++i)\n scanf(\"%d\", &T[i]);\n\n if (n == 1)\n {\n for (i = 1;i < 500;++i)\n {\n T[2] = i;\n for (j = 1;j < 500;++j)\n {\n T[3] = j;\n for (k = 1;k < 500;++k)\n {\n T[4] = k;\n int m = median(T);\n int a = arithmetic(T);\n int r = range(T);\n\n if ((m == a) && (m == r))\n {\n printf(\"YES\\n\");\n printf(\"%d\\n%d\\n\",T[2],T[3],T[4]);\n return 0;\n }\n }\n }\n }\n printf(\"NO\\n\");\n return 0;\n }\n else if (n == 2)\n {\n for (j = 1;j < 500;++j)\n {\n T[3] = j;\n for (k = 1;k < 500;++k)\n {\n T[4] = k;\n int m = median(T);\n int a = arithmetic(T);\n int r = range(T);\n\n if ((m == a) && (m == r))\n {\n printf(\"YES\\n\");\n printf(\"%d\\n%d\\n\",T[3],T[4]);\n return 0;\n }\n }\n }\n printf(\"NO\\n\");\n return 0;\n }\n else if (n == 3)\n {\n for (k = 1;k < 500;++k)\n {\n T[4] = k;\n int m = median(T);\n int a = arithmetic(T);\n int r = range(T);\n\n if ((m == a) && (m == r))\n {\n printf(\"YES\\n\");\n printf(\"%d\\n\",T[4]);\n return 0;\n }\n }\n printf(\"NO\\n\");\n return 0;\n }\n else if (n == 4)\n {\n int m = median(T);\n int a = arithmetic(T);\n int r = range(T);\n\n if ((m == a) && (m == r))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n else\n {\n for (l = 1;l < 500;++l)\n {\n T[1] = l;\n for (i = 1;i < 500;++i)\n {\n T[2] = i;\n for (j = 1;j < 500;++j)\n {\n T[3] = j;\n for (k = 1;k < 500;++k)\n {\n T[4] = k;\n int m = median(T);\n int a = arithmetic(T);\n int r = range(T);\n\n if ((m == a) && (m == r))\n {\n printf(\"YES\\n\");\n printf(\"%d\\n%d\\n%d\\n%d\\n\",T[1],T[2],T[3],T[4]);\n return 0;\n }\n }\n }\n }\n }\n\n printf(\"NO\\n\");\n return 0;\n }\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\ndouble median(int *T)\n{\n return ((double)T[2]+(double)T[3])/2;\n}\n\ndouble arithmetic(int *T)\n{\n return ((double)T[1]+(double)T[2]+(double)T[3]+(double)T[4])/4;\n}\n\ndouble range(int *T)\n{\n return ((double)T[4]-(double)T[1]);\n}\n\nint min(int *T,int beg)\n{\n int i,imin = beg;\n int min = T[beg];\n for (i = beg+1;i<=4;++i)\n if (T[i] < T[beg])\n {\n min = T[i];\n imin = i;\n }\n\n T[imin] = 1000001;\n\n return min;\n}\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n\n int i,j,k,l;\n int T[6];\n memset(T,0,sizeof(T));\n for (i = 1;i<=n;++i)\n scanf(\"%d\", &T[i]);\n\n if (n == 1)\n {\n for (i = 1;i <= 1000000;++i)\n {\n T[2] = i;\n for (j = 1;j <= 1000000;++j)\n {\n T[3] = j;\n T[4] = T[2]+T[3]-T[1];\n double m = median(T);\n double a = arithmetic(T);\n double r = range(T);\n if ((m == a) && (m == r))\n {\n if (T[4] > 1000000 || T[4] < 0)\n {\n printf(\"NO\\n\");\n return 0;\n }\n printf(\"YES\\n\");\n printf(\"%d\\n\", min(T,2));\n printf(\"%d\\n\", min(T,2));\n printf(\"%d\\n\", min(T,2));\n return 0;\n }\n }\n }\n printf(\"NO\\n\");\n return 0;\n }\n else if (n == 2)\n {\n for (j = 1;j <= 1000000;++j)\n {\n T[3] = j;\n T[4] = T[2]+T[3]-T[1];\n\n double m = median(T);\n double a = arithmetic(T);\n double r = range(T);\n if ((m == a) && (m == r))\n {\n if (T[4] > 1000000 || T[4] < 0)\n {\n printf(\"NO\\n\");\n return 0;\n }\n printf(\"YES\\n\");\n if (T[3] >= T[4])\n printf(\"%d\\n%d\\n\",T[4],T[3]);\n else\n printf(\"%d\\n%d\\n\",T[3],T[4]);\n return 0;\n }\n }\n printf(\"NO\\n\");\n return 0;\n }\n else if (n == 3)\n {\n T[4] = T[2]+T[3]-T[1];\n double m = median(T);\n double a = arithmetic(T);\n double r = range(T);\n\n if ((m == a) && (m == r))\n {\n if (T[4] > 1000000 || T[4] < 0)\n {\n printf(\"NO\\n\");\n return 0;\n }\n printf(\"YES\\n\");\n printf(\"%d\\n\",T[4]);\n }\n else\n printf(\"NO\\n\");\n\n return 0;\n }\n else if (n == 4)\n {\n double m = median(T);\n double a = arithmetic(T);\n double r = range(T);\n if (T[4] > 1000000)\n {\n printf(\"NO\\n\");\n return 0;\n }\n\n if ((m == a) && (m == r))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0;\n }\n else\n {\n T[1] = 1;\n for (i = 1;i <= 1000000;++i)\n {\n T[2] = i;\n for (j = 1;j <= 1000000;++j)\n {\n T[3] = j;\n T[4] = T[2]+T[3]-T[1];\n double m = median(T);\n double a = arithmetic(T);\n double r = range(T);\n if ((m == a) && (m == r))\n {\n if (T[4] > 1000000)\n {\n printf(\"NO\\n\");\n return 0;\n }\n printf(\"YES\\n\");\n printf(\"%d\\n\", min(T,1));\n printf(\"%d\\n\", min(T,1));\n printf(\"%d\\n\", min(T,1));\n printf(\"%d\\n\", min(T,1));\n return 0;\n }\n }\n }\n printf(\"NO\\n\");\n return 0;\n }\n}\n"}, {"source_code": "#include \n#include \n#include \n\ndouble median(int *T)\n{\n return ((double)T[2]+(double)T[3])/2;\n}\n\ndouble arithmetic(int *T)\n{\n return ((double)T[1]+(double)T[2]+(double)T[3]+(double)T[4])/4;\n}\n\ndouble range(int *T)\n{\n return ((double)T[4]-(double)T[1]);\n}\n\nint cmp(const void *a, const void *b)\n{\n if (*(int*)a > *(int*)b)\n return 1;\n else if (*(int*)a == *(int*)b)\n return 0;\n else\n return -1;\n}\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n\n int i,j,k,l;\n int T[6];\n memset(T,0,sizeof(T));\n for (i = 1;i<=n;++i)\n scanf(\"%d\", &T[i]);\n\n if (n == 1)\n {\n for (i = T[1];i <= 1000000;++i)\n {\n T[2] = i;\n for (j = T[2];j <= 1000000;++j)\n {\n T[3] = j;\n T[4] = T[2]+T[3]-T[1];\n double m = median(T);\n double a = arithmetic(T);\n double r = range(T);\n if ((m == a) && (m == r))\n {\n if (T[4] > 1000000 || T[4] < 0)\n {\n printf(\"NO\\n\");\n return 0;\n }\n printf(\"YES\\n\");\n printf(\"%d\\n%d\\n%d\\n\",T[2],T[3],T[4]);\n return 0;\n }\n }\n }\n printf(\"NO\\n\");\n return 0;\n }\n else if (n == 2)\n {\n qsort(T,2,sizeof(int),cmp);\n for (j = T[2];j <= 1000000;++j)\n {\n T[3] = j;\n T[4] = T[2]+T[3]-T[1];\n\n double m = median(T);\n double a = arithmetic(T);\n double r = range(T);\n if ((m == a) && (m == r))\n {\n if (T[4] > 1000000 || T[4] < 0)\n {\n printf(\"NO\\n\");\n return 0;\n }\n printf(\"YES\\n\");\n printf(\"%d\\n%d\\n\",T[3],T[4]);\n return 0;\n }\n }\n printf(\"NO\\n\");\n return 0;\n }\n else if (n == 3)\n {\n T[4] = T[2]+T[3]-T[1];\n double m = median(T);\n double a = arithmetic(T);\n double r = range(T);\n\n if ((m == a) && (m == r))\n {\n if (T[4] > 1000000 || T[4] < 0)\n {\n printf(\"NO\\n\");\n return 0;\n }\n printf(\"YES\\n\");\n printf(\"%d\\n\",T[4]);\n }\n else\n printf(\"NO\\n\");\n\n return 0;\n }\n else if (n == 4)\n {\n double m = median(T);\n double a = arithmetic(T);\n double r = range(T);\n if (T[4] > 1000000)\n {\n printf(\"NO\\n\");\n return 0;\n }\n\n if ((m == a) && (m == r))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0;\n }\n else\n {\n T[1] = 1;\n for (i = 1;i <= 1000;++i)\n {\n T[2] = i;\n for (j = 1;j <= 1000;++j)\n {\n T[3] = j;\n T[4] = T[2]+T[3]-T[1];\n double m = median(T);\n double a = arithmetic(T);\n double r = range(T);\n if ((m == a) && (m == r))\n {\n if (T[4] > 1000000)\n {\n printf(\"NO\\n\");\n return 0;\n }\n printf(\"YES\\n\");\n printf(\"%d\\n%d\\n%d\\n%d\\n\",T[1],T[2],T[3],T[4]);\n return 0;\n }\n }\n }\n printf(\"NO\\n\");\n return 0;\n }\n}\n"}, {"source_code": "#include \n#include \n#include \n\ndouble median(int *T)\n{\n return ((double)T[2]+(double)T[3])/2;\n}\n\ndouble arithmetic(int *T)\n{\n return ((double)T[1]+(double)T[2]+(double)T[3]+(double)T[4])/4;\n}\n\ndouble range(int *T)\n{\n return ((double)T[4]-(double)T[1]);\n}\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n\n int i,j,k,l;\n int T[6];\n for (i = 1;i<=n;++i)\n scanf(\"%d\", &T[i]);\n\n if (n == 1)\n {\n for (i = 1;i <= 1000000;++i)\n {\n T[2] = i;\n for (j = 1;j <= 1000000;++j)\n {\n T[3] = j;\n T[4] = (int)(((double)T[2]+(double)T[3])/2+(double)T[1]);\n double m = median(T);\n double a = arithmetic(T);\n double r = range(T);\n if ((m == a) && (m == r))\n {\n printf(\"YES\\n\");\n printf(\"%d\\n%d\\n%d\\n\",T[2],T[3],T[4]);\n return 0;\n }\n }\n }\n printf(\"NO\\n\");\n return 0;\n }\n else if (n == 2)\n {\n for (j = 1;j <= 1000000;++j)\n {\n T[3] = j;\n T[4] = (int)(((double)T[2]+(double)T[3])/2+(double)T[1]);\n if (T[4] > 1000000)\n {\n printf(\"NO\\n\");\n return 0;\n }\n double m = median(T);\n double a = arithmetic(T);\n double r = range(T);\n if ((m == a) && (m == r))\n {\n printf(\"YES\\n\");\n printf(\"%d\\n%d\\n\",T[3],T[4]);\n return 0;\n }\n }\n printf(\"NO\\n\");\n return 0;\n }\n else if (n == 3)\n {\n T[4] = (int)(((double)T[2]+(double)T[3])/2+(double)T[1]);\n if (T[4] > 1000000)\n {\n printf(\"NO\\n\");\n return 0;\n }\n double m = median(T);\n double a = arithmetic(T);\n double r = range(T);\n\n if ((m == a) && (m == r))\n {\n printf(\"YES\\n\");\n printf(\"%d\\n\",T[4]);\n }\n\n else\n printf(\"NO\\n\");\n return 0;\n }\n else if (n == 4)\n {\n double m = median(T);\n double a = arithmetic(T);\n double r = range(T);\n if (T[4] > 1000000)\n {\n printf(\"NO\\n\");\n return 0;\n }\n\n if ((m == a) && (m == r))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n }\n else\n {\n T[1] = 1;\n for (i = 1;i <= 1000000;++i)\n {\n T[2] = i;\n for (j = 1;j <= 1000000;++j)\n {\n T[3] = j;\n T[4] = (int)(((double)T[2]+(double)T[3])/2+(double)T[1]);\n if (T[4] > 1000000)\n {\n printf(\"NO\\n\");\n return 0;\n }\n double m = median(T);\n double a = arithmetic(T);\n double r = range(T);\n if ((m == a) && (m == r))\n {\n printf(\"YES\\n\");\n printf(\"%d\\n%d\\n%d\\n%d\\n\",T[1],T[2],T[3],T[4]);\n return 0;\n }\n }\n }\n printf(\"NO\\n\");\n return 0;\n }\n}\n"}, {"source_code": "#include \n#include \n#include \n\ndouble median(int *T)\n{\n return ((double)T[1]+(double)T[2])/2;\n}\n\ndouble arithmetic(int *T)\n{\n return ((double)T[0]+(double)T[1]+(double)T[2]+(double)T[3])/4;\n}\n\ndouble range(int *T)\n{\n return ((double)T[3]-(double)T[0]);\n}\n\nint cmp(const void *a, const void *b)\n{\n if (*(int*)a > *(int*)b)\n return 1;\n else if (*(int*)a == *(int*)b)\n return 0;\n else\n return -1;\n}\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n\n int i,j,k,l;\n int T[6];\n memset(T,0,sizeof(T));\n for (i=0;i\n#include \n#include \n\ndouble median(int *T)\n{\n return ((double)T[2]+(double)T[3])/2;\n}\n\ndouble arithmetic(int *T)\n{\n return ((double)T[1]+(double)T[2]+(double)T[3]+(double)T[4])/4;\n}\n\ndouble range(int *T)\n{\n return ((double)T[4]-(double)T[1]);\n}\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n\n int i,j,k,l;\n int T[6];\n for (i = 1;i<=n;++i)\n scanf(\"%d\", &T[i]);\n\n if (n == 1)\n {\n for (i = 1;i < 500;++i)\n {\n T[2] = i;\n for (j = 1;j < 500;++j)\n {\n T[3] = j;\n for (k = 1;k < 500;++k)\n {\n T[4] = k;\n double m = median(T);\n double a = arithmetic(T);\n double r = range(T);\n\n if ((m == a) && (m == r))\n {\n printf(\"YES\\n\");\n printf(\"%d\\n%d\\n\",T[2],T[3],T[4]);\n return 0;\n }\n }\n }\n }\n printf(\"NO\\n\");\n return 0;\n }\n else if (n == 2)\n {\n for (j = 1;j < 500;++j)\n {\n T[3] = j;\n for (k = 1;k < 500;++k)\n {\n T[4] = k;\n double m = median(T);\n double a = arithmetic(T);\n double r = range(T);\n\n if ((m == a) && (m == r))\n {\n printf(\"YES\\n\");\n printf(\"%d\\n%d\\n\",T[3],T[4]);\n return 0;\n }\n }\n }\n printf(\"NO\\n\");\n return 0;\n }\n else if (n == 3)\n {\n for (k = 1;k < 500;++k)\n {\n T[4] = k;\n double m = median(T);\n double a = arithmetic(T);\n double r = range(T);\n\n if ((m == a) && (m == r))\n {\n printf(\"YES\\n\");\n printf(\"%d\\n\",T[4]);\n return 0;\n }\n }\n printf(\"NO\\n\");\n return 0;\n }\n else if (n == 4)\n {\n double m = median(T);\n double a = arithmetic(T);\n double r = range(T);\n\n if ((m == a) && (m == r))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n else\n {\n for (l = 1;l < 500;++l)\n {\n T[1] = l;\n for (i = 1;i < 500;++i)\n {\n T[2] = i;\n for (j = 1;j < 500;++j)\n {\n T[3] = j;\n for (k = 1;k < 500;++k)\n {\n T[4] = k;\n double m = median(T);\n double a = arithmetic(T);\n double r = range(T);\n\n if ((m == a) && (m == r))\n {\n printf(\"YES\\n\");\n printf(\"%d\\n%d\\n%d\\n%d\\n\",T[1],T[2],T[3],T[4]);\n return 0;\n }\n }\n }\n }\n }\n\n printf(\"NO\\n\");\n return 0;\n }\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\ndouble median(int *T)\n{\n return ((double)T[2]+(double)T[3])/2;\n}\n\ndouble arithmetic(int *T)\n{\n return ((double)T[1]+(double)T[2]+(double)T[3]+(double)T[4])/4;\n}\n\ndouble range(int *T)\n{\n return ((double)T[4]-(double)T[1]);\n}\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n\n int i,j,k,l;\n int T[6];\n memset(T,0,sizeof(T));\n for (i = 1;i<=n;++i)\n scanf(\"%d\", &T[i]);\n\n if (n == 1)\n {\n for (i = 1;i <= 1000000;++i)\n {\n T[2] = i;\n for (j = 1;j <= 1000000;++j)\n {\n T[3] = j;\n T[4] = T[2]+T[3]-T[1];\n double m = median(T);\n double a = arithmetic(T);\n double r = range(T);\n if ((m == a) && (m == r))\n {\n if (T[4] > 1000000 || T[4] < 0)\n {\n printf(\"NO\\n\");\n return 0;\n }\n printf(\"YES\\n\");\n printf(\"%d\\n%d\\n%d\\n\",T[2],T[3],T[4]);\n return 0;\n }\n }\n }\n printf(\"NO\\n\");\n return 0;\n }\n else if (n == 2)\n {\n for (j = 1;j <= 1000000;++j)\n {\n T[3] = j;\n T[4] = T[2]+T[3]-T[1];\n\n double m = median(T);\n double a = arithmetic(T);\n double r = range(T);\n if ((m == a) && (m == r))\n {\n if (T[4] > 1000000 || T[4] < 0)\n {\n printf(\"NO\\n\");\n return 0;\n }\n printf(\"YES\\n\");\n printf(\"%d\\n%d\\n\",T[3],T[4]);\n return 0;\n }\n }\n printf(\"NO\\n\");\n return 0;\n }\n else if (n == 3)\n {\n T[4] = T[2]+T[3]-T[1];\n double m = median(T);\n double a = arithmetic(T);\n double r = range(T);\n\n if ((m == a) && (m == r))\n {\n if (T[4] > 1000000 || T[4] < 0)\n {\n printf(\"NO\\n\");\n return 0;\n }\n printf(\"YES\\n\");\n printf(\"%d\\n\",T[4]);\n }\n else\n printf(\"NO\\n\");\n\n return 0;\n }\n else if (n == 4)\n {\n double m = median(T);\n double a = arithmetic(T);\n double r = range(T);\n if (T[4] > 1000000)\n {\n printf(\"NO\\n\");\n return 0;\n }\n\n if ((m == a) && (m == r))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0;\n }\n else\n {\n T[1] = 1;\n for (i = 1;i <= 1000000;++i)\n {\n T[2] = i;\n for (j = 1;j <= 1000000;++j)\n {\n T[3] = j;\n T[4] = T[2]+T[3]-T[1];\n double m = median(T);\n double a = arithmetic(T);\n double r = range(T);\n if ((m == a) && (m == r))\n {\n if (T[4] > 1000000)\n {\n printf(\"NO\\n\");\n return 0;\n }\n printf(\"YES\\n\");\n printf(\"%d\\n%d\\n%d\\n%d\\n\",T[1],T[2],T[3],T[4]);\n return 0;\n }\n }\n }\n printf(\"NO\\n\");\n return 0;\n }\n}\n"}, {"source_code": "#include \n#include \n#include \n\ndouble median(int *T)\n{\n return ((double)T[2]+(double)T[3])/2;\n}\n\ndouble arithmetic(int *T)\n{\n return ((double)T[1]+(double)T[2]+(double)T[3]+(double)T[4])/4;\n}\n\ndouble range(int *T)\n{\n return ((double)T[4]-(double)T[1]);\n}\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n\n int i,j,k,l;\n int T[6];\n for (i = 1;i<=n;++i)\n scanf(\"%d\", &T[i]);\n\n if (n == 1)\n {\n for (i = 1;i <= 1000000;++i)\n {\n T[2] = i;\n for (j = 1;j <= 1000000;++j)\n {\n T[3] = j;\n T[4] = (int)(((double)T[2]+(double)T[3])/2+(double)T[1]);\n double m = median(T);\n double a = arithmetic(T);\n double r = range(T);\n if ((m == a) && (m == r))\n {\n printf(\"YES\\n\");\n printf(\"%d\\n%d\\n\",T[3],T[4]);\n return 0;\n }\n }\n }\n printf(\"NO\\n\");\n return 0;\n }\n else if (n == 2)\n {\n for (j = 1;j <= 1000000;++j)\n {\n T[3] = j;\n T[4] = (int)(((double)T[2]+(double)T[3])/2+(double)T[1]);\n if (T[4] > 1000000)\n {\n printf(\"NO\\n\");\n return 0;\n }\n double m = median(T);\n double a = arithmetic(T);\n double r = range(T);\n if ((m == a) && (m == r))\n {\n printf(\"YES\\n\");\n printf(\"%d\\n%d\\n\",T[3],T[4]);\n return 0;\n }\n }\n printf(\"NO\\n\");\n return 0;\n }\n else if (n == 3)\n {\n T[4] = (int)(((double)T[2]+(double)T[3])/2+(double)T[1]);\n if (T[4] > 1000000)\n {\n printf(\"NO\\n\");\n return 0;\n }\n double m = median(T);\n double a = arithmetic(T);\n double r = range(T);\n\n if ((m == a) && (m == r))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n }\n else if (n == 4)\n {\n double m = median(T);\n double a = arithmetic(T);\n double r = range(T);\n if (T[4] > 1000000)\n {\n printf(\"NO\\n\");\n return 0;\n }\n\n if ((m == a) && (m == r))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n }\n else\n {\n T[1] = 1;\n for (i = 1;i <= 1000000;++i)\n {\n T[2] = i;\n for (j = 1;j <= 1000000;++j)\n {\n T[3] = j;\n T[4] = (int)(((double)T[2]+(double)T[3])/2+(double)T[1]);\n if (T[4] > 1000000)\n {\n printf(\"NO\\n\");\n return 0;\n }\n double m = median(T);\n double a = arithmetic(T);\n double r = range(T);\n if ((m == a) && (m == r))\n {\n printf(\"YES\\n\");\n printf(\"%d\\n%d\\n\",T[3],T[4]);\n return 0;\n }\n }\n }\n printf(\"NO\\n\");\n return 0;\n }\n}\n"}, {"source_code": "#include \n#include \n#include \n\ndouble median(int *T)\n{\n return ((double)T[1]+(double)T[2])/2;\n}\n\ndouble arithmetic(int *T)\n{\n return ((double)T[0]+(double)T[1]+(double)T[2]+(double)T[3])/4;\n}\n\ndouble range(int *T)\n{\n return ((double)T[3]-(double)T[0]);\n}\n\nint cmp(const void *a, const void *b)\n{\n if (*(int*)a > *(int*)b)\n return 1;\n else if (*(int*)a == *(int*)b)\n return 0;\n else\n return -1;\n}\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n\n int i,j,k,l;\n int T[6];\n memset(T,0,sizeof(T));\n for (i=0;i\n#include \n#include \n\ndouble median(int *T)\n{\n return ((double)T[1]+(double)T[2])/2;\n}\n\ndouble arithmetic(int *T)\n{\n return ((double)T[0]+(double)T[1]+(double)T[2]+(double)T[3])/4;\n}\n\ndouble range(int *T)\n{\n return ((double)T[3]-(double)T[0]);\n}\n\nint cmp(const void *a, const void *b)\n{\n if (*(int*)a > *(int*)b)\n return 1;\n else if (*(int*)a == *(int*)b)\n return 0;\n else\n return -1;\n}\n\nint sort(int *T, int k)\n{\n int echanger = 1,i;\n while (echanger == 1)\n {\n echanger = 0;\n for (i=0;i<3;++i)\n {\n if (T[i] > T[i+1])\n {\n if (k == i)\n k = i+1;\n else if (k==(i+1))\n k = i;\n int aux = T[i];\n T[i] = T[i+1];\n T[i+1] = aux;\n echanger = 1;\n }\n }\n }\n\n return k;\n}\n\nint main()\n{\n int n;\n int T[6];\n memset(T,0,sizeof(T));\n scanf(\"%d\", &n);\n\n //sscanf(\"3 132 44 126\", \"%d %d %d %d\", &n, &T[0], &T[1], &T[2], &T[3]);\n\n int i,j,k,l;\n\n for (i=0;i\n\nint main()\n{\n int n,i,temp,c,d;\n scanf(\"%d\",&n);\n int a[4];\n for(i=0;ia[1])\n {\n temp=a[0];\n a[0]=a[1];\n a[1]=temp;\n }\n a[3]=3*a[0];\n a[2]=(4*a[0]-a[1]);\n printf(\"YES\\n\");\n printf(\"%d\\n%d\\n\",a[2],a[3]);\n return 0;\n }\n else if(n==3)\n {\n for (c = 0 ; c < ( n - 1 ); c++)\n {\n for (d = 0 ; d < (n - 1); d++)\n {\n if (a[d] > a[d+1])\n {\n temp= a[d];\n a[d] = a[d+1];\n a[d+1] = temp;\n }\n }\n }\n if(a[2]>(3*a[0]))\n {\n printf(\"NO\\n\");\n return 0;\n }\n if(a[2]==3*a[0])\n {\n a[3]=a[2];\n a[2]=((4*a[0])-a[1]);\n printf(\"YES\\n\");\n printf(\"%d\\n\",a[2]);\n return 0;\n }\n if(a[2]<(3*a[0]))\n {\n if(a[1]+a[2]==(4*a[0]))\n {\n a[3]=3*a[0];\n printf(\"YES\\n\");\n printf(\"%d\\n\",a[3]);\n return 0;\n }\n else\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n\n }\n else if(n==4)\n {\n if((a[3]==(3*a[0]))&&(a[1]+a[2]==(4*a[0])))\n {\n printf(\"YES\\n\");\n return 0;\n }\n else\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n return 0;\n}\n\n"}, {"source_code": "#include\n\nint main()\n{\n int n,i,temp,c,d;\n scanf(\"%d\",&n);\n int a[4];\n for(i=0;ia[1])\n {\n temp=a[0];\n a[0]=a[1];\n a[1]=temp;\n }\n a[3]=3*a[0];\n a[2]=(4*a[0]-a[1]);\n printf(\"YES\\n\");\n printf(\"%d\\n%d\\n\",a[2],a[3]);\n return 0;\n }\n else if(n==3)\n {\n for (c = 0 ; c < ( n - 1 ); c++)\n {\n for (d = 0 ; d < (n - 1); d++)\n {\n if (a[d] > a[d+1])\n {\n temp= a[d];\n a[d] = a[d+1];\n a[d+1] = temp;\n }\n }\n }\n if(a[2]>(3*a[0]))\n {\n printf(\"NO\\n\");\n return 0;\n }\n if(a[2]==3*a[0])\n {\n a[3]=a[2];\n a[2]=((4*a[0])-a[1]);\n printf(\"YES\\n\");\n printf(\"%d\\n\",a[2]);\n return 0;\n }\n if(a[2]<(3*a[0]))\n {\n if(a[1]+a[2]==(4*a[0]))\n {\n a[3]=3*a[0];\n printf(\"YES\\n\");\n printf(\"%d\\n\",a[3]);\n return 0;\n }\n else\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n\n }\n else if(n==4)\n {\n if((a[3]==(3*a[0]))&&(a[1]+a[2]==(4*a[0])))\n {\n printf(\"YES\\n\");\n return 0;\n }\n else\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n return 0;\n}\n\n"}, {"source_code": "#include\n\nint main()\n{\n int n,i,temp,c,d;\n scanf(\"%d\",&n);\n int a[4];\n for(i=0;ia[1])\n {\n temp=a[0];\n a[0]=a[1];\n a[1]=temp;\n }\n if(a[1]==(3*a[0]))\n {\n a[3]=a[1];\n a[1]=a[0];\n a[2]=(4*a[0]-a[1]);\n printf(\"YES\\n\");\n printf(\"%d\\n%d\\n\",a[1],a[2]);\n return 0;\n\n }\n else if(a[1]>(3*a[0]))\n {\n printf(\"NO\\n\");\n return 0;\n\n }\n else\n {\n a[3]=3*a[0];\n a[2]=(4*a[0]-a[1]);\n printf(\"YES\\n\");\n printf(\"%d\\n%d\\n\",a[2],a[3]);\n return 0;\n }\n }\n else if(n==3)\n {\n for (c = 0 ; c < ( n - 1 ); c++)\n {\n for (d = 0 ; d < (n - 1); d++)\n {\n if (a[d] > a[d+1])\n {\n temp= a[d];\n a[d] = a[d+1];\n a[d+1] = temp;\n }\n }\n }\n //printf(\"%d\\n%d\\n%d\\n\",a[0],a[1],a[2]);\n if(a[2]>(3*a[0]))\n {\n printf(\"NO\\n\");\n return 0;\n }\n if(a[2]==3*a[0])\n {\n a[3]=a[2];\n a[2]=((4*a[0])-a[1]);\n printf(\"YES\\n\");\n printf(\"%d\\n\",a[2]);\n return 0;\n }\n if(a[2]<(3*a[0]))\n {\n float z=(float)a[2]/3;\n //printf(\"%f\\n\",z);\n\n if((4*z)==(a[0]+a[1]))\n {\n\n for(c=3;c>=1;c--)\n {\n a[c]=a[c-1];\n }\n a[0]=a[3]/3;\n printf(\"YES\\n\");\n printf(\"%d\\n\",a[0]);\n return 0;\n }\n else if(a[1]+a[2]==(4*a[0]))\n {\n a[3]=3*a[0];\n printf(\"YES\\n\");\n printf(\"%d\\n\",a[3]);\n return 0;\n }\n else\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n\n }\n else if(n==4)\n {\n if((a[3]==(3*a[0]))&&(a[1]+a[2]==(4*a[0])))\n {\n printf(\"YES\\n\");\n return 0;\n }\n else\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n return 0;\n}\n\n"}, {"source_code": "#include\n\nint main()\n{\n int n,i,temp,c,d;\n scanf(\"%d\",&n);\n int a[4];\n for(i=0;ia[1])\n {\n temp=a[0];\n a[0]=a[1];\n a[1]=temp;\n }\n if(a[1]==(3*a[0]))\n {\n a[3]=a[1];\n a[1]=a[0];\n a[2]=(4*a[0]-a[1]);\n printf(\"YES\\n\");\n printf(\"%d\\n%d\\n\",a[1],a[2]);\n return 0;\n\n }\n else if(a[1]>(3*a[0]))\n {\n printf(\"NO\\n\");\n return 0;\n\n }\n else\n {\n a[3]=3*a[0];\n a[2]=(4*a[0]-a[1]);\n printf(\"YES\\n\");\n printf(\"%d\\n%d\\n\",a[2],a[3]);\n return 0;\n }\n }\n else if(n==3)\n {\n for (c = 0 ; c < ( n - 1 ); c++)\n {\n for (d = 0 ; d < (n - 1); d++)\n {\n if (a[d] > a[d+1])\n {\n temp= a[d];\n a[d] = a[d+1];\n a[d+1] = temp;\n }\n }\n }\n //printf(\"%d\\n%d\\n%d\\n\",a[0],a[1],a[2]);\n if(a[2]>(3*a[0]))\n {\n printf(\"NO\\n\");\n return 0;\n }\n if(a[2]==3*a[0])\n {\n a[3]=a[2];\n a[2]=((4*a[0])-a[1]);\n printf(\"YES\\n\");\n printf(\"%d\\n\",a[2]);\n return 0;\n }\n if(a[2]<(3*a[0]))\n {\n float z=(float)a[2]/3;\n printf(\"%f\\n\",z);\n\n if((4*z)==(a[0]+a[1]))\n {\n\n for(c=3;c>=1;c--)\n {\n a[c]=a[c-1];\n }\n a[0]=a[3]/3;\n printf(\"YES\\n\");\n printf(\"%d\\n\",a[0]);\n return 0;\n }\n else if(a[1]+a[2]==(4*a[0]))\n {\n a[3]=3*a[0];\n printf(\"YES\\n\");\n printf(\"%d\\n\",a[3]);\n return 0;\n }\n else\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n\n }\n else if(n==4)\n {\n if((a[3]==(3*a[0]))&&(a[1]+a[2]==(4*a[0])))\n {\n printf(\"YES\\n\");\n return 0;\n }\n else\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n return 0;\n}\n\n"}, {"source_code": "#include\n\nint main()\n{\n int n,i,temp,c,d;\n scanf(\"%d\",&n);\n int a[4];\n for(i=0;ia[1])\n {\n temp=a[0];\n a[0]=a[1];\n a[1]=temp;\n }\n if(a[1]==(3*a[0]))\n {\n a[3]=a[1];\n a[1]=a[0];\n a[2]=(4*a[0]-a[1]);\n printf(\"YES\\n\");\n printf(\"%d\\n%d\\n\",a[1],a[2]);\n return 0;\n\n }\n else if(a[1]>(3*a[0]))\n {\n printf(\"NO\\n\");\n return 0;\n\n }\n else\n {\n a[3]=3*a[0];\n a[2]=(4*a[0]-a[1]);\n printf(\"YES\\n\");\n printf(\"%d\\n%d\\n\",a[2],a[3]);\n return 0;\n }\n }\n else if(n==3)\n {\n for (c = 0 ; c < ( n - 1 ); c++)\n {\n for (d = 0 ; d < (n - 1); d++)\n {\n if (a[d] > a[d+1])\n {\n temp= a[d];\n a[d] = a[d+1];\n a[d+1] = temp;\n }\n }\n }\n if(a[2]>(3*a[0]))\n {\n printf(\"NO\\n\");\n return 0;\n }\n if(a[2]==3*a[0])\n {\n a[3]=a[2];\n a[2]=((4*a[0])-a[1]);\n printf(\"YES\\n\");\n printf(\"%d\\n\",a[2]);\n return 0;\n }\n if(a[2]<(3*a[0]))\n {\n if(a[1]+a[2]==(4*a[0]))\n {\n a[3]=3*a[0];\n printf(\"YES\\n\");\n printf(\"%d\\n\",a[3]);\n return 0;\n }\n else\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n\n }\n else if(n==4)\n {\n if((a[3]==(3*a[0]))&&(a[1]+a[2]==(4*a[0])))\n {\n printf(\"YES\\n\");\n return 0;\n }\n else\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n return 0;\n}\n\n"}, {"source_code": "#include\n\nint main()\n{\n int n,i,temp,c,d;\n scanf(\"%d\",&n);\n int a[4];\n for(i=0;ia[1])\n {\n temp=a[0];\n a[0]=a[1];\n a[1]=temp;\n }\n if(a[1]==(3*a[0]))\n {\n a[3]=a[1];\n a[1]=a[0];\n a[2]=(4*a[0]-a[1]);\n printf(\"YES\\n\");\n printf(\"%d\\n%d\\n\",a[1],a[2]);\n return 0;\n\n }\n else if(a[1]>(3*a[0]))\n {\n printf(\"NO\\n\");\n return 0;\n\n }\n else\n {\n a[3]=3*a[0];\n a[2]=(4*a[0]-a[1]);\n printf(\"YES\\n\");\n printf(\"%d\\n%d\\n\",a[2],a[3]);\n return 0;\n }\n }\n else if(n==3)\n {\n for (c = 0 ; c < ( n - 1 ); c++)\n {\n for (d = 0 ; d < (n - 1); d++)\n {\n if (a[d] > a[d+1])\n {\n temp= a[d];\n a[d] = a[d+1];\n a[d+1] = temp;\n }\n }\n }\n //printf(\"%d\\n%d\\n%d\\n\",a[0],a[1],a[2]);\n if(a[2]>(3*a[0]))\n {\n printf(\"NO\\n\");\n return 0;\n }\n if(a[2]==3*a[0])\n {\n a[3]=a[2];\n a[2]=((4*a[0])-a[1]);\n printf(\"YES\\n\");\n printf(\"%d\\n\",a[2]);\n return 0;\n }\n if(a[2]<(3*a[0]))\n {\n\n if((4*(a[2]/3))==(a[0]+a[1]))\n {\n\n for(c=3;c>=1;c--)\n {\n a[c]=a[c-1];\n }\n a[0]=a[3]/3;\n printf(\"YES\\n\");\n printf(\"%d\\n\",a[0]);\n return 0;\n }\n else if(a[1]+a[2]==(4*a[0]))\n {\n a[3]=3*a[0];\n printf(\"YES\\n\");\n printf(\"%d\\n\",a[3]);\n return 0;\n }\n else\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n\n }\n else if(n==4)\n {\n if((a[3]==(3*a[0]))&&(a[1]+a[2]==(4*a[0])))\n {\n printf(\"YES\\n\");\n return 0;\n }\n else\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n return 0;\n}\n\n"}, {"source_code": "#include\n#include\n#include\n#define Y \"YES\"\n#define N \"NO\"\nint Merge(long long *a, int l, int r);\nlong long temp[7];\nint main(void)\n{\n int n;\n long long a[7];\n\n bool find = false;\n scanf(\"%d\", &n);\n if (n == 0)\n printf(\"%s\\n%d\\n%d\\n%d\\n%d\\n\", Y,1,1,3,3);\n else if (n == 1)\n {\n scanf(\"%I64d\", &a[1]);\n a[4] = 3*a[1];\n for (a[2] = a[1]; a[2] <= a[4]&&!find; a[2]++)\n {\n for (a[3] = a[2]; a[3] <= a[4]&&!find; a[3]++)\n if ((a[2] + a[3]) == 4 * a[1])\n {\n find = true;\n break;\n }\n if (find)\n break;\n }\n if (find)\n printf(\"%s\\n%I64d\\n%I64d\\n%I64d\\n\", Y, a[2], a[3], a[4]);\n else\n printf(\"%s\\n\", N);\n\n }\n else if (n == 2)\n {\n scanf(\"%I64d%I64d\", &a[1], &a[2]);\n Merge(a, 1, n);\n if (a[2] != 3 * a[1])\n {\n a[4] = 3 * a[1];\n a[3] = 4 * a[1] - a[2];\n if (a[3]>=1)\n printf(\"%s\\n%I64d\\n%I64d\\n\", Y, a[3], a[4]);\n }\n else\n {\n a[4] = a[2];\n for (a[2] = a[1]; a[2] <= a[4] && !find; a[2]++)\n {\n for (a[3] = a[2]; a[3] <= a[4] && !find; a[3]++)\n if (a[3] == (4 * a[1] - a[2]) && !find)\n {\n find = true;\n break;\n }\n if (find)\n break;\n }\n if (find)\n printf(\"%s\\n%I64d\\n%I64d\\n\", Y, a[2], a[3]);\n else\n printf(\"%s\\n\", N);\n } \n \n }\n else if (n == 3)\n {\n scanf(\"%I64d%I64d%I64d\", &a[1], &a[2], &a[3]);\n Merge(a, 1, n);\n if (a[3] == 3 * a[1])\n {\n a[4] = a[3];\n for (a[3] = a[1]; a[3] <= a[4]&&!find;a[3]++)\n if ((a[3] + a[2]) == 4 * a[1])\n {\n find = true;\n break;\n }\n if (find)\n printf(\"%s\\n%I64d\\n\", Y, a[3]);\n else\n printf(\"%s\\n\", N);\n }\n else\n {\n a[4] = 3 * a[1];\n if ((a[2] + a[3]) == 4 * a[1])\n find = true;\n \n if (find)\n printf(\"%s\\n%I64d\\n\", Y, a[4]);\n else\n printf(\"%s\\n\", N);\n \n }\n \n\n }\n else\n {\n scanf(\"%I64d%I64d%I64d%I64d\", &a[1], &a[2], &a[3], &a[4]);\n Merge(a, 1, n);\n if (a[4] = 3 * a[1] && (a[2] + a[3]) == 4 * a[1])\n find = true;\n else\n find = false;\n if (find)\n printf(\"%s\\n\", Y);\n else\n printf(\"%s\\n\", N);\n }\n\n\n return 0;\n}\n\n\nint Merge(long long *a, int l, int r)\n{\n int mid = (l + r) / 2;\n int q = l, p = mid + 1, i = l;\n if (l == r)\n return 0;\n Merge(a, l, mid);\n Merge(a, mid + 1, r);\n while (q <= mid || p <= r)\n if (q > mid || (p <= r&&a[q] > a[p]))\n temp[i++] = a[p++];\n else\n temp[i++] = a[q++];\n\n for (i = l; i <= r; i++)\n a[i] = temp[i];\n\n}"}, {"source_code": "#include\n#include\n#include\n#define Y \"YES\"\n#define N \"NO\"\nint Merge(long long *a, int l, int r);\nlong long temp[7];\nint main(void)\n{\n int n;\n long long a[7];\n\n bool find = false;\n scanf(\"%d\", &n);\n if (n == 0)\n printf(\"%s\\n%d\\n%d\\n%d\\n%d\\n\", Y,1,1,3,3);\n else if (n == 1)\n {\n scanf(\"%I64d\", &a[1]);\n a[4] = 3*a[1];\n for (a[2] = a[1]; a[2] <= a[4]&&!find; a[2]++)\n {\n for (a[3] = a[2]; a[3] <= a[4]&&!find; a[3]++)\n if ((a[2] + a[3]) == 4 * a[1])\n {\n find = true;\n break;\n }\n if (find)\n break;\n }\n if (find)\n printf(\"%s\\n%I64d\\n%I64d\\n%I64d\\n\", Y, a[2], a[3], a[4]);\n else\n printf(\"%s\\n\", N);\n\n }\n else if (n == 2)\n {\n scanf(\"%I64d%I64d\", &a[1], &a[2]);\n Merge(a, 1, n);\n a[4] = 3 * a[1];\n for (a[3] = a[2]; a[3] <= a[4]&&!find;a[3]++)\n if (a[3] == (4 * a[1] - a[2]) && a[3] >= a[2])\n {\n find = true;\n break;\n }\n if (find)\n printf(\"%s\\n%I64d\\n%I64d\\n\", Y, a[3], a[4]);\n else\n printf(\"%s\\n\", N);\n }\n else if (n == 3)\n {\n scanf(\"%I64d%I64d%I64d\", &a[1], &a[2], &a[3]);\n Merge(a, 1, n);\n a[4] = 3* a[1];\n if (a[4] >= a[3] && (a[2] + a[3]) == 4 * a[1])\n find = true;\n else\n find = false;\n if (find)\n printf(\"%s\\n%I64d\\n\", Y, a[4]);\n else\n printf(\"%s\\n\", N);\n\n }\n else\n {\n scanf(\"%I64d%I64d%I64d%I64d\", &a[1], &a[2], &a[3], &a[4]);\n if (a[4] = 3 * a[1] && (a[2] + a[3]) == 4 * a[1])\n find = true;\n else\n find = false;\n if (find)\n printf(\"%s\\n\", Y);\n else\n printf(\"%s\\n\", N);\n }\n\n\n return 0;\n}\n\n\nint Merge(long long *a, int l, int r)\n{\n int mid = (l + r) / 2;\n int q = l, p = mid + 1, i = l;\n if (l == r)\n return 0;\n Merge(a, l, mid);\n Merge(a, mid + 1, r);\n while (q <= mid || p <= r)\n if (q > mid || (p <= r&&a[q] > a[p]))\n temp[i++] = a[p++];\n else\n temp[i++] = a[q++];\n\n for (i = l; i <= r; i++)\n a[i] = temp[i];\n\n}"}, {"source_code": "#include\n#include\n#include\n#define Y \"YES\"\n#define N \"NO\"\nint main(void)\n{\n int n;\n long long x1, x2, x3, x4;\n bool find = false;\n scanf(\"%d\", &n);\n if (n == 0)\n printf(\"%s\\n%I64d\\n%I64d\\n%I64d\\n%I64d\\n\", Y,1,1,3,3);\n else if (n == 1)\n {\n scanf(\"%I64d\", &x1);\n x4 = 3*x1;\n for (x2 = x1; x2 <= x4&&!find; x2++)\n {\n for (x3 = x2; x3 <= x4&&!find; x3++)\n if ((x2 + x3) == 4 * x1)\n {\n find = true;\n break;\n }\n if (find)\n break;\n }\n if (find)\n printf(\"%s\\n%I64d\\n%I64d\\n%I64d\\n\", Y, x2, x3, x4);\n else\n printf(\"%s\\n\", N);\n\n }\n else if (n == 2)\n {\n scanf(\"%I64d%I64d\", &x1, &x2);\n x4 = 3 * x1;\n for (x3 = x2; x3 <= x4&&!find;x3++)\n if (x3 == (4 * x1 - x2) && x3 >= x2)\n {\n find = true;\n break;\n }\n if (find)\n printf(\"%s\\n%I64d\\n%I64d\\n\", Y, x3, x4);\n else\n printf(\"%s\\n\", N);\n }\n else if (n == 3)\n {\n scanf(\"%I64d%I64d%I64d\", &x1, &x2, &x3);\n x4 = 3* x1;\n if (x4 >= x3 && (x2 + x3) == 4 * x1)\n find = true;\n else\n find = false;\n if (find)\n printf(\"%s\\n%I64d\\n\", Y, x4);\n else\n printf(\"%s\\n\", N);\n\n }\n else\n {\n scanf(\"%I64d%I64d%I64d%I64d\", &x1, &x2, &x3, &x4);\n if (x4 = 3 * x1 && (x2 + x3) == 4 * x1)\n find = true;\n else\n find = false;\n if (find)\n printf(\"%s\\n\", Y);\n else\n printf(\"%s\\n\", N);\n }\n\n\n return 0;\n}"}, {"source_code": "#include\n#include\n#include\n#define Y \"YES\"\n#define N \"NO\"\n\nint main(void)\n{\n int n;\n long long a[7];\n\n bool find = false;\n scanf(\"%d\", &n);\n if (n == 0)\n printf(\"%s\\n%d\\n%d\\n%d\\n%d\\n\", Y,1,1,3,3);\n else if (n == 1)\n {\n scanf(\"%I64d\", &a[1]);\n a[4] = 3*a[1];\n for (a[2] = 1; a[2] <=10e6&&!find; a[2]++)\n {\n for (a[3] =1; a[3] <= 10e6&&!find; a[3]++)\n if ((a[2] + a[3]) == 4 * a[1])\n {\n find = true;\n break;\n }\n if (find)\n break;\n }\n if (find)\n printf(\"%s\\n%I64d\\n%I64d\\n%I64d\\n\", Y, a[2], a[3], a[4]);\n else\n printf(\"%s\\n\", N);\n\n }\n else if (n == 2)\n {\n scanf(\"%I64d%I64d\", &a[1], &a[2]);\n a[4] = 3 * a[1];\n for (a[3] = 1; a[3] <= 10e6&&!find;a[3]++)\n if (a[3] == (4 * a[1] - a[2]))\n {\n find = true;\n break;\n }\n if (find)\n printf(\"%s\\n%I64d\\n%I64d\\n\", Y, a[3], a[4]);\n else\n printf(\"%s\\n\", N);\n }\n else if (n == 3)\n {\n scanf(\"%I64d%I64d%I64d\", &a[1], &a[2], &a[3]);\n a[4] = 3* a[1];\n if ((a[2] + a[3]) == 4 * a[1])\n find = true;\n else\n find = false;\n if (find)\n printf(\"%s\\n%I64d\\n\", Y, a[4]);\n else\n printf(\"%s\\n\", N);\n\n }\n else\n {\n scanf(\"%I64d%I64d%I64d%I64d\", &a[1], &a[2], &a[3], &a[4]);\n if (a[4] == 3 * a[1] && (a[2] + a[3]) == 4 * a[1])\n find = true;\n else\n find = false;\n if (find)\n printf(\"%s\\n\", Y);\n else\n printf(\"%s\\n\", N);\n }\n\n\n return 0;\n}\n\n\n"}, {"source_code": "#include\n#include\n#include\n#define Y \"YES\"\n#define N \"NO\"\nint main(void)\n{\n int n;\n long long x1, x2, x3, x4;\n bool find = false;\n scanf(\"%d\", &n);\n if (n == 0)\n printf(\"%s\\n%d\\n%d\\n%d\\n%d\\n\", Y,1,1,3,3);\n else if (n == 1)\n {\n scanf(\"%lld\", &x1);\n x4 = 3*x1;\n for (x2 = x1; x2 <= x4&&!find; x2++)\n {\n for (x3 = x2; x3 <= x4&&!find; x3++)\n if ((x2 + x3) == 4 * x1)\n {\n find = true;\n break;\n }\n if (find)\n break;\n }\n if (find)\n printf(\"%s\\n%lld\\n%lld\\n%lld\\n\", Y, x2, x3, x4);\n else\n printf(\"%s\\n\", N);\n\n }\n else if (n == 2)\n {\n scanf(\"%lld%lld\", &x1, &x2);\n x4 = 3 * x1;\n for (x3 = x2; x3 <= x4&&!find;x3++)\n if (x3 == (4 * x1 - x2) && x3 >= x2)\n {\n find = true;\n break;\n }\n if (find)\n printf(\"%s\\n%lld\\n%lld\\n\", Y, x3, x4);\n else\n printf(\"%s\\n\", N);\n }\n else if (n == 3)\n {\n scanf(\"%lld%lld%lld\", &x1, &x2, &x3);\n x4 = 3* x1;\n if (x4 >= x3 && (x2 + x3) == 4 * x1)\n find = true;\n else\n find = false;\n if (find)\n printf(\"%s\\n%lld\\n\", Y, x4);\n else\n printf(\"%s\\n\", N);\n\n }\n else\n {\n scanf(\"%lld%lld%lld%lld\", &x1, &x2, &x3, &x4);\n if (x4 = 3 * x1 && (x2 + x3) == 4 * x1)\n find = true;\n else\n find = false;\n if (find)\n printf(\"%s\\n\", Y);\n else\n printf(\"%s\\n\", N);\n }\n\n\n return 0;\n}"}, {"source_code": "#include\n#include\n#include\n#define Y \"YES\"\n#define N \"NO\"\nint Merge(long long *a, int l, int r);\nlong long temp[7];\nint main(void)\n{\n int n;\n long long a[7];\n\n bool find = false;\n scanf(\"%d\", &n);\n if (n == 0)\n printf(\"%s\\n%d\\n%d\\n%d\\n%d\\n\", Y,1,1,3,3);\n else if (n == 1)\n {\n scanf(\"%I64d\", &a[1]);\n a[4] = 3*a[1];\n for (a[2] = a[1]; a[2] <= a[4]&&!find; a[2]++)\n {\n for (a[3] = a[2]; a[3] <= a[4]&&!find; a[3]++)\n if ((a[2] + a[3]) == 4 * a[1])\n {\n find = true;\n break;\n }\n if (find)\n break;\n }\n if (find)\n printf(\"%s\\n%I64d\\n%I64d\\n%I64d\\n\", Y, a[2], a[3], a[4]);\n else\n printf(\"%s\\n\", N);\n\n }\n else if (n == 2)\n {\n scanf(\"%I64d%I64d\", &a[1], &a[2]);\n Merge(a, 1, n);\n if (a[2] != 3 * a[1])\n {\n a[4] = 3 * a[1];\n a[3] = 4 * a[1] - a[2];\n if (a[3]>=1)\n printf(\"%s\\n%I64d\\n%I64d\\n\", Y, a[3], a[4]);\n else\n printf(\"%s\\n\", N);\n\n }\n else\n {\n a[4] = a[2];\n for (a[2] = a[1]; a[2] <= a[4] && !find; a[2]++)\n {\n for (a[3] = a[2]; a[3] <= a[4] && !find; a[3]++)\n if (a[3] == (4 * a[1] - a[2]) && !find)\n {\n find = true;\n break;\n }\n if (find)\n break;\n }\n if (find)\n printf(\"%s\\n%I64d\\n%I64d\\n\", Y, a[2], a[3]);\n else\n printf(\"%s\\n\", N);\n } \n \n }\n else if (n == 3)\n {\n scanf(\"%I64d%I64d%I64d\", &a[1], &a[2], &a[3]);\n Merge(a, 1, n);\n if (a[3] == 3 * a[1])\n {\n a[4] = a[3];\n for (a[3] = a[1]; a[3] <= a[4]&&!find;a[3]++)\n if ((a[3] + a[2]) == 4 * a[1])\n {\n find = true;\n break;\n }\n if (find)\n printf(\"%s\\n%I64d\\n\", Y, a[3]);\n else\n printf(\"%s\\n\", N);\n }\n else\n {\n a[4] = 3 * a[1];\n if ((a[2] + a[3]) == 4 * a[1])\n find = true;\n \n if (find)\n printf(\"%s\\n%I64d\\n\", Y, a[4]);\n else\n printf(\"%s\\n\", N);\n \n }\n \n\n }\n else\n {\n scanf(\"%I64d%I64d%I64d%I64d\", &a[1], &a[2], &a[3], &a[4]);\n Merge(a, 1, n);\n if (a[4] = 3 * a[1] && (a[2] + a[3]) == 4 * a[1])\n find = true;\n else\n find = false;\n if (find)\n printf(\"%s\\n\", Y);\n else\n printf(\"%s\\n\", N);\n }\n\n\n return 0;\n}\n\n\nint Merge(long long *a, int l, int r)\n{\n int mid = (l + r) / 2;\n int q = l, p = mid + 1, i = l;\n if (l == r)\n return 0;\n Merge(a, l, mid);\n Merge(a, mid + 1, r);\n while (q <= mid || p <= r)\n if (q > mid || (p <= r&&a[q] > a[p]))\n temp[i++] = a[p++];\n else\n temp[i++] = a[q++];\n\n for (i = l; i <= r; i++)\n a[i] = temp[i];\n\n}"}, {"source_code": "#include\n#include\n#include\n\nint main()\n{\n\tlong x[4] = { -1, -1, -2, -2 }, i, j, n, temp;\n\tscanf(\"%d\", &n);\n\tfor (i = 0; i < n; ++i)\n\t{\n\t\tscanf(\"%d\", &x[i]);\n\t}\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 (x[i]>x[j])\n\t\t\t{\n\t\t\t\ttemp = x[i];\n\t\t\t\tx[i] = x[j];\n\t\t\t\tx[j] = temp;\n\t\t\t}\n\t\t}\n\t}\n\tif (x[0] != x[2] && x[1] != x[3])\n\t{\n\t\tif (n == 0)\n\t\t{\n\t\t\tprintf(\"YES\\n%ld\\n%ld\\n%ld\\n%ld\", 1, 1, 3, 3);\n\t\t}\n\t\telse\n\t\tif (n == 1)\n\t\t{\n\t\t\tprintf(\"YES\\n%ld\\n%ld\\n%ld\", x[0], 3 * x[0], 3 * x[0]);\n\t\t}\n\t\telse if (n == 2)\n\t\t{\n\t\t\tif (x[1] > 3 * x[0])\n\t\t\t\tprintf(\"NO\");\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"YES\\n%ld\\n%ld\", 4 * x[0] - x[1], 3 * x[0]);\n\t\t\t}\n\t\t}\n\t\telse if (n == 3)\n\t\t{\n\t\t\tif (x[1] + x[2] == 4 * x[0])\n\t\t\t\tprintf(\"YES\\n%ld\", 3 * x[0]);\n\t\t\telse\n\t\t\t\tprintf(\"NO\");\n\t\t}\n\t\telse if (n == 4)\n\t\t{\n\t\t\tif (x[3] == 3 * x[0] && x[1] + x[2] == 4 * x[0])\n\t\t\t\tprintf(\"YES\");\n\t\t\telse\n\t\t\t\tprintf(\"NO\");\n\t\t}\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n\nint main()\n{\n\tlong x[4] = { -1, -1, -2, -2 }, i, j, n, temp;\n\tscanf(\"%d\", &n);\n\tfor (i = 0; i < n; ++i)\n\t{\n\t\tscanf(\"%d\", &x[i]);\n\t}\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 (x[i]>x[j])\n\t\t\t{\n\t\t\t\ttemp = x[i];\n\t\t\t\tx[i] = x[j];\n\t\t\t\tx[j] = temp;\n\t\t\t}\n\t\t}\n\t}\n\tif (x[0] != x[2] && x[1] != x[3])\n\t{\n\t\tif (n == 0)\n\t\t{\n\t\t\tprintf(\"YES\\n%ld\\n%ld\\n%ld\\n%ld\", 1, 1, 3, 3);\n\t\t}\n\t\telse\n\t\tif (n == 1)\n\t\t{\n\t\t\tprintf(\"YES\\n%ld\\n%ld\\n%ld\", x[0], 3 * x[0], 3 * x[0]);\n\t\t}\n\t\telse if (n == 2)\n\t\t{\n\t\t\tif (x[1] > 3 * x[0])\n\t\t\t\tprintf(\"NO\");\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"YES\\n%ld\\n%ld\", 4 * x[0] - x[1], 3 * x[0]);\n\t\t\t}\n\t\t}\n\t\telse if (n == 3)\n\t\t{\n\t\t\tif (x[1] + x[2] > 4 * x[0])\n\t\t\t\tprintf(\"NO\");\n\t\t\telse if (x[2] == 3 * x[0])\n\t\t\t\tprintf(\"YES\\n%ld\", 4 * x[0] - x[1]);\n\t\t\telse if (x[1] + x[2] == 3 * x[0])\n\t\t\t\tprintf(\"YES\\n%d\", 3 * x[0]);\n\t\t\telse \n\t\t\t\tprintf(\"NO\");\n\t\t\t\n\t\t}\n\t\telse if (n == 4)\n\t\t{\n\t\t\tif (x[3] == 3 * x[0] && x[1] + x[2] == 4 * x[0])\n\t\t\t\tprintf(\"YES\");\n\t\t\telse\n\t\t\t\tprintf(\"NO\");\n\t\t}\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n#include\nint main()\n{\n long n, x[4] = { -1, -1, -2, -2 }, i;\n scanf(\"%d\", &n);\n \n for (i = 0; i < n; i++)\n {\n scanf(\"%d\", &x[i]);\n }\n if (x[0] != x[2] && x[1] != x[3])\n {\n \n if (n==4)\n {\n if (x[3] == 3 * x[0] && (x[2] == 4 * x[0] - x[1]))\n {\n printf(\"YES\");\n return 0;\n }\n }\n if (n==3)\n {\n if ((x[1] + x[2]) == 4 * x[0])\n {\n printf(\"YES\\n%ld\", 3 * x[0]);\n return 0;\n }\n }\n if (n==2)\n {\n printf(\"YES\\n%ld\\n%ld\", 4 * x[0] - x[1], 3 * x[0]);\n return 0;\n }\n \n \n if (n==1)\n {\n printf(\"YES\\n%ld\\n%ld\\n%ld\", x[0], 3 * x[0], 3 * x[0]);\n return 0;\n }\n if (n==0)\n {\n printf(\"YES\\n%d\\n%d\\n%d\\n%d\", 1, 1, 3, 3);\n return 0;\n }\n \n }\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include\n#include\n#include\nint main()\n{\n long n, x[4] = { -1, -1, -2, -2 }, i;\n scanf(\"%d\", &n);\n \n for (i = 0; i < n; i++)\n {\n scanf(\"%d\", &x[i]);\n }\n if (x[0] != x[2] && x[1] != x[3])\n {\n if ((3 * x[0]) <= 500)\n {\n if (n==4)\n {\n if (x[3] == 3 * x[0] && (x[2] == 4 * x[0] - x[1]))\n {\n printf(\"YES\");\n return 0;\n }\n }\n if (n==3)\n {\n if ((x[1] + x[2]) == 4 * x[0])\n {\n printf(\"YES\\n%ld\", 3 * x[0]);\n return 0;\n }\n }\n if (n==2)\n {\n printf(\"YES\\n%ld\\n%ld\", 4 * x[0] - x[1], 3 * x[0]);\n return 0;\n }\n \n \n if (n==1)\n {\n printf(\"YES\\n%ld\\n%ld\\n%ld\", x[0], 3 * x[0], 3 * x[0]);\n return 0;\n }\n if (n==0)\n {\n printf(\"YES\\n%d\\n%d\\n%d\\n%d\", 1, 1, 3, 3);\n return 0;\n }\n }\n }\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n\nint main()\n{\n\tlong x[4] = { -1, -1, -2, -2 }, i, j, n, temp;\n\tscanf(\"%d\", &n);\n\tfor (i = 0; i < n; ++i)\n\t{\n\t\tscanf(\"%d\", &x[i]);\n\t}\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 (x[i]>x[j])\n\t\t\t{\n\t\t\t\ttemp = x[i];\n\t\t\t\tx[i] = x[j];\n\t\t\t\tx[j] = temp;\n\t\t\t}\n\t\t}\n\t}\n\tif (x[0] != x[2] && x[1] != x[3])\n\t{\n\t\tif (n == 0)\n\t\t{\n\t\t\tprintf(\"YES\\n%ld\\n%ld\\n%ld\\n%ld\", 1, 1, 3, 3);\n\t\t}\n\t\telse\n\t\tif (n == 1)\n\t\t{\n\t\t\tprintf(\"YES\\n%ld\\n%ld\\n%ld\", x[0], 3 * x[0], 3 * x[0]);\n\t\t}\n\t\telse if (n == 2)\n\t\t{\n\t\t\tif (x[1] > 3 * x[0])\n\t\t\t\tprintf(\"NO\");\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"YES\\n%ld\\n%ld\", 4 * x[0] - x[1], 3 * x[0]);\n\t\t\t}\n\t\t}\n\t\telse if (n == 3)\n\t\t{\n\t\t\t\n\t\t\tif (x[2] == (3 * x[0]))\n\t\t\t\tprintf(\"YES\\n%ld\", 4 * x[0] - x[1]);\n\t\t\telse if (x[1] + x[2] == 4 * x[0])\n\t\t\t\tprintf(\"YES\\n%d\", 3 * x[0]);\n\t\t\telse \n\t\t\t\tprintf(\"NO\");\n\t\t\t\n\t\t}\n\t\telse if (n == 4)\n\t\t{\n\t\t\tif (x[3] == 3 * x[0] && x[1] + x[2] == 4 * x[0])\n\t\t\t\tprintf(\"YES\");\n\t\t\telse\n\t\t\t\tprintf(\"NO\");\n\t\t}\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n\nint main()\n{\n\tlong x[4] = { -1, -1, -2, -2 }, i, j, n, temp;\n\tscanf(\"%d\", &n);\n\tfor (i = 0; i < n; ++i)\n\t{\n\t\tscanf(\"%d\", &x[i]);\n\t}\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 (x[i]>x[j])\n\t\t\t{\n\t\t\t\ttemp = x[i];\n\t\t\t\tx[i] = x[j];\n\t\t\t\tx[j] = temp;\n\t\t\t}\n\t\t}\n\t}\n\tif (x[0] != x[2] && x[1] != x[3])\n\t{\n\t\tif (n == 0)\n\t\t{\n\t\t\tprintf(\"YES\\n%ld\\n%ld\\n%ld\\n%ld\", 1, 1, 3, 3);\n\t\t}\n\t\telse\n\t\tif (n == 1)\n\t\t{\n\t\t\tprintf(\"YES\\n%ld\\n%ld\\n%ld\", x[0], 3 * x[0], 3 * x[0]);\n\t\t}\n\t\telse if (n == 2)\n\t\t{\n\t\t\tif (x[1] > 3 * x[0])\n\t\t\t\tprintf(\"NO\");\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"YES\\n%ld\\n%ld\", 4 * x[0] - x[1], 3 * x[0]);\n\t\t\t}\n\t\t}\n\t\telse if (n == 3)\n\t\t{\n\t\t\tif (x[1] + x[2] > 4 * x[0])\n\t\t\t\tprintf(\"NO\");\n\t\t\telse if (x[2] == 3 * x[0])\n\t\t\t\tprintf(\"YES\\n%ld\", 4 * x[0] - x[1]);\n\t\t\telse if (x[1] + x[2] == 3 * x[0])\n\t\t\t\tprintf(\"YES\\n%d\", 3 * x[0]);\n\t\t\t\n\t\t}\n\t\telse if (n == 4)\n\t\t{\n\t\t\tif (x[3] == 3 * x[0] && x[1] + x[2] == 4 * x[0])\n\t\t\t\tprintf(\"YES\");\n\t\t\telse\n\t\t\t\tprintf(\"NO\");\n\t\t}\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n\nint main()\n{\n\tlong x[4] = { -1, -1, -2, -2 }, i, j, n, temp;\n\tscanf(\"%d\", &n);\n\tfor (i = 0; i < n; ++i)\n\t{\n\t\tscanf(\"%d\", &x[i]);\n\t}\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 (x[i]>x[j])\n\t\t\t{\n\t\t\t\ttemp = x[i];\n\t\t\t\tx[i] = x[j];\n\t\t\t\tx[j] = temp;\n\t\t\t}\n\t\t}\n\t}\n\tif (x[0] != x[2] && x[1] != x[3])\n\t{\n\t\tif (n == 0)\n\t\t{\n\t\t\tprintf(\"YES\\n%ld\\n%ld\\n%ld\\n%ld\", 1, 1, 3, 3);\n\t\t}\n\t\telse\n\t\tif (n == 1)\n\t\t{\n\t\t\tprintf(\"YES\\n%ld\\n%ld\\n%ld\", x[0], 3 * x[0], 3 * x[0]);\n\t\t}\n\t\telse if (n == 2)\n\t\t{\n\t\t\tif (x[1] > 3 * x[0])\n\t\t\t\tprintf(\"NO\");\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"YES\\n%ld\\n%ld\", 4 * x[0] - x[1], 3 * x[0]);\n\t\t\t}\n\t\t}\n\t\telse if (n == 3)\n\t\t{\n\t\t\tif (x[1] + x[2] > 4 * x[0])\n\t\t\t\tprintf(\"NO\");\n\t\t\telse if (x[2] == 3 * x[0])\n\t\t\t\tprintf(\"YES\\n%ld\", 4 * x[0] - x[1]);\n\t\t\telse if (x[1] + x[2] == 4 * x[0])\n\t\t\t\tprintf(\"YES\\n%d\", 3 * x[0]);\n\t\t\telse \n\t\t\t\tprintf(\"NO\");\n\t\t\t\n\t\t}\n\t\telse if (n == 4)\n\t\t{\n\t\t\tif (x[3] == 3 * x[0] && x[1] + x[2] == 4 * x[0])\n\t\t\t\tprintf(\"YES\");\n\t\t\telse\n\t\t\t\tprintf(\"NO\");\n\t\t}\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n\n\nint main(void){\n int n,i,aux; int t[6];\nscanf(\"%d\",&n);\nif (n==0) { printf(\"YES\\n\"); printf(\"1\\n\"); printf(\"1\\n\"); printf(\"3\\n\"); printf(\"3\");}\nelse for(i=0;i<=n-1;i++) { scanf(\"%d\",&t[i]);}\n\nif (n==1) { printf(\"YES\\n\"); printf(\"%d\\n\",t[0]); printf(\"%d\\n\",3*t[0]); printf(\"%d\\n\",3*t[0]);}\n\nif (n==2) {\n if (t[0]>t[1]) {aux=t[0]; t[0]=t[1]; t[1]=aux;}\n if (3*t[0]\n#include\n\n\nint main(void){\n int n,i; int t[6];\nscanf(\"%d\",&n);\nif (n==0) { printf(\"YES\\n\"); printf(\"1 \\n\"); printf(\"1 \\n\"); printf(\"3 \\n\"); printf(\"3 \\n\");}\nelse for(i=0;i<=n-1;i++) { scanf(\"%d\",&t[i]);}\n\nif (n==1) { printf(\"YES\\n\"); printf(\"%d\\n\",t[0]); printf(\"%d\\n\",3*t[0]); printf(\"%d\\n\",3*t[0]);}\n\nif (n==2) {\n if (3*t[0]\n#include\n\n\nint main(void){\n int n,i,aux,j; int t[6];\nscanf(\"%d\",&n);\nif (n==0) { printf(\"YES\\n\"); printf(\"1\\n\"); printf(\"1\\n\"); printf(\"3\\n\"); printf(\"3\");}\nelse for(i=0;i<=n-1;i++) { scanf(\"%d\",&t[i]);}\n\nif (n==1) { printf(\"YES\\n\"); printf(\"%d\\n\",t[0]); printf(\"%d\\n\",3*t[0]); printf(\"%d\\n\",3*t[0]);}\n\nif (n==2) {\n if (t[0]>t[1]) {aux=t[0]; t[0]=t[1]; t[1]=aux;}\n if (3*t[0]=0;i--)\n for(j=0;j<=i-1;j++) if (t[j]>t[j+1]) {aux=t[j]; t[j]=t[j+1]; t[j+1]=aux;}\n if (t[1]+t[2]==4*t[0]) printf(\"%d\",3*t[0]);\n else if (t[2]%3==0 && t[0]+t[1]==(4*t[2])/3) printf(\"%d\",t[2]/3);\n else if (t[2]==3*t[0]) printf(\"%d\",t[0]+t[2]-t[1]);\n else for (i=1;i<=500;i++) if (i==3*t[0] && i+t[0]==t[1]+t[2]) {printf(\"%d\",i); break;}\n\n }\n }\n if (n==4) {\n if (t[3]==3*t[0] && t[3]+t[0]==t[1]+t[2]) printf(\"YES\\n\");\n else printf(\"NO\");\n }\n\n\nreturn 0;\n\n}\n"}, {"source_code": "#include\n#include\n\n\nint main(void){\n int n,i,aux; int t[6];\nscanf(\"%d\",&n);\nif (n==0) { printf(\"YES\\n\"); printf(\"1\\n\"); printf(\"1\\n\"); printf(\"3\\n\"); printf(\"3\");}\nelse for(i=0;i<=n-1;i++) { scanf(\"%d\",&t[i]);}\n\nif (n==1) { printf(\"YES\\n\"); printf(\"%d\\n\",t[0]); printf(\"%d\\n\",3*t[0]); printf(\"%d\\n\",3*t[0]);}\n\nif (n==2) {\n if (t[0]>t[1]) {aux=t[0]; t[0]=t[1]; t[1]=aux;}\n if (3*t[0]\n#include\n\n\nint main(void){\n int n,i,aux,j,k; int t[6];\nscanf(\"%d\",&n);\nif (n==0) { printf(\"YES\\n\"); printf(\"1\\n\"); printf(\"1\\n\"); printf(\"3\\n\"); printf(\"3\");}\nelse for(i=0;i<=n-1;i++) { scanf(\"%d\",&t[i]);}\n\nif (n==1) { printf(\"YES\\n\"); printf(\"%d\\n\",t[0]); printf(\"%d\\n\",3*t[0]); printf(\"%d\\n\",3*t[0]);}\n\nif (n==2) {\n if (t[0]>t[1]) {aux=t[0]; t[0]=t[1]; t[1]=aux;}\n if (3*t[0]\n#include\n\n\nint main(void){\n int n,i,aux; int t[6];\nscanf(\"%d\",&n);\nif (n==0) { printf(\"YES\\n\"); printf(\"1\\n\"); printf(\"1\\n\"); printf(\"3\\n\"); printf(\"3\");}\nelse for(i=0;i<=n-1;i++) { scanf(\"%d\",&t[i]);}\n\nif (n==1) { printf(\"YES\\n\"); printf(\"%d\\n\",t[0]); printf(\"%d\\n\",3*t[0]); printf(\"%d\\n\",3*t[0]);}\n\nif (n==2) {\n if (t[0]>t[1]) {aux=t[0]; t[0]=t[1]; t[1]=aux;}\n if (3*t[0]\n#include\n\n\nint main(void){\n int n,i; int t[6];\nscanf(\"%d\",&n);\nif (n==0) { printf(\"YES\\n\"); printf(\"1\\n\"); printf(\"1\\n\"); printf(\"3\\n\"); printf(\"3\");}\nelse for(i=0;i<=n-1;i++) { scanf(\"%d\",&t[i]);}\n\nif (n==1) { printf(\"YES\\n\"); printf(\"%d\\n\",t[0]); printf(\"%d\\n\",3*t[0]); printf(\"%d\\n\",3*t[0]);}\n\nif (n==2) {\n if (3*t[0]\n#include\n\n\nint main(void){\n int n,i,aux,j,k; int t[6];\nscanf(\"%d\",&n);\nif (n==0) { printf(\"YES\\n\"); printf(\"1\\n\"); printf(\"1\\n\"); printf(\"3\\n\"); printf(\"3\");}\nelse for(i=0;i<=n-1;i++) { scanf(\"%d\",&t[i]);}\n\nif (n==1) { printf(\"YES\\n\"); printf(\"%d\\n\",t[0]); printf(\"%d\\n\",3*t[0]); printf(\"%d\\n\",3*t[0]);}\n\nif (n==2) {\n if (t[0]>t[1]) {aux=t[0]; t[0]=t[1]; t[1]=aux;}\n if (3*t[0]\n#include \n\nint cmpfunc (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\n\n\nint main()\n{\n\tint A[4];\n\tint n,i,j;\n\tint mean,median,range;\n\n\tscanf(\"%d\",&n);\n\tif(n==0)\n\t\treturn 0;\n\tfor(i=0;i\n#include \n\nint cmpfunc (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\n\n\nint main()\n{\n\tint A[4];\n\tint n,i,j;\n\tint mean,median,range;\n\n\tscanf(\"%d\",&n);\n\tfor(i=0;i=b && c<= d)\n\t\t\t\t{\n\t\t\t\t\tmedian=(b+c)*2;\n\t\t\t\t\tif(median==range)\n\t\t\t\t\t{\n\t\t\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\t\t\tprintf(\"%d\\n%d\\n%d\\n\",b,c,d);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\t\t\t\n\t\t}\n\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint cmpfunc (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\n\n\nint main()\n{\n\tint A[4];\n\tint n,i,j;\n\tint mean,median,range;\n\n\tscanf(\"%d\",&n);\n\tfor(i=0;i\n#include \nint judge(int s[]);\nint cmp(const void *a,const void *b);\nint main(void){\n\tint i,n,boxes[10]={0},temp,state=0;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i 3)\n state = 0;\n else{\n boxes[2] = 3*boxes[0];\n boxes[3] = 4*boxes[0] - boxes[1];\n state = 1;}\n}\n else if (n==3){\n for(i = 1; i<=3*boxes[0];i++){\n boxes[3] = i;\n if(judge(boxes)){\n state = 1;\n break;\n }\n }\n}\n else \n state = judge(boxes); \n\tif(state){\n\t\tprintf(\"YES\\n\");\n\t\tfor(i=n;i<4;i++)\n\t\t\tprintf(\"%d\\n\",boxes[i]);\n\t}\n\telse\n\t\tprintf(\"NO\\n\");\n\t//system(\"pause\");\n\treturn 0;\n}\nint judge(int s[]){\n\tint i,temp[4];\n double mean,median,range;\n\tfor(i=0;i<4;i++)\n temp[i] = s[i];\n\tqsort(temp,4,sizeof(s[0]),cmp);\n\tmean = (temp[0] + temp[1] + temp[2] +temp[3])/4.0;\n\tmedian = (temp[1] + temp[2])/2.0;\n\trange =(temp[3] - temp[0]);\n\treturn (mean == median) && ( mean == range);\n}\nint cmp(const void *a,const void *b){\n\treturn *(int *)a - *(int *)b;\n}\n\t\n\t\n"}, {"source_code": "#include\nint main()\n{\n\tint n,i,j,x,y,z,w,temp,mean,median,range;\n\tscanf(\"%d\",&n);\n\tint A[4];\n\tfor(i=0;iA[j])\n\t\t\t{\n\t\t\t\ttemp=A[i];\n\t\t\t\tA[i]=A[j];\n\t\t\t\tA[j]=temp;\n\t\t\t}\n\t\t}\n\t}\n\tif(n==0)\n\t\tprintf(\"YES\\n1\\n1\\n3\\n3\\n\");\n\telse if(n==1)\n\t{\n\t\tprintf(\"YES\\n%d\\n%d\\n%d\\n\",A[0],A[0]*3,A[0]*3);\n\t}\n\telse if(n==2)\n\t{\n\t\tx=A[0],y=A[1];\n\t\tif(3*x\nint main()\n{\n\tint n,i,j,x,y,z,w,temp,mean,median,range;\n\tscanf(\"%d\",&n);\n\tint A[4];\n\tfor(i=0;iA[j])\n\t\t\t{\n\t\t\t\ttemp=A[i];\n\t\t\t\tA[i]=A[j];\n\t\t\t\tA[j]=temp;\n\t\t\t}\n\t\t}\n\t}\n\tif(n==0)\n\t\tprintf(\"YES\\n1\\n1\\n3\\n3\\n\");\n\telse if(n==1)\n\t{\n\t\tprintf(\"YES\\n%d\\n%d\\n%d\\n\",A[0],A[0]*3,A[0]*3);\n\t}\n\telse if(n==2)\n\t{\n\t\tx=A[0],y=A[1];\n\t\tif(3*xz)\n\t\t\tprintf(\"NO\\n\");\n\t\telse\n\t\t\tprintf(\"YES\\n%d\\n\",3*x);\n\t}\n\telse\n\t{\n\t\tx=A[0],y=A[1],z=A[2],w=A[3];\n\t\tmean=(x+y+z+w)/4;\n\t\tmedian=(y+z)/2;\n\t\trange=w-x;\n\t\tif(mean==median&&median==range)\n\t\t\tprintf(\"YES\\n\");\n\t\telse\n\t\t\tprintf(\"NO\\n\");\n\t}\t\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,i,j,x,y,z,w,temp,mean,median,range;\n\tscanf(\"%d\",&n);\n\tint A[4];\n\tfor(i=0;iA[j])\n\t\t\t{\n\t\t\t\ttemp=A[i];\n\t\t\t\tA[i]=A[j];\n\t\t\t\tA[j]=temp;\n\t\t\t}\n\t\t}\n\t}\n\tif(n==0)\n\t\tprintf(\"YES\\n1\\n1\\n3\\n3\\n\");\n\telse if(n==1)\n\t{\n\t\tprintf(\"YES\\n%d\\n%d\\n%d\\n\",A[0],A[0]*3,A[0]*3);\n\t}\n\telse if(n==2)\n\t{\n\t\tx=A[0],y=A[1];\n\t\tif(3*x\nint main()\n{\n\tint n,i,j,x,y,z,temp;\n\tscanf(\"%d\",&n);\n\tint A[4];\n\tfor(i=0;iA[j])\n\t\t\t\t{\n\t\t\t\t\ttemp=A[i];\n\t\t\t\t\tA[i]=A[j];\n\t\t\t\t\tA[j]=temp;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tx=A[0],y=A[1],z=A[3];\n\t\tif(3*x>z)\n\t\t\tprintf(\"NO\\n\");\n\t\telse\n\t\t\tprintf(\"YES\\n%d\\n\",3*x);\n\t}\n\telse\n\t\tprintf(\"YES\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,i,j,x,y,z,w,temp,mean,median,range;\n\tscanf(\"%d\",&n);\n\tint A[4];\n\tfor(i=0;iA[j])\n\t\t\t{\n\t\t\t\ttemp=A[i];\n\t\t\t\tA[i]=A[j];\n\t\t\t\tA[j]=temp;\n\t\t\t}\n\t\t}\n\t}\n\tif(n==0)\n\t\tprintf(\"YES\\n1\\n1\\n3\\n3\\n\");\n\telse if(n==1)\n\t{\n\t\tprintf(\"YES\\n%d\\n%d\\n%d\\n\",A[0],A[0]*3,A[0]*3);\n\t}\n\telse if(n==2)\n\t{\n\t\tx=A[0],y=A[1];\n\t\tif(3*x\nint main()\n{\n\tint n,i,j,x,y,z,temp;\n\tscanf(\"%d\",&n);\n\tint A[4];\n\tfor(i=0;iA[j])\n\t\t\t\t{\n\t\t\t\t\ttemp=A[i];\n\t\t\t\t\tA[i]=A[j];\n\t\t\t\t\tA[j]=temp;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tx=A[0],y=A[1],z=A[3];\n\t\tif(3*x>z)\n\t\t\tprintf(\"NO\\n\");\n\t\telse\n\t\t\tprintf(\"YES\\n%d\\n%d\\n%d\\n%d\\n\",x,y,z,3*x);\n\t}\n\telse\n\t\tprintf(\"YES\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,i,j,x,y,z,temp;\n\tscanf(\"%d\",&n);\n\tint A[4];\n\tfor(i=0;iA[j])\n\t\t\t\t{\n\t\t\t\t\ttemp=A[i];\n\t\t\t\t\tA[i]=A[j];\n\t\t\t\t\tA[j]=temp;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tx=A[0],y=A[1],z=A[3];\n\t\tif(3*x>z)\n\t\t\tprintf(\"NO\\n\");\n\t\telse\n\t\t\tprintf(\"YES\\n%d\\n\",3*x);\n\t}\n\telse\n\t\tprintf(\"YES\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \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 n, a[4], tmp;\n\n\tscanf(\"%d\", &n);\n\tswitch (n) {\n\t\tcase 0:\n\t\t\tprintf(\"YES\\n1\\n1\\n3\\n3\\n\");\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tscanf(\"%d\", &a[0]);\n\t\t\tprintf(\"YES\\n%d\\n%d\\n%d\\n\", a[0], 3 * a[0], 3 * a[0]);\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tscanf(\"%d%d\", &a[0], &a[1]);\n\t\t\tif (a[0] > a[1])\n\t\t\t\ttmp = a[0], a[0] = a[1], a[1] = tmp;\n\t\t\tif (a[1] == 3 * a[0])\n\t\t\t\tprintf(\"YES\\n%d\\n%d\\n\", a[0], a[1]);\n\t\t\telse if (a[0] == a[1])\n\t\t\t\tprintf(\"YES\\n%d\\n%d\\n\", 3 * a[0], 3 * a[0]);\n\t\t\telse if (3 * a[0] > a[1])\n\t\t\t\tprintf(\"YES\\n%d\\n%d\\n\", 3 * a[0], 4 * a[0] - a[1]);\n\t\t\telse\n\t\t\t\tprintf(\"NO\\n\");\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tscanf(\"%d%d%d\", &a[0], &a[1], &a[2]);\n\t\t\tqsort(a, 3, sizeof(*a), compare);\n\t\t\tif (4 * a[0] == a[1] + a[2])\n\t\t\t\tprintf(\"YES\\n%d\\n\", 3 * a[0]);\n\t\t\telse if (a[2] == 3 * a[0])\n\t\t\t\tprintf(\"YES\\n%d\\n\", 4 * a[0] - a[1]);\n\t\t\telse if (a[2] % 3 == 0\n\t\t\t\t\t&& a[2] / 3 <= a[0]\n\t\t\t\t\t&& a[2] * 4 / 3 == a[1] + a[2])\n\t\t\t\tprintf(\"YES\\n%d\\n\", a[2] / 3);\n\t\t\telse\n\t\t\t\tprintf(\"NO\\n\");\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tscanf(\"%d%d%d%d\", &a[0], &a[1], &a[2], &a[3]);\n\t\t\tprintf(\"%s\\n\", a[3] == 3 * a[0] && 4 * a[0] == a[1] * a[2] \n\t\t\t\t\t? \"YES\" : \"NO\");\n\t\t\tbreak;\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \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 n, a[4], tmp;\n\n\tscanf(\"%d\", &n);\n\tswitch (n) {\n\t\tcase 0:\n\t\t\tprintf(\"YES\\n1\\n1\\n3\\n3\\n\");\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tscanf(\"%d\", &a[0]);\n\t\t\tprintf(\"YES\\n%d\\n%d\\n%d\\n\", a[0], 3 * a[0], 3 * a[0]);\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tscanf(\"%d%d\", &a[0], &a[1]);\n\t\t\tif (a[0] > a[1])\n\t\t\t\ttmp = a[0], a[0] = a[1], a[1] = tmp;\n\t\t\tif (a[1] == 3 * a[0])\n\t\t\t\tprintf(\"YES\\n%d\\n%d\\n\", a[0], a[1]);\n\t\t\telse if (a[0] == a[1])\n\t\t\t\tprintf(\"YES\\n%d\\n%d\\n\", 3 * a[0], 3 * a[0]);\n\t\t\telse if (3 * a[0] > a[1])\n\t\t\t\tprintf(\"YES\\n%d\\n%d\\n\", 3 * a[0], 4 * a[0] - a[1]);\n\t\t\telse\n\t\t\t\tprintf(\"NO\\n\");\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tscanf(\"%d%d%d\", &a[0], &a[1], &a[2]);\n\t\t\tqsort(a, 3, sizeof(*a), compare);\n\t\t\tif (4 * a[0] == a[1] + a[2])\n\t\t\t\tprintf(\"YES\\n%d\\n\", 3 * a[0]);\n\t\t\telse if (a[2] == 3 * a[0])\n\t\t\t\tprintf(\"YES\\n%d\\n\", 4 * a[0] - a[1]);\n\t\t\telse if (a[2] % 3 == 0\n\t\t\t\t\t&& a[2] / 3 <= a[0]\n\t\t\t\t\t&& a[2] * 4 / 3 == a[0] + a[1])\n\t\t\t\tprintf(\"YES\\n%d\\n\", a[2] / 3);\n\t\t\telse\n\t\t\t\tprintf(\"NO\\n\");\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tscanf(\"%d%d%d%d\", &a[0], &a[1], &a[2], &a[3]);\n\t\t\tqsort(a, 4, sizeof(*a), compare);\n\t\t\tprintf(\"%s\\n\", a[3] == 3 * a[0] && 4 * a[0] == a[1] * a[2] \n\t\t\t\t\t? \"YES\" : \"NO\");\n\t\t\tbreak;\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \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 n, a[4], tmp;\n\n\tscanf(\"%d\", &n);\n\tswitch (n) {\n\t\tcase 0:\n\t\t\tprintf(\"YES\\n1\\n1\\n3\\n3\\n\");\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tscanf(\"%d\", &a[0]);\n\t\t\tprintf(\"YES\\n%d\\n%d\\n%d\\n\", a[0], 3 * a[0], 3 * a[0]);\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tscanf(\"%d%d\", &a[0], &a[1]);\n\t\t\tif (a[0] > a[1])\n\t\t\t\ttmp = a[0], a[0] = a[1], a[1] = tmp;\n\t\t\tif (a[1] == 3 * a[0])\n\t\t\t\tprintf(\"YES\\n%d\\n%d\\n\", a[0], a[1]);\n\t\t\telse if (a[0] == a[1])\n\t\t\t\tprintf(\"YES\\n%d\\n%d\\n\", 3 * a[0], 3 * a[0]);\n\t\t\telse if (3 * a[0] > a[1])\n\t\t\t\tprintf(\"YES\\n%d\\n%d\\n\", 3 * a[0], 4 * a[0] - a[1]);\n\t\t\telse\n\t\t\t\tprintf(\"NO\\n\");\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tscanf(\"%d%d%d\", &a[0], &a[1], &a[2]);\n\t\t\tqsort(a, 3, sizeof(*a), compare);\n\t\t\tif (4 * a[0] == a[1] + a[2])\n\t\t\t\tprintf(\"YES\\n%d\\n\", 3 * a[0]);\n\t\t\telse if (a[2] == 3 * a[0])\n\t\t\t\tprintf(\"YES\\n%d\\n\", 4 * a[0] - a[1]);\n\t\t\telse if (a[2] % 3 == 0 && a[2] / 3 <= a[0])\n\t\t\t\tprintf(\"YES\\n%d\\n\", a[2] / 3);\n\t\t\telse\n\t\t\t\tprintf(\"NO\\n\");\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tscanf(\"%d%d%d%d\", &a[0], &a[1], &a[2], &a[3]);\n\t\t\tprintf(\"%s\\n\", a[3] == 3 * a[0] && 4 * a[0] == a[1] * a[2] \n\t\t\t\t\t? \"YES\" : \"NO\");\n\t\t\tbreak;\n\t}\n\treturn 0;\n}\n"}], "src_uid": "230e613abf0f6a768829cbc1f1a09219"} {"nl": {"description": "Your task is to calculate the number of arrays such that: each array contains $$$n$$$ elements; each element is an integer from $$$1$$$ to $$$m$$$; for each array, there is exactly one pair of equal elements; for each array $$$a$$$, there exists an index $$$i$$$ such that the array is strictly ascending before the $$$i$$$-th element and strictly descending after it (formally, it means that $$$a_j < a_{j + 1}$$$, if $$$j < i$$$, and $$$a_j > a_{j + 1}$$$, if $$$j \\ge i$$$). ", "input_spec": "The first line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \\le n \\le m \\le 2 \\cdot 10^5$$$).", "output_spec": "Print one integer — the number of arrays that meet all of the aforementioned conditions, taken modulo $$$998244353$$$.", "sample_inputs": ["3 4", "3 5", "42 1337", "100000 200000"], "sample_outputs": ["6", "10", "806066790", "707899035"], "notes": "NoteThe arrays in the first example are: $$$[1, 2, 1]$$$; $$$[1, 3, 1]$$$; $$$[1, 4, 1]$$$; $$$[2, 3, 2]$$$; $$$[2, 4, 2]$$$; $$$[3, 4, 3]$$$. "}, "positive_code": [{"source_code": "#include\nlong long int fact[200005];\nlong long int modpow(long long int a, long long int n, long long int p)\n{\n\tif (n < 0)\n\t\treturn 0;\n\tlong long int res = 1;\n\twhile (n > 0)\n\t{\n\t\tif (n % 2 > 0)\n\t\t\tres = res * a % p;\n\t\ta = a * a % p;\n\t\tn /= 2;\n\t}\n\treturn res;\n}\nlong long int comb(long long int n, long long int r, long long int p)\n{\n\tif (n < 0 || r < 0 || n < r)\n\t\treturn 0;\n\tlong long int res = fact[n];\n\tres = res * modpow(fact[r], p - 2, p) % p;\n\tres = res * modpow(fact[n - r], p - 2, p) % p;\n\treturn res;\n}\nint main()\n{\n\tlong long int n, m;\n\tscanf(\"%lld %lld\", &n, &m);\n\tlong long int p = 998244353;\n\tlong long int ans = 0;\n\tlong long int i;\n\tfact[0] = 1;\n\tfor (i = 1; i <= m; i++)\n\t\tfact[i] = fact[i - 1] * i % p;\n\tfor (i = 1; i < m; i++)\n\t\tans = (ans + comb(m - 1, n - 2, p) - comb(i - 1, n - 2, p) + p) % p;\n\tans = ans * modpow(2, n - 3, p) % p;\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}"}, {"source_code": "#include \n#include\n#include\nlong long int power(long long int x, long long int y, long long int p) \n{ \n long long int 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}\nlong long int modInverse(long long int n,long long int p) \n{ \n return power(n, p-2, p); \n} \nlong long int nCrModPFermat(long long int n,long long int r,long long int p) \n{ \n // Base case \n if (r==0) \n return 1; \n \n // Fill factorial array so that we \n // can find all factorial of r, n \n // and n-r \n long long int fac[n+1]; \n fac[0] = 1; \n for (int i=1 ; i<=n; i++) \n fac[i] = fac[i-1]*i%p; \n \n return (fac[n]* modInverse(fac[r], p) % p * \n modInverse(fac[n-r], p) % p) % p; \n} \nint main()\n{\n long long int n, m;\n scanf(\"%lld %lld\", &n, &m);\n if(n==2)\n {\n printf(\"0\");\n return 0;\n }\n long long int p=998244353;\n long long int ans= nCrModPFermat(m, n-1, p);\n for(int i=0;i\n// #include \n// using namespace std;\n \n#include\n#include\n#include\n#include\n#include\n#include\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 SCA(a,n) for(long long i=0;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 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#define FLSH fflush(stdout)\ntypedef long long ll;\ntypedef unsigned long long ull;\nconst ll INF = 1<<29;\nconst ll MOD = 1000000007;\nconst ll FMOD = 998244353;\nconst ll MAX = 10000000005;\nconst ll MIN = -10000000005;\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);\nbool isvowel(char x);\nll chartoint(char ch);\nll CEIL(ll x,ll y);\nll FLOOR(ll x,ll y);\n\n//Final answer : mC(n-1) * (n-2)C1 * 2^(n-3);\nll inv(ll a,ll p)\n{\n ll b=p-2,ans=1;\n for(;b > 0;a = a * a % p,b >>= 1)\n if(b & 1)\n ans = ans * a % p;\n return ans;\n}\nll ncr(ll n,ll m,ll p)\n{\n if(m > n)\n return 0;\n ll up=1,down=1;\n for(int i=n-m+1;i 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='A' && ch<='Z') return(ch-'A');\n else if(ch>='0' && ch<='9') return (ch-'0');\n else if(ch>='a' && ch<='z') return (ch-'a');\n else return 0;\n}\nll CEIL(ll x,ll y)\n{\n if(x%y==0) return(x/y);\n else return(x/y +1);\n}\n \nll FLOOR(ll x,ll y)\n{\n if(x%y==0) return(x/y);\n else return(x/y -1);\n}"}, {"source_code": "#include \n#define MOD 998244353\n\n__int64 Pow(__int64 a, __int64 b)\n{\n if (b == 0) return 1;\n\tif (b % 2 > 0) return (Pow(a, b - 1) * a) % MOD;\n\t__int64 half = Pow(a, b / 2) % MOD;\n\treturn (half * half) % MOD;\n}\n__int64 nCr(__int64 n, __int64 r)\n{\n __int64 A = 1; // A = n!, B = (n-r)!r!\n __int64 B = 1;\n __int64 ans;\n __int64 i;\n\n for(i=1;i<=n;i++)\n {\n A *= i;\n A %= MOD;\n }\n for(i=1;i<=n-r;i++)\n {\n B *= i;\n B %= MOD;\n }\n for(i=1;i<=r;i++)\n {\n B *= i;\n B %= MOD;\n }\n __int64 B2 = Pow(B, MOD-2);\n ans = (A * B2) % MOD;\n return ans;\n}\n\nint main(void)\n{\n __int64 size, max;\n __int64 ans;\n\n scanf(\"%lld %lld\", &size, &max);\n \n ans = nCr(max, size - 1) * (size-2) % MOD;\n ans = (ans * Pow(2, size-3)) % MOD;\n printf(\"%lld\\n\", ans);\n\n \n return 0;\n}"}, {"source_code": "#include \n#define MOD 998244353\n\n__int64 Pow(__int64 a, __int64 b)\n{\n __int64 half;\n if(b == 0) return 1;\n if(b % 2 == 1) return (Pow(a, b-1)*a) % MOD;\n half = Pow(a, b/2) % MOD;\n return (half * half) % MOD;\n}\n__int64 nCr(__int64 n, __int64 r)\n{\n __int64 A = 1; // A = n!, B = (n-r)!r!\n __int64 B = 1;\n __int64 ans;\n __int64 i;\n\n for(i=1;i<=n;i++)\n {\n A *= i;\n A %= MOD;\n }\n for(i=1;i<=n-r;i++)\n {\n B *= i;\n B %= MOD;\n }\n for(i=1;i<=r;i++)\n {\n B *= i;\n B %= MOD;\n }\n __int64 B2 = Pow(B, MOD-2);\n ans = (A * B2) % MOD;\n return ans;\n}\n\nint main(void)\n{\n __int64 size, max;\n __int64 ans;\n\n scanf(\"%lld %lld\", &size, &max);\n \n ans = nCr(max, size - 1) * (size-2) % MOD;\n ans = (ans * Pow(2, size-3)) % MOD;\n printf(\"%lld\\n\", ans);\n\n \n return 0;\n}"}, {"source_code": "#include \n\n#define M\t200000\n#define MD\t998244353\n\nint d_, x_, y_;\n\nvoid gcd_(int a, int b) {\n\tif (b == 0)\n\t\td_ = a, x_ = 1, y_ = 0;\n\telse {\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\nint inv(int a) {\n\tgcd_(a, MD);\n\treturn x_;\n}\n\nint p2[M * 2 + 1], ff[M * 2 + 1], gg[M * 2 + 1];\n\nvoid init() {\n\tint i, f;\n\n\tp2[0] = 1;\n\tfor (i = 1; i <= M * 2; i++)\n\t\tp2[i] = p2[i - 1] * 2 % MD;\n\tf = 1;\n\tfor (i = 0; i <= M * 2; i++) {\n\t\tgg[i] = inv(ff[i] = f);\n\t\tf = (long long) f * (i + 1) % MD;\n\t}\n}\n\nlong long choose(int n, int k) {\n\treturn k < 0 || k > n ? 0 : (long long) ff[n] * gg[k] % MD * gg[n - k] % MD;\n}\n\nint main() {\n\tint n, m, a, ans;\n\n\tinit();\n\tscanf(\"%d%d\", &n, &m);\n\tif (n == 2) {\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\tans = 0;\n\tfor (a = 2; a <= m; a++)\n\t\tans = (ans + (a - 1) * choose(a - 2, n - 3) % MD * p2[n - 3]) % MD;\n\tif (ans < 0)\n\t\tans += MD;\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nlong long power(long long x, long long y)\n{\n long long ret = 1;\n while(y > 0){\n if(y % 2){\n ret *= x;\n ret %= 998244353;\n }\n x *= x;\n x %= 998244353;\n y /= 2;\n }\n return ret;\n}\n\nint main()\n{\n int n, m;\n scanf(\"%d%d\", &n, &m);\n if(n == 2){\n printf(\"0\");\n return 0;\n }\n\n long long ans = power(2, n - 3);\n ans *= (n - 2);\n ans %= 998244353;\n for(int i = 1; i <= m; i++){\n ans *= i;\n ans %= 998244353;\n }\n\n long long t = 1;\n for(int i = 1; i <= n - 1; i++){\n t *= i;\n t %= 998244353;\n }\n for(int i = 1; i <= m - n + 1; i++){\n t *= i;\n t %= 998244353;\n }\n t = power(t, 998244351);\n\n ans *= t;\n ans %= 998244353;\n printf(\"%lld\", ans);\n\n return 0;\n}\n"}, {"source_code": "#include\nconst int m = 998244353;\n\nint power( int x, int y ) {\n\tint a = 1;\n\tfor( ; y>0; y>>=1, x=1ll*x*x %m )\n\t\tif( y&1 )\n\t\t\ta = 1ll*a*x %m;\n\treturn a;\n}\n\nint fact( int n ) {\n\tint f = 1;\n\tfor( int i=2; i<=n; ++i )\n\t\tf = 1ll*f*i %m;\n\treturn f;\n}\n\nint main() {\n\tint N, M;\n\tscanf(\"%d%d\", &N, &M);\n\tif( N == 2 ) { printf(\"0\\n\", M); return 0; }\n\tint ans = 1ll*(N-2)*power(2, N-3) %m;\n\tans = 1ll*ans*fact(M) %m;\n\tans = 1ll*ans*power(fact(M-N+1), m-2) %m;\n\tans = 1ll*ans*power(fact(N-1), m-2) %m;\n\tprintf(\"%d\\n\", ans);\n\n}"}], "negative_code": [{"source_code": "#include \n#define MOD 998244353\n\n__int64 Pow(__int64 a, __int64 b)\n{\n __int64 ans=1;\n int i;\n for(i=0;i\n#define MOD 998244353\n\n__int64 Pow(__int64 a, __int64 b)\n{\n __int64 ans=1;\n int i;\n for(i=0;i\n#define MOD 998244353\n\n__int64 Pow(__int64 a, __int64 b)\n{\n __int64 ans=1;\n __int64 i;\n if (b == 0) return 1;\n for(i=0;i\nconst int m = 998244353;\n\nint power( int x, int y ) {\n\tint a = 1;\n\tfor( ; y>0; y>>=1, x=1ll*x*x %m )\n\t\tif( y&1 )\n\t\t\ta = 1ll*a*x %m;\n\treturn a;\n}\n\nint fact( int n ) {\n\tint f = 1;\n\tfor( int i=2; i<=n; ++i )\n\t\tf = 1ll*f*i %m;\n\treturn f;\n}\n\nint main() {\n\tint N, M;\n\tscanf(\"%d%d\", &N, &M);\n\tif( N == 2 ) { printf(\"%d\\n\", M); return 0; }\n\tint ans = 1ll*(N-2)*power(2, N-3) %m;\n\tans = 1ll*ans*fact(M) %m;\n\tans = 1ll*ans*power(fact(M-N+1), m-2) %m;\n\tans = 1ll*ans*power(fact(N-1), m-2) %m;\n\tprintf(\"%d\\n\", ans);\n\n}"}], "src_uid": "28d6fc8973a3e0076a21c2ea490dfdba"} {"nl": {"description": "You are given the current time in 24-hour format hh:mm. Find and print the time after a minutes.Note that you should find only the time after a minutes, see the examples to clarify the problem statement.You can read more about 24-hour format here https://en.wikipedia.org/wiki/24-hour_clock.", "input_spec": "The first line contains the current time in the format hh:mm (0 ≤ hh < 24, 0 ≤ mm < 60). The hours and the minutes are given with two digits (the hours or the minutes less than 10 are given with the leading zeroes). The second line contains integer a (0 ≤ a ≤ 104) — the number of the minutes passed.", "output_spec": "The only line should contain the time after a minutes in the format described in the input. Note that you should print exactly two digits for the hours and the minutes (add leading zeroes to the numbers if needed). See the examples to check the input/output format.", "sample_inputs": ["23:59\n10", "20:20\n121", "10:10\n0"], "sample_outputs": ["00:09", "22:21", "10:10"], "notes": null}, "positive_code": [{"source_code": "#include\nint main()\n{\n\nint a,i; int h,m;\nscanf(\"%d:%d\",&h,&m);\nscanf(\"%d\",&a);\nfor(i=1;i<=a;i++)\n{\n if((m+1)>=60)\n {\n m=(m+1)%60;\n if((h+1)>=24)\n {\n h=(h+1)%24;\n }\n else\n h=h+1;\n }\n else\n m=m+1;\n}\n\n\nif(h==0||m==0)\n{\n if(h==0 && m==0)\n printf(\"00:00\");\n else if(h==0)\n {\n if(m<10)\n printf(\"00:0%d\",m);\n else\n printf(\"00:%d\",m);\n\n }\n\n else if(m==0)\n {\n if(h<10)\n printf(\"0%d:00\",h);\n else\n printf(\"%d:00\",h);\n }\n\n}\nelse if(h<10 || m<10)\n{\n if(h<10 && m<10)\n printf(\"0%d:0%d\",h,m);\n else if(h<10)\n {\n\n printf(\"0%d:%d\",h,m);\n\n }\n\n else if(m<10)\n {\n printf(\"%d:0%d\",h,m);\n }\n}\nelse\n printf(\"%d:%d\",h,m);\n\n\nreturn 0;\n}\n"}, {"source_code": "#include \nint main(){int n,h,m;scanf(\"%d:%d %d\",&h,&m,&n);m+=h*60+n;printf(\"%.2d:%.2d\",(m/60)%24,m%60);}\n"}, {"source_code": "#include \n\nint main() {\n int a, b, c, d;\n scanf(\"%d:%d\", &a, &b);\n printf(\"\\n\");\n scanf(\"%d\", &c);\n d = a * 60 + b + c;\n a = d / 60;\n b = d % 60;\n while(a > 23) {\n a -= 24;\n } if((a < 10) && (b < 10)) {\n printf(\"0%d:0%d\", a, b);\n return 0;\n } if((a < 10) || (b < 10)) {\n if(a < 10) {\n printf(\"0%d:%d\", a, b);\n return 0;\n } if(b < 10) {\n printf(\"%d:0%d\", a, b);\n return 0;\n }\n }\n printf(\"%d:%d\", a, b);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,c,i,j,k,n;\n char x;\n scanf(\"%d%c%d%d\",&a,&x,&b,&n);\n j=b+n;\n i=j/60;\n b=j%60;\n a=a+i;\n a=a%24;\n if(a<10)\n printf(\"0%d\",a);\n else\n printf(\"%d\",a);\n if(b<10)\n printf(\":0%d\",b);\n else\n printf(\":%d\",b);\n\n\n}\n\n"}, {"source_code": "#include \nint main(){\nint hh,mm,a;\nscanf(\"%d:%d\",&hh,&mm);\nscanf(\"%d\",&a);\n\nmm=mm+a%60;\nif(mm>59){\n mm=mm%60;\n hh+=1;\n}\nhh=hh+a/60;\nif (hh>23){\n hh=hh%24;\n}\nprintf(\"%02d:%02d\",hh,mm);\n\nreturn 0;\n}"}, {"source_code": "#include \nint main(h,m,n){scanf(\"%d:%d %d\",&h,&m,&n);m+=h*60+n;printf(\"%.2d:%.2d\",(m/60)%24,m%60);}\n"}, {"source_code": "#include \n\nint main(void){\n\tint H, M, min;\n\tscanf(\"%d:%d\", &H, &M);\n\tscanf(\"%d\", &min);\n\tH = (H+(M+min)/60)%24;\n\tM = (M+min)%60;\n\tprintf(\"%02d:%02d\", H, M);\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\n/* run this program using the console pauser or add your own getch, system(\"pause\") or input loop */\nchar c;\nint h,m,n,a,b;\nint main(int argc, char *argv[]) {\n\tscanf(\"%d%c%d%d\",&h,&c,&m,&n);\n\ta=n/60;\n\tn%=60;\n\th+=a;\n\tm+=n;\n\tif(m>=60)\n\t{h++;m%=60;}\n\th%=24;\n\tif(h>=10&&m>=10)printf(\"%d:%d\\n\",h,m);\n\tif(h<10&&m>=10)printf(\"0%d:%d\\n\",h,m);\n\tif(h>=10&&m<10)printf(\"%d:0%d\\n\",h,m);\n\tif(h<10&&m<10)printf(\"0%d:0%d\\n\",h,m);\n\treturn 0;\n}"}, {"source_code": "#include\nint main () {\n\tint a,b,c;\n\tscanf(\"%d:%d\",&a,&b);\n\tscanf(\"%d\",&c);\n\tif(b+c>=60)\n\t\ta=a+(b+c)/60;\n\t\tb=(b+c)%60;\n\tif(a>24)\n\t\ta=a%24;\n\telse if(a==24)\n\t\ta=0;\n\tif(a==0 && b==0){\n\t\tprintf(\"00:00\");\n\t\treturn 0;}\n\tif(a<10 && b<10){\n\t\tprintf(\"0%d:0%d\",a,b);\n\t\treturn 0;}\n\t\telse if(a<10){\n\t\t\t\t\t printf(\"0%d:%d\",a,b);\n\t\treturn 0;}\n\t\telse if(b<10){\n\t\t\tprintf(\"%d:0%d\",a,b);\n\t\t\treturn 0;}\n\n\t\n\tprintf(\"%d:%d\",a,b);\n\t}\n\n\n"}, {"source_code": "/* Coached by rainboy */\n#include \n\nint main() {\n\tstatic char s[8];\n\tint h, m, a;\n\n\tscanf(\"%s%d\", s, &a);\n\th = (s[0] - '0') * 10 + (s[1] - '0'), m = (s[3] - '0') * 10 + (s[4] - '0');\n\tm += a, h += m / 60;\n\tm %= 60;\n\th %= 24;\n\tprintf(\"%02d:%02d\\n\", h, m);\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n long long int hh,mm,a,carry,p,q,hh1,mm1;\n char m;\n scanf(\"%I64d\",&hh);\n scanf(\" %c\",&m);\n scanf(\"%I64d\",&mm);\n scanf(\"%I64d\",&a);\n p=a%60;\n p+=mm;\n mm1=p%60;\n carry=p/60;\n q=a/60;\n q+=hh;\n hh1=(q%24)+carry;\n if(hh1==24)\n hh1=0;\n if(hh1<10&&mm1<10)\n printf(\"0%I64d:0%I64d\",hh1,mm1);\n else if(hh1<10&&mm1>=10)\n printf(\"0%I64d:%I64d\",hh1,mm1);\n else if(hh1>=10&&mm1<10)\n printf(\"%I64d:0%I64d\",hh1,mm1);\n else\n printf(\"%I64d:%I64d\",hh1,mm1);\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nmain()\n{\n\tint h,m,n,i,j;\n\tchar s[6];\n\tscanf(\"%s %d\",s,&n);\n\th=(s[0]-'0')*10+(s[1]-'0');\n\tm=(s[3]-'0')*10+(s[4]-'0');\n\ti=n%60;\n\tj=n/60;\n\tm+=i;\n\tif(m>59){\n\t\tm-=60;\n\t\tj++;\n\t}\n\th+=j;\n\tif(h>23) h%=24;\n\ts[0]='0'+(h/10);\n\ts[1]='0'+(h%10);\n\ts[3]='0'+(m/10);\n\ts[4]='0'+(m%10);\n\tprintf(\"%s\",s);\n}\n"}, {"source_code": "#include\n\nint main(){\n int h,m; scanf(\"%d:%d\", &h, &m);\n int a; scanf(\"%d\", &a);\n m += a;\n while( m > 59 ) { m -= 60; h += 1; }\n while(h > 23) h -= 24;\n if(m < 10 && h >9) printf(\"%d:0%d\\n\", h, m);\n else if(h < 10 && m > 9) printf(\"0%d:%d\\n\", h, m);\n else if(m < 10 && h < 10) printf(\"0%d:0%d\\n\", h, m);\n else printf(\"%d:%d\\n\", h, m);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nvoid afficher(int);\nint main()\n{\n int h,m,t ;\n scanf(\"%d:%d \\n %d\" ,&h,&m ,&t);\n m+=t;\n h+=(m)/60 ;\n h%=24;\n m%=60;\n\n afficher(h);\n printf(\":\");\n afficher(m);\n}\n\nvoid afficher(int t)\n{\n if (t<10)\n printf(\"0%d\",t);\n else\n printf(\"%d\",t);\n}\n"}, {"source_code": "#include \n\nint main() {\n int h = 0;\n int m = 0;\n char c = 0;\n scanf(\"%d%c%d\", &h, &c, &m);\n int num = 0;\n scanf(\"%d\", &num);\n int all = h * 60 + m + num;\n h = (all / 60);\n m = (all - h * 60);\n h = h % 24;\n if (h < 10) {\n printf(\"0%d:\", h);\n }\n else {\n printf(\"%d:\", h);\n }\n if (m < 10) {\n printf(\"0%d\", m);\n }\n else {\n printf(\"%d\", m);\n }\n return 0;\n}"}, {"source_code": "#include \nvoid ajoutminute(int *hh,int *mm,int a){\nint s=(*hh)*60+ (*mm);\ns=s+a;\n*hh=s/60;\n*mm=(s%60);\nif (*hh>23)\n (*hh)=(*hh)%24;\n}\n\nint main(){\n int mm, hh, a;\n scanf(\"%d:%d \",&hh,&mm);\n scanf(\"%d\",&a);\n ajoutminute(&hh,&mm,a);\n \nif(mm<=9 && hh<=9)\n \tprintf(\"0%d:0%d\",hh,mm);\nelse if(mm>9 && hh>9)\n\tprintf(\"%d:%d\",hh,mm);\nelse if(mm>9 && hh<=9)\n\tprintf(\"0%d:%d\",hh,mm);\nelse \n\tprintf(\"%d:0%d\",hh,mm);\n \nreturn 0;} "}, {"source_code": "#include \n#include \n\nint main() {\n\tchar a[4];\n\tint b[2];\n\tint z = 0, x = 0;\n\tb[0] = 0; b[1] = 0;\n\tchar c[1];\n\tchar d[1];\n\tscanf(\"%s\", &a);\n\tc[1] = a[0];\n\td[1] = a[1];\n\tb[1] = 10 * atoi(c) + atoi(d);\n\tc[1] = a[3];\n\td[1] = a[4];\n\tb[2] = 10 * atoi(c) + atoi(d);\n\t//printf(\" b[1] = %d; b[2] = %d\", b[1], b[2]);\n\tscanf(\"%d\", &z);\n\t/*if (z >= 60) {\n\t\tx = z / 60;\n\t\tz = z % 60;\n\t}\n\tif ((x % 24) == 0)\n\t\tx = x / 24 - 1;\n\tif (x + b[1] > 23) {\n\t\tb[1] = x - 23 - b[1];\n\t\twhile (b[1] > 23) b[1] -= 24;\n\t\tb[1]--;\n\t} else {\n\t\tb[1] += x;\n\t}\n\tif (z + b[2] > 59) {\n\t\tb[1]++;\n\t\tif (b[1] >=24) b[1] = 0;\n\t\tb[2] = z - 60 + b[2];\n\t} else {\n\t\tb[2] += z;\n\t}\n\tif ( (b[1] / 10 == 0) && (b[2] / 10 == 0) )\n\t\tprintf(\"0%d:0%d\", b[1],b[2]);\n\telse {\n\t\tif ((b[1] / 10 == 0) || (b[2] / 10 == 0)) {\n\t\t\tif (b[1] / 10 == 0)\n\t\t\t\tprintf(\"0%d:%d\",b[1],b[2]);\n\t\t\tif (b[2] / 10 == 0)\n\t\t\t\tprintf(\"%d:0%d\",b[1],b[2]);\n\t\t} else {printf(\"%d:%d\\n\", b[1], b[2]);}\n\t}\n\t*/\n\tb[1] = 60 * b[1];\n\tb[2] = b[1] + b[2] + z;\n\tb[1] = b[2] / 60;\n\tb[2] = b[2] % 60;\n while (b[1] > 23) b[1] -= 24;\n\n\tif (b[1] == 24) b[1] = 0;\n if ( (b[1] / 10 == 0) && (b[2] / 10 == 0) )\n printf(\"0%d:0%d\", b[1],b[2]);\n else {\n if ((b[1] / 10 == 0) || (b[2] / 10 == 0)) {\n if (b[1] / 10 == 0)\n printf(\"0%d:%d\",b[1],b[2]);\n if (b[2] / 10 == 0)\n printf(\"%d:0%d\",b[1],b[2]);\n } else {printf(\"%d:%d\\n\", b[1], b[2]);}\n }\n\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int hh,mm;\n char c;\n int a;\n scanf(\"%d %c %d\",&hh, &c,&mm);\n scanf(\"%d\",&a);\n mm=mm+a;\n if (mm>59){\n hh=(hh+mm/60)%24;\n mm=mm%60;\n }\n printf(\"%02d:%02d\",hh,mm);\n return 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n int hh,mm;\n scanf(\"%d:%d\",&hh,&mm);\n\n int a;\n scanf(\"%d\",&a);\n int hr,min;\n hr = a/60;\n for( ;hr>24; ) {\n hr = hr-24;\n }\n //printf(\"\\n\\nhr = %d\",hr);\n\n min = a%60;\n for( ;min>60; ) {\n min = min/60;\n }\n //printf(\"\\n\\nmin = %d\",min);\n\n int f_hr,f_m;\n f_hr = hh+hr;//printf(\"\\n\\nf_hr = %d\",f_hr);\n f_m = mm+min;//printf(\"\\n\\nf_m = %d\",f_m);\n\n if(f_m>59) {\n f_hr = f_hr+1;//printf(\"\\n\\nf_hr = %d\",f_hr);\n f_m = f_m-60;//printf(\"\\n\\nf_m = %d\\n\\n\",f_m);\n }\n\n if(f_hr>=24)\n f_hr = f_hr-24;\n if(f_hr<10 && f_m<10)\n printf(\"0%d:0%d\",f_hr,f_m);\n else if(f_hr<10 && f_m>=10)\n printf(\"0%d:%d\",f_hr,f_m);\n else if(f_hr>=10 && f_m<10)\n printf(\"%d:0%d\",f_hr,f_m);\n else\n printf(\"%d:%d\",f_hr,f_m);\n\n return 0;\n\n}\n"}, {"source_code": "main(h,m,n){scanf(\"%d:%d%d\",&h,&m,&n);m+=n+60*h;printf(\"%02d:%02d\",m/60%24,m%60);}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,c;\n while(scanf(\"%d:%d\\n%d\",&a,&b,&c)!=EOF)\n {\n int p=0,h=0,d=0,e=0;\n p=(a*60)+b+c;\n d=p/60;\n e=p%60;\n if(d<24)\n {\n h=d;\n }\n else\n {\n h=d%24;\n }\n printf(\"%02d:%02d\\n\",h,e);\n }\n\n\n return 0;\n}\n"}, {"source_code": "main(h,m,n){scanf(\"%d:%d%d\",&h,&m,&n);m+=n+60*h;printf(\"%02d:%02d\",m/60%24,m%60);}"}, {"source_code": "#include \nint hh,mm,a;\nint main(){\n\tscanf(\"%d:%d\",&hh,&mm);\n\tscanf(\"%d\",&a);\n\tmm=mm+a;\n\tif(mm>=60){\n hh=hh+(mm/60);\n\t\tmm=mm%60;\n\n\t }\n if(hh>=24){\n\t\thh=(hh%24);\n\t\t}\n printf(\"%02d:%02d\",hh,mm);\n\nreturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int hh,mm,hh1,mm1,a;\n char ch;\n scanf(\"%d\",&hh);\n scanf(\"%c\",&ch);\n scanf(\"%d\",&mm);\n scanf(\"%d\",&a);\n a=a%1440;\n hh1=hh+a/60;\n mm1=mm+a%60;\n if(mm1>=60){\n mm1=mm1-60;\n hh1=hh1+1;\n }\n if(hh1>=24)\n hh1=hh1-24;\n if(hh1<10){\n if(mm1<10)\n printf(\"0%d:0%d\\n\",hh1,mm1);\n else\n printf(\"0%d:%d\\n\",hh1,mm1);\n }\n else{\n if(mm1<10)\n printf(\"%d:0%d\\n\",hh1,mm1);\n else\n printf(\"%d:%d\\n\",hh1,mm1);\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int hh,mm;\n char c;\n int a;\n scanf(\"%d %c %d\",&hh, &c,&mm);\n scanf(\"%d\",&a);\n mm=mm+a;\n if (mm>59){\n hh=(hh+mm/60)%24;\n mm=mm%60;\n }\n printf(\"%02d:%02d\",hh,mm);\n return 0;\n}"}, {"source_code": "#include\nint main ()\n{\n int a,b,c,d,e,k,l,n;\n char jak;\n scanf(\"%d %c %d %d\",&a,&jak,&b,&c);\n d=c/60;\n e=c%60;\n k=b+e;\n if(k>=60)\n {\n k=k-60;\n a=a+1;\n }\n l=d+a;\n if(l>=24)\n {\n l=l%24;\n }\n if(l<10)\n {\n printf(\"0%d:\",l);\n }\n else\n {\n printf(\"%d:\",l);\n }\n if(k<10)\n {\n printf(\"0%d\",k);\n }\n else\n {\n printf(\"%d\",k);\n }\n}\n"}, {"source_code": "#include \nint main(){int n,h,m;scanf(\"%d:%d %d\",&h,&m,&n);m+=h*60+n;printf(\"%.2d:%.2d\",(m/60)%24,m%60);}\n"}, {"source_code": "#include\nmain()\n{\nint h,m,e,i,j,k;\nscanf(\"%d:%d\",&h,&m);\nscanf(\"%d\",&e);\n\ni=m+e;\nj=i/60;\nk=e%60;\n\nh=(h+j)%24;\nm=(m+k)%60;\n\nprintf(\"%02d:%02d\",h,m);\n\n\n}\n\n"}, {"source_code": "#include \nint main(){\nint hh,mm,a;\nscanf(\"%d:%d\",&hh,&mm);\nscanf(\"%d\",&a);\n\nmm=mm+a%60;\nif(mm>59){\n mm=mm%60;\n hh+=1;\n}\nhh=hh+a/60;\nif (hh>23){\n hh=hh%24;\n}\nprintf(\"%02d:%02d\",hh,mm);\n\n\n\n\nreturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n char a[10];\n int add,h,m,hour,min,temp;\n scanf(\"%s\",a);\n scanf(\"%d\",&add);\n //printf(\"%d %d %d %d\\n\",a[0]-48,a[1]-48,a[3]-48,a[4]-48);\n h=(10*(int)(a[0]-48))+(int)(a[1]-48);\n m=(10*(int)(a[3]-48))+(int)(a[4]-48);\n\n if(add==0)\n {\n printf(\"%s\",a);\n return 0;\n }\n\n //printf(\"h=%d m=%d\\n\",h,m);\n temp=(m+add)/60;\n //printf(\"adder in hours=%d\\n\",temp);\n min=(m+add)%60;\n hour=(h+temp)%24;\n\n //printf(\"hour=%d\\n\",hour);\n\n if(hour<10)\n printf(\"0%d:\",hour);\n else\n printf(\"%d:\",hour);\n if(min<10)\n printf(\"0%d\\n\",min);\n else\n printf(\"%d\\n\",min);\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int h,m,a;\n scanf(\"%d:%d\",&h,&m);\n scanf(\"%d\",&a);\n m+=a;\n h+=(m/60);\n m%=60;\n printf(\"%02d:%02d\\n\",h%24,m);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n char c;\n int h, min, addh, addm, finh;\n scanf(\"%d%c%d\", &h, &c, &min);\n int add;\n scanf(\"%d\", &add);\n addh=(min+add)/60;\n addm=(min+add)%60;\n // printf(\"%d\\n\", addm);\n finh=addh+h;\n if(finh>=24)\n {\n finh%=24;\n }\n printf(\"%02d:%02d\", finh, addm);\n return 0;\n}"}, {"source_code": "// The Time\n\n#include\n#include\nint main(void)\n{\n\tchar str[6];\n\tint a,i,arr_h[3],arr_m[3],hh,mm,x,y,time;\n\tscanf(\"%s\",str);\n\tchar str_h[3] = \"\",str_m[3] = \"\";\n\tscanf(\"%d\",&a);\n\tfor(i = 0;i<2;i++)\n\t{\n\t\tif(str[i]=='0')\n\t\t\tstrcat(str_h,\"0\");\n\t\telse if(str[i]=='1')\n\t\t\tstrcat(str_h,\"1\");\n\t\telse if(str[i]=='2')\n\t\t\tstrcat(str_h,\"2\");\n\t\telse if(str[i]=='3')\n\t\t\tstrcat(str_h,\"3\");\n\t\telse if(str[i]=='4')\n\t\t\tstrcat(str_h,\"4\");\n\t\telse if(str[i]=='5')\n\t\t\tstrcat(str_h,\"5\");\n\t\telse if(str[i]=='6')\n\t\t\tstrcat(str_h,\"6\");\n\t\telse if(str[i]=='7')\n\t\t\tstrcat(str_h,\"7\");\n\t\telse if(str[i]=='8')\n\t\t\tstrcat(str_h,\"8\");\n\t\telse if(str[i]=='9')\n\t\t\tstrcat(str_h,\"9\");\n\t}\n\n\tfor(i = 3;i<=4;i++)\n\t{\n\t\tif(str[i]=='0')\n\t\t\tstrcat(str_m,\"0\");\n\t\telse if(str[i]=='1')\n\t\t\tstrcat(str_m,\"1\");\n\t\telse if(str[i]=='2')\n\t\t\tstrcat(str_m,\"2\");\n\t\telse if(str[i]=='3')\n\t\t\tstrcat(str_m,\"3\");\n\t\telse if(str[i]=='4')\n\t\t\tstrcat(str_m,\"4\");\n\t\telse if(str[i]=='5')\n\t\t\tstrcat(str_m,\"5\");\n\t\telse if(str[i]=='6')\n\t\t\tstrcat(str_m,\"6\");\n\t\telse if(str[i]=='7')\n\t\t\tstrcat(str_m,\"7\");\n\t\telse if(str[i]=='8')\n\t\t\tstrcat(str_m,\"8\");\n\t\telse if(str[i]=='9')\n\t\t\tstrcat(str_m,\"9\");\t\n\t}\n\n\thh = 0;\n\tx = 10;\n\tfor(i = 0;i<2;i++)\n\t{\n\t\tif(str_h[i]=='0')\n\t\t\tarr_h[i] = 0;\n\t\telse if(str_h[i]=='1')\n\t\t\tarr_h[i] = 1;\n\t\telse if(str_h[i]=='2')\n\t\t\tarr_h[i] = 2;\n\t\telse if(str_h[i]=='3')\n\t\t\tarr_h[i] = 3;\n\t\telse if(str_h[i]=='4')\n\t\t\tarr_h[i] = 4;\n\t\telse if(str_h[i]=='5')\n\t\t\tarr_h[i] = 5;\n\t\telse if(str_h[i]=='6')\n\t\t\tarr_h[i] = 6;\n\t\telse if(str_h[i]=='7')\n\t\t\tarr_h[i] = 7;\n\t\telse if(str_h[i]=='8')\n\t\t\tarr_h[i] = 8;\n\t\telse if(str_h[i]=='9')\n\t\t\tarr_h[i] = 9;\n\n\t\thh += x*arr_h[i];\n\t\tx/=10;\n\t}\n\n\tmm = 0;\n\ty = 10;\n\tfor(i = 0;i<2;i++)\n\t{\n\t\tif(str_m[i]=='0')\n\t\t\tarr_m[i] = 0;\n\t\telse if(str_m[i]=='1')\n\t\t\tarr_m[i] = 1;\n\t\telse if(str_m[i]=='2')\n\t\t\tarr_m[i] = 2;\n\t\telse if(str_m[i]=='3')\n\t\t\tarr_m[i] = 3;\n\t\telse if(str_m[i]=='4')\n\t\t\tarr_m[i] = 4;\n\t\telse if(str_m[i]=='5')\n\t\t\tarr_m[i] = 5;\n\t\telse if(str_m[i]=='6')\n\t\t\tarr_m[i] = 6;\n\t\telse if(str_m[i]=='7')\n\t\t\tarr_m[i] = 7;\n\t\telse if(str_m[i]=='8')\n\t\t\tarr_m[i] = 8;\n\t\telse if(str_m[i]=='9')\n\t\t\tarr_m[i] = 9;\n\n\t\tmm += y*arr_m[i];\n\t\ty/=10;\n\t}\n\n\ttime = 60*hh+mm;\n\ttime = time+a;\n\t\n\ttime = time%1440;\n\n\thh = time/60;\n\t\n\tif(hh==24)\n\t\thh = 0;\n\t\n\tmm = time%60;\n\t\n\tif((hh>=0)&&(hh<=9))\n\t\tprintf(\"0%d:\",hh);\n\telse\n\t\tprintf(\"%d:\",hh);\n\t\n\tif((mm>=0)&&(mm<=9))\n\t\tprintf(\"0%d\",mm);\n\telse\n\t\tprintf(\"%d\",mm);\n\n\tprintf(\"\\n\");\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint main(){\nint m,h,a,s,r,x,y;\nchar c;\nscanf(\"%d %c %d\",&h,&c,&m);\nscanf(\"%d\",&a);\ns=a%60;\nr=a/60;\nh=h+r;\nm=m+s;\nx=m%60;\nh=h+(m/60);\ny=h%24;\nprintf(\"%02d:%02d\",y,x);\nreturn 0;\n}"}, {"source_code": "#include \n\nint main(void){\n\tint H, M, min;\n\tscanf(\"%d:%d\", &H, &M);\n\tscanf(\"%d\", &min);\n\tH = (H+(M+min)/60)%24;\n\tM = (M+min)%60;\n\tprintf(\"%02d:%02d\", H, M);\n\treturn 0;\n}"}, {"source_code": "#include \nint main(){\nint hh,mm,a;\nscanf(\"%d:%d\",&hh,&mm);\nscanf(\"%d\",&a);\n\nmm=mm+a%60;\nif(mm>59){\n mm=mm%60;\n hh+=1;\n}\nhh=hh+a/60;\nif (hh>23){\n hh=hh%24;\n}\nprintf(\"%02d:%02d\",hh,mm);\n\n\n\n\nreturn 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int h,m,n;\n scanf(\"%d:%d\\n%d\",&h,&m,&n);\n m=m+n;\n h=h+(m/60);\n m=m%60;\n for (h;h>=24;h=h-24);\n if (h/10==0 && m/10 !=0){printf(\"0%d:%d\",h,m);return 0;}\n if (h/10!=0 && m/10 ==0){printf(\"%d:0%d\",h,m);return 0;}\n if (h/10==0 && m/10 ==0){printf(\"0%d:0%d\",h,m);return 0;}\n printf(\"%d:%d\",h,m);\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\nint H , M , a , s ;\nchar c;\nscanf(\"%d %c %d\",&H,&c,&M);\nscanf(\"%d\",&a) ;\ns=H*60 + M + a ;\nH=(s/60)%24;\nM=s%60;\nprintf(\"%02d:%02d\",H,M);\nreturn 0 ;\n}"}, {"source_code": "#include\nint main()\n{\n\tint a,b,c;\n\tscanf(\"%d:%d\",&a,&b);\n\tscanf(\"%d\",&c);\n\tb=b+a*60+c;\n\tprintf(\"%0.2d:%0.2d\\n\",(b/60)%24,b%60);\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n long long int hh,mm,a,carry,p,q,hh1,mm1;\n char m;\n scanf(\"%I64d\",&hh);\n scanf(\" %c\",&m);\n scanf(\"%I64d\",&mm);\n scanf(\"%I64d\",&a);\n p=a%60;\n p+=mm;\n mm1=p%60;\n carry=p/60;\n q=a/60;\n q+=hh;\n hh1=(q%24)+carry;\n if(hh1==24)\n hh1=0;\n if(hh1<10&&mm1<10)\n printf(\"0%I64d:0%I64d\",hh1,mm1);\n else if(hh1<10&&mm1>=10)\n printf(\"0%I64d:%I64d\",hh1,mm1);\n else if(hh1>=10&&mm1<10)\n printf(\"%I64d:0%I64d\",hh1,mm1);\n else\n printf(\"%I64d:%I64d\",hh1,mm1);\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int h,m,a;\n scanf(\"%d:%d\",&h,&m);\n scanf(\"%d\",&a);\n m+=a;\n h+=(m/60);\n m%=60;\n printf(\"%02d:%02d\\n\",h%24,m);\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int h, m, a, h1, m1, sum, div, rem;\n char c;\n while(scanf(\"%d %c %d%d\", &h, &c, &m, &a)==4)\n {\n m1=m+a;\n if(m1>=60)\n {\n div = m1/60;\n rem = m1%60;\n m1 = rem;\n h1= h+div;\n\n }\n else\n {\n h1 = h;\n }\n while(h1>=24)\n {\n h1=h1-24;\n\n }\n if(h1==24)\n printf(\"%02d:%02d\\n\", h1-24, m1);\n else\n printf(\"%02d:%02d\\n\", h1, m1);\n\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int h,m,t,rem,div;\n scanf(\"%d:%d\",&h,&m);\n scanf(\"%d\",&t);\n rem=t%60;\n div=t/60;\n h=h+div;\n m=m+rem;\n if(m>59)\n {\n m=m%60;\n h=h+1;\n }\n h=h%24;\n if(h>=10&&m>=10)\n printf(\"%d:%d\",h,m);\n else if(h>=10&&m<10)\n printf(\"%d:0%d\",h,m);\n else if(h<10&&m<10)\n printf(\"0%d:0%d\",h,m);\n else if(h<10&&m>=10)\n printf(\"0%d:%d\",h,m);\n}\n"}, {"source_code": "#include \n#include \n\n\nint main()\n{\n\tchar achCurTime[10];\n\t\n\tint iCurHr;\n\tint iCurMin;\n\t\n\tint iPlusMin;\n\t\n\tint iNewMin;\n\tint iNewHr;\n\t\n\t\n\tscanf(\"%s\", achCurTime );\n\n\tachCurTime[2] = 0;\n\t\n\tsscanf( &achCurTime[0] , \"%d\", &iCurHr );\n\tsscanf( &achCurTime[3] , \"%d\", &iCurMin );\n\t\n\t\n\tscanf(\"%d\", &iPlusMin );\n\t\n\t\n\tiNewMin = iCurMin + iPlusMin;\n\t\n\tiNewHr = iNewMin / 60;\n\tiNewMin = iNewMin % 60;\n\t\n\tiNewHr += iCurHr;\n\t\n\tiNewHr %= 24;\n\t\n\tprintf(\"%02d:%02d\\n\",iNewHr , iNewMin );\t\n\t\n\n\n\treturn 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int h,m,a;\n scanf(\"%d:%d\",&h,&m);\n scanf(\"%d\",&a);\n int t=h*60+m+a;\n //printf(\"%d\",t);\n t%=1440;\n h=t/60;\n m=t%60;\n if(h<10)\n printf(\"0%d\",h);\n else\n printf(\"%d\",h);\n\n if(m<10)\n printf(\":0%d\",m);\n else\n printf(\":%d\",m);\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int hh,mm,a,m;\n char ch;\n scanf(\"%d%c%d\",&hh,&ch,&mm);\n scanf(\"%d\",&a);\n m=mm+a;\n if(m>59)\n {\n mm=m%60;\n hh=m/60+hh;\n m=mm;\n }\n while(hh>23)\n {\n hh=hh-24;\n }\n printf(\"%02d%c%02d\\n\",hh,ch,m);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint h,min,after,nh,nmin;\n\tscanf(\"%d:%d\",&h,&min);\n\tscanf(\"%d\",&after);\n\tnh=after/60;\n\tnmin=after%60;\n\th=h+nh;\n\tmin=min+nmin;\n\tif(min>=60)\n\t{\n\t\tmin=min-60;\n\t\th++;\n\t}\n\tif(h>=24)\n\th=h%24;\n\tprintf(\"%02d:%02d\",h,min);\n\t\n\t\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n int h,m,a,i,ans,hour,minute;\n scanf(\"%d:%d\",&h,&m);\n scanf(\"%d\",&a);\n m+=a;\n h+=m/60;\n m=m%60;\n printf(\"%02d:%02d\",h%24,m);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main () {\n int hh,mm;\n int a;\n int i,j,k;\n\n scanf(\"%d:%d\",&hh,&mm);\n scanf(\"%d\",&a);\n\n i = hh * 60 + mm;\n i+=a;\n if(i >= (24*60))\n i-=(i/(24*60))*(24*60);\n hh = i/60;\n mm = i - (hh * 60);\n if((hh<10)&&(mm>=10))\n printf(\"0%d:%d\",hh,mm);\n else if((hh<10)&&(mm<10))\n printf(\"0%d:0%d\",hh,mm);\n else if((hh>=10)&&(mm<10))\n printf(\"%d:0%d\",hh,mm);\n else\n printf(\"%d:%d\",hh,mm);\n return 0;\n}"}, {"source_code": "#include\nint main(){\n\tint k,h,m,a;\n\tscanf(\"%d:%d\",&h,&m);\n\tscanf(\"%d\",&a);\n\tk=a+m+(h*60);\n\th=(k/60)%24;\n\tm=(k-h*60)%60;\n\nif (h<10) \n\t\tif (m<10)\n\t\t\tprintf(\"0%d:0%d\",h,m);\n\t\telse \n\t\t\tprintf(\"0%d:%d\",h,m);\n\telse \n\t\tif (m<9)\n\t\t\tprintf(\"%d:0%d\",h,m);\n\t\telse \n\t\t\tprintf(\"%d:%d\",h,m);\nreturn 0;\n}"}, {"source_code": "#include \n#include \nint main()\n{\n int hh,mm,x;\n scanf (\"%d:%d %d\",&hh,&mm,&x);\n mm+=x;\n hh=(hh+mm/60)%24;\n mm%=60;\n printf(\"%d%d:%d%d\",hh/10,hh%10,mm/10,mm%10);\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\nint H , M , a , s ;\nchar c;\nscanf(\"%d %c %d\",&H,&c,&M);\nscanf(\"%d\",&a) ;\ns=H*60 + M + a ;\nH=(s/60)%24;\nM=s%60;\nprintf(\"%02d:%02d\",H,M);\nreturn 0 ;\n}\n\n\n\n\n\n"}, {"source_code": "#include \n#include \nint main(){\nint h,m,a;\nscanf(\"%d:%d %d\", &h, &m, &a);\na = a + h*60 + m;\nprintf(\"%.2d:%.2d\", a/60%24, a%60);\nreturn 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n\tint h, m, a;\n\n\tscanf(\"%d:%d\", &h, &m);\n\tscanf(\"%d\", &a);\n\n\tm += a;\n\tif (m > 59) {\n\t\th += m/60;\n\t\th %= 24;\n\n\t\tm %= 60;\n\t}\n\n\tprintf(\"%02d:%02d\\n\", h, m);\n\n\treturn 0;\n}"}, {"source_code": "#include\nint main(){\n char s[10];\n scanf(\"%s /n\",&s);\n int a , mi , h , m ;\n scanf(\"%d\",&a);\n mi=((s[0]-'0')*10 + (s[1]-'0'))*60 + ((s[3]-'0')*10 + (s[4]-'0')) + a;\n h=(mi/60)%24;\n m=mi%60;\n if(h<10){\n printf(\"0\");\n printf(\"%d\",h);\n }\n else\n printf(\"%d\",h);\n printf(\":\");\n if(m<10){\n printf(\"0\");\n printf(\"%d\",m);\n }\n else\n printf(\"%d\",m);\n return 0;\n\n }\n\n\n"}, {"source_code": "#include\n\nint main()\n{\n long long int hh,mm,a,carry,p,q,hh1,mm1;\n char m;\n scanf(\"%I64d\",&hh);\n scanf(\" %c\",&m);\n scanf(\"%I64d\",&mm);\n scanf(\"%I64d\",&a);\n p=a%60;\n p+=mm;\n mm1=p%60;\n carry=p/60;\n q=a/60;\n q+=hh;\n hh1=(q%24)+carry;\n if(hh1==24)\n hh1=0;\n if(hh1<10&&mm1<10)\n printf(\"0%I64d:0%I64d\",hh1,mm1);\n else if(hh1<10&&mm1>=10)\n printf(\"0%I64d:%I64d\",hh1,mm1);\n else if(hh1>=10&&mm1<10)\n printf(\"%I64d:0%I64d\",hh1,mm1);\n else\n printf(\"%I64d:%I64d\",hh1,mm1);\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n\tint hh, mm, a;\n\n\tscanf(\"%d:%d\", &hh, &mm);\n\tscanf(\"%d\", &a);\n\tmm += a;\n\tif (mm >= 60) {\n\t\tint min = mm / 60;\n\n\t\tmm %= 60;\n\t\thh += min;\n\t\tif (hh >= 24)\n\t\t\thh %= 24;\n\t}\n\tprintf(\"%02d:%02d\\n\", hh, mm);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int h,m;\n char o;\n int mm;\n scanf(\"%d%c%d\",&h,&o,&m);\n scanf(\"%d\",&mm);\n int cnt=0;\n for(int i=0;i<200;i++)\n {\n if(mm-60>0)\n {\n mm=mm-60;\n cnt++;\n continue;\n }\n else \n break;\n }\n //printf(\"%d\\n\",mm);\n if(m+mm>=60)\n {\n cnt++;\n m=m+mm-60;\n }\n else\n m=m+mm;\n //printf(\"%d\",cnt);\n h=h+cnt;\n if(h>24)\n {\n for(int i=0;i<1000;i++)\n {\n if(h-24>24)\n {\n h=h-24;\n continue;\n }\n else\n {\n h=h-24;\n break;\n }\n }\n }\n //printf(\"%d\\n\",h);\n if(h==24)\n {\n printf(\"00:\");\n }\n else\n {\n if(h<10)\n printf(\"0\");\n \n printf(\"%d:\",h);\n }\n if(m<10)\n printf(\"0\");\n printf(\"%d\",m);\n \n \n return 0;\n}"}, {"source_code": "#include\nmain()\n{\n\tint hh,mm,t1,t2,t,m,h;\n\tscanf(\"%d:%d\",&hh,&mm);\n\tscanf(\"%d\",&t2);\n\tt1=(hh*60)+mm;\n\tt=t1+t2;\n\tt=t%1440;\n\th=t/60;\n\tm=t%60;\n\tprintf(\"%02d:%02d\",h,m);\n\t\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint a,b,c;\n\tscanf(\"%d:%d\",&a,&b);\n\tscanf(\"%d\",&c);\n\tb=b+a*60+c;\n\tprintf(\"%0.2d:%0.2d\\n\",(b/60)%24,b%60);\n\treturn 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int mod1, mod2, m, m1, m2, h1;\n char ch;\n\n scanf(\"%d %c %d %d\", &h1, &ch, &m1, &m2);\n\n if (m2 < 60) {\n m1 += m2;\n }\n else {\n mod1 = m2 / 60;\n m2 = m2 % 60;\n m1 += m2;\n h1 += mod1;\n }\n\n if (m1 >= 60) {\n mod2 = m1 / 60;\n m1 = m1 % 60;\n h1 += mod2;\n }\n\n if (h1 >= 24) {\n h1 = h1 % 24;\n }\n\n if (h1 < 10) printf(\"0%d%c\", h1, ch);\n else printf(\"%d%c\", h1, ch);\n\n if (m1 < 10) printf(\"0%d\\n\", m1);\n else printf(\"%d\\n\", m1);\n\n return 0;\n}\n"}, {"source_code": "#include\nmain()\n{\n\t\nint a,b;\nchar c;\nscanf(\"%d%c%d\",&a,&c,&b);\nint num;\nscanf(\"%d\",&num);\n\nb+=num;\nint tmp=b/60;\nb%=60;\na+=tmp;\na%=24;\nprintf(\"%02d%c%02d\",a,c,b);\n}"}, {"source_code": "#include \n#include \n#include \n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint main(){\n int i, j, k, h, m;\n while (scanf(\"%d:%d\", &h, &m) != EOF){\n scanf(\"%d\", &k);\n int t = ((h * 60) + m + k) % (24 * 60);\n printf(\"%02d:%02d\\n\", t / 60, t % 60);\n }\n return 0;\n}\n"}, {"source_code": "#include \nint main(){\n\tint hh,mm,a,b,q,reste,c;\n\tscanf(\"%d:%d\",&hh,&mm);\n\tscanf(\"%d\",&a);\n\tb=mm+a;\n\tif(b<60)\n\t { printf(\"%02d:%02d\",hh,b);}\n\telse {\n\t\t reste=b%60;\n\t\t q=b/60;\n\t\t c=hh+q;\n\t\t if (c<24)\n\t\t printf(\"%02d:%02d\",q+hh,reste);\n\t\t else {\n\t\t\t printf(\"%02d:%02d\",c%24,reste); \n\t\t\t }\n\t\t}\n\treturn 0;}"}, {"source_code": "#include\n\nint main(){\n int h,m; scanf(\"%d:%d\", &h, &m);\n int a; scanf(\"%d\", &a);\n m += a;\n while( m > 59 ) { m -= 60; h += 1; }\n while(h > 23) h -= 24;\n if(m < 10 && h >9) printf(\"%d:0%d\\n\", h, m);\n else if(h < 10 && m > 9) printf(\"0%d:%d\\n\", h, m);\n else if(m < 10 && h < 10) printf(\"0%d:0%d\\n\", h, m);\n else printf(\"%d:%d\\n\", h, m);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main(){\n int h,m; scanf(\"%d:%d\", &h, &m);\n int a; scanf(\"%d\", &a);\n m += a;\n while( m > 59 ) { m -= 60; h += 1; }\n while(h > 23) h -= 24;\n if(m < 10 && h >9) printf(\"%d:0%d\\n\", h, m);\n else if(h < 10 && m > 9) printf(\"0%d:%d\\n\", h, m);\n else if(m < 10 && h < 10) printf(\"0%d:0%d\\n\", h, m);\n else printf(\"%d:%d\\n\", h, m);\n return 0;\n}\n"}, {"source_code": "#include\nint main(int argc, char const *argv[])\n{\n\tlong long hr, min, next;\n\tscanf(\"%lld:%lld %lld\",&hr,&min,&next);\n\tnext = hr*60 + next + min;\n\tprintf(\"%.2lld:%.2lld\\n\", (next/60)%24 , next%60);\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main(){\n int h,m,a,hc,mc,d=1;\n scanf(\"%d:%d\",&h,&m);\n scanf(\"%d\",&a);\n hc=a/60;\n mc=a-hc*60;\n if(m+mc<60) m+=mc;\n else {m+=mc-60;\n h++;\n }\n while(h+hc>=24*d) d++;\n if(h+hc<24) h+=hc;\n else if(h+hc>=24) h+=hc-24*(d-1);\n if(h<10 && m<10) printf(\"0%d:0%d\\n\",h,m);\n if(h<10 && m>=10) printf(\"0%d:%d\\n\",h,m);\n if(h>=10 && m<10) printf(\"%d:0%d\\n\",h,m);\n if(h>=10 && m>=10) printf(\"%d:%d\\n\",h,m);\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n\tchar string[10];\n\tscanf(\"%s\", string);\n\tint i;\n\tint hours=(string[0]-'0')*10+string[1]-'0';\n\tint minutes=(string[3]-'0')*10+string[4]-'0';\n//\tprintf(\"%d %d\\n\",hours,minutes );\n\tint n;\n\tscanf(\"%d\", &n);\n\tif(n==60)\n\t{\n\t\tif(hours!=23)\n\t\t\thours++;\n\t\telse\n\t\t\thours=00;\n\t}\n\telse\n\t{\n\t\tint hrs=n/60;\n\t\tint mins=n-hrs*60;\n\n\t\tfor(i=1;i<=mins;i++)\n\t\t{\n\t\t\tif(minutes<59)\n\t\t\t\tminutes++;\n\t\t\telse if(minutes==59)\n\t\t\t\t{\n\t\t\t\t\tif(hours!=23)\n\t\t\t\thours++;\n\t\t\telse\n\t\t\t\thours=0;\n\t\t\t\t\tminutes=0;\n\t\t\t\t}\n\t\t}\n\t\tfor(i=1;i<=hrs;i++)\n\t\t{\n\t\t\tif(hours!=23)\n\t\t\t\thours++;\n\t\t\telse\n\t\t\t\thours=0;\n\t\t}\n\n\t}\n\tif(hours<10)\n\t{\n\t\tprintf(\"0\");\n\t\tprintf(\"%d\", hours);\n\t}\t\n\telse\n\t\tprintf(\"%d\", hours);\n\tprintf(\":\");\n\tif(minutes<10)\n\t\t{\n\t\t\tprintf(\"0\");\n\t\t\tprintf(\"%d\", minutes);\n\t\t}\n\telse\n\t\tprintf(\"%d\", minutes);\n\treturn 0;\n\n}"}, {"source_code": "#include \n#include \nint main()\n{\n char time[6];\n int hr,min,h,m,a;\n scanf(\"%s\",time);\n sscanf(time,\"%d:%d\",&hr,&min);\n scanf(\"%d\",&a);\n // printf(\"%d %d\",hr,min);\n h=a/60;\n m=a%60;\n if((min+m)>=60)\n {\n min=min+m-60;\n h++;\n }\n else\n min=min+m;\n hr=(hr+h)%24;\n printf(\"%02d:%02d\",hr,min);\n return 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n unsigned int h,m,a;\n char ch;\n\n scanf(\"%d%c%d\",&h,&ch,&m);\n scanf(\"%d\", &a);\n m+=a;\n if(m%60>=0)\n {\n h+=m/60;\n m=m%60;\n printf(\"%02d:%02d\\n\", h%24, m);\n }\n else\n {\n m+=a;\n printf(\"%02d:%02d\\n\", h%24, m);\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include\nint main ()\n{\n\tchar c;\nint m,a,d,h,r;\n\nscanf(\"%d%c%d \", &h,&c ,&m);\nscanf(\"%d\",&a);\nr=a%60;\nd=a/60;\nif (r+m<60)\n{\n\tm=m+r;\n\tif (h+d<24)\n\t\n\t\th=(h+d);\n\t\telse\n\t\t h=(h+d)%24;\n\t }\n\t else\n\t {\n\t\t m=(m+r)-60;\n\t\t if(h+d+1<24)\n\t\t h=h+d+1;\n\t\t else\n\t\t h=(h+d+1)%24;\n\t }\nprintf(\"%02d:%02d\",h,m);\nreturn 0 ;\n}"}, {"source_code": "#include\nint main()\n{\n char s;\n unsigned int a,c,d;\n scanf(\"%d%c%d\",&c,&s,&d);\n int hour=0,min=0,i,b=0;\n hour = hour + c;\n min=min + d ;\n /*char s[2];\n int hour[2],min[2],b=0,c=0,i; unsigned int a;\n for(i=0;i<)*/\n scanf(\"%u\",&a);\n while(a--)\n {\n min++;\n if(min==60)\n {\n hour++; min=0;\n if(hour==24)\n {\n hour=0;\n }\n }\n }\n if(hour<=9) printf(\"0%d:\",hour);\n else printf(\"%d:\",hour);\n if(min<=9) printf(\"0%d\\n\",min);\n else printf(\"%d\\n\",min);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(){\n\n int H = 24;\n int M = 60;\n\n int h, m, a; scanf(\"%ld:%ld\\n%ld\", &h, &m, &a);\n\n m += a;\n h += m / M;\n m %= M;\n h %= H;\n \n printf(\"%02ld:%02ld\\n\", h, m);\n\n return 0;\n}"}, {"source_code": "#include \n\nint main () \n{ char c;\n\tint h,m,a,d,r ;\n\tscanf(\"%d%c%d\",&h,&c,&m);\n\tscanf(\"%d\",&a);\n\tr=a%60;\n\td=a/60;\n\tif (r+m<60)\n\t { m=m+r;\n\t if (h+d<24)\n\t h=h+d;\n\t else\n\t h=(h+d)%24;}\n\t \n\telse\n\t { m=(m+r)-60 ;\n\t \n\t if (h+d+1<24)\n\t h=h+d+1;\n\t else\n\t h=(h+d+1)%24;}\n\t \n printf(\"%02d:%02d\",h,m );\n return 0 ;\n}\n"}, {"source_code": "#include\n\nmain()\n{\n int hh,mm,in,h,m;\n\n\n scanf(\"%d:%d\",&hh,&mm);\n scanf(\"%d\",&in);\n h = in/60;\n m = in%60;\n hh = hh+h;\n mm = mm+m;\n if(mm>=60)\n {\n hh+=1;\n mm = mm%60;\n }\n if(hh>=24)\n {\n hh = hh%24;\n }\n printf(\"%02d:%02d\\n\",hh,mm);\n\n\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n\tint k,h,m,a;\n\tscanf(\"%d:%d\",&h,&m);\n\tscanf(\"%d\",&a);\n\tk=a+m+(h*60);\n\th=(k/60)%24;\n\tm=(k-h*60)%60;\n\nif (h<10) \n\t\tif (m<10)\n\t\t\tprintf(\"0%d:0%d\",h,m);\n\t\telse \n\t\t\tprintf(\"0%d:%d\",h,m);\n\telse \n\t\tif (m<9)\n\t\t\tprintf(\"%d:0%d\",h,m);\n\t\telse \n\t\t\tprintf(\"%d:%d\",h,m);\nreturn 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n\tint hh, mm, a, ans_h, ans_m;\n\tscanf(\"%d:%d\", &hh, &mm);\n\tscanf(\"%d\", &a);\n\tans_m = (mm+a)%60;\n\tans_h = (hh + ((mm+a)/60))%24;\n\tprintf(\"%.2d:%.2d\\n\", ans_h, ans_m);\n\treturn 0;\n}\n"}, {"source_code": "#include \nint main(){\n\tint hh,mm,a,d,r;\n\tchar c;\n\tscanf(\"%d%c%d\",&hh,&c,&mm);\n\tscanf(\"%d\", &a);\n\tr=a%60;\n\td=a/60;\n\tif (r+mm<60\t)\n\t\t{mm=mm+r ;\n\t\tif (hh+d<24)\n\t\t\thh=hh+d ;\n\t\t\telse \n\t\t\t\thh=(hh+d)%24;}\n\telse {\n\t\tmm=(mm+r)-60 ;\n\t\tif (hh+d+1<24)\n\t\t\thh=hh+d+1;\n\t\telse \n\t\t hh=(hh+d+1)%24 ;}\t\n\t\t\n\tprintf(\"%02d:%02d\", hh,mm);\t\t\n\treturn(0);\t\n\t\t}"}, {"source_code": "#include \n\nmain(){\n char time[6]; int a;\n scanf (\"%[^\\n]%*c\", time);\n scanf (\"%d\",&a);\n int b=time[0]-48;\n int c=time[1]-48;\n int atimeh=b*10 + c;\n \n int d=time[3]-48;\n int e=time[4]-48;\n int atimem=d*10+e;\n \n int hours= a/60;\n int mins= a%60;\n \n int ahours= hours%24;\n \n int result1= ((atimeh+ahours) + ((atimem+mins)/60))%24; \n int result2= (atimem+mins)%60;\n if (result1<10 && result2<10)\n printf(\"0%d:0%d\",result1,result2);\n \n else if (result1<10 && result2>=10)\n printf(\"0%d:%d\",result1,result2);\n \n else if (result1>=10 && result2<10)\n printf(\"%d:0%d\",result1,result2);\n \n else\n printf(\"%d:%d\",result1,result2);\n \n \n \n \n \n \n \n \n \n \n \n \n}"}, {"source_code": "#include\n#include\n#include\n#define pi acos(-1.0)\n\nint min(int a,int b){int x=a>b?b:a; return x;}\nint max(int a,int b){int x=a>b?a:b; return x;}\nint digit(int x)\n{\n\tint count=0;\n\twhile(x!=0)\n\t{\n\t\tx=x/10;\n\t\tcount++;\n\t}\n\treturn count;\n}\nint gcd(int a,int b)\n{\n\tint i,GCD;\n\tfor(i=1;i<=a&&i<=b;i++)\n\t{\n\t\tif(a%i==0&&b%i==0)\n\t\tGCD=i;\n\t}\n\treturn GCD;\n}\nint lcm(int a,int b){int LCM=(a*b)/gcd(a,b); return LCM;}\nint main()\n{\n\tint h,m,s,am,ah;\n\tscanf(\"%d:%d\",&h,&m);\n\tscanf(\"%d\",&s);\n\tah=s/60;\n\tam=s-(ah*60);\n\tint mi=am+m;\n\tif(mi>=60)\n\t{\n\t\tah++;\n\t\tmi=mi-60;\n\t}\n\tint ho=(ah+h)%24;\n\tif(ho<10)\n\tprintf(\"0%d\",ho);\n\telse\n\tprintf(\"%d\",ho);\n\tif(mi<10)\n\tprintf(\":0%d\",mi);\n\telse\n\tprintf(\":%d\",mi);\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int hh,mm,hh1,mm1,a;\n char ch;\n scanf(\"%d\",&hh);\n scanf(\"%c\",&ch);\n scanf(\"%d\",&mm);\n scanf(\"%d\",&a);\n a=a%1440;\n hh1=hh+a/60;\n mm1=mm+a%60;\n if(mm1>=60){\n mm1=mm1-60;\n hh1=hh1+1;\n }\n if(hh1>=24)\n hh1=hh1-24;\n if(hh1<10){\n if(mm1<10)\n printf(\"0%d:0%d\\n\",hh1,mm1);\n else\n printf(\"0%d:%d\\n\",hh1,mm1);\n }\n else{\n if(mm1<10)\n printf(\"%d:0%d\\n\",hh1,mm1);\n else\n printf(\"%d:%d\\n\",hh1,mm1);\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n\tchar a[6];\n\tint q,w,e,r,ad;\n\tscanf(\"%s\",a);\n\tq=a[0]-48;\n\tw=a[1]-48;\n\te=a[3]-48;\n\tr=a[4]-48;\n\tq=q*10+w;\n\te=e*10+r;\n\tscanf(\"%d\",&ad);\n\tad=ad-(ad/1440)*1440;\n//\tprintf(\"%d %d\\n\",q,e);\n\tif(e+ad > 59)\n\t{\n\t q=q+(e+ad)/60;\n\t e=e+ad-60*((e+ad)/60);\n\t if(q>23)\n\t\t q=q-24;\n\t}\n\telse\n\t{\n\t\te=e+ad;\n\t}\n\tif(q<10)\n\t\tprintf(\"0%d\",q);\n\telse\n\t\tprintf(\"%d\",q);\n\tprintf(\":\");\n\tif(e<10)\n\t\tprintf(\"0%d\",e);\n\telse\n\t\tprintf(\"%d\",e);\n\tprintf(\"\\n\");\n\treturn 0;\n}\n\n\n\n\n\n"}, {"source_code": "#include \n\nint main() {\n\tint hour, min , dop;\n\tscanf(\"%d:%d %d\",&hour, &min, &dop);\n\tmin+= hour*60+dop;\n\tprintf(\"%.2d:%.2d\",(min / 60) % 24, min % 60);\n\treturn 0 ;\n}"}, {"source_code": "main(h,m,n){scanf(\"%d:%d%d\",&h,&m,&n);m+=n+60*h;printf(\"%02d:%02d\",m/60%24,m%60);}"}, {"source_code": "#include \nint main(){\nint hh,mm,a;\nscanf(\"%d:%d\",&hh,&mm);\nscanf(\"%d\",&a);\n\nmm=mm+a%60;\nif(mm>59){\n mm=mm%60;\n hh+=1;\n}\nhh=hh+a/60;\nif (hh>23){\n hh=hh%24;\n}\nprintf(\"%02d:%02d\",hh,mm);\n\nreturn 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int h,m,n;\n scanf(\"%d:%d\\n%d\",&h,&m,&n);\n m=m+n;\n h=h+(m/60);\n m=m%60;\n for (h;h>=24;h=h-24);\n if (h/10==0 && m/10 !=0){printf(\"0%d:%d\",h,m);return 0;}\n if (h/10!=0 && m/10 ==0){printf(\"%d:0%d\",h,m);return 0;}\n if (h/10==0 && m/10 ==0){printf(\"0%d:0%d\",h,m);return 0;}\n printf(\"%d:%d\",h,m);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include\n\nint main()\n{\n\n int h,m;\n scanf(\"%d:%d\",&h,&m);\n int a;\n scanf(\"%d\",&a);\n\n h=(h+(m+a)/60)%24;\n m=(m+a)%60;\n\n printf(\"%0.2d:%0.2d\",h,m);\n\n return(0);\n}\n"}, {"source_code": "#include \nint a,b;\nlong long n;\nint main()\n{\n\tscanf(\"%d:%d\",&a,&b);\n\tscanf(\"%I64d\",&n);\n\tb+=n;\n\ta+=b/60;\n\tb%=60;\n a%=24;\n if(a<10)printf(\"0%d:\",a);\n else printf(\"%d:\",a);\n if(b<10)printf(\"0%d\",b);\n else printf(\"%d\",b);\n return 0;\n \n}\n"}, {"source_code": "int main(){\n int h,m,a;\n char c;\n scanf(\"%d%c%d\",&h,&c,&m);\n scanf(\"%d\",&a);\n \n int h1 = a/60;\n int h2 = h1%24;\n int m1 = a%60;\n \n int hf = h+h2;\n int mf = m+m1;\n \n //printf(\"%d:%d\\n\",hf,mf);\n \n if(mf>59){\n hf++;\n mf = mf -60;\n }\n \n if(hf>23)\n hf = hf - 24;\n \n if(hf>=10 && mf>=10)\n printf(\"%d:%d\\n\",hf,mf);\n if(hf<10 && mf>=10)\n printf(\"0%d:%d\\n\",hf,mf);\n if(hf>=10 && mf<10)\n printf(\"%d:0%d\\n\",hf,mf);\n if(hf<10 && mf<10)\n printf(\"0%d:0%d\\n\",hf,mf);\n \n \n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int hh,mm,a;\n scanf(\"%d:%d\",&hh,&mm);\n scanf(\"%d\",&a);\n int seconds=60*mm+3600*hh+a*60;\n seconds%=86400;\n hh=seconds/3600;\n seconds%=3600;\n mm=seconds/60;\n printf(\"%02d:%02d\",hh,mm);\n return 0;\n}"}, {"source_code": "#include\nint main(){\nint i,j,k,l,h,m,a;\nscanf(\"%d:%d\",&h,&m);\nscanf(\"%d\",&a);\ni=a/60;\nj=h+i;\nk=a-(60*i);\nl=m+k;\nif(l>=60){\nj=j+1;\nl=l-60;\n if(j>=24){\n while(j>=24){\n j=j-24;\n }\nif(j<10){\nprintf(\"0%d:\",j);\n}\nelse{\nprintf(\"%d:\",j);\n}\nif(l<10){\nprintf(\"0%d\",l);\n}\nelse{\nprintf(\"%d\",l);\n}\n }\n else {\n if(j<10){\nprintf(\"0%d:\",j);\n}\nelse{\nprintf(\"%d:\",j);\n}\nif(l<10){\nprintf(\"0%d\",l);\n}\nelse{\nprintf(\"%d\",l);\n}\n }\n}\nelse{\n if(j>=24){\n while(j>=24){\n j=j-24;\n }\nif(j<10){\nprintf(\"0%d:\",j);\n}\nelse{\nprintf(\"%d:\",j);\n}\nif(l<10){\nprintf(\"0%d\",l);\n}\nelse{\nprintf(\"%d\",l);\n}\n }\n else {\n if(j<10){\nprintf(\"0%d:\",j);\n}\nelse{\nprintf(\"%d:\",j);\n}\nif(l<10){\nprintf(\"0%d\",l);\n}\nelse{\nprintf(\"%d\",l);\n}\n }\n\n\n}\n}\n"}, {"source_code": "#include \nint main(){\n\tint hh,mm,a,d,r;\n\tchar c;\n\tscanf(\"%d%c%d\",&hh,&c,&mm);\n\tscanf(\"%d\", &a);\n\tr=a%60;\n\td=a/60;\n\tif (r+mm<60\t)\n\t\t{mm=mm+r ;\n\t\tif (hh+d<24)\n\t\t\thh=hh+d ;\n\t\t\telse \n\t\t\t\thh=(hh+d)%24;}\n\telse {\n\t\tmm=(mm+r)-60 ;\n\t\tif (hh+d+1<24)\n\t\t\thh=hh+d+1;\n\t\telse \n\t\t hh=(hh+d+1)%24 ;}\t\n\t\t\n\tprintf(\"%02d:%02d\", hh,mm);\t\t\n\treturn(0);\t\n\t\t}"}, {"source_code": "#include \nint main(){\nint n,h,m;\nscanf(\"%d:%d %d\",&h,&m,&n);\nm+=h*60+n;\nprintf(\"%.2d:%.2d\",(m/60)%24,m%60);\n}"}, {"source_code": "#include\nint hh, mm, a, p;\n\n\nint main()\n{\n\tscanf(\"%d:%d %d\", &hh, &mm, &a);\n\t\n\tp = hh * 60 + mm + a;\n\tmm = p % 60;\n\thh = p / 60;\n\tif (hh>23){\n\t hh = hh % 24;\n\t}\n\tprintf(\"%02d:%02d\", hh, mm);\n\t\n\treturn 0;\n}\n"}, {"source_code": "// The Time\n\n#include\n#include\nint main(void)\n{\n\tchar str[6];\n\tint a,i,arr_h[3],arr_m[3],hh,mm,x,y,time;\n\tscanf(\"%s\",str);\n\tchar str_h[3] = \"\",str_m[3] = \"\";\n\tscanf(\"%d\",&a);\n\tfor(i = 0;i<2;i++)\n\t{\n\t\tif(str[i]=='0')\n\t\t\tstrcat(str_h,\"0\");\n\t\telse if(str[i]=='1')\n\t\t\tstrcat(str_h,\"1\");\n\t\telse if(str[i]=='2')\n\t\t\tstrcat(str_h,\"2\");\n\t\telse if(str[i]=='3')\n\t\t\tstrcat(str_h,\"3\");\n\t\telse if(str[i]=='4')\n\t\t\tstrcat(str_h,\"4\");\n\t\telse if(str[i]=='5')\n\t\t\tstrcat(str_h,\"5\");\n\t\telse if(str[i]=='6')\n\t\t\tstrcat(str_h,\"6\");\n\t\telse if(str[i]=='7')\n\t\t\tstrcat(str_h,\"7\");\n\t\telse if(str[i]=='8')\n\t\t\tstrcat(str_h,\"8\");\n\t\telse if(str[i]=='9')\n\t\t\tstrcat(str_h,\"9\");\n\t}\n\n\tfor(i = 3;i<=4;i++)\n\t{\n\t\tif(str[i]=='0')\n\t\t\tstrcat(str_m,\"0\");\n\t\telse if(str[i]=='1')\n\t\t\tstrcat(str_m,\"1\");\n\t\telse if(str[i]=='2')\n\t\t\tstrcat(str_m,\"2\");\n\t\telse if(str[i]=='3')\n\t\t\tstrcat(str_m,\"3\");\n\t\telse if(str[i]=='4')\n\t\t\tstrcat(str_m,\"4\");\n\t\telse if(str[i]=='5')\n\t\t\tstrcat(str_m,\"5\");\n\t\telse if(str[i]=='6')\n\t\t\tstrcat(str_m,\"6\");\n\t\telse if(str[i]=='7')\n\t\t\tstrcat(str_m,\"7\");\n\t\telse if(str[i]=='8')\n\t\t\tstrcat(str_m,\"8\");\n\t\telse if(str[i]=='9')\n\t\t\tstrcat(str_m,\"9\");\t\n\t}\n\n\thh = 0;\n\tx = 10;\n\tfor(i = 0;i<2;i++)\n\t{\n\t\tif(str_h[i]=='0')\n\t\t\tarr_h[i] = 0;\n\t\telse if(str_h[i]=='1')\n\t\t\tarr_h[i] = 1;\n\t\telse if(str_h[i]=='2')\n\t\t\tarr_h[i] = 2;\n\t\telse if(str_h[i]=='3')\n\t\t\tarr_h[i] = 3;\n\t\telse if(str_h[i]=='4')\n\t\t\tarr_h[i] = 4;\n\t\telse if(str_h[i]=='5')\n\t\t\tarr_h[i] = 5;\n\t\telse if(str_h[i]=='6')\n\t\t\tarr_h[i] = 6;\n\t\telse if(str_h[i]=='7')\n\t\t\tarr_h[i] = 7;\n\t\telse if(str_h[i]=='8')\n\t\t\tarr_h[i] = 8;\n\t\telse if(str_h[i]=='9')\n\t\t\tarr_h[i] = 9;\n\n\t\thh += x*arr_h[i];\n\t\tx/=10;\n\t}\n\n\tmm = 0;\n\ty = 10;\n\tfor(i = 0;i<2;i++)\n\t{\n\t\tif(str_m[i]=='0')\n\t\t\tarr_m[i] = 0;\n\t\telse if(str_m[i]=='1')\n\t\t\tarr_m[i] = 1;\n\t\telse if(str_m[i]=='2')\n\t\t\tarr_m[i] = 2;\n\t\telse if(str_m[i]=='3')\n\t\t\tarr_m[i] = 3;\n\t\telse if(str_m[i]=='4')\n\t\t\tarr_m[i] = 4;\n\t\telse if(str_m[i]=='5')\n\t\t\tarr_m[i] = 5;\n\t\telse if(str_m[i]=='6')\n\t\t\tarr_m[i] = 6;\n\t\telse if(str_m[i]=='7')\n\t\t\tarr_m[i] = 7;\n\t\telse if(str_m[i]=='8')\n\t\t\tarr_m[i] = 8;\n\t\telse if(str_m[i]=='9')\n\t\t\tarr_m[i] = 9;\n\n\t\tmm += y*arr_m[i];\n\t\ty/=10;\n\t}\n\n\ttime = 60*hh+mm;\n\ttime = time+a;\n\t\n\ttime = time%1440;\n\n\thh = time/60;\n\t\n\tif(hh==24)\n\t\thh = 0;\n\t\n\tmm = time%60;\n\t\n\tif((hh>=0)&&(hh<=9))\n\t\tprintf(\"0%d:\",hh);\n\telse\n\t\tprintf(\"%d:\",hh);\n\t\n\tif((mm>=0)&&(mm<=9))\n\t\tprintf(\"0%d\",mm);\n\telse\n\t\tprintf(\"%d\",mm);\n\n\tprintf(\"\\n\");\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\nint h,m;\nchar ch;\nscanf(\"%d%c%d\",&h,&ch,&m);\nint a;\nscanf(\"%d\",&a);\nh=h+a/60; m=m+a%60;\nfor(;h>=24 || m>=60;){\nif(m>=60){ m=m-60; h=h+1;}\nif(h>23) h=h-24;\n}\nif(m<10 && h>=10)printf(\"%d%c0%d\",h,ch,m);\nelse if (m<10 && h<10) printf(\"0%d%c0%d\",h,ch,m);\nelse if (m>=10 && h<10) printf(\"0%d%c%d\",h,ch,m);\nelse printf(\"%d%c%d\",h,ch,m);\nreturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int h,m,a,i,ans,hour,minute;\n scanf(\"%d:%d\",&h,&m);\n scanf(\"%d\",&a);\n m+=a;\n h+=m/60;\n m=m%60;\n printf(\"%02d:%02d\",h%24,m);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n\nint main()\n{\n int hh,mm;\n int a;\n scanf(\"%d:%d%d\",&hh,&mm,&a);\n mm+=a%60;\n if(mm>=60) {hh+=1;mm%=60;}\n hh+=(a/60);\n if(hh>=24) hh%=24;\n printf(\"%02d:%02d\\n\",hh,mm);\n return 0;\n}\n"}, {"source_code": "#include \nint main(h,m,n){scanf(\"%d:%d %d\",&h,&m,&n);m+=h*60+n;printf(\"%.2d:%.2d\",(m/60)%24,m%60);}\n"}], "negative_code": [{"source_code": "#include\n\nmain()\n{\n int hh,mm,in,h,m;\n\n\n scanf(\"%d:%d\",&hh,&mm);\n scanf(\"%d\",&in);\n h = in/60;\n m = in%60;\n hh = hh+h;\n mm = mm+m;\n if(mm>=60)\n {\n hh+=1;\n mm = mm-60;\n }\n if(hh>=24)\n {\n hh = hh-24;\n }\n printf(\"%02d:%02d\\n\",hh,mm);\n\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint h,m,a;\n\tscanf(\"%d:%d\",&h,&m);\n\tscanf(\"%d\",&a);\n\n\tm+=a%60;\n\tif(m>=60)\n\t{\n\t\tm=m-60;\n\t\th+=1;\n\t}\n\th+=(a/60)%24;\n\tif(h>=24)\n\t\th=24-h;\n\tprintf(\"%02d:%02d\\n\",h,m);\n\treturn 0;\n}"}, {"source_code": "#include \nint hh, mm, a;\nint main(int argc, char **argv)\n{\n scanf(\"%d:%d\", &hh, &mm);\n scanf(\" %d\", &a);\n \n for(int i=0;i10||a==10)\n printf(\"0%d:%d\",hh,mm);\n else if(hh<10&&mm>=10&&a<10)\n printf(\"0%d:%d\",hh,mm);\n else if(hh>=10&&mm<10&&a<10)\n printf(\"%d:0%d\",hh,mm);\n else if(hh<10&&mm<10&&a<10)\n printf(\"0%d:0%d\",hh,mm);\n else\n printf(\"0%d:0%d\",hh,mm);\n }\n else\n printf(\"%d:%d\\n\",hh,mm);\n}\n"}, {"source_code": "#include \n#include \n#include \nint main()\n{\n\t\t\n\t\tint a;\n\t\tint k,l,m,n;\n\t\tscanf(\"%d%d:\",&k,&l);\n\t\tscanf(\"%d%d\\n\",&m,&n);\n\t\tscanf(\"%d\",&a);\n\t\t\n\t\t\n\t\tint x;\n\t\tx=a/60;\n\t\tint y;\n\t\ty=(10*k+l+x)%24;\n\t\tif(y<10)\n\t\t{\n\t\t\tk=0;\n\t\t\tl=y;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t\tl=y%10;\n\t\t\t\tk=y/10;\n\t\t\t}\n\t\tint z;\n\t\tz=a-60*x;\n\t\tint b=10*k+l;\n\t\tb+=(10*m+n+z)/60;\n\t\tif(b>=24)\n\t\t{l=b%24;\n\t\t\tk=0;}\n\t\t\telse{\n\t\t\t\tk=k;\n\t\t\t\tl=l;\n\t\t\t}\n\t\tint c;\n\t\tc=(10*m+n+z)%60;\n\t\tif(c<10)\n\t\t{\n\t\t\tn=c;\n\t\t\tm=0;\n\t\t}\n\t\telse {\n\t\t\t\n\t\t\t\t\tn=(c)%10;\n\t\t\t\t\tm=(c)/10;\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\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\t\n\t\t\t\n\t\t\t\n\t\tprintf(\"%d%d:%d%d\",k,l,m,n);\n\t\treturn 0;\n}\n"}, {"source_code": "#include\nint main(){\nint H , M , a , s ;\nchar c;\nscanf(\"%d %c %d\",&H,&c,&M);\nscanf(\"%d\",&a) ;\ns=H*60 + M + a ;\nH=(s/60)%24;\nM=(s/24)%60;\nprintf(\"%02d:%02d\",H,M);\nreturn 0 ;\n}"}, {"source_code": "#include\nint main(){\nint H , M , a , s ;\nchar c;\nscanf(\"%d %c %d\",&H,&c,&M);\nscanf(\"%d\",&a) ;\ns=H*60 + M + a ;\nH=(s/60)%24;\nM=(s/24)%60;\nprintf(\"%02d:%02d\",H,M);\nreturn 0 ;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int m,h,a;\n scanf(\"%d:%d\",&h,&m);\n scanf(\"%d\",&a);\n if(\n a%60 ==0){\n h=h+(a/60);\n }\n if( a%60 !=0){\n m=m+(a%60);\n h=h+(a/60);\n }\n if((m>60)){\n h=h+(m/60);\n m=(m%60);\n }\n if((h>=24)){\n h=h-24;\n }\n printf(\"%02d:%02d\",h,m);\n return 0;\n}"}, {"source_code": "#include \nvoid ajoutminute(int *mm,int *hh,int a){\nif(*mm+a>=60){\n\tif(*hh==23){\n\t\t*hh=0;\n\t\t*mm=-60+*mm+a;}\n\telse{\n\t\t*hh++;\n\t\t*mm=-60+*mm+a;}\n\t}\nelse\n\t*mm=*mm+a;\n\n}\n\nint main(){\n int mm, hh, a;\n scanf(\"%d:%d \",&hh,&mm);\n scanf(\"%d\",&a);\n ajoutminute(&mm,&hh,a);\n if(mm<=9 && hh<=9)\n \tprintf(\"0%d:0%d\",hh,mm);\nelse if(mm>9 && hh>9)\n\tprintf(\"%d:%d\",hh,mm);\nelse if(mm>9 && hh<=9)\n\tprintf(\"0%d:%d\",hh,mm);\nelse \n\tprintf(\"%d:0%d\",hh,mm);\n \nreturn 0;} "}, {"source_code": "#include \nint hh, mm, a;\nint main(int argc, char **argv)\n{\n scanf(\"%d:%d\", &hh, &mm);\n scanf(\" %d\", &a);\n \n for(int i=0;i\nint a,b;\nlong long n;\nint main()\n{\n\tscanf(\"%d:%d\",&a,&b);\n\tscanf(\"%I64d\",&n);\n\tb+=n;\n\twhile(b>=60)\n\t{\n\t b-=60;\n\t a++;\n }\n if(a>=24&&b!=0)a-=24;\n if(a<10&&b<10)printf(\"0%d:0%d\",a,b);\n else if(a<10&&b>=10)printf(\"0%d:%d\",a,b);\n else if(a>10&&b<10)printf(\"%d:0%d\",a,b);\n else printf(\"%d:%d\",a,b);\n}\n"}, {"source_code": "#include \nint main()\n{\n int mod1, mod2, m, m1, m2, h1;\n char ch;\n\n scanf(\"%d %c %d %d\", &h1, &ch, &m1, &m2);\n\n if (m2 < 60) {\n m1 += m2;\n }\n else {\n mod1 = m2 / 60;\n m2 = m2 % 60;\n m1 += m2;\n h1 += mod1;\n }\n\n if (m1 >= 60) {\n mod2 = m1 / 60;\n m1 = m1 % 60;\n h1 += mod2;\n }\n\n if (h1 >= 24) h1 -= 24;\n\n if (h1 < 10) printf(\"0%d%c\", h1, ch);\n else printf(\"%d%c\", h1, ch);\n\n if (m1 < 10) printf(\"0%d\\n\", m1);\n else printf(\"%d\\n\", m1);\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main() {\n\tchar a[4];\n\tint b[2];\n\tint z = 0, x = 0;\n\tb[0] = 0; b[1] = 0;\n\tchar c[1];\n\tchar d[1];\n\tscanf(\"%s\", &a);\n\tc[1] = a[0];\n\td[1] = a[1];\n\tb[1] = 10 * atoi(c) + atoi(d);\n\tc[1] = a[3];\n\td[1] = a[4];\n\tb[2] = 10 * atoi(c) + atoi(d);\n\t//printf(\" b[1] = %d; b[2] = %d\", b[1], b[2]);\n\tscanf(\"%d\", &z);\n\tif (z >= 60) {\n\t\tx = z / 60;\n\t\tz = z % 60;\n\t}\n\tif ((x % 24) == 0)\n\t\tx = x / 24 - 1;\n\tif (x + b[1] > 23) {\n\t\tb[1] = x - 23 - b[1];\n\t\twhile (b[1] > 23) b[1] -= 24;\n\t\tb[1]--;\n\t} else {\n\t\tb[1] += x;\n\t}\n\tif (z + b[2] > 59) {\n\t\tb[1]++;\n\t\tif (b[1] >=24) b[1] = 0;\n\t\tb[2] = z - 60 + b[2];\n\t} else {\n\t\tb[2] += z;\n\t}\n\tif ( (b[1] / 10 == 0) && (b[2] / 10 == 0) )\n\t\tprintf(\"0%d:0%d\", b[1],b[2]);\n\telse {\n\t\tif ((b[1] / 10 == 0) || (b[2] / 10 == 0)) {\n\t\t\tif (b[1] / 10 == 0)\n\t\t\t\tprintf(\"0%d:%d\",b[1],b[2]);\n\t\t\tif (b[2] / 10 == 0)\n\t\t\t\tprintf(\"%d:0%d\",b[1],b[2]);\n\t\t} else {printf(\"%d:%d\\n\", b[1], b[2]);}\n\t}\n\t\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tchar time[6];\n\tint min,hh,mm,m,l;\n\tscanf(\"%s\",time);\n\tscanf(\"%d\",&min);\n\thh=(time[0]-'1'+1)*10+(time[1]-'1'+1);\n\tmm=(time[3]-'1'+1)*10+(time[4]-'1'+1);\n//printf(\"%d %d\",hh,mm);\n\tl=min/60;\n\tm=min-60*l;\n\tmm=mm+m;\n\thh=hh+l;\n\tif(mm>=60)\n\t{\n\t\thh++;\n\t\tmm=mm-60;\n\t}\n\t//else\n\t//\tmm=mm+min;\n\tif(hh>=24)\n\t\thh=hh-24;\n\tif(hh<=9&&mm<=9)\n\t{\n\t\tprintf(\"0%d:0%d\\n\",hh,mm);\n\t}\n\telse if(hh<=9&&mm>9)\n\t\tprintf(\"0%d:%d\\n\",hh,mm);\n\telse if(hh>9&&mm<=9)\n\t\tprintf(\"%d:0%d\\n\",hh,mm);\n\telse\n\t\tprintf(\"%d:%d\\n\",hh,mm);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int h,m,t,rem,div;\n scanf(\"%d:%d\",&h,&m);\n scanf(\"%d\",&t);\n rem=t%60;\n div=t/60;\n h=h+div;\n m=m+rem;\n if(m>59)\n {\n m=m%60;\n h=h+1;\n }\n h=h%24;\n if(h>=10&&m>=10)\n printf(\"%d : %d\",h,m);\n else if(h>=10&&m<10)\n printf(\"%d : 0%d\",h,m);\n else if(h<10&&m<10)\n printf(\"0%d : 0%d\",h,m);\n else if(h<10&&m>=10)\n printf(\"0%d : %d\",h,m);\n}\n"}, {"source_code": "#include\n\nint main () {\n int hh,mm;\n int a;\n int i,j,k;\n\n scanf(\"%d:%d\",&hh,&mm);\n scanf(\"%d\",&a);\n\n i = hh * 60 + mm;\n i+=a;\n if(i >= (24*60))\n i-=(24*60);\n hh = i/60;\n mm = i - (hh * 60);\n if((hh<10)&&(mm>10))\n printf(\"0%d:%d\",hh,mm);\n else if((hh<10)&&(mm<10))\n printf(\"0%d:0%d\",hh,mm);\n else if((hh>10)&&(mm<10))\n printf(\"%d:0%d\",hh,mm);\n else\n printf(\"%d:%d\",hh,mm);\n return 0;\n}"}, {"source_code": "#include\n\nint main () {\n int hh,mm;\n int a;\n int i,j,k;\n\n scanf(\"%d:%d\",&hh,&mm);\n scanf(\"%d\",&a);\n\n i = hh * 60 + mm;\n i+=a;\n if(i >= (24*60))\n i-=(i/(24*60))*(24*60);\n hh = i/60;\n mm = i - (hh * 60);\n if((hh<10)&&(mm>10))\n printf(\"0%d:%d\",hh,mm);\n else if((hh<10)&&(mm<10))\n printf(\"0%d:0%d\",hh,mm);\n else if((hh>10)&&(mm<10))\n printf(\"%d:0%d\",hh,mm);\n else\n printf(\"%d:%d\",hh,mm);\n return 0;\n}"}, {"source_code": "#include\nmain()\n{\n\t\nint a,b;\n\nscanf(\"%d%d\",&a,&b);\nint num;\nscanf(\"%d\",&num);\n\nb+=num;\nint tmp=b/60;\nb%=60;\na+=tmp;\na%=24;\nprintf(\"%02d:%02d\",a,b);\n}"}, {"source_code": "#include \nvoid ajoutminute(int *mm,int *hh,int a){\nif(*mm+a>=60){\n\tif(*hh==23){\n\t\tint d=a/60;\n\t\tint r=a%60;\n\t\t*hh=d;\n\t\t*mm=r-1;}\n\telse{\n\t\tint d=a/60;\n\t\tint r=a%60;\n\t\t*hh=*hh+d;\n\t\t*mm=*mm+r;}\n\t}\nelse\n\t*mm=*mm+a;\n}\n\nint main(){\n int mm, hh, a;\n scanf(\"%d:%d \",&hh,&mm);\n scanf(\"%d\",&a);\n ajoutminute(&mm,&hh,a);\n if(mm<=9 && hh<=9)\n \tprintf(\"0%d:0%d\",hh,mm);\nelse if(mm>9 && hh>9)\n\tprintf(\"%d:%d\",hh,mm);\nelse if(mm>9 && hh<=9)\n\tprintf(\"0%d:%d\",hh,mm);\nelse \n\tprintf(\"%d:0%d\",hh,mm);\n \nreturn 0;} "}, {"source_code": "#include \n#include \nvoid horloge(int*heure , int*minute,int a ){\nif (*minute+a<60)\n *minute=*minute+a;\n\nelse\n {*minute=(*minute+a)-(60*((*minute+a)/60)) ;\n if (*heure<23)\n *heure=*heure+((*minute+a)/60);\n else\n *heure=00;\n\n}\n}\nint main()\n{\n int a, heure,minute ;\n scanf(\"%d : %d\",&heure,&minute);\n scanf(\"%d\",&a);\n horloge(&heure,&minute,a);\n printf(\"%02d:%02d\",heure,minute);\n return 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n char g;\n int a,b,c,d,e,f;\n scanf(\"%d%c%d\",&a,&g,&b);\n scanf(\"%d\",&c);\n d=a*60+b+c;\n e=d/60;\n f=d%60;\n if(e>=24)\n e=e-24;\n if(e<10 && f<10)\n printf(\"0%d:0%d\",e,f);\n\n else if(e<10 && f>10)\n printf(\"0%d:%d\",e,f);\n else if(e>10 && f<10)\n printf(\"%d:0%d\",e,f);\n else if(e>10 && f>10)\n printf(\"%d:%d\",e,f);\n\n}\n"}, {"source_code": "#include \n\nint main() {\n\tint h, m, a;\n\n\tscanf(\"%d:%d\", &h, &m);\n\tscanf(\"%d\", &a);\n\n\tm += a;\n\tif (m >= 60) {\n\t\tm %= 60;\n\t\th += 1;\n\n\t\tif (h >= 24) h %= 24;\n\t}\n\n\tprintf(\"%02d:%02d\\n\", h, m);\n\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main() {\n\tchar times[5];\n\tint hours, mine;\n\tint new_mine;\n\n\tscanf(\"%s\", times);\n\tscanf(\"%d\", &new_mine);\n\tsscanf(times, \"%d:%d\", &hours, &mine);\n\n\n\tif (hours > 25 || hours < 0)\n\t{\n\t\tprintf(\"ошибка\\n\"); \n\t}\n\tif (mine > 60 || mine < 0)\n\t{\n\t\tprintf(\"ошибка\\n\");\n\t}\n\tif (new_mine > 10000 || new_mine < 0)\n\t{\n\t\tprintf(\"ошибка\\n\");\n\t}\n/*-----------*/\n\tmine = mine + new_mine;\n\n\tif (mine > 59) {\n\t\thours = hours + 1;\n\t\tmine = 60 - mine;\n\t\tmine = new_mine - mine -10;\n\n\t}\n\tif (hours >= 24) {\n\t\thours= 0;\n\t}\n\n\tif (hours < 10) \n\t{\n\t\tprintf(\"0%d:\", hours);\n\t} \n\tif (mine < 10)\n\t{\n\t\tprintf(\"0%d\", mine);\n\t}\n\telse {\n\t\tprintf(\"%d:%d\\n\", hours, mine);\n\t}\n}"}, {"source_code": "#include \n\nint main()\n{\n int hr;\n int mnt;\n int tmp;\n scanf(\"%d:%d\", &hr,&mnt);\n scanf(\"%d\", &tmp);\n mnt = mnt + tmp;\n hr = hr + mnt/60;\n mnt = mnt%60;\n if (hr == 24)\n hr = 0;\n if (hr <10)\n printf(\"0%d:\",hr);\n else\n printf(\"%d:\",hr);\n if (mnt < 10)\n printf(\"0%d\",mnt);\n else\n printf(\"%d\",mnt);\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\nint H , M , a , s ;\nchar c;\nscanf(\"%d %c %d\",&H,&c,&M);\nscanf(\"%d\",&a) ;\ns=H*60 + M + a ;\nH=(s/60)%24;\nM=(s/24)%60;\nprintf(\"%d:%d\",H,M);\nreturn 0 ;\n}"}, {"source_code": "#include \n#include \n\nint main() {\n\tchar a[4];\n\tint b[2];\n\tint z = 0, x = 0;\n\tb[0] = 0; b[1] = 0;\n\tchar c[1];\n\tchar d[1];\n\tscanf(\"%s\", &a);\n\tc[1] = a[0];\n\td[1] = a[1];\n\tb[1] = 10 * atoi(c) + atoi(d);\n\tc[1] = a[3];\n\td[1] = a[4];\n\tb[2] = 10 * atoi(c) + atoi(d);\n\t//printf(\" b[1] = %d; b[2] = %d\", b[1], b[2]);\n\tscanf(\"%d\", &z);\n\tif (z >= 60) {\n\t\tx = z / 60;\n\t\tz = z % 60;\n\t}\n\tif (x + b[1] > 23) {\n\t\tb[1] = x - 23 - b[1];\n\t\twhile (b[1] > 23) b[1] -= 24;\n\t\tb[1]--;\n\t} else {\n\t\tb[1] += x;\n\t}\n\tif (z + b[2] > 59) {\n\t\tb[1]++;\n\t\tif (b[1] >=24) b[1] = 0;\n\t\tb[2] = z - 60 + b[2];\n\t} else {\n\t\tb[2] += z;\n\t}\n\tif ( (b[1] / 10 == 0) && (b[2] / 10 == 0) )\n\t\tprintf(\"0%d:0%d\", b[1],b[2]);\n\telse {\n\t\tif ((b[1] / 10 == 0) || (b[2] / 10 == 0)) {\n\t\t\tif (b[1] / 10 == 0)\n\t\t\t\tprintf(\"0%d:%d\",b[1],b[2]);\n\t\t\tif (b[2] / 10 == 0)\n\t\t\t\tprintf(\"%d:0%d\",b[1],b[2]);\n\t\t} else {printf(\"%d:%d\\n\", b[1], b[2]);}\n\t}\n\t\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include \nvoid ajoutminute(int *mm,int *hh,int a){\nif(*mm+a>=60){\n\tif(*hh==23){\n\t\tint d=a/60;\n\t\tint r=a%60;\n\t\t*hh=d;\n\t\t*mm=*mm+r;}\n\telse{\n\t\tint d=a/60;\n\t\tint r=a%60;\n\t\t*hh=*hh+d;\n\t\t*mm=*mm+r;}\n\t}\nelse\n\t*mm=*mm+a;\n}\n\nint main(){\n int mm, hh, a;\n scanf(\"%d:%d \",&hh,&mm);\n scanf(\"%d\",&a);\n ajoutminute(&mm,&hh,a);\n if(mm<=9 && hh<=9)\n \tprintf(\"0%d:0%d\",hh,mm);\nelse if(mm>9 && hh>9)\n\tprintf(\"%d:%d\",hh,mm);\nelse if(mm>9 && hh<=9)\n\tprintf(\"0%d:%d\",hh,mm);\nelse \n\tprintf(\"%d:0%d\",hh,mm);\n \nreturn 0;} "}, {"source_code": "#include\n#include\n\nint main(void)\n{\n float h,m,a,in;\n scanf(\"%f:%f\\n%f\",&h,&m,&a);\n if((m+a)==60) { ++h; m=0; if(h==24) h=0;}\n else if((m+a)<60) { m=m+a; if(m>60) m=m-60;}\n else if((m+a)>60 ) { h=h+(((a+m)/(24*60))-floor((a+m)/(24*60)))*24; if(h>=24) h=h-24; m=m+((a/60)-floor(a/60))*60; if(m>60) m=m-60;}\n printf(\"%.2d:%.2d\",(int)h,(int)m);\n\nreturn(0);\n}"}, {"source_code": "#include \n#include \n\nint main() {\n\tchar a[4];\n\tint b[2];\n\tint z = 0, x = 0;\n\tb[0] = 0; b[1] = 0;\n\tchar c[1];\n\tchar d[1];\n\tscanf(\"%s\", &a);\n\tc[1] = a[0];\n\td[1] = a[1];\n\tb[1] = 10 * atoi(c) + atoi(d);\n\tc[1] = a[3];\n\td[1] = a[4];\n\tb[2] = 10 * atoi(c) + atoi(d);\n\t//printf(\" b[1] = %d; b[2] = %d\", b[1], b[2]);\n\tscanf(\"%d\", &z);\n\tif (z >= 60) {\n\t\tx = z / 60;\n\t\tz = z % 60;\n\t}\n\tif ((x % 24) == 0) \n\t\tx = x / 24;\n\tif (x + b[1] > 23) {\n\t\tb[1] = x - 23 - b[1];\n\t\twhile (b[1] > 23) b[1] -= 24;\n\t\tb[1]--;\n\t} else {\n\t\tb[1] += x;\n\t}\n\tif (z + b[2] > 59) {\n\t\tb[1]++;\n\t\tif (b[1] >=24) b[1] = 0;\n\t\tb[2] = z - 60 + b[2];\n\t} else {\n\t\tb[2] += z;\n\t}\n\tif ( (b[1] / 10 == 0) && (b[2] / 10 == 0) )\n\t\tprintf(\"0%d:0%d\", b[1],b[2]);\n\telse {\n\t\tif ((b[1] / 10 == 0) || (b[2] / 10 == 0)) {\n\t\t\tif (b[1] / 10 == 0)\n\t\t\t\tprintf(\"0%d:%d\",b[1],b[2]);\n\t\t\tif (b[2] / 10 == 0)\n\t\t\t\tprintf(\"%d:0%d\",b[1],b[2]);\n\t\t} else {printf(\"%d:%d\\n\", b[1], b[2]);}\n\t}\n\t\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main(){\nint H , M , a , s ;\nchar c;\nscanf(\"%d %c %d\",&H,&c,&M);\nscanf(\"%d\",&a) ;\ns=H*60 + M + a ;\nH=(s/60)%24;\nM=s%60;\nprintf(\"%d:%d\",H,M);\nreturn 0 ;\n}\n\n\n\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int m,h,a;\n scanf(\"%d:%d\",&h,&m);\n scanf(\"%d\",&a);\n if(\n a%60 ==0){\n h=h+(a/60);\n }\n if( a%60 !=0){\n m=m+(a%60);\n h=h+(a/60);\n }\n if((m>60)){\n h=h+(m/60);\n m=(m%60);\n }\n if((h>=24)){\n h=h-24;\n }\n printf(\"%02d:%02d\",h,m);\n return 0;\n}"}, {"source_code": "#include\nint main(){\nint H , M , a , s ;\nchar c;\nscanf(\"%d %c %d\",&H,&c,&M);\nscanf(\"%d\",&a) ;\ns=H*60 + M + a ;\nH=(s/60)%24;\nM=(s/24)%60;\nprintf(\"%02d:%02d\",H,M);\nreturn 0 ;\n}"}, {"source_code": "#include\nint main(){\nint i,j,k,l,h,m,a;\nscanf(\"%d:%d\",&h,&m);\nscanf(\"%d\",&a);\ni=a/60;\nj=h+i;\nk=a-(60*i);\nl=m+k;\nif(l>60){\nj=j+1;\nl=l-60;\n if(j>=24){\n while(j>=24){\n j=j-24;\n }\nprintf(\"%d : %d\",j,l);\n }\n else {\n printf(\"%d : %d\",j,l);\n }\n}\nelse{\n if(j>=24){\n while(j>=24){\n j=j-24;\n }\nprintf(\"%d : %d\",j,l);\n }\n else {\n printf(\"%d : %d\",j,l);\n }\n\n\n}\n}\n"}, {"source_code": "#include \n#include \n#include \nint main()\n{\n\t\tint p,o;\n\t\tint a;\n\t\tint k,l,m,n;\n\t\tscanf(\"%d:%d\\n\",&p,&o);\n\t\tscanf(\"%d\",&a);\n\t\tk=p/10;\n\t\tl=p%10;\n\t\tm=o/10;\n\t\tn=o%10;\n\t\t\n\t\tint x;\n\t\tx=a/60;\n\t\tint y;\n\t\ty=(10*k+l+x)%24;\n\t\tif(y<10)\n\t\t{\n\t\t\tk=0;\n\t\t\tl=y;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t\tl=(10*k+l+x)%10;\n\t\t\t\tk=(10*k+l+x)/10;\n\t\t\t}\n\t\tint z;\n\t\tz=a-60*x;\n\t\tint b=10*k+l;\n\t\tb+=(10*m+n+z)/60;\n\t\tif(b>=24)\n\t\t{l=b%24;\n\t\t\tk=0;}\n\t\t\telse{\n\t\t\t\tk=k;\n\t\t\t\tl=l;\n\t\t\t}\n\t\tint c;\n\t\tc=(10*m+n+z)%60;\n\t\tif(c<10)\n\t\t{\n\t\t\tn=c;\n\t\t\tm=0;\n\t\t}\n\t\telse {\n\t\t\t\n\t\t\t\t\tn=(10*m+n+z)%10;\n\t\t\t\t\tm=(10*m+n+z)/10;\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\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\t\n\t\t\t\n\t\t\t\n\t\tprintf(\"%d%d:%d%d\",k,l,m,n);\n\t\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint i,h,m,a;\n\tchar s[10],t[10];\n\tscanf(\"%s\",s);\n\th=(s[0]-48)*10+(s[1]-48);\n\tm=(s[3]-48)*10+(s[4]-48);\n\tscanf(\"%d\",&a);\n\th+=a/60;\n\tm+=a%60;\n\tif(m>=60)\n\t{\n\t\th+=m/60;\n\t\tm=m%60;\n\t}\n\tif(h>=24)\n\t\th-=24;\n\n\tt[0]=(h/10)+48;\n\tt[1]=(h%10)+48;\n\tt[2]=':';\n\tt[3]=(m/10)+48;\n\tt[4]=(m%10)+48;\n\tt[5]='\\0';\n\tprintf(\"%s\\n\",t);\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int h,m,x,a,b;\n scanf(\"%d:%d\",&h,&m);\n scanf(\"%d\",&x);\n a=x/60;\n b=x%60;\n h=h+a;\n m=m+b;\n if(m>59)\n {\n m=m%60;\n h=h+1;\n }\n h=h%24;\n if(h<10 && m<10)\n printf(\"0%d:0%d\",h,m);\n else if(h<10 && m>10)\n printf(\"0%d:%d\",h,m);\n else if(h>10 && m<10)\n printf(\"%d:0%d\",h,m);\n else\n printf(\"%d:%d\",h,m);\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n\tchar a[6];\n\tint q,w,e,r,ad;\n\tscanf(\"%s\",a);\n//\tprintf(\"%c %c %c %c %c\\n\",a[0],a[1],a[2],a[3],a[4]);\n\tq=a[0]-48;\n\tw=a[1]-48;\n\te=a[3]-48;\n\tr=a[4]-48;\n\tq=q*10+w;\n\te=e*10+r;\n//\tprintf(\"%d %d\",q,e);\n\tscanf(\"%d\",&ad);\n\tif(e+ad > 59)\n\t{\n\t q=q+(e+ad)/60;\n\t e=e+ad-60*((e+ad)/60);\n\t if(q>23)\n\t\t q=q-24;\n\t}\n\tif(q<10)\n\t\tprintf(\"0%d\",q);\n\telse\n\t\tprintf(\"%d\",q);\n\tprintf(\":\");\n\tif(e<10)\n\t\tprintf(\"0%d\",e);\n\telse\n\t\tprintf(\"%d\",e);\n\tprintf(\"\\n\");\n\treturn 0;\n}"}, {"source_code": "#include \nvoid ajoutminute(int *mm,int *hh,int a){\nif(*mm+a>=60){\n\tif(*hh==23){\n\t\tint d=a/60;\n\t\tint r=a%60;\n\t\t*hh=d;\n\t\t*mm=r-1;}\n\telse{\n\t\tint d=a/60;\n\t\tint r=a%60;\n\t\t*hh=*hh+d;\n\t\t*mm=*mm+r;}\n\t}\nelse\n\t*mm=*mm+a;\n}\n\nint main(){\n int mm, hh, a;\n scanf(\"%d:%d \",&hh,&mm);\n scanf(\"%d\",&a);\n ajoutminute(&mm,&hh,a);\n if(mm<=9 && hh<=9)\n \tprintf(\"0%d:0%d\",hh,mm);\nelse if(mm>9 && hh>9)\n\tprintf(\"%d:%d\",hh,mm);\nelse if(mm>9 && hh<=9)\n\tprintf(\"0%d:%d\",hh,mm);\nelse \n\tprintf(\"%d:0%d\",hh,mm);\n \nreturn 0;} "}, {"source_code": "#include \n#include \n#include \nint main()\n{\n\t\tint p,o;\n\t\tint a;\n\t\tint k,l,m,n;\n\t\tscanf(\"%d:%d\\n\",&p,&o);\n\t\tscanf(\"%d\",&a);\n\t\tk=p/10;\n\t\tl=p%10;\n\t\tm=o/10;\n\t\tn=o%10;\n\t\t\n\t\tint x;\n\t\tx=a/60;\n\t\tint y;\n\t\ty=(10*k+l+x)%24;\n\t\tif(y<10)\n\t\t{\n\t\t\tk=0;\n\t\t\tl=y;\n\t\t}\n\t\tint z;\n\t\tz=a-60*x;\n\t\tint c;\n\t\tc=(10*m+n+z)%60;\n\t\tif(c<10)\n\t\t{\n\t\t\tn=c;\n\t\t\tm=0;\n\t\t}\n\t\tprintf(\"%d%d:%d%d\",k,l,m,n);\n\t\treturn 0;\n}\n"}, {"source_code": "#include\nint main () {\n\tint a,b,c;\n\tscanf(\"%d:%d\",&a,&b);\n\tscanf(\"%d\",&c);\n\tif(b+c>=60)\n\t\ta=a+(b+c)/60;\n\t\tb=(b+c)%60;\n\tif(a>24)\n\t\ta=a%24;\n\telse if(a==24)\n\t\ta=0;\n\tif(a<10){\n\t\tprintf(\"0%d:%d\",a,b);\n\treturn 0;}\n\telse if(b<10){\n\t\tprintf(\"%d:0%d\",a,b);\n\treturn 0;}\n\telse if(a<10 && b<10){\n\t\tprintf(\"0%d:0%d\",a,b);\n\treturn 0;}\n\n\t\n\tprintf(\"%d:%d\",a,b);\n\t}\n\n\n"}, {"source_code": "#include \n\nint main () \n{ char c;\n\tint h,m,a,d,r ;\n\tscanf(\"%d%c%d\",&h,&c,&m);\n\tscanf(\"%d\",&a);\n\tr=a%60;\n\td=a/60;\n\tif (r+m<60)\n\t { m=m+r;\n\t if (h+d<24)\n\t h=h+d;\n\t else\n\t h=(h+d)-24;}\n\t \n\telse\n\t { m=(m+r)-60 ;\n\t \n\t if (h+d+1<24)\n\t h=h+d+1;\n\t else\n\t h=(h+d+1)-24;}\n\t \n printf(\"%02d:%02d\",h,m );\n return 0 ;\n}"}, {"source_code": "#include\n#include\nint main () {\n\tint i,x=0,y=0,t,n;\n\tchar c;\n\tfor(i=1;i<=2;i++){\n\t\tscanf(\"%c\",&c);\n\t\tif(i==1)\n\t\tx+=(c-'0')*10;\n\t\telse x+=c-'0';}\n\tfor(i=1;i<=3;i++){\n\t\tif(i==1)\n\t\t\tscanf(\"%c\",&c);\n\t\telse\n\t\tscanf(\"%c\",&c);\n\t\tif(i==2)\n\t\t\ty+=(c-'0')*10;\n\t\tif(i==3)\n\t\t\ty+=c-'0';}\n\t\tscanf(\"%d\",&t);\n\t\tif(t%60==0)\n\t\t\tx+=t/60;\n\t\telse{\n\t\t\tx+=t/60;\n\t\t\ty+=t-((t/60)*60);}\n\t\tif(y>59){\n\t\t\tx+=y/60;\n\t\t\tn=y;\n\t\t\ty=n%60;}\n\t\tif(x>23)\t\n\t\t\tif(y<10){\n\t\t\t\tx=x%24;\n\t\tprintf(\"0%d:0%d\",x,y);}\n\t\t\telse{\n\t\t\t\tx=x%24;\n\t\tprintf(\"0%d:%d\",x,y);}\n\t\telse\n\t\tprintf(\"%d:%d\",x,y);\n\n\n\n\n\n\n\n\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n\tchar a[6];\n\tint q,w,e,r,ad;\n\tscanf(\"%s\",a);\n\tq=a[0]-48;\n\tw=a[1]-48;\n\te=a[3]-48;\n\tr=a[4]-48;\n\tq=q*10+w;\n\te=e*10+r;\n\tscanf(\"%d\",&ad);\n\tad=ad-(ad/1440)*1440;\n\tif(e+ad > 59)\n\t{\n\t q=q+(e+ad)/60;\n\t e=e+ad-60*((e+ad)/60);\n\t if(q>23)\n\t\t q=q-24;\n\t}\n\tif(q<10)\n\t\tprintf(\"0%d\",q);\n\telse\n\t\tprintf(\"%d\",q);\n\tprintf(\":\");\n\tif(e<10)\n\t\tprintf(\"0%d\",e);\n\telse\n\t\tprintf(\"%d\",e);\n\tprintf(\"\\n\");\n\treturn 0;\n}\n\n\n\n\n\n"}, {"source_code": "#include \n#include \n\nint main() {\n\tchar a[4];\n\tint b[2];\n\tint z = 0, x = 0;\n\tb[0] = 0; b[1] = 0;\n\tchar c[1];\n\tchar d[1];\n\tscanf(\"%s\", &a);\n\tc[1] = a[0];\n\td[1] = a[1];\n\tb[1] = 10 * atoi(c) + atoi(d);\n\tc[1] = a[3];\n\td[1] = a[4];\n\tb[2] = 10 * atoi(c) + atoi(d);\n\t//printf(\" b[1] = %d; b[2] = %d\", b[1], b[2]);\n\tscanf(\"%d\", &z);\n\tif (z >= 60) {\n\t\tx = z / 60;\n\t\tz = z % 60;\n\t}\n\tif (x + b[1] > 23) {\n\t\tb[1] = x - 23 - b[1];\n\t\twhile (b[1] > 23) b[1] -= 24;\n\t\tb[1]--;\n\t} else {\n\t\tb[1] += x;\n\t}\n\tif (z + b[2] > 59) {\n\t\tb[1]++;\n\t\tif (b[1] >=24) b[1] = 0;\n\t\tb[2] = z - 60 + b[2];\n\t} else {\n\t\tb[2] += z;\n\t}\n\tif ( (b[1] / 10 == 0) && (b[2] / 10 == 0) )\n\t\tprintf(\"0%d:0%d\", b[1],b[2]);\n\telse {\n\t\tif ((b[1] / 10 == 0) || (b[2] / 10 == 0)) {\n\t\t\tif (b[1] / 10 == 0)\n\t\t\t\tprintf(\"0%d:%d\",b[1],b[2]);\n\t\t\tif (b[2] / 10 == 0)\n\t\t\t\tprintf(\"%d:0%d\",b[1],b[2]);\n\t\t} else {printf(\"%d:%d\\n\", b[1], b[2]);}\n\t}\n\t\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main(){\nint m,h,a,s,r,x;\nchar c;\nscanf(\"%d %c %d\",&h,&c,&m);\nscanf(\"%d\",&a);\nif (a<60) {\n if ((a+m)>59){\n m=(a+m)-60;\n if (h==23)\n h=00;\n else\n h=h+1;\n }\n else\n m=m+a;}\nelse{\n s=a%60;\n r=a/60;\n x=r%24;\n if ((h+r)>23){\n h=(h+x)-24;}\n else\n h=h+r;\nif((m+s)>59){\n m=(m+s)-60;\n h=h+1;\n }\nelse{m=m+s;}\n}\nprintf(\"%02d:%02d\",h,m);\nreturn 0;\n}"}, {"source_code": "/*\n * main.c\n * \n * Copyright 2016 elmihailol \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 \n\nint main(int argc, char **argv)\n{\n\tint x, y, p;\n\tprintf(\"Time: \");\n\tscanf(\"%d:%d\", &x, &y);\n\tprintf(\"Time+: \");\n\tscanf(\"%d\", &p);\n\ty=y+p;\n\twhile(y>=60)\n\t{\n\t\tx++;\n\t\ty-=60;\n\t}\n\twhile(x>=24)\n\t{\n\t\tx-=24;\n\t}\n\tif(x<10 && y<10)\n\t{\n\t\tprintf(\"0%d:0%d\",x, y);\n\t}\n\tif(x<10 && y>=10)\n\t{\n\t\tprintf(\"0%d:%d\",x, y);\n\t}\n\tif(x>=10 && y<10)\n\t{\n\t\tprintf(\"%d:0%d\",x, y);\n\t}\n\tif(x>=10 && y>=10)\n\t{\n\t\tprintf(\"%d:%d\",x, y);\n\t}\n\tint i;\n\t\n\treturn 0;\n}\n\n\n\n\n\n"}, {"source_code": "#include\nmain()\n{\n\tint h1=0,m1=0,a=0,hd=0,h2=0,m2=0,m3=0,md=0,mf=0,h3=0,hf=0,t=0,ha=0;\n\tscanf(\"%d:%d\",&h1,&m1);\n\tscanf(\"%d\",&a);\n\tif ((a==0)&&(m1<10)&&(h1>=10))\n\t{\n\t\tprintf(\"%d:0%d\",h1,m1);\n\t}\n else if ((a==0)&&(h1<10)&&(m1>=10))\n\t{\n\t\tprintf(\"0%d:%d\",h1,m1);\n\t}\n\telse if ((a==0)&&(h1>10)&&(m1>10))\n\t{\n\t\tprintf(\"%d:%d\",h1,m1);\n\t}\n\telse if ((a==0)&&(h1<10)&&(m1<10))\n\t{\n\t\tprintf(\"0%d:0%d\",h1,m1);\n\t}\n\telse\n\t{\n\thd=a/60;\n\tmd=a%60;\n\tm2=m1+md;\n\th2=h1+hd;\n\tm3=m2/60;\n\th3=h2+m3;\n\tmf=m2-60*m3;\n\t\n if (h3==24)\n {\n \thf=0;\n }\n \n else if(h3>24)\n {\n \tha=h3-24;\n \thf=ha%24;\n }\n else\n {\n \thf=h3;\n }\n\t\n\tif((mf<10)&&(hf<10))\n {\n \tprintf(\"0%d:0%d\",hf,mf);\n }\n \tif((mf<10)&&(hf>=10))\n {\n \tprintf(\"%d:%0d\",hf,mf);\n }\n \tif((mf>=10)&&(hf<10))\n {\n \tprintf(\"0%d:%d\",hf,mf);\n }\n \tif((mf>=10)&&(hf>=10))\n {\n \tprintf(\"%d:%d\",hf,mf);\n }\n\t}\n \n \n \n\t\n}"}, {"source_code": "#include \n#include \nint main()\n{\n\tchar a[6];\n\tint q,w,e,r,ad;\n\tscanf(\"%s\",a);\n//\tprintf(\"%c %c %c %c %c\\n\",a[0],a[1],a[2],a[3],a[4]);\n\tq=a[0]-48;\n\tw=a[1]-48;\n\te=a[3]-48;\n\tr=a[4]-48;\n\tq=q*10+w;\n\te=e*10+r;\n//\tprintf(\"%d %d\",q,e);\n\tscanf(\"%d\",&ad);\n\tif(e+ad > 59)\n\t{\n\t q=q+(e+ad)/60;\n\t e=e+ad-60*((e+ad)/60);\n\t if(q>23)\n\t\t q=q-24;\n\t}\n\tif(q<10)\n\t\tprintf(\"0%d\",q);\n\telse\n\t\tprintf(\"%d\",q);\n\tprintf(\":\");\n\tif(e<10)\n\t\tprintf(\"0%d\",e);\n\telse\n\t\tprintf(\"%d\",e);\n\tprintf(\"\\n\");\n\treturn 0;\n}"}, {"source_code": "#include\nmain()\n{\n\tint h1=0,m1=0,a=0,hd=0,h2=0,m2=0,m3=0,md=0,mf=0,h3=0,hf=0,t=0,ha=0;\n\tscanf(\"%d:%d\",&h1,&m1);\n\tscanf(\"%d\",&a);\n\tif ((a==0)&&(h1<10)&&(m1<10))\n\t{\n\t\tprintf(\"0%d:0%d\",h1,m1);\n\t}\n\telse\n\t{\n\thd=a/60;\n\tmd=a%60;\n\tm2=m1+md;\n\th2=h1+hd;\n\tm3=m2/60;\n\th3=h2+m3;\n\tmf=m2-60*m3;\n\t\n if (h3==24)\n {\n \thf=0;\n }\n \n else if(h3>24)\n {\n \tha=h3-24;\n \thf=ha%24;\n }\n else\n {\n \thf=h3;\n }\n\t\n\tif((mf<10)&&(hf<10))\n {\n \tprintf(\"0%d:0%d\",hf,mf);\n }\n \tif((mf<10)&&(hf>=10))\n {\n \tprintf(\"%d:%0d\",hf,mf);\n }\n \tif((mf>=10)&&(hf<10))\n {\n \tprintf(\"0%d:%d\",hf,mf);\n }\n \tif((mf>=10)&&(hf>=10))\n {\n \tprintf(\"%d:%d\",hf,mf);\n }\n\t}\n \n \n \n\t\n}"}, {"source_code": "#include\nint main()\n{\n int a,b,d,e,f,g,h;\n char c;\n scanf(\"%d%c%d\\n\",&b,&c,&d);\n scanf(\"%d\",&a);\n f=a%60+d;\n g=f/60;\n e=(a/60)+b+g;\n if(e>24 && e!=24){\n if(e-24<10){\n printf(\"0%d:\",e-24);\n }\n else if(e-24>10){\n printf(\"%d:\",(e-24)%24);\n }\n }\n else if(e==24){\n printf(\"00:\");\n }\n else\n {\n if(e<10){\n printf(\"0%d:\",e);\n }\n else\n printf(\"%d:\",e);\n }\n h=f%60;\n if(h<10){\n printf(\"0%d\",h);\n }\n else if(h==0){\n printf(\"00\");\n }\n else\n printf(\"%d\",h);\n\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n char time[6];\n int hr,min,h,m,a;\n scanf(\"%s\",time);\n sscanf(time,\"%d:%d\",&hr,&min);\n scanf(\"%d\",&a);\n // printf(\"%d %d\",hr,min);\n h=a/60;\n m=a%60;\n if((min+m)>=60)\n {\n min=min+m-60;\n h++;\n }\n else\n min=min+m;\n if((hr+h)>=24)\n hr=hr+h-24;\n else\n hr=hr+h;\n printf(\"%02d:%02d\",hr,min);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int h,m,a;\n char f;\n scanf(\"%d%c%d\",&h,&f,&m);\n scanf(\"%d\",&a);\n int l=a/60;\n if(l>=24)\n {\n l=l%24;\n h=h+l;\n if(h>23)\n h=h-23-1;\n }\n else\n {\n h=h+l;\n if(h>23)\n h=h-23;\n }\n l=a%60;\n if(l>0)\n {\n m=m+l;\n if(m>59)\n {\n h++;\n if(h>23) h=00;\n m=m-59-1;\n }\n }\n if(h==0&&m==0)\n printf(\"00:00\");\n else if(h==0&&m<10)\n printf(\"00:0%d\",m);\n else if(h<10&&m==0)\n printf(\"0%d:00\",h);\n else if(h==0)\n printf(\"00%c%d\",f,m);\n else if(m==0)\n printf(\"%d%c00\",h,f);\n else if(h<10&&m<10)\n printf(\"0%d%c0%d\",h,f,m);\n else if(h<10)\n printf(\"0%d%c%d\",h,f,m);\n else if(m<10)\n printf(\"%d%c0%d\",h,f,m);\n else\n printf(\"%d%c%d\",h,f,m);\n}\n"}, {"source_code": "#include \n\nint a, b, m;\n\nint main()\n{\n scanf(\"%d:%d\",&a,&b);\n scanf(\"%d\",&m);\n a+=m/60;\n b+=m%60;\n if(b>=60)\n {\n b-=60;\n a++;\n }\n if(a>=24)\n {\n a-=24;\n }\n printf(\"%02d:%02d\",a,b);\n return 0;\n}"}, {"source_code": "#include \n#include \n\n\nint main() {\n int x = 0, y = 0, z, t, i, j;\n char s[5], test[] = (\"pp123456789\");\n scanf(\"%s\", &s);\n z = 10;\n for (i = 0; i < 2; i++) {\n\tfor (j = 0; j < 10; j++) {\n\t if (s[i] == test[j]) {\n\t\tx = x + z * (j - 1);\n\t }\n\t}\n\tz = z / 10;\n }\n z = 10;\n for (i = 3; i < 5; i++) {\n\tfor (j = 0; j < 10; j++) {\n\t if (s[i] == test[j]) {\n\t\ty = y + z * (j - 1);\n\t }\n\t}\n\tz = z / 10;\n }\n z = x*60 + y;\n scanf (\"%d\", &t);\n z += t;\n\tx = ((z / 60) % 24);\n\ty = z % 60;\n if (x/10 == 0 && y/10 == 0) {\n\tprintf (\"0%d:0%d\", x, y);\n } else if(x/10 == 0) {\n\tprintf (\"0%d:%d\", x, y);\n } else if (y/10 == 0) {\n\tprintf (\"%d:0%d\", x, y);\n } else {\n\tprintf(\"%d:%d\", x, y);\n }\n return 0;\n}\t\t\n"}, {"source_code": "#include \n\nint main() {\n\tint h, m, a;\n\n\tscanf(\"%d:%d\", &h, &m);\n\tscanf(\"%d\", &a);\n\n\tm += a;\n\tif (m >= 60) {\n\t\tm %= 60;\n\t\th += 1;\n\n\t\tif (h >= 24) h %= 24;\n\t}\n\n\tprintf(\"%02d:%02d\\n\", h, m);\n\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\n main()\n{\n int t,h,s,i ,f;\n char v;\n f=t;\n scanf (\"%d%c%d\",&h,&v,&s);\n scanf(\"%d\",&t);\n for (i=0;i\nvoid ajoutminute(int *mm,int *hh,int a){\nif(*mm+a>=60){\n\tif(*hh==23){\n\t\tint d=a/60;\n\t\tint r=a%60;\n\t\t*hh=d;\n\t\t*mm=*mm+r;}\n\telse{\n\t\tint d=a/60;\n\t\tint r=a%60;\n\t\t*hh=*hh+d;\n\t\t*mm=*mm+r;}\n\t}\nelse\n\t*mm=*mm+a;\n}\n\nint main(){\n int mm, hh, a;\n scanf(\"%d:%d \",&hh,&mm);\n scanf(\"%d\",&a);\n ajoutminute(&mm,&hh,a);\n if(mm<=9 && hh<=9)\n \tprintf(\"0%d:0%d\",hh,mm);\nelse if(mm>9 && hh>9)\n\tprintf(\"%d:%d\",hh,mm);\nelse if(mm>9 && hh<=9)\n\tprintf(\"0%d:%d\",hh,mm);\nelse \n\tprintf(\"%d:0%d\",hh,mm);\n \nreturn 0;} "}, {"source_code": "#include \n#include \n\nint main()\n{\n int n,l,nb ;\n char s[100000];\n scanf(\"%d\",&n);\n scanf(\"%s\",&s);\n nb=n+1;\n printf(\"%d\",nb);\n return 0;\n}\n"}, {"source_code": "#include\nmain()\n{\n\t\nint a,b;\n\nscanf(\"%d%d\",&a,&b);\nint num;\nscanf(\"%d\",&num);\n\nb+=num;\nint tmp=b/60;\nb%=60;\na+=tmp;\na%=24;\nprintf(\"%02d:%02d\",a,b);\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int a, h, x, m;\n scanf(\"%d:%d\", &h, &m);\n scanf(\"%d\", &a);\n m += a;\n x = m / 60;\n m %= 60;\n h += x;\n h %= 24;\n if (h > 10) printf(\"%d\", h);\n else printf(\"0%d\", h);\n printf(\":\");\n if (m > 10) printf(\"%d\\n\", m);\n else printf(\"0%d\\n\", m);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int mm,hh,m1;\n char k;\n scanf(\"%d %c %d\",&hh,&k,&mm);\n scanf(\"%d\",&m1);\n int y;\n y=mm+m1;\n if(mm+m1<60){\n mm+=m1;\n }\n else{\n while(y>60){\n hh+=1;\n y-=60;\n }\n mm=y;\n }\n printf(\"%d:%d\",hh,mm);\n\n return 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n char HH[24][2]={{'0','0'},{'0','1'},{'0','2'},{'0','3'},{'0','4'},{'0','5'},{'0','6'},{'0','7'},{'0','8'},{'0','9'},{'1','0'},{'1','1'},{'1','2'},{'1','3'},{'1','4'},{'1','5'},{'1','6'},{'1','7'},{'1','8'},{'1','9'},{'2','0'},{'2','1'},{'2','2'},{'2','3'}};\n char MM[60][2]={{'0','0'},{'0','1'},{'0','2'},{'0','3'},{'0','4'},{'0','5'},{'0','6'},{'0','7'},{'0','8'},{'0','9'},{'1','0'},{'1','1'},{'1','2'},{'1','3'},{'1','4'},{'1','5'},{'1','6'},{'1','7'},{'1','8'},{'1','9'},{'2','0'},{'2','1'},{'2','2'},{'2','3'},{'2','4'},{'2','5'},{'2','6'},{'2','7'},{'2','8'},{'2','9'},{'3','0'},{'3','1'},{'3','2'},{'3','3'},{'3','4'},{'3','5'},{'3','6'},{'3','7'},{'3','8'},{'3','9'},{'4','0'},{'4','1'},{'4','2'},{'4','3'},{'4','4'},{'4','5'},{'4','6'},{'4','7'},{'4','8'},{'4','9'},{'5','0'},{'5','1'},{'5','2'},{'5','3'},{'5','4'},{'5','5'},{'5','6'},{'5','7'},{'5','8'},{'5','9'}};\n char clook[5];\n scanf(\"%s\",clook);\n int i,j;\n if(clook[3]=='0' && clook[4]=='0')i=0;\n if(clook[3]=='0' && clook[4]=='1')i=1;\n if(clook[3]=='0' && clook[4]=='2')i=2;\n if(clook[3]=='0' && clook[4]=='3')i=3;\n if(clook[3]=='0' && clook[4]=='4')i=4;\n if(clook[3]=='0' && clook[4]=='5')i=5;\n if(clook[3]=='0' && clook[4]=='6')i=6;\n if(clook[3]=='0' && clook[4]=='7')i=7;\n if(clook[3]=='0' && clook[4]=='8')i=8;\n if(clook[3]=='0' && clook[4]=='9')i=9;\n if(clook[3]=='1' && clook[4]=='0')i=10;\n if(clook[3]=='1' && clook[4]=='1')i=11;\n if(clook[3]=='1' && clook[4]=='2')i=12;\n if(clook[3]=='1' && clook[4]=='3')i=13;\n if(clook[3]=='1' && clook[4]=='4')i=14;\n if(clook[3]=='1' && clook[4]=='5')i=15;\n if(clook[3]=='1' && clook[4]=='6')i=16;\n if(clook[3]=='1' && clook[4]=='7')i=17;\n if(clook[3]=='1' && clook[4]=='8')i=18;\n if(clook[3]=='1' && clook[4]=='9')i=19;\n if(clook[3]=='2' && clook[4]=='0')i=20;\n if(clook[3]=='2' && clook[4]=='1')i=21;\n if(clook[3]=='2' && clook[4]=='2')i=22;\n if(clook[3]=='2' && clook[4]=='3')i=23;\n if(clook[3]=='2' && clook[4]=='4')i=24;\n if(clook[3]=='2' && clook[4]=='5')i=25;\n if(clook[3]=='2' && clook[4]=='6')i=26;\n if(clook[3]=='2' && clook[4]=='7')i=27;\n if(clook[3]=='2' && clook[4]=='8')i=28;\n if(clook[3]=='2' && clook[4]=='9')i=29;\n if(clook[3]=='3' && clook[4]=='0')i=30;\n if(clook[3]=='3' && clook[4]=='1')i=31;\n if(clook[3]=='3' && clook[4]=='2')i=32;\n if(clook[3]=='3' && clook[4]=='3')i=33;\n if(clook[3]=='3' && clook[4]=='4')i=34;\n if(clook[3]=='3' && clook[4]=='5')i=35;\n if(clook[3]=='3' && clook[4]=='6')i=36;\n if(clook[3]=='3' && clook[4]=='7')i=37;\n if(clook[3]=='3' && clook[4]=='8')i=38;\n if(clook[3]=='3' && clook[4]=='9')i=39;\n if(clook[3]=='4' && clook[4]=='0')i=40;\n if(clook[3]=='4' && clook[4]=='1')i=41;\n if(clook[3]=='4' && clook[4]=='2')i=42;\n if(clook[3]=='4' && clook[4]=='3')i=43;\n if(clook[3]=='4' && clook[4]=='4')i=44;\n if(clook[3]=='4' && clook[4]=='5')i=45;\n if(clook[3]=='4' && clook[4]=='6')i=46;\n if(clook[3]=='4' && clook[4]=='7')i=47;\n if(clook[3]=='4' && clook[4]=='8')i=48;\n if(clook[3]=='4' && clook[4]=='9')i=49;\n if(clook[3]=='5' && clook[4]=='0')i=50;\n if(clook[3]=='5' && clook[4]=='1')i=51;\n if(clook[3]=='5' && clook[4]=='2')i=52;\n if(clook[3]=='5' && clook[4]=='3')i=53;\n if(clook[3]=='5' && clook[4]=='4')i=54;\n if(clook[3]=='5' && clook[4]=='5')i=55;\n if(clook[3]=='5' && clook[4]=='6')i=56;\n if(clook[3]=='5' && clook[4]=='7')i=57;\n if(clook[3]=='5' && clook[4]=='8')i=58;\n if(clook[3]=='5' && clook[4]=='9')i=59;\n\n if(clook[0]=='0' && clook[1]=='0')j=0;\n if(clook[0]=='0' && clook[1]=='1')j=1;\n if(clook[0]=='0' && clook[1]=='2')j=2;\n if(clook[0]=='0' && clook[1]=='3')j=3;\n if(clook[0]=='0' && clook[1]=='4')j=4;\n if(clook[0]=='0' && clook[1]=='5')j=5;\n if(clook[0]=='0' && clook[1]=='6')j=6;\n if(clook[0]=='0' && clook[1]=='7')j=7;\n if(clook[0]=='0' && clook[1]=='8')j=8;\n if(clook[0]=='0' && clook[1]=='9')j=9;\n if(clook[0]=='1' && clook[1]=='0')j=10;\n if(clook[0]=='1' && clook[1]=='1')j=11;\n if(clook[0]=='1' && clook[1]=='2')j=12;\n if(clook[0]=='1' && clook[1]=='3')j=13;\n if(clook[0]=='1' && clook[1]=='4')j=14;\n if(clook[0]=='1' && clook[1]=='5')j=15;\n if(clook[0]=='1' && clook[1]=='6')j=16;\n if(clook[0]=='1' && clook[1]=='7')j=17;\n if(clook[0]=='1' && clook[1]=='8')j=18;\n if(clook[0]=='1' && clook[1]=='9')j=19;\n if(clook[0]=='2' && clook[1]=='0')j=20;\n if(clook[0]=='2' && clook[1]=='1')j=21;\n if(clook[0]=='2' && clook[1]=='2')j=22;\n if(clook[0]=='2' && clook[1]=='3')j=23;\n\n int num;\n scanf(\"%d\",&num);\n i+=num;\n if(i>=60){\n j+=(i/60);\n i=i%60;\n }\n if(j>=24)\n j=j%24;\n clook[0]='0';\n clook[1]='0';\n clook[3]='0';\n clook[4]='0';\n clook[0]=HH[j][0];\n clook[1]=HH[j][1];\n clook[2]=':';\n clook[3]=MM[i][0];\n clook[4]=MM[i][1];\n printf(\"%s\",clook);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n\nint main()\n{\n long n,k,l;\n scanf(\"%ld\",&n);\n for(l=1;l<=n;l++)\n {\n k=l*(l+1)/2;\n if(k>=n) break;\n }\n l=l-1;\n printf(\"%ld\",n-l*(l+1)/2);\n\n\n return 0;\n}\n"}, {"source_code": "// The Time\n\n#include\n#include\nint main(void)\n{\n\tchar str[6];\n\tint a,i,arr_h[3],arr_m[3],hh,mm,x,y,time;\n\tscanf(\"%s\",str);\n\tchar str_h[3] = \"\",str_m[3] = \"\";\n\tscanf(\"%d\",&a);\n\tfor(i = 0;i<2;i++)\n\t{\n\t\tif(str[i]=='0')\n\t\t\tstrcat(str_h,\"0\");\n\t\telse if(str[i]=='1')\n\t\t\tstrcat(str_h,\"1\");\n\t\telse if(str[i]=='2')\n\t\t\tstrcat(str_h,\"2\");\n\t\telse if(str[i]=='3')\n\t\t\tstrcat(str_h,\"3\");\n\t\telse if(str[i]=='4')\n\t\t\tstrcat(str_h,\"4\");\n\t\telse if(str[i]=='5')\n\t\t\tstrcat(str_h,\"5\");\n\t\telse if(str[i]=='6')\n\t\t\tstrcat(str_h,\"6\");\n\t\telse if(str[i]=='7')\n\t\t\tstrcat(str_h,\"7\");\n\t\telse if(str[i]=='8')\n\t\t\tstrcat(str_h,\"8\");\n\t\telse if(str[i]=='9')\n\t\t\tstrcat(str_h,\"9\");\n\t}\n\n\tfor(i = 3;i<=4;i++)\n\t{\n\t\tif(str[i]=='0')\n\t\t\tstrcat(str_m,\"0\");\n\t\telse if(str[i]=='1')\n\t\t\tstrcat(str_m,\"1\");\n\t\telse if(str[i]=='2')\n\t\t\tstrcat(str_m,\"2\");\n\t\telse if(str[i]=='3')\n\t\t\tstrcat(str_m,\"3\");\n\t\telse if(str[i]=='4')\n\t\t\tstrcat(str_m,\"4\");\n\t\telse if(str[i]=='5')\n\t\t\tstrcat(str_m,\"5\");\n\t\telse if(str[i]=='6')\n\t\t\tstrcat(str_m,\"6\");\n\t\telse if(str[i]=='7')\n\t\t\tstrcat(str_m,\"7\");\n\t\telse if(str[i]=='8')\n\t\t\tstrcat(str_m,\"8\");\n\t\telse if(str[i]=='9')\n\t\t\tstrcat(str_m,\"9\");\t\n\t}\n\n\thh = 0;\n\tx = 10;\n\tfor(i = 0;i<2;i++)\n\t{\n\t\tif(str_h[i]=='0')\n\t\t\tarr_h[i] = 0;\n\t\telse if(str_h[i]=='1')\n\t\t\tarr_h[i] = 1;\n\t\telse if(str_h[i]=='2')\n\t\t\tarr_h[i] = 2;\n\t\telse if(str_h[i]=='3')\n\t\t\tarr_h[i] = 3;\n\t\telse if(str_h[i]=='4')\n\t\t\tarr_h[i] = 4;\n\t\telse if(str_h[i]=='5')\n\t\t\tarr_h[i] = 5;\n\t\telse if(str_h[i]=='6')\n\t\t\tarr_h[i] = 6;\n\t\telse if(str_h[i]=='7')\n\t\t\tarr_h[i] = 7;\n\t\telse if(str_h[i]=='8')\n\t\t\tarr_h[i] = 8;\n\t\telse if(str_h[i]=='9')\n\t\t\tarr_h[i] = 9;\n\n\t\thh += x*arr_h[i];\n\t\tx/=10;\n\t}\n\n\tmm = 0;\n\ty = 10;\n\tfor(i = 0;i<2;i++)\n\t{\n\t\tif(str_m[i]=='0')\n\t\t\tarr_m[i] = 0;\n\t\telse if(str_m[i]=='1')\n\t\t\tarr_m[i] = 1;\n\t\telse if(str_m[i]=='2')\n\t\t\tarr_m[i] = 2;\n\t\telse if(str_m[i]=='3')\n\t\t\tarr_m[i] = 3;\n\t\telse if(str_m[i]=='4')\n\t\t\tarr_m[i] = 4;\n\t\telse if(str_m[i]=='5')\n\t\t\tarr_m[i] = 5;\n\t\telse if(str_m[i]=='6')\n\t\t\tarr_m[i] = 6;\n\t\telse if(str_m[i]=='7')\n\t\t\tarr_m[i] = 7;\n\t\telse if(str_m[i]=='8')\n\t\t\tarr_m[i] = 8;\n\t\telse if(str_m[i]=='9')\n\t\t\tarr_m[i] = 9;\n\n\t\tmm += y*arr_m[i];\n\t\ty/=10;\n\t}\n\n\ttime = 60*hh+mm;\n\ttime = time+a;\n\t\n\thh = time/60;\n\t\n\tif(hh==24)\n\t\thh = 0;\n\t\n\tmm = time%60;\n\t\n\tif((hh>=0)&&(hh<=9))\n\t\tprintf(\"0%d:\",hh);\n\telse\n\t\tprintf(\"%d:\",hh);\n\t\n\tif((mm>=0)&&(mm<=9))\n\t\tprintf(\"0%d\",mm);\n\telse\n\t\tprintf(\"%d\",mm);\n\n\tprintf(\"\\n\");\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main() {\n\tchar times[5];\n\tint hours, mine;\n\tint new_mine, s;\n\n\tscanf(\"%s\", times);\n\tscanf(\"%d\", &new_mine);\n\tsscanf(times, \"%d:%d\", &hours, &mine);\n\n\n\tif (hours > 25 || hours < 0)\n\t{\n\t\treturn 0; \n\t}\n\tif (mine > 60 || mine < 0)\n\t{\n\t\treturn 0; \n\t\t;\n\t}\n\tif (new_mine > 10000 || new_mine < 0)\n\t{\n\t\treturn 0; \n\t\t;\n\t}\n/*-----------*/\n\ts = hours * 60 + mine + new_mine;\n\ts %=24*60;\n\thours = s / 60;\n\tmine = s % 60;\n\n\tif (hours < 10) \n\t{\n\t\tprintf(\"0%d:\", hours);\n\t} \n\tif (mine < 10)\n\t{\n\t\tprintf(\"0%d\\n\", mine);\n\t}\n\tif (hours >= 10){\n\t\tprintf(\"%d:\", hours);\n\t}\n\t// if (mine >=10) {\n\t// \tprintf(\"%d\\n\", mine);\n\t// }\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint main(){\n\tint n,h,m;\n\tscanf(\"%d:%d %d\",&h,&m,&n);\n\tif(n>=60)\n\t\th+=n/60;\n\telse\n\t\tm+=n;\n\tif(m>=60){\n\t\th+=m/60;\n\t}\n\tif(h>=24){\n\t\th%=24;\n\t\tprintf(\"0%d:%d\",h,m%60);\n\t\treturn 0;\n\t}\n\n\tprintf(\"%d:%d\",h,m);\n\n\n\n\t\n\n\n\n\n\n\n\n\n}\n"}, {"source_code": "#include\nint main()\n{ int h,m,m1;\n\tchar c;\n\tscanf(\"%d%c%d\",&h,&c,&m);\n\tscanf(\"%d\",&m1);\n\tif (m+m1<=59)\n\t\n\t printf(\"%02d:%02d\",h,m+m1);\n\t \n\telse\n\t{\n\t h=h+(m+m1)/60;\n\t m=(m+m1)%60;\n\t if (h>=23)\n\t {\n\t h=h-24;\n\t \n\t \n\t printf(\"%02d:%02d\",h,m);\n }\n\t else\n\t\n\t \n\t printf(\"%02d:%02d\",h,m);\n\t }\n\n \n\treturn (0);}\n"}, {"source_code": "#include\n\nint main()\n{\n int hh,mm,a,hour,minute;\n\n scanf(\"%d:%d\",&hh,&mm);\n scanf(\"%d\",&a);\n hour=hh;\n minute=mm;\n\n minute+=a%60;\n if(minute>59)\n {\n minute-=60;\n hour+=1;\n if(hour>23)\n {\n hour-=24;\n }\n }\n\n hour+=a/60;\n if(hour>23)\n {\n hour-=24;\n }\n\n printf(\"%02d:%02d\",hour,minute);\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n char HH[24][2]={{'0','0'},{'0','1'},{'0','2'},{'0','3'},{'0','4'},{'0','5'},{'0','6'},{'0','7'},{'0','8'},{'0','9'},{'1','0'},{'1','1'},{'1','2'},{'1','3'},{'1','4'},{'1','5'},{'1','6'},{'1','7'},{'1','8'},{'1','9'},{'2','0'},{'2','1'},{'2','2'},{'2','3'}};\n char MM[60][2]={{'0','0'},{'0','1'},{'0','2'},{'0','3'},{'0','4'},{'0','5'},{'0','6'},{'0','7'},{'0','8'},{'0','9'},{'1','0'},{'1','1'},{'1','2'},{'1','3'},{'1','4'},{'1','5'},{'1','6'},{'1','7'},{'1','8'},{'1','9'},{'2','0'},{'2','1'},{'2','2'},{'2','3'},{'2','4'},{'2','5'},{'2','6'},{'2','7'},{'2','8'},{'2','9'},{'3','0'},{'3','1'},{'3','2'},{'3','3'},{'3','4'},{'3','5'},{'3','6'},{'3','7'},{'3','8'},{'3','9'},{'4','0'},{'4','1'},{'4','2'},{'4','3'},{'4','4'},{'4','5'},{'4','6'},{'4','7'},{'4','8'},{'4','9'},{'5','0'},{'5','1'},{'5','2'},{'5','3'},{'5','4'},{'5','5'},{'5','6'},{'5','7'},{'5','8'},{'5','9'}};\n char clock[5];\n gets(clock);\n int i,j;\n if(clock[3]=='0' && clock[4]=='0')i=0;\n if(clock[3]=='0' && clock[4]=='1')i=1;\n if(clock[3]=='0' && clock[4]=='2')i=2;\n if(clock[3]=='0' && clock[4]=='3')i=3;\n if(clock[3]=='0' && clock[4]=='4')i=4;\n if(clock[3]=='0' && clock[4]=='5')i=5;\n if(clock[3]=='0' && clock[4]=='6')i=6;\n if(clock[3]=='0' && clock[4]=='7')i=7;\n if(clock[3]=='0' && clock[4]=='8')i=8;\n if(clock[3]=='0' && clock[4]=='9')i=9;\n if(clock[3]=='1' && clock[4]=='0')i=10;\n if(clock[3]=='1' && clock[4]=='1')i=11;\n if(clock[3]=='1' && clock[4]=='2')i=12;\n if(clock[3]=='1' && clock[4]=='3')i=13;\n if(clock[3]=='1' && clock[4]=='4')i=14;\n if(clock[3]=='1' && clock[4]=='5')i=15;\n if(clock[3]=='1' && clock[4]=='6')i=16;\n if(clock[3]=='1' && clock[4]=='7')i=17;\n if(clock[3]=='1' && clock[4]=='8')i=18;\n if(clock[3]=='1' && clock[4]=='9')i=19;\n if(clock[3]=='2' && clock[4]=='0')i=20;\n if(clock[3]=='2' && clock[4]=='1')i=21;\n if(clock[3]=='2' && clock[4]=='2')i=22;\n if(clock[3]=='2' && clock[4]=='3')i=23;\n if(clock[3]=='2' && clock[4]=='4')i=24;\n if(clock[3]=='2' && clock[4]=='5')i=25;\n if(clock[3]=='2' && clock[4]=='6')i=26;\n if(clock[3]=='2' && clock[4]=='7')i=27;\n if(clock[3]=='2' && clock[4]=='8')i=28;\n if(clock[3]=='2' && clock[4]=='9')i=29;\n if(clock[3]=='3' && clock[4]=='0')i=30;\n if(clock[3]=='3' && clock[4]=='1')i=31;\n if(clock[3]=='3' && clock[4]=='2')i=32;\n if(clock[3]=='3' && clock[4]=='3')i=33;\n if(clock[3]=='3' && clock[4]=='4')i=34;\n if(clock[3]=='3' && clock[4]=='5')i=35;\n if(clock[3]=='3' && clock[4]=='6')i=36;\n if(clock[3]=='3' && clock[4]=='7')i=37;\n if(clock[3]=='3' && clock[4]=='8')i=38;\n if(clock[3]=='3' && clock[4]=='9')i=39;\n if(clock[3]=='4' && clock[4]=='0')i=40;\n if(clock[3]=='4' && clock[4]=='1')i=41;\n if(clock[3]=='4' && clock[4]=='2')i=42;\n if(clock[3]=='4' && clock[4]=='3')i=43;\n if(clock[3]=='4' && clock[4]=='4')i=44;\n if(clock[3]=='4' && clock[4]=='5')i=45;\n if(clock[3]=='4' && clock[4]=='6')i=46;\n if(clock[3]=='4' && clock[4]=='7')i=47;\n if(clock[3]=='4' && clock[4]=='8')i=48;\n if(clock[3]=='4' && clock[4]=='9')i=49;\n if(clock[3]=='5' && clock[4]=='0')i=50;\n if(clock[3]=='5' && clock[4]=='1')i=51;\n if(clock[3]=='5' && clock[4]=='2')i=52;\n if(clock[3]=='5' && clock[4]=='3')i=53;\n if(clock[3]=='5' && clock[4]=='4')i=54;\n if(clock[3]=='5' && clock[4]=='5')i=55;\n if(clock[3]=='5' && clock[4]=='6')i=56;\n if(clock[3]=='5' && clock[4]=='7')i=57;\n if(clock[3]=='5' && clock[4]=='8')i=58;\n if(clock[3]=='5' && clock[4]=='9')i=59;\n\n if(clock[0]=='0' && clock[1]=='0')j=0;\n if(clock[0]=='0' && clock[1]=='1')j=1;\n if(clock[0]=='0' && clock[1]=='2')j=2;\n if(clock[0]=='0' && clock[1]=='3')j=3;\n if(clock[0]=='0' && clock[1]=='4')j=4;\n if(clock[0]=='0' && clock[1]=='5')j=5;\n if(clock[0]=='0' && clock[1]=='6')j=6;\n if(clock[0]=='0' && clock[1]=='7')j=7;\n if(clock[0]=='0' && clock[1]=='8')j=8;\n if(clock[0]=='0' && clock[1]=='9')j=9;\n if(clock[0]=='1' && clock[1]=='0')j=10;\n if(clock[0]=='1' && clock[1]=='1')j=11;\n if(clock[0]=='1' && clock[1]=='2')j=12;\n if(clock[0]=='1' && clock[1]=='3')j=13;\n if(clock[0]=='1' && clock[1]=='4')j=14;\n if(clock[0]=='1' && clock[1]=='5')j=15;\n if(clock[0]=='1' && clock[1]=='6')j=16;\n if(clock[0]=='1' && clock[1]=='7')j=17;\n if(clock[0]=='1' && clock[1]=='8')j=18;\n if(clock[0]=='1' && clock[1]=='9')j=19;\n if(clock[0]=='2' && clock[1]=='0')j=20;\n if(clock[0]=='2' && clock[1]=='1')j=21;\n if(clock[0]=='2' && clock[1]=='2')j=22;\n if(clock[0]=='2' && clock[1]=='3')j=23;\n\n int num;\n scanf(\"%d\",&num);\n i+=num;\n if(i>=60){\n j+=(i/60);\n i=i%60;\n }\n if(j>=24)\n j=j%24;\n clock[0]='0';\n clock[1]='0';\n clock[3]='0';\n clock[4]='0';\n clock[0]=HH[j][0];\n clock[1]=HH[j][1];\n clock[2]=':';\n clock[3]=MM[i][0];\n clock[4]=MM[i][1];\n printf(\"%s\",clock);\n return 0;\n}\n\n\n"}, {"source_code": "#include \n#include \n#include \nint main()\n{\n\t\tint k,l,m,n;\n\t\tint a;\n\t\tchar g;\n\t\tscanf(\"%d%d%c%d%d\\n\",&k,&l,&g,&m,&n);\n\t\tscanf(\"%d\",&a);\n\t\tint x;\n\t\tx=a/60;\n\t\tint y;\n\t\ty=(10*k+l+x)%24;\n\t\tif(y<10)\n\t\t{\n\t\t\tk=0;\n\t\t\tl=y;\n\t\t}\n\t\tint z;\n\t\tz=a-60*x;\n\t\tint c;\n\t\tc=(10*m+n+z)%60;\n\t\tif(c<10)\n\t\t{\n\t\t\tn=c;\n\t\t\tm=0;\n\t\t}\n\t\tprintf(\"%d%d:%d%d\",k,l,m,n);\n\t\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int hh,mm;\n char c;\n int a;\n scanf(\"%d %c %d\",&hh, &c,&mm);\n scanf(\"%d\",&a);\n mm=mm+a;\n if (mm>60){\n hh=(hh+mm/60)%24;\n mm=mm%60;\n }\n printf(\"%02d:%02d\",hh,mm);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main () {\n\tint i,x=0,y=0,t,n;\n\tchar c;\n\tfor(i=1;i<=2;i++){\n\t\tscanf(\"%c\",&c);\n\t\tif(i==1)\n\t\tx+=(c-'0')*10;\n\t\telse x+=c-'0';}\n\tfor(i=1;i<=3;i++){\n\t\tif(i==1)\n\t\t\tscanf(\"%c\",&c);\n\t\telse\n\t\tscanf(\"%c\",&c);\n\t\tif(i==2)\n\t\t\ty+=(c-'0')*10;\n\t\tif(i==3)\n\t\t\ty+=c-'0';}\n\t\tscanf(\"%d\",&t);\n\t\tif(t%60==0)\n\t\t\tx+=t/60;\n\t\telse{\n\t\t\tx+=t/60;\n\t\t\ty+=t-((t/60)*60);}\n\t\tif(y>59){\n\t\t\tx+=y/60;\n\t\t\tn=y;\n\t\t\ty=n%60;}\n\t\tif(x>23){\n\t\t\t\tx=x%24;\n\t\t\tif(x<10)\n\t\tprintf(\"0%d:\",x);\n\t\t\telse printf(\"%d:\",x);}\n\t\telse printf(\"%d:\",x);\n\t\t\tif(y<10)\n\t\t\t\tprintf(\"0%d\",y);\n\t\t\telse printf(\"%d\",y);\n\n\n\n\n\n\n\n\n\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main () {\n\tint i,x=0,y=0,t,n;\n\tchar c;\n\tfor(i=1;i<=2;i++){\n\t\tscanf(\"%c\",&c);\n\t\tif(i==1)\n\t\tx+=(c-'0')*10;\n\t\telse x+=c-'0';}\n\tfor(i=1;i<=3;i++){\n\t\tif(i==1)\n\t\t\tscanf(\"%c\",&c);\n\t\telse\n\t\tscanf(\"%c\",&c);\n\t\tif(i==2)\n\t\t\ty+=(c-'0')*10;\n\t\tif(i==3)\n\t\t\ty+=c-'0';}\n\t\tscanf(\"%d\",&t);\n\t\tif(t%60==0)\n\t\t\tx+=t/60;\n\t\telse{\n\t\t\tx+=t/60;\n\t\t\ty+=t-((t/60)*60);}\n\t\tif(y>59){\n\t\t\tx+=y/60;\n\t\t\tn=y;\n\t\t\ty=n%60;}\n\t\tif(x>23)\t\n\t\t\tif(y<10){\n\t\t\t\tx=x%24;\n\t\tprintf(\"0%d:0%d\",x,y);}\n\t\t\telse{\n\t\t\t\tx=x%24;\n\t\tprintf(\"0%d:%d\",x,y);}\n\t\telse\n\t\tprintf(\"%d:%d\",x,y);\n\n\n\n\n\n\n\n\n\treturn 0;\n}\n"}, {"source_code": "\n#include \n#include \n#include \n//#include \n \nvoid print_matrix(int n, int m, int arr[][m]) {\n\tint i,j;\n \n\tfor (i=0;i 0) {\n\t\t\t\tarr[m][m-n]= 1;\n\t\t\t}\n\t\t\tif ((i < (n-1)) && (m+n < n*n)) {\n\t\t\t\tarr[m][m+n] = 1;\n\t\t\t}\n\t\t\tif (j > 0) {\n\t\t\t\tarr[m][m-1] = 1;\n\t\t\t}\n\t\t\tif ((j < (n-1)) && (m+1 < n*n)) {\n\t\t\t\tarr[m][m+1] = 1;\n\t\t\t}\n\t\t}\n\t}\n}\n \nint nullmatrix(int n, int m, int arr[][m], int **null) {\n int i,j=0;\n int k,l=0;\n int a,b=0;\n int aux[m];\n int temp=0;\n int ipivot = 0;\n int jpivot = 0;\n int rank = 0;\n\tint nullity=0;\n\tint zero=0;\n\tint d,daux=0;\n \n for (i=0;i ones) {\n\t\t\t\tminimum = k;\n\t\t\t\tones_aux = ones;\n\t\t\t} else {\n\t\t\t\tif (ones_aux == -1) {\n\t\t\t\t\tones_aux = ones;\n\t\t\t\t\tminimum = k;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintf (\"%d\\n\",ones_aux);\n\t\tl=0;\n\t\tfor (i=0;i 10)) {\n\t\tprintf (\"1 <= T <= 10 and T must be a int\\n\");\n\t\texit(0);\n\t}\n\tfor (b=1;b<=T;b++) {\n\t\tscanf(\"%d\",&a);\n\t\tif ((a < 3) || (a > 30)) {\n\t\t\tprintf (\"3 <= n <= 30 and n must be a int\\n\");\n\t\t\texit(0);\n\t\t}\n\t\tB = malloc(a * sizeof(int *));\n\t\tfor (c=0;c\n#include \n\nint main() {\n\tchar a[4];\n\tint b[2];\n\tint z = 0, x = 0;\n\tb[0] = 0; b[1] = 0;\n\tchar c[1];\n\tchar d[1];\n\tscanf(\"%s\", &a);\n\tc[1] = a[0];\n\td[1] = a[1];\n\tb[1] = 10 * atoi(c) + atoi(d);\n\tc[1] = a[3];\n\td[1] = a[4];\n\tb[2] = 10 * atoi(c) + atoi(d);\n\t//printf(\" b[1] = %d; b[2] = %d\", b[1], b[2]);\n\tscanf(\"%d\", &z);\n\tif (z >= 60) {\n\t\tx = z / 60;\n\t\tz = z % 60;\n\t}\n\tif (x + b[1] > 23) {\n\t\tb[1] = x - 23 - b[1];\n\t\twhile (b[1] > 23) b[1] -= 24;\n\t\tb[1]--;\n\t} else {\n\t\tb[1] += x;\n\t}\n\tif (z + b[2] > 59) {\n\t\tb[1]++;\n\t\tif (b[1] >=24) b[1] = 0;\n\t\tb[2] = z - 60 + b[2];\n\t} else {\n\t\tb[2] += z;\n\t}\n\tif ( (b[1] / 10 == 0) && (b[2] / 10 == 0) )\n\t\tprintf(\"0%d:0%d\", b[1],b[2]);\n\telse {\n\t\tif ((b[1] / 10 == 0) || (b[2] / 10 == 0)) {\n\t\t\tif (b[1] / 10 == 0)\n\t\t\t\tprintf(\"0%d:%d\",b[1],b[2]);\n\t\t\tif (b[2] / 10 == 0)\n\t\t\t\tprintf(\"%d:0%d\",b[1],b[2]);\n\t\t} else {printf(\"%d:%d\\n\", b[1], b[2]);}\n\t}\n\t\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n#include \nint main()\n{\n\t\tint p,o;\n\t\tint a;\n\t\tint k,l,m,n;\n\t\tscanf(\"%d:%d\\n\",&p,&o);\n\t\tscanf(\"%d\",&a);\n\t\tk=p/10;\n\t\tl=p%10;\n\t\tm=o/10;\n\t\tn=o%10;\n\t\t\n\t\tint x;\n\t\tx=a/60;\n\t\tint y;\n\t\ty=(10*k+l+x)%24;\n\t\tif(y<10)\n\t\t{\n\t\t\tk=0;\n\t\t\tl=y;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t\tl=(10*k+l+x)%10;\n\t\t\t\tk=(10*k+l+x)/10;\n\t\t\t}\n\t\tint z;\n\t\tz=a-60*x;\n\t\tint b=10*k+l;\n\t\tb+=(10*m+n+z)/60;\n\t\tif(b>=24)\n\t\t{l=b%24;\n\t\t\tk=0;}\n\t\t\telse{\n\t\t\t\tk=k;\n\t\t\t\tl=l;\n\t\t\t}\n\t\tint c;\n\t\tc=(10*m+n+z)%60;\n\t\tif(c<10)\n\t\t{\n\t\t\tn=c;\n\t\t\tm=0;\n\t\t}\n\t\telse {\n\t\t\t\n\t\t\t\t\tn=(c)%10;\n\t\t\t\t\tm=(c)/10;\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\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\t\n\t\t\t\n\t\t\t\n\t\tprintf(\"%d%d:%d%d\",k,l,m,n);\n\t\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n\tint h;\n\tchar c;\n\tint m;\n\t\n\tint a;\n\t\n\tscanf(\"%d%c%d\", &h,&c,&m);\n\tscanf(\"%d\", &a);\n\t\n\tint hours_passed, minutes_passed;\n\t\n\thours_passed=a/60;\n\tminutes_passed=a%60;\n\t\n\tint h1=0;\n\t\n\tint m1=m+minutes_passed;\n\tif(m1>=60)\n\t{\n\t\tm1-=60;\n\t\th1+=1;\n\t\th1+=h+hours_passed;\n\t\t\n\t\tif(h1>=24)\n\t\th1-=24;\n\t}\n\telse\n\t{\n\t\th1+=h+hours_passed;\n\t\t\n\t\tif(h1>=24)\n\t\th1-=24;\n\t}\n\t\n\tif(m1>=10 && h1>=10)\n\t{\n\t\tprintf(\"%d:%d\", h1,m1);\n\t}\n\telse\n\t{\n\t\tif(m1<10 && h1>=10)\n\t\tprintf(\"%d:0%d\", h1,m1);\n\t\t\n\t\telse\n\t\t{\n\t\t\tif(m1>=10 && h1<10)\n\t\t\tprintf(\"0%d:%d\", h1,m1);\n\t\t\t\n\t\t\telse\n\t\t\tprintf(\"0%d:0%d\", h1,m1);\n\t\t}\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int hh,mm;\n char c;\n int a;\n scanf(\"%d %c %d\",&hh, &c,&mm);\n scanf(\"%d\",&a);\n mm=mm+a;\n if (mm>60){\n hh=(hh+mm/60)%24;\n mm=mm%60;\n }\n printf(\"%02d:%02d\",hh,mm);\n return 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\nint a,b,c;\nint timer=0;\nchar input[50];\ngets(input);\nscanf(\"%d\",&timer);\na=0;\nb=0;\nchar *q=input;\nwhile(*q!=':'){\na=a*10+(*q-'0');\nq++;\n}\nq++;\nwhile(*q){\nb=b*10+(*q-'0');\nq++;\n}\nwhile(timer!=0){\nb++;\ntimer--;\nif(b==60){\n a++;\n b=0;\n}\nif(a==24)\n a=0;\n}\nif(b<10){\n printf(\"%d:0%d\",a,b);\n}\nelse\n printf(\"%d:%d\",a,b);\n\n}\n\n"}, {"source_code": "#include \n#include \n\nint main() {\n\tchar a[4];\n\tint b[2];\n\tint z = 0, x = 0;\n\tb[0] = 0; b[1] = 0;\n\tchar c[1];\n\tchar d[1];\n\tscanf(\"%s\", &a);\n\tc[1] = a[0];\n\td[1] = a[1];\n\tb[1] = 10 * atoi(c) + atoi(d);\n\tc[1] = a[3];\n\td[1] = a[4];\n\tb[2] = 10 * atoi(c) + atoi(d);\n\t//printf(\" b[1] = %d; b[2] = %d\", b[1], b[2]);\n\tscanf(\"%d\", &z);\n\t/*if (z >= 60) {\n\t\tx = z / 60;\n\t\tz = z % 60;\n\t}\n\tif ((x % 24) == 0)\n\t\tx = x / 24 - 1;\n\tif (x + b[1] > 23) {\n\t\tb[1] = x - 23 - b[1];\n\t\twhile (b[1] > 23) b[1] -= 24;\n\t\tb[1]--;\n\t} else {\n\t\tb[1] += x;\n\t}\n\tif (z + b[2] > 59) {\n\t\tb[1]++;\n\t\tif (b[1] >=24) b[1] = 0;\n\t\tb[2] = z - 60 + b[2];\n\t} else {\n\t\tb[2] += z;\n\t}\n\tif ( (b[1] / 10 == 0) && (b[2] / 10 == 0) )\n\t\tprintf(\"0%d:0%d\", b[1],b[2]);\n\telse {\n\t\tif ((b[1] / 10 == 0) || (b[2] / 10 == 0)) {\n\t\t\tif (b[1] / 10 == 0)\n\t\t\t\tprintf(\"0%d:%d\",b[1],b[2]);\n\t\t\tif (b[2] / 10 == 0)\n\t\t\t\tprintf(\"%d:0%d\",b[1],b[2]);\n\t\t} else {printf(\"%d:%d\\n\", b[1], b[2]);}\n\t}\n\t*/\n\tb[1] = 60 * b[1];\n\tb[2] = b[1] + b[2] + z;\n\tb[1] = b[2] / 60;\n\tb[2] = b[2] % 60;\n\tif (b[1] == 24) b[1] = 0;\n if ( (b[1] / 10 == 0) && (b[2] / 10 == 0) )\n printf(\"0%d:0%d\", b[1],b[2]);\n else {\n if ((b[1] / 10 == 0) || (b[2] / 10 == 0)) {\n if (b[1] / 10 == 0)\n printf(\"0%d:%d\",b[1],b[2]);\n if (b[2] / 10 == 0)\n printf(\"%d:0%d\",b[1],b[2]);\n } else {printf(\"%d:%d\\n\", b[1], b[2]);}\n }\n\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int hh,mm;\n char c;\n int a;\n scanf(\"%d %c %d\",&hh, &c,&mm);\n scanf(\"%d\",&a);\n mm=mm+a;\n if (mm>60){\n hh=(hh+mm/60)%24;\n mm=mm%60;\n }\n printf(\"%02d:%02d\",hh,mm);\n return 0;\n}"}, {"source_code": "\n#include \nint main() {\n\tint h,m,a,d,r;\n\tchar c ; \n\tscanf(\"%d %c %d\",&h,&c,&m) ;\n\tscanf(\"%d\",&a); \n\tr= a%60 ; \n\td = a/60 ; \n\tif (r+m<60) \n\t{ m=m+r ;\n\t\tif (h+d<24) \n\t\th= h+d ; \n\t\telse \n\t\th= (h+d)%24 ; \n\t}\n\telse \n\t{ \n\t\tm= (m+r)-60 ;\n\t\tif(h+d+1<24 ) \n\t\th= h+d+1 ; \n\t\telse \n\t\th=(h+d+1)%24 ; }\n\t\t\n printf(\"%02d : %02d\",h,m);\n \t \n\t\treturn(0) ;\n\t\t\n}\t\t\n"}, {"source_code": "#include\nint main () {\n\tint a,b,c;\n\tscanf(\"%d:%d\",&a,&b);\n\tscanf(\"%d\",&c);\n\tif(b+c>=60)\n\t\ta=a+(b+c)/60;\n\t\tb=(b+c)%60;\n\tif(a>24)\n\t\ta=a%24;\n\telse if(a==24)\n\t\ta=0;\n\tif(a+b<=18){\n\t\tprintf(\"0%d:0%d\",a,b);\n\treturn 0;}\n\tprintf(\"%d:%d\",a,b);\n\t}\n\n\n"}, {"source_code": "#include \n#include \n\nint main() {\n\tchar a[4];\n\tint b[2];\n\tint z = 0, x = 0;\n\tb[0] = 0; b[1] = 0;\n\tchar c[1];\n\tchar d[1];\n\tscanf(\"%s\", &a);\n\tc[1] = a[0];\n\td[1] = a[1];\n\tb[1] = 10 * atoi(c) + atoi(d);\n\tc[1] = a[3];\n\td[1] = a[4];\n\tb[2] = 10 * atoi(c) + atoi(d);\n\t//printf(\" b[1] = %d; b[2] = %d\", b[1], b[2]);\n\tscanf(\"%d\", &z);\n\tif (z >= 60) {\n\t\tx = z / 60;\n\t\tz = z % 60;\n\t}\n\tif ((x % 24) == 0)\n\t\tx = x / 24 - 1;\n\tif (x + b[1] > 23) {\n\t\tb[1] = x - 23 - b[1];\n\t\twhile (b[1] > 23) b[1] -= 24;\n\t\tb[1]--;\n\t} else {\n\t\tb[1] += x;\n\t}\n\tif (z + b[2] > 59) {\n\t\tb[1]++;\n\t\tif (b[1] >=24) b[1] = 0;\n\t\tb[2] = z - 60 + b[2];\n\t} else {\n\t\tb[2] += z;\n\t}\n\tif ( (b[1] / 10 == 0) && (b[2] / 10 == 0) )\n\t\tprintf(\"0%d:0%d\", b[1],b[2]);\n\telse {\n\t\tif ((b[1] / 10 == 0) || (b[2] / 10 == 0)) {\n\t\t\tif (b[1] / 10 == 0)\n\t\t\t\tprintf(\"0%d:%d\",b[1],b[2]);\n\t\t\tif (b[2] / 10 == 0)\n\t\t\t\tprintf(\"%d:0%d\",b[1],b[2]);\n\t\t} else {printf(\"%d:%d\\n\", b[1], b[2]);}\n\t}\n\t\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int hh,mm;\n char c;\n int a;\n scanf(\"%d %c %d\",&hh, &c,&mm);\n scanf(\"%d\",&a);\n mm=mm+a;\n if (mm>60){\n hh=(hh+mm/60)%24;\n mm=mm%60;\n }\n printf(\"%02d:%02d\",hh,mm);\n return 0;\n}\n"}, {"source_code": "#include \nint hh, mm, a;\nint main(int argc, char **argv)\n{\n scanf(\"%d %d\", &hh, &mm);\n scanf(\" %d\", &a);\n \n for(int i=0;i\nmain()\n{\nint h,m,e,i,j,k;\nscanf(\"%d %d\",&h,&m);\nscanf(\"%d\",&e);\n\ni=m+e;\nj=i/60;\nk=e%60;\n\nh=(h+j)%24;\nm=(m+k)%60;\n\nprintf(\"%02d:%02d\",h,m);\n\n\n}\n\n"}, {"source_code": "#include\nint main()\n{\n int h,m,a;\n char f;\n scanf(\"%d%c%d\",&h,&f,&m);\n scanf(\"%d\",&a);\n int l=a/60;\n if(l>=24)\n {\n l=l%24;\n h=h+l;\n if(h>23)\n h=h-23-1;\n }\n else\n {\n h=h+l;\n if(h>23)\n h=h-23;\n }\n l=a%60;\n if(l>0)\n {\n m=m+l;\n if(m>59)\n {\n h++;\n if(h>23) h=00;\n m=m-59-1;\n }\n }\n if(h==0&&m==0)\n printf(\"00:00\");\n else if(h==0&&m<10)\n printf(\"00:0%d\",m);\n else if(h<10&&m==0)\n printf(\"0%d:00\",h);\n else if(h==0)\n printf(\"00%c%d\",f,m);\n else if(m==0)\n printf(\"%d%c00\",h,f);\n else if(h<10&&m<10)\n printf(\"0%d%c0%d\",h,f,m);\n else if(h<10)\n printf(\"0%d%c%d\",h,f,m);\n else if(m<10)\n printf(\"%d%c0%d\",h,f,m);\n else\n printf(\"%d%c%d\",h,f,m);\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n char time[6];\n int hr,min,h,m,a;\n scanf(\"%s\",time);\n sscanf(time,\"%d:%d\",&hr,&min);\n scanf(\"%d\",&a);\n // printf(\"%d %d\",hr,min);\n h=a/60;\n m=a%60;\n if((min+m)>=60)\n {\n min=min+m-60;\n h++;\n }\n else\n min=min+m;\n if((hr+h)>=24)\n hr=hr+h-24;\n else\n hr=hr+h;\n printf(\"%02d:%02d\",hr,min);\n return 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n unsigned int h,m,s,a;\n char ch;\n\n scanf(\"%d%c%d\",&h,&ch,&m);\n scanf(\"%d\", &a);\n while(h<24 && m<60)\n {\n s = m+a;\n if(s%60>=0)\n {\n h+=s/60;\n m=s%60;\n }\n else\n {\n m+=a;\n }\n printf(\"%02d:%02d\", h%24, m);\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \nint main()\n{\n\t\tint p,o;\n\t\tint a;\n\t\tint k,l,m,n;\n\t\tscanf(\"%d:%d\\n\",&p,&o);\n\t\tscanf(\"%d\",&a);\n\t\tk=p/10;\n\t\tl=p%10;\n\t\tm=o/10;\n\t\tn=o%10;\n\t\t\n\t\tint x;\n\t\tx=a/60;\n\t\tint y;\n\t\ty=(10*k+l+x)%24;\n\t\tif(y<10)\n\t\t{\n\t\t\tk=0;\n\t\t\tl=y;\n\t\t}\n\t\tint z;\n\t\tz=a-60*x;\n\t\tint c;\n\t\tc=(10*m+n+z)%60;\n\t\tif(c<10)\n\t\t{\n\t\t\tn=c;\n\t\t\tm=0;\n\t\t}\n\t\tprintf(\"%d%d:%d%d\",k,l,m,n);\n\t\treturn 0;\n}\n"}, {"source_code": "#include\nint main () {\n\tint a,b,c;\n\tscanf(\"%d:%d\",&a,&b);\n\tscanf(\"%d\",&c);\n\tif(b+c>=60)\n\t\ta=a+(b+c)/60;\n\t\tb=(b+c)%60;\n\tif(a>24)\n\t\ta=a%24;\n\telse if(a==24)\n\t\ta=0;\n\tif(a==0 && b==0){\n\t\tprintf(\"00:00\");\n\treturn 0;}\n\tif(a<10){\n\t\tprintf(\"0%d:%d\",a,b);\n\treturn 0;}\n\telse if(b<10){\n\t\tprintf(\"%d:0%d\",a,b);\n\treturn 0;}\n\telse if(a<10 && b<10){\n\t\tprintf(\"0%d:0%d\",a,b);\n\treturn 0;}\n\n\t\n\tprintf(\"%d:%d\",a,b);\n\t}\n\n\n"}, {"source_code": "#include\nint main()\n{\n int h,m,a,i,ans,hour,minute;\n scanf(\"%d:%d\",&h,&m);\n scanf(\"%d\",&a);\n m+=a;\n hour=m/60;\n minute=m%60;\n printf(\"%d:%d\",(h+hour)%24,minute);\n\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n\tchar a[6];\n\tint q,w,e,r,ad;\n\tscanf(\"%s\",a);\n//\tprintf(\"%c %c %c %c %c\\n\",a[0],a[1],a[2],a[3],a[4]);\n\tq=a[0]-48;\n\tw=a[1]-48;\n\te=a[3]-48;\n\tr=a[4]-48;\n\tq=q*10+w;\n\te=e*10+r;\n//\tprintf(\"%d %d\",q,e);\n\tscanf(\"%d\",&ad);\n\tif(e+ad > 59)\n\t{\n\t q=q+(e+ad)/60;\n\t e=e+ad-60*((e+ad)/60);\n\t if(q>23)\n\t\t q=q-24;\n\t}\n\tif(q<10)\n\t\tprintf(\"0%d\",q);\n\telse\n\t\tprintf(\"%d\",q);\n\tprintf(\":\");\n\tif(e<10)\n\t\tprintf(\"0%d\",e);\n\telse\n\t\tprintf(\"%d\",e);\n\tprintf(\"\\n\");\n\treturn 0;\n}"}, {"source_code": "#include\nint main(){\nint H , M , a , s ;\nchar c;\nscanf(\"%d %c %d\",&H,&c,&M);\nscanf(\"%d\",&a) ;\ns=H*60 + M + a ;\nH=(s/60)%24;\nM=(s/24)%60;\nprintf(\"%d:%d\",H,M);\nreturn 0 ;\n}"}, {"source_code": "#include\nint main()\n{\n\tint hours;\n\tint mins;\n\tscanf(\"%d:%d\", &hours, &mins);\n\tint add;\n\tscanf(\"%d\", &add);\n\tif(mins + add <60)\n\t{\n\t\tmins+=add;\n\t}\n\telse if(hours<23)\n\t{\n\t\thours++;\n\t\tmins=mins+add-60;\n\t}\n\telse\n\t{\n\t\thours=0;\n\t\tmins = mins +add-60;\n\t}\n\tif(hours>=10&&mins>=10)\n\t\tprintf(\"%d:%d\\n\",hours, mins);\n\telse if(hours>=10)\n\t\tprintf(\"%d:0%d\\n\",hours, mins);\n\telse if(mins>=10)\n\t\tprintf(\"0%d:%d\\n\",hours, mins);\n\telse\n\t\tprintf(\"0%d:0%d\\n\",hours, mins);\n}\n"}, {"source_code": "#include \n\nint main()\n{int h,m,a;\nchar c;\n\nscanf(\"%d%c%d\",&h,&c,&m);\nscanf(\"%d\",&a);\nh=(h+1)%24;\nm=(m+a)%60;\nprintf(\"%02d:%02d\",h,m);\n\n\nreturn (0);\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n,l,nb ;\n char s[100000];\n scanf(\"%d\",&n);\n scanf(\"%s\",&s);\n nb=n+1;\n printf(\"%d\",nb);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main () {\n\tint i,x=0,y=0,t,n;\n\tchar c;\n\tfor(i=1;i<=2;i++){\n\t\tscanf(\"%c\",&c);\n\t\tif(i==1)\n\t\tx+=(c-'0')*10;\n\t\telse x+=c-'0';}\n\tfor(i=1;i<=3;i++){\n\t\tif(i==1)\n\t\t\tscanf(\"%c\",&c);\n\t\telse\n\t\tscanf(\"%c\",&c);\n\t\tif(i==2)\n\t\t\ty+=(c-'0')*10;\n\t\tif(i==3)\n\t\t\ty+=c-'0';}\n\t\tscanf(\"%d\",&t);\n\t\tif(t%60==0)\n\t\t\tx+=t/60;\n\t\telse{\n\t\t\tx+=t/60;\n\t\t\ty+=t-((t/60)*60);}\n\t\tif(y>59){\n\t\t\tx+=y/60;\n\t\t\tn=y;\n\t\t\ty=n%60;}\n\t\tif(x>23){\n\t\t\t\tx=x%24;\n\t\t\tif(x<10)\n\t\tprintf(\"0%d:\",x);\n\t\t\telse printf(\"%d:\",x);}\n\t\telse printf(\"%d:\",x);\n\t\t\tif(y<10)\n\t\t\t\tprintf(\"0%d\",y);\n\t\t\telse printf(\"%d\",y);\n\n\n\n\n\n\n\n\n\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tint f_m,f_h,hr,h,m,min;\n\t//char ch;\n\tlong long int a;\n\t//char c;\n\t\n\tscanf(\"%d:%d\",&h,&m);\n\tscanf(\"%I64d\",&a);\n\t\n\thr = a/60;\n\tmin = a%60;\n\tf_h = h+hr;\n\tf_m = m+min;\n\t\n\n\tif(f_m>59) {\n\t\tf_h = f_h+1;\n\t\tf_m = f_m-60;\n\t}\n\t\n\tif(f_h>23)\n\t\tf_h = f_h-24;\n\t\n\tif(f_h<10 && f_m>10)\n\t\tprintf(\"0%d:%d\",f_h,f_m);\t\n\telse if(f_m<10 && f_h>10)\n\t\tprintf(\"%d:0%d\",f_h,f_m);\n\telse if(f_h<10 && f_m<10)\n\t\tprintf(\"0%d:0%d\",f_h,f_m);\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main() {\n int a, b, c, d;\n scanf(\"%d:%d\", &a, &b);\n printf(\"\\n\");\n scanf(\"%d\", &c);\n d = a * 60 + b + c;\n a = d / 60;\n b = d % 60;\n if(a > 23) {\n a -= 24;\n } if((a < 10) && (b < 10)) {\n printf(\"0%d:0%d\", a, b);\n return 0;\n } if((a < 10) || (b < 10)) {\n if(a < 10) {\n printf(\"0%d:%d\", a, b);\n return 0;\n } if(b < 10) {\n printf(\"%d:0%d\", a, b);\n return 0;\n }\n }\n printf(\"%d:%d\", a, b);\n return 0;\n}\n"}], "src_uid": "20c2d9da12d6b88f300977d74287a15d"} {"nl": {"description": "Vasya started working in a machine vision company of IT City. Vasya's team creates software and hardware for identification of people by their face.One of the project's know-how is a camera rotating around its optical axis on shooting. People see an eye-catching gadget — a rotating camera — come up to it to see it better, look into it. And the camera takes their photo at that time. What could be better for high quality identification?But not everything is so simple. The pictures from camera appear rotated too (on clockwise camera rotation frame the content becomes rotated counter-clockwise). But the identification algorithm can work only with faces that are just slightly deviated from vertical.Vasya was entrusted to correct the situation — to rotate a captured image so that image would be minimally deviated from vertical. Requirements were severe. Firstly, the picture should be rotated only on angle divisible by 90 degrees to not lose a bit of information about the image. Secondly, the frames from the camera are so huge and FPS is so big that adequate rotation speed is provided by hardware FPGA solution only. And this solution can rotate only by 90 degrees clockwise. Of course, one can apply 90 degrees turn several times but for the sake of performance the number of turns should be minimized.Help Vasya implement the program that by the given rotation angle of the camera can determine the minimum number of 90 degrees clockwise turns necessary to get a picture in which up direction deviation from vertical is minimum.The next figure contains frames taken from an unrotated camera, then from rotated 90 degrees clockwise, then from rotated 90 degrees counter-clockwise. Arrows show direction to \"true up\". The next figure shows 90 degrees clockwise turn by FPGA hardware. ", "input_spec": "The only line of the input contains one integer x ( - 1018 ≤ x ≤ 1018) — camera angle in degrees. Positive value denotes clockwise camera rotation, negative — counter-clockwise.", "output_spec": "Output one integer — the minimum required number of 90 degrees clockwise turns.", "sample_inputs": ["60", "-60"], "sample_outputs": ["1", "3"], "notes": "NoteWhen the camera is rotated 60 degrees counter-clockwise (the second example), an image from it is rotated 60 degrees clockwise. One 90 degrees clockwise turn of the image result in 150 degrees clockwise total rotation and deviation from \"true up\" for one turn is 150 degrees. Two 90 degrees clockwise turns of the image result in 240 degrees clockwise total rotation and deviation from \"true up\" for two turns is 120 degrees because 240 degrees clockwise equal to 120 degrees counter-clockwise. Three 90 degrees clockwise turns of the image result in 330 degrees clockwise total rotation and deviation from \"true up\" for three turns is 30 degrees because 330 degrees clockwise equal to 30 degrees counter-clockwise.From 60, 150, 120 and 30 degrees deviations the smallest is 30, and it it achieved in three 90 degrees clockwise turns."}, "positive_code": [{"source_code": "#include\n#include\n\nlong long min(long long a, long long b){return a\nint main(){\n\tlong long n;\n\tscanf(\"%lld\",&n);\n\tn%=360;\n\tif (n<0) n+=360;\n\tif (n<=45 || n>=315) printf(\"0\");\n\telse if (n<=135) printf(\"1\");\n\telse if (n<=225) printf(\"2\");\n\telse printf(\"3\");\n printf(\"\\n\");\n return 0;\n}"}, {"source_code": "#include\n#include\n\nint main()\n{\n\tlong long int x;\n\tscanf(\"%lld\",&x);\n\tlong long int a=0;\n\tlong long int n=0;\n\tif(x<0)\n\t{\n\t\ta=(x%360+360)%360;\n\t\tif(a>=0&&a<=44)\n\t\t\tprintf(\"0\");\n\t\telse if(a==45)\n\t\t\tprintf(\"0\");\n\t\telse if(a>=46&&a<=134)\n\t\t\tprintf(\"1\");\n\t\telse if(a==135)\n\t\t\tprintf(\"1\");\n\t\telse if(a>=136&&a<=224)\n\t\t\tprintf(\"2\");\n\t\telse if(a==225)\n\t\t\tprintf(\"2\");\n\t\telse if(a>=226&&a<=314)\n\t\t\tprintf(\"3\");\n\t\telse if(a==315)\n\t\t\tprintf(\"0\");\n\t\telse if(a>=316&&a<=360)\n\t\t\tprintf(\"0\");\n\t}\n\telse if(x>=0)\n\t{\n\t\tn=(x%360+360)%360;\n\t\tif(n>=0&&n<=44)\n\t\t\tprintf(\"0\");\n\t\telse if(n==45)\n\t\t\tprintf(\"0\");\n\t\telse if(n>=46&&n<=134)\n\t\t\tprintf(\"1\");\n\t\telse if(n==135)\n\t\t\tprintf(\"1\");\n\t\telse if(n>=136&&n<=224)\n\t\t\tprintf(\"2\");\n\t\telse if(n==225)\n\t\t\tprintf(\"2\");\n\t\telse if(n>=226&&n<=314)\n\t\t\tprintf(\"3\");\n\t\telse if(n==315)\n\t\t\tprintf(\"0\");\n\t\telse if(n>=316&&n<=360)\n\t\t\tprintf(\"0\");\n\n\t}\n\treturn 0;\n\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n#define prime 1000000007\nint main()\n{\n\tlong long num,flag=0;\n\tscanf(\"%lli\",&num);\n\tif(num<0)\n\t{\n\t\tflag=1;\n\t\tnum=-1*num;\n\t}\n\tnum=num%360;\n\tif(flag==0)\n\t{\n\t\tif(num<=45)\n\t\t{\n\t\t\tprintf(\"0\\n\");\n\t\t}\n\t\telse if(num<=135)\n\t\t{\n\t\t\tprintf(\"1\\n\");\n\t\t}\n\t\telse if(num<=225)\n\t\t{\n\t\t\tprintf(\"2\\n\");\n\t\t}\n\t\telse if(num<315)\n\t\t{\n\t\t\tprintf(\"3\\n\");\n\t\t}\n\t\telse printf(\"0\\n\");\n\t}\n\telse if(flag==1)\n\t{\n\t\tif(num==135)\n\t\t\tprintf(\"2\\n\");\n\t\telse if(num==225)\n\t\t\tprintf(\"1\\n\");\n\t\telse if(num==315)\n\t\t\tprintf(\"0\\n\");\n\t\telse if(num<=45)\n\t\t{\n\t\t\tprintf(\"0\\n\");\n\t\t}\n\t\telse if(num<=135)\n\t\t{\n\t\t\tprintf(\"3\\n\");\n\t\t}\n\t\telse if(num<=225)\n\t\t{\n\t\t\tprintf(\"2\\n\");\n\t\t}\n\t\telse if(num<315)\n\t\t{\n\t\t\tprintf(\"1\\n\");\n\t\t}\n\t\telse printf(\"0\\n\");\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include \n\nint main() {\n\tlong long x;\n\tint cnt;\n\n\tscanf(\"%lld\", &x);\n\tif (x > 0)\n\t\tx %= 360;\n\telse\n\t\tx = (360 - (-x % 360)) % 360;\n\tcnt = 0;\n\tif ((x >= 315 && x < 360) || (x >= 0 && x <= 45))\n\t\tcnt = 0;\n\telse if (x >= 46 && x <= 135)\n\t\tcnt = 1;\n\telse if (x >= 136 && x <= 225)\n\t\tcnt = 2;\n\telse if (x >= 225 && x <= 315)\n\t\tcnt = 3;\n\tprintf(\"%d\\n\", cnt);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tlong long int n,a;\n\tscanf(\"%lld\",&n);\n\tif(n<0)\n\t{\n\t\ta=360+n%360;\n\t}\n\telse\n\t\ta=n%360;\n\tif(a>=0&&a<=45)\n\t\tprintf(\"0\");\n\telse if(a>=46&&a<=135)\n\t\tprintf(\"1\");\n\telse if(a>=136&&a<=225)\n\t\tprintf(\"2\");\n\telse if(a>=226&&a<=314)\n\t\tprintf(\"3\");\n\telse if(a>=315&&a<=360)\n\t\tprintf(\"0\");\n\n\treturn 0;\n\n}\n"}, {"source_code": "#include\nint main()\n{long long int n,m,i,j,k=0,l;\nscanf(\"%I64d\",&n);\nif(n>360||n<-360){\n if(n>0)\n { k=(n/360)*360;\n n=n-k;}\n if(n<0)\n {\n n=n*(-1);\n k=(n/360)*360;\n n=n-k;\n n=n*(-1);\n }\n\n}\n if(n>=0)\n {\n i=n/90;\n l=i+1;\n if((n-90*i)<=(l*90-n))\n j=i;\n else\n j=l;\n if(n>=315)\n j=0;\n }\n if(n<0)\n { k=n*(-1);\n n=(360+n);\n i=n/90;\n l=i+1;\n if((n-90*i)<=(l*90-n))\n j=i;\n else\n j=l;\n if(k<=45)\n j=0;\n\n\n}\nprintf(\"%I64d\",j);\n\n}"}, {"source_code": "#include \n\nint main()\n{\n\tlong long x, y, z = 180, i, j = 0;\n\tscanf(\"%I64d\", &x), x = x>=0 ? x%360 : 360+x%360, x = 360-x;\n\tfor (i = 0; i < 360; i += 90) {\n\t\ty = (x+i)%360>180 ? 360-(x+i)%360 : (x+i)%360;\n\t\tif (z > y) z = y, j = i/90;\n\t}\n\tprintf(\"%I64d\\n\", j);\n}\n"}, {"source_code": "#include\nint main()\n{long long int n,m,i,j,k=0,l;\nscanf(\"%I64d\",&n);\nif(n>360||n<-360){\n if(n>0)\n { k=(n/360)*360;\n n=n-k;}\n if(n<0)\n {\n n=n*(-1);\n k=(n/360)*360;\n n=n-k;\n n=n*(-1);\n }\n\n}\n if(n>=0)\n {\n i=n/90;\n l=i+1;\n if((n-90*i)<=(l*90-n))\n j=i;\n else\n j=l;\n if(n>=315)\n j=0;\n }\n if(n<0)\n { k=n*(-1);\n n=(360+n);\n i=n/90;\n l=i+1;\n if((n-90*i)<=(l*90-n))\n j=i;\n else\n j=l;\n if(k<=45)\n j=0;\n\n\n}\nprintf(\"%I64d\",j);\n\n}\n"}, {"source_code": "#include \n#include \n#include \n\n#define min(a,b) ((a)<(b) ? (a):(b))\n#define max(a,b) ((a)>(b) ? (a):(b))\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint main(){\n long long y, i, j, c, d, x, z, res, idx;\n\n while (scanf(\"%lld\", &y) != EOF){\n x = y % 360;\n if (x < 0) x += 360;\n\n if (x <= 45 || x >= 315) puts(\"0\");\n else if (x >= 46 && x <= 135) puts(\"1\");\n else if (x >= 136 && x <= 225) puts(\"2\");\n else puts(\"3\");\n }\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include\n#include\n\nint main(){\n\tlong long x;\n\tint res=0;\n\tscanf(\"%I64d\", &x);\n\tx%=360;\n\tx+=360;\n\tx%=360;\n\tif(360-x>(x+90)%360) for(;;++res, x-=90) if(llabs(x-90)>=x) break;\n\tprintf(\"%d\\n\", res);\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main(){\n\tlong long x;\n\tint res;\n\tscanf(\"%I64d\", &x);\n\tx%=360;\n\tx+=360;\n\tx%=360;\n\tfor(res=0;;++res, x-=90) if(llabs(x-90)>x) break;\n\tprintf(\"%d\\n\", res);\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main(){\n\tlong long x;\n\tint res;\n\tscanf(\"%I64d\", &x);\n\tx%=360;\n\tx+=360;\n\tx%=360;\n\tfor(res=0;;++res, x-=90) if(llabs(x-90)>=x) break;\n\tprintf(\"%d\\n\", res);\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main()\n{\n\tlong long int x;\n\tscanf(\"%lld\",&x);\n\tlong long int a=0;\n\tlong long int n=0;\n\tif(x<0)\n\t{\n\t\ta=(360+x)%360;\n\t\tif(a>=0&&a<=44)\n\t\t\tprintf(\"0\");\n\t\telse if(a==45)\n\t\t\tprintf(\"0\");\n\t\telse if(a>=46&&a<=134)\n\t\t\tprintf(\"1\");\n\t\telse if(a==135)\n\t\t\tprintf(\"1\");\n\t\telse if(a>=136&&a<=224)\n\t\t\tprintf(\"2\");\n\t\telse if(a==225)\n\t\t\tprintf(\"2\");\n\t\telse if(a>=226&&a<=314)\n\t\t\tprintf(\"3\");\n\t\telse if(a==315)\n\t\t\tprintf(\"0\");\n\t\telse if(a>=316&&a<=360)\n\t\t\tprintf(\"0\");\n\t}\n\telse if(x>=0)\n\t{\n\t\tn=x%360;\n\t\tif(n>=0&&n<=44)\n\t\t\tprintf(\"0\");\n\t\telse if(n==45)\n\t\t\tprintf(\"0\");\n\t\telse if(n>=46&&n<=134)\n\t\t\tprintf(\"1\");\n\t\telse if(n==135)\n\t\t\tprintf(\"1\");\n\t\telse if(n>=136&&n<=224)\n\t\t\tprintf(\"2\");\n\t\telse if(n==225)\n\t\t\tprintf(\"2\");\n\t\telse if(n>=226&&n<=314)\n\t\t\tprintf(\"3\");\n\t\telse if(n==315)\n\t\t\tprintf(\"0\");\n\t\telse if(n>=316&&n<=360)\n\t\t\tprintf(\"0\");\n\n\t}\n\treturn 0;\n\n}\n"}, {"source_code": "#include\n#include\n\nint main()\n{\n long long int x;\n scanf(\"%lld\",&x);\n long long int a=0;\n if(x<0)\n {\n a=360+x;\n if(a>=0&&a<=44)\n printf(\"0\");\n else if(a==45)\n printf(\"0\");\n else if(a>=46&&a<=134)\n printf(\"1\");\n else if(a==135)\n printf(\"1\");\n else if(a>=136&&a<=224)\n printf(\"2\");\n else if(a==225)\n printf(\"2\");\n else if(a>=226&&a<=314)\n printf(\"3\");\n else if(a==315)\n printf(\"0\");\n else if(a>=316&&a<=360)\n printf(\"0\");\n }\n else if(x>=0)\n {\n \n if(x>=0&&x<=44)\n printf(\"0\");\n else if(x==45)\n printf(\"0\");\n else if(x>=46&&x<=134)\n printf(\"1\");\n else if(x==135)\n printf(\"1\");\n else if(x>=136&&x<=224)\n printf(\"2\");\n else if(x==225)\n printf(\"2\");\n else if(x>=226&&x<=314)\n printf(\"3\");\n else if(x==315)\n printf(\"0\");\n else if(x>=316&&x<=360)\n printf(\"0\");\n \n }\n return 0;\n \n}"}, {"source_code": "#include\n#include\n#include\n#include\n#define prime 1000000007\nint main()\n{\n\tlong long num,flag=0;\n\tscanf(\"%lli\",&num);\n\tif(num<0)\n\t{\n\t\tflag=1;\n\t\tnum=-1*num;\n\t}\n\tnum=num%360;\n\tif(flag==0)\n\t{\n\t\tif(num<45)\n\t\t{\n\t\t\tprintf(\"0\\n\");\n\t\t}\n\t\telse if(num<135)\n\t\t{\n\t\t\tprintf(\"1\\n\");\n\t\t}\n\t\telse if(num<225)\n\t\t{\n\t\t\tprintf(\"2\\n\");\n\t\t}\n\t\telse if(num<315)\n\t\t{\n\t\t\tprintf(\"3\\n\");\n\t\t}\n\t\telse printf(\"0\\n\");\n\t}\n\telse if(flag==1)\n\t{\n\t\tif(num<45)\n\t\t{\n\t\t\tprintf(\"0\\n\");\n\t\t}\n\t\telse if(num<135)\n\t\t{\n\t\t\tprintf(\"3\\n\");\n\t\t}\n\t\telse if(num<225)\n\t\t{\n\t\t\tprintf(\"2\\n\");\n\t\t}\n\t\telse if(num<315)\n\t\t{\n\t\t\tprintf(\"1\\n\");\n\t\t}\n\t\telse printf(\"0\\n\");\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include\n#include\n#include\n#include\n#define prime 1000000007\nint main()\n{\n\tlong long num,flag=0;\n\tscanf(\"%lli\",&num);\n\tif(num<0)\n\t{\n\t\tflag=1;\n\t\tnum=-1*num;\n\t}\n\tnum=num%360;\n\tif(flag==0)\n\t{\n\t\tif(num<=45)\n\t\t{\n\t\t\tprintf(\"0\\n\");\n\t\t}\n\t\telse if(num<=135)\n\t\t{\n\t\t\tprintf(\"1\\n\");\n\t\t}\n\t\telse if(num<=225)\n\t\t{\n\t\t\tprintf(\"2\\n\");\n\t\t}\n\t\telse if(num<315)\n\t\t{\n\t\t\tprintf(\"3\\n\");\n\t\t}\n\t\telse printf(\"0\\n\");\n\t}\n\telse if(flag==1)\n\t{\n\t\tif(num<=45)\n\t\t{\n\t\t\tprintf(\"0\\n\");\n\t\t}\n\t\telse if(num<=135)\n\t\t{\n\t\t\tprintf(\"3\\n\");\n\t\t}\n\t\telse if(num<=225)\n\t\t{\n\t\t\tprintf(\"2\\n\");\n\t\t}\n\t\telse if(num<315)\n\t\t{\n\t\t\tprintf(\"1\\n\");\n\t\t}\n\t\telse printf(\"0\\n\");\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include\n#include\n#include\n#include\n#define prime 1000000007\nint main()\n{\n\tlong long num,flag=0;\n\tscanf(\"%lli\",&num);\n\tif(num<0)\n\t{\n\t\tflag=1;\n\t\tnum=-1*num;\n\t}\n\tnum=num%360;\n\tif(flag==0)\n\t{\n\t\tif(num<=45)\n\t\t{\n\t\t\tprintf(\"0\\n\");\n\t\t}\n\t\telse if(num<=135)\n\t\t{\n\t\t\tprintf(\"1\\n\");\n\t\t}\n\t\telse if(num<=225)\n\t\t{\n\t\t\tprintf(\"2\\n\");\n\t\t}\n\t\telse if(num<=315)\n\t\t{\n\t\t\tprintf(\"3\\n\");\n\t\t}\n\t\telse printf(\"0\\n\");\n\t}\n\telse if(flag==1)\n\t{\n\t\tif(num<=45)\n\t\t{\n\t\t\tprintf(\"0\\n\");\n\t\t}\n\t\telse if(num<=135)\n\t\t{\n\t\t\tprintf(\"3\\n\");\n\t\t}\n\t\telse if(num<=225)\n\t\t{\n\t\t\tprintf(\"2\\n\");\n\t\t}\n\t\telse if(num<=315)\n\t\t{\n\t\t\tprintf(\"1\\n\");\n\t\t}\n\t\telse printf(\"0\\n\");\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include\n#include\n#include\n#include\n#define prime 1000000007\nint main()\n{\n\tlong long num,flag=0;\n\tscanf(\"%lli\",&num);\n\tif(num<0)\n\t{\n\t\tflag=1;\n\t\tnum=-1*num;\n\t}\n\tnum=num%360;\n\tif(flag==0)\n\t{\n\t\tif(num<=45)\n\t\t{\n\t\t\tprintf(\"0\\n\");\n\t\t}\n\t\telse if(num<=135)\n\t\t{\n\t\t\tprintf(\"1\\n\");\n\t\t}\n\t\telse if(num<=225)\n\t\t{\n\t\t\tprintf(\"2\\n\");\n\t\t}\n\t\telse if(num<315)\n\t\t{\n\t\t\tprintf(\"3\\n\");\n\t\t}\n\t\telse printf(\"0\\n\");\n\t}\n\telse if(flag==1)\n\t{\n\t\tif(num==135)\n\t\t\tprintf(\"2\\n\");\n\t\telse if(num<=45)\n\t\t{\n\t\t\tprintf(\"0\\n\");\n\t\t}\n\t\telse if(num<=135)\n\t\t{\n\t\t\tprintf(\"3\\n\");\n\t\t}\n\t\telse if(num<=225)\n\t\t{\n\t\t\tprintf(\"2\\n\");\n\t\t}\n\t\telse if(num<315)\n\t\t{\n\t\t\tprintf(\"1\\n\");\n\t\t}\n\t\telse printf(\"0\\n\");\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include \n\nint main()\n{\n\tlong long x, y, z = 180, i, j = 0;\n\tscanf(\"%I64d\", &x), x = x>=0 ? x%360 : 360+x%360;\n\tfor (i = 0; i < 360; i += 90) {\n\t\ty = (x+i)%360>180 ? 360-(x+i)%360 : (x+i)%360;\n\t\tif (z > y) z = y, j = i/90;\n\t}\n\tprintf(\"%I64d\\n\", (4-j)%4);\n}\n"}, {"source_code": "#include\nint main()\n{long long int n,m,i,j,k=0,l;\nscanf(\"%I64d\",&n);\nif(n>360||n<-360){\n if(n<0)\n { k=(n/360)*360;\n n=n-(n/360)*360;\n if(n>0)\n {\n n=n*(-1);\n n=n-(n/360)*360;\n n=n*(-1);\n }\n }\n\n }\n if(n>=0)\n {\n i=n/90;\n l=i+1;\n if((n-90*i)<=(l*90-n))\n j=i;\n else\n j=l;\n if(n==315)\n j=0;\n }\n if(n<0)\n { n=(360+n);\n i=n/90;\n l=i+1;\n if((n-90*i)<=(l*90-n))\n j=i;\n else\n j=l;\n\n\n}\n\n\nprintf(\"%I64d\",j+k);\n}\n"}, {"source_code": "#include\nint main()\n{long long int n,m,i,j,k=0,l;\nscanf(\"%I64d\",&n);\nif(n>360||n<-360){\n if(n<0)\n { k=(n/360)*360;\n n=n-(n/360)*360;\n if(n>0)\n {\n n=n*(-1);\n n=n-(n/360)*360;\n n=n*(-1);\n }\n }\n\n }\n if(n>=0)\n {\n i=n/90;\n l=i+1;\n\n if((n-90*i)<=(l*90-n))\n j=i;\n else\n j=l;\n }\n if(n<0)\n { n=(360+n);\n i=n/90;\n l=i+1;\n if((n-90*i)<=(l*90+n))\n j=i;\n else\n j=l;\n\n}\n\n\nprintf(\"%I64d\",j+k);\n}\n"}, {"source_code": "#include\nint main()\n{long long int n,m,i,j,k=0,l;\nscanf(\"%I64d\",&n);\nif(n>360||n<-360){\n if(n<0)\n { k=(n/360)*360;\n n=n-(n/360)*360;\n if(n>0)\n {\n n=n*(-1);\n n=n-(n/360)*360;\n n=n*(-1);\n }\n }\n\n }\n if(n>=0)\n {\n i=n/90;\n l=i+1;\n\n if((n-90*i)<(l*90-n))\n j=i;\n else\n j=l;\n }\n if(n<0)\n { n=(360+n);\n i=n/90;\n l=i+1;\n if((n-90*i)<(l*90+n))\n j=i;\n else\n j=l;\n\n}\n\n\nprintf(\"%I64d\",j+k);\n}\n"}, {"source_code": "#include\nint main()\n{long long int n,m,i,j,k=0,l;\nscanf(\"%I64d\",&n);\nif(n>360||n<-360){\n if(n>0)\n { k=(n/360)*360;\n n=n-k;\n if(n<0)\n {\n n=n*(-1);\n n=n-(n/360)*360;\n n=n*(-1);\n }\n }\n\n }\n if(n>=0)\n {\n i=n/90;\n l=i+1;\n if((n-90*i)<=(l*90-n))\n j=i;\n else\n j=l;\n if(n>=315)\n j=0;\n }\n if(n<0)\n { k=n*(-1);\n n=(360+n);\n i=n/90;\n l=i+1;\n if((n-90*i)<=(l*90-n))\n j=i;\n else\n j=l;\n if(k<=45)\n j=0;\n\n\n}\nprintf(\"%I64d\",j);\n\n}\n"}, {"source_code": "#include\nint main()\n{long long int n,m,i,j,k=0,l;\nscanf(\"%I64d\",&n);\nif(n>360||n<-360){\n if(n<0)\n { k=(n/360)*360;\n n=n-(n/360)*360;\n if(n>0)\n {\n n=n*(-1);\n n=n-(n/360)*360;\n n=n*(-1);\n }\n }\n\n }\n if(n>=0)\n {\n i=n/90;\n l=i+1;\n if((n-90*i)<=(l*90-n))\n j=i;\n else\n j=l;\n if(n>=315)\n j=0;\n }\n if(n<0)\n { n=(360+n);\n i=n/90;\n l=i+1;\n if((n-90*i)<=(l*90+n))\n j=i;\n else\n j=l;\n\n\n}\n\n\nprintf(\"%I64d\",j+k);\n}\n"}, {"source_code": "#include\nint main()\n{int i,j,k,n;\nscanf(\"%d\",&n);\nif(n==0)\n{\n j=0;\n}\nelse if(n<0)\n {n=(-1)*n;\n j=(360-n)/90;}\n else\n{ if(n<90)\n j=90/n;\n else\n j=n/90;\n}\nprintf(\"%d\",j);\n}\n"}, {"source_code": "#include\nint main()\n{long long int n,m,i,j,k=0,l;\nscanf(\"%I64d\",&n);\nif(n>360||n<-360){\n if(n>0)\n { k=(n/360)*360;\n n=n-k;\n if(n<0)\n {\n n=n*(-1);\n n=n-(n/360)*360;\n n=n*(-1);\n }\n }\n\n }\n if(n>=0)\n {\n i=n/90;\n l=i+1;\n if((n-90*i)<=(l*90-n))\n j=i;\n else\n j=l;\n if(n>=315)\n j=0;\n }\n if(n<0)\n { n=(360+n);\n i=n/90;\n l=i+1;\n if((n-90*i)<=(l*90+n))\n j=i;\n else\n j=l;\n\n\n}\nprintf(\"%I64d\",j);\n\n}\n"}, {"source_code": "#include\nint main()\n{long long int n,m,i,j,k=0,l;\nscanf(\"%I64d\",&n);\nif(n>360||n<-360){\n if(n<0)\n { k=(n/360)*360;\n n=n-(n/360)*360;\n if(n>0)\n {\n n=n*(-1);\n n=n-(n/360)*360;\n n=n*(-1);\n }\n }\n\n }\n if(n>=0)\n {\n i=n/90;\n l=i+1;\n if((n-90*i)==(l*90-n))\n j=0;\n else if((n-90*i)<(l*90-n))\n j=i;\n else\n j=l;\n }\n if(n<0)\n { n=(360+n);\n i=n/90;\n l=i+1;\n if((n-90*i)==(l*90+n))\n j=0;\n if((n-90*i)<(l*90+n))\n j=i;\n else\n j=l;\n\n}\n\n\nprintf(\"%I64d\",j+k);\n}\n"}, {"source_code": "#include\nint main()\n{long long int n,m,i,j,k=0,l;\nscanf(\"%I64d\",&n);\nif(n>360||n<-360){\n if(n<0)\n { k=(n/360)*360;\n n=n-(n/360)*360;\n if(n>0)\n {\n n=n*(-1);\n n=n-(n/360)*360;\n n=n*(-1);\n }\n }\n\n }\n if(n>=0)\n {\n i=n/90;\n l=i+1;\n if((n-90*i)<=(l*90-n))\n j=i;\n else\n j=l;\n if(n==315)\n j=0;\n }\n if(n<0)\n { n=(360+n);\n i=n/90;\n l=i+1;\n if((n-90*i)<=(l*90+n))\n j=i;\n else\n j=l;\n\n\n}\n\n\nprintf(\"%I64d\",j+k);\n}\n"}, {"source_code": "#include\nint main()\n{long long int n,m,i,j,k=0,l;\nscanf(\"%I64d\",&n);\nif(n>360||n<-360){\n if(n>0)\n { k=(n/360)*360;\n n=n-k;\n if(n<0)\n {\n n=n*(-1);\n n=n-(n/360)*360;\n n=n*(-1);\n }\n }\n\n }\n if(n>=0)\n {\n i=n/90;\n l=i+1;\n if((n-90*i)<=(l*90-n))\n j=i;\n else\n j=l;\n if(n>=315)\n j=0;\n }\n if(n<0)\n { k=n*(-1);\n n=(360+n);\n i=n/90;\n l=i+1;\n if((n-90*i)<=(l*90+n))\n j=i;\n else\n j=l;\n if(k<=45)\n j=0;\n\n\n}\nprintf(\"%I64d\",j);\n\n}\n"}, {"source_code": "#include \n#include \n#include \n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nlong long fucks(long long x){\n if (x >= 0) return x;\n return -x;\n}\n\nint main(){\n long long y, i, j, c, d, x;\n\n while (scanf(\"%lld\", &y) != EOF){\n x = fucks(y) % 360;\n if (y < 0) x = -x;\n if (x < 0) x += 360;\n\n long long res = 0, min = 1010;\n for (i = 0; i <= 100; i++){\n d = (i * 90) % 360;\n c = fucks(d - x);\n if (c < min) min = c, res = i;\n }\n\n if ((y % 360) == 0) res = 0;\n printf(\"%lld\\n\", res);\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\n#define min(a,b) ((a)<(b) ? (a):(b))\n#define max(a,b) ((a)>(b) ? (a):(b))\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nlong long fucks(long long x){\n if (x >= 0) return x;\n return -x;\n}\n\nint main(){\n long long y, i, j, c, d, x, z, res, idx;\n\n while (scanf(\"%lld\", &y) != EOF){\n x = fucks(y) % 360;\n if (y < 0) x = 360 - x;\n\n res = 1LL << 60;\n for (i = 0; i <= 10000; i++){\n c = fucks(360 - x);\n d = fucks(180 - x);\n z = min(c, d);\n if (z < res) res = z, idx = i;\n x = (x + 90) % 360;\n }\n\n printf(\"%lld\\n\", idx);\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint main(){\n long long y;\n int i, j, c, d, x;\n\n while (scanf(\"%lld\", &y) != EOF){\n x = llabs(y) % 360;\n if (y < 0) x = -x;\n if (x < 0) x += 360;\n\n int res = 0, min = 1010;\n for (i = 0; i <= 100; i++){\n d = (i * 90) % 360;\n c = abs(d - x);\n if (c < min) min = c, res = i;\n }\n\n printf(\"%d\\n\", res);\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nlong long fucks(long long x){\n if (x >= 0) return x;\n return -x;\n}\n\nint main(){\n long long y, i, j, c, d, x;\n\n while (scanf(\"%lld\", &y) != EOF){\n x = fucks(y) % 360;\n if (y < 0) x = -x;\n if (x < 0) x += 360;\n\n long long res = 0, min = 1010;\n for (i = 0; i <= 100; i++){\n d = (i * 90) % 360;\n if (d <= x) c = (360 - d) + x;\n else c = fucks(x - d);\n if (c < min) min = c, res = i;\n }\n\n if ((y % 360) == 0) res = 0;\n printf(\"%lld\\n\", res);\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\n#define min(a,b) ((a)<(b) ? (a):(b))\n#define max(a,b) ((a)>(b) ? (a):(b))\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nlong long fucks(long long x){\n if (x >= 0) return x;\n return -x;\n}\n\nint main(){\n long long y, i, j, c, d, x, z, res, idx;\n\n while (scanf(\"%lld\", &y) != EOF){\n x = fucks(y) % 360;\n if (y < 0) x = 360 - x;\n\n res = 1LL << 60;\n for (i = 0; i <= 10000; i++){\n c = fucks(360 - x);\n d = fucks(180 - x);\n c = d;\n z = min(c, d);\n if (x == 0) z = 0;\n if (z < res) res = z, idx = i;\n x = (x + 90) % 360;\n }\n\n printf(\"%lld\\n\", idx);\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\n#define min(a,b) ((a)<(b) ? (a):(b))\n#define max(a,b) ((a)>(b) ? (a):(b))\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nlong long fucks(long long x){\n if (x >= 0) return x;\n return -x;\n}\n\nint main(){\n long long y, i, j, c, d, x, z, res, idx;\n\n while (scanf(\"%lld\", &y) != EOF){\n x = fucks(y) % 360;\n if (y < 0) x = 360 - x;\n\n res = 1LL << 60;\n for (i = 0; i <= 10000; i++){\n c = fucks(360 - x);\n d = fucks(180 - x);\n z = min(c, d);\n if (x == 0) z = 0;\n if (z < res) res = z, idx = i;\n x = (x + 90) % 360;\n }\n\n printf(\"%lld\\n\", idx);\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint main(){\n long long y, i, j, c, d, x, z;\n\n while (scanf(\"%lld\", &y) != EOF){\n x = llabs(y) % 360;\n z = llabs(y) / 360;\n if (y < 0) x = -x;\n if (x < 0) x += 360;\n\n long long res = 0, min = 1000010;\n for (i = 0; i <= 100000; i++){\n d = (i * 90) % 360;\n c = llabs(d - x) + (z * 4);\n if (c < min) min = c, res = i;\n }\n\n printf(\"%lld\\n\", res);\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nlong long fucks(long long x){\n if (x >= 0) return x;\n return -x;\n}\n\nint main(){\n long long y, i, j, c, d, x;\n\n while (scanf(\"%lld\", &y) != EOF){\n x = fucks(y) % 360;\n if (y < 0) x = -x;\n if (x < 0) x += 360;\n\n long long res = 0, min = 1010;\n for (i = 0; i <= 100; i++){\n d = (i * 90) % 360;\n c = fucks(d - x);\n if (c < min) min = c, res = i;\n }\n\n printf(\"%lld\\n\", res);\n }\n return 0;\n}\n"}], "src_uid": "509db9cb6156b692557ba874a09f150e"} {"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.Petya calls a number almost lucky if it could be evenly divided by some lucky number. Help him find out if the given number n is almost lucky.", "input_spec": "The single line contains an integer n (1 ≤ n ≤ 1000) — the number that needs to be checked.", "output_spec": "In the only line print \"YES\" (without the quotes), if number n is almost lucky. Otherwise, print \"NO\" (without the quotes).", "sample_inputs": ["47", "16", "78"], "sample_outputs": ["YES", "YES", "NO"], "notes": "NoteNote that all lucky numbers are almost lucky as any number is evenly divisible by itself.In the first sample 47 is a lucky number. In the second sample 16 is divisible by 4."}, "positive_code": [{"source_code": "#include \n#include \n#include \n\nint main(){\nint n,m=1;\nint ones,tens,hundreds;\nscanf(\"%d\",&n);\nif(n==799 || n==94||n==141){printf(\"YES\");m=0;}\nif(n<1||n>1000)return 0;\nones=n%10;\ntens=(n%100)/10;\nhundreds=(n-(n%100))/100;\n\nif(n<10&&(ones==4||ones==7))printf(\"YES\");\nelse if(n<100&&(ones==4||ones==7)&&(tens==4||tens==7))printf(\"YES\");\nelse if((ones==4||ones==7)&&(tens==4||tens==7)&&(hundreds==4||hundreds==7))printf(\"YES\");\nelse if((n%4)==0 || (n%7)==0)printf(\"YES\");\nelse if(m==1) printf(\"NO\");\n\nreturn 0;}\n\n\n"}, {"source_code": "#include\nint main()\n{\n int n,i,j,len;\n scanf(\"%d\",&n);\n if(n%4==0 || n%7==0 || n%47==0 || n%74==0 || n%77==0 || n%447==0 || n%474==0 || n%477==0 || n%747==0 || n%774==0 ){\n printf(\"YES\");\n }\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n=0;\n scanf(\"%d\",&n);\n int arr[]={47,447,477};\n if(n%4==0)\n {\n printf(\"YES\");\n return 0;\n }\n if(n%7==0 || n%arr[0]==0 || n%arr[1]==0 || n%arr[2]==0)\n {\n printf(\"YES\");\n return 0;\n }\n int flag=0,i=0;\n int x=n;\n while(x>0)\n {\n x=x/10;\n i++;\n }\n x=n;\n \n for(int j=0;j\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n%4==0||n%7==0||n%47==0||n%74==0||n%44==0||n%77==0||n%444==0||n%447==0||n%474==0||n%744==0||n%477==0||n%747==0||n%777==0||n%774==0)\n {\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n}\n"}, {"source_code": "main()\n{\n int n;\n scanf(\"%d\", &n);\n\n if(n%4==0 || n%7==0 || n%47==0 || n%74==0 || n%477==0 || n%474==0 || n%747==0 || n%774==0)\n printf(\"YES\");\nelse\n printf(\"NO\");\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int a[10],n,i=0,b=0,f=0,s=0,nu,c;\n scanf(\"%d\",&c);\n n=c;\n while(n!=0)\n {\n a[i]=n%10;\n n=n/10;\n if(a[i]==4||a[i]==7)\n {\n f++;\n }\n else{f=0;}\n i++;\n }\n nu=c;\n if(nu%4==0||nu%7==0)\n {\n b=2;\n }\n if((f==i)||b==2||c==799||c==94||c==141)\n {\n printf(\"YES\");\n }\n else{printf(\"NO\");\n }\n return 0;\n\n}\n"}, {"source_code": "#include \n#include \n\nint main(){\n\nint n,digit,counter1=0,m,a=0,i,k,counter2=0,lol,p,potato,potato_counter=0,tomato_counter=0,d;\nint s[1000];\n\n\nscanf(\"%d\",&n);\nif(n%7==0 || n%4==0){\n printf(\"YES\");\n return 0;\n}\npotato=n;\nfor(p=0;potato!=0;p++){\n d=potato%10;\n potato=potato/10;\n if(d==7 || d==4)\n potato_counter++;\n tomato_counter++;\n}\nif(potato_counter==tomato_counter)\n{\n printf(\"YES\");\n return 0;\n}\n\n\nfor(i=1;i<=n;i++){\n m=i;\n for(k=0;m!=0;k++){\n digit=m%10;\n m=m/10;\n\n if(digit == 4 || digit == 7){\n counter1++;\n }\n\ncounter2++;\n }\n if(counter1==counter2){\n s[a]=i;\n a++;\n }\n counter1=0;\n counter2=0;\n}\n\nfor(lol=0;lol\n\n\nint main ()\n\n{\n\n int n;\n\n scanf(\"%d\", &n);\n\n\n if(((n % 4) == 0) || ((n % 7) == 0) || ((n % 44) == 0) || ((n % 47) == 0) | ((n % 74) == 0) || ((n %\n\n 444) == 0) || ((n % 447) == 0) || ((n % 474) == 0) || ((n % 477) == 0))\n\n {\n\n printf(\"YES\\n\");\n\n }\n\n\n else\n\n {\n\n printf(\"NO\\n\");\n\n }\n\n\n return 0;\n\n}"}, {"source_code": "#include\nint main()\n{\n\tint a,b;\nloop:while(scanf(\"%d\",&a)!=EOF)\n\t{\n\t\tint flag=0;\n\t\tb=a;\n\t\twhile(a>0)\n\t\t{\n\t\t\tif(a%10!=4&&a%10!=7)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ta/=10;\n\t\t}\n\t\ta=b;\n\t\tif(!flag)\n\t\t{\n\t\t\tprintf(\"YES\\n\");\n\t\t\tgoto loop;\n\t\t}\n\t\tif(a%4==0||a%7==0||a%44==0||a%47==0||a%74==0||a%77==0||a%444==0||a%447==0||a%474==0||a%477==0)\n\t\t{\n\t\t\tprintf(\"YES\\n\");\n\t\t\tgoto loop;\n\t\t}\n\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}\n \t\t \t \t\t\t\t\t\t \t \t\t \t"}, {"source_code": "#include\n#include\n\nmain(){\n\tint num,temp,truth=1;\n\tscanf(\"%d\",&num);\n\tint dig=num;\n\n\tfor(int i=0;num>0;i++){\n\t\ttemp=num%10;\n\t\tnum/=10;\t\n\t\tif(temp!=4 && temp%10!=7){\n\t\t\ttruth=0;\n\t\t}\n\t\tnum/=10;\n\t\t//printf(\"%d\\n\",truth );\n\n\t}\n\tif(truth==1 ){\n\t\tprintf(\"YES\\n\");\n\t}\n\telse{\n\t\tif(dig%4==0 || dig%7==0 || dig%47==0 || dig%74==0){\n\t\t\tprintf(\"YES\\n\");}\n\t\t\telse{\n\t\t\t\tprintf(\"NO\\n\");\n\t\t\t}\n\t\t}\n\t\n\n}"}, {"source_code": "#include\n\n\nint main()\n\n{\n int n;\n\n scanf(\"%d\", &n);\n\n if(((n % 4) == 0) || ((n % 7) == 0) || ((n % 44) == 0) || ((n % 47) == 0) | ((n % 74) == 0) || ((n %\n\n 444) == 0) || ((n % 447) == 0) || ((n % 474) == 0) || ((n % 477) == 0))\n\n {\n\n printf(\"YES\\n\");\n\n }\n\n else\n {\n\n printf(\"NO\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int j=0,i,z,x,y[100],n,m;\n i=0;\n z=0;\n scanf(\"%d\",&x);\n if(x<10)\n {\n if(x==4||x==7)\n printf(\"YES\\n\");\n else\n {\n if((x%4)==0||(x%7)==0)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n }\n else{\n n=x;\n //printf(\"n==%d\",n);\n y[i]=n%10;\n //printf(\"y[i]=%d\",y[i]);\n n=n/10;\n //printf(\"n==%d\",n);\n while(n!=0)\n {\n\n i++;\n y[i]=n%10;\n //printf(\"y[i]=%d\",y[i]);\n n=n/10;\n z=z+1;\n }\n //printf(\"z=%d\",z);\n for(i=0;i<=z;i++)\n {\n // printf(\"y[i]=%d\",y[i]);\n if((y[i]==4||y[i]==7)&&j==0)\n {\n j=0;\n }\n else\n j=1;\n }\n //printf(\"j=%d\",j);\n if(j==0)\n printf(\"YES\\n\");\n else if(j==1)\n {\n if((x%4)==0||(x%7)==0||(x%44)==0||(x%77)==0||(x%47)==0||(x%74)==0)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n\n if(n%4==0 || n%7==0 || n%44==0 || n%47==0 || n%74==0 || n%77==0 || n%444==0 || n%447==0 || n%474==0 || n%477==0)\n printf(\"YES\\n\");\n\n else if(n==4 || n==7 || n==44 || n==47 || n==74 || n==77 || n==444 || n==447 || n==474 || n==477 || n==744 || n==747 || n==774 || n==777)\n printf(\"YES\\n\");\n\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main(int argc, char **argv)\n{\n int mas_schast[9]={4,7,47,74,447,474,477,747,774}, i, n, b;\n i=b=n=0;\n scanf(\"%d\",&n);\n for (i=0;i<9;i++)\n {\n if (n%mas_schast[i]==0) b=1;\n }\n if (b==1) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include\nint main ()\n{\n int n, a,c=0;\n\n while(scanf(\"%d\", &n)!=EOF)\n {\n if(n%4==0 || n%7==0 || n%44==0 || n%47==0 || n%77==0 || n%444==0 || n%447==0 || n%474==0 || n%744==0 || n%477==0 || n%747==0 || n%774==0 || n%777==0)c=2;\n\n else\n {\n\n while(n!=0)\n {\n if(n%10==4 || n%10==7)\n c=2;\n\n else\n {\n\n c=0; break;\n }\n n=n/10;\n }\n }\n\n if(c==2)printf(\"YES\\n\");\n else printf(\"NO\\n\"); c=0;\n }\n}\n"}, {"source_code": "#include\nint main ()\n\n{\n\n int n;\n scanf(\"%d\", &n);\n if(((n % 4) == 0) || ((n % 7) == 0) || ((n % 44) == 0) || ((n % 47) == 0) | ((n % 74) == 0) || ((n %\n\n 444) == 0) || ((n % 447) == 0) || ((n % 474) == 0) || ((n % 477) == 0))\n\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n \n }\n return 0;\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,i=0;\n scanf(\"%d\",&n);\n int a[]={4,7,44,47,74,77,444,447,474,477,744,747,774,777,999};\n while(a[i]<999)\n {\n if(n==a[i])\n break;\n else\n i++;\n }\n if(a[i]<999)\n printf(\"YES\");\n else\n {\n i=0;\n while(n>=a[i]&&a[i]!=777)\n {\n if(n%a[i]==0)\n break;\n else\n i++;\n }\n if(a[i]!=777&&n>=a[i])\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n char s[5];\n int len,i,sum=0,a=0,j,b,c=1;\n scanf(\"%s\",s);\n len=strlen(s);\n if(strcmp(s,\"799\")==0||strcmp(s,\"94\")==0||strcmp(s,\"141\")==0){\n printf(\"YES\\n\");\n return 0;\n }\n for(i=0;i\nint main() \n { int a; scanf(\"%d\",&a); \n if(a==47||a==74||a==44||a==77|| a==444||a==447||a==474||a==477||a==744||a==747||a==774||a==777) printf(\"YES\"); \n else if( a%47==0||a%74==0||a%44==0||a%77==0||a%444==0||a%447==0||a%474==0||a%477==0||a%744==0||a%747==0||a%774==0||a%777==0||a%4==0||a%7==0) printf(\"YES\"); \n else if(a%7!=0||a%4!=0) printf(\"NO\"); \n }"}, {"source_code": "#include\n#include\nint main()\n{\n char s[5];\n int len,i,sum=0,a=0,j,b,c=1;\n scanf(\"%s\",s);\n len=strlen(s);\n if(strcmp(s,\"799\")==0||strcmp(s,\"94\")==0||strcmp(s,\"141\")==0){\n printf(\"YES\\n\");\n return 0;\n }\n for(i=0;i\nint main(){\n\tint n,a,b,c,d;\n\tscanf(\"%d\",&n);\n\ta=n%10;\n\tb=(n/10)%10;\n\tc=(n/100)%10;\n\td=(n/1000)%10;\n\tif(n%4==0 || n%7==0)\n\tprintf(\"YES\\n\");\n\tif(n==141)\n\tprintf(\"YES\");\n\tif(n==94){\n\t\tprintf(\"YES\");\n\t}\n\tif(n==799){\n\t\tprintf(\"YES\");\n\t}\n\tif(n==274){\n\tprintf(\"NO\");\n\t}\n\telse if((a==4||b==4||c==4||d==4 )&&(a==7|| b==7||c==7||d==7))\n\tprintf(\"YES\\n\");\n\telse if(!(n%4==0 || n%7==0)&& n!=799&&n!=94&&n!=141)\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n%4==0||n%7==0||n%47==0||n%74==0||n%4==0||n%447==0||n%474==0||n%744==0||n%477==0||n%774==0||n%747==0||n%777==0||n%444==0||n%44==0||n%77==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\nint main()\n{\n int x,flag=0,i,temp;\n scanf(\"%d\",&x);\n if(x%4==0||x%7==0||x%47==0||x%74==0||x%444==0||x%447==0||x%474==0)\n {\n printf(\"YES\");\n return 0;\n }\n for(i=0;x>0;i++)\n {\n temp=x%10;\n if(temp==4||temp==7)\n flag=1;\n else\n {\n flag=0;\n break;\n }\n x=x/10;\n }\n if(flag==1)\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n}\n"}, {"source_code": "#include\n\nint islucky(int n){\n int i=0;\n while(n!=0){\n if(n%10==7||n%10==4){\n i=0;\n }\n else\n {\n i=1;\n break;\n }\n n=n/10;\n }\n if(i==0)\n return 1;\n else\n return 0;\n}\n\nint main(){\nunsigned int n;\nscanf(\"%d\",&n);\nint i,j=1;\nfor(i=1;i<=n;i++){\n if(islucky(i)){\n if(n%i == 0){\n j=0;\n break;\n }\n else{\n j=1;}\n }\n j=1;\n}\nif(j==1)\nprintf(\"NO\");\nelse\nprintf(\"YES\");\n \n}"}, {"source_code": "#include\nint main()\n{\n int n,i,j,len;\n scanf(\"%d\",&n);\n if(n%4==0 || n%7==0 || n%47==0 || n%74==0 || n%77==0 || n%447==0 || n%474==0 || n%477==0 || n%747==0 || n%774==0 ){\n printf(\"YES\");\n }\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int i,n,arr[14]= {4,7,44,47,74,77,444,447,474,477,744,747,774,777};\n scanf(\"%d\",&n);\n for(i=0; i<14; i++)\n {\n if(n%arr[i]==0){\n printf(\"YES\");\n break;\n }\n }\n if(i==14)printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include\nint main ()\n{\n int n,i,j=0,k,rem,res ,l,m ;\n\n scanf(\"%d\",&n) ;\n i=n ;\n\n res=n/10 ;\n rem = n%10 ;\n l= res/10 ;\n m=res%10 ;\n\n // printf(\"%d%d\",m,rem) ;\n\n\n if( rem==7&&m==4||m==7&&rem==7||rem==4&&m==4)\n {\n printf(\"YES\") ;\n }\n else if (i%4==0||i%7==0)\n {\n printf(\"YES\") ;\n }\n\n else if(i%47==0||n%744==0)\n {\n printf(\"YES\") ;\n }\n\n else\n printf(\"NO\") ;\n\n return 0 ;\n}\n"}, {"source_code": "#include\nint main()\n{\nint N,i,a[10]={4,7,744,47,447,74,474,477,774,747},flag=0;\nscanf(\"%d\",&N);\nfor(i=0;i<10;i++)\n{\n if(N==a[i] || N%a[i]==0)\n {\n printf(\"YES\");\n break;\n }\n else\n flag++;\n}\nif(flag==10)\nprintf(\"NO\");\nreturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint a,b;\nloop:while(scanf(\"%d\",&a)!=EOF)\n\t{\n\t\tint flag=0;\n\t\tb=a;\n\t\twhile(a>0)\n\t\t{\n\t\t\tif(a%10!=4&&a%10!=7)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ta/=10;\n\t\t}\n\t\ta=b;\n\t\tif(!flag)\n\t\t{\n\t\t\tprintf(\"YES\\n\");\n\t\t\tgoto loop;\n\t\t}\n\t\tif(a%4==0||a%7==0||a%44==0||a%47==0||a%74==0||a%77==0||a%444==0||a%447==0||a%474==0||a%477==0)\n\t\t{\n\t\t\tprintf(\"YES\\n\");\n\t\t\tgoto loop;\n\t\t}\n\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}\n \t\t \t \t\t\t\t\t\t \t \t\t \t"}, {"source_code": "#include \n#include \n#include \n\nint main()\n{\n int n,i,a[10]={4,7,47,74,447,474,477,774,747,744},cnt=0;\n scanf(\"%d\",&n);\n for(i=0;i<10;i++){\n if(n==a[i]||n%a[i]==0){\n printf(\"YES\\n\");\n break;\n }\n\n else cnt++;\n }\n if(cnt==10) printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "int main() {\n int i,sayi,luckynumber[14]={4,7,44,47,74,77,444,447,474,477,744,747,774,777};\n scanf(\"%d\",&sayi);\n for(i=0;i<14;i++)\n if(sayi%luckynumber[i]==0) {\n printf(\"YES\");\n break;\n }\n if(i==14)\n printf(\"NO\");\n}"}, {"source_code": "#include\nint main()\n{\n int a;\n scanf(\"%d\",&a);\n\n if((a%4==0) || (a%7==0) || (a%47==0) || (a%74==0) || (a%444==0) || (a%447==0) || (a%474==0) || (a%477==0) || (a%744==0) || (a%747==0) || (a%774==0) || (a%777==0))\n {\n\n printf(\"YES\\n\");\n }\n else{\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": " #include\n int main()\n {\n int i=0,n,j,c1=0,c2=0,c=0;\n int a[1000];\n int b[14] ={ 4,7,44,47,74,77,444,447,474,744,777,774,747,477};\n\n\n\n scanf(\"%d\",&n);\n\n for ( i=0; i<14; i++)\n {\n if ( n%b[i]==0)\n {\n printf(\"YES\\n\"); return 0;\n }\n }\n\n while(n>0)\n {\n a[i]=n%10;\n\n i++;\n if (n%10==4) c1++;\n if(n%10==7) c2++; n=n/10;\n c++;\n }\n\n if ((c1+c2)==c )\n printf(\"YES\\n\");\n\n else\n printf(\"NO\\n\");\n\n\n return 0;\n }"}, {"source_code": "#include \n#include \n#include\nint main() \n{ \n int n;\n scanf(\"%d\",&n);\n if(n%47==0||n%74==0||n%744==0||n%474==0||n%4==0||n%7==0||n%77==0||n%44==0||n%444==0||n%777==0||n%447==0||n%477==0||n%747==0||n%774==0)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n \n} "}, {"source_code": "main()\n{\n int n;\n scanf(\"%d\", &n);\n\n printf((n%4==0 || n%7==0 || n%47==0 || n%74==0 || n%477==0 || n%474==0 || n%747==0 || n%774==0)? \"YES\" : \"NO\");\n\n}\n"}, {"source_code": "#include\n#include\nint main(void)\n\n{\n int n,i;\n\n scanf(\"%d\",&n);\n if(n==0) printf(\"NO\");\n else i=log10(n)+1;\n if (i==1) {\n if(n%4==0 || n%7==0) printf(\"YES\");\n else printf(\"NO\");\n }\n else if(i==2) {\n if(n%4==0 || n%7==0||n%47==0 || n%74==0 ) printf(\"YES\");\n else printf(\"NO\");\n }\n else if(i==3) {\n if(n%4==0 || n%7==0||n%44==0 || n%77==0||n%47==0 || n%74==0 || n%447==0 || n%774==0 ||n%474==0 || n%477==0||n%747==0 || n%744==0 ) printf(\"YES\");\n else printf(\"NO\");\n }\n else printf(\"YES\");\n\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main(){\nint n,i;\nscanf(\"%d\",&n);\nint flag=0;\nif(n%4==0) flag=1;\nif(n%7==0) flag=1;\nif(n%44==0) flag=1;\nif(n%47==0) flag=1;\nif(n%74==0) flag=1;\nif(n%77==0) flag=1;\nif(n%444==0) flag=1;\nif(n%447==0) flag=1;\nif(n%474==0) flag=1;\nif(n%477==0) flag=1;\nif(n%744==0) flag=1;\nif(n%747==0) flag=1;\nif(n%774==0) flag=1;\nif(n%777==0) flag=1;\nif(flag) printf(\"YES\");\nelse\n printf(\"NO\");\nreturn 0;\n}\n \t \t\t \t \t\t\t \t \t\t \t \t \t"}, {"source_code": "#include \n#include \n#include \n\n\nint main()\n{\n int n,l=0,i=0,a,c,k,s,z;\n scanf(\"%d\",&n);\n\n do\n {\n l++;\n c=trunc(pow(10,l));\n\n } while(n%c!=n);\n a=n%10;\n while(i\nint main()\n{\n int i,j,count=0;\n char s[1000];\n scanf(\"%s\",s);\n int m=strlen(s);\n int num=atoi(s);\n if(num==799||num==94||num==141)\n printf(\"YES\\n\");\n else if(num%4==0||num%7==0)\n\n printf(\"YES\\n\");\n else {\n for(i=0;i\n\nmain()\n{ int n;\n\nscanf(\"%d\",&n);\n\tif (n%4==0 || n%7==0 || n%47==0 || n%74==0 || n%777==0 || n%477==0 ||n%444==0 || n%44==0 || n%77==0 || n%447==0 || n%474==0 ||n%744==0 || n%747==0 )\n printf(\"YES\"); \n else\n printf(\"NO\");\n\n\n}\n"}, {"source_code": "#include \n#include \n#include\n\nint main()\n{\n int i,j,t,c = 0,s = 7,f = 4;\n scanf(\"%d\",&j);\n t = j;\n while (j != 0){\n j /= 10;\n c ++;\n }\n char a[c];\n s = 7 * (10 ^ i);\n f = 4 * (10 ^ i);\n if (t %4== 0 || t %7== 0|| t %44== 0|| t %77== 0|| t %74== 0|| t %47== 0){\n printf(\"YES\");\n }\n else{\n itoa(t,a,10);\n for (i = 0 ; i < c ; i ++){\n if (a[i] == '4' || a[i] == '7'){\n if (i == c-1){\n printf(\"YES\");\n }\n }\n else {\n printf(\"NO\");\n break;\n }\n\n\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n\tint n,g,s,b;\n\tscanf(\"%d\",&n);\n\tif(n%4==0||n%7==0||n%47==0||n%74==0||n%447==0||n%444==0||n%474==0||n%477==0)\n\t\tprintf(\"YES\");\n\telse\n\t{\n\t\tg=n%10;\n\t\ts=n%100/10;\n\t\tb=n/100;\n\t\tif(b!=0)\n\t\t{\n\t\t\tif(b==4||b==7)\n\t\t\t{\n\t\t\t\tif(s==4||s==7)\n\t\t\t\t{\n\t\t\t\t\tif(g==4||g==7)\n\t\t\t\t\t\tprintf(\"YES\");\n\t\t\t\t\telse\n\t\t\t\t\t\tprintf(\"NO\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tprintf(\"NO\");\n\t\t\t}\n\t\t\telse\n\t\t\t\tprintf(\"NO\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(s!=0)\n\t\t\t{\n\t\t\t\tif(s==4||s==7)\n\t\t\t\t{\n\t\t\t\t\tif(g==4||g==7)\n\t\t\t\t\t\tprintf(\"YES\");\n\t\t\t\t\telse\n\t\t\t\t\t\tprintf(\"NO\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tprintf(\"NO\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(g==4||g==7)\n\t\t\t\t\tprintf(\"YES\");\n\t\t\t\telse\n\t\t\t\t\tprintf(\"NO\");\n\t\t\t}\n\t\t}\n\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n#include\n#include\n\n\nint main()\n{\n\n long i,n,ra[1000],ra1,t1,ra2,rem=0,m,q,tem=0,j;\n scanf(\"%ld\",&n);\n long s[1000];\n q=n;\n for(i=0;n!=0;i++)\n {\n s[i]=n%10;\n n=n/10;\n\n\n }\n for(j=0;j<=i;j++)\n {\n if(s[j]==4 || s[j]==7)\n {\n tem++;\n }\n }\n\n\n if(tem==i || q%47==0 || q%74==0) printf(\"YES\");\nelse if(q%4==0 || q%7==0) printf(\"YES\");\n else printf(\"NO\");\n\n return 0;\n\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n char s[5];\n int len,i,sum=0,a=0,j,b,c=1;\n scanf(\"%s\",s);\n len=strlen(s);\n if(strcmp(s,\"799\")==0||strcmp(s,\"94\")==0||strcmp(s,\"141\")==0){\n printf(\"YES\\n\");\n return 0;\n }\n for(i=0;i\n#include\nint main()\n{\n int n,q,a,r,s,b,c,d,j=0,i;\n double l;\n scanf(\"%d\",&n);\n l= log10(n);\n q=l+.5+1;\n\n d=n;\n for(i=0;;i++)\n {\n c=d%10;\n d=d/10;\n if((c!=4)&&(c!=7))\n j=1;\n if (d==0)\n break;\n\n }\n\n a=n%4;\n b=n%7;\n r=n%47;\n s=n%744;\n if (j==0)\n printf(\"YES\");\n else if(a==0)\n {\n printf(\"YES\");\n }\n else if(b==0)\n {\n printf(\"YES\");\n }\n else if(r==0)\n {\n printf(\"YES\");\n }\n\n else if(s==0)\n {\n printf(\"YES\");\n }\n\n else\n printf(\"NO\");\n return 0;\n\n}\n"}, {"source_code": "#include\nint luck(int n){\n int k,j;\n for(j=n;j>0;){\n k=j%10;\n j=j/10;\n if(k!=4 && k!=7)\n return 0;\n }\n return 1;\n}\nint main(){\n int n,i;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++){\n if(n%i==0 && luck(i)){\n printf(\"YES\");\n return 0;\n }\n }\n printf(\"NO\");\n return 0;\n \n}"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\\n\",&n);\n if(n%4==0 ||n%7==0 ||n%44==0 || n%47==0 || n%74==0 || n%77==0 || n%444==0 || n%447==0 || n%474==0 || n%477==0 || n%744==0 || n%774==0 || n%777==0 )\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include\nmain()\n{\n int arr[14]={4,7,47,74,44,77,444,777,447,474,744,747,774,477},n,i,c=0;\n scanf(\"%d\",&n);\n for(i=0;i<14;i++)\n {\n if(n%arr[i]==0)\n {\n c++;\n }\n }\n if(c>0)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main() {\n int n;\n int flag = 0;\n int nums[14] = {4, 7, 44, 77, 47, 74, 477, 447, 444, 474, 777, 747, 774, 744};\n scanf(\"%d\", &n);\n for (int i = 13; i >= 0; i--) {\n if (n == nums[i]) {\n printf(\"YES\");\n flag = 1;\n break;\n }\n }\n if (flag == 0) {\n for (int i = 0; i < 14; i++)\n\n {\n if (n % nums[i] == 0) {\n printf(\"YES\");\n flag = 1;\n break;\n }\n }\n if (flag == 0) {\n printf(\"NO\");\n }\n }\n}\n"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n%4==0||n%7==0||n%47==0||n%74==0||n%44==0||n%77==0||n%444==0||n%447==0||n%474==0||n%744==0||n%477==0||n%747==0||n%777==0||n%774==0)\n {\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n}\n"}, {"source_code": "#include\nint main(){\n int n,arr[]={4,7,44,77,47,74,444,447,474,744,777,774,747,477},t=0;\n scanf(\"%d\",&n);\n for(int i=0;i<14;i++){\n if(n%arr[i]==0){printf(\"YES\");t++;break;}\n }\n if(t==0){printf(\"NO\");}\n}"}, {"source_code": "#include \n#include \nint main()\n{\n int x,y,z,a,b,d,e,g,f,h;\n scanf(\"%d\", &x);\n a = x%4;\n b = x%7;\n d = x%47;\n e = x%74;\n g = x%447;\n f = x%474;\n h = x%477;\n if(a==0 || b==0 || d==0|| e==0 || g==0 || f==0 || h==0)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n int num,array[100],digit=0,flag=0,flag1=0;\n scanf(\"%d\",&num);\n if (num%4==0||num%7==0||num%44==0||num%47==0||num%74==0||num%77==0||num%447==0||num%474==0||num%744==0||num%477==0||num%747==0||num%774==0||num%777==0||num%777==0)\n printf(\"YES\");\n else printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n int x,y,z,a,b,d,e,g,f,h;\n scanf(\"%d\", &x);\n a = x%4;\n b = x%7;\n d = x%47;\n e = x%74;\n g = x%447;\n f = x%474;\n h = x%477;\n if(a==0 || b==0 || d==0|| e==0 || g==0 || f==0 || h==0)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n}\n"}, {"source_code": "\n#include\nint main()\n{\n int n,i;\n scanf(\"%d\",&n);\n if(n== 4|| n==7|| n==47|| n==74|| n==44 || n==77 || n==444 || n==447 || n==474 || n==477 || n==744 || n==747 || n==774 || n==777)\n {\n printf(\"YES\\n\");\n\n }\n else if(n%4==0)\n\n {\n printf(\"YES\\n\");\n }\n\n else if(n%7==0)\n\n {\n printf(\"YES\\n\");\n }\n else if(n%44==0)\n\n {\n printf(\"YES\\n\");\n }\n else if(n%47==0)\n\n {\n printf(\"YES\\n\");\n }\n else if(n%74==0)\n\n {\n printf(\"YES\\n\");\n }\n else if(n%77==0)\n\n {\n printf(\"YES\\n\");\n }\n else if(n%444==0)\n\n {\n printf(\"YES\\n\");\n }\n else if(n%447==0)\n\n {\n printf(\"YES\\n\");\n }\n else if(n%474==0)\n\n {\n printf(\"YES\\n\");\n }\n else if(n%477==0)\n\n {\n printf(\"YES\\n\");\n }\n else if(n%774==0)\n\n {\n printf(\"YES\\n\");\n }\n else if(n%747==0)\n\n {\n printf(\"YES\\n\");\n }\n else if(n%774==0)\n\n {\n printf(\"YES\\n\");\n }\n else if(n%777==0)\n\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n\n\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int a;\n scanf(\"%d\",&a);\n if( a%4==0 ||a%7==0 ||a%47==0 ||a%74==0 ||a%444==0 ||a%744==0||a%447==0||a%474==0||a%477==0)\n {\n printf(\"YES\\n\");\n }\n\n else\n {\n printf(\"NO\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int n, a[]={4, 7, 44, 47, 74, 77, 444, 447, 474, 477, 744, 747, 774, 777}, flag=0;\n\tscanf(\"%d\", &n);\n\tfor (int i=0;i\nint main()\n{\n\tint a,b;\nloop:while(scanf(\"%d\",&a)!=EOF)\n\t{\n\t\tint flag=0;\n\t\tb=a;\n\t\twhile(a>0)\n\t\t{\n\t\t\tif(a%10!=4&&a%10!=7)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ta/=10;\n\t\t}\n\t\ta=b;\n\t\tif(!flag)\n\t\t{\n\t\t\tprintf(\"YES\\n\");\n\t\t\tgoto loop;\n\t\t}\n\t\tif(a%4==0||a%7==0||a%44==0||a%47==0||a%74==0||a%77==0||a%444==0||a%447==0||a%474==0||a%477==0)\n\t\t{\n\t\t\tprintf(\"YES\\n\");\n\t\t\tgoto loop;\n\t\t}\n\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}\n \t\t \t \t\t\t\t\t\t \t \t\t \t"}, {"source_code": "#include\n#include\n#include\n#include\n#include\n#include\n\nint count_digit(int n)\n{\n int x=0;\n while(n != 0)\n {\n n = n/10;\n ++x;\n }\n return x;\n}\nint is_lucky(int n)\n{\n int i=10,count=0,digit=0;\n digit=count_digit(n);\n\n if(n%4==0 || n%7==0)\n return 1;\n else\n {\n while(n!=0)\n {\n if((n%i)!=4 && (n%i)!=7)\n {\n return -1;\n break;\n }\n else\n {\n count++;\n n=n/i;\n }\n }\n if(count==digit)\n return 1;\n\n }\n}\n\nint main(void)\n{\n int i,n,result=0,state_1=0,state_2=0;\n scanf(\"%d\",&n);\n result=is_lucky(n);\n if(n<47)\n {\n if(result==1)\n printf(\"YES\");\n else if(result==-1)\n printf(\"NO\");\n }\n else\n {\n if(result==1)\n printf(\"YES\");\n else if(result==-1)\n {\n for(i=2;i<1000;i++)\n {\n if(n%i==0)\n {\n state_1=is_lucky(i);\n state_2=is_lucky(n/i);\n if(state_1==1 || state_2==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n break;\n }\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,a,i,j,l=0,lo=0,cnt=0;\n scanf(\"%d\",&n);\n j=n;\n for(i=0;j!=0;i++)\n {\n a=j%10;\n if(a==4||a==7)\n {\n lo+=1;\n }\n j/=10;\n }\n if(lo==i)\n {\n printf(\"YES\");\n }\n else\n {\n if(n%4==0||n%7==0||n%44==0||n%47==0||n%74==0||n%77==0)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int a;\n scanf(\"%d\",&a);\n int z[10];\n int d=a,j=a,x=0;\n while(d>0)\n {\n j=d%10;\n z[x]=j;\n x++;\n d=d/10;\n }\n int y=0;\n for(int i=0; i\nint main()\n{ \n\tint n,flag=0,i=0;\n\tscanf(\"%d\",&n);\n\tint lu[10]={4,7,47,74,444,447,474,744,747,777};\n\tint a=n;\n\tfor(i=0;i<=a;i++)\n\t{\n\t\tif(a%10==4||a%10==7)\n\t\t{\n\t\t\tflag=1;\n\t\t\ta=a/10;\n\t\t\tif(a<0)\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tflag=0;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif(flag==0)\n\t{\n\tfor (i = 0; i<10 ; i++)\n\t{\n\t\tif(n>lu[i])\n\t\t{\n\t\t\tif(n%lu[i]==0)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tflag=0;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t}\n\t}\n\tif(flag==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 \n#include \n\nint main()\n{\n int i, j=0,n,k,l=0,p,q,m,r,x,y;\n char st[1001];\n scanf(\"%s\",st);\n n=strlen(st);\n for(i=0;i2)\n {\n m=st[0]+st[1]-2*48;\n if(m%4==0||m%7==0)\n {\n printf(\"YES\\n\");\n }\n else\n {\n y=(st[0]-48)*10+st[1]-48;\n if(y%4==0||y%7==0)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n }\n\n }\n\n else\n {\n if(n==2)\n {\n r=(st[0]-48)%4;\n x=(st[0]-48)%7;\n if((r*10+st[1]-48)%7==0||(r*10+st[1]-48)%4==0||(x*10+st[1]-48)%7==0||(x*10+st[1]-48)%7==0)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n }\n\n else\n {\n printf(\"NO\\n\");\n }\n\n }\n\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,s,w=0,r,c=0,l;\n scanf(\"%d\",&n);\n s=n%10;\n r=n/10;\n l=r/10;\n if(n%4==0||n%7==0||n%47==0||n&744==0)\n {\n w++;\n }\n else if(n<99)\n {\n if(s==4||s==7)\n w++;\n }\n else if(n>99)\n {\n if(l==7||l==4)\n c++;\n }\n if(w==0&&c==0)\n {\n printf(\"NO\\n\");\n }\n else\n {\n printf(\"YES\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n\tint num;\n\tint a = -1;\n\tint b = -1;\n\tint c = -1;\n\tint check = 0;\n\t\n\tscanf(\"%d\", &num);\n\t\n\tif(num > 99) {\n\t\ta = num/100;\n\t\tb = num%100;\n\t\tb = b/10;\n\t\tc = num%100;\n\t\tc = c%10;\n\t} else if(num > 9) {\n\t\tb = num/10;\n\t\tc = num%10;\n\t} else {\n\t\tc = num;\n\t}\n\t\n\t//printf(\"%d %d %d\", a, b, c);\n\t\n\tif(c==4 || c==7) {\n\t\tif(b==-1) {\n\t\t\tprintf(\"YES\"); return 0;\n\t\t}\n\t\telse if(b==4 || b==7) {\n\t\t\tif(a==-1) {\n\t\t\t\tprintf(\"YES\"); return 0;\n\t\t\t}\n\t\t\telse if(a==4 || a==7) {\n\t\t\t\tprintf(\"YES\"); return 0;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tprintf(\"NO\"); return 0;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif(num%4==0) {\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t} else if(num%47==0) {\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t} else if(num%7==0) {\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t} else if(num%74==0) {\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t} else if(num%77==0) {\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t} else if(num%44==0) {\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\t\n\tif(num%4==0) {\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t} else if(num%47==0) {\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t} else if(num%7==0) {\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t} else if(num%74==0) {\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t} else if(num%77==0) {\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t} else if(num%44==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\nint main(){\n\tint n,temp,num,count=0,count1=0;\n\tscanf(\"%d\",&n);\n\tnum=n;\n\twhile(num!=0){\n\t\ttemp=n%10;\n\t\tcount1++;\n\t\tnum=num/10;\n\t}\n\tif(n==799)\n\t\tprintf(\"YES\");\n\telse if(n==94)\n\t\tprintf(\"YES\");\n\telse if(n%7==0 || n%4==0 || n%47==0 )\n\t\tprintf(\"YES\");\n\telse if(n%4!=0 && n%7!=0){\n\twhile(n!=0){\n\t\ttemp=n%10;\n\t\tif(temp==4 || temp==7)\n\t\tcount++;\n\t\tn=n/10;\n\t}\n\tif(count==count1)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\t}\n\telse\n\t\tprintf(\"YES\");\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\nint main(){\nint n,m=1;\nint ones,tens,hundreds;\nscanf(\"%d\",&n);\n//if(n==799 || n==94||n==141){printf(\"YES\");m=0;}\nif(n<1||n>1000)return 0;\nones=n%10;\ntens=(n%100)/10;\nhundreds=(n-(n%100))/100;\n\nif(n<10&&(ones==4||ones==7))printf(\"YES\");\nelse if(n<100&&(ones==4||ones==7)&&(tens==4||tens==7))printf(\"YES\");\nelse if((ones==4||ones==7)&&(tens==4||tens==7)&&(hundreds==4||hundreds==7))printf(\"YES\");\nelse if((n%4)==0 || (n%7)==0||(n%47)==0||(n%74)==0||(n%447)==0)printf(\"YES\");\nelse if(m==1) printf(\"NO\");\n\nreturn 0;}\n\n\n"}, {"source_code": "#include \n\nint main()\n{\n int luc[14]={4,7,44,47,74,77,447,474,444,477,777,747,774,744}, a, b, c=0;\n scanf(\"%d\", &a);\n for (b=0; b<14; b++)\n {\n if(a%luc[b]==0)\n c=1;\n }\n if(c==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n\n}\n"}, {"source_code": "#include\nint main()\n{\nint n;\nscanf(\"%d\",&n);\nint nod(int n)\n{ int i=0;\ndo\n{ n=n/10;\n i++;\n}\nwhile (n);\nreturn(i);\n}\nint verif(int n)\n{ int i=1,m=(n%10),p=nod(n);\n\tif ((n/10)==0)\n\t { if (((n%4)==0)||(n==7))\n\t return(1);\n\t else\n\t return(0);\n\t }\n\t else if ((m==4)||(m==7))\n\t { \n while((i<=p)&&(i!=0))\n { \n if ((m==4)||(m==7))\n { \n i++;\n n=(n/10);\n m=(n%10);\n\t\t }\n else i=0;\n \n }\n if (i==0)\n return(0);\n else\n return(i-1);\n }\n else return(0);\n}\nif((n%4==0)||(n%7==0)||((n%47)==0))\nprintf(\"YES\");\nelse if(verif(n)==nod(n))\nprintf(\"YES\");\nelse printf(\"NO\");\n}"}, {"source_code": "#include\nmain()\n{\n int arr[14]={4,7,47,74,44,77,444,777,447,474,744,747,774,477},n,i,c=0;\n scanf(\"%d\",&n);\n for(i=0;i<14;i++)\n {\n if(n%arr[i]==0)\n {\n c++;\n }\n }\n if(c>0)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,a,i,j,l=0,lo=0,cnt=0;\n scanf(\"%d\",&n);\n j=n;\n for(i=0;j!=0;i++)\n {\n a=j%10;\n if(a==4||a==7)\n {\n lo+=1;\n }\n j/=10;\n }\n if(lo==i)\n {\n printf(\"YES\");\n }\n else\n {\n if(n%4==0||n%7==0||n%44==0||n%47==0||n%74==0||n%77==0)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int a[14]={4,7,44,47,74,77,444,447,474,477,744,747,774,777},n,i;\n scanf(\"%d\",&n);\n for(i=0;i<14;i++)\n {\n if(n%a[i]==0)\n {\n printf(\"YES\\n\");\n break;\n }\n }\n if(i==14)\n {\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n%4==0||n%7==0||n%47==0||n%74==0||n%477==0||n%447==0||n%474==0||n%744==0||n%774==0)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n}"}, {"source_code": "#include\nint main()\n{\n int n,i,j,len;\n scanf(\"%d\",&n);\n if(n%4==0 || n%7==0 || n%47==0 || n%74==0 || n%77==0 || n%447==0 || n%474==0 || n%477==0 || n%747==0 || n%774==0 ){\n printf(\"YES\");\n }\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int i,n;\n int l[]= {4,7,47,74,447,474,477};\n scanf(\"%d \",&n);\n for(i=0;i<7;i++)\n if((n/l[i])*l[i]==n)\n {\n printf(\"YES\");\n return 0;\n }\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include \nint main()\n{\n int n;\n int temp=0;\n scanf (\"%d\",&n);\n int a[14]={7,47,4,74,774,447,477,777,444,747,474,744,44,77};\n for (int i=0;i<14;i++)\n {\n if (n%a[i]==0)\n {\n printf (\"YES\");\n temp=1;\n break;\n }\n }\n if (temp==0)\n {\n printf (\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n\tint x, y, a = 0, b = 0, c = 0, z;\n\tscanf(\"%d\", &x);\n\tint k = x;\n\tif (x % 7 == 0 || x % 4 == 0)printf(\"YES\");\n\telse {\n\t\twhile (x > 0){\n\t\t\ty = x % 10;\n\t\t\tif (y == 7)a++;\n\t\t\telse if (y == 4)b++;\n\t\t\tc++;\n\t\t\tx = x / 10;\n\t\t}\n\t\tz = a + b;\n\t\tif (z == c || k % 47 == 0)printf(\"YES\");\n\t\telse printf(\"NO\");\n\t}\n\n\n\treturn 0;\n}"}, {"source_code": "#include \nint main() {\n int nums[15] = {4,7,44,47,74,77,444,447,474,477,744,747,774,777,1000}, n, a=0, i;\n scanf(\"%d\", &n);\n\n for (i = 0; i < 15; i++)\n {\n if ( n % nums[i] == 0 )\n {\n a=1;\n break;\n }\n }\n if ( a == 1 ) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include \n#include \nint main() {\n int n;\n int flag = 0;\n int nums[14] = {4, 7, 44, 77, 47, 74, 477, 447, 444, 474, 777, 747, 774, 744};\n scanf(\"%d\", &n);\n for (int i = 13; i >= 0; i--) {\n if (n == nums[i]) {\n printf(\"YES\");\n flag = 1;\n break;\n }\n }\n if (flag == 0) {\n for (int i = 0; i < 14; i++)\n\n {\n if (n % nums[i] == 0) {\n printf(\"YES\");\n flag = 1;\n break;\n }\n }\n if (flag == 0) {\n printf(\"NO\");\n }\n }\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,i,j,len;\n scanf(\"%d\",&n);\n if(n%4==0 || n%7==0 || n%47==0 || n%74==0 || n%77==0 || n%447==0 || n%474==0 || n%477==0 || n%747==0 || n%774==0 ){\n printf(\"YES\");\n }\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n\nint lucky(int n)\n{\n while(n)\n {\n if(n%10 != 4 && n%10 !=7) return 0;\n n /= 10;\n }\n\n return 1;\n}\n\nint almost_lucky(int n)\n{\n int i;\n if(lucky(n)) return 1;\n for(i=2; i*i<=n; i++){\n if(n%i == 0 && (lucky(i) || lucky(n/i))) return 1;\n }\n return 0;\n}\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n if(almost_lucky(n)) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int num,k;\n int r,p,q,f=0;\n scanf(\"%d\",&num);\n int i,j;\n j=num;\n for(j=num;j>0;j/=10)\n {\n k=j%10;\n if(k==4 || k==7)\n continue;\n else\n break;\n }//magic number check\n if(j==0)\n printf(\"YES\");\n else\n {\n f=0;\n k=2;\n while(k<=num/2)\n {\n j=num/k;\n r=num%k;\n if(r==0)\n {\n for(p=j;p>0;p/=10)\n {\n q=p%10;\n if(q!=4 && q!=7)\n break;\n }\n if(p==0)\n {\n f=1;\n break;\n }\n } \n k++;\n }\n if(f==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include\nint main()\n{ \n\tint n,flag=0,i=0;\n\tscanf(\"%d\",&n);\n\tint lu[10]={4,7,47,74,444,447,474,744,747,777};\n\tint a=n;\n\tfor(i=0;i<=a;i++)\n\t{\n\t\tif(a%10==4||a%10==7)\n\t\t{\n\t\t\tflag=1;\n\t\t\ta=a/10;\n\t\t\tif(a<0)\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tflag=0;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif(flag==0)\n\t{\n\tfor (i = 0; i<10 ; i++)\n\t{\n\t\tif(n>lu[i])\n\t\t{\n\t\t\tif(n%lu[i]==0)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tflag=0;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t}\n\t}\n\tif(flag==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 \n#include \n\nint main()\n{\n int p,x,a,y,m,n;\n scanf(\"%d\",&n);\n if(n<0) {\n printf(\"NO\\n\");\n return 0;\n }\n if(n==78 || n==274){\n printf(\"NO\\n\");\n return 0;\n }\n if(n%4==0) {\n printf(\"YES\\n\");\n return 0;\n }\n if(n%7==0){\n printf(\"YES\\n\");\n return 0;\n }\n if(n>0 && n<100){\n x=n/10;\n a=n%10;\n if(a==4 || a==7){\n printf(\"YES\\n\");\n return 0;\n }else if(x==4 || x==7) {\n printf(\"YES\\n\");\n return 0;\n }\n else{\n printf(\"NO\\n\");\n return 0;\n }\n }\n if(n>99 && n<1000){\n y=n/100;\n m=(n%100)/10;\n p=y%10;\n if(p==4 || p==7){\n printf(\"YES\\n\");\n return 0;\n }\n else if(m==4 || m==7){\n printf(\"YES\\n\");\n return 0;\n }\n else if(y==4 || y==7){\n printf(\"YES\\n\");\n return 0;\n }\n else{\n printf(\"NO\\n\");\n return 0;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n=0,m,j=0,c=0,i=0,r,A[100],h=0,a;\n scanf(\"%d\",&a);\n while(n<=1000)\n {\n n++;\n m=n;\n c=0;\n j=0;\n while(m>0)\n {\n j++;\n r=m%10;\n if(r==4 || r==7)\n c++;\n m=m/10;\n\n\n }\n if(c==j)\n A[i++]=n;\n\n }\n for(j=0;j\n\nint main(void) {\n\tint n;\n\tscanf(\"%d\",&n);\n\tif(!(n%4 && n%7 && n%44 && n%47 && n%447 && n%474 && n%477 && n%744 && n%777))\n\t\tprintf(\"YES\\n\");\n\telse printf(\"NO\\n\");\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\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n%4==0||n%7==0||n%47==0||n%74==0||n%477==0||n%447==0||n%474==0)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n}"}, {"source_code": "#include \n\nint main(){\n int num, r,n=0,r1,r2;\n scanf(\"%i\",&num);\n while(n<=num){\n n+=1;\n r=num%n;\n if(r==0){\n if(n==4||n==7||n==47){\n printf(\"YES\");\n return 0;\n }\n }\n r1=num%10;\n if(r1==4||r1==7){\n r2=num;\n while(r2>10){\n r2=r2/10;\n }\n r1=r2%10;\n if(r1==4||r1==7){\n printf(\"YES\");\n return 0;}\n }\n }\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int x;\n scanf(\"%lli\",&x);\n\n if(x==94||x==141||x==799||x==4||x==7||x==47||x==74||x==44||x==77||x==444||x==447||x==474||x==477||x==744||x==747||x==747||x==777||x==774)\n {\n printf(\"YES\");\n }\n else if(x%4==0||x%7==0)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n}\n"}, {"source_code": "#include\nint main (){\n int n;\n scanf(\"%d\", &n);\n if(((n % 4) == 0) || ((n % 7) == 0) || ((n % 44) == 0) || ((n % 47) == 0) | ((n % 74) == 0) || ((n %\n 444) == 0) || ((n % 447) == 0) || ((n % 474) == 0) || ((n % 477) == 0))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n}"}, {"source_code": "#include\n#include\nmain(){\n\tint i,j;\n\tscanf(\"%d\",&i);\n\tif((i%4==0)||(i%7==0)||(i%47==0)||(i%74==0)||(i%444==0)||(i%447==0)||(i%474==0)||(i%477==0)||(i%777==0)||(i%744==0)||(i%774==0)||(i%747==0))\n\tprintf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n}"}, {"source_code": "#include\nint main(){\n int n;\n scanf(\"%d\",&n);\n if(n==47|n==4|n==7|n==744|n==77|n==477|n==49|n==42|n==70|n==777|n==799)\n printf(\"YES\");\n else if(n%4==0|n==882|n==94|n==141)\n printf(\"YES\");\n else if(n==5|n==17|n==567)\n printf(\"NO\");\n else \n printf(\"NO\");\n return 0;\n \n}"}, {"source_code": "#include \nmain()\n{\nint n,g,i,j,k;\nchar s[4],a[3]={'0','4','7'};\nscanf(\"%d\",&n);\nfor(i=0;i<3;i++)\n{s[0]=a[i];\nfor(j=0;j<3;j++)\n{if(s[0]!='0' && j==0)j=1;s[1]=a[j];\nfor(k=0;k<3;k++)\n{if(s[1]!='0' && k==0)k=1;s[2]=a[k];\ng=atoi(s);\nif(g!=0 && n%g==0)\n{printf(\"YES\");return 0;}\nif(g>n ||(g==777)){printf(\"NO\");return 0;}\n}}}\n}"}, {"source_code": "#include\nint main()\n{\n int n,a,i,j,l=0,lo=0,cnt=0;\n scanf(\"%d\",&n);\n j=n;\n for(i=0;j!=0;i++)\n {\n a=j%10;\n if(a==4||a==7)\n {\n lo+=1;\n }\n j/=10;\n }\n if(lo==i)\n {\n printf(\"YES\");\n }\n else\n {\n if(n%4==0||n%7==0||n%44==0||n%47==0||n%74==0||n%77==0)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{ \n\tint n,flag=0,i=0;\n\tscanf(\"%d\",&n);\n\tint lu[10]={4,7,47,74,444,447,474,744,747,777};\n\tint a=n;\n\tfor(i=0;i<=a;i++)\n\t{\n\t\tif(a%10==4||a%10==7)\n\t\t{\n\t\t\tflag=1;\n\t\t\ta=a/10;\n\t\t\tif(a<0)\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tflag=0;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif(flag==0)\n\t{\n\tfor (i = 0; i<10 ; i++)\n\t{\n\t\tif(n>lu[i])\n\t\t{\n\t\t\tif(n%lu[i]==0)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tflag=0;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t}\n\t}\n\tif(flag==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\n//#include\nmain()\n{\n int a[]={4,7,44,47,74,77,444,447,474,477,744,747,774,777};\n\n int d;\n scanf(\"%d\",&d);\n int i=0;\n while(a[i]<=d)\n {\n //printf(\"%d\\n\",d%a[i]);\n if(d%a[i]==0)\n {\n\n printf(\"YES\");\n return 0;\n }\n i++;\n }\n while(1)\n {\n d=0;\n break;\n }\n printf(\"NO\");\n return 0;\n\n}\n"}, {"source_code": "#include\nint main() {\n int n,i,a[10] = {4,7,47,74,447,474,477,774,747,744};\n int count = 0;\n scanf(\"%d\",&n);\n for(i = 0; i < 10; i++) {\n if(n==a[i]||n%a[i]==0) {\n printf(\"YES\\n\");\n break;\n }\n else count++;\n }\n if(count == 10)\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n int a,m,n;\n scanf(\"%d\",&n);\n m=n;\n do\n {\n a=n%10;\n if(a!=7 && a!=4) \n break;\n n=n/10;\n }while(n!=0);\nif(n==0 || m%4==0 || m%7==0 || m%47==0) \n printf(\"YES\");\nelse\n printf(\"NO\");\nreturn 0;\n \n}"}, {"source_code": " #include\n int main()\n {\n int n,i,a[10]={4,7,47,74,447,474,477,774,747,744},cnt=0;\n scanf(\"%d\",&n);\n for(int i=0;i<10;i++){\n if(n==a[i]||n%a[i]==0){\n printf(\"YES\\n\");\n break;\n }\n else cnt++;\n }\n if(cnt==10) \n printf(\"NO\\n\");\n return 0;\n }"}, {"source_code": "#include\nint main()\n{\n\tint n,digits,i;\n\tint b[14]={4,7,44,47,74,77,444,447,774,777,474,744,747,477};\n\tscanf(\"%d\",&n);\n\tfor(i=0;i<14;i++){\n if(n%b[i]==0){\n \tprintf(\"YES\\n\");\n \treturn 0;\n \t}\n }\t//if(n==0||n==1||n==2||n==3||n==5||n==6||n==8||n==9)//{\n \t\t//printf(\"NO\\n\");\n\n \t//}\n\twhile(n>0){\n\n\tdigits=(n%10);\n\tn=n/10;\n\t}\n if(digits==4&&7){\n\t\tprintf(\"YES\\n\");\n\t}\n\telse if(digits!=4&&7) {\n\t\tprintf(\"NO\\n\");\n\n\t}\n\n\treturn 0;\n}\n"}], "negative_code": [{"source_code": "#include\nint main(){\n int a,b,n,i;\n scanf(\"%d\",&n);\n\n\n if((n/4)%2==0 || (n/7)%2==0){\n if(n%4==0 || n%7==0){\n printf(\"YES\");\n }\n }\n\n else if(n>0){\n for(i=0;n>0;i++){\n a=n%10;\n if(a!=7 & a!=4){\n printf(\"NO\");\n break;\n }\n\n n=n/10;\n if(n==0){\n printf(\"YES\");\n }\n\n }\n }\n}\n"}, {"source_code": "#include\nint main(){\n int n,r,count;\n scanf(\"%d\",&n);\n while(n>0){\n r=n%10;\n if((r==4)||(r==7)){\n count=0;\n }\n else\n break;\n n=n/10;\n}\nif(count==0){\n printf(\"YES\\n\");\n}\nelse if((n%4==0)||(n%7==0)||(n%44==0)||(n%47==0)||(n%74==0)||(n%77==0)||(n%444==0)||(n%447==0)||(n%474==0)||(n%477==0)||(n%744==0)||(n%747==0)||(n%774==0)||(n%777==0))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n==4||n==7||n==47||n==74||n==44||n==77||n==444||n==447||n==474||n==477||n==777||n==774||n==747||n==744||n%4==0||n%7==0||n==9||n==49||n==94||n==79||n==97||n==99||n==449||n==494||n==499||n==479||n==497||n==749||n==794||n==799||n==779||n==797||n==944||n==949||n==974||n==977||n==979||n==994||n==997||n==999||n%9==0)\n {\n printf(\"YES\");\n }\n else\n printf(\"NO\");\n\n\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n%4==0||n%7==0||n%47==0||n%74==0||n%4==0||n%447==0||n%474==0||n%744==0||n%774==0||n%777==0||n%444==0||n%44==0||n%77==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main()\n{\n\tint n,a,ok=0;\n\tdo\n\t{\n\t\tscanf(\"%d\",&n);\n\t}\n\twhile(n<1||n>1000);\n\t\n\t\tif (n%4==0||n%7==0)\n\t\t\tok=1;\n\t\telse\n\t\t{\n\t\t\tdo\n\t\t\t{\n\t\t\t\ta=n%10;\n\t\t\t\tif(a==4&&a==7)\n\t\t\t\t\tok=1;\n\t\t\t\telse\n\t\t\t\t\tok=0;\n\t\t\t\tn=n/10;\n\t\t\t}\n\t\t\twhile(n>0);\n\t\t}\t\n\t\t\n\tif(ok==1)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\t\n\treturn 0;\n\t\t\n}"}, {"source_code": "#include\nint main()\n{\n int n,a,i,m;\n scanf(\"%d\",&n);\n m=n;\n\n a=n%10;\n n=n/10;\n\n if(a==4||a==7)\n {\n while(n!=0)\n {\n a=n%10;\n n=n/10;\n if(a==4||a==7&n==4||n==7){\n\n printf(\"YES\");\n return 0;\n }\n else\n break;\n\n\n }\n }\n if(m==799){\n printf(\"YES\");\n return 0;\n }\n\n if(m%7==0||m%4==0){\n\n printf(\"YES\");\n return 0;\n }\n else printf(\"NO\");\n\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n\n\nint main() \n\n{\n\tchar a[100],b[100];\n\tint sum=0,newc=0,count=0,i,j,l[1000];\nint n,m,temp;\nscanf(\"%d\",&i);\nif(i%10==4||i%10==7)\n{\n\tnewc=i;\n\twhile(newc!=0)\n\t{\n\t \n\tnewc=newc/10;\n\tif(newc%10!=4&&newc%10!=7)\n\tbreak;\n}\n if(newc==0)\n printf(\"YES\");\n}\nelse \n{\n j=i;\n if((j%4)==0)\n printf(\"YES\");\n else if((j%7)==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n}\n\n\n}\n\n"}, {"source_code": "#include \nmain()\n{\n int n,f=0,x;\n scanf(\"%d\", &n);\n if(n>=1 && n<=1000) {\n if(n%4==0 || n%7==0){\n printf(\"YES\");\n }\n else if(n%4==1 || n%7==1){\n printf(\"YES\");\n }\n else {\n while(n!=0) {\n x=n%10;\n n/=10;\n if(x==7) {\n x=n%10;\n if(x==4) {\n f=1;\n }\n\n }\n }\n if(f==1) printf(\"YES\");\n else printf(\"NO\");\n }\n }\n}\n"}, {"source_code": "#include\nint main()\n{\n int i,n,arr[]= {4,7,44,47,74,77,444,447,474,477,744,747,774,777};\n scanf(\"d\",&n);\n for(i=0; i<14; i++)\n {\n if(n%arr[i])\n {\n for(; n; n/=10)\n {\n if(n%10==4||n%10==7)\n continue;\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n printf(\"YES\");\n }\n else\n {\n printf(\"YES\");\n return 0;\n }\n }\n for(; n; n/=10)\n {\n if(n%10==4||n%10==7)\n continue;\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include \nint main() \n{ \n int a,p,x,flag=1,q; \n scanf(\"%d\",&a); \n x=a;\n while(a>0) \n {\n p=a%10; \n a=a/10; \n if(p==4||p==7||x%4==0||x%7==0) \n { flag=0; } \n else {flag=1; break;}\n } \n if(flag==0) printf(\"YES\"); \n else if(flag==1) printf(\"NO\");\n }"}, {"source_code": "#include\nint main(){\n int n;\n scanf(\"%d\",&n);\n if(n%4==0||n%7==0||n%44==0||n%77==0||n%47==0||n%74==0||n%447==0||n%774==0||n%474==0||n%747==0||n%477==0||n%777==0)\n printf(\"Yes\\n\");\n else\n printf(\"No\");\n return 0;\n}"}, {"source_code": "#include\nint main(){\n\tint N;\n\tint c=0,d=0,u=0, NO=0;\n\tscanf(\"%d\", &N);\n\tc = (int) N/100;\n\td = (int) ((N - (c*100))/10);\n\tu = (int) (N - (c*100)) - (d*10);\n\tprintf(\"c = %d, d = %d, u = %d\\n\", c,d,u);\n\tif((c != 7 && c!= 4 && c!=0) || (d != 7 && d!= 4) || (u != 7 && u!= 4)){\n\t\tif(N%4 !=0 && N%7 !=0 && N%44 !=0 && N%77 !=0 && N%47 !=0 && N%74 !=0 && N%444 !=0 && N%447 !=0 && N%474 !=0 && N%744 !=0 && N%777 !=0 && N%774 !=0 && N%747 !=0 && N%477 !=0){\n\t\t\tprintf(\"NO\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"YES\\n\");\n\t\nreturn 0;\n}\n"}, {"source_code": "#include\n\nmain()\n{ int x,i,j=0,cn=0;\n scanf(\"%d\",&x);\nint b[100];\n char a[100];\n\n itoa(x,a,10);\n\n\n\n\n\n for(i=0;i\nint main ()\n{\n int n,a;\n a=n;\n scanf(\"%i\",&n);\n if(n-(n/10)*10==4 || n-(n/10)*10==7)\n {\n n=n/10;\n if(n-(n/10)*10==4 || n-(n/10)*10==7)\n {\n n=n/10;\n if(n-(n/10)*10==4 || n-(n/10)*10==7 || n-(n/10)*10==0) printf(\"YES\");\n }\n else if(n-(n/10)*10==0) printf(\"YES\");\n }\n if(n%4==0 || n%7==0) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,a,i,j,l=0,lo=0,cnt=0;\n scanf(\"%d\",&n);\n j=n;\n for(i=0;j!=0;i++)\n {\n a=j%10;\n cnt++;\n j/=10;\n if(a==4||a==7)\n {\n lo+=1;\n continue;\n }\n else l=1;\n }\n if(lo==cnt)\n {\n printf(\"YES\");\n }\n if(l==1)\n {\n if(a%4==0||a%7==0)\n {\n printf(\"YES\");\n }\n else\n {\n if(a%4==3&&a%7<3||a%4<3&&a%7<=3)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,s,w=0,r,c=0,l;\n scanf(\"%d\",&n);\n s=n%10;\n r=n/10;\n l=r/10;\n if(n%4==0||n%7==0)\n {\n w++;\n }\n else if(n<99)\n {\n if(s==4||s==7)\n w++;\n }\n else if(n>99)\n {\n if(l==7||l==4)\n c++;\n }\n if(w==0&&c==0)\n {\n printf(\"NO\\n\");\n }\n else\n {\n printf(\"YES\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include\nmain()\n{\n\tint d,c=0,f=0,j,m,i,n;\n\tscanf(\"%d\",&n);\n\t\n\tfor(i=n;i>0;i=i/10)\n\t{\n\t\tc++;\n\t\td=i%10;\n\t\tif(d==4||d==7)\n\t\t{\n\t\t\tf++;\n\t\t}\n\t}\n\tif(c==f)\n\t\tprintf(\"YES\");\n\t\n\t\n\t\n\telse if(c!=f)\n\t{\n\tf=0;\n\t\n\tfor(i=1;i<=n;i++)\n\t{\tc=0;\n\t\tm=n/i;\n\t\t\n\t\tfor(j=m;j>0;j=j/10)\n\t\t{\n\t\t\tc++;\n\t\t\td=j%10;\n\t\t\tif(d==4||d==7)\n\t\t\t{\n\t\t\t\tf++;\n\t\t\t}\n\t\t}\n\t\tif(c==f)\n\t\t{\n\t\t\n\t\t\tprintf(\"YES\");\n\t\t\tbreak;\n\t\t}\n\tif(c==f)\n\t\tbreak;\n\t}\n\t}\n/*\tif(c!=f)\n\t{\n\t\n\tif(n%4==0||n%7==0)\n\tprintf(\"YES\");\n\telse \n\tprintf(\"NO\");\n\t}*/\n\telse \n\tprintf(\"NO\");\n\t\n\t\n}\n"}, {"source_code": "#include \nint main() \n{ \n int a,p,x,flag=1,q; scanf(\"%d\",&a); x=a; \n while(a>0) \n { p=a%10; a=a/10; if(p==4||p==7||x%4==0||x%7==0) { flag=0;} else {flag=1;break;} } if(flag==0) printf(\"YES\"); else if(flag==1) printf(\"NO\"); }"}, {"source_code": "#include \n#include \n\nint main(){\n int n,k,sum=0,count=0;\n scanf(\"%d\",&n);\n if(n%4==0 || n%7==0){\n printf(\"YES\");\n }else{\n while(n!=0){\n k=n%10;\n sum++;\n n=n/10;\n if(k==4 || k==7){\n count++;\n }\n }if(count==sum){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int n,q,a,b,c,d,j=0,i;\n double l;\n scanf(\"%d\",&n);\n l= log10(n);\n q=l+.5+1;\n\n d=n;\n for(i=0;;i++)\n {\n c=d%10;\n d=d/10;\n if((c!=4)&&(c!=7))\n j=1;\n if (d==0)\n break;\n\n }\n\n a=n%4;\n b=n%7;\n if (j==0)\n printf(\"YES\");\n else if(a==0)\n {\n printf(\"YES\");\n }\n else if(b==0)\n {\n printf(\"YES\");\n }\n else\n printf(\"NO\");\n return 0;\n\n}\n"}, {"source_code": "#include\nint main()\n{\nint n,m,i=1;\ndo\n{\nprintf(\"n=\");\nscanf(\"%d\",&n);\n}\nwhile((n<1)||(n>1000));\nm=(n%10);\nint nod(int n)\n{ int i=0;\nwhile (n)\n{ n=n/10;\n i++;\n}\nreturn(i+1);\n}\nwhile(((m==4)||(m==7))&&(i<=nod(n)))\n{ m=(n%10);\n n=(n/10);\n i++;\n}\nif(i==nod(n))\nprintf(\"YES\");\nelse if((n%4==0)||(n%7==0))\nprintf(\"YES\");\nelse printf(\"NO\");\n}\n"}, {"source_code": "#include\nint main()\n{\n int i,x,sum=0;\n scanf(\"%d\",&x);\n if(x==4||x==7)\n {\n printf(\"YES\\n\");\n return 0;\n }\n if(x%4==0||x%7==0)\n {\n printf(\"YES\\n\");\n }\n\n else{\n do\n {\n\n if(x%10!=4&&x%10!=7)\n {\n printf(\"NO\\n\");\n return 0;\n }\n else\n {\n printf(\"YES\\n\");\n return 0;\n }\n x=x/10;\n }while(x>0);\n }\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,i,len,count,x,y,j,q,flag;\n\tlen=0,count=0;\n\tscanf(\"%d\",&n);\n\ty=n;\n\tj=n/4;\n\tq=n/7;\n\tif((j%2==0&&j*4==n)||(q%2==0&&q*7==n)){\n\n\t\t\tprintf(\"YES\\n\");\n\n\t}\n\n\telse{\n\n\t\twhile(n!=0){\n\t\tn=n/10;\n\t\tlen++;\n\t}\n\n\tn=y;\n\n\twhile(n!=0){\n\t\tx=n%10;\n\t\tif(x==4||x==7){\n\t\t\tcount++;\n\n\t\t}\n\t\tn=n/10;\n\t}\n\tif(count==len){\n\t\tprintf(\"YES\\n\");\n\t}\n\telse{\n\t\tprintf(\"NO\\n\");\n\t}\n\t}\n\n}"}, {"source_code": "#include\nint main()\n{\n int i,j,count=0;\n char s[1000];\n scanf(\"%s\",s);\n int m=strlen(s);\n int num=atoi(s);\n if(num==799)\n printf(\"YES\\n\");\n else if(num%4==0||num%7==0)\n\n printf(\"YES\\n\");\n else {\n for(i=0;i\n#include\n\nvoid name_correction(char *s)\n{\n int i;\n for(i=0; s[i]; i++) {\n if(s[i] >= 'A' && s[i] <= 'Z') s[i] = s[i] - 'A' + 'a';\n }\n}\n\nint main()\n{\n char str1[105];\n char str2[105];\n\n scanf(\"%s\", str1);\n scanf(\"%s\", str2);\n\n name_correction(str1);\n name_correction(str2);\n\n printf(\"%d\\n\", strcmp(str1, str2));\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n\nint main()\n{\n int a,temp,flag,x,num;\n scanf(\"%d\",&num);\n temp=num;\n flag=0;\n\n if(num>=1 && num<=100)\n {\n while(temp>0)\n {\n x=temp%10;\n if(x==4||x==7)\n {\n flag=1;\n\n }\n else\n {\n flag=0;\n break;\n }\n temp=temp/10;\n\n }\n if(flag==1)\n {\n printf(\"YES\");\n }\n else if((num%4==0 || num%7==0) )\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n\n\n\n\n\n\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\n int a,c=1,d,b=0;\n scanf(\"%d\",&a);\n d=a;\n if(a%4==0||(a+1)%7==0||a%7==0)\n printf(\"YES\");\n\n else\n {\n c=0;\n while(d!=0)\n {\n if(d%10==4||d%10==7)\n {\n c++;\n }\n d=d/10;\n b++;\n }\n }\n\n if(c==b)\n printf(\"YES\");\n else if(a%4!=0&&a%7!=0)\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n int x,y,z;\n scanf(\"%d\", &x);\n y = x%4;\n z = x%7;\n if(y == 0 || z==0)\n {\n printf(\"YES\");\n }\n else\n {\n int a[4];\n a[0] = x%10;\n x = x/10;\n a[1] = x%10;\n x = x/10;\n a[2] = x%10;\n x = x/10;\n a[3] = x%10;\n\n if((a[0] ==4 || a[0] ==7 || a[0] ==0) && (a[1] ==4 || a[1] ==7 || a[1] ==0) && (a[2] ==4 || a[2] ==7 || a[2] ==0) && (a[3] ==4 || a[3] ==7 || a[3] ==0) )\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n\n }\n }\n}"}, {"source_code": "#include\n#include\nint main(){\n int n;\n scanf(\"%d\",&n);\n if(n==274){\n printf(\"NO\");\n return 0;\n }\n \n if(n%4==0||n%7==0){\n printf(\"YES\");\n return 0;\n }\n for(int i=0;n!=0;i++){\n int x=n%10;\n if(x==4){\n printf(\"YES\");\n return 0;\n }\n n=n/10;\n }\n printf(\"NO\");\n return 0;\n} "}, {"source_code": "#include\nint main()\n{\n\tint i,n,k=0,arr[15]={4,7,44,47,74,77,444,447,474,477,744,747,774,777};\n\tscanf(\"%d\",&n);\n\tfor (i=0;i<14;i++)\n\t{\n\t\tif (n%arr[i]==0)\n\t\t{\n\t\t\tk=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (k==1)\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse if (k==0)\n\t{\n\t\tprintf(\"N0\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n#include \nint main(){\nint a[14]={4,7,77,44,47,74,447,774,474,444,777,744,774,747};\nint x,z=0;\nscanf(\"%d\",&x);\nint i;\nfor(i=0;i<14;i++){\n if(x==a[i]){\n printf(\"YES\");\n break;\n }\n else z++;\n}\nif(z==14){printf(\"NO\");}\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int i,c,n,a;\n double b,d;\n\n scanf(\"%d\",&n);\n if (n%7 || n%4)\n printf(\"YES\");\n else{\n for (i=0;i<3;i++)\n {\n a=n/10;\n b=n/10.0;\n d=b-a;\n c=d*10;\n n=n/10;\n\n if (c==7 || c==4)\n continue;\n else printf(\"NO\");\n\n }\n printf(\"YES\");}\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,a,b,c;\n scanf(\"%d\",&n);\n\n a=n/10;\n b=n%10;\n c=a%10;\n\n if(n%4==0 || n%7==0)\n printf(\"YES\\n\");\n\n else if(b==4 || b==7 || c==4 || c==7)\n printf(\"YES\\n\");\n\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\n int n;\n scanf(\"%d\",&n);\n if( n%10 == 4 || n%10 == 7 ){\n while(n>0){\n\n if( n%10 == 4 || n%10 == 7 ){\n n/=10;\n ///printf(\"YES\\n\");\n ///return 0;\n }\n else\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n printf(\"YES\\n\");\n return 0;\n }\n if ( n%4 == 0 || n%7 == 0 )\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include\ntypedef int bool;\nenum {false,true};\nint main()\n{\n int n,digit,i,temp,c;\n bool a,b,x=true;\n scanf(\"%d\",&n);\n temp=n;\n while(n>0)\n {\n digit=n%10;\n if((digit==4 || digit==7))\n a=a*true;\n else\n goto label;\n n=n/10;\n }\n if(a)\n {\n printf(\"YES\");\n return 0;\n }\n label:\n n=temp;\n for(i=4;i0)\n {\n digit=c%10;\n if(digit==4 || digit==7)\n {\n x=x*true;\n }\n else\n {\n x=x*false;\n }\n c=c/10;\n }\n if(n%i==0 && x)\n {\n printf(\"YES\");\n return 0;\n }\n else\n continue;\n }\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \n\n\nint main()\n{\n int n,l=0,i=0,j=1,a,c,b=0;\n scanf(\"%d\",&n);\n do\n {\n l++;\n c=trunc(pow(10,l));\n\n } while(n%c!=n);\n a=n%10;\n while(b\nint main(){\n int n,c=0,d=0,rem;\n scanf(\"%d\",&n);\n while(n>0){\n rem=n%10;\n if(rem == 4 || rem == 7){\n c++;\n }\n n=n/10;\n d++;\n }\n if(d==c){\n printf(\"YES\");\n }\n else if(n%4 == 0 || n%7 == 0){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n}"}, {"source_code": "#include\n#include\nint main()\n{\n char ara[1005];\n int i,len,flag=0,temp=0;\n double len2;\n gets(ara);\n len=strlen(ara);\n len2=pow(10,len-1);\n for(i=0;i\n\nint main(void)\n{\n\tint n;\n\t//scanf(\"%d\", &n);\n\n\tfor(n = 1; n<= 1000; n++){\n\t\tif(n%4==0 || n%4==7){\n\t\t\tprintf(\"%d\\n\", n);\n\t\t\tprintf(\"Yes\\n\");\t\n\t\t}else{\n\t\t\tprintf(\"%d\\n\", n);\n\t\t\tprintf(\"No\\n\");\t\t\n\t\t}\n\t}\n\t\n\t//return 0;\n}\n"}, {"source_code": "#include\nint main()\n{ int m,n;\n scanf(\"%d\",&n);\n while(n>0)\n { m=n%10;\n if(m==4||m==7)\n { n/=10;\n }\n else{\n n=1;\n break;}\n }\n if(n==1)\n printf(\"NO\");\n else\n printf(\"YES\");\n}"}, {"source_code": "#include\nint main()\n{\n int n,i,j,k,l;\n scanf(\"%d\",&n);\n for(;;)\n {\n k=n%10;\n if(k==4||k==7||!(n%4)||!(n%7))\n l=1;\n else\n {\n break;\n l=0;\n }\n n=n/10;\n if(n==0)\n break;\n }\n if(l==1)\n printf(\"YES\\n\");\n else if(l==0)\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include\nint judge(int t){\n\t\twhile(t){\n\t\tif((t % 10 != 4) && (t % 10 != 7)) break;\n\t\tt /= 10;\n\t}\n\treturn t;\n}\n//判断t是否为幸运数; \n\nint main(){\n\tint n;\n\tscanf(\"%d\", &n);\n\tint t, i;\n\tt = n;\n\tjudge(t);\n\tif(t != 0){\n\t\tfor(i = 0; i < n; i++){\n\t\t\tif(judge(i))\n\t\t\t\tif(n % i == 0){\n\t\t\t\t\tprintf(\"YES\"); break;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tprintf(\"NO\"); break;\n\t\t\t\t} \n\t\t}\n\t}\n\telse printf(\"YES\");\n\treturn 0;\n}\n\t \t\t \t \t \t \t \t\t\t \t\t\t \t\t\t \t"}, {"source_code": "#include \n\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\t\n\tif(n==4 || n== 7 || n==47 || n == 74)\n\t{\n\t\tprintf(\"YES\\n\");\n\t}\n\telse if ( n % 4 == 0 || n % 7 == 0)\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 \nmain()\n{\n int n,f=0,x;\n scanf(\"%d\", &n);\n if(n>=1 && n<=1000) {\n if(n%4==0 || n%7==0){\n printf(\"YES\");\n }\n else if(n%4==1){\n printf(\"YES\");\n }\n else {\n while(n!=0) {\n x=n%10;\n n/=10;\n if(x==7) {\n x=n%10;\n if(x==4) {\n f=1;\n }\n\n }\n }\n if(f==1) printf(\"YES\");\n else printf(\"NO\");\n }\n }\n}\n"}, {"source_code": "#include\nint main(){\n int a,b,n,i;\n scanf(\"%d\",&n);\n\n if(n%4==4 || n%7==7){\n printf(\"YES\");\n }\n\n else if(n>0){\n for(i=0;n>0;i++){\n a=n%10;\n if(a!=7 & a!=4){\n printf(\"NO\");\n break;\n }\n\n n=n/10;\n if(n==0){\n printf(\"YES\");\n }\n\n }\n }\n}\n"}, {"source_code": "#include\nint main(){\nint n,c=0,r[5],i=-1;\nscanf(\"%d\",&n);\nif(n%4==0||n%7==0){\n printf(\"YES\");\n return 0;\n}\nwhile(n>0){\n i++;\n r[i]=n%10;\n n=n/10;\n\n}\nfor(i=0;i<3;i++){\nif(r[i]==7||r[i]==4){\n continue;}\nelse{\n c=1;\n break;\n}\n}\n\nif(c!=0){printf(\"NO\");}\nelse {printf(\"YES\");}\nreturn 0;\n\n}"}, {"source_code": "#include \n#include \n#include \n\nint main()\n{\n int i,a,m=1,count=0;\n int c[4];\n scanf(\"%d\",&a);\n memset(c,0,sizeof(c));\n c[0]=a%10;\n c[1]=a/10%10;\n c[2]=a/100%10;\n c[3]=a/1000;\n if(a>10&&a<100)\n {\n m=2;\n }\n if(a>100&&a<1000)\n {\n m=3;\n }\n if(a>1000)\n {\n m=4;\n }\n for(i=0;i0)\n {\n if(a%2==1)\n {\n a-=7;\n }\n else\n {\n while(a%4==0&&a%7!=0)\n {\n a-=4;\n }\n while(a%2==0&&a>0)\n {\n a-=7;\n }\n }\n }\n\n if(a==0)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main(){\nchar a[1000];\nint i,j,k,x=0,z=0,l,s=0,b,c,d,e,f,g,h,p,q=0,r=0;\ngets(a);\nl=strlen(a);\nfor(i=0;i\n\nmain()\n{ int n,i,r,res;\nint T[3];\nint c=0,d=0,u=0;\n\nscanf(\"%d\",&n);\nr=n;\nres=0;\nif (r==1000)\nres=1;\nif (r==799)\nres=1;\nif (r==49)\nres=1;\n\n\n\n\nwhile(r>=100)\n{c++;\nr-=100;\n}\nwhile(r>=10)\n{d++;\nr-=10;\n}\nwhile(r>=1)\n{u++;\nr-=1;\n}\n\nif (u==4 || u==7 )\n{\t\n\tif (d==4 || d==7 )\n\t{\t\n\t\tif (c==4 || c==7 || c==0 )\n\t\tres=1;\n\t\t\n\t}\n\telse if (d==0 )\n\t\tif (c!=0)\n\t\tres=0;\n\t \n\t else \n\t \n\t res=1;\n\t\n}\nif (res==0)\n{\tif (n%4==0 || n%7==0)\n res=1;\n \n}\n\nif (res==0)\nprintf(\"NO\");\nelse \n printf(\"YES\");\n}\n\n\n"}, {"source_code": "#include\nint main()\n{ int m,n;\n scanf(\"%d\",&n);\n while(n>0)\n { m=n%10;\n if(m!=4||m!=7)\n { n=1;\n break;}\n n=n/10;\n }\n if(n==1)\n printf(\"NO\");\n else\n printf(\"YES\");\n}"}, {"source_code": "#include\nint main()\n{\n int a[100],i,l,b=0,n,c,d;\n scanf(\"%d\",&c);\n n=c;\n for(i=0;n!=0;i++)\n {\n a[i]=n%10;\n n=n/10;\n if(a[i]==4||a[i]==7)\n {\n b++;\n }\n else{b=0;}\n }\n d=c;\n if((d%4==0)||(d%7==0))\n {\n b=2;\n }\nif(b>=2)\n{\n printf(\"YES\");\n}\nelse\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \nmain (){\n int n;\n scanf (\"%d\",&n);\n if(n>0)\n {\n if(((n%47)==0)||((n%4)==0)||(n==7))\n printf(\"YES\");\n else printf (\"NO\");\n }\n else printf (\"NO\");\n}"}, {"source_code": "#include\n#include\nint main()\n{\n int a,m,n;\n scanf(\"%d\",&n);\n m=n;\n do\n {\n a=n%10;\n if(a!=7 && a!=4) \n break;\n n=n/10;\n }while(n!=0);\nif(n==0 || m%4==0 ||m%7==0) \n printf(\"YES\");\nelse\n printf(\"NO\");\nreturn 0;\n \n}"}, {"source_code": "#include\nint main()\n{\n int a;\n scanf(\"%d\",&a);\n\n if((a%4==0) || (a%7==0) || (a%47==0) || (a%74==0) || (a%444==0) || (a%447==0) || (a%474==0) || (a%744==0) || (a%747==0) || (a%777==0))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n}\n"}, {"source_code": "#include\nint main ()\n{\n int n,i,j=0,k,rem,res ;\n\n scanf(\"%d\",&n) ;\n i=n ;\n\n while (n!=0)\n {\n\n\n res=n/10 ;\n rem =n%10 ;\n n=res ;\n j++ ;\n\n if(j==2)\n {\n break ;\n }\n }\n\n // printf(\"%d\",rem) ;\n\n if(rem==4||rem==7)\n {\n printf(\"YES\") ;\n }\n else if (i%4==0||i%7==0)\n {\n printf(\"YES\") ;\n }\n\n else\n printf(\"NO\") ;\n\n return 0 ;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tint x, y, a, b, c,z;\n\tscanf(\"%d\", &x);\n\tif (x % 7 == 0 || x % 4 == 0)printf(\"YES\");\n\telse while (x > 0){\n\t\t\ty = x % 10;\n\t\t\tif (y == 7)a++;\n\t\t\telse if (y == 4)b++;\n\t\t\tc++;\n\t\t\tx = x/ 10;\n\t\t}\n\t\tz = a + b;\n\t\tif (z==c)printf(\"YES\");\n\t\telse printf(\"NO\");\n\t\n\n\treturn 0;\n}"}, {"source_code": "#include \nmain (){\n \n int n;\n scanf (\"%d\",&n);\n if((n>0)&&(n<1000))\n {\n if(((n%47)==0)||((n%4)==0)||((n%744)==0))\n printf(\"YES\");\n else printf (\"NO\");\n }\n else printf (\"NO\");\n}"}, {"source_code": "#include\nint main()\n{\n int n,i,a[12]={4,7,44,77,47,74,444,777,447,474,747,774};\n scanf(\"%d\",&n);\n if(n>0){\n for(i=0;i<11;i++){\n if(n==a[i] || n%a[i]==0){\n printf(\"YES\");\n return 0;\n }\n }\n }\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,temp,r,count=0,count1=0,z,y;\n scanf(\"%d\",&n);\n if(n/4==4||n/7==7)\n {\n printf(\"YES\");\n\n }\n else\n {\n temp=n;\n while(temp!=0)\n {\n r=temp%10;\n temp=temp/10;\n count++;\n }\n temp=n;\n while(temp!=0)\n {\n r=temp%10;\n temp=temp/10;\n if(r==4||r==7)\n count1++;\n else\n break;\n }\n\n if(count==count1)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n\n return 0;\n\n\n}"}, {"source_code": "#include\n\nmain()\n{ int x,i,j=0,cn=0;\n scanf(\"%d\",&x);\nint b[100];\n char a[100];\n\n itoa(x,a,10);\n\n\n\n\n\n for(i=0;i\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int flag=2;\nif (n%4==0 || n%7==0)\n printf(\"YES\");\nelse{\n while(n>0){\n if(n%10==4 || n%10==7){\n flag=0;\n }\n else\n if(n%10==9 && flag==0)\n {\n flag=0;\n }\n else\n {\n flag=1;\n break;\n }\n \n n/=10;\n }\n if (flag==1)\n printf(\"NO\");\n else\n printf(\"YES\");\n}return 0;\n}"}, {"source_code": "#include\nint main( )\n{\n int n , a = 7 , flag = 0 , i ;\n int array[] = { 4 , 7,47, 77 , 74, 447, 744, 477};\n int sum_four , sum_seven ;\n scanf(\"%d\", &n );\n\n for( i = 0 ; i < a ; i++)\n {\n if(n%array[i] ==0)\n {\n flag = 1 ;\n printf(\"YES\\n\") ;\n }\n }\n if(flag==0)\n printf(\"NO\\n\");\n\n return 0 ;\n}\n"}, {"source_code": "#include\n#include\n\nint lucky(int x)\n{\n int y[1000],c1=0,c2=0,c=0;\n for(int j=0;x>0;j++)\n {\n y[j]=x%10;\n if(y[j]==4) c1++;\n if(y[j]==7) c2++;\n c++;\n x=x/10;\n }\n if((c1+c2)==c) return 1;\n else return 0;\n\n}\nint al_lucky(int x)\n{\n if(lucky(x))\n return 1;\n for(int i=2;i*i<=x;i++)\n {\n if(x%i==0&&(lucky(x)||lucky(x/i)))\n return 1;\n }\n return 0;\n\n}\n\nint main()\n{\n int a;\n scanf(\"%d\",&a);\n if(al_lucky(a))\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n }\n\n\n"}, {"source_code": "#include\nint main()\n{\n\tint n,m,a[100],i=0,j,k=0;\n\tscanf(\"%d\",&n);\n\tm=n;\n\twhile(m%10!=0)\n\t{\n\t\ta[i++]=m%10;\n\t\tm/=10;\n\t}\n\tfor(j=0;j\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int flag=0;\nif (n%4==0 || n%7==0)\n printf(\"YES\");\nelse{\n while(n>0){\n if(n%10==4 || n%10==7 || flag==3){\n flag=0;\n }\n else\n if((n%10==9 )&& (flag==0))\n {\n flag=3;\n }\n else\n {\n flag=1;\n break;\n }\n \n n/=10;\n }\n if (flag==1)\n printf(\"NO\");\n else \n printf(\"YES\");\n}return 0;\n}"}, {"source_code": "#include \nmain (){\n \n int n;\n scanf (\"%d\",&n);\n if((n>0)&&(n<1000))\n {\n if(((n%47)==0)||((n%4)==0)||((n%10)==7))\n printf(\"YES\");\n else printf (\"NO\");\n }\n else printf (\"NO\");\n}"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n printf(n%4 && n%477 && n%7 && 744%n ? \"No\": \"Yes\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include\n#include\n\n\nint main()\n{\n\n long i,n,ra[1000],ra1,t1,ra2,ra3,ra4,t2,rem=0,m,q,tem=0,j;\n scanf(\"%ld\",&n);\n long s[1000];\n q=n;\n for(i=0;n!=0;i++)\n {\n s[i]=n%10;\n n=n/10;\n\n\n }\n for(j=0;j<=i;j++)\n {\n if(s[j]==4 || s[j]==7)\n {\n tem++;\n }\n }\n for(j=0;j<=i;j++)\n {\n if(j==0)\n {\n t1=0;\n }\n else\n {\n t1=pow(10,j);\n\n }\n t2=pow(10,j+1);\n ra1=4+t1*4;\n ra2=7+t1*7;\n ra3=ra1*t2+ra2;\n ra4=ra2*t2 +ra1;\n if(q%ra1==0 || q%ra2==0 || q%ra3==0 || q%ra4==0)\n {\n\n m=10;\n break;\n }\n\n\n\n }\n\n if(tem==i || m==10) printf(\"YES\");\n\n else printf(\"NO\");\n\n return 0;\n\n}\n"}, {"source_code": "#include\n#include\n\nint main()\n{\n int n,digit,i,temp,c;\n bool a,b=true,x=true;\n scanf(\"%d\",&n);\n temp=n;\n while(n>0)\n {\n digit=n%10;\n if((digit==4 || digit==7))\n a=true;\n else\n goto label;\n n=n/10;\n }\n if(a)\n {\n printf(\"YES\");\n return 0;\n }\n label:\n n=temp;\n for(i=4;i0)\n {\n digit=c%10;\n if(digit==4 || digit==7)\n {\n x=x*true;\n }\n else\n {\n x=x*false;\n }\n c=c/10;\n }\n if(n%i==0 && x)\n {\n printf(\"YES\");\n return 0;\n }\n else\n continue;\n }\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \n\n\nint main (){\n int t[8]={4,7,44,47,74,77,444,777};\n int n,i;\n\n scanf (\"%d\",&n);\n\n\n for (i=0; i<9; i++){\n if (n%t[i]==0){\n printf (\"YES\");\n return 0;\n }\n\n }\n\n\n printf (\"NO\");\n\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int x;\n scanf(\"%d\", &x);\n if(x==4)\n {\n printf(\"YES\");\n }\n else if(x==7)\n {\n printf(\"YES\");\n\n }\n else if(x==47)\n {\n printf(\"YES\");\n\n }\n else if(x==74)\n {\n printf(\"YES\");\n\n }\n else if(x==44)\n {\n printf(\"YES\");\n\n }\n else if(x==77)\n {\n printf(\"YES\");\n\n }\n else if(x==444)\n {\n printf(\"YES\");\n }\n else if(x==447)\n {\n printf(\"YES\");\n\n }\n else if(x==474)\n {\n printf(\"YES\");\n\n }\n else if(x==477)\n {\n printf(\"YES\");\n\n }\n else if(x==744)\n {\n printf(\"YES\");\n\n }\n else if(x==747)\n {\n printf(\"YES\");\n\n }\n else if(x==777)\n {\n printf(\"YES\");\n\n }\n else if(x==774)\n {\n printf(\"YES\");\n\n }\n else if(x%4==0)\n {\n printf(\"YES\");\n }\n else if(x%7==0)\n {\n printf(\"YES\");\n\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n>=1&&n<=1000){\n if(n==4||n==7||n==74||n==47||n==774||n==477||n==747||n==444||n==777||n==447||n==744||n==474){\n printf(\"YES\");\n }\n else if(n%4==0||n%7==0){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n }\n\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,c,d,e;\n scanf(\"%d\",&a);\n if(a%4==0)\n {\n printf(\"YES\");\n }\n else if(a%7==0)\n {\n printf(\"YES\");\n }\n else if(a%47==0)\n {\n printf(\"YES\");\n }\n else if(a%74==0)\n {\n printf(\"YES\");\n }\n else if(a%444&&447&&474&&747&&477&&774&&777==0)\n {\n printf(\"YES\");\n }\n else printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n\nvoid Merge(int *arr, int i, int k, int j)\n{\n int p, l=i, r=k+1, a=0, temp_arr[j-i+1];\n while(l<=k && r<=j)\n {\n if(arr[l]\nint main()\n{\n\tint n,i,len,count,x,y,j,q,flag;\n\tlen=0,count=0;\n\tscanf(\"%d\",&n);\n\ty=n;\n\tj=n/4;\n\tq=n/7;\n\tif((j%2==0&&j*4==n)||(q%2==0&&q*7==n)){\n\n\t\t\tprintf(\"YES\\n\");\n\n\t}\n\n\telse{\n\n\t\twhile(n!=0){\n\t\tn=n/10;\n\t\tlen++;\n\t}\n\n\tn=y;\n\n\twhile(n!=0){\n\t\tx=n%10;\n\t\tif(x==4||x==7){\n\t\t\tcount++;\n\n\t\t}\n\t\tn=n/10;\n\t}\n\tif(count==len){\n\t\tprintf(\"YES\\n\");\n\t}\n\telse{\n\t\tprintf(\"NO\\n\");\n\t}\n\t}\n\n}"}, {"source_code": "\n #include \n\n\nint main() {\n\tint x;\n\tscanf(\"%d\",&x);\n\tif(x==47||x==744||x==477||x%4==0||x%7==0||x==799||x==94){\n\tprintf(\"YES\");}\n\n\t\telse {\n\tprintf(\"NO\");}\n\t\n\treturn 0;\n}"}, {"source_code": "#include \n#include \nint main() {\n int n;\n int flag = 0;\n int nums[12] = {4, 7, 44, 77, 47, 74, 447, 444, 474, 777, 747, 774, 744};\n scanf(\"%d\", &n);\n for (int i = 12; i >= 0; i--) {\n if (n == nums[i]) {\n printf(\"YES\");\n flag = 1;\n break;\n }\n }\n if (flag == 0) {\n for (int i = 0; i < 13; i++) {\n\n {\n if (n % nums[i] == 0) {\n printf(\"YES\");\n break;\n } else {\n printf(\"NO\");\n break;\n }\n }\n }\n }\n}\n"}, {"source_code": "\t#include\nint main()\n{\n\tint n,i,len,count,x,y,j,q,flag;\n\tlen=0,count=0;\n\tscanf(\"%d\",&n);\n\ty=n;\n\tj=n/4;\n\tq=n/7;\n\tif((j*4==n)||(q*7==n)){\n\n\t\t\tprintf(\"YES\\n\");\n\n\t}\n\n\telse{\n\n\t\twhile(n!=0){\n\t\tn=n/10;\n\t\tlen++;\n\t}\n\n\tn=y;\n\n\twhile(n!=0){\n\t\tx=n%10;\n\t\tif(x==4||x==7){\n\t\t\tcount++;\n\n\t\t}\n\t\tn=n/10;\n\t}\n\tif(count==len){\n\t\tprintf(\"YES\\n\");\n\t}\n\telse{\n\t\tprintf(\"NO\\n\");\n\t}\n\t}\n\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int a,b,c,l,i,m=0;\n long long int n;\n scanf(\"%lld\",&n);\n if(n%4==0||n%7==0)\n printf(\"YES\\n\");\n else{\n for(i=1;i<1000;i++)\n {\n l=n%10;\n n=n/10;\n c=i;\n if(l==4||l==7||l==9)\n {\n m++;\n\n\n }\n if(n==0)\n break;\n\n\n }\n\n if(m==c)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n\n return 0;\n}\n\n\n\n\n\n"}, {"source_code": "#include\n#include\n\nbool Div(int num){\n\tif(num%4 == 0 || num%7 == 0){\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nmain(){\n\tint input;\n\tscanf(\"%d\",&input);\n\n\tint ones = input%10;\n\tint tens = input%100 - ones;\n\tint hundreds = input%1000 - tens - ones;\n\n\tif(input == 0){\n\t\tprintf(\"NO\");\n\t}\n\telse if(Div(input)){\n\t\tprintf(\"YES\");\n\t}else if(Div(ones) && Div(tens) && Div(hundreds)){\n\t\tprintf(\"YES\");\n\t}else{\n\t\tprintf(\"NO\");\n\t}\n\n}"}, {"source_code": "#include\n#include\nint main()\n{\n int64_t x,y,z=0;\n scanf(\"%I64d\",&y);\n for(x=0;x<3;x++)\n {\n if(y%10==7 || y%10==4)\n {\n y=y/10;\n z=1;\n }\n else{z=0;\n break;}\n }\n\n\n\n\n if(z==1)\n printf(\"Yes\");\n else\n printf(\"No\");\n\n\n return 0;\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,i;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++)\n {\n if(n%4==0 && n%7==0)\n {\n printf(\"YES\");\n }\n else\n printf(\"NO\");\n return 0;\n }\n}"}, {"source_code": "#include \n\n\nint main (){\n int t[8]={4,7,44,47,74,77,444,777};\n int n,i;\n \n scanf (\"%d\",&n);\n \n\n\n for (i=0; i<9; i++){\n if (n%t[i]==0){\n printf (\"YES\");\n return 0;\n }\n\n }\n\n\n printf (\"NO\");\n\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int s, a;\n char num[4];\n gets (num);\n s=strlen(num);\n if ( s == 1 && ( num[0] == '4' || num[0] == '7' || num[0] == '8')) printf (\"YES\");\n else if ( s == 2 )\n {\n a = ((num[0]-48)*10)+(num[1]-48);\n if (( num[0] == '4' || num[0] == '7' ) && ( num[1] == '4' || num[1] == '7' )) printf (\"YES\");\n else if ( a%4 == 0 || a%7 == 0 ) printf (\"YES\");\n else printf (\"NO\");\n }\n else if ( s == 3 )\n {\n a = ((num[0]-48)*100)+((num[1]-48)*10)+(num[2]-48);\n if (( num[0] == '4' || num[0] == '7' ) && ( num[1] == '4' || num[1] == '7' ) && ( num[2] == '4' || num[2] == '7' )) printf (\"YES\");\n else if ( a%4 == 0 || a%7 == 0 || a%74 == 0 || a%47 == 0 ) printf (\"YES\");\n else printf (\"NO\");\n }\n else if ( num[0] == '1' && num[1] == '0' && num[2] == '0' && num[3] == '0' ) printf (\"YES\");\n else printf (\"NO\");\n return 0;\n}"}, {"source_code": "#include\nint main(){\n int n;\n scanf(\"%d\",&n);\n if(n%4 == 0 || n%7 == 0){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n}"}, {"source_code": "#include \n#include \n#include \nint main()\n{\n int x ;\n scanf(\"%d\",&x);\n if(x==799){printf(\"YES\"); return 0;}\n \n if(x%4==0||x%7==0){printf(\"YES\"); return 0;}\n\n while(x!=0){\n if(x%10!=4&&x%10!=7){break;}\n x=x/10;\n }\n if(x==0){printf(\"YES\");}\n else {printf(\"NO\");}\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,i;\n scanf(\"%d\",&n);\n if(n%4==0 || n%14==0)\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n for(i=n;i>0;i=i/10)\n {\n if(i%10!=4 || i%10!=7)\n {\n printf(\"NO\");\n return 0;\n }\n }\n printf(\"YES\");\n return 0;\n }\n}"}, {"source_code": "#include\nint main(){\n int n;\n scanf(\"%d\",&n);\n if(n%4 == 0 || n%7 == 0){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n}"}, {"source_code": "#include \nint main()\n{\n long long n;\n int flag,i=0,a[100],j;\n\n\n scanf(\"%lld\", &n);\n\n while(n!=0)\n {\n a[i]=n%10;\n n=n/10;\n i++;\n }\n\nfor(j=0;j\n#include\n#include\nmain()\n{\n int n,i,len,cnt=0;\n char a[100];\n gets(a);\n len=strlen(a);\n for(i=0;i\n#include\n#include\nint main()\n{\n int x,flag=0,i,temp;\n scanf(\"%d\",&x);\n if(x%4==0||x%7==0)\n {\n printf(\"YES\");\n return 0;\n }\n for(i=0;x>0;i++)\n {\n temp=x%10;\n if(temp==4||temp==7)\n flag=1;\n else\n {\n flag=0;\n break;\n }\n x=x/10;\n }\n if(flag==1)\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n}\n"}, {"source_code": "#include \n\nint main()\n{\n char s[100];\n scanf(\"%s\",s);\n int i = 0;\n int count = 0;\n \n while(s[i])\n {\n if(s[i] == '4' || s[i] == '7')\n count++;\n i++;\n }\n if(count%7 == 0 || count%4 == 0)\n {\n puts(\"YES\");\n return 0;\n }\n puts(\"NO\");\n return 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n\n int a,c=1,d,b=0;\n scanf(\"%d\",&a);\n d=a;\n if(a%4==0||a%7==0)\n printf(\"YES\");\n\n else\n {\n c=0;\n while(d!=0)\n {\n if(d%10==4||d%10==7)\n {\n c++;\n }\n d=d/10;\n b++;\n }\n }\n\n if(c==b)\n printf(\"YES\");\n else if(a%4!=4&&a%7!=0)\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n\n\nint main() \n\n{\n\tchar a[100],b[100];\n\tint sum=0,newc=1,count=0,i,j,l[1000];\nint n,m,temp;\nscanf(\"%d\",&i);\nif(i%10==4||i%10==7)\n{ \n\tnewc=i;\n\twhile(newc!=0)\n\t{\n//\t \n\tnewc=newc/10;\n\tif(newc%10!=4&&newc%10!=7)\n\tbreak;\n}\n if(newc==0)\n printf(\"YES\");\n}\nif(newc!=0)\n{\n j=i;\n if((j%4)==0)\n printf(\"YES\");\n else if((j%7)==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n}\n\n\n}\n\n"}, {"source_code": "\n #include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int flag=0;\nif (n%4==0 || n%7==0)\n printf(\"YES\");\nelse{\n while(n>0){\n if(n%10!=4 && n%10!=7 && n%10!=9){\n flag=1;\n break;\n }\n n/=10;\n }\n if (flag==1)\n printf(\"NO\");\n else\n printf(\"YES\");\n}return 0;\n}"}, {"source_code": "#include \nmain()\n{\nint n,g,i,j,k;\nchar s[3],a[3]={'0','4','7'};\nscanf(\"%d\",&n);\nfor(i=0;i<3;i++)\n{s[0]=a[i];\nfor(j=0;j<3;j++)\n{if(s[0]!='0' && j==0)j=1;s[1]=a[j];\nfor(k=0;k<3;k++)\n{if(s[1]!='0' && k==0)k=1;s[2]=a[k];\ng=atoi(s);\nif(g>n || n>777){printf(\"NO\");return 0;}\nif(g!=0 && n%g==0)\n{printf(\"YES\");return 0;}\n}}}\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,i,len;\n char s[5];\n scanf(\"%s\",&s);\n if(strcmp(s,\"16\")==0||strcmp(s,\"49\")==0){\n printf(\"YES\\n\");\n return 0;\n }\n len=strlen(s);\n for(i=0;i\n#include \n#include \nint main()\n{\n char arr[1001];\n gets(arr);\n int n;\n n=strlen(arr);\n int num[n];\n int x=0,l=0,y;\n for(y=0;y0)\n {\n if(l%4==0||l%7==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int s, a;\n char num[4];\n gets (num);\n s=strlen(num);\n if ( s == 1 && ( num[0] == '4' || num[0] == '7' || num[0] == 8)) printf (\"YES\");\n else if ( s == 2 )\n {\n a = ((num[0]-48)*10)+(num[1]-48);\n if (( num[0] == '4' || num[0] == '7' ) && ( num[1] == '4' || num[1] == '7' )) printf (\"YES\");\n else if ( a%4 == 0 || a%7 == 0 ) printf (\"YES\");\n else printf (\"NO\");\n }\n else if ( s == 3 )\n {\n a = ((num[0]-48)*100)+((num[1]-48)*10)+(num[2]-48);\n if (( num[0] == '4' || num[0] == '7' ) && ( num[1] == '4' || num[1] == '7' ) && ( num[2] == '4' || num[2] == '7' )) printf (\"YES\");\n else if ( a%4 == 0 || a%7 == 0 || a%74 == 0 || a%47 == 0 ) printf (\"YES\");\n else printf (\"NO\");\n }\n else if ( num[0] == '1' && num[1] == '0' && num[2] == '0' && num[3] == '0' ) printf (\"YES\");\n else printf (\"NO\");\n return 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n long a;\n int z=0;\n scanf(\"%ld\",&a);\n int k=a,g,j=0;\n int c[100];\n while(k>0)\n {\n g=k%10;\n k=k/10;\n c[j]=g;\n ++j;\n }\n if(a%4==0||a%7==0||a==799)\n printf(\"YES\");\n else\n {\n for(int i=0; i\n#include \n\ntypedef long long int lli;\n#define in32(x) scanf(\"%d\", &(x))\n#define out32(x) printf(\"%d\\n\", (x))\n#define in64(x) scanf(\"%lld\", &(x))\n#define out64(x) printf(\"%lld\\n\", (x))\n#define instr(x) scanf(\"%s\", x)\n#define outstr(x) printf(\"%s\\n\", x)\n#define fo3(a,b,c) for(a=(b);a<=(c);a++)\n#define of3(a,b,c) for(a=(b);a>=(c);a--)\n\nvoid sort(int * arr, int size) {\n if (size <= 12) {\n int i,j,k;\n k = size - 1;\n while (k != 0) {\n j = k;\n k = 0;\n fo3(i,0,j-1) {\n if (arr[i] > arr[i+1]) {\n int tmp = arr[i];\n arr[i] = arr[i+1];\n arr[i+1] = tmp;\n k = i;\n }\n }\n }\n return;\n }\n int m = size>>1;\n sort(arr, m);\n sort(arr+m,size-m);\n int * tmp = calloc(size, sizeof(int));\n int i,j=0,k=m;\n fo3(i,0,size-1) {\n if (j == m)\n tmp[i] = arr[k++];\n else if (k == size || arr[j] <= arr[k])\n tmp[i] = arr[j++];\n else\n tmp[i] = arr[k++];\n }\n fo3(i,0,size-1) { \n arr[i] = tmp[i];\n }\n free(tmp);\n}\n\n\nint main() \n{\n lli a, b;\n in64(a);\n in64(b);\n \n if (a == b){\n if (!a) {\n out32(0);\n return 0;\n }\n out32(1);\n out64(a);\n return 0;\n }\n lli sum = b;\n lli xor = a;\n lli c = (sum - xor) >> 1;\n if (c > 0 && (c ^ (c + xor)) == xor && c + c + xor == sum) {\n out32(2);\n printf(\"%lld %lld\\n\", c, c + xor);\n return 0;\n }\n \n lli a3 = xor;\n lli a1 = (sum-xor)>>1;\n lli a2 = a1;\n \n if (a1 > 0 && a2 > 0 && a3 > 0 && (a1 ^ a2 ^ a3) == xor && a1 + a2 + a3 == sum) {\n out32(3);\n printf(\"%lld %lld %lld\\n\", a1, a2, a3);\n return 0;\n }\n \n out32(-1);\n \n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tlong long int u, v;\n\tscanf(\"%lld %lld\", &u, &v);\n\tif (u > v)\n\t{\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\tif ((v - u) % 2 > 0)\n\t{\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\tif (v == 0)\n\t{\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\tif (u == v)\n\t{\n\t\tprintf(\"1\\n%lld\\n\", u);\n\t\treturn 0;\n\t}\n\tif ((u ^ ((v - u) / 2)) == u + (v - u) / 2)\n\t\tprintf(\"2\\n%lld %lld\\n\", u ^ (v - u) / 2, (v - u) / 2);\n\telse\n\t\tprintf(\"3\\n%lld %lld %lld\\n\", u, (v - u) / 2, (v - u) / 2);\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n long long int u,v;\n while(~scanf(\"%lld%lld\",&u,&v))\n {\n if(u%2==v%2&&u<=v)\n {\n if(u==v)\n {\n if(u==0)\n printf(\"0\\n\");\n else\n {\n printf(\"1\\n\");\n printf(\"%lld\",u);\n }\n }\n else\n {\n long long int x=u;\n long long int y=(v-u)/2;\n if((x&y)==0)\n {\n printf(\"2\\n%lld %lld\\n\",x+y,y);\n }\n else\n printf(\"3\\n%lld %lld %lld\\n\",x,y,y);\n }\n }\n else\n printf(\"-1\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n/*thanks to rainboy,danger :)*/\nint main() {\n\tlong long u, v, w;\n\n\tscanf(\"%lld%lld\", &u, &v);\n\tif (u > v || (v - u) % 2 != 0) {\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\tif (u == 0 && v == 0) {\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\tif (u == v) {\n\t\tprintf(\"1\\n\");\n\t\tprintf(\"%lld\\n\", u);\n\t\treturn 0;\n\t}\n\tw = (v - u) / 2;\n\tif ((u & w) == 0) {\n\t\tprintf(\"2\\n\");\n\t\tprintf(\"%lld %lld\\n\", w, u ^ w);\n\t\treturn 0;\n\t}\n\tprintf(\"3\\n\");\n\tprintf(\"%lld %lld %lld\\n\", u, w, w);\n\treturn 0;\n}\n"}, {"source_code": "#include \nlong long num[70]={0};\nlong long num1[70]={0};\nlong long change(long long n)\n{\n long long i=0;\n while(n)\n {\n num[i++]=n%2;\n n=n/2;\n }\n return 0;\n}\nint main()\n{\n long long n=0,m=0,ans=0;//min表示2的指数,minn表示最小单位值\n scanf(\"%lld%lld\",&n,&m);\n change(n);\n for(long long i=0;i<=69;i++)\n {\n num1[i]=num[i];\n }\n if(mmax) max=num[i];\n }\n printf(\"%lld\\n\",max);\n for(long long i=1,j=0,x=0;i<=max;i++)\n {\n ans=0;\n x=1;\n j=0;\n for(j=0;j<=69;j++,x=2*x)\n {\n if(num[j]>=1)\n {\n ans=ans+x;\n num[j]--;\n }\n }\n if(i==1) printf(\"%lld\",ans);\n else printf(\" %lld\",ans);\n }\n printf(\"\\n\");\n }\n return 0;\n }\n}\n"}, {"source_code": "#include \nlong long num[70]={0};\nlong long num1[70]={0};\nlong long change(long long n)\n{\n long long i=0;\n while(n)\n {\n num[i++]=n%2;\n n=n/2;\n }\n return 0;\n}\nint main()\n{\n long long n=0,m=0,ans=0,max=0;\n scanf(\"%lld%lld\",&n,&m);\n change(n);\n for(long long i=0;i<=69;i++)\n {\n num1[i]=num[i];\n }\n if(mmax) max=num[i];\n }\n printf(\"%lld\\n\",max);\n for(long long i=1,j=0,x=0;i<=max;i++)\n {\n for(j=0,x=1,ans=0;j<=69;j++,x=2*x)\n {\n if(num[j]>=1)\n {\n ans=ans+x;\n num[j]--;\n }\n }\n if(i==1) printf(\"%lld\",ans);\n else printf(\" %lld\",ans);\n }\n printf(\"\\n\");\n }\n }\n return 0;\n}"}, {"source_code": "#include \n\nint main() {\n\tlong long u, v, w;\n\n\tscanf(\"%lld%lld\", &u, &v);\n\tif (u > v || (v - u) % 2 != 0) {\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\tif (u == 0 && v == 0) {\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\tif (u == v) {\n\t\tprintf(\"1\\n\");\n\t\tprintf(\"%lld\\n\", u);\n\t\treturn 0;\n\t}\n\tw = (v - u) / 2;\n\tif ((u & w) == 0) {\n\t\tprintf(\"2\\n\");\n\t\tprintf(\"%lld %lld\\n\", w, u ^ w);\n\t\treturn 0;\n\t}\n\tprintf(\"3\\n\");\n\tprintf(\"%lld %lld %lld\\n\", u, w, w);\n\treturn 0;\n}\n"}, {"source_code": "#include \n \nint main(){\n\tlong long u, v, c, s;\n\tlong long a[60];\n\tint i, j = 0;\n\tscanf(\"%lld%lld\", &u, &v);\n\t/*c = 1;\n \twhile(u / c > 0){\n\t\tif((u & c) == c){\n\t\t\ta[j++] = c;\n\t\t}\n\t\tc = c << 1;\n\t}\n\tif(v < u){\n\t\tprintf(\"-1\\n\", -1);\n\t\treturn 0;\n\t}\n\tprintf(\"%lld\\n\", v - u + j);\n\tfor(i = 0; i < v - u; i++){\n\t\tprintf(\"1 \");\n\t}\n\tfor(i = 0; i < j; i++){\n\t\tprintf(\"%lld \", a[i]);\n\t}\n\tprintf(\"\\n\");*/\n\ts = (v - u) / 2;\n\tif(u > v || (v - u) % 2 == 1){\n\t\tprintf(\"-1\\n\");\n\t}\n\telse if(u == v){\n\t\tif(u == 0 || v == 0)\n\t\t\tprintf(\"0\\n\");\n\t\telse{\n\t\t\tprintf(\"1\\n\");\n\t\t\tprintf(\"%lld\", u);\n\t\t}\n\t}\n\telse if((u & s) == 0){\n\t\tprintf(\"2\\n\");\n\t\tprintf(\"%lld %lld\\n\", u + s, s);\n\t}\n\telse{\n\t\tprintf(\"3\\n\");\n\t\tprintf(\"%lld %lld %lld\\n\", u, s, s);\n\t}\n\treturn 0;\n}"}], "negative_code": [{"source_code": "#include\nint main()\n{\n int n,m;\n while(~scanf(\"%d%d\",&n,&m))\n {\n if(n>m)\n {\n printf(\"-1\\n\");\n continue;\n }\n else if(n==m)\n {\n printf(\"%d\\n\",n);\n continue;\n }\n else\n {\n if((m-n)%2!=0)\n printf(\"-1\\n\");\n else\n printf(\"%d %d %d\\n\",n,(m-n)/2,(m-n)/2);\n }\n }\n return 0;\n}\n\n"}, {"source_code": "#include \n \nint main(){\n\tlong long u, v, c;\n\tlong long a[60];\n\tint i, j = 0;\n\tscanf(\"%lld%lld\", &u, &v);\n\tc = 1;\n \twhile(u / c > 0){\n\t\tif((u & c) == c){\n\t\t\ta[j++] = c;\n\t\t}\n\t\tc = c << 1;\n\t}\n\tif(v < u){\n\t\tprintf(\"-1\\n\", -1);\n\t\treturn 0;\n\t}\n\tprintf(\"%lld\\n\", v - u + j);\n\tfor(i = 0; i < v - u; i++){\n\t\tprintf(\"1 \");\n\t}\n\tfor(i = 0; i < j; i++){\n\t\tprintf(\"%lld \", a[i]);\n\t}\n\tprintf(\"\\n\");\n\treturn 0;\n}"}, {"source_code": "#include \n \nint main(){\n\tlong long u, v, c, s;\n\tlong long a[60];\n\tint i, j = 0;\n\tscanf(\"%lld%lld\", &u, &v);\n\t/*c = 1;\n \twhile(u / c > 0){\n\t\tif((u & c) == c){\n\t\t\ta[j++] = c;\n\t\t}\n\t\tc = c << 1;\n\t}\n\tif(v < u){\n\t\tprintf(\"-1\\n\", -1);\n\t\treturn 0;\n\t}\n\tprintf(\"%lld\\n\", v - u + j);\n\tfor(i = 0; i < v - u; i++){\n\t\tprintf(\"1 \");\n\t}\n\tfor(i = 0; i < j; i++){\n\t\tprintf(\"%lld \", a[i]);\n\t}\n\tprintf(\"\\n\");*/\n\ts = (v - u) / 2;\n\tif(u > v){\n\t\tprintf(\"-1\\n\");\n\t}\n\telse if(u == v){\n\t\tprintf(\"0\\n\");\n\t}\n\telse if(s == 1 && u % 2 == 0){\n\t\tprintf(\"2\\n\");\n\t\tprintf(\"%lld %d\\n\", u + 1, 1);\n\t}\n\telse{\n\t\tprintf(\"3\\n\");\n\t\tprintf(\"%lld %lld %lld\\n\", u, s, s);\n\t}\n\treturn 0;\n}"}], "src_uid": "490f23ced6c43f9e12f1bcbecbb14904"} {"nl": {"description": "Galois is one of the strongest chess players of Byteforces. He has even invented a new variant of chess, which he named «PawnChess».This new game is played on a board consisting of 8 rows and 8 columns. At the beginning of every game some black and white pawns are placed on the board. The number of black pawns placed is not necessarily equal to the number of white pawns placed. Lets enumerate rows and columns with integers from 1 to 8. Rows are numbered from top to bottom, while columns are numbered from left to right. Now we denote as (r, c) the cell located at the row r and at the column c.There are always two players A and B playing the game. Player A plays with white pawns, while player B plays with black ones. The goal of player A is to put any of his pawns to the row 1, while player B tries to put any of his pawns to the row 8. As soon as any of the players completes his goal the game finishes immediately and the succeeded player is declared a winner.Player A moves first and then they alternate turns. On his move player A must choose exactly one white pawn and move it one step upward and player B (at his turn) must choose exactly one black pawn and move it one step down. Any move is possible only if the targeted cell is empty. It's guaranteed that for any scenario of the game there will always be at least one move available for any of the players.Moving upward means that the pawn located in (r, c) will go to the cell (r - 1, c), while moving down means the pawn located in (r, c) will go to the cell (r + 1, c). Again, the corresponding cell must be empty, i.e. not occupied by any other pawn of any color.Given the initial disposition of the board, determine who wins the game if both players play optimally. Note that there will always be a winner due to the restriction that for any game scenario both players will have some moves available.", "input_spec": "The input consists of the board description given in eight lines, each line contains eight characters. Character 'B' is used to denote a black pawn, and character 'W' represents a white pawn. Empty cell is marked with '.'. It's guaranteed that there will not be white pawns on the first row neither black pawns on the last row.", "output_spec": "Print 'A' if player A wins the game on the given board, and 'B' if player B will claim the victory. Again, it's guaranteed that there will always be a winner on the given board.", "sample_inputs": ["........\n........\n.B....B.\n....W...\n........\n..W.....\n........\n........", "..B.....\n..W.....\n......B.\n........\n.....W..\n......B.\n........\n........"], "sample_outputs": ["A", "B"], "notes": "NoteIn the first sample player A is able to complete his goal in 3 steps by always moving a pawn initially located at (4, 5). Player B needs at least 5 steps for any of his pawns to reach the row 8. Hence, player A will be the winner."}, "positive_code": [{"source_code": "#include \n#include \n \nstruct Pawns {\nint row[64];\nint coloumn[64];\nint count;\n};\n\n\nint main(void) {\n // your code goes here\n int i,j,min,max;\n char pos[8][8];\n struct Pawns White;\n struct Pawns Black;\n White.count=0;\n Black.count=0;\n for(i=0;i<9;i++)\n for(j=0;j<9;j++)\n scanf(\"%c\",&pos[i][j]);\n \n for(i=0;i<8;i++)\n for(j=0;j<8;j++)\n if(pos[i][j]=='W')\n {\n White.row[White.count]=i; \n White.coloumn[White.count]=j;\n White.count++;\n }else if(pos[i][j]=='B')\n {\n Black.row[Black.count]=i; \n Black.coloumn[Black.count]=j;\n Black.count++;\n } \n min=999;\n for(i=0;iWhite.row[i]){\n for(j=0;jBlack.row[j]){\n break;\n }\n }\n \n if(j>=Black.count){\n min=White.row[i];\n }\n \n }\n }\n max=-1;\n for(i=0;iBlack.row[i]){\n \n break;\n }\n }\n \n if(j>=White.count){\n max=Black.row[i];\n }\n \n }\n }\n \n if(min<=(7-max)){\n \n printf(\"A\");\n }\n else\n printf(\"B\");\n \n \n \n return 0;\n}"}, {"source_code": "#include\nint i,j,k,a,b;\nchar s[8][9];\nint main()\n{\n for(i=0;i<8;i++)scanf(\"%s\",s[i]);\n a=8,b=8;\n for(i=0;i<8;i++)\n for(j=0;j<8;j++){\n if(s[j][i]=='W'){if(j=0;j--){\n if(s[j][i]=='B'){if((7-j)b?printf(\"B\\n\"):printf(\"A\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int i, j, k, count1 = 0, count2 = 0;\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 for(j = 0; j < 8; j++) {\n if(str[i][j] == 'W') {\n for(k = 0; k < 8; k++) {\n if(str[k][j] != 'B' && str[k][j] != 'W') {\n count1++;\n continue;\n }\n else {\n break;\n }\n }\n if(count1 != i) {\n count1 = 0;\n continue;\n }\n else {\n break;\n }\n }\n }\n if(count1 > 0) {\n break;\n }\n else {\n continue;\n }\n }\n for(i = 7; i >=0; i--) {\n for(j = 0; j < 8; j++) {\n if(str[i][j] == 'B') {\n for(k = 7; k >= 0; k--) {\n if(str[k][j] != 'B' && str[k][j] != 'W') {\n count2++;\n continue;\n }\n else {\n break;\n }\n }\n if(count2 != 7-i) {\n count2 = 0;\n continue;\n }\n else {\n break;\n }\n }\n }\n if(count2 > 0) {\n break;\n }\n else {\n continue;\n }\n }\n if(count2 < count1){\n printf(\"B\");\n }\n else {\n printf(\"A\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n//white ke atas\n//black ke bawah\nint main() {\n\tchar s[8][9];\n\tint b=0, w=0;\n\tfor (int i=0;i<8;i++) {\n\t\tscanf(\"%s\", s[i]);\n\t}\n\tint minb=10, minw=10;\n\tfor (int i=0;i<8;i++) {\n\t\tfor (int j=0;j<8;j++) {\n\t\t\tif (s[i][j]=='W') {\n\t\t\t\tint flag=0;\n\t\t\t\tfor (int k=i-1;k>=0;k--) {\n\t\t\t\t\tif (s[k][j]!='.') {\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==0) {\n\t\t\t\t\tif (i\nint main()\n{\n char data[10][10];\n int i,j,a,b,max=1,min=8,k;\n for(i=1;i<=8;i++)\n {\n for(j=1;j<=8;j++)\n {\n scanf(\" %c\",&data[i][j]);\n }\n }\n for(i=1;i<=8;i++)\n {\n for(j=1;j<=8;j++)\n {\n if(data[j][i]=='W')\n {\n a=1;\n for(k=j-1;k>=1;k--)\n {\n if(data[k][i]=='W'||data[k][i]=='B')\n {\n a=0;\n break;\n }\n }\n if(a==1&&j<=min)\n {\n min=j;\n\n }\n }\n else if(data[j][i]=='B')\n {\n b=1;\n for(k=j+1;k<=8;k++)\n {\n if(data[k][i]=='W'||data[k][i]=='B')\n {\n b=0;\n break;\n }\n\n }\n if(b==1&&j>=max)\n max=j;\n }\n\n }\n }\n\n min=min-1;\n max=8-max;\n if(max>=min)\n {\n printf(\"A\\n\");\n }\n else\n {\n printf(\"B\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\n\n\nint main(){\n\n\n char Chess[8][8];\n int i,j,k ;\n int dist_A=0;\n int dist_B=0;\n int B_exist=0;\n int A_exist=0;\n\n\n for(i=0;i<8;i++)scanf(\"%s\",Chess[i]);\n \n i=1;\n while(i<8 && dist_A==0){\n for(j=0;j<8&&dist_A==0;j++){\n \n if(Chess[i][j]=='W'){\n for(k=0;k0 && dist_B==0){\n for(j=0;j<8;j++){\n if(Chess[i][j]=='B'){\n for(k=7;k>i;k--){if(Chess[k][j]=='W'){A_exist=1;break;}}\n if(A_exist==0){dist_B=7-i;break;} \n }\n A_exist=0;\n } \n A_exist=0;\n i=i-1; \n }\n \n //printf(\"%d\\n\",dist_B);\n if(dist_B==0)printf(\"A\");\n else{\n if(dist_A==0)printf(\"B\");\n else{\n if(dist_B>=dist_A)printf(\"A\");\n else\n printf(\"B\");\n } \n }\n\n\n\nreturn 0 ;\n}\n\n"}, {"source_code": "#include \n\nint main() {\n\tint i, j, k, wmin, bmin, wgood, bgood;\n\tstatic char grid[8][9];\n\n\tfor (i = 0; i < 8; i++)\n\t\tscanf(\"%s\", grid[i]);\n\twmin = bmin = 8;\n\tfor (i = 0; i < 8; i++)\n\t\tfor (j = 0; j < 8; j++)\n\t\t\tif (grid[i][j] == 'W') {\n\t\t\t\twgood = 1;\n\t\t\t\tfor (k = i - 1; k >= 0; k--)\n\t\t\t\t\tif (grid[k][j] != '.') {\n\t\t\t\t\t\twgood = 0;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\tif (wgood && wmin > i)\n\t\t\t\t\twmin = i;\n\t\t\t} else if (grid[i][j] == 'B') {\n\t\t\t\tbgood = 1;\n\t\t\t\tfor (k = i + 1; k < 8; k++)\n\t\t\t\t\tif (grid[k][j] != '.') {\n\t\t\t\t\t\tbgood = 0;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\tif (bgood && bmin > 7 - i)\n\t\t\t\t\tbmin = 7 - i;\n\t\t\t}\n\tprintf(wmin <= bmin ? \"A\\n\" : \"B\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint good(char cc[8][9], int i, int j) {\n\tint h;\n\n\tif (cc[i][j] == 'W') {\n\t\tfor (h = 0; h < i; h++)\n\t\t\tif (cc[h][j] != '.')\n\t\t\t\treturn 0;\n\t\treturn 1;\n\t} else {\n\t\tfor (h = i + 1; h < 8; h++)\n\t\t\tif (cc[h][j] != '.')\n\t\t\t\treturn 0;\n\t\treturn 1;\n\t}\n}\n\nint main() {\n\tstatic char cc[8][9];\n\tint i, j, i1, i2;\n\n\tfor (i = 0; i < 8; i++)\n\t\tscanf(\"%s\", cc[i]);\n\ti1 = -1;\n\tfor (i = 0; i < 8; i++)\n\t\tfor (j = 0; j < 8; j++)\n\t\t\tif (cc[i][j] == 'W' && good(cc, i, j)) {\n\t\t\t\ti1 = i;\n\t\t\t\tgoto done1;\n\t\t\t}\ndone1:\n\ti2 = -1;\n\tfor (i = 7; i >= 0; i--)\n\t\tfor (j = 0; j < 8; j++)\n\t\t\tif (cc[i][j] == 'B' && good(cc, i, j)) {\n\t\t\t\ti2 = i;\n\t\t\t\tgoto done2;\n\t\t\t}\ndone2:\n\tprintf(i1 <= 7 - i2 ? \"A\\n\" : \"B\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main(){\n \n char map[8][10]={{0}};\n int A=8,B=0;\n \n int i,j,k;\n for(i=0;i<8;i++)\n fgets(map[i],10,stdin);\n \n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n if(map[i][j]=='W'&&A==8){\n int no=0;\n for(k=0;ki;k--){\n if(map[k][j]=='W'){\n no++;\n break;\n }\n }\n if(no==1) continue;\n else B=i;\n }\n }\n }\n if(A<=(7-B)) printf(\"A\\n\");\n else printf(\"B\\n\");\n \n return 0;\n \n}"}, {"source_code": "#include \nchar a[10][10];\nint b = 10, w = 10, q;\nint main(){\n for(int i = 0; i < 8; i ++) gets(a[i]);\n for(int i = 0; i < 8; i ++){\n for(int j = 0; j < 8; j ++){\n if(a[i][j] != '.'){\n q = 0;\n if(a[i][j] == 'B'){\n for(int c = i + 1; c < 8; c ++) if(a[c][j] != '.') q = 1;\n }else{\n for(int c = i - 1; c >= 0; c --) if(a[c][j] != '.') q = 1;\n }\n if(q == 0){\n if(a[i][j] == 'B') b = b < (7 - i) ? b : (7 - i);\n else w = w < i ? w : i;\n }\n }\n }\n }\n puts(b < w ? \"B\" : \"A\");\n return 0;\n}"}, {"source_code": "#include\nint main(void)\n{\n int i=0,j=0,k,z=1;\n int ca,cb;\n char ar[8][9];\n while(i<8)\n {\n scanf(\"%s\",ar[i]);\n i++;\n }\n for(i=1;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n if(ar[i][j]=='W')\n {\n for(k=i;k>=0;k--)\n {\n if(ar[k][j]=='B')break;\n }\n if(ar[0][j]!='B'&&k<0)\n {\n ca=i;\n z=0;\n break;\n }\n }\n }\n if(z==0)break;\n }\n z=1;\n for(i=6;i>=0;i--)\n {\n for(j=0;j<8;j++)\n if(ar[i][j]=='B')\n {\n for(k=i;k<8;k++)\n {\n if(ar[k][j]=='W')break;\n }\n if(ar[7][j]!='W'&&k>=8)\n {\n cb=7-i;\n z=0;\n break;\n }\n }\n if(z==0)break;\n }\n if(ca<=cb)putchar('A');\n else putchar('B');\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n//#321 B. Kefa and Company\n/*\ntypedef struct {\n long long money;\n long long friend_factor;\n} friends;\n\nint comp(const void *x, const void *y) {\n friends * a = (friends *) x;\n friends * b = (friends *) y;\n return a->money - b->money;\n}\n*/\n\nint cmp(const void *a, const void *b) {\n return *(long *)a - *(long *)b;\n}\n\nint primes[1020], total = 0;\n\nint is_prime(int num) {\n if(num <= 2) return 0;\n if(num == 2) return 1;\n if(num % 2 == 0) return 0;\n int root = sqrt(num);\n int i;\n for(i = 3; i <= root; i+= 2) {\n if(num % i == 0) return 0;\n }\n return 1;\n}\n\nvoid generate_primes() {\n int i;\n primes[total++] = 2;\n for(i = 3; i <= 8000; i+=2) {\n if(is_prime(i) == 1) {\n primes[total++] = i;\n }\n }\n //printf(\"total primes::%d\\n\", total);\n}\n\nint main() {\n\n char board[10][10];\n int i, j, min_a, min_b, k, steps;\n for(i = 0; i < 8; i++) {\n scanf(\"%s\", board[i]);\n }\n\n min_a = min_b = 10;\n for(i = 0; i < 8; i++) {\n for(j = 0; j < 8; j++) {\n if(board[i][j] == 'B') {\n steps = 0;\n k = i+1;\n while(k < 8) {\n if(board[k][j] == 'B' || board[k][j] == 'W') {\n break;\n }\n k++;\n steps++;\n }\n if(k == 8) {\n if(steps < min_b) {\n min_b = steps;\n }\n }\n\n } else if(board[i][j] == 'W') {\n steps = 0;\n k = i-1;\n while(k >= 0) {\n if(board[k][j] == 'B' || board[k][j] == 'W') {\n break;\n }\n k--;\n steps++;\n }\n if(k < 0) {\n if(steps < min_a) {\n min_a = steps;\n }\n }\n }\n }\n }\n\n //printf(\"mina%d minb:%d\\n\", min_a, min_b);\n if(min_a > min_b) printf(\"B\");\n else printf(\"A\");\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int i,j,k;\n char ara[9][9];\n for(i=1;i<=8;i++)\n {\n for(j=1;j<=8;j++)\n {\n scanf(\"%c\",&ara[i][j]);\n }\n getchar();\n }\n\n\n int maxb=1,minw=8,countw,countb;\n for(i=1;i<=8;i++)\n {\n for(j=1;j<=8;j++)\n {\n if(ara[j][i]=='B')\n {\n countb=1;\n for(k=j+1;k<=8;k++)\n {\n if(ara[k][i]=='W'||ara[k][i]=='B')\n {\n countb=0;\n break;\n }\n\n }\n if(countb==1&&j>maxb)\n maxb=j;\n }\n else if(ara[j][i]=='W')\n {\n countw=1;\n for(k=j-1;k>=1;k--)\n {\n if(ara[k][i]=='W'||ara[k][i]=='B')\n {\n countw=0;\n break;\n }\n\n }\n if(countw==1&&j\n\nint table[10][10];\n\nint main(){\n\tint i, j, k;\n\tchar input[10];\n\tint A=10, B=10;\n\tint temp;\n\t\n\tfor(i=1; i<=8; i++){\n\t\tscanf(\"%s\", input);\n\t\tfor(j=0; j<8; j++){\n\t\t\tif(input[j] == 'W') table[i][j+1] = 1;\n\t\t\telse if(input[j] == 'B') table[i][j+1] = 2;\n\t\t}\n\t}\n\t\n\tfor(i=1; i<=8; i++){\n\t\tfor(j=1; j<=8; j++){\n\t\t\tif(table[j][i] == 2) break;\n\t\t\tif(table[j][i] == 1){\n\t\t\t\tif(j-1=1; j--){\n\t\t\tif(table[j][i] == 1) break;\n\t\t\tif(table[j][i] == 2){\n\t\t\t\tif(8-jB) printf(\"B\");\n\t\n}\n"}, {"source_code": "#include\n#include\nint main()\n{ char tabla[50][50];\n int beli[50][50];\n int crni[50][50];\n int a,b,c,d;\n int i;\n for(i=0;i<8;i++){\n gets(tabla[i]);\n }\n char *q=tabla[0];\n int beli_int=0;\n int beli_int1=0;\n int petlja_beli1=0;\n int petlja_beli;\n int brojac_belih=0;\n for(petlja_beli=0;petlja_beli<8;petlja_beli++){\n q=tabla[petlja_beli];\n for(beli_int=0;beli_int<8;beli_int++,q++){\n if(*q=='W'){\n beli[petlja_beli1++][beli_int1]=(petlja_beli+1)*10 + beli_int+1;\n brojac_belih++;\n }}\nbeli_int1=0;\n }\n\n\n\n int petlja_crni;\n int crni_int;\n int petlja_crni1=0;\n int crni_int1=0;\n int brojac_crnih=0;\n for(petlja_crni=0;petlja_crni<8;petlja_crni++){\n q=tabla[petlja_crni];\n for(crni_int=0;crni_int<8;crni_int++,q++){\n if(*q=='B'){\n crni[petlja_crni1++][crni_int1]=(petlja_crni+1)*10 + crni_int+1;\n brojac_crnih++;\n }\n }\ncrni_int1=0;\n }\nint test=0;\nfor(test=0;testcrni[test_GD][0]/10)\n {\n nije_valid=1;\n break;\n }\n}\nif(nije_valid == 1)\n continue;\nelse{\n dobri_beli[beli_increaser++][0]=broj_valid;\n nije_valid=0;\n}}\nfor(test=0;testdobri_beli[sort1][0]){\n najveci_beli=dobri_beli[sort1][0];\n }\n }\n}\n//printf(\"\\n\\n**NAJVECI BELI%d\",najveci_beli);\nint zadnji_korak_b;\nint zadnji_korak_c;\nzadnji_korak_b=najveci_beli/10;\nzadnji_korak_c=najveci_crni/10;\n//printf(\"\\n\\nBELI - %d\\nCRNI - %d\",abs(1-zadnji_korak_b),abs(8-zadnji_korak_c));\nif(abs(1-zadnji_korak_b)<=abs(8-zadnji_korak_c)){\nprintf(\"A\");\n}\nelse\n printf(\"B\");\n}\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include\n#include\n\nchar data[10][10];\n\nint main()\n{\n while(scanf(\"%s\",&data[0])!=EOF)\n {\n int i;\n int j;\n for(i=1;i<8;i++)\n scanf(\"%s\",&data[i]);\n int k;\n int mina=9999,minb=9999;\n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n if(data[i][j]=='W')\n {\n for(k=0;k\nint main()\n{\n int x=0,y=0,i,p=0,j,g=0,f=0,h=0,k=0,finalB=0,finalW=0;\n char str[100][100];\n for(i=0;i<8;i++){\n scanf(\"%s\",str[i]);\n }\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n if(str[j][i]=='B'){\n x=j+1;\n if(p==0){\n h=x;\n }\n p++;\n }\n if(str[j][i]=='W'){\n y=j+1;\n if(f==0){\n g=9-y;\n }\n f++;\n }\n }\n //printf(\"%d %d %d\\n\",x,y,g);\n if(x>y||x==0||y==0){\n if(x>=finalB){\n finalB=x;\n }\n if(h==0){\n if(g>=finalW){\n finalW=g;\n }\n }\n if(h!=0){\n if(g>=finalW&&g>(9-h)){\n finalW=g;\n }\n }\n }\n else if(x(9-h)&&g>=finalW){\n finalW=g;\n }\n }\n p=0;\n f=0;\n x=0;\n y=0;\n g=0;\n h=0;\n }\n if(finalW>=finalB){\n printf(\"A\");\n }\n else{\n printf(\"B\");\n }\n //printf(\"\\n%d %d\",finalB,finalW);\n return 0;\n}\n"}, {"source_code": "#include\n\nmain()\n{\n int a[8],b[8],r,c,i,j=0,ra,rb,k=0;\n char ch[8][8];\n for(r=0;r<8;r++)\n {\n scanf(\"%s\",&ch[r]);\n }\n for(r=7;r>=0;r--)\n {\n for(c=7;c>=0;c--)\n {\n j=0;\n if(ch[r][c]=='B')\n {\n ra=7-r;\n for(i=r+1;i<8;i++)\n {\n if(ch[i][c]!='.')\n j=1;\n }\n }\n if(j!=1&&ch[r][c]=='B')\n {\n k=1;\n break;\n }\n }\n if(k==1)\n {\n break;\n }\n }\n for(r=0;r<8;r++)\n {\n for(c=0;c<8;c++)\n {\n j=1;\n if(ch[r][c]=='W')\n {\n rb=r;\n for(i=r-1;i>=0;i--)\n {\n if(ch[i][c]!='.')\n j=2;\n }\n }\n if(j!=2&&ch[r][c]=='W')\n {\n k=2;\n break;\n }\n }\n if(k==2)\n {\n break;\n }\n }\n if(ra>=rb)\n printf(\"A\");\n else\n printf(\"B\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nmain()\n {\n int i,j,na,nb,stepA,stepB;\n int Ax[64],Ay[64],Bx[64],By[64];\n char s[9];\n na = 0;\n nb = 0;\n for (i=0;i<8;i++)\n {\n scanf(\"%s\",s);\n for (j=0;j<8;j++)\n {\n if (s[j]=='W')\n {\n Ax[na] = i;\n Ay[na] = j;\n na++;\n }\n else\n {\n if (s[j]=='B')\n {\n Bx[nb] = i;\n By[nb] = j;\n nb++;\n }\n }\n }\n }\n\n stepA = 10;\n for (i=0;i\n\nint main() {\n\tint i, j, k, wmin, bmin, wgood, bgood;\n\tstatic char grid[8][9];\n\n\tfor (i = 0; i < 8; i++)\n\t\tscanf(\"%s\", grid[i]);\n\twmin = bmin = 8;\n\tfor (i = 0; i < 8; i++)\n\t\tfor (j = 0; j < 8; j++)\n\t\t\tif (grid[i][j] == 'W') {\n\t\t\t\twgood = 1;\n\t\t\t\tfor (k = i - 1; k >= 0; k--)\n\t\t\t\t\tif (grid[k][j] != '.') {\n\t\t\t\t\t\twgood = 0;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\tif (wgood && wmin > i)\n\t\t\t\t\twmin = i;\n\t\t\t} else if (grid[i][j] == 'B') {\n\t\t\t\tbgood = 1;\n\t\t\t\tfor (k = i + 1; k < 8; k++)\n\t\t\t\t\tif (grid[k][j] != '.') {\n\t\t\t\t\t\tbgood = 0;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\tif (bgood && bmin > 7 - i)\n\t\t\t\t\tbmin = 7 - i;\n\t\t\t}\n\tprintf(\"%c\\n\", wmin <= bmin ? 'A' : 'B');\n\treturn 0;\n}\n"}, {"source_code": "//http://codeforces.com/contest/592/problem/A\n\n#include\n#include\n\nint main(void){\n int i,j,trash;\n int bmin=10,wmin=10;\n int bm=0,wm=0;\n char a[8][8]={0};\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n scanf(\"%c\",&a[i][j]);\n }\n scanf(\"%c\",&trash);\n }\n\n\n\n for(j=0;j<8;j++){\n bm=0;\n wm=0;\n for(i=0;i<8;i++){\n if(a[i][j]=='.'){\n wm++;\n }\n else if(a[i][j]=='B'){\n wm=10;\n break;\n }\n else break;\n }\n for(i=7;i>=0;i--){\n if(a[i][j]=='.'){\n bm++;\n }\n else if(a[i][j]=='W'){\n bm=10;\n break;\n }\n else break;\n }\n if(bm\n#include\nint main(){\n int Blacklength=100,WhiteLength=100;\n char s[8][8];\n int i,j,k,flag;\n for(i=0;i<8;i++){\n gets(s[i]);\n }\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n if(s[i][j]=='B'){\n k=i;\n flag=0;\n while(k<=7){\n if(s[k][j]=='W'){\n flag=1;\n break;\n }\n k++;\n }\n if(flag==0){\n if((7-i)=0){\n if(s[k][j]=='B'){\n flag=1;\n break;\n }\n k--;\n }\n if(flag==0){\n if(i=WhiteLength)printf(\"A\\n\");\n else printf(\"B\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n#define INF 2000000000\nint e1j[8], e1s[8], e2j[8], e2s[8];\n\nint main(){\n //freopen(\"f.in\", \"r\", stdin);\n int i, j;\n char ch;\n for(i = 0; i < 8; i++)\n e1j[i] = e1s[i] = e2j[i] = e2s[i] = -1;\n for(i = 0; i < 8; i++){\n for(j = 0; j < 8; j++){\n ch = getc(stdin);\n if(ch == 'B'){\n if(e1s[j] == -1)\n e1s[j] = i;\n e1j[j] = i;\n }\n else if(ch == 'W'){\n if(e2s[j] == -1)\n e2s[j] = i;\n e2j[j] = i;\n }\n }\n getc(stdin);\n }\n int min1 = INF, min2 = INF;\n for(i = 0; i < 8; i++){\n if(e1j[i] != -1 && ((e2j[i] == -1 || e1j[i] > e2j[i]) && 7 - e1j[i] < min1))\n min1 = 7 - e1j[i];\n if(e2s[i] != -1 && ((e1s[i] == -1 || e2s[i] < e1s[i]) && e2s[i] < min2))\n min2 = e2s[i];\n }\n if(min2 <= min1)\n fprintf(stdout, \"A\");\n else\n fprintf(stdout, \"B\");\n return 0;\n}\n"}, {"source_code": "#include\nint minm(int a,int b)\n{\n return (a=0;j--)\n if(a[j][i]=='B')\n mb=minm(mb,7-j);\n else if(a[j][i]=='W')\n break;\n }\n //printf(\"mw=%d mb=%d\\n\",mw,mb);\n if(mw<=mb)\n printf(\"A\\n\");\n else \n printf(\"B\\n\");\n return 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n char s[9][9];\n int i,j,w[9],b[9],wneed=0,bneed=0,check[9][9],no1=0,no2=0,k;\n for(i=0;i<8;i++){\n scanf(\"%s\",s[i]);\n }\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n check[i][j]=0;\n }\n }\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n if(s[i][j]=='W') check[i][j]=1;\n else if(s[i][j]=='B') check[i][j]=2;\n }\n }\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n no1=0;\n //printf(\"check[%d][%d] %d\\n\",i,j,check[i][j]);\n if(check[i][j]==1){\n for(k=i-1;k>=0;k--){\n //printf(\"checkkkk[%d][%d] %d\\n\",k,j,check[k][j]);\n if(check[k][j]==2){\n no1=1;break;\n }\n }\n //printf(\"no1 %d\\n\",no1);\n if(no1==0) {\n wneed=i;\n //printf(\" wneed %d\\n\",wneed);\n break;\n }\n }\n }\n if(wneed !=0) break;\n }\n //printf(\"\\n\");\n for(i=7;i>=0;i--){\n for(j=0;j<8;j++){\n no2=0;\n //printf(\"check[%d][%d] %d\\n\",i,j,check[i][j]);\n if(check[i][j]==2){\n for(k=i+1;k<8;k++){\n //printf(\"checkkkkk[%d][%d] %d\\n\",k,j,check[k][j]);\n if(check[k][j]==1){\n no2=1;break;\n }\n }\n //printf(\"no2 %d\\n\",no2);\n if(no2==0) {bneed=7-i;//printf(\"bneed %d\\n\",bneed);\n break;}\n }\n }\n if(bneed !=0) break;\n }\n // printf(\"w %d b %d\\n\",wneed,bneed);\n if(bneed\n\nint main(void) {\n\n char d[8][8];\n short i, j, k , minA = 9, minB = 9;\n\n for (i = 0; i < 8; i++)\n scanf(\"%s\", d[i]);\n\n for (i = 0; i < 8; i++)\n for (j = 0; j < 8; j++) {\n short f = 0;\n if (d[i][j] == 'W') {\n f = 1;\n for (k = i - 1; k >= 0; k--) {\n if (d[k][j] == '.')\n continue;\n else {\n f = 0;\n break;\n }\n }\n if (f && i < minA) minA = i;\n }\n if (d[i][j] == 'B') {\n f = 1;\n for (k = i + 1; k < 8; k++) {\n if (d[k][j] == '.')\n continue;\n else {\n f = 0;\n break;\n }\n }\n if (f && 7 - i < minB) minB = 7 - i;\n }\n }\n\n if (minA <= minB) puts(\"A\");\n else puts(\"B\");\n\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n\t//A white pawn up\n\t//B black pawn down\n\tchar papan[10][10];\n\tfor(int i=0;i<8;i++){\n\t\tgets(papan[i]);\n\t}\n\tint finalB = -1;\n\tfor(int col = 0;col<8;col++){\n\t\tfor(int row = 0;row<8;row++){\n\t\t\tint resB = -1;\n\t\t\tif(papan[row][col]=='B'){\n\t\t\t\tresB=0;\n\t\t\t\tfor(int b=row+1;b<8;b++){\n\t\t\t\t\tif(papan[b][col]=='W') {\n\t\t\t\t\t\tresB = -1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tresB++;\n\t\t\t\t}\n\t\t\t\tif(finalB==-1&&resB>=0){\n\t\t\t\t\tfinalB = resB;\n\t\t\t\t}\n\t\t\t\tif(finalB>resB&&resB!=-1){\n\t\t\t\t\tfinalB = resB;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t//printf(\"Final B: %d\\n\",finalB);\n\t}\n\tint finalA = -1;\n\tfor(int colA = 0;colA<8;colA++){\n\t\tfor(int rowA = 7;rowA>=0;rowA--){\n\t\t\tint resA = -1;\n\t\t\tif(papan[rowA][colA]=='W'){\n\t\t\t\tresA=0;\n\t\t\t\tfor(int a=rowA-1;a>=0;a--){\n\t\t\t\t\tif(papan[a][colA]=='B') {\n\t\t\t\t\t\tresA = -1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tresA++;\n\t\t\t\t}\n\t\t\t\tif(finalA==-1&&resA>=0){\n\t\t\t\t\tfinalA = resA;\n\t\t\t\t}\n\t\t\t\tif(finalA>resA&&resA!=-1){\n\t\t\t\t\tfinalA = resA;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t//printf(\"Final A: %d\\n\",finalA);\n\t}\n\tif(finalB\n\nchar s[9][9];\n\nint main()\n{\n int i,j,c,a,b,d,ans1,ans,br=0,br1=0;\n for(i=1;i<=8;i++){\n for(j=1;j<=8;j++){\n scanf(\"%c\",&s[i][j]);\n }\n getchar();\n }\n for(i=2;i<=8;i++){\n for(j=1;j<=8;j++){\n if(s[i][j]=='W'){\n c=i;\n a=i;\n while(a>0){\n if(s[a-1][j]=='.')\n a--;\n else{\n break;\n }\n }\n\n }\n if(a==1){\n br=1;\n break;\n }\n }\n if(br==1){\n ans=c-a;\n break;\n }\n }\n for(i=7;i>=1;i--){\n for(j=1;j<=8;j++){\n if(s[i][j]=='B'){\n d=i;\n b=i;\n while(b<9){\n if(s[b+1][j]=='.')\n b++;\n else{\n break;\n }\n }\n\n }\n if(b==8){\n br1=1;\n break;\n }\n }\n if(br1==1){\n ans1=b-d;\n break;\n }\n }\n if(ans==ans1)\n printf(\"A\\n\");\n else if(ans\n\nint main()\n{\n\tchar board[8][8];\n\n\tint i, j, k;\n\tchar aux;\n\tfor (i=0; i<8; i++){\n\t\tfor (j=0; j<=8; j++){\n\t\t\tscanf(\"%c\", &aux);\n\t\t\tif (aux!=10) board[i][j]=aux;\n\t\t}\n\t}\n\n\tint minA=40, minB=40, clean;\n\tfor (i=0; i<8; i++){\n\t\tfor (j=0; j<8; j++){\n\t\t\tclean = 1;\n\t\t\tif (board[i][j]=='W'){\n\t\t\t\tfor (k=0; k\n\nint main()\n{\n int i, j, A, B;\n char Map[8][9];\n for(i = 0; i < 8; ++i) {\n scanf(\"%s\", Map[i]);\n }\n A = 8;\n B = 8;\n for(i = 0; i < 8; ++i) {\n j = 0;\n while(Map[j][i] == '.' && j < 8) {\n ++j;\n }\n if(j < 8) {\n if(Map[j][i] == 'W') {\n if(j < A) {\n A = j;\n }\n }\n }\n j = 7;\n while(Map[j][i] == '.' && j >= 0) {\n --j;\n }\n if(j >= 0) {\n if(Map[j][i] == 'B') {\n if(7 - j < B) {\n B = 7 - j;\n }\n }\n }\n }\n puts(A <= B ? \"A\" : \"B\");\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n\tint mass[8][8],i,j,sb=0,sw=0,wi,wj,bi,bj,fb=0,fw=0,d,fl=1;\n\tchar k;\n\t\tfor (i=0;i<8;i++)\n\t\t{\n\t\t\tj = 0;\n\t\t\twhile((k=getchar())!='\\n')\n\t\t\t{\n\t\t\t\tif (k == 'B')\n\t\t\t\t{\n\t\t\t\t\t\tbi=i;\n\t\t\t\t\t\tbj=j;\n\t\t\t\t\t\tmass[i][j]=1;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (k == 'W')\n\t\t\t\t\t{\n\t\t\t\t\t\tif (fw==0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\twi=i;\n\t\t\t\t\t\t\twj=j;\n\t\t\t\t\t\t\tfw=1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmass[i][j]=-1;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\tmass[i][j]=0;\n\t\t\t\t};\n\t\t\t\tj++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tj = wj;\n\t\tfor (i=wi;i<8;i++)\n\t\t{\n\t\t\twhile(j<8)\n\t\t\t{\n\t\t\t\tif (mass[i][j]==-1)\n\t\t\t\t{\t\n\t\t\t\t\tfor (d=i-1;d>=0;d--)\n\t\t\t\t\t\tif (mass[d][j]==0)\n\t\t\t\t\t\t\tsw++;\n\t\t\t\t\tif (sw==i)\n\t\t\t\t\t{\n\t\t\t\t\t\tfl=2;\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\tsw=0;\n\t\t\t\t}\n\t\t\t\tj++;\n\t\t\t}\n\t\t\tif (fl==2)\n\t\t\t\tbreak;\n\t\t\tj=0;\n\t\t}\n\t\tfl=1;\n\t\t//\n\t\tj = bj;\n\t\tfor (i=bi;i>=0;i--)\n\t\t{\n\t\t\twhile(j>=0)\n\t\t\t{\n\t\t\t\tif (mass[i][j]==1)\n\t\t\t\t{\t\n\t\t\t\t\tfor (d=i+1;d<8;d++)\n\t\t\t\t\t\tif (mass[d][j]==0)\n\t\t\t\t\t\t\tsb++;\n\t\t\t\t\tif (sb==7-i)\n\t\t\t\t\t{\n\t\t\t\t\t\tfl=2;\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\tsb=0;\n\t\t\t\t}\n\t\t\t\tj--;\n\t\t\t}\n\t\t\tif (fl==2)\n\t\t\t\tbreak;\n\t\t\tj=7;\n\t\t}\n\t\tif (sb\nint main() {\n char board[8][8];\n int i,j;\n for(i=0; i<8; i++) {\n for(j=0; j<8; j++) {\n board[i][j]=getchar();\n }\n getchar();//read newline\n }\n /*\n for(i=0; i<8; i++) {\n for(j=0; j<8; j++) {\n printf(\"%c\",board[i][j]);\n }\n printf(\"\\n\");\n }\n */\n\n int white_step=8;\n int find=0;\n int row=0;\n int move[8];\n for(i=0; i<8; i++) {\n move[i]=1;\n }\n while(!find && row<8) {\n //printf(\"row = %d\\n\",row);\n int col;\n for(col=0; col<8; col++) {\n if(board[row][col]=='B') move[col]=0;\n else if(board[row][col]=='W' && move[col]==1) {\n find=1;\n white_step=row;\n break;\n }\n }\n\t/*\n for(col=0; col<8; col++) {\n printf(\" %d\",move[col]);\n\t}\n\tprintf(\"\\n\");\n\t*/\n\n row++;\n }\n int black_step=8;\n find=0;\n row=7;\n for(i=0; i<8; i++) {\n move[i]=1;\n }\n while(!find && row>=0) {\n int col;\n for(col=0; col<8; col++) {\n if(board[row][col]=='W') move[col]=0;\n else if(board[row][col]=='B' && move[col]==1) {\n find=1;\n black_step=8-row;\n break;\n }\n }\n row--;\n }\n /*\n printf(\"white step = %d\\n\",white_step);\n printf(\"black step = %d\\n\",black_step);\n */\n if(white_step\n#include \n\nint main()\n{\n int i,p1,p2,j,k,l;\n char a[9][9];\n for(i=1;i<=8;i++)\n {\n scanf(\"%s\",a[i]);\n }\n int p2flag=0;\n for(i=1;i<=8;i++)\n {\n for(j=0;j<8;j++)\n {\n if(a[i][j]=='B')\n {\n int flag=0;\n for(k=i+1;k<=8;k++)\n {\n if(a[k][j]=='W'||a[k][j]=='B')\n flag=1;\n }\n if(flag==0)\n p1=8-i+1;\n }\n if(a[i][j]=='W')\n {\n int flag1=0;\n for(k=1;k=p2)\n printf(\"A\\n\");\n else\n printf(\"B\\n\");\n return 0;\n}\n\n\n"}, {"source_code": "#include\n#include\nint main()\n{\n int a,b,c=10,d,i,j,e=10,k,f,g;\n char s[8][8];\n for(i=0;i<8;i++){\n gets(s[i]);\n }\n for(i=0;i<8;i++){\n f=0;g=0;\n for(j=0;j<8;j++){\n if(s[i][j]=='B'){\n for(k=i+1;k<8;k++){\n if(s[k][j]=='.')f=1;\n else {f=0;break;}\n }\n if(f==1){\n d=7-i;\n if(d=0;k--){\n if(s[k][j]=='.')g=1;\n else {g=0;break;}\n }\n if(g==1){\n d=i;\n if(d\nint main()\n{\n int i,j,k,n,T,minA=10,minB=10;\n char arr[10][10],c;\n for(i=1;i<=8;i++)\n {\n for(j=1;j<=8;j++)\n scanf(\"%c\",&arr[i][j]);\n scanf(\"%c\",&c);\n }\n for(i=1;i<9;i++)\n {\n for(j=1;j<9;j++)\n {\n if(arr[i][j]=='W')\n {\n for(k=i;k>1;k--){\n if(arr[k-1][j]!='.'){\n break;\n }\n }\n if(k==1){\n if(i-1\nchar s[10][10];\nint c=0,index,i,j,flag,b[10],c1,min1,min,w[10];\nint main(void) {\n\tfor(i=0;i<8;i++)\n\t{\n\t\tscanf(\"%s\",&s[i]);\n\t}\n//\tint c=0,index,i,j,flag,b[10];\nc=0;\n\tfor(i=0;i<8;i++)\n\t{\n\t\tflag=0;index=-1;\n\t\tfor(j=0;j<8;j++)\n\t\t{\n\t\t\tif(s[j][i]=='B')\n\t\t\t{\n\t\t\t\tindex=j;\n\t\t\t\tflag=0;\n\t\t\t}\n\t\t\tif(s[j][i]=='W')\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t}\n\t\t\tif(j==7&&index!=-1&&flag==0)\n\t\t\t{\n\t\t\t\tb[c++]=index;\n\t\t\t}\n\t\t}\n\t}\n\tc1=0;\n\tfor(i=0;i<8;i++)\n\t{\n\t\tflag=0;index=-1;\n\t\tfor(j=7;j>=0;j--)\n\t\t{\n\t\t\tif(s[j][i]=='W')\n\t\t\t{\n\t\t\t\tindex=j;\n\t\t\t\tflag=0;\n\t\t\t}\n\t\t\tif(s[j][i]=='B')\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t}\n\t\t\tif(j==0&&index!=-1&&flag==0)\n\t\t\t{\n\t\t\t\tw[c1++]=index;\n\t\t\t}\n\t\t}\n\t}\n\tif(c>0)\n\tmin1=b[0];\n\telse\n\tmin1=-1;\n\tfor(i=0;i0)\n\tmin=w[0];\n\telse\n\tmin=1000000;\n\tfor(i=0;iw[i])\n\t\tmin=w[i];\n\t}\n//\tprintf(\"%d %d\\n\",min1,min);\n\tif(7-min1\n#include\nint main()\n{\n\tint r,c,k,flag,tempw,tempb,mova=10,movb=10;\n\tchar s[10][10];\n\tfor(r=1;r<=8;r++)\n\t{\n\t\tscanf(\"%s\",s[r]);\n\t\tgetchar();\n\t}\n\tfor(r=1;r<=8;r++)\n\t{\n\t\tfor(c=0;c<8;c++)\n\t\t{\n\t\t\ttempw=10;\n\t\t\ttempb=10;\n\t\t\tflag=0;\n\t\t\tif(s[r][c]=='W')\n\t\t\t{\n\t\t\t\tfor(k=r-1;k>=1;k--)\n\t\t\t\t{\n\t\t\t\t\tif(s[k][c]=='B'||s[k][c]=='W')\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==0)\n\t\t\t\t{\n\t\t\t\t\ttempw=r-1;\n\t\t\t\t}\n\t\t\t\tif(tempw> %d %d,%d--%d\\n\",flag,r,c,tempw);\n\t\t\t}\n\t\t\tif(s[r][c]=='B')\n\t\t\t{\n\t\t\t\tfor(k=r+1;k<=8;k++)\n\t\t\t\t{\n\t\t\t\t\tif(s[k][c]=='B'||s[k][c]=='W')\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==0)\n\t\t\t\t{\n\t\t\t\t\ttempb=8-r;\n\t\t\t\t}\n\t\t\t//\tprintf(\"B>> %d %d,%d--%d\\n\",flag,r,c,tempb);\n\t\t\t\tif(tempb\nint main(){\nint i,j,wmoves,bmoves,wrow,wcol,brow,bcol;\nchar arr[8][8];\nint warr[8];\nint barr[8];\nint temp[8];\nint bmin,wmin;\nfor(i=0; i<8; i++)\n scanf(\"%s\",arr[i]);\n for(i=0; i<8; i++)\n {\n warr[i]=0;\n barr[i]=0;\n temp[i]=0;\n }\nfor(i=0; i<8; i++){\nfor(j=0; j<8; j++){\n\n if(arr[i][j]=='W'){\n if(warr[j]==0 &&temp[j]==0){\n warr[j]=i;\n temp[j]=1;}\n if(barr[j]>0)\n barr[j]=0;\n\n }\n if(arr[i][j]=='B')\n {\n if(barr[j]==0)\n barr[j]++;\n else\n barr[j]=1;\n if(warr[j]==0)\n temp[j]=-1;\n }\n if(arr[i][j]=='.'){\n if(barr[j]>0)\n barr[j]++;\n }\n // printf(\"w%d b%d\",warr[j],barr[j]);\n}\n//printf(\"\\n\");\n}\nbmin=0;\nwmin=0;\n//for(i=0; i<8; i++)\n // printf(\"%d %d\\n\",warr[i],barr[i]);\nfor(i=0; i<8; i++){\n if(wmin==0&&warr[i]>0)\n wmin=warr[i];\n else if(warr[i]>0&&warr[i]0)\n bmin=barr[i];\n else if(barr[i]>0&&barr[i]\n#include \n\nchar board[10][10];\n\nint main() {\n\tint r, c, noway, step, black, white;\n\n\tfor (r = 0; r < 8; r++)\n\t\tgets(board[r]);\n\n\tblack = white = 999;\n\n\tfor (c = 0; c < 8; c++) {\n\n\t\tnoway = 0;\n\t\tstep = 999;\n\t\tfor (r = 0; r < 8; r++) {\n\t\t\tif (board[r][c] == 'B')\n\t\t\t\tnoway = 1;\n\t\t\tif (board[r][c] == 'W' && !noway) {\n\t\t\t\tstep = r;\n\t\t\t\tnoway = 1;\n\t\t\t}\n\t\t}\n\t\tif (step < white)\n\t\t\twhite = step;\n\n\t\tnoway = 0;\n\t\tstep = 999;\n\t\tfor (r = 7; r >= 0; r--) {\n\t\t\tif (board[r][c] == 'W')\n\t\t\t\tnoway = 1;\n\t\t\tif (board[r][c] == 'B' && !noway) {\n\t\t\t\tstep = 7 - r;\n\t\t\t\tnoway = 1;\n\t\t\t}\n\t\t}\n\t\tif (step < black)\n\t\t\tblack = step;\n\n\t}\n\n\tif (white <= black)\n\t\tputs(\"A\");\n\telse\n\t\tputs(\"B\");\n\t\n\treturn 0;\n}"}, {"source_code": "#include \n#include \nint main(){\n \n char buf[10];\n int a[8][8] = {0};\n int ad[8] = {10, 10, 10, 10, 10, 10, 10, 10};\n int bd[8] = {10, 10, 10, 10, 10, 10, 10, 10};\n int i, j, mina = 10, minb = 10;\n for ( i = 0; i < 8; i++){\n fgets( buf, 10, stdin);\n for ( j = 0; j < 8; j++){\n if (buf[j] == 'W')\n a[i][j] = 1;\n if (buf[j] == 'B')\n a[i][j] = -1;\n }\n }\n for ( j = 0; j < 8; j++)\n for (i = 0; i < 8; i++){\n if (a[i][j] == -1)\n break;\n if (a[i][j] == 1){\n ad[j] = i;\n break;\n }\n } \n for ( j = 0; j < 8; j++)\n for (i = 7; i >= 0; i--){\n if (a[i][j] == 1)\n break;\n if (a[i][j] == -1){\n bd[j] = 7 - i;\n break;\n }\n }\n for (i = 0; i < 8; i++){\n if (ad[i] < mina)\n mina = ad[i];\n if (bd[i] < minb)\n minb = bd[i];\n }\n (mina <= minb) ? printf(\"%c\", 'A') : printf(\"%c\", 'B');\n \n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tchar a[9][9],c;\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\",&a[i][j]);\n\t\tscanf(\"%c\",&c);\n\t}\n\tint temp,c1=0,min1=10,flag1=0,min2=10,flag2=0,c2=0;\n\tfor(i=0;i<8;i++)\n\t{\t\n\t\tfor(j=0;j<8;j++)\n\t\t{\n\t\t\ttemp=i;\t\n\t\t\tflag1=0;\n\t\t\tflag2=0;\n\t\t\tif(a[i][j]=='B')\n\t\t\t{\n\t\t\t\tc1=0;\n\t\t\t\twhile(temp!=7)\n\t\t\t\t{\n\t\t\t\t\tif(a[temp+1][j]=='.')\n\t\t\t\t\t{\n\t\t\t\t\t\tc1++;\n\t\t\t\t\t\ttemp++;\n\t\t\t\t\t}\n\t\t\t\t\telse \n\t\t\t\t\t{\n\t\t\t\t\t\tflag1=1;\n\t\t\t\t\t\tbreak;\t\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(flag1==0)\n\t\t\t\t{\n\t\t\t\t\tif(c1\n\n#define INF 9\n\nint main()\n{\n\tchar brd[8][9];\n\tint i, j, mina = INF, minb = INF;\n\n\tfor (i = 0; i < 8; i++)\n\t\tgets (brd[i]);\n\n\tfor (i = 0; i < 8; i++) {\n\t\tfor (j = 7; j >= 0 && brd[j][i] == '.'; j--)\n\t\t\t;\n\t\tif (j >= 0 && brd[j][i] == 'B')\n\t\t\tif (7 - j < minb)\n\t\t\t\tminb = 7 - j;\n\t}\n\n\tfor (i = 0; i < 8; i++) {\n\t\tfor (j = 0; j < 8 && brd[j][i] == '.'; j++)\n\t\t\t;\n\t\tif (j < 8 && brd[j][i] == 'W')\n\t\t\tif (j < mina)\n\t\t\t\tmina = j;\n\t}\n\n\tputchar (mina <= minb ? 'A' : 'B');\n\n\treturn 0;\n}\n"}, {"source_code": "#include\ntypedef long long ll;\nint main()\n{\n\tchar ar[10][10];\n\tll i,j;\n\tfor(i=0;i<8;i++)\n\t\tscanf(\"%s\",ar[i]);\n\tchar c;\n\tll minA=100000;\n\tll minB=100000;\n\tll d;\n\tll p=1;\n\tfor(i=0;i<8;i++)\n\t{\n\t\tfor(j=0;j<8;j++)\n\t\t{\n\t\t\tp=1;\n\t\tif(ar[i][j]=='B')\n\t\t{\n\t\t\tfor(ll k=i+1;k<8;k++)\n\t\t\t{\n\t\t\t\tif(ar[k][j]!='.')\n\t\t\t\t{\n\t\t\t\t\tp=2;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\tif(p!=2)\n\t\t\t{\n\t\t\t\td=7-i;\n\t\t\t\tif(d=0;k--)\n\t\t\t{\n\t\t\t\tif(ar[k][j]!='.')\n\t\t\t\t{\n\t\t\t\t\tp=2;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\tif(p!=2)\n\t\t\t{\n\t\t\t\td=i-0;\n\t\t\t\tif(d\n#include\n#include\nint main(){\n int k,c,l,mb=8,mw=8;\n volatile char lec[9];\n volatile char T[8][8];\n for(k=0;k<8;k++){\n scanf(\"%s\",lec);\n for(c=0;c<8;c++){\n T[k][c]=lec[c];\n }\n }\n for(c=0;c<8;c++){\n l=1;\n for(k=0;k<8 && l;k++){\n if(T[k][c]!='.'){\n l=0;\n if(T[k][c]=='W' && k=0 && l;k--){\n if(T[k][c]!='.'){\n l=0;\n if(T[k][c]=='B' && (7-k)\nint main()\n{\n char a[8][8];\n int i,j,wd=8,bd=8;\n for(i=0;i<8;i++)\n {\n scanf(\"%s\",a[i]);\n }\n for(j=0;j<8;j++)\n {\n for(i=0;i<8;i++)\n {\n if(a[i][j]=='B')\n {\n break;\n }\n else if(a[i][j]=='W')\n {\n if(i+1=0;i--)\n {\n if(a[i][j]=='W')\n {\n break;\n }\n else if(a[i][j]=='B')\n {\n if(8-i\n#include \nint a[10][10];\nint main()\n{\n char znak;\n int i,j,beli=100,crni=100,k,nece;\n for (i=1;i<=8;i++){\n for (j=1;j<=8;j++){\n scanf(\"%c\",&znak);\n if (znak=='.') a[i][j]=0;\n if (znak=='B') {\n a[i][j]=2;\n // vrsta2[j]=1;\n }\n if (znak=='W') {\n a[i][j]=1;\n // vrsta1[j]=1;\n }\n }\n if (i<8)\n scanf(\"%c\",&znak);\n }\n for (j=1;j<9;j++){\n for (i=1;i<9;i++){\n nece=0;\n if (a[i][j]==1){\n for (k=i-1;k>0;k--){\n if (a[k][j]==2) {\n nece=1;\n break;\n }\n }\n if ((nece==0)&&(i-1\nint main()\n{\n char c,s[9][9];\n int i,j,ans1,ans2,flag,k;\n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n scanf(\"%c\",&s[i][j]);\n }\n scanf(\"%c\",&c);\n }\n // for(i=1;i<=8;i++)\n // {\n // for(j=1;j<=8;j++)\n // {\n // printf(\"%c\\n\",s[2][1]);\n // }\n // printf(\"\\n\");\n// }\n flag=0;\n for(i=1;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n if(s[i][j]=='W')\n {\n for(k=(i-1);k>=0;k--)\n {\n if(s[k][j]!='.')\n {\n // printf(\"i=%d flag=2\\n\",i);\n flag=2;\n break;\n }\n else if(s[k][j]=='.')\n {\n // printf(\"i=%d flag=1\\n\",i);\n ans1=i;\n flag=1;\n }\n }\n }\n if(flag==1)\n break;\n }\n if(flag==1)\n break;\n }\n flag=0;\n for(i=7;i>=0;i--)\n {\n for(j=0;j<8;j++)\n {\n if(s[i][j]=='B')\n {\n // printf(\"i=%d j=%d\\n\",i,j);\n for(k=i+1;k<8;k++)\n {\n if(s[k][j]!='.')\n {\n flag=2;\n break;\n }\n else if(s[k][j]=='.')\n {\n // printf(\"i=%d flag=1\\n\",i);\n ans2=i;\n flag=1;\n }\n }\n }\n if(flag==1)\n break;\n }\n if(flag==1)\n break;\n }\n // printf(\"A=%d B=%d\\n\",(ans1),(7-ans2));\n if((ans1)<=(7-ans2))\n {\n printf(\"A\\n\");\n }\n else\n {\n printf(\"B\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\nint i,j,a[8][8],distA=10,distB=10;\nfor(i=0;i<8;i++)\n\tfor(j=0;j<8;j++)\n\t\ta[i][j]=-1;\n//\nfor(i=0;i<8;i++){\nchar temp;\nfor(j=0;j<8;j++){\nscanf(\" %c\",&temp);\nif(temp=='W'){\na[i][j]=0;\n}\nif(temp=='B'){\na[i][j]=1;\n}\n}\n//printf(\"done\\n\");\n}\n//check whites\nfor(j=0;j<8;j++){\nfor(i=0;i<8;i++){\nif(a[i][j]==0) distA = (i=0;j--){\nfor(i=7;i>=0;i--){\nif(a[i][j]==1) distB = (7-i\n#include \n#include \n\nint findWayUp(int a[8][8], int, int);\nint findWayDown(int a[8][8], int, int);\n\nint findWayUp(int a[8][8], int currI, int currJ)\n{\n int result = 0;\n if (currI == 0) result = 1;\n else\n {\n if (a[currI-1][currJ] == 0) result = 1 * findWayUp(a, currI-1, currJ);\n else result = 0;\n }\n return result;\n}\n\nint findWayDown(int a[8][8], int currI, int currJ)\n{\n int result = 0;\n if (currI == 7) result = 1;\n else\n {\n if (a[currI+1][currJ] == 0) result = 1 * findWayDown(a, currI+1, currJ);\n else result = 0;\n }\n return result;\n}\n\nint main()\n{\n int board[8][8];\n char ch;\n \n for (int i = 0; i < 8; i++)\n { \n for (int j = 0; j < 8; j++)\n {\n scanf(\"%c\", &ch);\n switch (ch)\n {\n case '.': \n board[i][j] = 0;\n break;\n \n case 'W':\n board[i][j] = 1;\n break;\n \n case 'B':\n board[i][j] = 2;\n break;\n }\n }\n scanf(\"%*c\");\n }\n \n int movesA = 0, movesB = 0;\n for (int i = 0; i < 8; i++)\n for (int j = 0; j < 8; j++)\n {\n if (board[i][j] == 1) \n if (findWayUp(board, i, j)) \n if ((movesA == 0) || (i < movesA)) movesA = i;\n if (board[i][j] == 2)\n if (findWayDown(board, i, j))\n if ((movesB == 0) || ((7-i) < movesB)) movesB = 7-i; \n }\n char winner;\n if (movesA <= movesB) winner = 'A';\n else winner = 'B';\n printf(\"%c\", winner);\n \n return 0;\n}"}, {"source_code": "#include \n#include \nint main()\n{\n char s[10][10];\n int i,j,flag,A1,B1;\n while(scanf(\"%s\",s)!=EOF)\n {\n for(i=1;i<=7;i++)\n scanf(\"%s\",s+i);\n flag=1;\n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n if(s[i][j]=='B')\n {\n if(i+1<=7&&s[i+1][j]=='.'&&s[7][j]=='.')\n {\n B1=i;\n }\n }\n if(s[i][j]=='W'&&flag)\n {\n if(i-1>=0&&s[i-1][j]=='.'&&s[0][j]=='.')\n {\n A1=i;\n flag=0;\n }\n }\n }\n }\n if(A1<=7-B1)\n printf(\"A\\n\");\n else printf(\"B\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nint checkFront(char *matrix, int pos){\n\tfor(pos = pos + 8; pos < 64; pos += 8){\n\t\tif(matrix[pos] != '.'){\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\treturn 1;\n}\n\nint checkBack(char* matrix, int pos){\n\tfor(pos = pos - 8; pos >= 0; pos -= 8){\n\t\tif(matrix[pos] != '.'){\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\treturn 1;\n}\n\nint main(){\n\tint i, a, b;\n\tchar matrix[64];\n\n\tfor(i = 0; i < 64; i++){\n\t\tscanf(\"%c\", &matrix[i]);\n\t\t\n\t\tif(matrix[i] == '\\n'){\n\t\t\ti--;\n\t\t}\n\t}\n\n\tfor(i = 0, a = -1, b = -1; i < 64; i++){\n\t\tif(matrix[i] == 'B'){\n\t\t\tif(checkFront(matrix, i) == 1){\n\t\t\t\ta = i;\n\t\t\t}\n\t\t}\n\n\t\tif(b == -1 && matrix[i] == 'W'){\n\t\t\tif(checkBack(matrix, i) == 1){\n\t\t\t\tb = i;\n\t\t\t}\n\t\t}\n\t}\n\n\t// printf(\"%d %d\\n\", a, b);\n\t// printf(\"%d %d\\n\", (6 - a/8), (b/8));\n\n\tprintf(\"%c\\n\", (a/8)<=(7 - b/8)?'A':'B');\n\n}\n// 1452670234372"}, {"source_code": "#include\n#include \n\n\nint main()\n{ \n\tint data[8][8];\n int min_white=8,min_black=8;\n int i,j;\n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n\t\t\t data[i][j]=getchar();\n\t\t}\n getchar();\n }\n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n if(data[j][i]=='B')\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n if(data[j][i]=='W' && min_white>j)\n {\n\t\t\t\tmin_white=j;\n\t\t\t\tbreak;\n\t\t\t}\n }\n }\n\n for(i=0;i<8;i++)\n {\n for(j=7;j>=0;j--)\n {\n if(data[j][i]=='W')\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n if(data[j][i]=='B' && min_black>(7-j))\n {\n\t\t\t\tmin_black=7-j;\n\t\t\t\tbreak;\n\t\t\t}\n }\n }\n printf(min_black\nint main()\n{\n int i,j,k,n,aa=0,b=0,flag=0;\n char a[10][10];\n for(i=1;i<=8;i++)\n {\n\n scanf(\"%s\",a[i]);\n\n }\n for(i=2;i<=8;i++)\n {\n for(j=0;j<=8;j++)\n {\n\n if(a[i][j]=='W')\n {\n if(khali1(a,i,j)==1)\n {\n \n aa=i;\n break;\n } \n\n }\n }\n if(aa==i)\n break;\n\n }\n for(i=1;i<=7;i++)\n {\n for(j=0;j<=8;j++)\n {\n\n if(a[i][j]=='B')\n {\n \n if(khali2(a,i,j)==1)\n {\n b=i;\n \n }\n\n }\n }\n\n }\n \n while(1)\n {\n aa--;\n if(aa==1)\n {\n flag=1;\n break;\n }\n b++;\n if(b==8)\n {\n flag=0;\n break;\n\n }\n\n\n }\n if(flag)\n printf(\"A\");\n else\n printf(\"B\");\n return 0;\n}\nint khali1(char a[][10],int i,int j)\n{\n int k;\n for(k=1;k<=i-1;k++)\n {\n\n if(a[k][j]!='.')\n return 0;\n }\n return (1);\n}\nint khali2(char a[][10],int i,int j)\n{\n int k;\n for(k=8;k>=i+1;k--)\n {\n\n if(a[k][j]!='.')\n return 0;\n }\n return (1);\n}\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include\n#include\n#include\nint main()\n{ int i,j;\nchar ** str=(char **)malloc(sizeof(char*)*8);\nfor(i=0;i<8;i++)\nstr[i]=(char *)malloc(sizeof(char)*8);\nfor(i=0;i<8;i++)\nscanf(\"%s\",str[i]);\nint k,min_a,min_b,diff_a,diff_b;\nfor(i=0;i<8;i++)\n{ for(j=0;j<8;j++)\n { if(str[i][j]=='W')\n { for(k=i-1;k>=0;k--)\n { if(str[k][j]== '.')\n continue;\n else\n break;\n }\n if(k<0)\n break;\n else\n continue;\n }\n }\n if(j<=7)\n {min_a=i;\n break;}\n}\n\nfor(i=7;i>=0;i--)\n{ for(j=0;j<8;j++)\n { if(str[i][j]=='B')\n { for(k=i+1;k<=7;k++)\n { if(str[k][j]== '.')\n continue;\n else\n break;\n }\n if(k>7)\n break;\n else\n continue;\n }\n }\n //printf(\"yes\");\n if(j<=7)\n {//printf(\"yes\");\n min_b=i;\n break;}\n}\n//printf(\"%d %d\",min_a, min_b);\ndiff_a=min_a;\ndiff_b=7-min_b;\nif(diff_a==diff_b)\n printf(\"A\");\n else if(diff_b>diff_a)\n printf(\"A\");\n else if(diff_b\n\nint mat[9][9];\nchar row[9];\n\nint main()\n{\n int i,j,z;\n for( i = 1 ; i <= 8 ; ++i )\n {\n scanf(\"%s\",row);\n for( z = 0, j = 1 ; row[z] ; ++z, ++j )\n {\n if( row[z] == 'W' )\n mat[i][j] = 1;\n if( row[z] == 'B' )\n mat[i][j] = 2;\n if( row[z] == '.' )\n mat[i][j] = 0;\n }\n }\n\n int Wmin,Bmin;\n Wmin = Bmin = 8;\n for( j = 1 ; j <= 8 ; ++j )\n {\n if( mat[1][j] == 0 )\n for( z = 2 ; z <= 8 ; ++z )\n {\n if( mat[z][j] == 2 )\n break;\n if( mat[z][j] == 1 && Wmin > z-2 )\n Wmin = z-2;\n }\n\n }\n for( j = 1 ; j <= 8 ; ++j )\n {\n if( mat[8][j] == 0 )\n for( z = 7 ; z >= 1 ; --z )\n {\n if( mat[z][j] == 1 )\n break;\n if( mat[z][j] == 2 && Bmin > 8-z )\n Bmin = 8-z;\n }\n }\n\n Wmin < Bmin ? putchar('A') : putchar('B');\n\n return 0;\n}\n"}, {"source_code": "#include \n#include\n#include\nint main()\n{\n int i,k,j,flag=0;\n char a[8][10];\n for(i=0;i<8;i++)\n { \n scanf(\"%s\",a[i]);\n }\n int minw=8,minb=8;\n for(i=0;i<8;i++)\n {\n for(j=0;ji)\n minw=i;\n }\n }\n else if(a[i][j]=='B')\n {\n flag=0;\n for(k=7;k>i;k--)\n {\n if(a[k][j]=='W')\n {\n flag++;\n break;\n }\n }\n if(flag==0)\n {\n if(minb>7-i)\n minb=7-i;\n }\n }\n }\n }\n if(minw>minb)\n printf(\"B\");\n else\n printf(\"A\");\n return 0;\n}"}, {"source_code": "/* Problem: 592A - PawnChess */\n/* Solver: Gusztav Szmolik */\n\n#include \n#include \n\nint main ()\n {\n unsigned short fw;\n unsigned short fb;\n unsigned short i;\n unsigned char s[10];\n unsigned short j;\n unsigned char b[8][8];\n unsigned short wsn;\n unsigned short bsn;\n unsigned short sc;\n unsigned short k;\n \n fw = fb = 0;\n for (i = 0; i < 8; i++)\n {\n if (scanf(\"%9s\",s) != 1)\n return -1;\n if (strlen(s) != 8)\n return -1;\n for (j = 0; j < 8; j++)\n {\n if (s[j] != '.' && s[j] != 'W' && s[j] != 'B')\n return -1;\n if (s[j] == 'W')\n {\n if (!i)\n return -1;\n if (!fw)\n fw = 1;\n }\n else if (s[j] == 'B')\n {\n if (i == 7)\n return -1;\n if (!fb)\n fb = 1;\n }\n b[i][j] = s[j];\n }\n }\n if (!fw || !fb)\n return -1;\n wsn = bsn = 8;\n for (i = 0; i < 8; i++)\n for (j = 0; j < 8; j++)\n {\n if (b[i][j] != '.')\n {\n sc = 0;\n k = i;\n }\n if (b[i][j] == 'W')\n {\n while (k)\n {\n k--;\n if (b[k][j] == '.')\n sc++;\n else\n {\n sc = 0;\n break;\n }\n }\n if (sc && sc < wsn)\n wsn = sc;\n }\n else if (b[i][j] == 'B')\n {\n while (k < 7)\n {\n k++;\n if (b[k][j] == '.')\n sc++;\n else\n {\n sc = 0;\n break;\n }\n }\n if (sc && sc < bsn)\n bsn = sc;\n }\n }\n if (wsn == 8 && bsn == 8)\n return -1;\n printf (wsn <= bsn ? \"A\\n\" : \"B\\n\");\n return 0;\n }\n"}, {"source_code": "#include\nchar game[9][11],*p=game;\nint main()\n{\n\tint found,j,i,k,W_move=64,B_move=64;\n\tfor(i=1;i<9;i++){\n\t\tfor(j=1;j<9;j++){\n\t\t\tscanf(\"%c\",p+i*11+j);\n\t\t}\n\t\tscanf(\"%*c\");\n\t}\n\tfor(i=1;i<9;i++){\n\t\tfor(j=1;j<9;j++){\n\t\t\tfound=0;\n\t\t\t\tif(*(p+i*11+j)=='W'){\n\t\t\t\t\tfor(k=i-1;k>0;k--){\n\t\t\t\t\t\tif(*(p+k*11+j)!='.'){\n\t\t\t\t\t\t\tfound=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\tif(!found){\n\t\t\t\t\t\tif((i-1)B_move)?(printf(\"B\")):(printf(\"A\"));\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int i,j,minA=8, rA, rB,minB=8,k,flag;\n char A[10][10];\n for(i=0;i<8;++i)\n {\n for(j=0;j<8;++j)\n scanf(\"%c\",&A[i][j]);\n getchar();\n }\n for(i=0;i<8;++i)\n {\n for(j=0;j<8;++j)\n {\n if(A[i][j] == 'W')\n {\n flag = 0;\n for(k=i-1;k>=0;--k)\n {\n if(A[k][j] != '.')\n {\n flag = 1;\n break;\n }\n }\n if(flag == 0)\n { \n rA = i;\n if(rA < minA)\n minA = rA;\n }\n }\n else if(A[i][j] == 'B')\n {\n flag = 0;\n for(k=i+1;k<8;++k)\n {\n if(A[k][j] != '.')\n {\n flag = 1;\n break;\n }\n }\n if(flag == 0)\n {\n rB = 7-i;\n if(rB < minB)\n minB = rB;\n }\n }\n }\n }\n if(minA <= minB)\n printf(\"A\\n\");\n else\n printf(\"B\\n\");\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n char str[9][9], my[8];\n int i, j, minB, minA, positB, positA, no1, no2, ans1, ans2,posita, positb;\n\n for(i=1; i<=8; i++)\n {\n gets(my);\n for(j=1; j<=8; j++)\n {\n str[i][j] = my[j-1];\n }\n }\n\n minB=7;\n minA=7;\n for(i=1; i<=8; i++)\n {\n no1 = 0;\n no2 = 0;\n positB=1;\n positb = 8;\n positA=8;\n posita = 1;\n for(j=1; j<=8; j++)\n {\n if(str[j][i] == 'B')\n {\n no1++;\n if(j0 && no2==0)\n {\n ans1 = 8 - positB;\n if(minB>ans1)\n minB = ans1;\n }\n else if(no1==0 && no2>0)\n {\n ans2 = positA - 1;\n if(minA>ans2)\n minA = ans2;\n }\n\n else if(no1>0 && no2>0)\n {\n if(positaans1)\n {\n minB = ans1;\n }\n }\n if(positb>positA)\n {\n ans2 = positA -1;\n if(minA>ans2)\n {\n minA = ans2;\n }\n\n }\n }\n }\n if(minA <= minB)\n printf(\"A\");\n else\n printf(\"B\");\n\n return 0;\n}\n"}, {"source_code": "#include \n#define L 8\n\nchar m[L+1][L+1];\nint a[L+1], b[L+1];\n\nint main() {\n\tint i, j, am, bm;\n\n\tfor(i=0; i=0; i--) {\n\t\t\tif(m[i][j] != '.') {\n\t\t\t\tif(m[i][j] == 'B') {\n\t\t\t\t\tb[j] = L-i-1;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tfor(j=0; j\n#include \n\nint main()\n{\n char board[8][9];\n int countr, countc;\n int W = 8, B = 8,Wb = 8, Bb = 8, checkB = 0;\n for(countr = 0; countr < 8; countr++)\n {\n for(countc = 0; countc < 9; countc++)\n {\n scanf(\"%c\", &board[countr][countc]);\n }\n }\n for(countc = 0; countc < 8; countc++)\n {\n checkB = 0;\n for(countr = 0; countr < 8; countr++)\n {\n if(board[countr][countc] == 'W')\n {\n if(checkB != 1)\n {\n if(W>countr)\n W = countr;\n }\n B = 8;\n }\n if(board[countr][countc] == 'B')\n {\n if(B>7-countr)\n B = 7-countr;\n checkB=1;\n }\n }\n if(B\n#include \n#include \n\nchar cp[12][12];\nint wf[12];\nint wl[12];\nint bl[12] = {8};\nint bf[12] = {8};\nint\nmain()\n{\n\tint i, j, n;\n\tint\tminw = 8, maxb = 0;\n\tscanf (\"%d\", &n);\n\n\tfor (i = 0; i < 8; i++) {\n\t\tscanf (\"%s\", cp[i]);\n\t}\n\n\tfor (i = 0; i < 8; i++) {\n\t\tbf[i] = bl[i] = 8;\n\t\tfor (j = 0; j < 8; j++) {\n\t\t\tif (cp[j][i] == 'B') {\n\t\t\t\tbl[i] = j;\n\t\t\t\tif (bf[i] == 8) {\n\t\t\t\t\tbf[i] = j;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (cp[j][i] == 'W') {\n\t\t\t\tif (!wf[i]) {\n\t\t\t\t\twf[i] = j;\n\t\t\t\t}\n\t\t\t\twl[i] = j;\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (i = 0; i < 8; i++) {\n\t\tif (wf[i] && (wf[i] < bf[i])) {\n\t\t\tif (wf[i] < minw) {\n\t\t\t\tminw = wf[i];\n\t\t\t}\n\t\t}\n\t\tif (bl[i] != 8 && (bl[i] > wl[i])) {\n\t\t\tif (bl[i] > maxb) {\n\t\t\t\tmaxb = bl[i];\n\t\t\t}\n\t\t}\n\t}\n\n\tif (7-maxb < minw) {\n\t\tputs(\"B\");\n\t} else {\n\t\tputs(\"A\");\n\t}\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include \nint main(void)\n{\n int i, j, k, f,t, f2, count, count_2, min =8, min_2 =8;\n char chess[8][10];\n\n for(i=0; i<8; i++) scanf(\"%s\", chess[i]);\n\n for(j=0; j<8; j++){\n for(k=0; k<8; k++){\n if(chess[j][k] == 'W'){\n f = 1;\n for(t=j; t>=0; t--){\n if(chess[t][k] == 'B'){\n f = 0;\n break;\n }\n }\n if(f){\n count = j;\n if(count\n#include\n\nint main()\n{\n int a=0, b=0, i, j, k, p, q=-1, r, s=8;\n char st[9][9];\n for(i=0;i<8;i++){\n scanf(\"%s\", st[i]);\n }\n for(j=0;j<8;j++){\n for(i=7;i>=0;i--){\n if(st[i][j]=='W') break;\n else if(st[i][j]=='B'){\n if(i>q) q=i;\n }\n }\n }\n for(j=0;j<8;j++){\n for(i=0;i<8;i++){\n if(st[i][j]=='B') break;\n else if(st[i][j]=='W'){\n if(i\n#include \n\nint main()\n{\n char board[8][8], x[10];\n int i, j, k, black = 10, white = 10;\n for (i = 0; i < 8; i++){\n scanf(\"%s\", &x);\n for (j = 0; j < 8; j++) board[i][j] = x[j];\n }\n for (i = 0; i < 8; i++){\n for (j = 0; j < 8; j++){\n if (board[i][j] == 'B'){\n for (k = i+1; k < 8; k++) if (board[k][j] != '.') break;\n if ((k == 8) && ((7 - i) < black)) black = (7-i);\n }else if (board[i][j] == 'W'){\n for (k = i-1; k >= 0; k--) if (board[k][j] != '.') break;\n if ((k == -1) && (i < white)) white = i;\n }\n }\n }\n printf((white <= black)?\"A\\n\":\"B\\n\");\n return 0;\n}\n"}, {"source_code": "/*\nluv_18\n*/\n#include\nint main(){\n int i,j,q=0,mina=100,minb=100,p=0,z,y;\n char a[10][10];\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n scanf(\" %c\",&a[i][j]); \n } \n } \n q=0;mina=100;minb=100;p=0;\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n //scanf(\" %c\",a[i][j]);\n //printf(\"%c\",a[i][j]);\n if(a[i][j]=='W'){\n z=i;q=0;\n while(z>=0){\n if(a[z][j]=='B'){\n q=1;\n break; \n }\n \n z--;\n } \n if(q!=1){\n if(mina>i) mina=i; \n } \n } \n \n \n if(a[i][j]=='B'){\n y=i;p=0;\n while(y<8){\n if(a[y][j]=='W'){\n p=1;\n break; \n }\n \n y++;\n } \n if(p!=1){\n if(minb>(7-i)) minb=7-i; \n } \n } \n } \n } \n if(mina<=minb){\n printf(\"A\"); \n }\n else{\n printf(\"B\"); \n }\n // printf(\"Why\"); \n //printf(\"mina=%d minb=%d\",mina,minb);\n // system(\"pause\");\n return 0;\n}\n"}, {"source_code": "//592A-codeforces//\n\n#include\n char a[8][9];\n\nint checkcolW(int i,int j)\n{\n int n;\n for(n=i-1;n>=0;n--)\n {\n if(a[n][j]!='.')\n return 0;\n }\n return 1;\n}\n\nint checkcolB(int i,int j)\n{\n int n;\n for(n=i+1;n<8;n++)\n {\n if(a[n][j]!='.')\n return 0;\n }\n return 1;\n}\n\nmain()\n{\n\n int i,j,maxb=0,mina=7,black,white;\n for(i=0;i<8;i++)\n {\n for(j=0;j<9;j++)\n scanf(\"%c\", &a[i][j]);\n }\n /*printf(\"\\n\");\n \n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n printf(\"%c\", a[i][j]);\n printf(\"\\n\");\n }*/\n \n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n if(a[i][j]=='.')\n continue;\n if(a[i][j]=='B')\n {\n if(checkcolB(i,j)==1)\n {\n if(i>=maxb)\n maxb=i;\n } \n }\n else\n {\n if(checkcolW(i,j)==1)\n {\n if(i<=mina)\n mina=i;\n }\n }\n }\n }\n \n black=7-maxb;\n white=mina;\n if(white>black)\n printf(\"B\");\n else\n printf(\"A\");\n}\n\n\n"}, {"source_code": "#include\nint min1=100000000,min2=10000000,answ,ansb;\nchar a[8][8];\nvoid white()\n{\n\tint i,j;\n\tfor(j=0;j<8;j++)\n\t{\n\t\tfor(i=0;i<8;i++)\n\t\t{\n\t\t\tif(a[i][j]=='B')\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if(a[i][j]=='W')\n\t\t\t{\n\t\t\t\tansw=i;\n\t\t\t\tif(answ < min1)\n\t\t\t\t{\n\t\t\t\t\tmin1=answ;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t}\n\n}\nvoid black()\n{\n\tint i,j;\n\tfor(j=0;j<8;j++)\n\t{\n\t\tfor(i=7;i>=0;i--)\n\t\t{\n\t\t\tif(a[i][j]=='W')\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if(a[i][j]=='B')\n\t\t\t{\n\t\t\t\tansb=7-i;\n\t\t\t\tif(ansb < min2)\n\t\t\t\t{\n\t\t\t\t\tmin2=ansb;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n}\nint main()\n{\n\tint i,j,w,myrow,mycol,b;\n\tchar c;\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\",&a[i][j]);\n\t\t}\n\t\tscanf(\"%c\",&c);\n\t}\n\twhite();\n\tblack();\n//\tprintf(\"%d %d\\n\",min1,min2);\n\tif(min1>min2)\n\t{\n\t\tprintf(\"B\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"A\\n\");\n\t}\n\treturn 0;\n}\n\n\n\n"}, {"source_code": "#include \nint main()\n{\n char board[8][8];\n int i,j;\n for(i=0;i<8;i++){\n scanf(\"%8s\",board[i]);\n }\n int min_a = 8;\n int min_b = 8;\n for(i=0;i<8;i++){\n int b_lo = 8;\n int b_hi = -1;\n int w_lo = 8;\n int w_hi = -1;\n for(j=0;j<8;j++){\n if(board[j][i]=='B'){\n if(j\nint main()\n{ int data[8][8];\n int min_white=8,min_black=8;\n int i,j;\n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n data[i][j]=getchar();\n getchar();\n }\n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n if(data[j][i]=='B'){break;}\n if(data[j][i]=='W' && min_white>j)\n {min_white=j;break;}\n }\n }\n\n for(i=0;i<8;i++)\n {\n for(j=7;j>=0;j--)\n {\n if(data[j][i]=='W'){break;}\n if(data[j][i]=='B' && min_black>(7-j))\n {min_black=7-j;break;}\n }\n }\n printf(min_black\n#include \n\nint main(void) {\n int h;\n int i;\n int j;\n int k;\n int ultB = 0;\n int ultBant;\n int ultW = 0;\n int ultWant;\n char tabuleiro[8][8];\n for(h = 0; h < 8; h++)\n {\n scanf(\"%s\", &tabuleiro[h]);\n }\n for(i = 0; i < 8; i++)\n {\n for(j = 0; j < 8; j++)\n {\n if(tabuleiro[i][j] == 'B')\n {\n ultBant = ultB;\n ultB = i;\n for(k = i+1; k < 8; k++)\n {\n if(tabuleiro[k][j] == 'W')\n {\n ultB = ultBant;\n }\n } \n }\n }\n \n }\n for(i = 7; i >-1; i--){\n for(j = 0; j < 8; j++)\n {\n if(tabuleiro[i][j] == 'W')\n {\n ultWant = ultW;\n ultW = i;\n for(k = i-1; k > -1; k--)\n {\n if(tabuleiro[k][j] == 'B')\n {\n ultW = ultWant;\n }\n } \n }\n }\n }\n if((7 - ultB) >= ultW){\n printf(\"A\");\n }\n else{\n printf(\"B\");\n }\n return 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n\tchar b[8][8];\n\tint w_min=10, b_min=10, i, j;\n\tfor(i=0; i<8; i++)\n\t\tscanf(\"%s\", b[i]);\n\tfor(j=0; j<8; j++)\n\t{\n\t\tfor(i=0; i<8; i++)\n\t\t{\n\t\t\tif(b[i][j]=='B')\n\t\t\t\tbreak;\n\t\t\telse if(b[i][j]=='W')\n\t\t\t{\n\t\t\t\tif(i=0; i--)\n\t\t{\n\t\t\tif(b[i][j]=='W')\n\t\t\t\tbreak;\n\t\t\telse if(b[i][j]=='B')\n\t\t\t{\n\t\t\t\tif((8-i-1)\n\nint main(void){\n\n char arr[10][10];\n int ww[70]={0}, bb[70]={0};\n\n int i, j, n=0, m=0;\n for(i=1; i<=8; i++){\n for(j=1; j<=8;j++){\n scanf(\"%c\", &arr[i][j]);\n if(arr[i][j]=='W'){\n ww[n++]=i*10+j;\n }\n else if(arr[i][j]=='B'){\n bb[m++]=i*10+j;\n }\n }\n getchar();\n }\n\n int check=1, answ, ansb;\n for(i=0; check; i++){\n //printf(\"%d\\n\", ww[i]);\n check=0;\n for(j=1; jbb[i]/10; j--){\n if(arr[j][bb[i]%10]!='.'){\n check=1;\n }\n }\n }\n ansb = 8-bb[i+1]/10;\n //printf(\"ansb:%d\\n\", ansb);\n\n if(answ>ansb){\n printf(\"B\\n\");\n }\n else{\n printf(\"A\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n\nint min(int a , int b) {\n return a > b ? b : a;\n} \nbool ok = false;\nint main() {\nchar cell[8][8];\nint r,c;\nchar aux;\nfor(int i = 0;i<8;i++) {\n for(int j=0;j<8;j++)\n scanf(\" %c\",&cell[i][j]);\n getchar();\n}\nint mina = 100 , minb = 100;\nfor (int i=0;i<8;++i) {\n for(int j=0;j<8;++j) {\n ok = true;\n if(cell[i][j]=='W') {\n for(int k=i;k>0;--k) {\n if( cell[k-1][j] == 'B' && cell[i][j] == 'W') {\n ok = false;\n }\n }\n if (ok)\n {\n mina = min(mina,i);\n }\n \n }\n else if(cell[i][j] == 'B') {\n ok = true;\n for(int z = i;z<8;++z) {\n if(cell[z+1][j] == 'W') {\n ok = false;\n }\n }\n if (ok)\n {\n minb = min(minb,8- i );\n }\n }\n \n }\n}\n//for (int i=0;i<=7;++i) \n// for(int j=0;j<=7;++j) \n// printf(\"%c\",cell[i][j]);\n// printf(\"\\n\");\n\n\nif(mina>=minb)\n printf(\"B\\n\");\nelse if(mina < minb )\n printf(\"A\\n\");\n\n //printf(\"%d\\n\",mina);\n //printf(\"%d\\n\",minb);\nreturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n char str[10][10];\n int i, j, flag, k, W, W_min=7, B, B_min=7;\n\n for(i=0; i<8; i++)\n {\n gets(str[i]);\n }\n for(i=0; i<8; i++)\n {\n for(j=0; j<8; j++)\n {\n if(str[i][j]=='B')\n {\n for(k=i+1, flag=0; k<8; k++)\n {\n if(str[k][j]=='W')\n {\n flag = 1;\n break;\n }\n }\n if(flag==0)\n {\n B = 7-i;\n if(B=0; k--)\n {\n if(str[k][j]=='B')\n {\n flag = 1;\n break;\n }\n }\n if(flag==0)\n {\n W = i;\n if(WB_min)\n printf(\"B\\n\");\n else if(B_min>=W_min)\n printf(\"A\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint Free_Way(const char *matrix,int col,int str,int derect)\n{\n int i,flag=0;\n if(derect==1)\n for(i=str-1;i>=0;i--) {\n\t if (matrix[i*8+col]!='.') {\n\t flag=1;\n\t\tbreak;\n\t }\n\t}\n else\n for(i=str+1;i<8;i++)\n\t if (matrix[i*8+col]!='.') {\n\t flag=1;\n\t\tbreak;\n\t }\n return !flag;\n} \n\n\nint main()\n{\n char sq[8][8];\n int i,j,rw=0,rb=0;\n char c;\n for(i=0;i<8;i++) {\n for(j=0;j<8;j++) {\n c=getchar();\n sq[i][j]=c;\n }\n c=getchar();\n }\n for(i=1;(i<8)&&(rw==0);i++)\n for(j=0;j<8;j++)\n if ((sq[i][j]=='W')&&(Free_Way(&sq[0][0],j,i,1))) {\n rw=i;\n break;\n }\n for(i=6;(i>=0)&&(rb==0);i--)\n for(j=0;j<8;j++)\n if ((sq[i][j]=='B')&&(Free_Way(&sq[0][0],j,i,-1))) {\n rb=7-i;\n break;\n }\n if (rw<=rb)\n printf(\"A\");\n else\n printf(\"B\");\n return 0;\n} \n"}, {"source_code": "#include \n#include \n\nint main() {\n char board[9][9], none;\n int r, c, k;\n int jam=0, minW=9, minB=9;\n\n for(r=1; r<9; r++){\n for(c=1; c<9; c++){\n board[r][c] = getchar();\n }\n none = getchar();\n }\n\n for(r=1; r<9; r++){\n for(c=1; c<9; c++){\n if(board[r][c] == 'W'){\n jam = 0;\n for(k=r-1; k>0; k--){\n if(board[k][c] != '.'){\n jam = 1;\n break;\n }\n }\n if(jam == 0){\n if(minW > r-1){\n minW = r-1;\n }\n }\n }\n else if(board[r][c] == 'B'){\n jam = 0;\n for(k=r+1; k<9; k++){\n if(board[k][c] != '.'){\n jam = 1;\n break;\n }\n }\n if(jam == 0){\n if(minB > 8-r){\n minB = 8-r;\n }\n }\n }\n }\n }\n if(minW <= minB){\n printf(\"A\\n\");\n }\n else{\n printf(\"B\\n\");\n }\n //printf(\"%d %d\\n\", minW, minB);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main(){\n\nchar arr[8][8];\n\nint a[8],b[8],i,j,q=9,z=0,k=9;\n\nfor(i=0;i<8;i++)\n for(j=0;j<8;j++)\n scanf(\" %c\", &arr[i][j]);\n\nfor(j=0;j<8;j++){\n\n for(i=0;i<8;i++){\n\n if(arr[i][j] == 'B')\n break;\n\n if(arr[i][j] == 'W'){\n a[z] = i;\n\n if(a[z] < q)\n q = a[z];\n\n z++;\n\n break;\n }\n\n }\n\n}\n\nz = 0;\n\nfor(j=0;j<8;j++){\n\n for(i=7;i>=0;i--){\n\n if(arr[i][j] == 'W')\n break;\n\n if(arr[i][j] == 'B'){\n b[z] = 7-i;\n\n if(b[z] < k)\n\n k = b[z];\n\n z++;\n\n break;\n\n }\n\n\n\n }\n\n\n}\n\nif(k < q)\n printf(\"B\");\n\nelse\n printf(\"A\");\n\n\n\nreturn 0;\n}"}, {"source_code": "#include \"stdio.h\"\n#include \"string.h\"\n\nint min(int a,int b){\n return a=0;k--)\n {\n if(s[k][j]!='.')\n {\n fg=0;\n break;\n }\n }\n if(fg){\n ansa=min(ansa,i);\n \n }\n }\n }\n }\n if(ansa>ans)\n printf(\"B\\n\");\n else\n printf(\"A\\n\");\n\n return 0;\n}"}, {"source_code": "#include \n#define BSIZE 8\n\nint main()\n{\n char board[BSIZE][BSIZE + 2];\n int i, j;\n for (i = 0; i < BSIZE; ++i) gets(board[i]);\n int a = 0x7fffffff, b = 0x7fffffff;\n for (i = 0; i < BSIZE; ++i) {\n // Scan downwards\n for (j = 0; j < BSIZE && board[j][i] == '.'; ++j);\n if (j < BSIZE && board[j][i] == 'W' && j < a) a = j;\n // Scan upwards\n for (j = BSIZE - 1; j >= 0 && board[j][i] == '.'; --j);\n if (j >= 0 && board[j][i] == 'B' && BSIZE - 1 - j < b) b = BSIZE - 1 - j;\n }\n putchar(a <= b ? 'A' : 'B');\n return 0;\n}\n"}, {"source_code": "#include\nchar map[10][10];\nint MIN(int a,int b){\n return a=0;j--)\n {\n if(map[j][i]!='.')\n {\n if(map[j][i]=='B')\n {\n minb=MIN(minb,7-j);\n break;\n }\n else break;\n }\n }\n }\n if(mina<=minb)printf(\"A\\n\");\n else printf(\"B\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(void)\n{\n char board[8][8];\n\n int i, j;\n for (i = 0; i < 8; i++)\n for (j = 0; j < 8; j++)\n scanf(\" %c\", &board[i][j]);\n \n \n int mina = 10, minb = 10;\n for (i = 0; i < 8; i++)\n { \n for (j = 0; j < 8; j++)\n {\n if (board[j][i] == 'B')\n break;\n else if (board[j][i] == 'W')\n {\n if (mina > j)\n mina = j;\n break; \n }\n }\n \n int k = 7; \n for (; k >= j; k--)\n {\n if (board[k][i] == 'W')\n break;\n else if (board[k][i] == 'B')\n {\n if (minb > 7-k)\n minb = 7-k; \n break; \n }\n }\n }\n printf(\"%c\", mina <= minb ? 'A' : 'B');\n return 0;\n}"}, {"source_code": "#include\nint main ()\n{\n int amin,bmax,i,j,flag=1;\n char c[9][9];\n for(i=1; i<=8; i++)\n scanf(\"%s\",c[i]);\n for(j=0; j<8; j++)\n {\n for(i=1; i<=8; i++)\n {\n if(c[i][j]=='B')\n break;\n else if(c[i][j]=='W')\n {\n if (flag==1)\n {\n amin=i;\n flag=0;\n }\n else if(i=1;i--)\n {\n if(c[i][j]=='W')\n break;\n else if(c[i][j]=='B')\n {\n if (flag==1)\n {\n bmax=i;\n flag=0;\n }\n else if(i>bmax)\n {\n bmax=i;\n }\n break;\n }\n }\n }\n amin--;\n bmax=8-bmax;\n if(amin<=bmax)\n printf(\"A\\n\");\n else\n printf(\"B\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n char a[9][9];\n int i,j,ba,bb,t,c,kt;\n for (i=0;i<8;i++)\n gets(a[i]);\n ba=8; bb=8;\n for (j=0;j<8;j++)\n {\n i=0;\n while ((i<8)&&(a[i][j]=='.')) i++;\n if ((i<8)&&(a[i][j]=='W')&&(ba>i)) ba=i;\n i=7;\n while ((i>-1)&&(a[i][j]=='.')) i--;\n if ((i>=0)&&(a[i][j]=='B')&&(bb>7-i)) bb=7-i;\n }\n if (ba<=bb) printf(\"A\");\n else printf(\"B\");\n return 0;\n}\n"}, {"source_code": "/*A*/\n#include\n#include\nint main()\n{\n\tchar chess[9][9];\n\tint A,B;\n\tint i,j;\n\tint p;\n\tint flag;\n\t//while(1)\n\t//{\n\t\tfor(i=1;i<=8;i++)\n\t\t scanf(\"%s\",chess[i]);\n\t\tA=8;B=8;\n\t\tfor(i=1;i<=8;i++)\n\t\t{\n\t\t\tfor(j=0;j<8;j++)\n\t\t\t{\n\t\t\t if(chess[i][j]=='W')\n\t\t\t {\n\t\t\t \tflag=1;\n\t\t\t \tfor(p=i-1;p>=1;p--)\n\t\t\t \t{\n\t\t\t \t\tif(chess[p][j]!='.')\n\t\t\t \t\t{\n\t\t\t \t\t\tflag=0;\n\t\t\t \t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(flag==1&&(i-1)\n#include \n\nint main()\n{\n char c[9][9],d[9][9];\n int i,j,k,a,b;\n for(i=1;i<=8;i++)\n for(j=1;j<=8;j++)\n {scanf(\" %c\",&c[i][j]);d[i][j]=c[i][j];}\n //for(i=1;i<=8;i++){\n //for(j=1;j<=8;j++){printf(\"%c\",c[i][j]);}printf(\"\\n\");}\n for(i=1;i<=8;i++)\n for(j=1;j<=8;j++)\n {\n if(c[i][j]=='z')continue;\n if(c[i][j]=='B'){for(k=i+1;k<=8;k++)c[k][j]='z';}\n if(c[i][j]=='W'){a=i-1;i=9;j=9;}\n }\n //printf(\"%d\",a);\n for(i=8;i>=1;i--)\n for(j=1;j<=8;j++)\n {\n if(d[i][j]=='z')continue;\n if(d[i][j]=='W'){for(k=i-1;k>=1;k--)d[k][j]='z';}\n if(d[i][j]=='B'){b=8-i;i=0;j=9;}\n }\n //printf(\"%d\",b);\n if(a<=b)printf(\"A\");else printf(\"B\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{ char tabla[50][50];\n int beli[50][50];\n int crni[50][50];\n int a,b,c,d;\n int i;\n for(i=0;i<8;i++){\n gets(tabla[i]);\n }\n char *q=tabla[0];\n int beli_int=0;\n int beli_int1=0;\n int petlja_beli1=0;\n int petlja_beli;\n int brojac_belih=0;\n for(petlja_beli=0;petlja_beli<8;petlja_beli++){\n q=tabla[petlja_beli];\n for(beli_int=0;beli_int<8;beli_int++,q++){\n if(*q=='W'){\n beli[petlja_beli1++][beli_int1]=(petlja_beli+1)*10 + beli_int+1;\n brojac_belih++;\n }}\nbeli_int1=0;\n }\n\n\n\n int petlja_crni;\n int crni_int;\n int petlja_crni1=0;\n int crni_int1=0;\n int brojac_crnih=0;\n for(petlja_crni=0;petlja_crni<8;petlja_crni++){\n q=tabla[petlja_crni];\n for(crni_int=0;crni_int<8;crni_int++,q++){\n if(*q=='B'){\n crni[petlja_crni1++][crni_int1]=(petlja_crni+1)*10 + crni_int+1;\n brojac_crnih++;\n }\n }\ncrni_int1=0;\n }\nint test=0;\nfor(test=0;testcrni[test_GD][0]/10)\n {\n nije_valid=1;\n break;\n }\n}\nif(nije_valid == 1)\n continue;\nelse{\n dobri_beli[beli_increaser++][0]=broj_valid;\n nije_valid=0;\n}}\nfor(test=0;testdobri_beli[sort1][0]){\n najveci_beli=dobri_beli[sort1][0];\n }\n }\n}\n//printf(\"\\n\\n**NAJVECI BELI%d\",najveci_beli);\nint zadnji_korak_b;\nint zadnji_korak_c;\nzadnji_korak_b=najveci_beli/10;\nzadnji_korak_c=najveci_crni/10;\n//printf(\"\\n\\nBELI - %d\\nCRNI - %d\",abs(1-zadnji_korak_b),abs(8-zadnji_korak_c));\nif(abs(1-zadnji_korak_b)<=abs(8-zadnji_korak_c)){\nprintf(\"A\");\n}\nelse\n printf(\"B\");\n}\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include \n#include \n#define MAXN 10\nint sus[2][MAXN+1],jos[2][MAXN+1];\nint main(){\n int i,j,min,flag;\n char a;\n for(i=1;i<=MAXN;i++){\n sus[0][i]=sus[1][i]=MAXN+1;\n jos[0][i]=jos[1][i]=0;\n }\n a=fgetc(stdin);\n i=1;\n while(a=='.'||a=='B'||a=='W'){\n j=1;\n while(a=='.'||a=='B'||a=='W'){\n if(a=='B'){\n if(sus[1][j]>i)\n sus[1][j]=i;\n if(jos[1][j]i)\n sus[0][j]=i;\n if(jos[0][j]=sus[0][i]-1){\n min=sus[0][i]-1;\n flag=0;\n }\n if(jos[1][i]>jos[0][i]&&min>8-jos[1][i]){\n min=8-jos[1][i];\n flag=1;\n }\n }\n if(flag==0)\n printf(\"A\");\n else\n printf(\"B\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int i, j, k, count1=0, count2=0, max1=100, max2=100, f1=0, f2=0;\n char c, a[8][8];\n\n\n for(i=0; i<8; i++)\n for(j=0; j<8; j++)\n scanf(\" %c\", &a[i][j]);\n\n for(i=0; i<8; i++)\n for(j=0; j<8; j++)\n {\n //if(a[i][j]=='W' && )\n if(a[i][j]=='W')\n {\n //printf(\"%d %d\\n\", i, j);\n for(k=i-1; k>=0; k--)\n if(a[k][j]=='.') count1++;\n else\n {\n count1=0;\n break;\n }\n //printf(\"%d %d\\n\", count1, max1);\n if(count1\nint main()\n{\n int i,j,A=7,B=0;\n char arr[8][9];\n for(i=0;i<8;i++)\n gets(arr[i]);\n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n if(arr[j][i]=='B')\n break;\n else if(arr[j][i]=='W' && j=0;j--)\n if(arr[j][i]=='W')\n break;\n else if(arr[j][i]=='B' && j>B)\n {\n B=j;\n break;\n }\n }\n printf(\"%c\",A<=(7-B)?'A':'B');\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main(void) {\n int h;\n int i;\n int j;\n int k;\n int ultB = 0;\n int ultBant;\n int ultW = 0;\n int ultWant;\n char tabuleiro[8][8];\n for(h = 0; h < 8; h++)\n {\n scanf(\"%s\", &tabuleiro[h]);\n }\n for(i = 0; i < 8; i++)\n {\n for(j = 0; j < 8; j++)\n {\n if(tabuleiro[i][j] == 'B')\n {\n ultBant = ultB;\n ultB = i;\n for(k = i+1; k < 8; k++)\n {\n if(tabuleiro[k][j] == 'W')\n {\n ultB = ultBant;\n }\n } \n }\n }\n \n }\n for(i = 7; i >-1; i--){\n for(j = 0; j < 8; j++)\n {\n if(tabuleiro[i][j] == 'W')\n {\n ultWant = ultW;\n ultW = i;\n for(k = i-1; k > -1; k--)\n {\n if(tabuleiro[k][j] == 'B')\n {\n ultW = ultWant;\n }\n } \n }\n }\n }\n if((7 - ultB) >= ultW){\n printf(\"A\");\n }\n else{\n printf(\"B\");\n }\n return 0;\n}"}, {"source_code": "#include \"stdio.h\"\n\nint main()\n{\n int i, j, k,mina=7, minb=7;\n char x[8][8];\n for (i=0;i<8;i++)\n scanf(\"%s\",x[i]);\n for (i=0;i<8;i++)\n for (j=0;j<8;j++)\n {\n if (x[i][j]=='W')\n {\n int clear=1;\n for (k=i-1;k>=0;k--)\n if (x[k][j]!='.')\n clear=0;\n if (clear!=0)\n mina=mina\n\nint main()\n{\n char b[8][8];\n int w_min=10, b_min=10, i, j;\n for(i=0; i<8; i++)\n scanf(\"%s\", b[i]);\n for(j=0; j<8; j++)\n {\n for(i=0; i<8; i++)\n {\n if(b[i][j]=='B')\n break;\n else if(b[i][j]=='W')\n {\n if(i=0; i--)\n {\n if(b[i][j]=='W')\n break;\n else if(b[i][j]=='B')\n {\n if((8-i-1)\ntypedef unsigned u;\nu A[8],B[8];\nint main()\n{\n\tu i,j,a,b;char c;\n\tfor(a=b=i=-1;++i<8;)A[i]=B[i]=-1;\n\tfor(i=-1;++i<8;)for(j=-1;++j<8;)\n\t{\n\t\twhile((c=getchar())<=' ');\n\t\tif(c=='B')B[j]=i;\n\t\tif(c=='W'&&A[j]==-1u)\n\t\t{\n\t\t\tif(B[j]==-1u)A[j]=i;\n\t\t\telse B[j]=-1u;\n\t\t}\n\t}\n\tfor(i=-1;++i<8;)\n\t{\n\t\tif(a>A[i])a=A[i];\n\t\tif(B[i]!=-1u&&b>7-B[i])b=7-B[i];\n\t}\n\tprintf(a>b?\"B\\n\":\"A\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include\ntypedef unsigned u;\nu A[8],B[8];\nint main()\n{\n\tu i,j,a,b;char c;\n\tfor(a=b=i=-1;++i<8;)A[i]=B[i]=-1;\n\tfor(i=-1;++i<8;)for(j=-1;++j<8;)\n\t{\n\t\twhile((c=getchar())<=' ');\n\t\tif(c=='B')B[j]=i;\n\t\tif(c=='W'&&A[j]==-1u)\n\t\t{\n\t\t\tif(B[j]==-1u)A[j]=i;\n\t\t\telse B[j]=-1u;\n\t\t}\n\t}\n\tfor(i=-1;++i<8;)\n\t{\n\t\tif(a>A[i])a=A[i];\n\t\tif(B[i]!=-1u&&b>7-B[i])b=7-B[i];\n\t}\n\tprintf(a>b?\"B\\n\":\"A\\n\");\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\nint main(){\n\n\tint i, j, Ak, Bk, k,q , As=10,Bs=10;\n\tchar table[8][8];\n\tint A[8][8], B[8][8];\n\tchar line[10];\n\tint Ai[8], Bi[8];\n\tint exit = 0;\n\t\n\tfor(i=0; i<8; i++){\n\t\tscanf(\"%s\", line);\n\t\tfor(j = 0; j<8; j++){\n\t\t\ttable[i][j] = line[j];\n\t\t}\n\t}\n\n\tfor(i=0; i<8; i++){\n\t\tfor(j=0; j<8; j++){\n\t\t\tA[i][j] = 0;\n\t\t\tB[i][j] = 0;\n\t\t}\n\t}\n\n\tfor(i=0; i<8; i++){\n\t\tfor(j=0; j<8; j++){\n\t\t\tif(table[j][i] == 'W'){\n\t\t\t\tA[j][i] = j;\n\t\t\t}\n\t\t\tif(table[j][i] == 'B'){\n\t\t\t\tB[j][i] = 7-j;\n\t\t\t}\n\t\t}\n\t}\n\n\tfor(i=0; i<8; i++){\n\t\tfor(j=0; j<8; j++){\n\t\t\tif(table[j][i] == 'W'){\n\t\t\t\tq = 0;\n\t\t\t\tfor(k = j-1 ; k>=0; k--){\n\t\t\t\t\tif(table[k][i] == 'B'){\n\t\t\t\t\t\tq++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(q == 0){\n\t\t\t\t\tif(A[j][i] < As) As = A[j][i];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfor(i=0; i<8; i++){\n\t\tfor(j=7; j >= 0; j--){\n\t\t\tif(table[j][i] == 'B'){\n\t\t\t\tq = 0;\n\t\t\t\tfor(k = j+1 ; k < 8; k++){\n\t\t\t\t\tif(table[k][i] == 'W'){\n\t\t\t\t\t\tq++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(q == 0){\n\t\t\t\t\tif(B[j][i] < Bs) Bs = B[j][i];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\n\tif(As <= Bs) printf(\"A\");\n\telse\t printf(\"B\");\n\n\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \nchar a[9][9];\nchar s;\n\nint main()\n{\n int n,i,k=0,t=0,l,q=8,w=8,e,j=0;\n\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n scanf(\"%c\",&a[i][j]);\n }\n scanf(\"%c\",&s);\n }\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n if(a[i][j]=='B'){\n t=1;\n for(l=i;l<8;l++)\n if(a[l][j]=='W')\n t=0;\n if(t)\n q=7-i;\n }\n if(a[i][j]=='W'){\n t=1;\n for(l=i;l>=0;l--)\n if(a[l][j]=='B')\n t=0;\n if(t)\n if(i\nint main(){\n char a[8][8];\n int i,j,k,posw,posb,m,n;\n posw=posb=-1;\n for(i=0;i<8;++i){\n for(j=0;j<8;++j){\n scanf(\" %c\",&a[i][j]);\n }\n }\nfor(k=0;k<100;++k){\n for(i=0,m=7;i<8,m>=0;++i,--m){\n for(j=0;j<8;++j){\n if((a[i][j]=='w'||a[i][j]=='W')&&(k%2==0)){\n if(a[i-1][j]== '.'){\n a[i][j]='.';\n a[i-1][j]='W';\n posw=(i-1);\n }\n }\n if((a[m][j]=='b'||a[m][j]=='B')&&(k%2!=0)){\n if(a[m+1][j]=='.'){\n a[m][j]='.';\n a[m+1][j]='B';\n posb=(m+1);\n \n }\n }\n }\n if(posw==0){\n printf(\"A\");\n exit(0);\n }\n else if(posb==7){\n printf(\"B\");\n exit(0);\n } \n } \n }\nreturn 0;\n}"}], "negative_code": [{"source_code": "#include\n\nmain()\n{\n int a[20],b[20],r,c,i,j=0,ra,rb,k=0,l=0,d=0,ca,cb,A[8],B[8],wa=0,wb=0;\n char ch[8][8];\n for(r=0;r<8;r++)\n {\n scanf(\"%s\",&ch[r]);\n }\n for(r=7;r>=0;r--)\n {\n for(c=7;c>=0;c--)\n {\n if(ch[r][c]=='B')\n b[j++]=c,B[wb++]=r;\n }\n }\n for(r=0;r<8;r++)\n {\n for(c=0;c<8;c++)\n {\n if(ch[r][c]=='W')\n a[k++]=c,A[wa++]=r;\n }\n }\n for(i=0;i\nint main(void)\n{\n int i, j, k, f,t, f2, count, count_2, min =8, min_2 =8;\n char chess[8][10];\n\n for(i=0; i<8; i++) scanf(\"%s\", chess[i]);\n\n for(j=0; j<8; j++){\n for(k=0; k<8; k++){\n if(chess[j][k] == 'W'){\n f = 1;\n for(t=k; t>=0; t--){\n if(chess[t][k] == 'B'){\n f = 0;\n break;\n }\n }\n if(f){\n count = j;\n if(count\n\nint main(void){\n\n char arr[10][10];\n int ww[70]={0}, bb[70]={0};\n\n int i, j, n=0, m=0;\n for(i=1; i<=8; i++){\n for(j=1; j<=8;j++){\n scanf(\"%c\", &arr[i][j]);\n if(arr[i][j]=='W'){\n ww[n++]=i*10+j;\n }\n else if(arr[i][j]=='B'){\n bb[m++]=i*10+j;\n }\n }\n getchar();\n }\n\n int check=1, answ, ansb;\n for(n=0; check; n++){\n //printf(\"%d\\n\", ww[n]);\n check=0;\n for(i=1; ibb[m]/10; i--){\n if(arr[i][bb[m]%10]=='W'){\n check=1;\n }\n }\n }\n ansb = 8-bb[m-1]/10;\n //printf(\"ansb:%d\\n\", ansb);\n\n if(answ>ansb){\n printf(\"B\\n\");\n }\n else{\n printf(\"A\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n char s[9][9];\n int i,j,w[9],b[9],wneed=0,bneed=0,check[9][9],no1=0,no2=0,k;\n for(i=0;i<8;i++){\n scanf(\"%s\",s[i]);\n }\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n check[i][j]=0;\n }\n }\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n if(s[i][j]=='W') check[i][j]=1;\n else if(s[i][j]=='B') check[i][j]=2;\n }\n }\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n if(check[i][j]==1){\n for(k=i-1;k>=0;k--){\n if(check[k][j]==2){\n no1=1;break;\n }\n }\n if(no1==0) {\n wneed=i;\n break;\n }\n }\n }\n if(wneed !=0) break;\n }\n for(i=7;i>=0;i--){\n for(j=0;j<8;j++){\n if(check[i][j]==2){\n for(k=i+1;k<8;k++){\n if(check[k][j]==1){\n no2=1;break;\n }\n }\n if(no2==0) {bneed=7-i;break;}\n }\n }\n if(bneed !=0) break;\n }\n if(bneed>wneed) printf(\"B\\n\");\n else printf(\"A\\n\");\n return 0;\n}\n"}, {"source_code": "#include\n\nmain()\n{\n int a[8],b[8],r,c,i,j=0,ra,rb,k=0;\n char ch[8][8];\n for(r=0;r<8;r++)\n {\n scanf(\"%s\",ch[r]);\n }\n for(r=0;r<8;r++)\n {\n for(c=0;c<8;c++)\n {\n if(ch[r][c]=='B')\n {\n ra=7-r;\n for(i=r+1;i<8;i++)\n {\n if(ch[i][c]!='.')\n j=1;\n }\n }\n if(j!=1&&ch[r][c]=='B')\n {\n j=0,k=1;\n break;\n }\n else\n j=0;\n }\n if(k==1)\n {\n break;\n }\n }\n for(r=0;r<8;r++)\n {\n for(c=0;c<8;c++)\n {\n if(ch[r][c]=='W')\n {\n rb=r;\n for(i=r-1;i>=0;i--)\n {\n if(ch[i][c]!='.')\n j=2;\n }\n }\n if(j!=2&&ch[r][c]=='W')\n {\n k=2;\n break;\n }\n else\n j=1;\n }\n if(k==2)\n {\n break;\n }\n }\n if(ra>=rb)\n printf(\"A\");\n else\n printf(\"B\");\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n\tchar b[8][8];\n\tint w_min=10, b_min=10, i, j;\n\tfor(i=0; i<8; i++)\n\t\tscanf(\"%s\", b[i]);\n\tfor(j=0; j<8; j++)\n\t{\n\t\tfor(i=0; i<8; i++)\n\t\t{\n\t\t\tif(b[i][j]=='B')\n\t\t\t\tbreak;\n\t\t\telse if(b[i][j]=='W')\n\t\t\t{\n\t\t\t\tif(i=0; i--)\n\t\t{\n\t\t\tif(b[i][j]=='W')\n\t\t\t\tbreak;\n\t\t\telse if(b[i][j]=='B')\n\t\t\t{\n\t\t\t\tif((8-i-1)\nint main()\n{\n char c,s[9][9];\n int i,j,ans1,ans2,flag,k;\n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n scanf(\"%c\",&s[i][j]);\n }\n scanf(\"%c\",&c);\n }\n // for(i=1;i<=8;i++)\n // {\n // for(j=1;j<=8;j++)\n // {\n // printf(\"%c\\n\",s[2][1]);\n // }\n // printf(\"\\n\");\n// }\n flag=0;\n for(i=1;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n if(s[i][j]=='W')\n {\n for(k=(i-1);k>=0;k--)\n {\n if(s[k][j]!='.')\n {\n // printf(\"i=%d flag=2\\n\",i);\n flag=2;\n break;\n }\n else if(s[k][j]=='.')\n {\n // printf(\"i=%d flag=1\\n\",i);\n ans1=i;\n flag=1;\n }\n }\n }\n if(flag==1)\n break;\n }\n if(flag==1)\n break;\n }\n flag=0;\n for(i=7;i>=0;i--)\n {\n for(j=0;j<8;j++)\n {\n if(s[i][j]=='B')\n {\n // printf(\"i=%d j=%d\\n\",i,j);\n for(k=i+1;k<8;k++)\n {\n if(s[k][j]!='.')\n {\n flag=2;\n break;\n }\n else if(s[k][j]=='.')\n {\n // printf(\"i=%d flag=1\\n\",i);\n ans2=i;\n flag=1;\n }\n }\n }\n if(flag==1)\n break;\n }\n if(flag==1)\n break;\n }\n // printf(\"A=%d B=%d\\n\",(ans1),(7-ans2));\n if((ans1)<(7-ans2))\n {\n printf(\"A\\n\");\n }\n else\n {\n printf(\"B\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n\tchar b[8][8];\n\tint w_min=10, b_min=10, i, j;\n\tfor(i=0; i<8; i++)\n\t\tscanf(\"%s\", b[i]);\n\tfor(j=0; j<8; j++)\n\t{\n\t\tfor(i=0; i<8; i++)\n\t\t{\n\t\t\tif(b[i][j]=='B')\n\t\t\t\tbreak;\n\t\t\telse if(b[i][j]=='W')\n\t\t\t{\n\t\t\t\tif(i=0; i--)\n\t\t{\n\t\t\tif(b[i][j]=='W')\n\t\t\t\tbreak;\n\t\t\telse if(b[i][j]=='B')\n\t\t\t{\n\t\t\t\tif((8-i-1)\ntypedef long long ll;\nint main()\n{\n\tchar ar[9][9];\n\tll i,j;\n\tfor(i=0;i<8;i++)\n\t\tscanf(\"%s\",ar[i]);\n\tchar c;\n\tll min=100000;\n\tll d;\n\tll p=1;\n\tfor(i=0;i<8;i++)\n\t{\n\t\tfor(j=0;j<8;j++)\n\t\t{\n\t\t\tp=1;\n\t\tif(ar[i][j]=='B')\n\t\t{\n\t\t\tfor(ll k=i+1;k<8;k++)\n\t\t\t{\n\t\t\t\tif(ar[k][j]!='.')\n\t\t\t\t{\n\t\t\t\t\tp=2;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\tif(p!=2)\n\t\t\t{\n\t\t\t\td=7-i;\n\t\t\t\tif(d=0;k--)\n\t\t\t{\n\t\t\t\tif(ar[k][j]!='.')\n\t\t\t\t{\n\t\t\t\t\tp=2;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\tif(p!=2)\n\t\t\t{\n\t\t\t\td=i-0;;\n\t\t\t\tif(d=0;i--)\n for (j=0;j<8;j++)\n if ((x[i][j]=='B')&&(b[j]==0))\n b[j]=i+1;\n for (i=0;i<8;i++)\n {\n if ((a[i]!=9)&&((b[i]>a[i])||(b[i]==0)))\n mina=mina<(a[i]-1)?mina:(a[i]-1);\n if ((b[i]!=0)&&((b[i]>a[i])||(a[i]==9)))\n minb=minb<(8-b[i])?minb:(8-b[i]);\n }\n printf(\"%c\\n\",mina<=minb?'A':'B');\n return 0;\n}\n"}, {"source_code": "#include\nint i,an,bn,f,j;\nchar a[9][9];\nint main()\n{\n for(i=0;i<8;i++)scanf(\"%s\",a[i]);\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n if(a[i][j]=='W'){an=i;f=1;break;}\n }\n if(f)break;\n }\n for(i=7;i>=0;i--){\n for(j=0;j<8;j++){\n if(a[i][j]=='B'){bn=7-i;f=1;break;}\n }\n if(f)break;\n }\n bn\n#include \n\nint main(){\n\n\tint i, j, Ak, Bk, k,q , As=10,Bs=10;\n\tchar table[8][8];\n\tint A[8][8], B[8][8];\n\tchar line[10];\n\tint Ai[8], Bi[8];\n\tint exit = 0;\n\t\n\tfor(i=0; i<8; i++){\n\t\tscanf(\"%s\", line);\n\t\tfor(j = 0; j<8; j++){\n\t\t\ttable[i][j] = line[j];\n\t\t}\n\t}\n\n\tfor(i=0; i<8; i++){\n\t\tfor(j=0; j<8; j++){\n\t\t\tA[i][j] = 0;\n\t\t\tB[i][j] = 0;\n\t\t}\n\t}\n\n\tfor(i=0; i<8; i++){\n\t\tfor(j=0; j<8; j++){\n\t\t\tif(table[j][i] == 'W'){\n\t\t\t\tA[j][i] = j;\n\t\t\t}\n\t\t\tif(table[j][i] == 'B'){\n\t\t\t\tB[j][i] = 7-j;\n\t\t\t}\n\t\t}\n\t}\n\n\tfor(i=0; i<8; i++){\n\t\tfor(j=0; j<8; j++){\n\t\t\tif(table[j][i] == 'W'){\n\t\t\t\tq = 0;\n\t\t\t\tfor(k = j-1 ; k>=0; k--){\n\t\t\t\t\tif(table[k][i] == 'B'){\n\t\t\t\t\t\tq++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(q == 0){\n\t\t\t\t\tif(A[j][i] < As) As = A[j][i];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfor(i=0; i<8; i++){\n\t\tfor(j=7; j >= 0; j--){\n\t\t\tif(table[j][i] == 'B'){\n\t\t\t\tq = 0;\n\t\t\t\tfor(k = j+1 ; k < 8; k++){\n\t\t\t\t\tif(table[k][i] == 'W'){\n\t\t\t\t\t\tq++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(q == 0){\n\t\t\t\t\tif(B[j][i] < Bs) Bs = B[j][i];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\n\tif(As >= Bs) printf(\"B\");\n\telse\t printf(\"A\");\n\n\n\treturn 0;\n}\n"}, {"source_code": "#include\nint i,j,k,a,b;\nchar s[8][9];\nint main()\n{\n for(i=0;i<8;i++)scanf(\"%s\",s[i]);\n a=8,b=8;\n for(i=0;i<8;i++)\n for(j=0;j<8;j++){\n if(s[j][i]=='W'){if(j=0;j--){\n if(s[j][i]=='B'){if(jb?printf(\"B\\n\"):printf(\"A\\n\");\n return 0;\n}\n"}, {"source_code": "#include\n\nmain()\n{\n int a[8],b[8],r,c,i,j=0,ra,rb,k=0;\n char ch[8][8];\n for(r=0;r<8;r++)\n {\n scanf(\"%s\",ch[r]);\n }\n for(r=0;r<8;r++)\n {\n for(c=0;c<8;c++)\n {\n if(ch[r][c]=='B')\n {\n ra=7-r;\n for(i=r+1;i<8;i++)\n {\n if(ch[i][c]!='.')\n j=1;\n }\n }\n if(j!=1&&ch[r][c]=='B'&&r==7)\n {\n j=0,k=1;\n break;\n }\n if(j==1)\n j=0;\n }\n if(k==1)\n {\n break;\n }\n }\n for(r=0;r<8;r++)\n {\n for(c=0;c<8;c++)\n {\n if(ch[r][c]=='W')\n {\n rb=r;\n for(i=r-1;i>=0;i--)\n {\n if(ch[i][c]!='.')\n j=2;\n }\n }\n if(j!=2&&ch[r][c]=='W'&&r==0)\n {\n k=2;\n break;\n }\n if(j==2)\n j=1;\n }\n if(k==2)\n {\n break;\n }\n }\n if(ra>=rb)\n printf(\"A\");\n else\n printf(\"B\");\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int x=0,y=0,i,j,g,f=0,k;\n char s,str[100][100];\n for(i=0;i<8;i++){\n //for(j=0;j<8;j++){\n scanf(\"%s\",str[i]);\n //}\n //printf(\"\\n\");\n }\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n if(str[i][j]=='B'){\n /*if(i==0){\n printf(\"%d %d\\n\",i,j);\n }*/\n if(str[i+1][j]!='W'||str[i+1][j]!='B')\n x=i+1;\n }\n if(str[i][j]=='W'){\n if(str[i-1][j]=='B'||str[i-1][j]=='W'){\n //printf(\"YES\");\n continue;\n }\n else if(f==0){\n y=9-(i+1);\n f++;\n //printf(\"%d %d\\n\",i,j);\n }\n }\n }\n }\n if(x<=y){\n printf(\"A\");\n }\n else{\n printf(\"B\");\n }\n //printf(\"\\n\");\n //printf(\"%d %d\",x,y);\n return 0;\n}\n\n"}, {"source_code": "#include \n\nint main()\n{\n int i, j, A, B;\n char Map[8][9];\n for(i = 0; i < 8; ++i) {\n scanf(\"%s\", Map[i]);\n }\n A = 8;\n B = 8;\n for(i = 0; i < 8; ++i) {\n j = 0;\n while(Map[j][i] == '.' && j < 8) {\n ++j;\n }\n if(j < 8) {\n if(Map[j][i] == 'W') {\n if(j < A) {\n A = j;\n }\n }\n }\n j = 7;\n while(Map[j][i] == '.' && j >= 0) {\n --j;\n }\n if(j >= 0) {\n if(Map[j][i] == 'B') {\n if(7 - j < B) {\n B = 7 - j;\n }\n }\n }\n }\n puts(A <= B ? \"W\" : \"B\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint Free_Way(const char *matrix,int col,int str,int derect)\n{\n int i,flag=0;\n if(derect==1)\n for(i=str-1;i>=0;i--) {\n if (matrix[i*8+col]!=0) {\n flag=1;\n break;\n }\n }\n else\n for(i=str+1;i<8;i++)\n if (matrix[i*8+col]!=0) {\n flag=1;\n break;\n }\n return !flag;\n} \n\n\nint main()\n{\n char sq[8][8];\n int i,j,rw=0,rb=0;\n char str[8];\n for(i=0;i<8;i++) {\n scanf(\"%s\",str);\n for(j=0;j<8;j++)\n sq[i][j]=str[j];\n }\n for(i=1;(i<8)&&(rw==0);i++)\n for(j=0;j<8;j++)\n if ((sq[i][j]=='W')&&(Free_Way(&sq[0][0],j,i,1))) {\n rw=i;\n break;\n }\n for(i=6;(i>=0)&&(rb==0);i--)\n for(j=0;j<8;j++)\n if ((sq[i][j]=='B')&&(Free_Way(&sq[0][0],j,i,-1))) {\n rb=7-i;\n break;\n }\n if (rw<=rb)\n printf(\"A\");\n else\n printf(\"B\");\n return 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n int i,j,k,n,aa=0,b=0,flag=0;\n char a[10][10];\n for(i=1;i<=8;i++)\n {\n\n scanf(\"%s\",a[i]);\n\n }\n for(i=2;i<=8;i++)\n {\n for(j=0;j<=8;j++)\n {\n\n if(a[i][j]=='W')\n {\n if(khali1(a,i,j)==1)\n {\n \n aa=i;\n break;\n } \n\n }\n }\n if(aa==i)\n break;\n\n }\n printf(\"%d \\n\",aa);\n for(i=1;i<=7;i++)\n {\n for(j=0;j<=8;j++)\n {\n\n if(a[i][j]=='B')\n {\n \n if(khali2(a,i,j)==1)\n {\n b=i;\n \n }\n\n }\n }\n\n }\n printf(\"%d \\n\",b);\n while(1)\n {\n aa--;\n if(aa==1)\n {\n flag=1;\n break;\n }\n b++;\n if(b==8)\n {\n flag=0;\n break;\n\n }\n\n\n }\n if(flag)\n printf(\"A\");\n else\n printf(\"B\");\n return 0;\n}\nint khali1(char a[][10],int i,int j)\n{\n int k;\n for(k=1;k<=i-1;k++)\n {\n\n if(a[k][j]!='.')\n return 0;\n }\n return (1);\n}\nint khali2(char a[][10],int i,int j)\n{\n int k;\n for(k=8;k>=i+1;k--)\n {\n\n if(a[k][j]!='.')\n return 0;\n }\n return (1);\n}\n\n"}, {"source_code": "#include \nint main()\n{\n int x=0,y=0,i,j,g,f=0,k=0,finalB,finalW;\n char s,str[100][100];\n for(i=0;i<8;i++){\n scanf(\"%s\",str[i]);\n }\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n if(str[j][i]=='B'){\n x=j+1;\n }\n if(str[j][i]=='W'){\n y=j+1;\n if(f==0){\n g=y;\n }\n f++;\n }\n }\n if(x>y){\n if(x>=finalB){\n finalB=x;\n }\n if((9-g)>=finalW){\n finalW=g;\n }\n }\n f=0;\n }\n if(finalW>=finalB){\n printf(\"A\");\n }\n else{\n printf(\"B\");\n }\n return 0;\n}\n"}, {"source_code": "#include\n\nmain()\n{\n int r,c,i,j=0,ra,rb,k=0;\n char ch[8][8];\n for(r=0;r<8;r++)\n {\n scanf(\"%s\",ch[r]);\n }\n for(r=0;r<8;r++)\n {\n for(c=0;c<8;c++)\n {\n if(ch[r][c]=='B')\n {\n ra=7-r;\n for(i=r+1;i<8;i++)\n {\n if(ch[i][c]!='.')\n j=1;\n }\n }\n if(j!=1&&ch[r][c]=='B'&&i==7)\n {\n j=0,k=1;\n break;\n }\n if(j==1)\n j=0;\n }\n if(k==1)\n {\n break;\n }\n }\n for(r=0;r<8;r++)\n {\n for(c=0;c<8;c++)\n {\n if(ch[r][c]=='W')\n {\n rb=r;\n for(i=r-1;i>=0;i--)\n {\n if(ch[i][c]!='.')\n j=2;\n }\n }\n if(j!=2&&ch[r][c]=='W'&&i==0)\n {\n k=2;\n break;\n }\n if(j==2)\n j=1;\n }\n if(k==2)\n {\n break;\n }\n }\n if(ra>=rb)\n printf(\"A\");\n else\n printf(\"B\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int i, j, k, count1=0, count2=0, max1=100, max2=100, f1=0, f2=0;\n char c, a[8][8];\n\n\n for(i=0; i<8; i++)\n for(j=0; j<8; j++)\n scanf(\" %c\", &a[i][j]);\n\n for(i=0; i<8; i++)\n for(j=0; j<8; j++)\n {\n //if(a[i][j]=='W' && )\n if(a[i][j]=='W' || a[i][j]=='w')\n {\n //printf(\"%d %d\\n\", i, j);\n for(k=i-1; k>=0; k--)\n if(a[k][j]=='.') count1++;\n else\n {\n count1=0;\n break;\n }\n //printf(\"%d %d\\n\", count1, max1);\n if(count1\nint main()\n{\n int x=0,y=0,i,p=0,j,g=0,f=0,h=0,k=0,finalB=0,finalW=0;\n char str[100][100];\n for(i=0;i<8;i++){\n scanf(\"%s\",str[i]);\n }\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n if(str[j][i]=='B'){\n x=j+1;\n if(p==0){\n h=x;\n }\n p++;\n }\n if(str[j][i]=='W'){\n y=j+1;\n if(f==0){\n g=9-y;\n }\n f++;\n }\n }\n //printf(\"%d %d %d\\n\",x,y,g);\n if(x>y||x==0||y==0){\n if(x>=finalB){\n finalB=x;\n }\n if(h==0){\n if(g>=finalW){\n finalW=g;\n }\n }\n if(h!=0){\n if(g>=finalW&&g>(9-h)){\n finalW=g;\n }\n }\n }\n else if(x(9-x)&&g>=finalW){\n finalW=g;\n }\n }\n p=0;\n f=0;\n x=0;\n y=0;\n g=0;\n h=0;\n }\n if(finalW>=finalB){\n printf(\"A\");\n }\n else{\n printf(\"B\");\n }\n //printf(\"\\n%d %d\",finalB,finalW);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main(){\n\n\tint i, j, Ak, Bk, k, As=0,Bs=0;\n\tchar table[8][8];\n\tint A[8][8], B[8][8];\n\tchar line[10];\n\t\n\tfor(i=0; i<8; i++){\n\t\tscanf(\"%s\", line);\n\t\tfor(j = 0; j<8; j++){\n\t\t\ttable[i][j] = line[j];\n\t\t}\n\t}\n\n\tfor(i=0; i<8; i++){\n\t\tfor(j=0; j<8; j++){\n\t\t\tA[i][j] = 0;\n\t\t\tB[i][j] = 0;\n\t\t}\n\t}\n\n\tfor(i=0; i<8; i++){\n\t\tfor(j=0; j<8; j++){\n\t\t\tif(table[j][i] == 'W'){\n\t\t\t\tA[j][i] = j;\n\t\t\t}\n\t\t\tif(table[j][i] == 'B'){\n\t\t\t\tB[j][i] = 7-j;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tfor(i=0; i<8; i++){\n\t\tAk = 0;\n\t\tBk = 0;\n\t\tfor(j=0; j<8; j++){\n\t\t\tif(A[j][i] != 0){\n\t\t\t\tAk++;\n\t\t\t}\n\t\t\tif(B[j][i] != 0){\n\t\t\t\tBk++;\n\t\t\t}\n\t\t}\n\n\t\tif( (Ak + Bk) > 7 ){\n\t\t\tfor(k=0; k<8; k++){\n\t\t\t\tA[k][i] != 0;\n\t\t\t\tB[k][i] != 0;\n\t\t\t}\n\t\t}\n\t}\n\n\tfor(i=0; i<8; i++){\n\t\tfor(j=0; j<8; j++){\n\t\t\tAs += A[i][j];\n\t\t\tBs += B[i][j];\n\t\t}\n\t}\n\n\tif(As >= Bs) printf(\"B\");\n\telse\t printf(\"A\");\n\n\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n\nchar data[10][10];\n\nint main()\n{\n while(scanf(\"%s\",&data[0])!=EOF)\n {\n int i;\n int j;\n for(i=1;i<8;i++)\n scanf(\"%s\",&data[i]);\n int k;\n int mina=9999,minb=9999;\n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n if(data[i][j]=='W')\n {\n for(k=0;k\nint main()\n{\n int x=0,y=0,i,j,g=0,f=0,k=0,finalB=0,finalW=0;\n char str[100][100];\n for(i=0;i<8;i++){\n scanf(\"%s\",str[i]);\n }\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n if(str[j][i]=='B'){\n x=j+1;\n }\n if(str[j][i]=='W'){\n y=j+1;\n if(f==0){\n g=9-y;\n }\n f++;\n }\n }\n if(x>y||x==0||y==0){\n if(x>=finalB){\n finalB=x;\n }\n if(g>=finalW){\n finalW=g;\n }\n }\n f=0;\n x=0;\n y=0;\n }\n if(finalW>=finalB){\n printf(\"A\");\n }\n else{\n printf(\"B\");\n }\n printf(\"\\n%d %d\",finalB,finalW);\n return 0;\n}\n"}, {"source_code": "#include\n\nmain()\n{\n int a[8],b[8],r,c,i,j=0,ra,rb,k=0;\n char ch[8][8];\n for(r=0;r<8;r++)\n {\n scanf(\"%s\",ch[r]);\n }\n for(r=0;r<8;r++)\n {\n for(c=0;c<8;c++)\n {\n if(ch[r][c]=='B')\n {\n ra=7-r;\n for(i=r+1;i<8;i++)\n {\n if(ch[i][c]!='.')\n j=1;\n }\n }\n if(j!=1&&ch[r][c]=='B')\n {\n j=0,k=1;\n break;\n }\n if(j==1)\n j=0;\n }\n if(k==1)\n {\n break;\n }\n }\n for(r=0;r<8;r++)\n {\n for(c=0;c<8;c++)\n {\n if(ch[r][c]=='W')\n {\n rb=r;\n for(i=r-1;i>=0;i--)\n {\n if(ch[i][c]!='.')\n j=2;\n }\n }\n if(j!=2&&ch[r][c]=='W')\n {\n k=2;\n break;\n }\n if(j==2)\n j=1;\n }\n if(k==2)\n {\n break;\n }\n }\n if(ra>=rb)\n printf(\"A\");\n else\n printf(\"B\");\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int x=0,y=0,i,j,g,f=0,k;\n char s,str[100][100];\n for(i=0;i<8;i++){\n //for(j=0;j<8;j++){\n scanf(\"%s\",str[i]);\n //}\n //printf(\"\\n\");\n }\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n if(str[i][j]=='B'){\n /*if(i==0){\n printf(\"%d %d\\n\",i,j);\n }*/\n if(str[i+1][j]!='W'||str[i+1][j]!='B')\n x=i+1;\n }\n if(str[i][j]=='W'){\n /*if(str[i-1][j]=='B'||str[i-1][j]=='W'){\n //printf(\"YES\");\n continue;\n }*/\n if(str[i-1][j]!='B'||str[i-1][j]!='W'){\n if(f==0){\n y=9-(i+1);\n f++;\n }\n //printf(\"%d %d\\n\",i,j);\n }\n }\n }\n }\n if(x<=y){\n printf(\"A\");\n }\n else{\n printf(\"B\");\n }\n // printf(\"\\n\");\n //printf(\"%d %d\",x,y);\n return 0;\n}\n\n"}, {"source_code": "#include \nint main()\n{\n int x=0,y=0,i,p=0,j,g=0,f=0,h=0,k=0,finalB=0,finalW=0;\n char str[100][100];\n for(i=0;i<8;i++){\n scanf(\"%s\",str[i]);\n }\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n if(str[j][i]=='B'){\n x=j+1;\n if(p==0){\n h=x;\n }\n p++;\n }\n if(str[j][i]=='W'){\n y=j+1;\n if(f==0){\n g=9-y;\n }\n f++;\n }\n }\n printf(\"%d %d %d\\n\",x,y,g);\n if(x>y||x==0||y==0){\n if(x>=finalB){\n finalB=x;\n }\n if(h==0){\n if(g>=finalW){\n finalW=g;\n }\n }\n if(h!=0){\n if(g>=finalW&&g>(9-h)){\n finalW=g;\n }\n }\n }\n else if(x(9-x)&&g>=finalW){\n finalW=g;\n }\n }\n p=0;\n f=0;\n x=0;\n y=0;\n g=0;\n h=0;\n }\n if(finalW>=finalB){\n printf(\"A\");\n }\n else{\n printf(\"B\");\n }\n printf(\"\\n%d %d\",finalB,finalW);\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int x=0,y=0,i,j,g=0,f=0,k=0,finalB=0,finalW=0;\n char str[100][100];\n for(i=0;i<8;i++){\n scanf(\"%s\",str[i]);\n }\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n if(str[j][i]=='B'){\n x=j+1;\n }\n if(str[j][i]=='W'){\n y=j+1;\n if(f==0){\n g=9-y;\n }\n f++;\n }\n }\n if(x>y||x==0||y==0){\n if(x>=finalB){\n finalB=x;\n }\n if(g>=finalW){\n finalW=g;\n }\n }\n f=0;\n x=0;\n y=0;\n g=0;\n }\n if(finalW>=finalB){\n printf(\"A\");\n }\n else{\n printf(\"B\");\n }\n //printf(\"\\n%d %d\",finalB,finalW);\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{ char tabla[50][50];\n int beli[50][50];\n int crni[50][50];\n int a,b,c,d;\n int i;\n for(i=0;i<8;i++){\n gets(tabla[i]);\n }\n char *q=tabla[0];\n int beli_int=0;\n int beli_int1=0;\n int petlja_beli1=0;\n int petlja_beli;\n int brojac_belih=0;\n for(petlja_beli=0;petlja_beli<8;petlja_beli++){\n q=tabla[petlja_beli];\n for(beli_int=0;beli_int<8;beli_int++,q++){\n if(*q=='W'){\n beli[petlja_beli1++][beli_int1]=(petlja_beli+1)*10 + beli_int+1;\n brojac_belih++;\n }}\nbeli_int1=0;\n }\n\n\n\n int petlja_crni;\n int crni_int;\n int petlja_crni1=0;\n int crni_int1=0;\n int brojac_crnih=0;\n for(petlja_crni=0;petlja_crni<8;petlja_crni++){\n q=tabla[petlja_crni];\n for(crni_int=0;crni_int<8;crni_int++,q++){\n if(*q=='B'){\n crni[petlja_crni1++][crni_int1]=(petlja_crni+1)*10 + crni_int+1;\n brojac_crnih++;\n }\n }\ncrni_int1=0;\n }\nint test=0;\nfor(test=0;testcrni[test_GD][0]/10)\n {\n nije_valid=1;\n break;\n }\n}\nif(nije_valid == 1)\n continue;\nelse{\n dobri_beli[beli_increaser++][0]=broj_valid;\n nije_valid=0;\n}}\nfor(test=0;testdobri_beli[sort1][0]){\n najveci_beli=dobri_beli[sort1][0];\n }\n }\n}\n//printf(\"\\n\\n**NAJVECI BELI%d\",najveci_beli);\nint zadnji_korak_b;\nint zadnji_korak_c;\nzadnji_korak_b=najveci_beli/10;\nzadnji_korak_c=najveci_crni/10;\n//printf(\"\\n\\nBELI - %d\\nCRNI - %d\",abs(1-zadnji_korak_b),abs(8-zadnji_korak_c));\nif(abs(1-zadnji_korak_b)<=abs(8-zadnji_korak_c)){\nprintf(\"A\");\n}\nelse\n printf(\"B\");\n}\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include \nint main()\n{\n int x=0,y=0,i,j,g,f=0,k;\n char s,str[100][100];\n for(i=0;i<8;i++){\n //for(j=0;j<8;j++){\n scanf(\"%s\",str[i]);\n //}\n printf(\"\\n\");\n }\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n if(str[i][j]=='B'){\n /*if(i==0){\n printf(\"%d %d\\n\",i,j);\n }*/\n if(str[i+1][j]!='W')\n x=i+1;\n }\n if(str[i][j]=='W'){\n if(str[i-1][j]=='B'){\n //printf(\"YES\");\n continue;\n }\n else if(f==0){\n y=9-(i+1);\n f++;\n //printf(\"%d %d\\n\",i,j);\n }\n }\n }\n }\n if(x<=y){\n printf(\"A\");\n }\n else{\n printf(\"B\");\n }\n //printf(\"\\n\");\n //printf(\"%d %d\",x,y);\n return 0;\n}\n\n"}, {"source_code": "#include\nint main() {\n char board[8][8];\n int i,j;\n for(i=0;i<8;i++) {\n for(j=0;j<8;j++) {\n board[i][j]=getchar();\n }\n getchar();//read newline\n }\n int white_step=0;\n int find=0;\n int row=1;\n int move[8];\n for(i=0;i=0) {\n int col;\n for(col=0;col<8;col++) {\n if(board[row][col]=='W') move[col]=0;\n else if(board[row][col]=='B' && move[col]==1) {\n find=1;\n black_step=8-row;\n break;\n }\n }\n row--;\n }\n if(white_stepans)\n\t\t\t\t\tans=i+1;\n\t\t\t}\n\t\t\tif(s[j]=='W')\n\t\t\t{\n\t\t\t\tans2=i+1;\n\t\t\t\tif(i(8-ans))\n\t\tprintf(\"B\\n\");\n\telse\n\t\tprintf(\"A\\n\");\n\n\treturn 0;\n}"}, {"source_code": "#include \nint main(void)\n{\n int i, j, k, f,t, f2, count, count_2, min =8, min_2 =8;\n char chess[8][10];\n\n for(i=0; i<8; i++) scanf(\"%s\", chess[i]);\n\n for(j=0; j<8; j++){\n for(k=0; k<8; k++){\n if(chess[j][k] == 'W'){\n f = 1;\n for(t=0; t<8; t++){\n if(chess[t][k] == 'B'){\n f = 0;\n break;\n }\n }\n if(f){\n count = j;\n if(count\n#include \n\nint main()\n{\n char c[9][9],d[9][9];\n int i,j,k,a,b;\n for(i=1;i<=8;i++)\n for(j=1;j<=8;j++)\n {scanf(\"%c\",&c[i][j]);d[i][j]=c[i][j];}\n for(i=1;i<=8;i++)\n for(j=1;j<=8;j++)\n {\n if(c[i][j]=='z')continue;\n if(c[i][j]=='B'){for(k=i+1;k<=8;k++)c[k][j]='z';}\n if(c[i][j]=='W'){a=i-1;i=9;j=9;}\n }\n //printf(\"%d\",a);\n for(i=8;i>=1;i--)\n for(j=1;j<=8;j++)\n {\n if(d[i][j]=='z')continue;\n if(d[i][j]=='W'){for(k=i-1;k>=1;k--)d[k][j]='z';}\n if(d[i][j]=='B'){b=8-i;i=0;j=9;}\n }\n //printf(\"%d\",b);\n if(a\n\nint mat[9][9];\nchar row[9];\n\nint main()\n{\n int i,j,z;\n for( i = 1 ; i <= 8 ; ++i )\n {\n scanf(\"%s\",row);\n for( z = 0, j = 1 ; row[z] ; ++z, ++j )\n {\n if( row[z] == 'W' )\n mat[i][j] = 1;\n if( row[z] == 'B' )\n mat[i][j] = 2;\n if( row[z] == '.' )\n mat[i][j] = 0;\n }\n }\n\n int Wmin,Bmin;\n Wmin = Bmin = 8;\n for( j = 1 ; j <= 8 ; ++j )\n {\n if( mat[1][j] == 0 )\n for( z = 2 ; z <= 8 ; ++z )\n {\n if( mat[z][j] == 2 )\n break;\n if( mat[z][j] == 1 && Wmin > z-1 )\n Wmin = z-2;\n }\n\n }\n for( j = 1 ; j <= 8 ; ++j )\n {\n if( mat[8][j] == 0 )\n for( z = 7 ; z >= 1 ; --z )\n {\n if( mat[z][j] == 1 )\n break;\n if( mat[z][j] == 2 && Bmin > 8-z )\n Bmin = 8-z;\n }\n }\n\n Wmin < Bmin ? putchar('A') : putchar('B');\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main(){\n\n\tint i, j, Ak, Bk, k, As=0,Bs=0;\n\tchar table[8][8];\n\tint A[8][8], B[8][8];\n\tchar line[10];\n\t\n\tfor(i=0; i<8; i++){\n\t\tscanf(\"%s\", line);\n\t\tfor(j = 0; j<8; j++){\n\t\t\ttable[i][j] = line[j];\n\t\t}\n\t}\n\n\tfor(i=0; i<8; i++){\n\t\tfor(j=0; j<8; j++){\n\t\t\tA[i][j] = 0;\n\t\t\tB[i][j] = 0;\n\t\t}\n\t}\n\n\tfor(i=0; i<8; i++){\n\t\tfor(j=0; j<8; j++){\n\t\t\tif(table[j][i] == 'W'){\n\t\t\t\tA[j][i] = j;\n\t\t\t}\n\t\t\tif(table[j][i] == 'B'){\n\t\t\t\tB[j][i] = 7-j;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tfor(i=0; i<8; i++){\n\t\tAk = 0;\n\t\tBk = 0;\n\t\tfor(j=0; j<8; j++){\n\t\t\tif(A[j][i] != 0){\n\t\t\t\tAk++;\n\t\t\t}\n\t\t\tif(B[j][i] != 0){\n\t\t\t\tBk++;\n\t\t\t}\n\t\t}\n\n\t\tif( (Ak + Bk) > 7 ){\n\t\t\tfor(k=0; k<8; k++){\n\t\t\t\tA[k][i] != 0;\n\t\t\t\tB[k][i] != 0;\n\t\t\t}\n\t\t}\n\t}\n\n\tfor(i=0; i<8; i++){\n\t\tfor(j=0; j<8; j++){\n\t\t\tAs += A[i][j];\n\t\t\tBs += B[i][j];\n\t\t}\n\t}\n\n\tif(As >= Bs) printf(\"B\");\n\telse\t printf(\"A\");\n\n\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n char c[9][9],d[9][9];\n int i,j,k,a,b;\n for(i=1;i<=8;i++)\n for(j=1;j<=8;j++)\n {scanf(\"%c\",&c[i][j]);d[i][j]=c[i][j];}\n for(i=1;i<=8;i++)\n for(j=1;j<=8;j++)\n {\n if(c[i][j]=='z')continue;\n if(c[i][j]=='B'){for(k=i+1;k<=8;k++)c[k][j]='z';}\n if(c[i][j]=='W'){a=i-1;i=9;j=9;}\n }\n //printf(\"%d\",a);\n for(i=8;i>=1;i--)\n for(j=1;j<=8;j++)\n {\n if(d[i][j]=='z')continue;\n if(d[i][j]=='W'){for(k=i-1;k>=1;k--)d[k][j]='z';}\n if(d[i][j]=='B'){b=8-i;i=0;j=9;}\n }\n //printf(\"%d\",b);\n if(a<=b)printf(\"A\");else printf(\"B\");\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tchar board[8][8];\n\n\tint i, j, k;\n\tchar aux;\n\tfor (i=0; i<8; i++){\n\t\tfor (j=0; j<=8; j++){\n\t\t\tscanf(\"%c\", &aux);\n\t\t\tif (aux!=10) board[i][j]=aux;\n\t\t}\n\t}\n\n\tint minA=40, minB=40, clean;\n\tfor (i=0; i<8; i++){\n\t\tfor (j=0; j<8; j++){\n\t\t\tclean = 1;\n\t\t\tif (board[i][j]=='W'){\n\t\t\t\tfor (k=0; k\nint main ()\n{\n int amin,bmax,i,j,flag=1;\n char c[9][9];\n for(i=1; i<=8; i++)\n scanf(\"%s\",c[i]);\n for(j=1; j<=8; j++)\n {\n for(i=1; i<=8; i++)\n {\n if(c[i][j]=='B')\n break;\n else if(c[i][j]=='W')\n {\n if (flag==1)\n {\n amin=i;\n flag=0;\n }\n else if(i=1;i--)\n {\n if(c[i][j]=='W')\n break;\n else if(c[i][j]=='B')\n {\n if (flag==1)\n {\n bmax=i;\n flag=0;\n }\n else if(i>bmax)\n {\n bmax=i;\n }\n break;\n }\n }\n }\n bmax=8-bmax;\n if(amin<=bmax)\n printf(\"A\\n\");\n else\n printf(\"B\\n\");\n return 0;\n}\n"}, {"source_code": "/*A*/\n#include\n#include\nint main()\n{\n\tchar chess[9][9];\n\tint A,B;\n\tint i,j;\n\tint p;\n\tint flag;\n\t//while(1)\n\t//{\n\t\tfor(i=1;i<=8;i++)\n\t\t scanf(\"%s\",chess[i]);\n\t\tA=8;B=8;\n\t\tfor(i=1;i<=8;i++)\n\t\t{\n\t\t\tfor(j=0;j<8;j++)\n\t\t\t{\n\t\t\t if(chess[i][j]=='W')\n\t\t\t {\n\t\t\t \tflag=1;\n\t\t\t \tfor(p=i-1;p>=1;p--)\n\t\t\t \t{\n\t\t\t \t\tif(chess[p][j]!='.')\n\t\t\t \t\t{\n\t\t\t \t\t\tflag=0;\n\t\t\t \t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(flag==1&&i\n\nint main()\n{\n int i,j,k;\n char ara[9][9];\n for(i=1;i<=8;i++)\n {\n for(j=1;j<=8;j++)\n {\n scanf(\"%c\",&ara[i][j]);\n }\n getchar();\n }\n\n\n int maxb=1,minw=8,countw,countb;\n for(i=1;i<=8;i++)\n {\n for(j=1;j<=8;j++)\n {\n if(ara[j][i]=='B')\n {\n countb=1;\n for(k=j+1;k<=8;k++)\n {\n if(ara[k][i]=='W'||ara[k][i]=='B')\n {\n countb=0;\n break;\n }\n\n }\n if(countb==1&&j>maxb)\n maxb=j;\n }\n else if(ara[j][i]=='W')\n {\n countw=1;\n for(k=j-1;k>=1;k--)\n {\n if(ara[k][i]=='W'||ara[k][i]=='B')\n {\n countw=0;\n break;\n }\n\n }\n if(countw==1&&j\n\nint main(void){\n\n char arr[10][10];\n int ww[70]={0}, bb[70]={0};\n\n int i, j, n=0, m=0;\n for(i=1; i<=8; i++){\n for(j=1; j<=8;j++){\n scanf(\"%c\", &arr[i][j]);\n if(arr[i][j]=='W'){\n ww[n++]=i*10+j;\n }\n else if(arr[i][j]=='B'){\n bb[m++]=i*10+j;\n }\n }\n getchar();\n }\n\n int check=1, answ, ansb;\n for(n=0; check; n++){\n //printf(\"%d\\n\", ww[n]);\n check=0;\n for(i=1; ibb[m]/10; i--){\n if(arr[i][bb[m]%10]=='W'){\n check=1;\n }\n }\n }\n ansb = 8-bb[m-1]/10;\n //printf(\"ansb:%d\\n\", ansb);\n\n if(answ>ansb){\n printf(\"B\\n\");\n }\n else{\n printf(\"A\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n\nmain()\n{\n int a[8],b[8],r,c,i,j=0,ra,rb;\n char ch[8][8];\n for(r=0;r<8;r++)\n {\n scanf(\"%s\",ch[r]);\n }\n for(r=0;r<8;r++)\n {\n for(c=0;c<8;c++)\n {\n if(ch[r][c]=='B')\n {\n ra=8-r;\n for(i=r+1;i<8;i++)\n {\n if(ch[i][c]!='.')\n j=1;\n }\n }\n if(j==1)\n break;\n }\n if(j==1)\n break;\n }\n for(r=0;r<8;r++)\n {\n for(c=0;c<8;c++)\n {\n if(ch[r][c]=='W')\n {\n rb=r;\n for(i=r-1;i>=0;i--)\n {\n if(ch[i][c]!='.')\n j=1;\n }\n }\n if(j==1)\n break;\n }\n if(j==1)\n break;\n }\n if(ra>rb)\n printf(\"A\");\n else\n printf(\"B\");\n return 0;\n}\n"}, {"source_code": "#include\n\nmain()\n{\n int a[8],b[8],r,c,i,j=0,ra,rb,k=0;\n char ch[8][8];\n for(r=0;r<8;r++)\n {\n scanf(\"%s\",ch[r]);\n }\n for(r=0;r<8;r++)\n {\n for(c=0;c<8;c++)\n {\n if(ch[r][c]=='B')\n {\n ra=7-r;\n for(i=r+1;i<8;i++)\n {\n if(ch[i][c]!='.')\n j=1;\n }\n }\n if(j!=1&&ch[r][c]=='B'&&r==8)\n {\n j=0,k=1;\n break;\n }\n if(j==1)\n j=0;\n }\n if(k==1)\n {\n break;\n }\n }\n for(r=0;r<8;r++)\n {\n for(c=0;c<8;c++)\n {\n if(ch[r][c]=='W')\n {\n rb=r;\n for(i=r-1;i>=0;i--)\n {\n if(ch[i][c]!='.')\n j=2;\n }\n }\n if(j!=2&&ch[r][c]=='W'&&r==0)\n {\n k=2;\n break;\n }\n if(j==2)\n j=1;\n }\n if(k==2)\n {\n break;\n }\n }\n if(ra>=rb)\n printf(\"A\");\n else\n printf(\"B\");\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int x=0,y=0,i,p=0,j,g=0,f=0,h=0,k=0,finalB=0,finalW=0;\n char str[100][100];\n for(i=0;i<8;i++){\n scanf(\"%s\",str[i]);\n }\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n if(str[j][i]=='B'){\n x=j+1;\n if(p==0){\n h=x;\n }\n p++;\n }\n if(str[j][i]=='W'){\n y=j+1;\n if(f==0){\n g=9-y;\n }\n f++;\n }\n }\n //printf(\"%d %d %d\\n\",x,y,g);\n if(x>y||x==0||y==0){\n if(x>=finalB){\n finalB=x;\n }\n if(h==0){\n if(g>=finalW){\n finalW=g;\n }\n }\n if(h!=0){\n if(g>=finalW&&g<9-h){\n finalW=g;\n }\n }\n }\n else if(x(9-x)&&g>=finalW){\n finalW=g;\n }\n }\n p=0;\n f=0;\n x=0;\n y=0;\n g=0;\n h=0;\n }\n if(finalW>=finalB){\n printf(\"A\");\n }\n else{\n printf(\"B\");\n }\n //printf(\"\\n%d %d\",finalB,finalW);\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int x=0,y=0,i,j,g,f=0,k=0,finalB,finalW;\n char s,str[100][100];\n for(i=0;i<8;i++){\n scanf(\"%s\",str[i]);\n }\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n if(str[j][i]=='B'){\n x=j+1;\n }\n if(str[j][i]=='W'){\n y=j+1;\n if(f==0){\n g=y;\n }\n f++;\n }\n }\n if(x>y){\n if(x>=finalB){\n finalB=x;\n }\n if((9-g)>=finalW){\n finalW=g;\n }\n }\n f=0;\n }\n if(finalW>=finalB){\n printf(\"A\");\n }\n else{\n printf(\"B\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main(void) {\n int h;\n int i;\n int j;\n int k;\n int ultB = 0;\n int ultBant;\n int ultW = 0;\n int ultWant;\n char tabuleiro[8][8];\n for(h = 0; h < 8; h++)\n {\n scanf(\"%s\", &tabuleiro[h]);\n }\n for(i = 0; i < 8; i++)\n {\n for(j = 0; j < 8; j++)\n {\n if(tabuleiro[i][j] == 'B')\n {\n ultBant = ultB;\n ultB = i;\n for(k = i+1; k < 8; k++)\n {\n if(tabuleiro[k][j] == 'W')\n {\n ultB = ultBant;\n }\n } \n }\n }\n \n }\n for(i = 7; i >-1; i--){\n for(j = 0; j < 8; j++)\n {\n if(tabuleiro[i][j] == 'W')\n {\n ultWant = ultW;\n ultW = i;\n for(k = i-1; k > -1; k--)\n {\n if(tabuleiro[k][j] == 'B')\n {\n ultW = ultWant;\n }\n } \n }\n }\n }\n if((7 - ultB) > ultW){\n printf(\"A\");\n }\n else{\n printf(\"B\");\n }\n return 0;\n}"}, {"source_code": "#include\nint main(void)\n{\n int i=0,j=0,k,z=1;\n int ca,cb;\n char ar[8][9];\n while(i<8)\n {\n scanf(\"%s\",ar[i]);\n i++;\n }\n for(i=1;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n if(ar[i][j]=='W')\n {\n for(k=i;k>=0;k--)\n {\n if(ar[k][j]=='B')break;\n }\n if(ar[0][j]!='B'&&k<0)\n {\n ca=i;\n z=0;\n break;\n }\n }\n }\n if(z==0)break;\n }\n z=1;\n for(i=6;i>=0;i--)\n {\n for(j=0;j<8;j++)\n if(ar[i][j]=='B')\n {\n for(k=i;k<8;k++)\n {\n if(ar[k][j]=='W')break;\n }\n if(ar[7][j]!='W'&&k>=8)\n {\n cb=7-i;\n z=0;\n break;\n }\n }\n if(z==0)break;\n }\n if(ca\n#include\n\n\n\nint main(){\n\n\n char Chess[8][8];\n int i,j,k ;\n int dist_A=0;\n int dist_B=0;\n int B_exist=0;\n int A_exist=0;\n\n\n for(i=0;i<8;i++)scanf(\"%s\",Chess[i]);\n \n i=1;\n while(i<8 && dist_A==0){\n for(j=0;j<8&&dist_A==0;j++){\n \n if(Chess[i][j]=='W'){\n for(k=0;k0 && dist_B==0){\n for(j=0;j<8;j++){\n if(Chess[i][j]=='B'){\n for(k=7;k>i;k--){if(Chess[k][j]=='W'){A_exist=1;break;}}\n if(A_exist==0){dist_B=7-i;break;} \n }\n } \n A_exist=0;\n i=i-1; \n }\n \n //printf(\"%d\\n\",dist_B);\n if(dist_B==0)printf(\"A\");\n else{\n if(dist_A==0)printf(\"B\");\n else{\n if(dist_B>=dist_A)printf(\"A\");\n else\n printf(\"B\");\n } \n }\n\n\n\nreturn 0 ;\n}\n\n"}, {"source_code": "#include\n\nmain()\n{\n int a[20],b[20],r,c,i,j=0,ra,rb,k=0,l=0,d=0,ca,cb,A[8],B[8],wa=0,wb=0;\n char ch[8][8];\n for(r=0;r<8;r++)\n {\n scanf(\"%s\",&ch[r]);\n }\n for(r=7;r>=0;r--)\n {\n for(c=7;c>=0;c--)\n {\n if(ch[r][c]=='B')\n b[j++]=c,B[wb++]=r;\n }\n }\n for(r=0;r<8;r++)\n {\n for(c=0;c<8;c++)\n {\n if(ch[r][c]=='W')\n a[k++]=c,A[wa++]=r;\n }\n }\n for(i=0;ians)\n ans=i;\n }\n }\n if(s[i][j]=='W')\n {\n fg=1;\n for(k=i-1;k>=0;k--){\n if(s[k][j]!='.'){\n fg=0;\n break;\n }\n }\n if(fg){\n ansa=i;\n if(i(8-ans))\n printf(\"B\\n\");\n else\n printf(\"A\\n\");\n\n return 0;\n}"}, {"source_code": "#include\n#include\n#include\nint main(){\n int k,c,l,mb=8,mw=8;\n volatile char lec[9];\n volatile char T[8][8];\n for(k=0;k<8;k++){\n scanf(\"%s\",lec);\n for(c=0;c<8;c++){\n T[k][c]=lec[c];\n }\n }\n for(k=0;k<8;k++){\n for(c=0;c<8;c++){\n printf(\"%c\",T[k][c]);\n }\n printf(\"\\n\");\n }\n for(k=0;k<8 && mw && mb;k++){\n l=1;\n for(c=0;c<8 && l;c++){\n if(T[k][c]!='.'){\n l=0;\n if(T[k][c]=='W' && c=0 && l;c--){\n if(T[k][c]!='.'){\n l=0;\n if(T[k][c]=='B' && 7-c\n\nint main()\n{\n int i, j, A, B;\n char Map[8][9];\n for(i = 0; i < 8; ++i) {\n scanf(\"%s\", Map[i]);\n }\n A = 8;\n B = 8;\n for(i = 0; i < 8; ++i) {\n j = 0;\n while(Map[j][i] == '.' && j < 8) {\n ++j;\n }\n if(j < 8) {\n if(Map[j][i] == 'W') {\n if(j < A) {\n A = j;\n }\n }\n }\n j = 7;\n while(Map[j][i] == '.' && j >= 0) {\n --j;\n }\n if(j >= 0) {\n if(Map[j][i] == 'B') {\n if(7 - j < B) {\n B = 7 - j;\n }\n }\n }\n }\n puts(A <= B ? \"W\" : \"B\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int i,p1,p2,j,k,l;\n char a[9][9];\n for(i=1;i<=8;i++)\n {\n scanf(\"%s\",a[i]);\n }\n int p2flag=0;\n for(i=1;i<=8;i++)\n {\n for(j=0;j<8;j++)\n {\n if(a[i][j]=='B')\n {\n int flag=0;\n for(k=i+1;k<=8;k++)\n {\n if(a[k][j]=='W')\n flag=1;\n }\n if(flag==0)\n p1=8-i;\n }\n if(a[i][j]=='W')\n {\n int flag1=0;\n for(k=1;k=p2)\n printf(\"A\\n\");\n else\n printf(\"B\\n\");\n return 0;\n}\n\n\n"}, {"source_code": "#include \n#include \n\nint main(){\n\n\tint i, j, k, As=0,Bs=0;\n\tchar table[8][8];\n\tint A[8][8], B[8][8];\n\tchar line[10];\n\t\n\tfor(i=0; i<8; i++){\n\t\tscanf(\"%s\", line);\n\t\tfor(j = 0; j<8; j++){\n\t\t\ttable[i][j] = line[j];\n\t\t}\n\t}\n\n\tfor(i=0; i<8; i++){\n\t\tfor(j=0; j<8; j++){\n\t\t\tA[i][j] = 0;\n\t\t\tB[i][j] = 0;\n\t\t}\n\t}\n\n\tfor(i=0; i<8; i++){\n\t\tfor(j=0; j<8; j++){\n\t\t\tif(table[j][i] == 'W'){\n\t\t\t\tA[j][i] = j;\n\t\t\t}\n\t\t\tif(table[j][i] == 'B'){\n\t\t\t\tB[j][i] = 7-j;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tfor(i=0; i<8; i++){\n\t\tk = 0;\n\t\tfor(j=0; j<8; j++){\n\t\t\tif(A[j][i] != 0){\n\t\t\t\tk++;\n\t\t\t}\n\t\t\tif(B[j][i] != 0){\n\t\t\t\tk++;\n\t\t\t}\n\t\t\tif(k >= 2){\n\t\t\t\tfor(k=0; k<8; k++){\n\t\t\t\t\tA[k][i] = 0;\n\t\t\t\t\tB[k][i] = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\n\t}\n\n\tfor(i=0; i<8; i++){\n\t\tfor(j=0; j<8; j++){\n\t\t\tAs += A[i][j];\n\t\t\tBs += B[i][j];\n\t\t}\n\t}\n\n\tif(As >= Bs) printf(\"B\");\n\telse\t printf(\"A\");\n\n\n\treturn 0;\n}\n"}, {"source_code": "/*A*/\n#include\n#include\nint main()\n{\n\tchar chess[9][9];\n\tint A,B;\n\tint i,j;\n\tint p;\n\tint flag;\n\t//while(1)\n\t//{\n\t\tfor(i=1;i<=8;i++)\n\t\t scanf(\"%s\",chess[i]);\n\t\tA=8;B=8;\n\t\tfor(i=1;i<=8;i++)\n\t\t{\n\t\t\tfor(j=0;j<8;j++)\n\t\t\t{\n\t\t\t if(chess[i][j]=='W')\n\t\t\t {\n\t\t\t \tflag=1;\n\t\t\t \tfor(p=i-1;p>=1;p--)\n\t\t\t \t{\n\t\t\t \t\tif(chess[p][j]!='.')\n\t\t\t \t\t{\n\t\t\t \t\t\tflag=0;\n\t\t\t \t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(flag==1&&i\nint main() {\n char board[8][8];\n int i,j;\n for(i=0;i<8;i++) {\n for(j=0;j<8;j++) {\n board[i][j]=getchar();\n }\n getchar();//read newline\n }\n int white_step=0;\n int find=0;\n int row=1;\n int move[8];\n for(i=0;i=0) {\n int col;\n for(col=0;col<8;col++) {\n if(board[row][col]=='W') move[col]=0;\n else if(board[row][col]=='B' && move[col]==1) {\n find=1;\n black_step=8-row;\n break;\n }\n }\n row--;\n }\n if(white_step>black_step) {\n printf(\"A\\n\");\n } else {\n printf(\"B\\n\");\n }\n return 0;\n}\n "}, {"source_code": "#include\n\nint main()\n{\n char str[9][9], my[8];\n int i, j, minB, minA, positB, positA, no1, no2, ans1, ans2;\n\n for(i=1; i<=8; i++)\n {\n gets(my);\n for(j=1; j<=8; j++)\n {\n str[i][j] = my[j-1];\n }\n }\n\n\n minB=7;\n minA=7;\n for(i=1; i<=8; i++)\n {\n no1 = 0;\n no2 = 0;\n positB=1;\n positA=8;\n for(j=1; j<=8; j++)\n {\n if(str[j][i] == 'B')\n {\n no1++;\n positB=j;\n }\n if(str[j][i] == 'W')\n {\n no2++;\n if(j0 && no2==0)\n {\n ans1 = 8 - positB;\n if(minB>ans1)\n minB = ans1;\n }\n else if(no1==0 && no2>0)\n {\n ans2 = positA - 1;\n if(minA>ans2)\n minA = ans2;\n }\n }\n if(minA <= minB)\n printf(\"A\");\n else\n printf(\"B\");\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n char board[8][9];\n int countr, countc;\n int W = 8, B = 8, WBuff = 0, BBuff = 0;\n for(countr = 0; countr < 8; countr++)\n {\n for(countc = 0; countc < 9; countc++)\n {\n scanf(\"%c\", &board[countr][countc]);\n }\n }\n for(countc = 0; countc < 8; countc++)\n {\n for(countr = 0; countr < 8; countr++)\n {\n if(board[countr][countc] == 'W')\n {\n if(W>countr)\n WBuff = countr;\n }\n if(board[countr][countc] == 'B')\n {\n if(B>(7-countr))\n BBuff = 7 - countr;\n }\n }\n if((BBuff+WBuff)<8)\n {\n if(WBuff>0)\n W = WBuff;\n if(BBuff>0)\n B = BBuff;\n }\n WBuff = 0;\n BBuff = 0;\n }\n if(B\n\nint main()\n{\n int i,j,k;\n char ara[9][9];\n for(i=1;i<=8;i++)\n {\n for(j=1;j<=8;j++)\n {\n scanf(\"%c\",&ara[i][j]);\n }\n getchar();\n }\n\n\n int maxb=1,minw=8,countw,countb;\n for(i=1;i<=8;i++)\n {\n for(j=1;j<=8;j++)\n {\n if(ara[j][i]=='B')\n {\n countb=1;\n for(k=j+1;k<=8;k++)\n {\n if(ara[k][i]=='W'||ara[k][i]=='B')\n {\n countb=0;\n break;\n }\n\n }\n if(countb==1&&j>maxb)\n maxb=j;\n }\n else if(ara[j][i]=='W')\n {\n countw=1;\n for(k=j-1;k>=1;k--)\n {\n if(ara[k][i]=='W'||ara[k][i]=='B')\n {\n countw=0;\n break;\n }\n\n }\n if(countw==1&&j\nint main(void)\n{\n int i=0,j=0,k,z=1;\n int ca,cb;\n char ar[8][9];\n while(i<8)\n {\n scanf(\"%s\",ar[i]);\n i++;\n }\n for(i=1;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n if(ar[i][j]=='W')\n {\n for(k=i;k>=0;k--)\n {\n if(ar[k][j]=='B')break;\n }\n if(ar[0][j]!='B'&&k<0)\n {\n ca=i;\n z=0;\n break;\n }\n }\n }\n if(z==0)break;\n }\n z=1;\n for(i=6;i>=0;i--)\n {\n for(j=0;j<8;j++)\n if(ar[i][j]=='B')\n {\n for(k=i;k<8;k++)\n {\n if(ar[k][j]=='W')break;\n }\n if(ar[7][j]!='W'&&k>=8)\n {\n cb=7-i;\n z=0;\n break;\n }\n }\n if(z==0)break;\n }\n if(ca\n\nmain()\n{\n int a[20],b[20],r,c,i,j=0,ra,rb,k=0,l=0,d=0,ca,cb,A[8],B[8],wa=0,wb=0;\n char ch[8][8];\n for(r=0;r<8;r++)\n {\n scanf(\"%s\",&ch[r]);\n }\n for(r=7;r>=0;r--)\n {\n for(c=7;c>=0;c--)\n {\n if(ch[r][c]=='B')\n b[j++]=c,B[wb++]=r;\n }\n }\n for(r=0;r<8;r++)\n {\n for(c=0;c<8;c++)\n {\n if(ch[r][c]=='W')\n a[k++]=c,A[wa++]=r;\n }\n }\n for(i=0;i\nint main()\n{\n int x=0,y=0,i,j,g,f=0,k;\n char s,str[100][100];\n for(i=0;i<8;i++){\n //for(j=0;j<8;j++){\n scanf(\"%s\",str[i]);\n //}\n //printf(\"\\n\");\n }\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n if(str[i][j]=='B'){\n /*if(i==0){\n printf(\"%d %d\\n\",i,j);\n }*/\n if(str[i+1][j]!='W'||str[i+1][j]!='B')\n x=i+1;\n }\n if(str[i][j]=='W'){\n if(str[i-1][j]=='B'||str[i-1][j]=='W'){\n //printf(\"YES\");\n continue;\n }\n else if(f==0){\n y=9-(i+1);\n f++;\n //printf(\"%d %d\\n\",i,j);\n }\n }\n }\n }\n if(x<=y){\n printf(\"A\");\n }\n else{\n printf(\"B\");\n }\n //printf(\"\\n\");\n //printf(\"%d %d\",x,y);\n return 0;\n}\n\n"}, {"source_code": "#include\nint main(){\n char a[8][8];\n int i,j,k,posw,posb;\n for(i=0;i<8;++i){\n for(j=0;j<8;++j){\n scanf(\"%c\",&a[i][j]);\n }\n }\nfor(k=0;k<8;++k){\n for(i=0;i<8;++i){\n for(j=0;j<8;++j){\n if(a[i][j]=='w'||a[i][j]=='W'){\n if(a[i-1][j]=='.'){\n a[i][j]=='.';\n a[i-1][j]=='W';\n posw=(i-1);\n }\n }\n if(a[i][j]=='b'||a[i][j]=='B'){\n if(a[i+1][j]=='.'){\n a[i][j]=='.';\n a[i+1][j]=='B';\n posb=(i+1);\n }\n }\n if(posw==0){\n printf(\"\\nA\");\n exit(0);\n }\n else if(posb==7){\n printf(\"\\nB\");\n exit(0);\n }\n }\n } \n }\nreturn 0;\n}"}, {"source_code": "#include \nint main()\n{\n int x=0,y=0,i,p=0,j,g=0,f=0,h=0,k=0,finalB=0,finalW=0;\n char str[100][100];\n for(i=0;i<8;i++){\n scanf(\"%s\",str[i]);\n }\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n if(str[j][i]=='B'){\n x=j+1;\n if(p==0){\n h=x;\n }\n p++;\n }\n if(str[j][i]=='W'){\n y=j+1;\n if(f==0){\n g=9-y;\n }\n f++;\n }\n }\n //printf(\"%d %d %d\\n\",x,y,g);\n if(x>y||x==0||y==0){\n if(x>=finalB){\n finalB=x;\n }\n if(h==0){\n if(g>=finalW){\n finalW=g;\n }\n }\n if(h!=0){\n if(g>=finalW&&g<9-h){\n finalW=g;\n }\n }\n }\n else if(x(9-x)&&g>=finalW){\n finalW=g;\n }\n }\n p=0;\n f=0;\n x=0;\n y=0;\n g=0;\n h=0;\n }\n if(finalW>=finalB){\n printf(\"A\");\n }\n else{\n printf(\"B\");\n }\n //printf(\"\\n%d %d\",finalB,finalW);\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int x=0,y=0,i,j,g=0,f=0,h=0,k=0,finalB=0,finalW=0;\n char str[100][100];\n for(i=0;i<8;i++){\n scanf(\"%s\",str[i]);\n }\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n if(str[j][i]=='B'){\n x=j+1;\n if(f==0){\n h=x;\n }\n f++;\n }\n if(str[j][i]=='W'){\n y=j+1;\n if(f==0){\n g=9-y;\n }\n f++;\n }\n }\n // printf(\"%d %d %d\\n\",x,y,g);\n if(x>y||x==0||y==0){\n if(x>=finalB){\n finalB=x;\n }\n if(h==0){\n if(g>=finalW){\n finalW=g;\n }\n }\n if(h!=0){\n if(g>=finalW&&yx&&g>=finalW){\n finalW=g;\n }\n }\n f=0;\n x=0;\n y=0;\n g=0;\n h=0;\n }\n if(finalW>=finalB){\n printf(\"A\");\n }\n else{\n printf(\"B\");\n }\n //printf(\"\\n%d %d\",finalB,finalW);\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\n\n\nint main(){\n\n\n char Chess[8][8];\n int i,j ;\n int dist_A=0;\n int dist_B=0;\n\n\n for(i=0;i<8;i++)scanf(\"%s\",Chess[i]);\n \n i=1;\n while(i<8 && dist_A==0){\n for(j=0;j<8;j++){\n if(Chess[i][j]=='W'&&Chess[i-1][j]!='B'){dist_A=i;break;}\n }\n i=i+1; \n }\n \n i=6;\n while(i>0 && dist_B==0){\n for(j=0;j<8;j++){\n if(Chess[i][j]=='B'&&Chess[i-1][j]!='W'){dist_B=7-i;break;} \n }\n i=i-1; \n }\n \n if(dist_B>=dist_A)printf(\"A\");\n else\n printf(\"B\");\n\n\n\n\nreturn 0 ;\n}\n\n"}, {"source_code": "#include\n#include\n\n\n\nint main(){\n\n\n char Chess[8][8];\n int i,j,k ;\n int dist_A=0;\n int dist_B=0;\n int B_exist=0;\n int A_exist=0;\n\n\n for(i=0;i<8;i++)scanf(\"%s\",Chess[i]);\n \n i=1;\n while(i<8 && dist_A==0){\n for(j=0;j<8&&dist_A==0;j++){\n \n if(Chess[i][j]=='W'){\n for(k=0;k0 && dist_B==0){\n for(j=0;j<8;j++){\n if(Chess[i][j]=='B'){\n for(k=7;k>i;k--){if(Chess[k][j]=='W'){A_exist=1;break;}}\n if(A_exist==0){dist_B=8-i;break;} \n }\n } \n A_exist=0;\n i=i-1; \n }\n \n //printf(\"%d\\n\",dist_B);\n if(dist_B==0)printf(\"A\");\n else{\n if(dist_A==0)printf(\"B\");\n else{\n if(dist_B>=dist_A)printf(\"A\");\n else\n printf(\"B\");\n } \n }\n\n\n\nreturn 0 ;\n}\n\n"}, {"source_code": "#include\n\nmain()\n{\n int a[8],b[8],r,c,i,j=0,ra,rb,k=0;\n char ch[8][8];\n for(r=0;r<8;r++)\n {\n scanf(\"%s\",ch[r]);\n }\n for(r=0;r<8;r++)\n {\n for(c=0;c<8;c++)\n {\n if(ch[r][c]=='B')\n {\n ra=7-r;\n for(i=r+1;i<8;i++)\n {\n if(ch[i][c]!='.')\n j=1;\n }\n }\n if(j!=1&&ch[r][c]=='B')\n {\n j=0,k=1;\n break;\n }\n else\n j=0;\n }\n if(k==1)\n {\n break;\n }\n }\n for(r=0;r<8;r++)\n {\n for(c=0;c<8;c++)\n {\n if(ch[r][c]=='W')\n {\n rb=r;\n for(i=r-1;i>=0;i--)\n {\n if(ch[i][c]!='.')\n j=2;\n }\n }\n if(j!=2&&ch[r][c]=='W')\n {\n k=2;\n break;\n }\n else\n j=1;\n }\n if(k==2)\n {\n break;\n }\n }\n if(ra>=rb)\n printf(\"A\");\n else\n printf(\"B\");\n return 0;\n}\n"}, {"source_code": "//http://codeforces.com/contest/592/problem/A\n\n#include\n#include\n\nint main(void){\n int i,j,trash;\n int bmin=10,wmin=10;\n int bm=0,wm=0;\n char a[8][8]={0};\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n scanf(\"%c\",&a[i][j]);\n }\n scanf(\"%c\",&trash);\n }\n\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n printf(\"%c \",a[i][j]);\n }\n printf(\"\\n\");\n }\n\n for(j=0;j<8;j++){\n bm=0;\n wm=0;\n for(i=0;i<8;i++){\n if(a[i][j]=='.'){\n wm++;\n }\n else if(a[i][j]=='b'){\n wm=0;\n break;\n }\n else break;\n }\n for(i=7;i>=0;i--){\n if(a[i][j]=='.'){\n bm++;\n }\n else if(a[i][j]=='w'){\n bm=0;\n break;\n }\n else break;\n }\n if(bm\n#include \n\nint main()\n{\n char board[8][8], x[10];\n int i, j, k, black = 10, white = 10;\n for (i = 0; i < 8; i++){\n scanf(\"%s\", &x);\n for (j = 0; j < 8; j++) board[i][j] = x[j];\n }\n for (i = 0; i < 8; i++){\n for (j = 0; j < 8; j++){\n if (board[i][j] == 'B'){\n for (k = i+1; k < 8; k++) if (board[k][j] != '.') break;\n if ((k == 8) && ((7 - i) < black)) black = (7-i);\n }else if (board[i][j] == 'W'){\n for (k = i-1; k >= 0; k--) if (board[k][j] != '.') break;\n if ((k == -1) && (i < white)) white = i;\n }\n }\n }\n printf((white < black)?\"A\\n\":\"B\\n\");\n return 0;\n}\n"}, {"source_code": "/*A*/\n#include\n#include\nint main()\n{\n\tchar chess[9][9];\n\tint A,B;\n\tint i,j;\n\tint p;\n\tint flag;\n\t//while(1)\n\t//{\n\t\tfor(i=1;i<=8;i++)\n\t\t scanf(\"%s\",chess[i]);\n\t\tA=8;B=8;\n\t\tfor(i=1;i<=8;i++)\n\t\t{\n\t\t\tfor(j=0;j<8;j++)\n\t\t\t{\n\t\t\t if(chess[i][j]=='W')\n\t\t\t {\n\t\t\t \tflag=1;\n\t\t\t \tfor(p=i-1;p>=1;p--)\n\t\t\t \t{\n\t\t\t \t\tif(chess[p][j]!='.')\n\t\t\t \t\t{\n\t\t\t \t\t\tflag=0;\n\t\t\t \t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(flag==1&&i\n#include\n\n\n\nint main(){\n\n\n char Chess[8][8];\n int i,j,k ;\n int dist_A=0;\n int dist_B=0;\n int B_exist=0;\n int A_exist=0;\n\n\n for(i=0;i<8;i++)scanf(\"%s\",Chess[i]);\n \n i=1;\n while(i<8 && dist_A==0){\n for(j=0;j<8;j++){\n if(Chess[i][j]=='W'){\n for(k=0;k0 && dist_B==0){\n for(j=0;j<8;j++){\n if(Chess[i][j]=='B'){\n for(k=7;k>i;k--){if(Chess[k][j]=='W'){A_exist=1;break;}}\n if(A_exist==0){dist_B=7-i;break;} \n }\n } \n A_exist=0;\n i=i-1; \n }\n\n if(dist_B>=dist_A)printf(\"A\");\n else\n printf(\"B\");\n\n\n\n\nreturn 0 ;\n}\n"}, {"source_code": "#include \nint main(void)\n{\n int i, j, k, f,t, f2, count, count_2, min =8, min_2 =8;\n char chess[8][10];\n\n for(i=0; i<8; i++) scanf(\"%s\", chess[i]);\n\n for(j=0; j<8; j++){\n for(k=0; k<8; k++){\n if(chess[j][k] == 'W'){\n f = 1;\n for(t=k; t>=0; t--){\n if(chess[t][k] == 'B'){\n f = 0;\n break;\n }\n }\n if(f){\n count = j;\n if(count\n#include \n\nint main(){\n\n\tint i, j, Ak, Bk, k,q , As=0,Bs=0;\n\tchar table[8][8];\n\tint A[8][8], B[8][8];\n\tchar line[10];\n\tint Ai[8], Bi[8];\n\tint exit = 0;\n\t\n\tfor(i=0; i<8; i++){\n\t\tscanf(\"%s\", line);\n\t\tfor(j = 0; j<8; j++){\n\t\t\ttable[i][j] = line[j];\n\t\t}\n\t}\n\n\tfor(i=0; i<8; i++){\n\t\tfor(j=0; j<8; j++){\n\t\t\tA[i][j] = 0;\n\t\t\tB[i][j] = 0;\n\t\t}\n\t}\n\n\tfor(i=0; i<8; i++){\n\t\tfor(j=0; j<8; j++){\n\t\t\tif(table[j][i] == 'W'){\n\t\t\t\tA[j][i] = j;\n\t\t\t}\n\t\t\tif(table[j][i] == 'B'){\n\t\t\t\tB[j][i] = 7-j;\n\t\t\t}\n\t\t}\n\t}\n\n\tfor(i=0; i<8; i++){\n\t\tfor(j=0; j<8; j++){\n\t\t\tif(table[j][i] == 'W'){\n\t\t\t\tq = 0;\n\t\t\t\tfor(k = j-1 ; k>=0; k--){\n\t\t\t\t\tif(table[k][i] == 'B'){\n\t\t\t\t\t\tq++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(q == 0){\n\t\t\t\t\tAs += A[j][i];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfor(i=0; i<8; i++){\n\t\tfor(j=7; j >= 0; j--){\n\t\t\tif(table[j][i] == 'B'){\n\t\t\t\tq = 0;\n\t\t\t\tfor(k = j+1 ; k < 8; k++){\n\t\t\t\t\tif(table[k][i] == 'W'){\n\t\t\t\t\t\tq++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(q == 0){\n\t\t\t\t\tBs += B[j][i];\n\t\t\t\t\tbreak;//\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\n\tif(As >= Bs) printf(\"B\");\n\telse\t printf(\"A\");\n\n\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n char a[8][8];\n int i,j,wd=8,bd=8;\n for(i=0;i<8;i++)\n {\n scanf(\"%s\",a[i]);\n }\n for(j=0;j<8;j++)\n {\n for(i=0;i<8;i++)\n {\n if(a[i][j]=='B')\n {\n break;\n }\n else if(a[i][j]=='W')\n {\n if(i+1=0;i--)\n {\n if(a[i][j]=='W')\n {\n break;\n }\n else if(a[i][j]=='B')\n {\n if(8-i\n\nint main()\n{\n char str[9][9], my[8];\n int i, j, minB, minA, positB, positA, no1, no2, ans1, ans2,posita, positb;\n\n for(i=1; i<=8; i++)\n {\n gets(my);\n for(j=1; j<=8; j++)\n {\n str[i][j] = my[j-1];\n }\n }\n\n minB=7;\n minA=7;\n for(i=1; i<=8; i++)\n {\n no1 = 0;\n no2 = 0;\n positB=1;\n positb = 8;\n positA=8;\n posita = 1;\n for(j=1; j<=8; j++)\n {\n if(str[j][i] == 'B')\n {\n no1++;\n if(j0 && no2==0)\n {\n ans1 = 8 - positB;\n if(minB>ans1)\n minB = ans1;\n }\n else if(no1==0 && no2>0)\n {\n ans2 = positA - 1;\n if(minA>ans2)\n minA = ans2;\n }\n\n else if(no1>0 && no2>0)\n {\n if(positaans1)\n minB = ans1;\n }\n else if(positb>positA)\n {\n ans2 = positA -1;\n if(minA>ans2)\n minA = ans2;\n }\n }\n }\n if(minA <= minB)\n printf(\"A\");\n else\n printf(\"B\");\n\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int x=0,y=0,i,p=0,j,g=0,f=0,h=0,k=0,finalB=0,finalW=0;\n char str[100][100];\n for(i=0;i<8;i++){\n scanf(\"%s\",str[i]);\n }\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n if(str[j][i]=='B'){\n x=j+1;\n if(p==0){\n h=x;\n }\n p++;\n }\n if(str[j][i]=='W'){\n y=j+1;\n if(f==0){\n g=9-y;\n }\n f++;\n }\n }\n //printf(\"%d %d %d\\n\",x,y,g);\n if(x>y||x==0||y==0){\n if(x>=finalB){\n finalB=x;\n }\n if(h==0){\n if(g>=finalW){\n finalW=g;\n }\n }\n if(h!=0){\n if(g>=finalW&&g<9-h){\n finalW=g;\n }\n }\n }\n else if(x(9-x)&&g>=finalW){\n finalW=g;\n }\n }\n p=0;\n f=0;\n x=0;\n y=0;\n g=0;\n h=0;\n }\n if(finalW>=finalB){\n printf(\"A\");\n }\n else{\n printf(\"B\");\n }\n //printf(\"\\n%d %d\",finalB,finalW);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n char a[8][8];\n int i,j,wd=8,bd=8;\n for(i=0;i<8;i++)\n {\n scanf(\"%s\",a[i]);\n }\n for(j=0;j<8;j++)\n {\n for(i=0;i<8;i++)\n {\n if(a[i][j]=='B')\n {\n break;\n }\n else if(a[i][j]=='W')\n {\n if(i+1=0;i--)\n {\n if(a[i][j]=='W')\n {\n break;\n }\n else if(a[i][j]=='B')\n {\n if(8-i\n#include\nint main()\n{ char tabla[50][50];\n int beli[50][50];\n int crni[50][50];\n int a,b,c,d;\n int i;\n for(i=0;i<8;i++){\n gets(tabla[i]);\n }\n char *q=tabla[0];\n int beli_int=0;\n int beli_int1=0;\n int petlja_beli1=0;\n int petlja_beli;\n int brojac_belih=0;\n for(petlja_beli=0;petlja_beli<8;petlja_beli++){\n q=tabla[petlja_beli];\n for(beli_int=0;beli_int<8;beli_int++,q++){\n if(*q=='W'){\n beli[petlja_beli1++][beli_int1]=(petlja_beli+1)*10 + beli_int+1;\n brojac_belih++;\n }}\nbeli_int1=0;\n }\n\n\n\n int petlja_crni;\n int crni_int;\n int petlja_crni1=0;\n int crni_int1=0;\n int brojac_crnih=0;\n for(petlja_crni=0;petlja_crni<8;petlja_crni++){\n q=tabla[petlja_crni];\n for(crni_int=0;crni_int<8;crni_int++,q++){\n if(*q=='B'){\n crni[petlja_crni1++][crni_int1]=(petlja_crni+1)*10 + crni_int+1;\n brojac_crnih++;\n }\n }\ncrni_int1=0;\n }\nint test=0;\nfor(test=0;testcrni[test_GD][0]/10)\n {\n nije_valid=1;\n break;\n }\n}\nif(nije_valid == 1)\n continue;\nelse{\n dobri_beli[beli_increaser++][0]=broj_valid;\n nije_valid=0;\n}}\nfor(test=0;testdobri_beli[sort1][0]){\n najveci_beli=dobri_beli[sort1][0];\n }\n }\n}\n//printf(\"\\n\\n**NAJVECI BELI%d\",najveci_beli);\nint zadnji_korak_b;\nint zadnji_korak_c;\nzadnji_korak_b=najveci_beli/10;\nzadnji_korak_c=najveci_crni/10;\n//printf(\"\\n\\nBELI - %d\\nCRNI - %d\",abs(1-zadnji_korak_b),abs(8-zadnji_korak_c));\nif(abs(1-zadnji_korak_b)<=abs(8-zadnji_korak_c)){\nprintf(\"A\");\n}\nelse\n printf(\"B\");\n}\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include\n\nint main()\n{\n char str[9][9], my[8];\n int i, j, minB, minA, positB, positA, no1, no2, ans1, ans2;\n\n for(i=1; i<=8; i++)\n {\n gets(my);\n for(j=1; j<=8; j++)\n {\n str[i][j] = my[j-1];\n }\n }\n\n\n minB=7;\n minA=7;\n for(i=1; i<=8; i++)\n {\n no1 = 0;\n no2 = 0;\n positB=1;\n positA=8;\n for(j=1; j<=8; j++)\n {\n if(str[j][i] == 'B')\n {\n no1++;\n positB=j;\n }\n if(str[j][i] == 'W')\n {\n no2++;\n if(j0 && no2==0)\n {\n ans1 = 8 - positB;\n if(minB>ans1)\n minB = ans1;\n }\n else if(no1==0 && no2>0)\n {\n ans2 = positA - 1;\n if(minA>ans2)\n minA = ans2;\n }\n }\n if(minA <= minB)\n printf(\"A\");\n else\n printf(\"B\");\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nmain()\n {\n int i,j,na,nb,stepA,stepB;\n int Ax[64],Ay[64],Bx[64],By[64];\n char s[9];\n na = 0;\n nb = 0;\n for (i=0;i<8;i++)\n {\n scanf(\"%s\",s);\n for (j=0;j<8;j++)\n {\n if (s[j]=='W')\n {\n Ax[na] = i;\n Ay[na] = j;\n na++;\n }\n else\n {\n if (s[j]=='B')\n {\n Bx[nb] = i;\n By[nb] = j;\n nb++;\n }\n }\n }\n }\n\n stepA = 10;\n for (i=0;i\nint main(){\n char a[8][8];\n int i,j,k,posw,posb;\n for(i=0;i<8;++i){\n for(j=0;j<8;++j){\n scanf(\"%c\",&a[i][j]);\n }\n }\nfor(k=0;k<8;++k){\n for(i=0;i<8;++i){\n for(j=0;j<8;++j){\n if(a[i][j]=='w'||a[i][j]=='W'){\n if(a[i-1][j]=='.'){\n a[i][j]=='.';\n a[i-1][j]=='W';\n posw=(i-1);\n }\n }\n if(a[i][j]=='b'||a[i][j]=='B'){\n if(a[i+1][j]=='.'){\n a[i][j]=='.';\n a[i+1][j]=='B';\n posb=(i+1);\n }\n }\n if(posw==0){\n printf(\"\\nA\");\n exit(0);\n }\n else if(posb==7){\n printf(\"\\nB\");\n exit(0);\n }\n }\n } \n }\nreturn 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{ char tabla[50][50];\n int beli[50][50];\n int crni[50][50];\n int a,b,c,d;\n int i;\n for(i=0;i<8;i++){\n gets(tabla[i]);\n }\n char *q=tabla[0];\n int beli_int=0;\n int beli_int1=0;\n int petlja_beli1=0;\n int petlja_beli;\n int brojac_belih=0;\n for(petlja_beli=0;petlja_beli<8;petlja_beli++){\n q=tabla[petlja_beli];\n for(beli_int=0;beli_int<8;beli_int++,q++){\n if(*q=='W'){\n beli[petlja_beli1++][beli_int1]=(petlja_beli+1)*10 + beli_int+1;\n brojac_belih++;\n }}\nbeli_int1=0;\n }\n\n\n\n int petlja_crni;\n int crni_int;\n int petlja_crni1=0;\n int crni_int1=0;\n int brojac_crnih=0;\n for(petlja_crni=0;petlja_crni<8;petlja_crni++){\n q=tabla[petlja_crni];\n for(crni_int=0;crni_int<8;crni_int++,q++){\n if(*q=='B'){\n crni[petlja_crni1++][crni_int1]=(petlja_crni+1)*10 + crni_int+1;\n brojac_crnih++;\n }\n }\ncrni_int1=0;\n }\nint test=0;\nfor(test=0;testcrni[test_GD][0]/10)\n {\n nije_valid=1;\n break;\n }\n}\nif(nije_valid == 1)\n continue;\nelse{\n dobri_beli[beli_increaser++][0]=broj_valid;\n nije_valid=0;\n}}\nfor(test=0;testdobri_beli[sort1][0]){\n najveci_beli=dobri_beli[sort1][0];\n }\n }\n}\nprintf(\"\\n\\n**NAJVECI BELI%d\",najveci_beli);\nint zadnji_korak_b;\nint zadnji_korak_c;\nzadnji_korak_b=najveci_beli/10;\nzadnji_korak_c=najveci_crni/10;\n//printf(\"\\n\\nBELI - %d\\nCRNI - %d\",abs(1-zadnji_korak_b),abs(8-zadnji_korak_c));\nif(abs(1-zadnji_korak_b)<=abs(8-zadnji_korak_c)){\nprintf(\"A\");\n}\nelse\n printf(\"B\");\n}\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include\nint main(){\nint i,j,wmoves,bmoves,wrow,wcol,brow,bcol;\nchar arr[8][8];\nint warr[8];\nint barr[8];\nint bmin,wmin;\nfor(i=0; i<8; i++)\n scanf(\"%s\",arr[i]);\n for(i=0; i<8; i++)\n {\n warr[i]=0;\n barr[i]=0;\n }\nfor(i=0; i<8; i++){\nfor(j=0; j<8; j++){\n\n if(arr[i][j]=='W'){\n if(warr[j]==0 &&barr[j]==0)\n warr[j]=i;\n if(barr[j]>0)\n barr[j]=0;\n\n }\n if(arr[i][j]=='B')\n {\n if(barr[j]==0)\n barr[j]++;\n else\n barr[j]=1;\n }\n if(arr[i][j]=='.'){\n if(barr[j]>0)\n barr[j]++;\n }\n}\n}\nbmin=0;\nwmin=0;\nfor(i=0; i<8; i++){\n if(wmin==0&&warr[i]>0)\n wmin=warr[i];\n else if(warr[i]>0&&warr[i]0)\n bmin=barr[i];\n else if(barr[i]>0&&barr[i]\n#include\n\n\n\nint main(){\n\n\n char Chess[8][8];\n int i,j,k ;\n int dist_A=0;\n int dist_B=0;\n int B_exist=0;\n int A_exist=0;\n\n\n for(i=0;i<8;i++)scanf(\"%s\",Chess[i]);\n \n i=1;\n while(i<8 && dist_A==0){\n for(j=0;j<8;j++){\n if(Chess[i][j]=='W'){\n for(k=0;k0 && dist_B==0){\n for(j=0;j<8;j++){\n if(Chess[i][j]=='B'){\n for(k=7;k>i;k--){if(Chess[k][j]=='W'){A_exist=1;break;}}\n if(A_exist==0){dist_B=7-i;break;} \n }\n } \n A_exist=0;\n i=i-1; \n }\n\n if(dist_B>=dist_A)printf(\"A\");\n else\n printf(\"B\");\n\n\n\n\nreturn 0 ;\n}\n"}, {"source_code": "#include\nint main(void)\n{\n int i=0,j=0,k,z=1;\n int ca,cb;\n char ar[8][9];\n while(i<8)\n {\n scanf(\"%s\",ar[i]);\n i++;\n }\n for(i=1;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n if(ar[i][j]=='W')\n {\n for(k=i;k>=0;k--)\n {\n if(ar[k][j]=='B')break;\n }\n if(ar[0][j]!='B'&&k<0)\n {\n ca=i;\n z=0;\n break;\n }\n }\n }\n if(z==0)break;\n }\n z=1;\n for(i=6;i>=0;i--)\n {\n for(j=0;j<8;j++)\n if(ar[i][j]=='B')\n {\n for(k=i;k<8;k++)\n {\n if(ar[k][j]=='W')break;\n }\n if(ar[7][j]!='W'&&k>=8)\n {\n cb=7-i;\n z=0;\n break;\n }\n }\n if(z==0)break;\n }\n if(ca\n#include \nint main()\n{\n char s[10][10];\n int i,j,flag,A1,B1;\n while(scanf(\"%s\",s)!=EOF)\n {\n for(i=1;i<=7;i++)\n scanf(\"%s\",s+i);\n flag=1;\n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n if(s[i][j]=='B')\n {\n if(i+1<=7&&s[i+1][j]=='.')\n {\n B1=i;\n }\n }\n if(s[i][j]=='W'&&flag)\n {\n if(i-1>=0&&s[i-1][j]=='.')\n {\n A1=i;\n flag=0;\n }\n }\n }\n }\n if(A1<=7-B1)\n printf(\"A\\n\");\n else printf(\"B\\n\");\n }\n return 0;\n}\n"}, {"source_code": "//http://codeforces.com/contest/592/problem/A\n\n#include\n#include\n\nint main(void){\n int i,j,trash;\n int bmin=10,wmin=10;\n int bm=0,wm=0;\n char a[8][8]={0};\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n scanf(\"%c\",&a[i][j]);\n }\n scanf(\"%c\",&trash);\n }\n\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n printf(\"%c \",a[i][j]);\n }\n printf(\"\\n\");\n }\n\n for(j=0;j<8;j++){\n bm=0;\n wm=0;\n for(i=0;i<8;i++){\n if(a[i][j]=='.'){\n wm++;\n }\n else if(a[i][j]=='b'){\n wm=0;\n break;\n }\n else break;\n }\n for(i=7;i>=0;i--){\n if(a[i][j]=='.'){\n bm++;\n }\n else if(a[i][j]=='w'){\n bm=0;\n break;\n }\n else break;\n }\n if(bm\nint main()\n{\n int x=0,y=0,i,j,g=0,f=0,h=0,k=0,finalB=0,finalW=0;\n char str[100][100];\n for(i=0;i<8;i++){\n scanf(\"%s\",str[i]);\n }\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n if(str[j][i]=='B'){\n x=j+1;\n if(f==0){\n h=x;\n }\n f++;\n }\n if(str[j][i]=='W'){\n y=j+1;\n if(f==0){\n g=9-y;\n }\n f++;\n }\n }\n // printf(\"%d %d %d\\n\",x,y,g);\n if(x>y||x==0||y==0){\n if(x>=finalB){\n finalB=x;\n }\n if(h==0){\n if(g>=finalW){\n finalW=g;\n }\n }\n if(h!=0){\n if(g>=finalW&&yx&&g>=finalW){\n finalW=g;\n }\n }\n f=0;\n x=0;\n y=0;\n g=0;\n h=0;\n }\n if(finalW>=finalB){\n printf(\"A\");\n }\n else{\n printf(\"B\");\n }\n //printf(\"\\n%d %d\",finalB,finalW);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(void)\n{\n char board[8][8];\n\n int i, j;\n for (i = 0; i < 8; i++)\n for (j = 0; j < 8; j++)\n scanf(\" %c\", &board[i][j]);\n \n \n int mina = 10, minb = 10;\n for (i = 0; i < 8; i++)\n { \n for (j = 0; j < 8; j++)\n {\n if (board[j][i] == 'B')\n break;\n else if (board[j][i] == 'W')\n {\n if (mina > j)\n mina = j;\n break; \n }\n }\n \n int k = 7; \n for (; k >= j; k--)\n {\n if (board[k][i] == 'W')\n break;\n else if (board[k][i] == 'B')\n {\n if (minb > 7-k)\n minb = 7-k; \n break; \n }\n }\n }\n printf(\"%c\", mina < minb ? 'A' : 'B');\n return 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{ char tabla[50][50];\n int beli[50][50];\n int crni[50][50];\n int a,b,c,d;\n int i;\n for(i=0;i<8;i++){\n gets(tabla[i]);\n }\n char *q=tabla[0];\n int beli_int=0;\n int beli_int1=0;\n int petlja_beli1=0;\n int petlja_beli;\n int brojac_belih=0;\n for(petlja_beli=0;petlja_beli<8;petlja_beli++){\n q=tabla[petlja_beli];\n for(beli_int=0;beli_int<8;beli_int++,q++){\n if(*q=='W'){\n beli[petlja_beli1++][beli_int1]=(petlja_beli+1)*10 + beli_int+1;\n brojac_belih++;\n }}\nbeli_int1=0;\n }\n\n\n\n int petlja_crni;\n int crni_int;\n int petlja_crni1=0;\n int crni_int1=0;\n int brojac_crnih=0;\n for(petlja_crni=0;petlja_crni<8;petlja_crni++){\n q=tabla[petlja_crni];\n for(crni_int=0;crni_int<8;crni_int++,q++){\n if(*q=='B'){\n crni[petlja_crni1++][crni_int1]=(petlja_crni+1)*10 + crni_int+1;\n brojac_crnih++;\n }\n }\ncrni_int1=0;\n }\nint test=0;\nfor(test=0;testcrni[test_GD][0]/10)\n {\n nije_valid=1;\n break;\n }\n}\nif(nije_valid == 1)\n continue;\nelse{\n dobri_beli[beli_increaser++][0]=broj_valid;\n nije_valid=0;\n}}\nfor(test=0;testdobri_beli[sort1][0]){\n najveci_beli=dobri_beli[sort1][0];\n }\n }\n}\n//printf(\"\\n\\n**NAJVECI BELI%d\",najveci_beli);\nint zadnji_korak_b;\nint zadnji_korak_c;\nzadnji_korak_b=najveci_beli/10;\nzadnji_korak_c=najveci_crni/10;\n//printf(\"\\n\\nBELI - %d\\nCRNI - %d\",abs(1-zadnji_korak_b),abs(8-zadnji_korak_c));\nif(abs(1-zadnji_korak_b)<=abs(8-zadnji_korak_c)){\nprintf(\"A\");\n}\nelse\n printf(\"B\");\n}\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "/*A*/\n#include\n#include\nint main()\n{\n\tchar chess[9][9];\n\tint A,B;\n\tint i,j;\n\tint p;\n\tint flag;\n\t//while(1)\n\t//{\n\t\tfor(i=1;i<=8;i++)\n\t\t scanf(\"%s\",chess[i]);\n\t\tA=8;B=8;\n\t\tfor(i=1;i<=8;i++)\n\t\t{\n\t\t\tfor(j=0;j<8;j++)\n\t\t\t{\n\t\t\t if(chess[i][j]=='W')\n\t\t\t {\n\t\t\t \tflag=1;\n\t\t\t \tfor(p=i-1;p>=1;p--)\n\t\t\t \t{\n\t\t\t \t\tif(chess[p][j]!='.')\n\t\t\t \t\t{\n\t\t\t \t\t\tflag=0;\n\t\t\t \t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(flag==1&&i\n\nint main()\n{\n int i,j,k;\n char ara[9][9];\n for(i=1;i<=8;i++)\n {\n for(j=1;j<=8;j++)\n {\n scanf(\"%c\",&ara[i][j]);\n }\n getchar();\n }\n\n\n int maxb=1,minw=8,countw,countb;\n for(i=1;i<=8;i++)\n {\n for(j=1;j<=8;j++)\n {\n if(ara[j][i]=='B')\n {\n countb=1;\n for(k=j+1;k<=8;k++)\n {\n if(ara[k][i]=='W'||ara[k][i]=='B')\n {\n countb=0;\n break;\n }\n\n }\n if(countb==1&&j>maxb)\n maxb=j;\n }\n else if(ara[j][i]=='W')\n {\n countw=1;\n for(k=j-1;k>=1;k--)\n {\n if(ara[k][i]=='W'||ara[k][i]=='B')\n {\n countw=0;\n break;\n }\n\n }\n if(countw==1&&j\n#include \n\nint main()\n{\n int i,p1,p2,j,k,l;\n char a[9][9];\n for(i=1;i<=8;i++)\n {\n scanf(\"%s\",a[i]);\n }\n int p2flag=0;\n for(i=1;i<=8;i++)\n {\n for(j=0;j<8;j++)\n {\n if(a[i][j]=='B')\n {\n int flag=0;\n for(k=i+1;k<=8;k++)\n {\n if(a[k][j]=='W')\n flag=1;\n }\n if(flag==0)\n p1=8-i;\n }\n if(a[i][j]=='W')\n {\n int flag1=0;\n for(k=1;kp2)\n printf(\"A\\n\");\n else\n printf(\"B\\n\");\n return 0;\n}\n\n\n"}, {"source_code": "# include \n\nint mat[9][9];\nchar row[9];\n\nint main()\n{\n int i,j,z;\n for( i = 1 ; i <= 8 ; ++i )\n {\n scanf(\"%s\",row);\n for( z = 0, j = 1 ; row[z] ; ++z, ++j )\n {\n if( row[z] == 'W' )\n mat[i][j] = 1;\n if( row[z] == 'B' )\n mat[i][j] = 2;\n if( row[z] == '.' )\n mat[i][j] = 0;\n }\n }\n\n int Wmin,Bmin;\n Wmin = Bmin = 8;\n for( j = 1 ; j <= 8 ; ++j )\n {\n if( mat[1][j] == 0 )\n for( z = 2 ; z <= 8 ; ++z )\n {\n if( mat[z][j] == 2 )\n break;\n if( mat[z][j] == 1 && Wmin > z-1 )\n Wmin = z-1;\n }\n\n }\n for( j = 1 ; j <= 8 ; ++j )\n {\n if( mat[8][j] == 0 )\n for( z = 7 ; z >= 1 ; --z )\n {\n if( mat[z][j] == 1 )\n break;\n if( mat[z][j] == 2 && Bmin > 8-z )\n Bmin = 8-z;\n }\n }\n\n Wmin < Bmin ? putchar('A') : putchar('B');\n\n return 0;\n}\n"}, {"source_code": "#include \nint main(void)\n{\n int i, j, k, f,t, f2, count, count_2, min =8, min_2 =8;\n char chess[8][10];\n\n for(i=0; i<8; i++) scanf(\"%s\", chess[i]);\n\n for(j=0; j<8; j++){\n for(k=0; k<8; k++){\n if(chess[j][k] == 'W'){\n f = 1;\n for(t=0; t<8; t++){\n if(chess[t][k] == 'B'){\n f = 0;\n break;\n }\n }\n if(f){\n count = j;\n if(count\n#include \n\nint Free_Way(const int *matrix,int col,int str,int derect)\n{\n int i,j,flag=0;\n if(derect==1)\n for(i=str-1;i>=0;i--) {\n if (matrix[i*8+col]!=0) {\n flag=1;\n break;\n }\n }\n else\n for(i=str+1;i<8;i++)\n if (matrix[i*8+col]!=0) {\n flag=1;\n break;\n }\n return !flag;\n}\n\n\nint main()\n{\n int sq[8][8],i,j,rw,rb;\n char str[8];\n for(i=0;i<8;i++) {\n scanf(\"%s\",str);\n for(j=0;j<8;j++)\n if (str[j]!='.')\n if (str[j]=='W')\n sq[i][j]=1;\n else\n sq[i][j]=-1;\n else\n sq[i][j]=0;\n }\n for(i=1;i<8;i++)\n for(j=0;j<8;j++)\n if ((sq[i][j]==1)&&(Free_Way(&sq[0][0],j,i,1))) {\n rw=i;\n break;\n }\n for(i=7;i>=0;i--)\n for(j=0;j<8;j++)\n if ((sq[i][j]==-1)&&(Free_Way(&sq[0][0],j,i,-1))) {\n rb=8-i;\n break;\n }\n if (rw<=rb)\n printf(\"A\");\n else\n printf(\"B\");\n\n return 0;\n}"}, {"source_code": "#include \"stdio.h\"\n#include \"string.h\"\n\nint main(int argc, char* argv[])\n{\n\tchar s[10];\n\tint i,j,ans=8,ans2=-1;\n\tfor(i=0;i<8;i++)\n\t{\n\t\tscanf(\"%s\",s);\n\t}\n\n\tfor(i=0;i<8;i++)\n\t{\n\t\tfor(j=0;j<8;j++)\n\t\t{\n\t\t\tif(s[j]=='B')\n\t\t\t{\n\t\t\t\tans=i+1;\n\t\t\t\tif(i>ans)\n\t\t\t\t\tans=i+1;\n\t\t\t}\n\t\t\tif(s[j]=='W')\n\t\t\t{\n\t\t\t\tans2=i+1;\n\t\t\t\tif(i(8-ans))\n\t\tprintf(\"B\\n\");\n\telse\n\t\tprintf(\"A\\n\");\n\n\treturn 0;\n}"}], "src_uid": "0ddc839e17dee20e1a954c1289de7fbd"} {"nl": {"description": "Can you imagine our life if we removed all zeros from it? For sure we will have many problems.In this problem we will have a simple example if we removed all zeros from our life, it's the addition operation. Let's assume you are given this equation a + b = c, where a and b are positive integers, and c is the sum of a and b. Now let's remove all zeros from this equation. Will the equation remain correct after removing all zeros?For example if the equation is 101 + 102 = 203, if we removed all zeros it will be 11 + 12 = 23 which is still a correct equation.But if the equation is 105 + 106 = 211, if we removed all zeros it will be 15 + 16 = 211 which is not a correct equation.", "input_spec": "The input will consist of two lines, the first line will contain the integer a, and the second line will contain the integer b which are in the equation as described above (1 ≤ a, b ≤ 109). There won't be any leading zeros in both. The value of c should be calculated as c = a + b.", "output_spec": "The output will be just one line, you should print \"YES\" if the equation will remain correct after removing all zeros, and print \"NO\" otherwise.", "sample_inputs": ["101\n102", "105\n106"], "sample_outputs": ["YES", "NO"], "notes": null}, "positive_code": [{"source_code": "#include\n#include\n#include\n\nint main(){\n long i,j=0,k,m,n,x,y,z,o;\n char a[11],b[11],c[11],d[11],e[12],f[12],g[12];\n scanf(\"%s\",a);\n scanf(\"%s\",b);\n for(i=0;i\n\nint removezero(int n);\nint removezero(int n)\n{\n int num=0,pow=1,reminder;\n\n while(n!=0)\n {\n reminder=n%10;\n n/=10;\n\n if(reminder!=0)\n {\n num+=reminder*pow;\n pow*=10;\n }\n }\n return num;\n}\n\nint main()\n{\n int a,b,c,A,B,C;\n scanf(\"%d %d\",&a,&b);\n c=a+b;\n A=removezero(a);\n B=removezero(b);\n C=removezero(c);\n\n if(A+B==C)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n}\n"}, {"source_code": "//Nihcas//\n\n# include \n# include \n# include \n# include \n\nint main(void)\n{\n\tchar a[10];\n\tchar b[10];\n\tchar c[10];\n\n\tint lena,lenb,i,j,sum,carry=0,k=0,key;\n\t\n\tscanf(\"%s\",a);\n\tscanf(\"%s\",b);\n\t\n\tsum=atoi(a)+atoi(b);\n\t\n\tlena=strlen(a);\n\tlenb=strlen(b);\n\t\n\ti=lena-1;\n\tj=lenb-1;\n\t\n\twhile(i>=0 && j>=0)\n\t{\n\t\t\n\t\tif(a[i]!='0' && b[j]!='0')\n\t\t{\n\t\t\tkey=a[i]+b[j]+carry-96;\n\t\t\t\n\t\t\tc[k]=(key%10)+48;\n\t\t\tcarry=key/10;\n\t\t\tk++;\n\t\t\ti--;\n\t\t\tj--;\n\t\t\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\t\n\t\t\tif(a[i]=='0')\n\t\t\t{\n\t\t\t\ti--;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t\n\t\t\tif(b[j]=='0')\n\t\t\t{\n\t\t\t\tj--;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t}\n\t\n\t\n\twhile(i>=0)\n\t{\n\t\tif(a[i]!='0')\n\t\t{\n\t\t\tkey=a[i]+carry-48;\n\t\t\t\n\t\t\tc[k]=(key%10)+48;\n\t\t\tcarry=key/10;\n\t\t\tk++;\n\t\t\ti--;\n\t\t\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\t\n\t\t\tif(a[i]=='0')\n\t\t\t{\n\t\t\t\ti--;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t\n\t\t}\n\t}\n\t\n\twhile(j>=0)\n\t{\n\t\t\n\t\tif(b[j]!='0')\n\t\t{\n\t\t\tkey=b[j]+carry-48;\n\t\t\t\n\t\t\tc[k]=(key%10)+48;\n\t\t\tcarry=key/10;\n\t\t\tk++;\n\t\t\tj--;\n\t\t\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\t\n\t\t\tif(b[j]=='0')\n\t\t\t{\n\t\t\t\tj--;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t}\n\tif(carry!=0)\n\t{c[k]=carry+48;k++;}\n\t\n\t\n\tfor(j=0;sum>0;j++)\n\t{\n\t\tint unit=sum%10;;\n\t\twhile(unit==0)\n\t\t{sum/=10;unit=sum%10;}\n\t\t\n\n\t\tif(c[j]!=unit+48)\n\t\t{\n\t\t\tprintf(\"NO\");\n\t\t\tbreak;\n\t\t}\n\t\tsum/=10;\n\t\n\t}\n\n\tif(sum==0 && j==k)\n\tprintf(\"YES\");\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include \n#include\n#include\nint main()\n{\n char a[20]; char b[20]; char c[20];\n char a2[20]; char b2[20]; char c2[20];\n int i;\n scanf(\"%s\",a);\n scanf(\"%s\",b);\n int x=atoi(a)+atoi(b); //x=a+b with zeros\n itoa(x,c,10);\n int y=0;\n for(i=0;i\nint remz(int n){\n int d,m=0,pow=1;\n while(n!=0){\n d=n%10;\n n=n/10;\n if(d!=0){\n m+=d*pow;\n pow*=10;\n }\n \n }\n return m;\n}\nint main(){\n int a,b,c,A,B,C;\n scanf(\"%d %d\",&a,&b);\n c=a+b;\n c=remz(c);\n A=remz(a);\n B=remz(b);\n C=A+B;\n if(c==C){\n printf(\"YES\");\n }else{\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n int a,b,c;\n int wza,wzb,wzc;\n\n\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n c=a+b;\n\n wza=WithoutZero(a);\n wzb=WithoutZero(b);\n wzc=WithoutZero(c);\n\n if((wza+wzb)==wzc)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n return 0;\n\n}\n\nint WithoutZero(int num){\n int i=0;\n double dig,pw,wzNum=0;\n while(num!=0)\n {\n if(num%10!=0){\n dig=num%10;\n pw=pow(10,i);\n wzNum=wzNum+dig*pow(10,i);\n i++;\n }\n num=num/10;\n }\n\n return wzNum;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int i, Num1,num1_,Num2,num2_,additionSum,additionSum_,digits1=0,digits2=0,sumDigits=0,j,lastttt;\n scanf(\"%i %i\",&Num1,&Num2);\n additionSum=Num1+Num2;\n additionSum_=additionSum;\n num1_=Num1;\n num2_=Num2;\n //printf(\"%i\\n\",additionSum);\n while(additionSum_!=0)\n {\n sumDigits++;\n additionSum_=additionSum_/10;\n }\n while(num1_!=0)\n {\n digits1++;\n num1_=num1_/10;\n }\n while(num2_!=0)\n {\n digits2++;\n num2_=num2_/10;\n }\n // printf(\"%i %i %i\\n\",digits1,digits2,sumDigits);\n int number1array[digits1],number2array[digits2],sumArray[sumDigits];\n for (i=digits1-1; i>=0; i--)\n {\n number1array[i]=Num1%10;\n Num1=Num1/10;\n }\n for (i=digits2-1; i>=0; i--)\n {\n number2array[i]=Num2%10;\n Num2=Num2/10;\n }\n\n for (i=sumDigits-1; i>=0; i--)\n {\n sumArray[i] =additionSum%10;\n additionSum=additionSum/10;\n }\n\n\n /* printf(\"\\n\");\n for (i=0; i=0; j--)\n {\n if (number1array[j]==0 && j!=0 )\n {\n temp=number1array[j-1];\n number1array[j-1]=number1array[j];\n number1array[j]=temp;\n }\n\n }\n }\n for (i=0; i=0; j--)\n {\n\n if (number2array[j]==0 && j!=0 )\n {\n temp1=number2array[j-1];\n number2array[j-1]=number2array[j];\n number2array[j]=temp1;\n }\n }\n }\n\n for (i=0; i=0; j--)\n {\n if (sumArray[j]==0 && j!=0 )\n {\n temp=sumArray[j-1];\n sumArray[j-1]=sumArray[j];\n sumArray[j]=temp;\n }\n }\n }\n/*printf(\"\\n\");\n for (i=0; i=0; i--)\n {\n x=number1array[i] *ten;\n ten=ten*10;\n sum1=sum1+x;\n }\n ten=1;\n for (i=digits2-1; i>=0; i--)\n {\n x=number2array[i] *ten;\n ten=ten*10;\n sum2=sum2+x;\n }\n ten=1;\n for (i=sumDigits-1; i>=0; i--)\n {\n x=sumArray[i] *ten;\n ten=ten*10;\n sum3=sum3+x;\n }\n\n//for (i=0; i\n#include\n#include\n\nint exzero(int a){\n char tmp[16],put[3],num[16];\n int i,j,k,n;\n\n for(i=0,j=0;i<=9;i++){\n if(a%10!=0){\n sprintf(put,\"%d\",a%10);\n tmp[j]=put[0];\n j++;\n }\n a/=10;\n if(a==0) break;\n }\n tmp[j]='\\0';\n for(i=0;i\n#include\nint main()\n{\n char a[10000],a1[10000],b[10000],b1[100000],s1[100000],s2[100000];\n int i,j,k=0,sum1,sum2;\n gets(a);\n gets(b);\n sum1=atoi(a)+atoi(b);\n itoa(sum1,s1,10);\n for(i=0;i\n\nint main(void)\n{\n\tint a,b,x=0,y=0,sum1,sum2,sumex=0;\n\tscanf(\"%d\",&a);\n\tscanf(\"%d\",&b);\n\n\tsum1=a+b;\n\t\n\tfor(int i=1,j=1,k=1;a!=0||b!=0||sum1!=0;)\n\t{\n\t\tif(a%10!=0) \n\t\t{\n\t\t\tx+=a%10*i;\n\t\t\ti*=10;\t\n\t\t}\n\t\t\n\t\tif(b%10!=0) \n\t\t{\n\t\t\ty+=b%10*j;\n\t\t\tj*=10;\t\n\t\t}\t\n\t\t\n\t\tif(sum1%10!=0) \n\t\t{\n\t\t\tsumex+=sum1%10*k;\n\t\t\tk*=10;\t\n\t\t}\t\n\t\t\n\t\ta/=10;\n\t\tb/=10;\n\t\tsum1/=10;\n\t}\n\n\tsum2=x+y;\n\t//printf(\"%d %d %d\",x,y,sumex);\n\t\n\tif(sumex==sum2) printf(\"YES\");\n\telse printf(\"NO\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint rz(int n)\n{\n long long k = 0;\n\n while(n)\n {\n if(n % 10)\n k = 10 * k + n % 10;\n n /= 10;\n }\n\n while(k)\n {\n n = 10 * n + k % 10;\n k /= 10;\n }\n\n return n;\n}\n\nint main(int argc, char *argv[])\n{\n int a, b;\n\n scanf(\"%d %d\", &a, &b);\n\n if(rz(a) + rz(b) == rz(a + b))\n puts(\"YES\");\n else\n puts(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "/* https://codeforces.com/contest/75/submission/20824456 (rainboy) */\n#include \n\nint rmzero(int a) {\n\treturn a == 0 ? 0 : (a % 10 == 0 ? rmzero(a / 10) : rmzero(a / 10) * 10 + a % 10);\n}\n\nint main() {\n\tint a, b, c;\n\n\tscanf(\"%d%d\", &a, &b);\n\tc = a + b;\n\tprintf(rmzero(a) + rmzero(b) == rmzero(c) ? \"YES\\n\" : \"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,c,d,a1,b1,d1;\n scanf(\"%d%d\",&a,&b);\n a1=count(a);\n b1 = count(b);\n d1 = a1+b1;\n c=a+b;\n d = count(c);\n if(d1==d)\n {\n printf(\"YES\\n\");\n\n }\n else\n {\n printf(\"NO\\n\");\n }\n\n\n}\nint count(int a)\n{\n int c=0,i=1,sum=0;\n while(a!=0)\n {\n c = (a%10);\n if (c>0)\n {\n sum +=(c*i);\n i*=10;\n }\n a /=10;\n }\n return sum;\n}\n"}, {"source_code": "#include \n#include \n#include \n\nint main()\n{\n\tint a,b,l[12],m[12],n[12];\n\tscanf(\"%d%d\",&a,&b);\n\tint c=a+b,t,i=0,j=0,k=0;\n\twhile(c>0)\n\t{\n\t\tt=c%10;\n\t\tif(t==0)\n\t\t{\n\t\t\tc=c/10;\n\t\t\tcontinue;\n\t\t}\n\t\tl[i]=t;\n\t\ti++;\n\t\tc=c/10;\n\t}\n\twhile(b>0)\n\t{\n\t\tt=b%10;\n\t\tif(t==0)\n\t\t{\n\t\t\tb=b/10;\n\t\t\tcontinue;\n\t\t}\n\t\tm[k]=t;\n\t\tk++;\n\t\tb=b/10;\n\t}\n\twhile(a>0)\n\t{\n\t\tt=a%10;\n\t\tif(t==0)\n\t\t{\n\t\t\ta=a/10;\n\t\t\tcontinue;\n\t\t}\n\t\tn[j]=t;\n\t\tj++;\n\t\ta=a/10;\n\t}\n\tint p,q=0,r=0,s=0;\n\tfor(p=i-1;p>=0;p--)\n\t{\n\t\ts=s*10+l[p];\n\t}\n\tfor(p=k-1;p>=0;p--)\n\t\tr=r*10+m[p];\n\tfor(p=j-1;p>=0;p--)\n\t\tq=q*10+n[p];\n\tif(q+r==s)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\treturn 0;\n\n\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint a,b,c,d=0,e,f=0,i=1,j=1,x,k=1,g,h=0;\n\tscanf(\"%d %d\",&a,&b);\n\tx=a+b;\n\n\twhile(a!=0)\n\t{\n\t\tc=a%10;\n\t\ta=a/10;\n\t\td=d+c*i;\n\t\tif(c!=0)\n\t\t\ti=i*10;\n\t}\n\n\twhile(b!=0)\n\t{\n\t\te=b%10;\n\t\tb=b/10;\n\t\tf=f+e*j;\n\t\tif(e!=0)\n\t\t\tj=j*10;\n\t}\n\n\n\twhile(x!=0)\n\t{\n\t\tg=x%10;\n\t\tx=x/10;\n\t\th=h+g*k;\n\t\tif(g!=0)\n\t\t\tk=k*10;\n\t}\n\n\tif(h==d+f)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n\nint removezeros(int );\n\nint main()\n{\n int a,b;\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n int c=a+b;\n int p,q,r;\n p=removezeros(a);\n q=removezeros(b);\n r=removezeros(c);\n if(r==(p+q))\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n\nint removezeros(int s)\n{\n int a=0,c=1;\n while(s!=0)\n {\n int p=s%10;\n s=s/10;\n if(p!=0)\n {\n a=a+(p*c);\n c*=10;\n }\n }\n return a;\n}"}, {"source_code": "#include\n#include\n#include\nint main(){\nint a,b,x,x1,c,a1,b1,c1,a2,i,b2,c2,na,nb,nc;\nna=nb=nc=0;\nscanf(\"%d%d\",&a,&b);\nc=a+b;\nif(a==10502405&&b==40403403){\n printf(\"YES\");\n}\n\n/*printf(\"%d %d %d\\n\",a,b,c);*/\nelse{\nx=a;\nwhile(x>0){\n x1=x%10;\nif(x1==0){\n na++;\n}\nx=x/10;\n\n }\n x=b;\n while(x>0){\n x1=x%10;\nif(x1==0){\n nb++;\n}\nx=x/10;\n\n }\n x=c;\n while(x>0){\n x1=x%10;\nif(x1==0){\n nc++;\n}\nx=x/10;\n\n }\nif(na==0&&nb==0&&nc==0){\n printf(\"YES\");\n}\nelse{\n i=0;\n a1=0;\n while(a>0){\n a2=a%10;\n if(a2==0){\n a=a/10;\n continue;\n }\n else{\n a1=a1+a2*pow(10,i);\n i++;\n }\na=a/10;\n }\n \n i=0;\n b1=0;\n while(b>0){\n b2=b%10;\n if(b2==0){\n b=b/10;\n continue;\n }\n else{\n b1=b1+b2*pow(10,i);\n i++;\n }\nb=b/10;\n }\n i=0;\n c1=0;\n while(c>0){\n c2=c%10;\n if(c2==0){\n c=c/10;\n continue;\n }\n else{\n c1=c1+c2*pow(10,i);\n i++;\n }\nc=c/10;\n }\n/*printf(\"%d %d %d\\n\",a1,b1,c1);*/\n\n if(c1==(a1+b1)){\n printf(\"YES\");\n}\nelse if(c1!=(a1+b1)){\n printf(\"NO\");\n}\n}\n}}"}, {"source_code": "#include\n\nint removezero(int n);\nint removezero(int n)\n{\n int num=0,pow=1,reminder;\n\n while(n!=0)\n {\n reminder=n%10;\n n/=10;\n\n if(reminder!=0)\n {\n num+=reminder*pow;\n pow*=10;\n }\n }\n return num;\n}\n\nint main()\n{\n int a,b,c,A,B,C;\n scanf(\"%d %d\",&a,&b);\n c=a+b;\n A=removezero(a);\n B=removezero(b);\n C=removezero(c);\n\n if(A+B==C)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n}\n"}, {"source_code": "#include \n\nint main()\n{\n long long int a,b,c,s1=0,s2=0,s3=0,rem,com1=0,n1=0,n2=0,com2;\n scanf(\"%I64d\",&a);\n scanf(\"%I64d\",&b);\n c=a+b;\n while (c!=0)\n {\n rem=c%10;\n if (rem!=0)\n {\n s1=s1*10+rem;\n }\n c/=10;\n }\n while (s1!=0)\n {\n rem=s1%10;\n com1=com1*10+rem;\n s1/=10;\n }\n while (a!=0)\n {\n rem=a%10;\n if (rem!=0)\n {\n n1=n1*10+rem;\n }\n a/=10;\n }\n while (n1!=0)\n {\n rem=n1%10;\n s2=s2*10+rem;\n n1/=10;\n }\n while (b!=0)\n {\n rem=b%10;\n if (rem!=0)\n {\n n2=n2*10+rem;\n }\n b/=10;\n }\n while (n2!=0)\n {\n rem=n2%10;\n s3=s3*10+rem;\n n2/=10;\n }\n com2=s2+s3;\n if (com1==com2)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \n\nint a,b,c,i,v1[11],v2[11],v3[11],nr1,nr2,nr3,nr4,nr5,nr6,aux1,aux2,aux3;\nint main()\n{\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n c=a+b;\n aux1=a;\n aux2=b;\n aux3=c;\n while(aux1!=0)\n if(aux1%10!=0)\n {\n nr1++;\n v1[nr1]=aux1%10;\n aux1=aux1/10;\n }\n else\n aux1=aux1/10;\n while(aux2!=0)\n if(aux2%10!=0)\n {\n nr2++;\n v2[nr2]=aux2%10;\n aux2=aux2/10;\n }\n else\n aux2=aux2/10;\n while(aux3!=0)\n if(aux3%10!=0)\n {\n nr3++;\n v3[nr3]=aux3%10;\n aux3=aux3/10;\n }\n else\n aux3=aux3/10;\n for(i=nr1;i>0;i--)\n nr4=nr4*10+v1[i];\n for(i=nr2;i>0;i--)\n nr5=nr5*10+v2[i];\n for(i=nr3;i>0;i--)\n nr6=nr6*10+v3[i];\n if(a+b==c&&nr4+nr5==nr6)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint a,b,c,d=0,e,f=0,i=1,j=1,x,k=1,g,h=0;\n\tscanf(\"%d %d\",&a,&b);\n\tx=a+b;\n\n\twhile(a!=0)\n\t{\n\t\tc=a%10;\n\t\ta=a/10;\n\t\td=d+c*i;\n\t\tif(c!=0)\n\t\t\ti=i*10;\n\t}\n\n\twhile(b!=0)\n\t{\n\t\te=b%10;\n\t\tb=b/10;\n\t\tf=f+e*j;\n\t\tif(e!=0)\n\t\t\tj=j*10;\n\t}\n\n\n\twhile(x!=0)\n\t{\n\t\tg=x%10;\n\t\tx=x/10;\n\t\th=h+g*k;\n\t\tif(g!=0)\n\t\t\tk=k*10;\n\t}\n\n\tif(h==d+f)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n}\n"}, {"source_code": "#include\nint wzero(int x)\n{\n int d,s=0,p=1;\n while(x!=0)\n {\n d=x%10;\n if(d!=0){\n s=s+p*d;\n p=p*10;\n }\n x=x/10;\n }\n return s;\n}\nint main()\n{\n int a,b,s,p,q,r,f=0;\n scanf(\"%d %d\",&a,&b);\n s=a+b;\n p=wzero(a);\n q=wzero(b);\n r=wzero(s);\n if((p+q)==r)\n f=1;\n if(f==0)\n printf(\"NO\");\n else\n printf(\"YES\");\n \n}"}, {"source_code": "#include\n#include\nint main()\n{\n long long int a,b,c,a1=0,b1=0,c1=0,i,k=0,j=0,l=0,m,n;\n scanf(\"%lld %lld\",&a,&b);\n c=a+b;\n for(;;)\n {\n m=a%10;\n a=a/10;\n if(m!=0)\n {\n n=1;\n for(i=0;i\n\nlong long int unzero(long long a)\n{\n long long t=0;\n while(a)\n {\n int d=a%10;\n if(d)\n t=10*t+d;\n a/=10;\n }\n long long int n=0;\n while(t)\n {\n int d=t%10;\n n=10*n+d;\n t/=10;\n }\n return n;\n}\n\nint main()\n{\n long long int a,b,c;\n scanf(\"%lld%lld\",&a,&b);\n c=a+b;\n long long int za,zb,zc;\n za=unzero(a);\n zb=unzero(b);\n zc=unzero(c);\n if(za+zb==zc)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n long long test(long long a)\n {long long r=0;\n while(a!=0){if(a%10!=0)\n r=r*10+a%10;a/=10;}\n while(r!=0){\n a=a*10+r%10;r/=10;}\n return a;\n\n }\n long long int a,b,c;\n scanf(\"%lld%lld\",&a,&b);\n c=a+b;\n if(test(c)==(test(a)+test(b)))\n printf(\"YES\");\n else\n printf(\"NO\");\n\n}\n"}, {"source_code": "#include\n#include\nmain()\n{\nchar x[100],y[100],z[100],m[100],n[100],p[100];\nint a,b,c,d,e,f,g,h,i,j;\nscanf(\"%s\",&x);\nscanf(\"%s\",&y);\n\n\na=atoi(x);\nb=atoi(y);\nc=a+b;\n\nfor(i=0,j=-1;i\n#include \nint main()\n{\n\tint a,b,c,g,i,j,k,o,l,s,n,e,f,q,r;\n\tint ara[100000];\n\tint arar[100000];\n\tint ar[100000];\n\tscanf(\"%d\",&a);\n\tscanf(\"%d\",&b);\n\tc=a+b;\n\ti=0;\n\twhile(a!=0){\n\t\tg=a%10;\n\t\tif (g!=0){\n\t\t\tara[i]=g;\n\t\t\ti=i+1;\n\t\t}\n\t\ta=a/10;\n\t\t\n\t}\n\tj=0;\n\twhile(b!=0){\n\t\tg=b%10;\n\t\tif (g!=0){\n\t\t\tarar[j]=g;\n\t\t\tj=j+1;\n\t\t}\n\t\tb=b/10;\n\t\t\n\t}\n\tl=0;\n\twhile(c!=0){\n\t\tg=c%10;\n\t\tif (g!=0){\n\t\t\tar[l]=g;\n\t\t\tl=l+1;\n\t\t}\n\t\tc=c/10;\n\t\t\n\t}\n\t/*for (i=j-1;i>=0;i--){\n\t\tprintf(\"%d \",arar[i]);\n\t}*/\n\ts=0;\n\tfor(o=i-1;o>=0;o--){\n\t\tr=1;\n\t\tfor (q=1;q<=o;q++){\n\t\t\tr=r*10;\n\t\t}\n\t\ts=s+(ara[o])*r;\n\t}\n\te=0;\n\tfor(o=j-1;o>=0;o--){\n\t\tr=1;\n\t\tfor (q=1;q<=o;q++){\n\t\t\tr=r*10;\n\t\t}\n\t\te=e+(arar[o])*r;\n\t}\n\tf=0;\n\tfor(o=l-1;o>=0;o--){\n\t\tr=1;\n\t\tfor (q=1;q<=o;q++){\n\t\t\tr=r*10;\n\t\t}\n\t\tf=f+(ar[o])*r;\n\t}\n\tif ((s+e)==f){\n\t\tprintf(\"YES\");\n\t}\n\telse{\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\nunsigned zero(unsigned n)\n{\n unsigned num=0,d=1;\n while(n)\n {\n if(n%10!=0)\n {\n num+=(n%10)*d;\n d*=10;\n }\n n/=10;\n }\n return num;\n}\nint main(void)\n{\n unsigned a,b,c,d,e,f;\n scanf(\"%u %u\",&a,&b);\n c=a+b;\n d=zero(a);\n e=zero(b);\n f=zero(c);\n if((d+e)==f) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include\nlong long removezero(long long no)\n{\n long long sum=0;\n while(no>0)\n {\n if(no%10==0)\n {\n no/=10;\n continue;\n }\n sum=sum*10+no%10;\n no/=10;\n }\n return sum;\n}\nlong long main()\n{\n long long a;\n long long b;\n long long c;\n scanf(\"%I64d%I64d\",&a,&b);\n c=a+b;\n if(removezero(removezero(c))==removezero(removezero(a))+removezero(removezero(b)))\n printf(\"YES\");\n else\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nmain()\n{\n long long a,b,c,d,e,f;\n int i,j,x,y,z;\n char str1[100];\n char str2[100];\n char str3[100];\n scanf(\"%I64d %I64d\",&a,&b);\n c=a+b;\n lltoa(a,str1,10);\n lltoa(b,str2,10);\n lltoa(c,str3,10);\n x=strlen(str1);\n y=strlen(str2);\n z=strlen(str3);\n for(i=0,j=0;i\n#include \n\nint main()\n{\nlong long int a,b,sum1,sum2,a1,b1,r,r1,r2,r3,r4,r5,rev1=0,rev2=0,rev3=0,rev4=0,rev5=0,rev6=0;\nscanf(\"%lld\",&a);\nscanf(\"%lld\",&b);\nsum1=a+b;\n//printf(\"%lld\",sum1);\na1=a;\nb1=b;\nwhile(a1!=0)\n{\n r=a1%10;\n if(r!=0)\n rev1=(rev1*10)+r;\n a1=a1/10;\n}\nwhile(rev1!=0)\n{\n r1=rev1%10;\n rev2=(rev2*10)+r1;\n rev1=rev1/10;\n }\n // printf(\"%lld\",rev2);\n while(b1!=0)\n{\n r2=b1%10;\n if(r2!=0)\n rev3=(rev3*10)+r2;\n b1=b1/10;\n}\nwhile(rev3!=0)\n{\n r3=rev3%10;\n rev4=(rev4*10)+r3;\n rev3=rev3/10;\n }\n // printf(\"%lld\\n\",rev4);\nsum2=rev2+rev4;\n//printf(\"%lld\",sum2);\n while(sum1!=0)\n{\n r4=sum1%10;\n if(r4!=0)\n rev5=(rev5*10)+r4;\n sum1=sum1/10;\n}\nwhile(rev5!=0)\n{\n r5=rev5%10;\n rev6=(rev6*10)+r5;\n rev5=rev5/10;\n }\n if(sum2==rev6)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\nint main(){\n int a,b,c,d,e,f,i,j,k,l,m,n,o,r,s,t,u,v,w;\n char x[10000],y[10000],p[10000],q[10000],z[10000],aa[10000];\n scanf(\"%d %d\",&a,&b);\n \n sprintf(x,\"%d\",a);\n sprintf(y,\"%d\",b);\n j=0;\n c=strlen(x);\n d=strlen(y);\n for(i=0;i\n\nint power (long long a, long long b)\n{\n int s = 1, i;\n\n for (i = 1; i <= b; i ++) {\n s *= a;\n }\n\n return s;\n}\n\nint main ()\n{\n long long a, b, c, p, q, r, x [10] = {0}, y [10] = {0}, z [11] = {0}, i, l = 0, m = 0, n = 0;\n\n scanf (\"%lld %lld\", &a, &b);\n\n c = a + b;\n\n i = 0;\n while (a > 0) {\n if (a % 10 != 0) {\n x [i] = a % 10;\n i ++;\n }\n\n a /= 10;\n }\n\n i = 0;\n while (b > 0) {\n if (b % 10 != 0) {\n y [i] = b % 10;\n i ++;\n }\n\n b /= 10;\n }\n\n i = 0;\n while (c > 0) {\n if (c % 10 != 0) {\n z [i] = c % 10;\n i ++;\n }\n\n c /= 10;\n }\n\n\n for (i = 0; x [i] != 0; i ++) {\n l += x [i] * power (10, i);\n }\n\n for (i = 0; y [i] != 0; i ++) {\n m += y [i] * power (10, i);\n }\n\n for (i = 0; z [i] != 0; i ++) {\n n += z [i] * power (10, i);\n }\n\n if (l + m == n) printf (\"YES\");\n else printf (\"NO\");\n\n return 0;\n}\n\n\n"}, {"source_code": "#include\nint main()\n{\n\tlong long int a,b,c,d=1;\n\tlong long int val1=0,val2=0,val3=0,val;\n\tint rem;\n\tscanf (\"%lli\",&a);\n\tscanf (\"%lli\",&b);\n\tc=a+b;\n\twhile (a!=0)\n\t{\n\t\tif ((a%10)!=0)\n\t\t{\n\t\t\trem=a%10;\n\t\t\tval1+=(rem*d);\n\t\t\td*=10;\n\t\t}\n\t\ta/=10;\n\t}\n\td=1;\n\twhile (b!=0)\n\t{\n\t\tif ((b%10)!=0)\n\t\t{\n\t\t\trem=b%10;\n\t\t\tval2+=(rem*d);\n\t\t\td*=10;\n\t\t}\n\t\tb/=10;\n\t}\n\td=1;\n\twhile (c!=0)\n\t{\n\t\tif ((c%10)!=0)\n\t\t{\n\t\t\trem=c%10;\n\t\t\tval3+=(rem*d);\n\t\t\td*=10;\n\t\t}\n\t\tc/=10;\n\t}\n\tval=(val1+val2);\n\tif (val==val3)\n\tprintf (\"YES\");\n\telse\n\tprintf (\"NO\");\t\t\t\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n/* Written by Nishant Mittal aka nishantwrp */\nint raise(int a,int b) {\nint c = 1;\nint i=0;\nwhile(i\nint remove_zero(int n) {\n int prod=0;\n int times=1;\n while(n>0) {\n if(n%10!=0) {\n prod=n%10*times+prod;\n times*=10;\n }\n n=n/10;\n }\n return prod;\n}\nint main() {\n int a,b;\n scanf(\"%d%d\",&a,&b);\n int za=remove_zero(a);\n int zb=remove_zero(b);\n int zab=remove_zero(a+b);\n if(za+zb==zab) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n long int a,b,c,suma,sumb,sumc,p,m,n,total,d,f,e;\n while(scanf(\"%ld%ld\",&a,&b)!=EOF)\n {\n c=a+b;\n suma=0;\n d=1;\n while(a!=0)\n {\n m=a%10;\n a=a/10;\n if(m!=0)\n {\n suma=suma+m*d;\n d=d*10;\n }\n }\n f=1;\n sumb=0;\n while(b!=0)\n {\n n=b%10;\n b=b/10;\n if(n!=0)\n {\n sumb=sumb+n*f;\n f=f*10;\n\n }\n }\n total=suma+sumb;\n sumc=0;\n e=1;\n while(c!=0)\n {\n p=c%10;\n c=c/10;\n if(p!=0)\n {\n sumc=sumc+p*e;\n e=e*10;\n }\n }\n if(total==sumc)\n {\n printf(\"YES\\n\");\n }\n else\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "//codeforces\n//Life without zeros\n\n#include \n\nint main()\n{\n\tlong int a,b,c, dig, ma=0, mb=0, mc=0;\n\tint i, j;\n\n\tscanf(\"%ld %ld\", &a, &b);\n\tc=a+b;\n\t\n\tfor(i=1; a!=0; i++)\n\t{\n\t\tif(a%10 != 0)\n\t\t{\n\t\t\tdig=a%10;\n\t\t\tfor(j=1; j\nint main()\n{\n int a,b,c,d,a1,b1,d1;\n scanf(\"%d%d\",&a,&b);\n a1=count(a);\n b1 = count(b);\n d1 = a1+b1;\n c=a+b;\n d = count(c);\n if(d1==d)\n {\n printf(\"YES\\n\");\n\n }\n else\n {\n printf(\"NO\\n\");\n }\n\n\n}\nint count(int a)\n{\n int c=0,i=1,sum=0;\n while(a!=0)\n {\n c = (a%10);\n if (c>0)\n {\n sum +=(c*i);\n i*=10;\n }\n a /=10;\n }\n return sum;\n}\n"}, {"source_code": "#include \n#include \n\n int call (int a);\n\nint main()\n{\n int a,b,c,sum;\n\n scanf(\"%d %d\",&a,&b);\n\n sum=a+b;\n\n a=call(a);\n b=call(b);\n sum=call(sum);\n\n\n \n if(sum==a+b)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n\nint call(int a)\n{\n\n int b,c=0,sum=0,d[16],e,s=1;\n\n while(a>0){\n b=a%10;\n a=a/10;\n\n if(b>0){\n c++;\n d[c]=b;\n }\n }\n\n for(b=1;b<=c;b++){\n\n for(e=1;e\n#include */\n#include \n#include \n#include \n\n/*using namespace std;*/\n\nvoid remove_zero(char *src,char *dst)\n{ \n int cnt,i,j;\n \n cnt = strlen(src);\n \n for(i=0,j=0;i\nint a,b,c , i,j ,k ;\nint azero( int n)\n{\n int x = 0 , y = 0 , p = 1;\n while(n > 0 )\n {\n y = n%10 ;\n if ( y != 0)\n {\n x = x + y * p ;\n\n p = p*10 ;\n\n }\n n = n/ 10 ;\n\n }\n return x ;\n}\nint main()\n{\n\n\n\n scanf(\"%d\", &a);\n scanf(\"%d\", &b);\n c = a + b ;\n\n a = azero(a);\n b = azero(b);\n c = azero(c) ;\n // printf(\"%d %d %d \\n\", a,b,c) ;\n if ( a +b == c)\n {\n printf(\"YES\") ;\n\n }\n else{\n printf(\"NO\" ) ;\n }\n\n\n return 0 ;\n}\n"}, {"source_code": "int remove(int num)\n{\n int sum=0,t=1;\n while(num)\n {\n if(num%10)\n {\n sum = sum + (num%10)*t;\n t*=10;\n }\n num/=10;\n }\n return sum;\n}\nmain()\n{\n int a,b,c;\n scanf(\"%d%d\",&a,&b);\n c=a+b;\n a=remove(a);\n b=remove(b);\n c=remove(c);\n if(c==a+b) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\"stdio.h\"\nint s(int n){\n\tint t=0,pw=1;\n\twhile(n){\n\t\tt+=(n%10)*pw;\n\t\tif(n%10)pw*=10;\n\t\tn/=10;\n\t} return t;\n}\nint main(){\n\tint a,b;\n\tscanf(\"%d%d\",&a,&b);\n\tputs(s(a+b)==s(a)+s(b)? \"YES\" : \"NO\");\n\treturn 0;\n}"}, {"source_code": "/* AUTHOR:AKASH JAIN\n* USERNAME:akash19jain \n* DATE:12/10/2019 \n*/\n// #include\n// #include \n// using namespace std;\n \n#include\n#include\n#include\n#include\n#include\n#include\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;\n SC2(a,b);\n ll sum=a+b;\n ll a1=0,b1=0,sum1=0;\n while(a>0)\n {\n int r=a%10;\n if(r)\n a1=a1*10+r;\n a=a/10;\n }\n while(b>0)\n {\n int r=b%10;\n if(r)\n b1=b1*10+r;\n b=b/10;\n }\n while(sum>0)\n {\n int r=sum%10;\n if(r)\n sum1=sum1*10+r;\n sum=sum/10;\n }\n while(a1)\n {\n int r=a1%10;\n a=a*10+r;\n a1/=10;\n }\n while(b1)\n {\n int r=b1%10;\n b=b*10+r;\n b1/=10;\n }\n while(sum1)\n {\n int r=sum1%10;\n sum=sum*10+r;\n sum1/=10;\n }\n // DEB(a);\n // DEB(b);\n // DEB(sum);\n if(a+b==sum)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\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\n#include\nint main()\n{\n int i=0;\n char s1[20],s2[20],s3[20];\n scanf(\"%s%s\",&s1,&s2);\n\n strrev(s1);\n strrev(s2);\n while(s1[i]!='\\0'&&s2[i]!='\\0')\n {\n if(s1[i]+s2[i]-96>9)\n {\n if(s1[i+1]=='0'||s2[i+1]=='0'||s1[i]+s2[i]-96==10)\n {\n printf(\"NO\\n\");\n return 0;\n }\n else if(s1[i+1]!='0')\n s1[i+1]=s1[i+1]+1;\n else if(s2[i+1]!='0')\n s2[i+1]=s2[i+1];\n }\n else if((s1[i]=='0'&&s2[i]!='0')||(s2[i]=='0'&&s1[i]!='0'))\n {\n printf(\"NO\\n\");\n return 0;\n }\n i++;\n }\n printf(\"YES\\n\");\n return 0;\n}"}, {"source_code": "#include \n\nint removezero(int n) {\n int res, rem;\n res = 0;\n int k = 1;\n while (n) {\n rem = n % 10;\n n /= 10;\n if (rem) {\n res = res + rem * k;\n k *= 10;\n }\n }\n return res;\n}\nint main() {\n long long int a, b, c ;\n scanf(\"%ld%ld%ld\",&a,&b,&c);\n c = a + b;\n a = removezero(a);\n b = removezero(b);\n c = removezero(c);\n if (c == a+b)\n printf( \"YES\");\n else\n printf (\"NO\");\n return 0;\n}"}, {"source_code": "/*#include \n#include */\n#include \n#include \n#include \n\n/*using namespace std;*/\n\nvoid remove_zero(char *src,char *dst)\n{ \n int cnt,i,j;\n \n cnt = strlen(src);\n \n for(i=0,j=0;i\n#include\n#include\n\nint withoutzeros(char str[105]) {\n int i, j = 0;\n char res[105];\n for (i = 0, j = 0; i < strlen(str); i++)\n if (str[i] != '0')\n res[j++] = str[i];\n res[j] = '\\0';\n return atoi(res);\n}\n\nint main(void) {\n char str1[105], str2[105], str3[105];\n int c1, c2;\n scanf(\"%s%s\", str1, str2);\n c1 = atoi(str1) + atoi(str2);\n sprintf(str3, \"%d\", c1);\n c1 = withoutzeros(str3);\n c2 = withoutzeros(str1) + withoutzeros(str2);\n //printf(\"%d %d\\n\", c1, c2);\n if (c1 == c2)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include\nlong long int fun(long long int n)\n{\n\tlong long int s = 0 , p = 0;\n\twhile(n)\n\t{\n\t\tif( n%10 == 0)\n\t\t n=n/10;\n\t\telse\n\t\t{\n s = 10*s + (n%10);\n n = n / 10;\n\t\t }\n\t}\n\t\twhile(s)\n\t{\n\t\t p = 10*p + (s%10);\n s = s / 10;\n\t}\n\treturn p;\n}\nint main()\n{\n\tlong long int n,m;\n\tscanf(\"%lld %lld\",&n,&m);\n if( fun(n) + fun(m) == fun(n+m))\n\t printf(\"YES\");\n\telse\n\tprintf(\"NO\");\n return 0;\n}"}, {"source_code": "#include \n\n\nint a,b,c,a1=0,b1=0,c1=0;\nint i=1,j=1;\n\nint main()\n{scanf(\"%d%d\",&a,&b);\nc=a+b;\nwhile(a>0)\n{if(a%10!=0)\n{a1+=(a%10)*j;j*=10;}\na/=10;\n} j=1;\nwhile(b>0)\n{if(b%10!=0)\n{b1+=(b%10)*j; j=j*10;}\nb/=10;\n} j=1;\nwhile(c>0)\n{if(c%10!=0)\n{c1+=(c%10)*j;\nj=j*10;}\nc/=10;\n}\nif(a1+b1==c1)\nprintf(\"YES\");\nelse\nprintf(\"NO\"); \n return 0;\n}"}, {"source_code": "#include \n\nint main(void)\n{\n\tint a,b,x=0,y=0,sum1,sum2,sumex=0;\n\tscanf(\"%d\",&a);\n\tscanf(\"%d\",&b);\n\n\tsum1=a+b;\n\t\n\tfor(int i=1,j=1,k=1;a!=0||b!=0||sum1!=0;)\n\t{\n\t\tif(a%10!=0) \n\t\t{\n\t\t\tx+=a%10*i;\n\t\t\ti*=10;\t\n\t\t}\n\t\t\n\t\tif(b%10!=0) \n\t\t{\n\t\t\ty+=b%10*j;\n\t\t\tj*=10;\t\n\t\t}\t\n\t\t\n\t\tif(sum1%10!=0) \n\t\t{\n\t\t\tsumex+=sum1%10*k;\n\t\t\tk*=10;\t\n\t\t}\t\n\t\t\n\t\ta/=10;\n\t\tb/=10;\n\t\tsum1/=10;\n\t}\n\n\tsum2=x+y;\n\t//printf(\"%d %d %d\",x,y,sumex);\n\t\n\tif(sumex==sum2) printf(\"YES\");\n\telse printf(\"NO\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include\nlong long int rev(long long int c)\n{\n\tlong long int i,rem,sum=0;\n\tfor(i=c;i>0;i=i/10)\n {\n rem=i%10;\n if(rem!=0)\n sum=10*sum+rem;\n }\n\treturn sum;\n}\n\nint main()\n{\n\tlong long int a,b,i;\n\tscanf(\"%I64d%I64d\",&a,&b);\n\tlong long int c,ans1,ans2,ans3;\n\tc=a+b;\n\tans1=rev(c);\n\tc=rev(ans1);\n//\tprintf(\"%I64d\",c);\n\tans2=rev(a);\n\ta=rev(ans2);\n\tans3=rev(b);\n\tb=rev(ans3);\n\t\n//\tprintf(\"%I64d %I64d %I64d\",a,b,c);\n\tif(a+b==c)\n\tprintf(\"YES\\n\");\n\telse\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n\t\t\n"}, {"source_code": "#include\nint rmvzero(int n)\n{\n\tint d,x=0,y=1;\n\twhile(n!= 0)\n\t{\n\t\td=n%10;\n\t\tn /= 10;\n\t\tif(d!=0)\n\t\t{\n\t\t\ty *=10;\n\t\t\tx += d*y;\n\t\t}\n\t}\n\t\n\treturn x;\n}\n\nint main()\n{\n\tint a,b,c,A,B,C;\n\tscanf(\"%d\",&a);\n\tscanf(\"%d\",&b);\n\tc=a+b;\n\tA = rmvzero(a);\n\tB = rmvzero(b);\n\tC = rmvzero(c);\n\tif(C == A+B)\n\t{\n\t\tprintf(\"YES\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\\n\");\n\t}\nreturn 0;\n}"}, {"source_code": "#include \n#include \n#include \n\nint main(void){\n\n char a[15];\n char b[15];\n\n char moda[15];\n char modb[15];\n\n scanf(\"%s\", a);\n scanf(\"%s\", b);\n\n int initial_total=atoi(a)+atoi(b);\n int mod_total=initial_total;\n\n // printf(\"%d\", initial_total);\n\n int counter=0;\n\n while(mod_total!=0){\n mod_total/=10;\n counter+=1;\n }\n\n // printf(\"%d\\n\", counter);\n\n char sum[15];\n\n mod_total=initial_total;\n\n for(int i=counter-1;i>-1;i--){\n sum[i]=mod_total%10+'0';\n mod_total/=10;\n }\n\n sum[counter]='\\0';\n\n int placeholder=0;\n\n for(int j=0;j\n#include\nint rev(long long num)\n{\n int e;\n long long num1=0;\n while(num>0)\n {\n e=num%10;\n num1=num1*10+e;\n num/=10;\n }\n return num1;\n}\nint main ()\n{\n long long x,y;\n scanf(\"%lld%lld\",&x,&y);\n long long x1,y1;\n x1=x;y1=y;\n long long z,z1;\n z=x+y;\n z1=z;\n long long e,r=0,n=0,m=0;\n while(x1>0)\n {\n e=x1%10;\n if(e==0)\n {\n x1=x1/10;\n continue;\n }\n else\n {\n r=r*10+e;\n x1=x1/10;\n }\n }\n r=rev(r);\n while(y1>0)\n {\n e=y1%10;\n if(e==0)\n {\n y1=y1/10;\n continue;\n }\n else\n {\n m=m*10+e;\n y1=y1/10;\n }\n\n }\n m=rev(m);\n while(z1>0)\n {\n e=z1%10;\n if(e==0)\n {\n z1=z1/10;\n continue;\n }\n else\n {\n n=n*10+e;\n z1=z1/10;\n }\n }\n n=rev(n);\n if(r+m==n)\n printf(\"YES\");\n else\n printf(\"NO\");\n}\n"}, {"source_code": "#include \n\nint rz(int n)\n{\n long long k = 0;\n\n while(n)\n {\n if(n % 10)\n k = 10 * k + n % 10;\n n /= 10;\n }\n\n while(k)\n {\n n = 10 * n + k % 10;\n k /= 10;\n }\n\n return n;\n}\n\nint main(int argc, char *argv[])\n{\n int a, b;\n\n scanf(\"%d %d\", &a, &b);\n\n if(rz(a) + rz(b) == rz(a + b))\n puts(\"YES\");\n else\n puts(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nlong long removeZero(long long a);\n\nint main()\n{\n long long a,b,c1,c2;\n\n scanf(\"%I64d\",&a);\n scanf(\"%I64d\",&b);\n c1 = a + b;\n\n\n a = removeZero(a);\n b = removeZero(b);\n c2 = removeZero(c1);\n if(a+b==c2)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n\n return 0;\n}\n\n\n\nlong long removeZero(long long a)\n{\n long long i,num=0;\n\n\n for(i=0; a != 0; i++)\n {\n if(a%10 != 0)\n {\n num = num * 10 + a % 10;\n }\n a = a/10;\n }\n\n for(i=0; num != 0; i++)\n {\n a = a * 10 + num % 10;\n num = num / 10;\n }\n\n\n\n return a;\n}\n"}, {"source_code": "#include\n#include\n\nint main()\n{\n int n,i,l1,l2;\n long long int diga,digb,sum1,sum2;\n char a[15],b[15],s1[40];\n scanf(\"%s %s\", a,b);\n l1 = strlen(a);\n l2 = strlen(b);\n diga = 0;\n digb = 0;\n for(i=0;i 0){\n digit_count++;\n su /= 10;\n }\n\n s1[digit_count] = '\\0';\n for(i=digit_count-1;i>=0;i--){\n s1[i] = (sum1%10) +'0';\n sum1 /= 10;\n }\n int SUM=0;\n for(i=0;i\nint rmvzero(int n)\n{\n\tint d,x=0,y=1;\n\twhile(n!= 0)\n\t{\n\t\td=n%10;\n\t\tn /= 10;\n\t\tif(d!=0)\n\t\t{\n\t\t\tx += d*y;\n\t\t\ty *= 10;\n\t\t}\n\t}\n\t\n\treturn x;\n}\n\nint main()\n{\n\tint a,b,c,A,B,C;\n\tscanf(\"%d\",&a);\n\tscanf(\"%d\",&b);\n\tc=a+b;\n\tA = rmvzero(a);\n\tB = rmvzero(b);\n\tC = rmvzero(c);\n\tif(C == A+B)\n\t{\n\t\tprintf(\"YES\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\\n\");\n\t}\nreturn 0;\n}"}, {"source_code": "#include \n#include \n\nvoid main()\n{\n long long int c, d, f, g = 0, e = 0 ,a , b, k, l = 0, r, s = 0, t, u = 0, w = 0, v, x;\n scanf(\"%lld %lld\", &a, &b);\n c = a + b ;\n while(a != 0)\n {\n d = a % 10;\n if(d != 0)\n e =e * 10 + d;\n a = a / 10;\n }\n while(b != 0)\n {\n f = b % 10;\n if(f != 0)\n g = g * 10 + f;\n b = b / 10;\n }\n while (c != 0)\n {\n k = c % 10;\n if(k != 0)\n l = l * 10 + k;\n c = c / 10;\n }\nwhile ( e != 0)\n{\n r = e % 10;\n s = s * 10 + r;\n e = e / 10;\n}\nwhile (g != 0)\n {\n t = g % 10;\n u = u * 10 + t;\n g = g / 10;\n }\n while (l != 0)\n {\n v = l % 10;\n w = w * 10 + v;\n l = l / 10;\n }\n x = s + u;\n\nif (w == x)\n printf(\"YES\\n\");\nelse\n printf(\"NO\\n\");\n\n}\n"}, {"source_code": "#include \n#define s(a,b) scanf(\"%d %d\",&a,&b)\n#define MAX 101\n#define w(a) while(a--)\n\nint zero(int num)\n{\n int ret = 0;\n int ten = 1;\n while(num)\n {\n int dig = num % 10;\n num /= 10;\n if (dig)\n {\n ret += dig * ten;\n ten *= 10;\n }\n }\n return ret;\n}\n \nint main() {\n int a, b, c;\n s(a,b);\n c=a+b;\n a=zero(a);\n b=zero(b);\n c=zero(c);\n if (a+b==c) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include \n#include \n\nvoid main()\n{\n long long int c, d, f, g = 0, e = 0 ,a , b, k, l = 0, r, s = 0, t, u = 0, w = 0, v, x;\n scanf(\"%lld %lld\", &a, &b);\n c = a + b ;\n while(a != 0)\n {\n d = a % 10;\n if(d != 0)\n e =e * 10 + d;\n a = a / 10;\n }\n while(b != 0)\n {\n f = b % 10;\n if(f != 0)\n g = g * 10 + f;\n b = b / 10;\n }\n while (c != 0)\n {\n k = c % 10;\n if(k != 0)\n l = l * 10 + k;\n c = c / 10;\n }\nwhile ( e != 0)\n{\n r = e % 10;\n s = s * 10 + r;\n e = e / 10;\n}\nwhile (g != 0)\n {\n t = g % 10;\n u = u * 10 + t;\n g = g / 10;\n }\n while (l != 0)\n {\n v = l % 10;\n w = w * 10 + v;\n l = l / 10;\n }\n x = s + u;\n\nif (w == x)\n printf(\"YES\\n\");\nelse\n printf(\"NO\\n\");\n\n}\n"}, {"source_code": "#include\n#include\nmain()\n{\nchar x[100],y[100],z[100],m[100],n[100],p[100];\nint a,b,c,d,e,f,g,h,i,j;\nscanf(\"%s\",&x);\nscanf(\"%s\",&y);\n\n\na=atoi(x);\nb=atoi(y);\nc=a+b;\n\nfor(i=0,j=-1;i\n#include\nint func(int n);\nint main()\n{\n int n,m,sum;\n scanf(\"%d %d\",&n,&m);\n\n sum=n+m;\n int p=func(n);\n int q=func(m);\n int sum1=func(sum);\n if(sum1==p+q)printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}\nint func(int n){\n int i=1,sum=0,a;\n while(n>0){\n a=n%10;\n if(a!=0){\n sum+=a*i;\n i*=10;\n }\n n/=10;\n }\n return sum;\n}\n"}, {"source_code": "#include \n#include \n\nvoid main()\n{\n long long int c, d, f, g = 0, e = 0 ,a , b, k, l = 0, r, s = 0, t, u = 0, w = 0, v, x;\n scanf(\"%lld %lld\", &a, &b);\n c = a + b ;\n while(a != 0)\n {\n d = a % 10;\n if(d != 0)\n e =e * 10 + d;\n a = a / 10;\n }\n while(b != 0)\n {\n f = b % 10;\n if(f != 0)\n g = g * 10 + f;\n b = b / 10;\n }\n while (c != 0)\n {\n k = c % 10;\n if(k != 0)\n l = l * 10 + k;\n c = c / 10;\n }\nwhile ( e != 0)\n{\n r = e % 10;\n s = s * 10 + r;\n e = e / 10;\n}\nwhile (g != 0)\n {\n t = g % 10;\n u = u * 10 + t;\n g = g / 10;\n }\n while (l != 0)\n {\n v = l % 10;\n w = w * 10 + v;\n l = l / 10;\n }\n x = s + u;\n\nif (w == x)\n printf(\"YES\\n\");\nelse\n printf(\"NO\\n\");\n\n}\n"}, {"source_code": "int remove(int num)\n{\n int sum=0,t=1;\n while(num)\n {\n if(num%10)\n {\n sum = sum + (num%10)*t;\n t*=10;\n }\n num/=10;\n }\n return sum;\n}\nmain()\n{\n int a,b;\n scanf(\"%d%d\",&a,&b);\n if(remove(a+b) == remove(a)+remove(b)) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include\n#include\nmain()\n{\nchar x[100],y[100],z[100],m[100],n[100],p[100];\nint a,b,c,d,e,f,g,h,i,j;\nscanf(\"%s\",&x);\nscanf(\"%s\",&y);\n\n\na=atoi(x);\nb=atoi(y);\nc=a+b;\n\nfor(i=0,j=-1;i\n\nlong long int f(long long int a)\n{\n\tlong long int ret = 0;\n\twhile(a)\n\t{\n\t\tret = ret*10 + a%10;\n\t\tif(a%10 == 0)\n\t\t\tret/=10;\n\t\ta/= 10;\n\t}\n\treturn ret;\t\n}\n\nint main()\n{\n\tlong long int a,b;\n\tscanf(\"%lld %lld\",&a,&b);\n\tlong long int sum = a+b;\n\tif(f(f(a)) + f(f(b)) == f(f(sum)))\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n#include \n#include \nlong long int power(int a,int b)\n{\n long long int res=1,i;\n for(i=1;i<=b;i++)\n res=res*a;\n return res;\n}\nint main()\n{\n long long int a,b;\n scanf(\"%I64d %I64d\",&a,&b);\n long long int c=a+b;\n long long int a1=0,b1=0,c1=0,k=0;\n while(a>0)\n {\n if(a%10!=0)\n {\n a1=a1+(a%10)*power(10,k);\n k++;\n }\n a=a/10;\n }\n //printf(\"%I64d\\n\",a1);\n k=0;\n while(b>0)\n {\n if(b%10!=0)\n {\n b1=b1+(b%10)*power(10,k);\n k++;\n }\n b=b/10;\n }\n //printf(\"%I64d\\n\",b1);\n k=0;\n while(c>0)\n {\n if(c%10!=0)\n {\n c1=c1+(c%10)*power(10,k);\n k++;\n }\n c=c/10;\n }\n //printf(\"%I64d\\n\",c1);\n if(a1+b1==c1)\n printf(\"YES\\n\");\n else printf(\"NO\\n\");\n}"}, {"source_code": "#include \n\n\nint a,b,c,a1=0,b1=0,c1=0;\nint i=1,j=1;\n\nint main()\n{scanf(\"%d%d\",&a,&b);\nc=a+b;\nwhile(a>0)\n{if(a%10!=0)\n{a1+=(a%10)*j;j*=10;}\na/=10;\n} j=1;\nwhile(b>0)\n{if(b%10!=0)\n{b1+=(b%10)*j; j=j*10;}\nb/=10;\n} j=1;\nwhile(c>0)\n{if(c%10!=0)\n{c1+=(c%10)*j;\nj=j*10;}\nc/=10;\n}\nif(a1+b1==c1)\nprintf(\"YES\");\nelse\nprintf(\"NO\"); \n return 0;\n}"}, {"source_code": "#include \n\nvoid remove_zero (int *a)\n{\n\tchar s[11];\n\tint i, j;\n\n\tsprintf (s, \"%d\", *a);\n\n\tfor (i = 0, j = 0; s[i]; i++)\n\t\tif (s[i] != '0')\n\t\t\ts[j++] = s[i];\n\n\ts[j] = '\\0';\n\n\tsscanf (s, \"%d\", a);\n}\n\nint main()\n{\n\tint a, b, c;\n\n\tscanf (\"%d %d\", &a, &b);\n\n\tc = a + b;\n\n\tremove_zero (&a);\n\tremove_zero (&b);\n\tremove_zero (&c);\n\n\tputs (a + b == c ? \"YES\" : \"NO\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint f(int a) {\n\treturn a == 0 ? 0 : (a % 10 == 0 ? f(a / 10) : f(a / 10) * 10 + a % 10);\n}\n\nint main() {\n\tint a, b;\n\n\tscanf(\"%d%d\", &a, &b);\n\tprintf(\"%s\\n\", f(a) + f(b) == f(a + b) ? \"YES\" : \"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include\nlong long ulta(long long n)\n{\n\tlong long i=0,s=0;\n\twhile(n)\n\t{\n\t\tif ((n%10)!=0)\n\t\ts=s*10+n%10;\n\t\tn=n/10;\n\t}\n\treturn s;\n}\nint main()\n{\n\tlong long m,n,s,m1,n1,s1;\n\tscanf(\"%I64d %I64d\",&m,&n);\n\ts=m+n;\n\tm1=ulta(ulta(m));\n\tn1=ulta(ulta(n));\n\ts1=ulta(ulta(s));\n\tif ((m1+n1)==s1) printf(\"YES\");\n\telse printf(\"NO\");\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\nlong long int a,b,sum1,sum2,a1,b1,r,r1,r2,r3,r4,r5,rev1=0,rev2=0,rev3=0,rev4=0,rev5=0,rev6=0;\nscanf(\"%lld\",&a);\nscanf(\"%lld\",&b);\nsum1=a+b;\n//printf(\"%lld\",sum1);\na1=a;\nb1=b;\nwhile(a1!=0)\n{\n r=a1%10;\n if(r!=0)\n rev1=(rev1*10)+r;\n a1=a1/10;\n}\nwhile(rev1!=0)\n{\n r1=rev1%10;\n rev2=(rev2*10)+r1;\n rev1=rev1/10;\n }\n // printf(\"%lld\",rev2);\n while(b1!=0)\n{\n r2=b1%10;\n if(r2!=0)\n rev3=(rev3*10)+r2;\n b1=b1/10;\n}\nwhile(rev3!=0)\n{\n r3=rev3%10;\n rev4=(rev4*10)+r3;\n rev3=rev3/10;\n }\n // printf(\"%lld\\n\",rev4);\nsum2=rev2+rev4;\n//printf(\"%lld\",sum2);\n while(sum1!=0)\n{\n r4=sum1%10;\n if(r4!=0)\n rev5=(rev5*10)+r4;\n sum1=sum1/10;\n}\nwhile(rev5!=0)\n{\n r5=rev5%10;\n rev6=(rev6*10)+r5;\n rev5=rev5/10;\n }\n if(sum2==rev6)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \n__int64 re(__int64 a)\n{\n __int64 r=0,t=0;\n while(a)\n {\n if(a%10!=0)\n {\n r=r*10+a%10;\n }\n a=a/10;\n }\n while(r)\n {\n t=t*10+r%10;\n r=r/10;\n }\n return t;\n}\nint main()\n{\n __int64 x,y,a,b,c,z;\n while(scanf(\"%I64d%I64d\",&a,&b)!=EOF)\n {\n z=a+b;\n if((re(a)+re(b))==re(z))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include\nint a,b,c,a1,b1,c1,m,k,l=0,p;\nint main()\n{\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n c=a+b;\n a1=zero1(a);\n b1=zero1(b);\n c1=zero1(c);\n if(a1+b1==c1)\n printf(\"YES\");\n else printf(\"NO\");\n return(0);\n}\nint zero1(int n)\n{\n l=0;p=1;\n while(n!=0)\n {\n m=n%10;\n if(m!=0)\n {\n l=m*p+l;\n p*=10;\n }\n n/=10;\n }\n return(l);\n}\n"}, {"source_code": "#include\nint a,b,c,a1,b1,c1,m,k,l=0,p;\nint main()\n{\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n c=a+b;\n a1=zero1(a);\n b1=zero1(b);\n c1=zero1(c);\n if(a1+b1==c1)\n printf(\"YES\");\n else printf(\"NO\");\n return(0);\n}\nint zero1(int n)\n{\n l=0;p=1;\n while(n!=0)\n {\n m=n%10;\n if(m!=0)\n {\n l=m*p+l;\n p*=10;\n }\n n/=10;\n }\n return(l);\n}\n"}, {"source_code": "#include\n\nint f(int a)\n{\n int i=1,sum=0,rem;\n while(a!=0)\n {\n rem=a%10;\n if(rem) { sum+=rem*i; i=i*10; }\n a=a/10;\n\n }\n\n return sum;\n\n}\nint main()\n{\n int a,b,c;\n scanf(\"%d %d\",&a,&b);\n c=a+b;\n\n if(f(a)+f(b)==f(c)) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \nint main()\n{\n int a,b,c,d;\n scanf(\"%d%d\",&a,&b);\n c=a+b;\n d=removezeros(a)+removezeros(b);\n if(removezeros(c)==d) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}\nint removezeros (int x)\n{\n int count=0,i,nonzero=0,y,f=0,l=x;\n while (l>0)\n {\n l/=10;\n count++;\n }\n for(i=0;i\n#include \n#include \n\nlong long int removeZero(long long int x) {\n \n int digit;\n int num = 0;\n int ten = 1;\n \n while(x) {\n digit = x%10;\n x/=10;\n \n if(digit) {\n num += ten * digit;\n ten *=10;\n }\n }\n \n return num;\n \n \n}\n\nint main()\n{\n long long int a, b, c;\n \n scanf(\"%lld%lld\", &a, &b);\n \n c = a + b;\n \n a = removeZero(a);\n b = removeZero(b);\n c = removeZero(c);\n \n if(a+b == c)\n printf(\"YES\");\n \n else\n printf(\"NO\");\n \n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\nint result(int [],int,int);\nint cmpfunc(const void*a,const void*b)\n{\n return (*(int*)a - *(int*)b);\n}\nint main()\n{\n long long n,m,i,j,sum=0,k,c=0,max=0,min=0,d=0;\n int a[1000005],b[1000005];\n char ch[100001],chr[100001],st[100001],str[100001];\n gets(ch);\n gets(chr);\n n=atol(ch);\n m=atol(chr);\n k=n+m;\n ltoa(k,st,10);\n j=0;\n for(i=0;ch[i];i++)\n {\n if(ch[i]!='0')\n str[j++]=ch[i];\n }\n n=atol(str);\n memset(str,NULL,sizeof(str));\n j=0;\n for(i=0;chr[i];i++)\n {\n if(chr[i]!='0')\n str[j++]=chr[i];\n }\n m=atol(str);\n memset(str,NULL,sizeof(str));\n j=0;\n for(i=0;st[i];i++)\n {\n if(st[i]!='0')\n str[j++]=st[i];\n }\n k=atol(str);\n if(n+m==k)\n puts(\"YES\");\n else\n puts(\"NO\");\n return 0;\n}"}, {"source_code": "#include\n\nint removezero(int n);\nint removezero(int n)\n{\n int num=0,pow=1,reminder;\n\n while(n!=0)\n {\n reminder=n%10;\n n/=10;\n\n if(reminder!=0)\n {\n num+=reminder*pow;\n pow*=10;\n }\n }\n return num;\n}\n\nint main()\n{\n int a,b,c,A,B,C;\n scanf(\"%d %d\",&a,&b);\n c=a+b;\n A=removezero(a);\n B=removezero(b);\n C=removezero(c);\n\n if(A+B==C)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\nint main()\n{\n int a,b,c,d,e,f,g,h,i,j,l;\n char c1[100],c2[100],c3[100],c4[100],ch1,c5[100],c6[100];\n scanf(\"%s %s\",c1,c2);\n a=atoi(c1);\n b=atoi(c2);\n //printf(\"%d %d\\n\",a,b);\n c=a+b;\n //printf(\"%d\\n\",c);\n itoa(c,c5,10);\n {\n\n l=strlen(c1);\n j=0;\n for (i = 0; i \n#include \n#include\n#include\nint main()\n{\n char a[20]; char b[20]; char c[20];\n char a2[20]; char b2[20]; char c2[20];\n int i;\n scanf(\"%s\",a);\n scanf(\"%s\",b);\n int x=atoi(a)+atoi(b); //x=a+b with zeros\n itoa(x,c,10);\n int y=0;\n for(i=0;i\n\nint main(void) {\n \n int a, b, c;\n int removeZeros(int);\n \n scanf(\"%d\\n%d\", &a, &b);\n c = a+b;\n \n int new_a = removeZeros(a);\n int new_b = removeZeros(b);\n int new_c = removeZeros(c);\n \n if((new_a + new_b)==new_c)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n}\n\nint removeZeros(int x)\n{\n int newX=0;\n int pow = 1;\n int temp;\n \n while(x != 0)\n {\n temp = x%10;\n x = x/10;\n \n if(temp != 0)\n {\n newX = newX + (temp * pow);\n pow = pow * 10;\n }\n }\n return newX;\n}\n\n"}, {"source_code": "#include \nint main()\n{\n\tlong long int a, b, s, r, i, c, j, x[3];\n\n\tscanf(\"%lld %lld\", &a, &b);\n\tc=a+b;\n\t\n\tx[0]=a;\n\tx[1]=b;\n\tx[2]=c;\n\t\n\tfor(j=0; j<3; j++)\n\t{\n\t\tr=0;\n\t\ts=0;\n\t\tfor(i=1; i<=10; i++)\n \t{\n \t\tif(x[j]%10!=0)\n \t\t{\n\t\t\t if(r==0)\n\t\t \t{\n\t\t\t \ts=s+(x[j]%10);\n\t\t\t \tx[j]=x[j]/10;\n\t\t\t \tr++;\n\t\t \t}\n\t\t\t else\n\t\t \t{\n\t\t\t \ts=s+((x[j]%10)*r*10);\n\t\t\t \tx[j]=x[j]/10;\n\t\t\t \tr=r*10;\n\t\t \t}\n \t \t}\n \t\telse\n \t\t{\n\t\t \tx[j]=x[j]/10;\n\t \t}\n \t}\n \tx[j]=s;\n\t}\n\t\n\tif(x[0]+x[1]==x[2])\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\nvoid main()\n{\n long long int c, d, f, g = 0, e = 0 ,a , b, k, l = 0, r, s = 0, t, u = 0, w = 0, v, x;\n scanf(\"%lld %lld\", &a, &b);\n c = a + b ;\n while(a != 0)\n {\n d = a % 10;\n if(d != 0)\n e =e * 10 + d;\n a = a / 10;\n }\n while(b != 0)\n {\n f = b % 10;\n if(f != 0)\n g = g * 10 + f;\n b = b / 10;\n }\n while (c != 0)\n {\n k = c % 10;\n if(k != 0)\n l = l * 10 + k;\n c = c / 10;\n }\nwhile ( e != 0)\n{\n r = e % 10;\n s = s * 10 + r;\n e = e / 10;\n}\nwhile (g != 0)\n {\n t = g % 10;\n u = u * 10 + t;\n g = g / 10;\n }\n while (l != 0)\n {\n v = l % 10;\n w = w * 10 + v;\n l = l / 10;\n }\n x = s + u;\n\nif (w == x)\n printf(\"YES\\n\");\nelse\n printf(\"NO\\n\");\n\n}\n"}, {"source_code": "#include\nlong lav(long a)\n{\n\tlong t,res=0,mul=1;\n\twhile(a)\n\t{\n\t\tt=a%10;\n\t\tif(t!=0)\n\t\t{\n\t\t\t//res = res*10 + t;\n\t\t\tres = t*mul+res;\n\t\t\tmul = mul*10;\n\t\t}\n\t\ta=a/10;\n\t}\nreturn res;\n}\n\nint main()\n{\n\tlong a,b,c,res,y;\n\tscanf(\"%ld%ld\",&a,&b);\n\tc=a+b;\n\t//printf(\"%ld%ld%ld\\n\",lav(a),lav(b),lav(c));\n\tres=lav(a)+lav(b);\n y=lav(c);\n\n\tif(y==res)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\nreturn 0;\n}\n"}, {"source_code": "#include \nint degit_sum (int a);\nint main ()\n{\n int a,b,c;\n scanf (\"%d%d\",&a,&b);\n c = a + b;\n if (degit_sum(a) + degit_sum(b) == degit_sum (c))\n printf (\"YES\\n\");\n else\n printf (\"NO\\n\");\n}\nint degit_sum (int a)\n{\n int sum = 0, n = 1;\n while (a > 0)\n {\n if (a%10 == 0)\n {\n a /=10;\n continue;\n }\n sum = sum + (a%10)*n;\n n = n*10;\n a = a/10;\n }\n return sum;\n}\n"}, {"source_code": "#include\nint main()\n{\n int x,y,a,b,i,j,k,l;\n char str[20],str2[20];\n gets(str);\n gets(str2);\n x=atoi(str);\n y=atoi(str2);\n x=x+y;\n\n a=strlen(str);\n b=strlen(str2);\n for(i=0,j=0; i\n#include\n#include\n\nint withoutzeros(char str[105]) {\n int i, j = 0;\n char res[105];\n for (i = 0, j = 0; i < strlen(str); i++)\n if (str[i] != '0')\n res[j++] = str[i];\n res[j] = '\\0';\n return atoi(res);\n}\n\nint main(void) {\n char str1[105], str2[105], str3[105];\n int c1, c2;\n scanf(\"%s%s\", str1, str2);\n c1 = atoi(str1) + atoi(str2);\n sprintf(str3, \"%d\", c1);\n c1 = withoutzeros(str3);\n c2 = withoutzeros(str1) + withoutzeros(str2);\n //printf(\"%d %d\\n\", c1, c2);\n if (c1 == c2)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include \nint removeZeros(int x){\n int tens = 1;\n int sum = 0;\n while(x != 0){\n if (x%10 != 0){\n sum += x%10 *tens;\n tens *= 10 ;\n }\n x /= 10;\n }\n return sum;\n}\nint main (void){\n int x1,x2,sum;\n scanf(\"%d %d\",&x1,&x2);\n sum = x1 + x2;\n x1 = removeZeros(x1);\n x2 = removeZeros(x2);\n sum = removeZeros(sum);\n if(x1 + x2 == sum){\n printf(\"YES\");\n }else{\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include \n\n\nint a,b,c,a1=0,b1=0,c1=0;\nint i=1,j=1;\n\nint main()\n{scanf(\"%d%d\",&a,&b);\nc=a+b;\nwhile(a>0)\n{if(a%10!=0)\n{a1+=(a%10)*j;j*=10;}\na/=10;\n} j=1;\nwhile(b>0)\n{if(b%10!=0)\n{b1+=(b%10)*j; j=j*10;}\nb/=10;\n} j=1;\nwhile(c>0)\n{if(c%10!=0)\n{c1+=(c%10)*j;\nj=j*10;}\nc/=10;\n}\nif(a1+b1==c1)\nprintf(\"YES\");\nelse\nprintf(\"NO\"); \n return 0;\n}"}, {"source_code": "#include\"stdio.h\"\nint s(int n){\n\tint t=0,pw=1;\n\twhile(n){\n\t\tt+=(n%10)*pw;\n\t\tif(n%10)pw*=10;\n\t\tn/=10;\n\t} return t;\n}\nint main(){\n\tint a,b;\n\tscanf(\"%d%d\",&a,&b);\n\tputs(s(a+b)==s(a)+s(b)? \"YES\" : \"NO\");\n\treturn 0;\n}"}, {"source_code": "#include\n#include \n#include\n#include\nint main()\n{\n char a[20]; char b[20]; char c[20];\n char a2[20]; char b2[20]; char c2[20];\n int i;\n scanf(\"%s\",a);\n scanf(\"%s\",b);\n int x=atoi(a)+atoi(b); //x=a+b with zeros\n itoa(x,c,10);\n int y=0;\n for(i=0;i\nmain()\n{\n\n long long int a,b;\n scanf(\"%I64d\",&a);\n scanf(\"%I64d\",&b);\n long long int j=a+b;\n long long int sum5=0,sum6=0;\n long long int sum1=0,sum2=0;\n long long int sum3=0,sum4=0;\n while(a!=0)\n {\n if(a%10==0)\n {a=a/10;\n continue;}\n sum1=sum1*10;\n sum1=sum1+a%10;\n a=a/10;\n }\n while(b!=0)\n {\n if(b%10==0)\n {b=b/10;\n continue;}\n sum2=sum2*10;\n sum2=sum2+b%10;\n b=b/10;\n }\n while(sum1!=0)\n {\n sum3=sum3*10;\n sum3=sum3+sum1%10;\n sum1=sum1/10;\n }\n while(sum2!=0)\n {\n sum4=sum4*10;\n sum4=sum4+sum2%10;\n sum2=sum2/10;\n }\n while(j!=0)\n {\n if(j%10==0)\n {j=j/10;\n continue;}\n sum5=sum5*10;\n sum5=sum5+j%10;\n j=j/10;\n }\n while(sum5!=0)\n {\n sum6=sum6*10;\n sum6=sum6+sum5%10;\n sum5=sum5/10;\n }\n if(sum3+sum4==sum6)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n\n\n\n\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint a,b,c,d=0,e,f=0,i=1,j=1,x,k=1,g,h=0;\n\tscanf(\"%d %d\",&a,&b);\n\tx=a+b;\n \n\twhile(a!=0)\n\t{\n\t\tc=a%10;\n\t\ta=a/10;\n\t\td=d+c*i;\n\t\tif(c!=0)\n\t\t\ti=i*10;\n\t}\n \n\twhile(b!=0)\n\t{\n\t\te=b%10;\n\t\tb=b/10;\n\t\tf=f+e*j;\n\t\tif(e!=0)\n\t\t\tj=j*10;\n\t}\n \n \n\twhile(x!=0)\n\t{\n\t\tg=x%10;\n\t\tx=x/10;\n\t\th=h+g*k;\n\t\tif(g!=0)\n\t\t\tk=k*10;\n\t}\n \n\tif(h==d+f)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n}\n\n"}, {"source_code": "#include \n\nunsigned long int power( int base , int pwr )\n{\n\t\tif( pwr == 0 ) return 1 ;\n\t\t\n\t\treturn base*power( base , ( pwr - 1 ) ) ;\n}\n\n\nunsigned long int zeroStripper(unsigned long int arg)\n{\n \n\t\tunsigned long int strippedNum = 0 ;\n int i = 0 ;\n \n while(arg > 0)\n {\n if(arg % 10 != 0)\n \n {\n strippedNum += (arg % 10)*power( 10 , i ) ; \n i += 1 ;\n }\n \n arg /= 10 ;\n }\n \n\n return strippedNum ;\n}\n \n\n\n\nint main(void)\n{\n \n\t\tunsigned long int a , b , c ;\n \n scanf(\"%lu %lu\" ,&a ,&b );\n \n c = a + b ;\n \n if( zeroStripper(a) + zeroStripper(b) == zeroStripper(c) ) printf(\"YES\");\n else printf(\"NO\");\n \n return 0 ;\n\n}"}, {"source_code": "#include \n#include \n#include \n#include \n\nint remove_zero(int a)\n{ int r;\n char ch[1000000];\n char ch2[1000000];\n sprintf(ch,\"%d\",a);\n char ch1;\n int i=0;\n if (ch[strlen(ch-1)]=='0')\n ch[strlen(ch-1)]='\\0';\n\n while (ch[i]!='\\0')\n {\n if(ch[i]=='0')\n {\n strcpy(ch2,ch+i+1);\n ch[i]='\\0';\n strcat(ch,ch2);\n }\n else\n i++;\n }\n sscanf(ch,\"%d\",&r);\n return r;\n\n}\n\n\nint main()\n{\nint a,b;\n\ndo{\n\nscanf(\"%d\",&a);\n}while((a<1)||(a>pow(10,9)));\n\ndo{\nscanf(\"%d\",&b);\n}while((b<1)||(b>pow(10,9)));\n\nint c=a+b;\n\na=remove_zero(a);\nb=remove_zero(b);\nc=remove_zero(c);\n\n\n\n\nif((a+b)==c)\n printf(\"YES\");\nelse\n printf(\"NO\");\n return 0;\n}"}], "negative_code": [{"source_code": "#include\n\nint main()\n{\n\tlong long int x, y;\n\tscanf(\"%lld %lld\",&x,&y);\n\tlong long int a=x;\n\tlong long int b=y;\n\tlong long int r=0;\n\tlong long int j=0;\n\tlong long int f=0;\n\tlong long int g=0;\n\twhile(x!=0 && y!=0)\n\t{\n\t\tr=x%10;\n\t\tx=x/10;\n\n\t\tj=y%10;\n\t\ty=y/10;\n\n\t\tif (r==0)\n\t\t\tf=f+1;\n\t\tif (j==0)\n\t\t\tg=g+1;\n\t}\n\tif(f==0 && g==0)\n\t{\n\t\tprintf(\"YES\");\n\t\n\t}\n\telse if(f==g && f!=0 && g!=0)\n\t{\n\t\tlong long int z=a%10;\n long long int v=b%10;\n if(z+v<9 && z+v>=0)\n printf(\"YES\");\n else\n\t printf(\"NO\");\n\t}\n\n\telse if(f!=g)\n\t\tprintf(\"NO\");\n\n\treturn 0;\n}\n\n"}, {"source_code": "#include\n#include\n#include\n\nint main(){\n long i,j=0,k,m,n,x,y,z,o;\n char a[11],b[11],c[11],d[11],e[12],f[12],g[12];\n scanf(\"%s\",a);\n scanf(\"%s\",b);\n for(i=0;i\n\nint main(void){\n int a, b, c, x, y, z, ans;\n scanf(\"%d%d\", &a, &b);\n c = a+b;\n x = y = 0;\n int pot = 1;\n while(a > 9){\n x += pot*(a%10);\n if(a%10 != 0) pot*=10;\n a /= 10;\n }\n x += pot*a;\n pot = 1;\n while(b > 9){\n y += pot*(b%10);\n if(b%10 != 0) pot*=10;\n b /= 10;\n }\n y += pot*b;\n pot = 1;\n while(c > 9){\n z += pot*(c%10);\n if(c%10 != 0) pot*=10;\n c /= 10;\n }\n z += pot*c;\n printf(x+y == z ? \"YES\\n\":\"NO\\n\");\n return 0;\n}\n \n \n"}, {"source_code": "#include \n\n\nint zero(int n) {\n int r = 0;\n int c = 1;\n while (n) {\n n/=10;\n if(n%10){\n r += (n% 10) * c;\n c *= 10;\n }\n }\n return r;\n}\n\nint main(void) {\n int a, b, c;\n scanf(\"%d %d\",&a,&b);\n c=a+b;\n a=zero(a);\n b=zero(b);\n c=zero(c);\n if(a+b==c)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n\tlong long int x, y;\n\tscanf(\"%lld %lld\",&x,&y);\n\tlong long int a=x;\n\tlong long int b=y;\n\tlong long int r=0;\n\tlong long int j=0;\n\tlong long int f=0;\n\tlong long int g=0;\n\twhile(x!=0 && y!=0)\n\t{\n\t\tr=x%10;\n\t\tx=x/10;\n\n\t\tj=y%10;\n\t\ty=y/10;\n\n\t\tif (r==0)\n\t\t\tf=f+1;\n\t\tif (j==0)\n\t\t\tg=g+1;\n\t}\n\tif(f==0 && g==0)\n\t{\n\t\tprintf(\"YES\");\n\t\n\t}\n\telse if(f==g && f!=0 && g!=0)\n\t{\n\t\tlong long int z=a%10;\n long long int v=b%10;\n if(z+v<9 && z+v>1)\n printf(\"YES\");\n else\n\t printf(\"NO\");\n\t}\n\n\telse if(f!=g)\n\t\tprintf(\"NO\");\n\n\treturn 0;\n}\n\n"}, {"source_code": "#include\n#include\nint main(){\n char ar[15],br[15];\n int len,i;\n scanf(\"%s\",ar);\n scanf(\"%s\",br);\n len=strlen(ar)>strlen(br)?strlen(ar):strlen(br);\n for(i=0;i105) || ((ar[i]=='0') && ((br[i]!='0') && (br[i]!='\\0')))){\n printf(\"NO\");\n return 0;\n }\n }\n printf(\"YES\");\n return 0;\n \n}"}, {"source_code": "#include\n#include\n\n\nint main()\n\n{\n char x[10],y[10];\n int a,b,c,d,i,j;\n\n scanf(\"%s %s\",x,y);\n\n a=strlen(x);\n b=strlen(y);\n c=(ab)?a:b;\n\n for(i=a-c,j=b-c;i<=d&&j<=d;i++,j++)\n {\n if((x[i]=='0'&&y[j]!='0')||(x[i]!='0'&&y[j]=='0')) break;\n else if(x[i]=='0'&&y[j]=='0')\n {if(x[i+1]-48+y[j+1]-48>9) break;}\n\n else if(x[i]-48+y[j]-48==10) break;\n }\n\n if(i>d) printf(\"YES\");\n else printf(\"NO\");\n}\n"}, {"source_code": "#include \n\nint remove_zeros (int n)\n{\n\tint k;\n\tint l = 0;\n\tint reverse = 0;\n\twhile (n != 0)\n\t{\n\t\tk = n % 10;\n\t\tn = n / 10;\n\t\tif (k == 0)\n\t\t{\n\t\t\tcontinue;\n\t\t}\n\t\tl = 10 * l + k;\n\t}\n\treturn (l);\n}\n\nint main(int argc, char const *argv[])\n{\n\tint a, b, c_reduced, c_callculated;\n\n\tscanf(\"%d %d\", &a, &b);\n\tc_callculated = a + b;\n\ta = remove_zeros(remove_zeros(a));\n\tb = remove_zeros(remove_zeros(b));\n\tc_callculated = remove_zeros(remove_zeros(c_callculated));\n\tc_reduced = a + b;\n\tif (c_reduced == c_callculated)\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\n#include\n\nint main()\n{\n char a[15],b[15],c[15];\n int i,zero=0,cnt=0;\n\n scanf(\"%s\",a);\n scanf(\"%s\",b);\n int len;\n int len1=strlen(a);\n int len2=strlen(b);\n if(len1>len2)\n {\n len=len2;\n\n }\n else\n {\n len=len1;\n\n }\n\n int n1=0,n2=0,sum;\n\n int cnt1=0;\n while(a[cnt1]!='\\0')\n {\n int temp=a[cnt1]-'0';\n\n for(i=0; i\nint removezero(int no)\n{\n int sum=0;\n while(no>0)\n {\n if(no%10==0)\n {\n no/=10;\n continue;\n }\n sum=sum*10+no%10;\n no/=10;\n }\n return sum;\n}\nint main()\n{\n int a;\n int b;\n int c;\n scanf(\"%d%d\",&a,&b);\n c=a+b;\n if(removezero(removezero(c))==removezero(removezero(a))+removezero(removezero(b)))\n printf(\"YES\");\n else\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint remove_zeros (int n)\n{\n\tint k = 0;\n\tint pw = 1;\n\twhile (n)\n\t{\n\t\tk += (n % 10) * pw;\n\t\tif (n % 10)\n\t\t{\n\t\t\tpw *= 10;\n\t\t}\n\t\tn /= 10;\n\t}\n\treturn (k);\n}\n\nint main(int argc, char const *argv[])\n{\n\tint a, b;\n\tscanf(\"%d %d\", &a, &b);\n\tprintf(\"remove_zeros(a + b) %d\\n\", remove_zeros(a + b));\n\tprintf(\"(remove_zeros(a) + remove_zeros(b)) %d\\n\", (remove_zeros(a) + remove_zeros(b)));\n\tif (remove_zeros(a + b) == (remove_zeros(a) + remove_zeros(b)))\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n long a, b, n1, m1, n2, m2, a1, b1, t=0, i;\n scanf(\"%ld\",&a);\n scanf(\"%ld\",&b);\n a1=a;\n b1=b;\n if(a%10==0 && b%10==0)\n {\n printf(\"YES\");\n return 0;\n }\n do\n {\n a1=a1/10;\n b1=b1/10;\n t++;\n }while(a1!=0 && b1!=0);\n for(i=0;i=10)\n {\n printf(\"NO\");\n return 0;\n }\n }\n if(n1==0 && m1!=0)\n {\n printf(\"NO\");\n return 0;\n }\n if(n1!=0 && m1==0)\n {\n printf(\"NO\");\n return 0;\n }\n }\n printf(\"YES\");\n return 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int i,j,L1,L2;\n char Str1[15],Str2[15],Str3[15];\n scanf(\"%s %s\",Str1,Str2);\n L1=strlen(Str1);\n L2=strlen(Str2);\n if(L1=0;--i,--j)\n {\n if((Str1[j]=='0'&&Str2[i]=='0')||Str1[j]-'0'+Str2[i]<='9')\n {\n continue;\n }\n else\n {\n break;\n }\n }\n puts(i<0?\"YES\":\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint func(long long int d)\n{\n\tint num,x=0,i=0;\n\twhile(d>0)\n\t{\n\tnum=d%10;\n\td=d/10;\n\tif(num!=0)\n\t{\n\t\tx=x+num*pow(10,i);\n\t\ti++;\n\t}\n}\nreturn x;\n}\nint main()\n{\n\tlong long int a,b,c1,c2;\n\tscanf(\"%d%d\",&a,&b);\n\tc1=a+b;\n\ta=func(a);\n\tb=func(b);\n\tc1=func(c1);\n\tc2=a+b;\n\tif(c1==c2)\n\tprintf(\"YES\");\n\telse\n\tprintf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include\n#include\n\nint main()\n{\n char a[10],b[10];\n int i,zero=0,cnt=0;\n\n scanf(\"%s\",a);\n scanf(\"%s\",b);\n\n int len1=strlen(a);\n int len2=strlen(b);\n\n for(i=0;i='5'&&b[i]<'9'-'5'||a[i]<'5'&&b[i]<'5'||a[i]<'9'-'5'&&b[i]>='5')\n continue;\n else {\n cnt++;\n printf(\"NO\\n\");\n return 0;\n }\n\n }\n if(cnt==0)\n printf(\"YES\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n\nint main(){\n long long int i,j=0,k,m,n,x,y,z,o;\n char a[11],b[11],c[11],d[11],e[12],f[12],g[12];\n scanf(\"%s\",a);\n scanf(\"%s\",b);\n for(i=0;i<=strlen(a);i++){\n if(a[i]=='0')\n continue;\n c[j]=a[i];\n j++;\n\n }\n c[j]='\\0';\n j=0;\n for(i=0;i<=strlen(b);i++){\n if(b[i]=='0')\n continue;\n d[j]=b[i];\n j++;\n\n }\n d[j]='\\0';\n j=0;\n x=atoll(a);\n y=atoll(b);\n z=x+y;\n sprintf(e,\"%lld\",&z);\n\n for(i=0;i<=strlen(e);i++){\n if(e[i]=='0')\n continue;\n f[j]=e[i];\n j++;\n\n }\n f[j]='\\0';\n\n m=atoll(c);\n n=atoll(d);\n o=m+n;\n sprintf(g,\"%lld\",&o);\n\n printf(\"%s\\n%s\\n%s\\n%s\",e,f,c,d);\n if(!strcmp(f,g))\n printf(\"yes\");\n else\n printf(\"no\");\n\n}\n"}, {"source_code": "\n #include \n\n void removeZeros(int num1, int num2)\n {\n int sum = num1 + num2;\n int temp1 = 0;\n int temp2 = 0;\n int temp3 = 0;\n int i = 1;\n int ans1,ans2;\n\n while(num1 != 0)\n {\n if(num1%10 != 0 )\n {\n temp1 += (num1%10)*i;\n i *= 10;\n }\n num1 /= 10;\n }\n i = 1;\n while(num2 != 0)\n {\n if(num2%10 != 0)\n {\n temp2 += (num2%10)*i;\n i *= 10;\n }\n num2 /= 10;\n }\n i = 1;\n while( sum != 0)\n {\n if(sum%10 != 0)\n {\n temp3 += (sum%10)*i;\n i *= 10;\n }\n sum /= 10;\n }\n ans1 = temp1 + temp2;\n ans2 = temp3;\n if(ans1 == ans2)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n}\nint main()\n{\n removeZeros(105,206);\n return 0;\n}"}, {"source_code": "#include\n#include\n\nint main()\n{\n char a[10],b[10],c[10];\n int i,zero=0,cnt=0;\n\n scanf(\"%s\",a);\n scanf(\"%s\",b);\n int len;\n int len1=strlen(a);\n int len2=strlen(b);\n if(len1>len2)\n {\n len=len2;\n// for(i=len2; i\n#include\nlong long int removed(long long int a);\nint main()\n{\n long long int a,b;\n scanf(\"%I64d%I64d\",&a,&b);\n if(a==999999999)\n {\n if(b==a)\n {\n printf(\"YES\");\n return 0;\n }\n }\n if(a==123456)\n {\n if(b==876543)\n {\n printf(\"YES\");\n return 0;\n }\n }\n long long int c,d,e,f;\n c=a+b;\n f=removed(c);\n d=removed(a);\n e=removed(b);\n if((e+d)==f)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\nlong long int removed(long long int a)\n{\n long long int x[100],j=0,sum=0;\n while(a!=0)\n {\n int k;\n k=a%10;\n if(k!=0)\n {\n x[j]=k;\n j++;\n }\n a=a/10;\n }\n for(int i=0;i\nlong long int removed(long long int a);\nint main()\n{\n long long int a,b;\n scanf(\"%I64d%I64d\",&a,&b);\n long long int c,d,e,f;\n c=a+b;\n f=removed(c);\n d=removed(a);\n e=removed(b);\n if((e+d)==f)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\nlong long int removed(long long int a)\n{\n long long int x[100],j=0,sum=0;\n while(a!=0)\n {\n int k;\n k=a%10;\n if(k!=0)\n {\n x[j]=k;\n j++;\n }\n a=a/10;\n }\n for(int i=0;i\n\nint f(int a)\n{\n\tint ret = 0;\n\twhile(a)\n\t{\n\t\tret = ret*10 + a%10;\n\t\tif(a%10 == 0)\n\t\t\tret/=10;\n\t\ta/= 10;\n\t}\n\treturn ret;\t\n}\n\nint main()\n{\n\tint a,b;\n\tscanf(\"%d %d\",&a,&b);\n\tint sum = a+b;\n\tif(f(f(a)) + f(f(b)) == f(f(sum)))\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\treturn 0;\n}"}, {"source_code": " #include \n\n void removeZeros(int num1, int num2)\n {\n int sum = num1 + num2;\n int temp1 = 0;\n int temp2 = 0;\n int temp3 = 0;\n int i = 1;\n\n while(num1 != 0)\n {\n if(num1%10 != 0 )\n {\n temp1 += (num1%10)*i;\n i *= 10;\n }\n num1 /= 10;\n }\n i = 1;\n while(num2 != 0)\n {\n if(num2%10 != 0)\n {\n temp2 += (num2%10)*i;\n i *= 10;\n }\n num2 /= 10;\n }\n i = 1;\n while( sum != 0)\n {\n if(sum%10 != 0)\n {\n temp3 += (sum%10)*i;\n i *= 10;\n }\n sum /= 10;\n }\n if((temp1 + temp2)==temp3)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n}\nint main()\n{\n removeZeros(105,206);\n return 0;\n}"}, {"source_code": "#include \n#include \nlong int main()\n{\n long long int a,b;\n scanf(\"%I64d\\n\",&a);\n scanf(\"%I64d\",&b);\nlong long int c=a+b;\n long long int i,j,k=0,l,p,q,t,mod;\n i=a,p=0,t=0,j=b,l=0,q=0;\n while(i>0)\n {\n mod=i%10;\n if(mod!=0)\n {\n p+=mod*pow(10,t);\n t++;\n }\n i/=10;\n }\n \n while(j>0)\n {\n mod=j%10;\n if(mod!=0)\n {\n q+=mod*pow(10,l);\n l++;\n }\n j/=10;\n }\n long long int u=c,m;\n long long int w=0;\n while(u>0)\n {\n mod=u%10;\n if(mod!=0)\n {\n w+=mod*pow(10,k);\n k++;\n }\n u/=10;\n }\n m=p+q;\n if(w==m)\n printf(\"YES\");\n else \n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include \n#include \nint main()\n{\n int i,n,j,x,y,z=0,l1,l2,a1,a2,b1,b2,c1,c2;\n scanf(\"%d %d\",&a1,&b1);\n c1=a1+b1;\n a2=0,b2=0,y=0;\n while(a1!=0) {\n x=a1%10;\n a1=a1/10;\n if(x==0) {\n continue;\n }\n a2+=x*(pow(10,z));\n z++;\n }\n z=0;\n while(b1!=0) {\n x=b1%10;\n b1=b1/10;\n if(x==0) {\n continue;\n }\n b2+=x*(pow(10,z));\n z++;\n }\n z=0;\n while(c1!=0) {\n x=c1%10;\n c1=c1/10;\n if(x==0) {\n continue;\n }\n y+=x*(pow(10,z));\n z++;\n }\n c2=a2+b2;\n if(y==c2) {\n printf(\"YES\\n\");\n }\n else{\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\nint main(){\nint a,b,c,a1,b1,c1,a2,i,b2,c2;\nscanf(\"%d%d\",&a,&b);\nif(a==999999999&&b==999999999){\n printf(\"YES\");\n}\nelse{\nc=a+b;\n/*printf(\"%d %d %d\\n\",a,b,c);*/\n i=0;\n a1=0;\n while(a>0){\n a2=a%10;\n if(a2==0){\n a=a/10;\n continue;\n }\n else{\n a1=a1+a2*pow(10,i);\n i++;\n }\na=a/10;\n }\n \n i=0;\n b1=0;\n while(b>0){\n b2=b%10;\n if(b2==0){\n b=b/10;\n continue;\n }\n else{\n b1=b1+b2*pow(10,i);\n i++;\n }\nb=b/10;\n }\n i=0;\n c1=0;\n while(c>0){\n c2=c%10;\n if(c2==0){\n c=c/10;\n continue;\n }\n else{\n c1=c1+c2*pow(10,i);\n i++;\n }\nc=c/10;\n }\n/*printf(\"%d %d %d\\n\",a1,b1,c1);*/\nif(c1==(a1+b1)){\n printf(\"YES\");\n}\nelse if(c1!=(a1+b1)){\n printf(\"NO\");\n}\n}\n}"}, {"source_code": "#include\n#include\n\n\nint main()\n\n{\n char x[10],y[10];\n int a,b,c,d,i,j;\n\n scanf(\"%s %s\",x,y);\n\n a=strlen(x);\n b=strlen(y);\n c=(ab)?a:b;\n\n for(i=a-c,j=b-c;i<=d&&j<=d;i++,j++)\n {\n if((x[i]=='0'&&y[j]!='0')||(x[i]!='0'&&y[j]=='0')) break;\n else if(x[i]=='0'&&y[j]=='0')\n {if(x[i+1]-48+y[j+1]-48>9) break;}\n\n else if(x[i]-48+y[j]-48==10) break;\n }\n\n if(i>d) printf(\"YES\");\n else printf(\"NO\");\n}\n"}, {"source_code": "#include\n#include\n#include\n\nint withoutzeros(char str[105]) {\n int i, j = 0;\n char res[105];\n for (i = 0, j = 0; i < strlen(str); i++)\n if (str[i] != '0')\n res[j++] = str[i];\n res[j] = '\\0';\n return atoi(res);\n}\n\nint main(void) {\n char str1[105], str2[105], str3[105];\n int c1, c2;\n scanf(\"%s%s\", str1, str2);\n c1 = atoi(str1) + atoi(str2);\n sprintf(str3, \"%d\", c1);\n c1 = withoutzeros(str3);\n c2 = withoutzeros(str1) + withoutzeros(str2);\n sprintf(str3, \"%d\", c2);\n c2 = withoutzeros(str3);\n if (c1 == c2)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include\n#include\n\nlong long int fun(long long int n)\n{\n\tlong long int p=1,k,dig=0,z,i,a,new=0;\n\n\tz=n;\n\n\twhile(z>0)\n\t{\n\t\tdig++;\n\t\tz=z/10;\n\t}\n\n\tz=n;\n\n\tfor(i=dig-1;i>=0;i--)\n\t{\n\t\tfor(k=1;k<=i;k++)\n\t\t\tp=p*10;\n\n\t\ta=z/p;\n\t\tif(a!=0)\n\t\tnew=new*10+a;\n\n\t\tz=z-a*p;\n\t\tp=1;\n\n\t}\n\n\treturn new;\n}\n\nint main()\n{\n\tlong long int a1,b1,c1,a2,b2,c2;\n\n\tscanf(\"%I64d%I64d\",&a1,&b1);\n\n\tc1=a1+b1;\n\n\ta2=fun(a1);\n\tb2=fun(b1);\n\tc2=fun(c1);\n\tprintf(\"%I64d %I64d %I64d\",a2,b2,c2);\n\n\tif(a2+b2==c2)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\nlong long int a,b,c;\nscanf(\"%I64d %I64d\",&a,&b);\nif((a%10==0&&b%10!=0)||(a%10!=0&&b%10==0))\n{\n //printf(\"ffff\\n\");\n printf(\"NO\");\nreturn 0;\n}\nwhile(a!=0&&b!=0)\n {\n if((a%10==0&&b%10!=0)||(a%10!=0&&b%10==0))\n {\n //printf(\"gggg\\n\");\n printf(\"NO\");\n return 0;\n }\n if((a%10)+(b%10)>10)\n {\n a/=10;\n b/=10;\n if((a%10==0||b%10==0)&&a/10!=0&&b/10!=0)\n {\n // printf(\"sssss\\n\");\n\n printf(\"NO\");\n return 0;\n }\n }\n a/=10;\n b/=10;\n }\n //printf(\"tttt\\n\");\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include \n\nint min(int a, int b, int c)\n{\n int m = a;\n if (b < m) m = b;\n if (c < m) m = c;\n\n return m;\n}\n\nint main()\n{\n int x, y, z, k, a = 1, b = 1, c = 1, i;\n\n scanf(\"%d %d %d %d\", &x, &y, &z, &k);\n\n for (i = 0; i < k; i++) {\n\t if (a == x && b == y && c == z) break;\n\t if (a == x && b == y) {\n\t c++;\n\t } else if (b == y && c == z) {\n\t a++;\n\t } else if (c == z && a == x) {\n\t b++;\n\t } else if (a == x) {\n\t if (b < c) {\n\t\t b++;\n\t } else {\n\t\t c++;\n\t }\n\t } else if (b == y) {\n\t if (a < c) {\n\t\t a++;\n\t } else {\n\t\t c++;\n\t }\n\t } else if (c == z) {\n\t if (a < b) {\n\t\t a++;\n\t } else {\n\t\t b++;\n\t }\n\t } else if (min(a, b, c) == a) {\n\t a++;\n\t } else if (min(a, b, c) == b) {\n\t b++;\n\t } else if (min(a, b, c) == c) {\n\t c++;\n\t }\n }\n\n printf(\"%I64d\\n\", (long long int)a * b * c);\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int i,j,k=0,l,m,n,p=0,q=0,r=0,t;\n scanf(\"%d%d\",&m,&n);\n l=m+n;\n while(m>0)\n {\n t=m%10;\n if(m%10!=0)\n {\n j=k;\n while(j>0)\n {\n t=t*10;\n j--;\n }\n p=p+t;\n k++;\n }\n m=m/10;\n }\n k=0;\n while(n>0)\n {\n t=n%10;\n if(n%10!=0)\n {\n j=k;\n while(j>0)\n {\n t=t*10;\n j--;\n }\n r=r+t;\n k++;\n }\n n=n/10;\n }\n k=0;\n while(l>0)\n {\n t=l%10;\n if(l%10!=0)\n {\n j=k;\n while(j>0)\n {\n t=t*10;\n j--;\n }\n q=q+t;\n k++;\n }\n l=l/10;\n }\n printf(\"%d\\n%d\\n%d\",p,r,q);\n if(p+r==q)\n printf(\"\\nYES\");\n else printf(\"\\nNO\");\n return 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n long a, b, n1, m1, n2, m2;\n scanf(\"%ld\",&a);\n scanf(\"%ld\",&b);\n do\n {\n n1=a%10;\n m1=b%10;\n a=a/10;\n b=b/10;\n n2=a%10;\n m2=b%10;\n if(n2==m2 && n2==0)\n {\n if(n1+m1>=10)\n {\n printf(\"NO\");\n return 0;\n }\n }\n }while(n2!=0 && m2!=0);\n printf(\"YES\");\n return 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n\tlong long int x, y;\n\tscanf(\"%lld %lld\",&x,&y);\n\tlong long int a=x;\n\tlong long int b=y;\n\tlong long int r=0;\n\tlong long int j=0;\n\tlong long int f=0;\n\tlong long int g=0;\n\twhile(x!=0 && y!=0)\n\t{\n\t\tr=x%10;\n\t\tx=x/10;\n\n\t\tj=y%10;\n\t\ty=y/10;\n\n\t\tif (r==0)\n\t\t\tf=f+1;\n\t\tif (j==0)\n\t\t\tg=g+1;\n\t}\n\tif(f==0 && g==0)\n\t{\n\t\tlong long int s=a+b;\n\t\tif(s%10==0)\n\t\t\tprintf(\"NO\");\n\t\telse \n\t\t\tprintf(\"YES\");\n\t\n\t}\n\telse if(f==g && f!=0 && g!=0)\n\t{\n\t\tlong long int z=a%10;\n long long int v=b%10;\n if(z+v<9 && z+v>=0)\n printf(\"YES\");\n else\n\t printf(\"NO\");\n\t}\n\n\telse if(f!=g)\n\t\tprintf(\"NO\");\n\n\treturn 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n int i,j,k=0,l,m,n,p=0,q=0,r=0,t;\n scanf(\"%d%d\",&m,&n);\n l=m+n;\n while(m>0)\n {\n t=m%10;\n if(m%10!=0)\n {\n j=k;\n while(j>0)\n {\n t=t*10;\n j--;\n }\n p=p+t;\n k++;\n }\n m=m/10;\n }\n k=0;\n while(n>0)\n {\n t=n%10;\n if(n%10!=0)\n {\n j=k;\n while(j>0)\n {\n t=t*10;\n j--;\n }\n r=r+t;\n k++;\n }\n n=n/10;\n }\n k=0;\n while(l>0)\n {\n t=l%10;\n if(l%10!=0)\n {\n j=k;\n while(j>0)\n {\n t=t*10;\n j--;\n }\n q=q+t;\n k++;\n }\n l=l/10;\n }\n printf(\"%d\\n%d\\n%d\",p,r,q);\n if(p+r==q)\n printf(\"\\nYES\");\n else printf(\"\\nNO\");\n return 0;\n}"}, {"source_code": "#include\nlong long lav(long long a)\n{\n long long t,res=0,mul=1;\n while(a)\n {\n t=a%10;\n if(t!=0)\n {\n //res = res*10 + t;\n res = t*mul+res;\n mul = mul*10;\n }\n a=a/10;\n }\nreturn res;\n}\n\nint main()\n{\n long long a,b,c,res;\n scanf(\"%lld%lld\",&a,&b);\n c=a+b;\n //printf(\"%lld %lld\\n\",lav(a),lav(b));\n res=lav(a)+lav(b);\n if(lav(c)==res)\n printf(\"YES\");\n else\n printf(\"NO\");\nreturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int i, Num1,num1_,Num2,num2_,additionSum,additionSum_,digits1=0,digits2=0,sumDigits=0,j,lastttt;\n scanf(\"%i %i\",&Num1,&Num2);\n additionSum=Num1+Num2;\n additionSum_=additionSum;\n num1_=Num1;\n num2_=Num2;\n//printf(\"%i\\n\",additionSum);\n while(additionSum_!=0)\n {\n sumDigits++;\n additionSum_=additionSum_/10;\n }\n while(num1_!=0)\n {\n digits1++;\n num1_=num1_/10;\n }\n while(num2_!=0)\n {\n digits2++;\n num2_=num2_/10;\n }\n int number1array[digits1],number2array[digits2],sumArray[sumDigits];\n for (i=digits1-1; i>=0; i--)\n {\n number1array[i]=Num1%10;\n Num1=Num1/10;\n number2array[i]=Num2%10;\n Num2=Num2/10;\n\n }\n for (i=sumDigits-1; i>=0; i--)\n {\n sumArray[i] =additionSum%10;\n additionSum=additionSum/10;\n }\n int temp,temp1;\n for (i=0; i=0; j--)\n {\n if (number1array[j]==0 && j!=0 )\n {\n temp=number1array[j-1];\n number1array[j-1]=number1array[j];\n number1array[j]=temp;\n }\n\n }\n }\nfor (i=0; i=0; j--)\n {\n\n if (number2array[j]==0 && j!=0 )\n {\n temp1=number2array[j-1];\n number2array[j-1]=number2array[j];\n number2array[j]=temp1;\n }\n }\n }\n\n for (i=0; i=0; j--)\n {\n if (sumArray[j]==0 && j!=0 )\n {\n temp=sumArray[j-1];\n sumArray[j-1]=sumArray[j];\n sumArray[j]=temp;\n }\n }\n }\n\n int ten=1;\n int sum1=0,sum2=0,sum3=0,x;\n for (i=digits1-1;i>=0;i--)\n {\n x=number1array[i] *ten;\n ten=ten*10;\n sum1=sum1+x;\n }\nten=1;\n for (i=digits2-1;i>=0;i--)\n {\n x=number2array[i] *ten;\n ten=ten*10;\n sum2=sum2+x;\n }\n ten=1;\n for (i=digits1-1;i>=0;i--)\n {\n x=sumArray[i] *ten;\n ten=ten*10;\n sum3=sum3+x;\n }\n\n//for (i=0; i\ntypedef struct ZeroLife{\n unsigned int a, b;\n unsigned short Correct;\n void (*Inite)(struct ZeroLife*);\n void (*IsCorrect)(struct ZeroLife*);\n void (*DisplayMs)(struct ZeroLife*);\n\n}ZeroLife;\nvoid Inite(ZeroLife*);\nvoid IsCorrect(ZeroLife*);\nvoid DisplayMs(ZeroLife*);\nint main()\n{\n ZeroLife s;\n s.Inite = Inite, s.Inite(&s), s.IsCorrect(&s), s.DisplayMs(&s);\n return 0;\n}\nvoid Inite(ZeroLife* s){\n s->DisplayMs = DisplayMs, s->IsCorrect = IsCorrect;\n scanf(\"%u%u\", &s->a, &s->b);\n}\nvoid IsCorrect(ZeroLife* s){\n unsigned int max, min;\n max = s->a > s->b ? s->a : s->b;\n min = s->a < s->b ? s->a : s->b;\n unsigned short x1, y1, sum1, x2, y2;\n while(min / 10){\n x1 = min % 10, y1 = max % 10;\n sum1 = x1 + y1;\n x2 = (min / 10) % 10, y2 = (max / 10) % 10;\n if( (!x1 && y1) || (!y1 && x1) || ( (sum1 > 9) && (!x2 || !y2) ) ){ s->Correct = 0; return; }\n min /= 10, max /= 10;\n }\n s->Correct = 1;\n}\nvoid DisplayMs(ZeroLife* s){\n 1 == s->Correct ? printf(\"YES\") : printf(\"NO\");\n}\n"}, {"source_code": "#include\nint main()\n{\n int c,d;\n int a,b;\n scanf(\"%d%d\",&a,&b);\n c = a+b;\n if((c/10)%2==0 && (a/10)%5==0 && (b/10)%5==0)\n {\n\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nlong long int A(long long int a)\n{\n\tlong long b, c;\n\n\tb = 0;\n\tc = 0;\n\twhile (a) {\n\t\tif (a % 10)\n\t\t\tb = a % 10 * pow(10, c++) + b;\n\t\ta /= 10;\n\t}\n\n\treturn b;\n}\n\nint main()\n{\n\tlong long a, b;\n\n\tscanf(\"%lld%lld\", &a, &b);\n\tif (A(a + b) == A(a) + A(b))\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nmain()\n{\n\tlong long int a,b,sum=0,c1=0,c2=0;\n\tscanf(\"%I64d\",&a);\n\tscanf(\"%I64d\",&b);\n\tsum+=(a+b);\nwhile(a)\n{\n\tint r1=sum%10;\n\tif(r1==0)\n\t{\n\t\tc1++;\n\t}\n\tint r2=a%10;\n\tint r3=b%10;\n\tif(r2==0 && r3==0)\n\t{\n\t\tc2++;\n\t}\n\tif((r2==0 && r3==0) && r1!=0)\n\t{\n\t\tprintf(\"NO\");\n\t\texit(0);\n\t}\n\tif(r2!=0 && r1==0)\n\t{\n\t\tprintf(\"NO\");\n\t\texit(0);\n\t}\n\tif(r1==0 && r2!=0)\n\t{\n\t\tprintf(\"NO\");\n\t\texit(0);\n\t}\n\tsum/=10;\n\ta/=10;\n\tb/=10;\n}\nif(c1>c2)\n{\n\tprintf(\"NO\");\n}\nelse\nprintf(\"YES\");\t\n}"}, {"source_code": "#include \n#include \nint main()\n{\n\tint a,b,c,g,i,j,k,o,l,s,n,e,f;\n\tint ara[100000];\n\tint arar[100000];\n\tint ar[100000];\n\tscanf(\"%d\",&a);\n\tscanf(\"%d\",&b);\n\tc=a+b;\n\ti=0;\n\twhile(a!=0){\n\t\tg=a%10;\n\t\tif (g!=0){\n\t\t\tara[i]=g;\n\t\t\ti=i+1;\n\t\t}\n\t\ta=a/10;\n\t\t\n\t}\n\tj=0;\n\twhile(b!=0){\n\t\tg=b%10;\n\t\tif (g!=0){\n\t\t\tarar[j]=g;\n\t\t\tj=j+1;\n\t\t}\n\t\tb=b/10;\n\t\t\n\t}\n\tl=0;\n\twhile(c!=0){\n\t\tg=c%10;\n\t\tif (g!=0){\n\t\t\tar[l]=g;\n\t\t\tl=l+1;\n\t\t}\n\t\tc=c/10;\n\t\t\n\t}\n\t\n\ts=0;\n\tfor(o=i-1;o>=0;o--){\n\t\tn=pow(10,o);\n\t\ts=s+(ara[o])*n;\n\t}\n\te=0;\n\tfor(o=j-1;o>=0;o--){\n\t\tn=pow(10,o);\n\t\te=e+(arar[o])*n;\n\t}\n\tf=0;\n\tfor(o=l-1;o>=0;o--){\n\t\tn=pow(10,o);\n\t\tf=f+(ar[o])*n;\n\t}\n\tif (s+e==f){\n\t\tprintf(\"YES\");\n\t}\n\telse{\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint remove_zeros(int number);\n\nint main (int argc, char *argv[]) {\n\tint a, b;\n\t\n\tscanf(\"%d %d\", &a, &b);\n\tif (a < 1 || a > 1000000000 || b < 1 || b > 1000000000) {\n\t\tprintf(\"Input error!\");\n\t\treturn 1;\n\t}\t\n\tprintf (\"%s\\n\", ((remove_zeros(a) + remove_zeros(b)) == remove_zeros(a + b)) ? \"YES\" : \"NO\");\n\treturn 0;\n}\n\nint remove_zeros(int number) {\n\tint i, j;\n\tint modified_number = 0;\n\tint dec;\n\t\n\tif (number > 0 && number < 10) {\n\t\treturn number;\n\t}\n\tdec = number % 10;\n\tfor (i = 1, j = 1; i < number; i *= 10) {\n\t\tif (dec != 0) {\n\t\t\tmodified_number += dec * j;\n\t\t\tj *= 10;\n\t\t}\n\t\tdec = (number % (i * 10)) / i;\n\t}\n\treturn modified_number;\n}\n"}, {"source_code": "#include\n#include\nint main(){\n char ar[15],br[15];\n int len,i;\n scanf(\"%s\",ar);\n scanf(\"%s\",br);\n len=strlen(ar)>strlen(br)?strlen(ar):strlen(br);\n for(i=0;i105) || ((ar[i]=='0') && ((br[i]!='0') && (br[i]!='\\0')))){\n printf(\"NO\");\n return 0;\n }\n }\n printf(\"YES\");\n return 0;\n \n}"}, {"source_code": "#include \n#include \nint main()\n{\n long int a,b;\n scanf(\"%d\\n\",&a);\n scanf(\"%d\",&b);\n long int c=a+b;\n long int i,j,k=0,l,p,q,t,mod;\n i=a,p=0,t=0,j=b,l=0,q=0;\n while(i>0)\n {\n mod=i%10;\n if(mod!=0)\n {\n p+=mod*pow(10,t);\n t++;\n }\n i/=10;\n }\n \n while(j>0)\n {\n mod=j%10;\n if(mod!=0)\n {\n q+=mod*pow(10,l);\n l++;\n }\n j/=10;\n }\n long int u=c;\n long int w=0;\n while(u>0)\n {\n mod=u%10;\n if(mod!=0)\n {\n w+=mod*pow(10,k);\n k++;\n }\n u/=10;\n }\n if(w==(p+q))\n printf(\"YES\");\n else \n printf(\"NO\");\n}"}, {"source_code": "#include \n#include \n#include \n#include \n\nint remove_zero(int a)\n{ int r;\n char ch[1000000];\n char ch2[1000000];\n sprintf(ch,\"%d\",a);\n char ch1;\n int i=0;\n while (ch[i]!='\\0')\n {\n if(ch[i]=='0')\n {\n strcpy(ch2,ch+i+1);\n ch[i]='\\0';\n strcat(ch,ch2);\n }\n else\n i++;\n }\n sscanf(ch,\"%d\",&r);\n return r;\n\n}\n\n\nint main()\n{\nint a,b;\n\ndo{\nprintf(\"donner a \\n\");\nscanf(\"%d\",&a);\n}while((a<1)||(a>pow(10,9)));\n\ndo{\nprintf(\"donner b \\n\");\nscanf(\"%d\",&b);\n}while((b<1)||(b>pow(10,9)));\n\nint c=a+b;\n\na=remove_zero(a);\nb=remove_zero(b);\nc=remove_zero(c);\n\nif((a+b)==c)\n printf(\"YES\");\nelse\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\nint main()\n{\n char a[11],b[11],c[11];\n gets(a);\n gets(b);\n long int a1,b1,c1,a2,b2,c2,c3;\n a1=atoi(a);\n b1=atoi(b);\n c1=b1+a1;\n sprintf(c,\"%ld\",c1);\n int i,j;\n for(i=0;i\n#include\n\nint main()\n{\n char a[10],b[10],c[10];\n int i,zero=0,cnt=0;\n\n scanf(\"%s\",a);\n scanf(\"%s\",b);\n int len;\n int len1=strlen(a);\n int len2=strlen(b);\n if(len1>len2)\n {\n len=len2;\n// for(i=len2; i\n#include \nlong int main()\n{\n long long int a,b;\n scanf(\"%I64d\\n\",&a);\n scanf(\"%I64d\",&b);\nlong long int c=a+b;\n long long int i,j,k=0,l,p,q,t,mod;\n i=a,p=0,t=0,j=b,l=0,q=0;\n while(i>0)\n {\n mod=i%10;\n if(mod!=0)\n {\n p+=mod*pow(10,t);\n t++;\n }\n i/=10;\n }\n \n while(j>0)\n {\n mod=j%10;\n if(mod!=0)\n {\n q+=mod*pow(10,l);\n l++;\n }\n j/=10;\n }\n long long int u=c,m;\n long long int w=0;\n while(u>0)\n {\n mod=u%10;\n if(mod!=0)\n {\n w+=mod*pow(10,k);\n k++;\n }\n u/=10;\n }\n m=p+q;\n if(w==m)\n printf(\"YES\");\n else \n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include\n#include\n\nint main()\n{\n int a,b,c,a1=0,b1=0,c1=0,j=1;\n scanf(\"%d%d\",&a,&b);\n c=a+b;\n while(a)\n { \n if(a%10!=0)\n { \n a1+=(a%10)*j;\n j*=10;\n }\n a/=10;\n }\n j=1;\n while(b)\n { \n if(b%10!=0)\n { \n b1+=(b%10)*j;\n j*=10;\n }\n b/=10; \n \n }\n j=1;\n while(c)\n { \n if(c%10!=0)\n { \n c1+=(c%10)*j;\n j*=10;\n }\n c/=10;\n \n \n }\n printf(\"%d %d %d\",a1,b1,c1);\n if(a1+b1==c1)\n printf(\"YES\");\n else\n printf(\"NO\");\n \n return 0; \n \n}"}, {"source_code": "#include \n\nint main()\n{\n long a, b, n1, m1, n2, m2, a1, b1, t=0, i;\n scanf(\"%ld\",&a);\n scanf(\"%ld\",&b);\n a1=a;\n b1=b;\n if(a%10==0 && b%10==0)\n {\n if(a==b)\n {\n printf(\"YES\");\n return 0;\n }\n if(a!=b)\n {\n printf(\"NO\");\n return 0;\n }\n }\n do\n {\n a1=a1/10;\n b1=b1/10;\n t++;\n }while(a1!=0 && b1!=0);\n for(i=0;i=10)\n {\n printf(\"NO\");\n return 0;\n }\n }\n if(n1==0 && m1!=0)\n {\n printf(\"NO\");\n return 0;\n }\n if(n1!=0 && m1==0)\n {\n printf(\"NO\");\n return 0;\n }\n }\n printf(\"YES\");\n return 0;\n}"}, {"source_code": "#include\n#include\nint main(){\n char ar[15],br[15];\n int len,i;\n scanf(\"%s\",ar);\n scanf(\"%s\",br);\n len=strlen(ar)>strlen(br)?strlen(ar):strlen(br);\n for(i=0;i105) || ((ar[i]=='0') && ((br[i]!='0') && (br[i]!='\\0')))){\n printf(\"NO\");\n return 0;\n }\n }\n printf(\"YES\");\n return 0;\n \n}"}, {"source_code": "#include\nint main()\n{\n int c,d;\n int a,b;\n scanf(\"%d%d\",&a,&b);\n c = a+b;\n if((c/10)%2==0 && (a/10)%5==0 && (b/10)%5==0)\n {\n\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "\n#include \n#include \nint main()\n{\n long test(long a)\n {long r=0;\n while(a!=0){r=r*10+a%10;a/=10;}return r;\n\n }\n long int a,b,c;\n scanf(\"%ld%ld\",&a,&b);\n c=a+b;\n if(test(c)==(test(a)+test(b)))\n printf(\"YES\");\n else\n printf(\"NO\");\n\n}\n\n"}, {"source_code": "#include\nint main()\n{\n int c,d;\n int a,b;\n scanf(\"%d%d\",&a,&b);\n c = a+b;\n if((c/10)%2==0 && (a/10)%5==0 && (b/10)%5==0)\n {\n\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long a,b;\n int x=0;\n scanf(\"%I64d %I64d\",&a,&b);\n for(;;)\n {\n if(a==0){\n if(b!=0){x=12; printf(\"NO\\n\"); break;}\n else break;\n }\n else if(b==0){\n if(a!=0){x=13; printf(\"NO\\n\"); break;}\n else break;\n }\n\n else if((a%10==0)&&(b%10!=0)){x=1; printf(\"NO\\n\"); break;}\n else if((a%10==5)&&(b%10>=5)){x=2; printf(\"NO\\n\"); break;}\n else if((a%10>=5)&&(b%10==5)){x=3; printf(\"NO\\n\"); break;}\n else if((a%10==6)&&(b%10>=4)){x=4; printf(\"NO\\n\"); break;}\n else if((a%10>=4)&&(b%10==6)){x=5; printf(\"NO\\n\"); break;}\n else if((a%10==7)&&(b%10>=3)){x=6; printf(\"NO\\n\"); break;}\n else if((a%10>=3)&&(b%10==7)){x=7; printf(\"NO\\n\"); break;}\n else if((a%10==8)&&(b%10>=2)){x=8; printf(\"NO\\n\"); break;}\n else if((a%10>=2)&&(b%10==8)){x=9; printf(\"NO\\n\"); break;}\n else if((a%10==9)&&(b%10>=1)){x=10; printf(\"NO\\n\"); break;}\n else if((a%10>=1)&&(b%10==9)){x=11; printf(\"NO\\n\"); break;}\n\n a=a/10; b=b/10;\n\n }\n if(x==0)\n printf(\"YES\\n\",x);\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int i=0,j;\n char a[11],b[11],n[12];\n scanf(\"%s\",a);\n scanf(\"%s\",b);\n itoa(atoi(a)+atoi(b),n,10);\n while(a[i]!='\\0')\n {\n if(a[i]=='0')\n {\n j=i;\n while(a[j]!='\\0')\n {\n a[j]=a[j+1];\n j+=1;\n }\n }\n i+=1;\n }\n i=0;\n while(b[i]!='\\0')\n {\n if(b[i]=='0')\n {\n j=i;\n while(b[j]!='\\0')\n {\n b[j]=b[j+1];\n j+=1;\n }\n }\n i+=1;\n }\n i=0;\n while(n[i]!='\\0')\n {\n if(n[i]=='0')\n {\n j=i;\n while(b[j]!='\\0')\n {\n b[j]=b[j+1];\n j+=1;\n }\n }\n i+=1;\n }\n if(atoi(n)==atoi(a)+atoi(b))printf(\"YES\");\n else printf(\"NO\");\n}\n"}, {"source_code": "#include \n#include \n#include \n\nint d_zero(char* _str)\n{\n int i = 0;\n for(i = 0; i < strlen(_str); ++i)\n {\n int j = i - 1;\n while(j >= 0 && _str[j] == '0')\n --j;\n if(j >= 0)\n {\n _str[j] = _str[i];\n _str[i] = '0';\n }\n }\n\n i = strlen(_str) - 1;\n while(i >= 0 && _str[i] == '0')\n --i;\n if(i >= 0)\n {\n _str[i + 1] = '\\0';\n return atoi(_str);\n }\n else\n return 0;\n}\nint main()\n{\n char s_a[10], s_b[10];\n scanf(\"%s\",&s_a);\n scanf(\"%s\",&s_b);\n\n int i_a = atoi(s_a);\n int i_b = atoi(s_b);\n int i_c = i_a + i_b;\n\n char s_c[10];\n itoa(i_c, s_c,10);\n\n int x = d_zero(s_a);\n int y = d_zero(s_b);\n int z = d_zero(s_c);\n\n if(x + y == z)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n long long a,b,sum;\n long long n_a=0,n_b=0,n_sum=0;\n int i=1,j=1,k=1;\n scanf(\"%I64d %I64d\",&a,&b);\n sum=a+b; //printf(\"%I64d\\n\",sum);\n for(;;){\n if(a%10!=0){\n n_a+=a%10*i; i=i*10;}\n //printf(\"n_a: %I64d\\n\",n_a);\n\n if(b%10!=0){\n n_b+=b%10*j; j=j*10;}\n //printf(\"n_b: %I64d\\n\",n_b);\n\n if(sum%10!=0){\n n_sum+=sum%10*k; k=k*10;}\n //printf(\"n_sum: %I64d\\n\",n_sum);\n\n a=a/10; b=b/10; sum=sum/10;\n if(a==0||b==0) break; //printf(\"\\n\");\n }\n //printf(\"%I64d %I64d\\n\",n_a,n_b);\n if(n_a+n_b==n_sum) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n\n return 0;\n}\n\n"}, {"source_code": "#include\n#include\n\n\nint main()\n\n{\n char x[10],y[10];\n int a,b,i,j;\n\n scanf(\"%s %s\",x,y);\n\n a=strlen(x);\n b=strlen(y);\n\n for(i=a,j=b;i>=0&&j>=0;i--,j--)\n {\n if((x[i]=='0'&&y[i]!='0')||(x[i]!='0'&&y[i]=='0')) break;\n\n if(x[i]-48+y[i]-48>9) break;\n\n }\n\n if(i<0||j<0) printf(\"YES\");\n else printf(\"NO\");\n\n\n\n}\n"}, {"source_code": "#include\n#include\n\nint main()\n{\n char a[10],b[10],c[10];\n int i,zero=0,cnt=0;\n\n scanf(\"%s\",a);\n scanf(\"%s\",b);\n\n int len1=strlen(a);\n int len2=strlen(b);\n\n int n1,n2,sum;\n n1=atoi(a);\n n2=atoi(b);\n sum=n1+n2;\n int tmp=0,tmp2=0;\n while(sum!=0){\n c[cnt]=sum%10+'0';\n sum=sum/10;\n cnt++;\n }\n c[cnt]='\\0';\n // printf(\"%s\\n\",c);\n for(i=0;i\n#include\n#include\nint main()\n{\nchar a[11],b[11],s[11];\nscanf(\"%s%s\",a,b);\nlong int c,d,t,i=0,j=0,e,f;\nc=atoi(a);\nd=atoi(b);\nt=c+d;\nj=0;\nfor(i=0;b[i]!='\\0';i++)\n{\nif(a[i]=='0')\ncontinue;\nelse\n{\na[j]=a[i];\nj++;\n}\n}\na[j]='\\0';\nj=0;\nfor(i=0;b[i]!='\\0';i++)\n{\nif(b[i]=='0')\ncontinue;\nelse\n{\nb[j]=b[i];\nj++;\n}\n}\nb[j]='\\0';\ne=atoi(a)+atoi(b);\ni=0;\nwhile(t)\n{\nc=t%10;\nif(c)\n{\ns[i]=c+48;\ni++;\n}\nt=t/10;\t\n}\ns[i]='\\0';\nf=atoi(strrev(s));\nif(e==f)\nprintf(\"YES\");\nelse\nprintf(\"NO\");\n}"}, {"source_code": "#include \n#include \n#include \n/*\n75A. Life Without Zeros\n\n\nCan you imagine our life if we removed all zeros from it? For sure we will have many problems.\n\nIn this problem we will have a simple example if we removed all zeros from our life, it's the addition operation. Let's assume you are given this equation a + b = c, where a and b are positive integers, and c is the sum of a and b. Now let's remove all zeros from this equation. Will the equation remain correct after removing all zeros?\n\nFor example if the equation is 101 + 102 = 203, if we removed all zeros it will be 11 + 12 = 23 which is still a correct equation.\n\nBut if the equation is 105 + 106 = 211, if we removed all zeros it will be 15 + 16 = 211 which is not a correct equation.\nInput\n\nThe input will consist of two lines, the first line will contain the integer a, and the second line will contain the integer b which are in the equation as described above (1 ≤ a, b ≤ 10^9). There won't be any leading zeros in both. The value of c should be calculated as c = a + b.\nOutput\n\nThe output will be just one line, you should print \"YES\" if the equation will remain correct after removing all zeros, and print \"NO\" otherwise.\n\nSample test(s)\nInput\n101\n102\n\nOutput\nYES\n\nInput\n105\n106\n\nOutput\nNO\n*/\n\n#define SIZE_MAX 100\n#define SIZE_SHORT_WORD 10\nint main(void){\n long int a,b,c, a1, b1, c1; int temp;\n scanf(\"%ld%ld\",&a, &b); c=a+b;\n for (a1=0; a>0; a=a/10) {\n\t temp=a%10; if (temp!=0) a1=a1*10+temp;\n }\n for (a=0;a1>0;a1=a1/10) {\n\t temp=a1%10; a=10*a+temp;\n }\n for (b1=0; b>0; b=b/10) {\n\t temp=b%10; if (temp!=0) b1=b1*10+temp;\n }\n for (b=0;b1>0;b1=b1/10) {\n\t temp=b1%10; b=10*b+temp;\n }\n for (c1=0; c>0; c=c/10) {\n\t temp=c%10; if (temp!=0) c1=c1*10+temp;\n }\n for (c=0;c1>0;c1=c1/10) {\n\t temp=c1%10; c=10*c+temp;\n }\n /*printf(\"%ld + %ld = %ld\\n\", a,b,c); /**/\n if (a+b==c) printf(\"YES\\n\"); else printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include \n\nint main()\n{ \n long a,b;\n scanf(\"%ld\\n%ld\",&a,&b);\n \n \n\n\n long c=0;\n long d=0;\n int fla=0;\n while(a>0 && b>0)\n {\n c=a%10;\n a=a/10;\n \n d=b%10;\n b=b/10;\n \n if((c+d)<=9 && c!=0 && d!=0)\n continue;\n else if(c==0 && d==0)\n continue;\n else\n {\n fla=1;\n break;\n }\n \n \n \n }\n \n if(fla==1)\n printf(\"NO\");\n else\n printf(\"YES\");\n \n return 0;\n}"}, {"source_code": "#include \n\nint main(void)\n{\n\tint a,b;\n\tscanf(\"%d\",&a);\n\tscanf(\"%d\",&b);\n\n\tfor(;a!=0&&b!=0;)\n\t{\n\t\tif(a%10+b%10>=10||a%10+b%10==0) \n\t\t{\n\t\t\tprintf(\"NO\");\n\t\t\treturn 0;\n\t\t}\n\t\ta/=10;\n\t\tb/=10;\n\t}\n\n\tprintf(\"YES\");\t\n\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n long a, b, n1, m1, n2, m2;\n scanf(\"%ld\",&a);\n scanf(\"%ld\",&b);\n do\n {\n n1=a%10;\n m1=b%10;\n a=a/10;\n b=b/10;\n n2=a%10;\n m2=b%10;\n if(n2==0 && m2==0)\n {\n if(n1+m1>=10)\n {\n printf(\"NO\");\n return 0;\n }\n }\n if(n1==0 && m1!=0)\n {\n printf(\"NO\");\n return 0;\n }\n if(n1!=0 && m1==0)\n {\n printf(\"NO\");\n return 0;\n }\n }while(n2!=0 && m2!=0 && n1!=0 && m1!=0);\n printf(\"YES\");\n return 0;\n}"}, {"source_code": "#include \n\nint rz(int n)\n{\n int k = 0;\n\n while(n)\n {\n if(n % 10)\n k = 10 * k + n % 10;\n n /= 10;\n }\n\n while(k)\n {\n n = 10 * n + k % 10;\n k /= 10;\n }\n\n return n;\n}\n\nint main(int argc, char *argv[])\n{\n int a, b;\n\n scanf(\"%d %d\", &a, &b);\n\n if(rz(a) + rz(b) == rz(a + b))\n puts(\"YES\");\n else\n puts(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int c,d;\n int a,b;\n scanf(\"%d%d\",&a,&b);\n c = a+b;\n if((c/10)%2==0 && (a/10)%5==0 && (b/10)%5==0)\n {\n\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\nint d_zero(char* _str)\n{\n int i = 0;\n for(i = 0; i < strlen(_str); ++i)\n {\n int j = i - 1;\n while(j >= 0 && _str[j] == '0')\n --j;\n if(j >= 0)\n {\n _str[j] = _str[i];\n _str[i] = '0';\n }\n }\n\n i = strlen(_str) - 1;\n while(i >= 0 && _str[i] == '0')\n --i;\n if(i >= 0)\n {\n _str[i + 1] = '\\0';\n return atoi(_str);\n }\n else\n return 0;\n}\nint main()\n{\n char s_a[10], s_b[10];\n scanf(\"%s\",&s_a);\n scanf(\"%s\",&s_b);\n\n int i_a = atoi(s_a);\n int i_b = atoi(s_b);\n int i_c = i_a + i_b;\n\n char s_c[10];\n itoa(i_c, s_c,10);\n\n int x = d_zero(s_a);\n int y = d_zero(s_b);\n int z = d_zero(s_c);\n\n if(x + y == z)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n\tint a,b,c,g,i,j,k,o,l,s,n,e,f;\n\tint ara[100000];\n\tint arar[100000];\n\tint ar[100000];\n\tscanf(\"%d\",&a);\n\tscanf(\"%d\",&b);\n\tc=a+b;\n\ti=0;\n\twhile(a!=0){\n\t\tg=a%10;\n\t\tif (g!=0){\n\t\t\tara[i]=g;\n\t\t\ti=i+1;\n\t\t}\n\t\ta=a/10;\n\t\t\n\t}\n\tj=0;\n\twhile(b!=0){\n\t\tg=b%10;\n\t\tif (g!=0){\n\t\t\tarar[j]=g;\n\t\t\tj=j+1;\n\t\t}\n\t\tb=b/10;\n\t\t\n\t}\n\tl=0;\n\twhile(c!=0){\n\t\tg=c%10;\n\t\tif (g!=0){\n\t\t\tar[l]=g;\n\t\t\tl=l+1;\n\t\t}\n\t\tc=c/10;\n\t\t\n\t}\n\t\n\ts=0;\n\tfor(o=i-1;o>=0;o--){\n\t\tn=pow(10,o);\n\t\ts=s+(ara[o])*n;\n\t}\n\te=0;\n\tfor(o=j-1;o>=0;o--){\n\t\tn=pow(10,o);\n\t\te=e+(arar[o])*n;\n\t}\n\tf=0;\n\tfor(o=l-1;o>=0;o--){\n\t\tn=pow(10,o);\n\t\tf=f+(ar[o])*n;\n\t}\n\tif ((s+e)==f){\n\t\tprintf(\"YES\");\n\t}\n\telse{\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n char a[10000],a1[10000],b[10000],b1[100000],s1[100000],s2[100000];\n int i,j,k=0,sum1,sum2;\n gets(a);\n gets(b);\n sum1=atoi(a)+atoi(b);\n itoa(sum1,s1,10);\n for(i=0;i\nint re(int a)\n{\n int r=0,t=0;\n while(a)\n {\n if(a%10!=0)\n {\n r=r*10+a%10;\n }\n a=a/10;\n }\n while(r)\n {\n t=t*10+r%10;\n r=r/10;\n }\n return t;\n}\nint main()\n{\n int x,y,a,b,c,z;\n while(scanf(\"%d%d\",&a,&b)!=EOF)\n {\n z=a+b;\n if((re(a)+re(b))==re(z))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int a, b,azero=0,bzero=0,n=0,m=0,anum,bnum,max,f=1;\n scanf(\"%d%d\",&a,&b);\n anum=a;\n bnum=b;\n while(anum)\n {\n anum/=10;\n n++;\n }\n while(bnum)\n {\n bnum/=10;\n m++;\n }\n if(n>m)\n max=n;\n else\n max=m;\n int ar[max],br[max],x=max;\n while(a>0||b>0)\n {\n if(a>0)\n {\n ar[--max]=a%10;\n if(a%10==0)\n azero++;\n a/=10;\n }\n else\n ar[max]=0;\n if(b>0)\n {\n br[max]=b%10;\n if(b%10==0)\n bzero++;\n b/=10;\n }\n else\n br[max]=0;\n }\n /*for(int i=0;i=0;i--)\n {\n if((ar[i]!=0&&br[i]==0)||(ar[i]==0&&br[i]!=0))\n {\n f=-1;\n break;\n }\n else if(ar[i]+br[i]>9)\n {\n if(ar[i-1]==0||br[i-1]==0)\n {\n f=-1;\n break;\n }\n else\n ar[i-1]+=ar[i]+br[i]-9;\n }\n }\n if(f==-1)\n printf(\"%s\",\"NO\");\n else\n printf(\"%s\",\"YES\");\n }\n return 0;\n}"}, {"source_code": "#include\n#include\n\nint main()\n{\n char a[10],b[10];\n int i,zero=0,cnt=0;\n\n scanf(\"%s\",a);\n scanf(\"%s\",b);\n\n int len1=strlen(a);\n int len2=strlen(b);\n\n for(i=0;i\n\nmain()\n{\n int c, d, f, g = 0, e = 0 ,a , b, k, l = 0, r, s = 0, t, u = 0, w = 0, v, x;\n scanf(\"%d %d\", &a, &b);\n c = a + b;\n while(a != 0)\n {\n d = a % 10;\n if(d != 0)\n e =e * 10 + d;\n a = a / 10;\n }\n while(b != 0)\n {\n f = b % 10;\n if(f != 0)\n g = g * 10 + f;\n b = b / 10;\n }\n while (c != 0)\n {\n k = c % 10;\n if(k != 0)\n l = l * 10 + k;\n c = c / 10;\n }\nwhile ( e != 0)\n{\n r = e % 10;\n s = s * 10 + r;\n e = e / 10;\n}\nwhile (g != 0)\n {\n t = g % 10;\n u = u * 10 + t;\n g = g / 10;\n }\n while (l != 0)\n {\n v = l % 10;\n w = w * 10 + v;\n l = l / 10;\n }\n x = s + u;\n\nif (w == x)\n printf(\"YES\\n\");\nelse\n printf(\"NO\\n\");\n\n}\n"}, {"source_code": "#include \n#include\n\nint main(void) {\n \n int a, b, c;\n int removeZeros(int);\n \n scanf(\"%d\\n%d\", &a, &b);\n c = a+b;\n \n int new_a = removeZeros(a);\n int new_b = removeZeros(b);\n int new_c = removeZeros(c);\n \n if((new_a + new_b)==new_c)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n}\n\nint removeZeros(int x)\n{\n int newX=0;\n int powCnt=0;\n while(x != 0)\n {\n if((x%10)!=0)\n {\n newX += (x%10)*pow(10,powCnt);\n powCnt++;\n }\n x = x/10;\n }\n return newX;\n}\n\n"}, {"source_code": "#include \nint re(int a)\n{\n int r=0,t=0;\n while(a)\n {\n if(a%10!=0)\n {\n r=r*10+a%10;\n }\n a=a/10;\n }\n while(r)\n {\n t=t*10+r%10;\n r=r/10;\n }\n return t;\n}\nint main()\n{\n int x,y,a,b,c,z;\n while(scanf(\"%d%d\",&a,&b)!=EOF)\n {\n z=a+b;\n if((re(a)+re(b))==re(z))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n long long int a,b;\n scanf(\"%I64d\\n\",&a);\n scanf(\"%I64d\",&b);\nlong long int c=a+b;\n long long int i,j,k=0,l,p,q,t,mod;\n i=a,p=0,t=0,j=b,l=0,q=0;\n while(i>0)\n {\n mod=i%10;\n if(mod!=0)\n {\n p+=mod*pow(10,t);\n t++;\n }\n i/=10;\n }\n \n while(j>0)\n {\n mod=j%10;\n if(mod!=0)\n {\n q+=mod*pow(10,l);\n l++;\n }\n j/=10;\n }\n long long int u=c;\n long long int w=0;\n while(u>0)\n {\n mod=u%10;\n if(mod!=0)\n {\n w+=mod*pow(10,k);\n k++;\n }\n u/=10;\n }\n if(w==(p+q))\n printf(\"YES\");\n else \n printf(\"NO\");\n}"}, {"source_code": "#include\n#include\n#include\n#define sz 100\nchar c[sz],ch[sz],x[sz],y[sz];\nint rev[sz];\nint main()\n{\n long long i,j,s1,s2,n,m,rem,s3,l;\n scanf(\"%s\",c);\n getchar();\n n=atoi(c);\n scanf(\"%s\",ch);\n getchar();\n m=atoi(ch);\n s1=n+m;\n //printf(\"%I64d\\n\",s1);\n i=0;\n l=s1;\n while(l!=0)\n {\n rem=l%10;\n if(rem>0){\n rev[i]=rem;\n //printf(\"%c\",rev[i]);\n i++;\n }\n l/=10;\n //i++;\n }\n s3=0;\n for(j=i-1;j>=0;j--)\n {\n s3=s3*10+rev[j];\n }\n //rev[i]='\\0';\n /*strrev(rev);\n puts(rev);\n s3=atoi(rev);*/\n //printf(\"s1=%I64d s3=%I64d\\n\",s1,s3);\n for(i=0,j=0;i\n\n#include\n#include\nint main()\n{\n long long int sum1=0,sum2=0,i,j,k,l1,l2;\n char m[10000],n[10000];\n scanf(\"%s%s\",m,n);\n l1=strlen(m);\n l2=strlen(n);\n for(i=0;i\n#include\n#include\nint main() \n{\n long long int a,b;\n scanf(\"%lld %lld\",&a,&b);\n long long int l,i,r,m,j,x,y,n,k,s[10]={0},t[10]={0},fin[10]={0},final[10]={0};\n l=a;\n i=0;\n while(l>0)\n {\n r=l%10;\n l=l/10;\n if(r>0)\n {\n s[i]=r;\n i++;\n }\n }\n m=b;\n j=0;\n while(m>0)\n {\n r=m%10;\n m=m/10;\n if(r>0)\n {\n t[j]=r;\n j++;\n }\n }\n n=a+b;\n k=0;\n while(n>0)\n {\n r=n%10;\n n=n/10;\n if(r>0)\n {\n final[k]=r;\n k++;\n }\n }\n if(i>=j)\n {\n for(x=0;x9)\n {\n fin[x+1]=fin[x]/10;\n fin[x]=fin[x]-10;\n }\n }\n long long int count=0;\n for(x=0;x9)\n {\n fin[x+1]+=fin[x]/10;\n fin[x]=fin[x]-10;\n }\n }\n long long int count=0;\n for(x=0;x\n\nint main()\n{\n long a, b, n1, m1, n2, m2;\n scanf(\"%ld\",&a);\n scanf(\"%ld\",&b);\n do\n {\n n1=a%10;\n m1=b%10;\n a=a/10;\n b=b/10;\n n2=a%10;\n m2=b%10;\n if(n2==m2 && n2==0)\n {\n if(n1+m1>=10)\n {\n printf(\"NO\");\n return 0;\n }\n }\n if(n2==0 && m2!=0)\n {\n printf(\"NO\");\n return 0;\n }\n if(n2!=0 && m2==0)\n {\n printf(\"NO\");\n return 0;\n }\n }while(n2!=0 && m2!=0);\n printf(\"YES\");\n return 0;\n}"}, {"source_code": "#include\n#include\n\n\nint main()\n\n{\n int p,q,r;\n\n int a,b,c,d,i,j;\n\n scanf(\"%d %d\",&p,&q);\n\n r=p+q;\n\n int x[11]={},y[11]={},z[11]={};\n\n for(i=10;p>0;i--)\n {\n x[i]=p%10;\n p/=10;\n }\n a=i+1;\n\n for(i=10;q>0;i--)\n {\n y[i]=q%10;\n q/=10;\n }\n b=i+1;\n\n for(i=10;r>0;i--)\n {\n z[i]=r%10;\n r/=10;\n }\n c=i+1;\n\n d=(a>b)?a:b;\n\n\n for(i=d;i<11;i++)\n { if(x[i]&&y[i]&&!z[i]) break;\n\n if(!x[i]&&!y[i]&&z[i]) break;\n\n if((!x[i]&&y[i])||(x[i]&&!y[i])) break;\n\n }\n\n if(i<11) printf(\"NO\");\n else\n {\n for(i=d-1;i>=c;i--)\n {\n if(!x[i]&&!y[i]&&z[i]) break;\n }\n\n if(i\n#include\n\nlong long int fun(long long int n)\n{\n\tlong long int p=1,k,dig=0,z,i,a,new=0;\n\n\tz=n;\n\n\twhile(z>0)\n\t{\n\t\tdig++;\n\t\tz=z/10;\n\t}\n\n\tz=n;\n\n\tfor(i=dig-1;i>=0;i--)\n\t{\n\t\tfor(k=1;k<=i;k++)\n\t\t\tp=p*10;\n\n\t\ta=z/p;\n\t\tif(a!=0)\n\t\tnew=new*10+a;\n\n\t\tz=z-a*p;\n\t\tp=1;\n\n\t}\n\n\treturn new;\n}\n\nint main()\n{\n\tlong long int a1,b1,c1,a2,b2,c2;\n\n\tscanf(\"%I64d%I64d\",&a1,&b1);\n\n\tc1=a1+b1;\n\n\ta2=fun(a1);\n\tb2=fun(b1);\n\tc2=fun(c1);\n\tprintf(\"%I64d %I64d %I64d\",a2,b2,c2);\n\n\tif(a2+b2==c2)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint zero(int n)\n{\n int x=0,y,s=0,d=0;\n while(n>0)\n {\n if(n%10==0)\n y=x;\n else\n s=n+y;\n x=n%10;\n n=n/10;\n }\n return s;\n}\n\nmain()\n{\n int a,b,c=0,p,q;\n scanf(\"%d %d\",&a,&b);\n c=a+b;\n p=zero(c);\n q=zero(a)+zero(b);\n if(p==q)\n printf(\"YES\");\n else\n printf(\"NO\");\n}\n"}, {"source_code": "#include \n#include \n\nint main(void){\n int m,k,p=0,y=0,i,j=0;\n scanf(\"%d\", &m);\n scanf(\"%d\", &k);\n i=m+k;\n while(i){\n if(i>0){\n j+=(i%10);\n i/=10;\n }\n }\n while(m){\n if(m>0){\n p+=(m%10);\n m/=10;\n }\n }\n while(k){\n if(k>0){\n y+=(k%10);\n k/=10;\n }\n }\n if((y+p)==j){\n printf(\"YES\\n\");\n }else{\n printf(\"NO\\n\");\n }\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \nint main(){\n\nint i, l, x, y, z, d, e, f, g, m;\nchar a[10], b[10], c[10];\nscanf(\"%s%s\", a, &b);\nx = atoi(a);\ny = atoi(b);\nz = x + y;\nsprintf(c, \"%d\", z);\nm = strlen(c);\nif(strlen(a) >= strlen(b)){\n l = strlen(a);\n}\nelse{\n l = strlen(b);\n}\nfor(i = 0; i < l; i++){\n if(a[i] == '0'){\n a[i] = '\\0';\n }\n if(b[i] == '0'){\n b[i] = '\\0';\n }\n if(c[i] == '0'){\n c[i] = '\\0';\n }\n}\nd = atoi(a);\ne = atoi(b);\nf = d + e;\ng = atoi(c);\nif(f == g){\n printf(\"YES\\n\");\n}\nelse printf(\"NO\\n\");\n\nreturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tlong long int a[2], b[2], c[2], baseA = 1, baseB = 1, baseC = 1;\n\t\n\tscanf(\"%d\", &a[0]);\n\tscanf(\"%d\", &b[0]);\n\tc[0] = a[0] + b[0];\n\n\ta[1] = 0, b[1] = 0, c[1] = 0;\n\twhile ((a[0] != 0) || (b[0] != 0))\n\t{\n\t\tif (a[0] % 10 != 0)\n\t\t{\n\t\t\ta[1] = a[1] + a[0] % 10 * baseA;\n\t\t\tbaseA *= 10;\n\t\t}\n\t\tif (b[0] % 10 != 0)\n\t\t{\n\t\t\tb[1] = b[1] + b[0] % 10 * baseB;\n\t\t\tbaseB *= 10;\n\t\t}\n\t\tif (c[0] % 10 != 0)\n\t\t{\n\t\t\tc[1] = c[1] + c[0] % 10 * baseC;\n\t\t\tbaseC *= 10;\n\t\t}\n\t\ta[0] = a[0] / 10;\n\t\tb[0] = b[0] / 10;\n\t\tc[0] = c[0] / 10;\n\t}\n\t\n\tif (a[1] + b[1] == c[1]) printf(\"YES\");\n\telse printf(\"NO\");\n\n\treturn 0;\n}"}, {"source_code": "#include\n#include\n#include\nint main()\n{\n char a[10000],b[10000],k[200];\n long long int c,d,e,f,g,h,len1,len2,i,m,n,len,sum1=0,sum2=0;\n gets(a);\n gets(b);\n c=atoi(a);\n d=atoi(b);\n e=c+d;\n sprintf(k,\"%d\",e);\n len=strlen(k);\n puts(k);\n for(i=0;i\nint main()\n{\n long long int a,b,c,aa,bb,cc,sum_a=0,sum_b=0,sum_c=0;\n scanf(\"%I64d %I64d\",&a,&b);\n c = a + b;\n while(a!=0){\n aa = a % 10;\n a = (a - aa)/10;\n if(aa!=0)sum_a = sum_a + aa;\n }\n while(b!=0){\n bb = b % 10;\n b = (b - bb)/10;\n if(bb!=0)sum_b = sum_b + bb;\n }\n while(c!=0){\n cc = c % 10;\n c = (c - cc)/10;\n if(cc!=0)sum_c = sum_c + cc;\n }\n\n if((sum_a+sum_b)==sum_c)printf(\"YES\");\n else printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nmain()\n{\n\tlong long int a,b,sum=0,c1=0,c2=0;\n\tscanf(\"%I64d\",&a);\n\tscanf(\"%I64d\",&b);\n\tsum+=(a+b);\nwhile(a)\n{\n\tint r1=sum%10;\n\tif(r1==0)\n\t{\n\t\tc1++;\n\t}\n\tint r2=a%10;\n\tint r3=b%10;\n\tif(r2==0 && r3==0)\n\t{\n\t\tc2++;\n\t}\n\tif((r2==0 && r3==0) && r1!=0)\n\t{\n\t\tprintf(\"NO\");\n\t\texit(0);\n\t}\n\tif(r2!=0 && r1==0)\n\t{\n\t\tprintf(\"NO\");\n\t\texit(0);\n\t}\n\tif(r1==0 && r2!=0)\n\t{\n\t\tprintf(\"NO\");\n\t\texit(0);\n\t}\n\tsum/=10;\n\ta/=10;\n\tb/=10;\n}\nif(c1>c2)\n{\n\tprintf(\"NO\");\n}\nelse\nprintf(\"YES\");\t\n}"}, {"source_code": "#include\nint main()\n{\n int i,sum=0,n,d,temp,j,a,b,c=0;\n int array[2],array1[2],array2[2];\n scanf(\"%d\",&a);\n printf(\"\\n\");\n scanf(\"%d\",&b);\n c=a+b;\n array[0]=a;\n array[1]=b;\n array[2]=c;\n for(i=0; i<3; i++)\n {\n //scanf(\"%d\",&array[i]);\n for(j=1; array[i]!=0; j++)\n {\n temp=array[i]%10;\n d=array[i]/10;\n if(temp!=0)\n {\n sum=sum*10+temp;\n\n }\n array[i]=d;\n }\n array1[i]=sum;\n sum=0;\n }\n for(i=0; i<3; i++)\n {\n for(j=1; array1[i]!=0; j++)\n {\n temp=array1[i]%10;\n d=array1[i]/10;\n if(temp!=0)\n {\n sum=sum*10+temp;\n\n }\n array1[i]=d;\n }\n array2[i]=sum;\n sum=0;\n }\n for(i=0;i<3;i++)\n {\n printf(\"%d\\n\",array2[i]);\n }\n\n if(array2[0]+array2[1]==array2[2])\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\nreturn 0;\n}\n"}, {"source_code": "#include \n#include \n\n#define LL __int64\n\nLL F(LL N)\n{\n LL r;\n int i=0,L;\n char Str[15];\n while(N)\n {\n if(N%10)\n {\n Str[i++]=N%10+'0';\n }\n N/=10;\n }\n Str[i]='\\0';\n L=i;\n for(r=0,i=L-1;i>=0;--i)\n {\n r*=10;\n r+=Str[i]-'0';\n }\n return r;\n}\n\nint main()\n{\n LL A,B,C,X,Y;\n scanf(\"%I64d %I64d\",&A,&B);\n C=A+B;\n X=F(A);\n Y=F(B);\n puts(X+Y==C?\"YES\":\"NO\");\n return 0;\n}\n"}, {"source_code": "int remove(int num)\n{\n int sum=0,t=1;\n while(num)\n {\n if(num%10)\n {\n sum = sum + (num%10)*t;\n t=10;\n }\n num/=10;\n }\n return sum;\n}\nmain()\n{\n int a,b,c;\n scanf(\"%d%d\",&a,&b);\n c=a+b;\n a=remove(a);\n b=remove(b);\n c=remove(c);\n if(c==a+b) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int Num1,Num2,i,Cnt=0,x,m1,m2;\n scanf(\"%i %i\",&Num1,&Num2);\n m1=Num1;\n m2=Num2;\n while(Num1!=0)\n {\n Num1=Num1/10;\n Cnt ++;\n\n }\n\n int a1[Cnt],a2[Cnt];\n for (i=Cnt-1;i>=0;i--)\n {\n a1[i]= m1%10;\n m1=m1/10;\n\n }\n for (i=Cnt-1;i>=0;i--)\n {\n a2[i]= m2%10;\n m2=m2/10;\n\n }\n /* for (i=0;i=10)\n {\n printf(\"NO\");\n break;\n\n }\n }\n }\n if (i==Cnt)\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\nint main(){\nint a,b,c,a1,b1,c1,a2,i,b2,c2;\nscanf(\"%d%d\",&a,&b);\nif(a==999999999&&b==999999999){\n printf(\"YES\");\n}\nelse{\nc=a+b;\n/*printf(\"%d %d %d\\n\",a,b,c);*/\n i=0;\n a1=0;\n while(a>0){\n a2=a%10;\n if(a2==0){\n a=a/10;\n continue;\n }\n else{\n a1=a1+a2*pow(10,i);\n i++;\n }\na=a/10;\n }\n \n i=0;\n b1=0;\n while(b>0){\n b2=b%10;\n if(b2==0){\n b=b/10;\n continue;\n }\n else{\n b1=b1+b2*pow(10,i);\n i++;\n }\nb=b/10;\n }\n i=0;\n c1=0;\n while(c>0){\n c2=c%10;\n if(c2==0){\n c=c/10;\n continue;\n }\n else{\n c1=c1+c2*pow(10,i);\n i++;\n }\nc=c/10;\n }\n/*printf(\"%d %d %d\\n\",a1,b1,c1);*/\nif(c1==a1+b1){\n printf(\"YES\");\n}\nelse{\n printf(\"NO\");\n}\n}\n}"}, {"source_code": "#include \n#include \n#include \n/*\n75A. Life Without Zeros\n\n\nCan you imagine our life if we removed all zeros from it? For sure we will have many problems.\n\nIn this problem we will have a simple example if we removed all zeros from our life, it's the addition operation. Let's assume you are given this equation a + b = c, where a and b are positive integers, and c is the sum of a and b. Now let's remove all zeros from this equation. Will the equation remain correct after removing all zeros?\n\nFor example if the equation is 101 + 102 = 203, if we removed all zeros it will be 11 + 12 = 23 which is still a correct equation.\n\nBut if the equation is 105 + 106 = 211, if we removed all zeros it will be 15 + 16 = 211 which is not a correct equation.\nInput\n\nThe input will consist of two lines, the first line will contain the integer a, and the second line will contain the integer b which are in the equation as described above (1 ≤ a, b ≤ 10^9). There won't be any leading zeros in both. The value of c should be calculated as c = a + b.\nOutput\n\nThe output will be just one line, you should print \"YES\" if the equation will remain correct after removing all zeros, and print \"NO\" otherwise.\n\nSample test(s)\nInput\n101\n102\n\nOutput\nYES\n\nInput\n105\n106\n\nOutput\nNO\n*/\n\n#define SIZE_MAX 100\n#define SIZE_SHORT_WORD 10\nint main(void){\n long long int a,b,c, a1, b1, c1; int temp;\n scanf(\"%lld%lld\",&a, &b); c=a+b;\n /*printf(\"%lld + %lld = %lld\\n\", a,b,c); /**/\n for (a1=0; a>0; a=a/10) {\n\t temp=a%10; if (temp!=0) a1=a1*10+temp;\n }\n for (a=0;a1>0;a1=a1/10) {\n\t temp=a1%10; a=10*a+temp;\n }\n for (b1=0; b>0; b=b/10) {\n\t temp=b%10; if (temp!=0) b1=b1*10+temp;\n }\n for (b=0;b1>0;b1=b1/10) {\n\t temp=b1%10; b=10*b+temp;\n }\n for (c1=0; c>0; c=c/10) {\n\t temp=c%10; if (temp!=0) c1=c1*10+temp;\n }\n /*printf(\"c1 = %lld\\n\", c1); /**/\n for (c=0;c1>0;c1=c1/10) {\n\t temp=c1%10; c=10*c+temp;\n }\n /*printf(\"%lld + %lld = %lld\\n\", a,b,c); /**/\n if (a+b==c) printf(\"YES\\n\"); else printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n int x,y,z,n=0,m=0,l=0,azero=0,bzero=0;\n long long a, b,c,cc,cnum,anum,bnum,max;\n scanf(\"%lld%lld\",&a,&b);\n c=a+b;\n cnum=c;\n while(cnum)\n {\n cnum/=10;\n l++;\n }\n z=l;\n int cr[l];\n while(c)\n {\n cr[--l]=c%10;\n c/=10;\n }\n for(int i=0;i=0;i--)\n c+=cr[i]*pow(10,z-1-i);\n anum=a;\n bnum=b;\n while(anum)\n {\n anum/=10;\n n++;\n }\n while(bnum)\n {\n bnum/=10;\n m++;\n }\n x=n;\n y=m;\n int ar[n],br[m];\n while(a>0)\n {\n ar[--x]=a%10;\n if(a%10==0)\n azero++;\n a/=10;\n }\n while(b>0)\n {\n br[--y]=b%10;\n if(b%10==0)\n bzero++;\n b/=10;\n }\n if(azero==0&&bzero==0)\n printf(\"%s\",\"YES\");\n else\n {\n x=n;\n for(int i=0;i=0;i--)\n a+=ar[i]*pow(10,n-1-i);\n b=0;\n for(int i=m-1;i>=0;i--)\n b+=br[i]*pow(10,m-1-i);\n //printf(\"\\n%d %d\",a,b);\n cc=a+b;\n if(c==cc)\n printf(\"%s\",\"YES\");\n else\n printf(\"%s\",\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n long long int a,b,c,d=0,e=0,f=0;\n scanf(\"%I64d%I64d\",&a,&b);\n c=a+b;\n int i=0,j=0,k=0;\n\n while(a>0)\n {\n if(a%10==0)\n {\n a=a/10;\n }\n else\n {\n d=d+pow(10,i)*(a%10);\n a=a/10;\n i++;\n }\n }\n while(b>0)\n {\n if(b%10==0)\n {\n b=b/10;\n }\n else\n {\n e=e+pow(10,j)*(b%10);\n b=b/10;\n j++;\n }\n }\n while(c>0)\n {\n if(c%10==0)\n {\n c=c/10;\n }\n else\n {\n f=f+pow(10,k)*(c%10);\n c=c/10;\n k++;\n }\n }\n if((d+e)==f)\n {\n printf(\"YES\");\n }\n else\n printf(\"NO\");\n return(0);\n}\n"}, {"source_code": "#include\nint digit (long long a)\n{\n long long i=0,j,k,n,b=0;\n int w[1000];\n n=a;\n while(n!=0){\n j=n%10;\n w[i]=j;\n n=n/10;\n i++;\n }\n for(k=i-1;k>=0;k--){\n if(w[k]==0) k--;\n b=b*10+w[k];\n }\n return b;\n}\nint main()\n{\n long long a,b,c1,c2,p,q;\n scanf(\"%I64d %I64d\",&a,&b);\n c1=a+b;\n a=digit(a);\n b=digit(b);\n c1=digit(c1);\n if(a+b==c1) printf(\"YES\");\n else printf(\"NO\");\n}"}, {"source_code": "#include \n\nint A(int a)\n{\n\tint b, c;\n\n\tb = a % 10;\n\ta /= 10;\n\tc = 10;\n\twhile (a) {\n\t\tif (a % 10) {\n\t\t\tb = a % 10 * c + b;\n\t\t\tc *= 10;\n\t\t}\n\t\ta /= 10;\n\t}\n\n\treturn b;\n}\n\nint main()\n{\n\tint a, b;\n\n\tscanf(\"%d%d\", &a, &b);\n\tif (A(a) + A(b) == A(a + b))\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\n\treturn 0;\n}\n"}], "src_uid": "ac6971f4feea0662d82da8e0862031ad"} {"nl": {"description": "Sereja showed an interesting game to his friends. The game goes like that. Initially, there is a table with an empty cup and n water mugs on it. Then all players take turns to move. During a move, a player takes a non-empty mug of water and pours all water from it into the cup. If the cup overfills, then we assume that this player lost.As soon as Sereja's friends heard of the game, they wanted to play it. Sereja, on the other hand, wanted to find out whether his friends can play the game in such a way that there are no losers. You are given the volumes of all mugs and the cup. Also, you know that Sereja has (n - 1) friends. Determine if Sereja's friends can play the game so that nobody loses.", "input_spec": "The first line contains integers n and s (2 ≤ n ≤ 100; 1 ≤ s ≤ 1000) — the number of mugs and the volume of the cup. The next line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 10). Number ai means the volume of the i-th mug.", "output_spec": "In a single line, print \"YES\" (without the quotes) if his friends can play in the described manner, and \"NO\" (without the quotes) otherwise.", "sample_inputs": ["3 4\n1 1 1", "3 4\n3 1 3", "3 4\n4 4 4"], "sample_outputs": ["YES", "YES", "NO"], "notes": null}, "positive_code": [{"source_code": "#include\nint main(void)\n{\n int i,n,s,max=0,a,sum=0;\n scanf(\"%d %d\",&n,&s);\n for(i=0;i\nint main()\n{\n int n,s,i,c=0;\n scanf(\"%d %d\",&n,&s);\n int a[n];\n int sum=0,max=0;\n for(i=0;imax){\n max=a[i];\n }\n }\n //printf(\"%d\",max);\n if(sum-max<=s)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n\n#define N 1000\n\nint arr[N] = {0};\n\nvoid Swap(int *x, int *y)\n{\n\tint tmp;\n\ttmp = *x;\n\t*x = *y;\n\t*y = tmp;\n}\n\nvoid Sorting(int n)\n{\n\tint i, j;\n\n\tfor (i = 0; i < n; ++i)\n\t{\n\t\tfor (j = 0; j < n; ++j)\n\t\t{\n\t\t\tif (arr[i] < arr[j])\n\t\t\t\tSwap(arr + i, arr + j);\n\t\t}\n\t}\n}\n\nint main(void)\n{\n\tint i;\n\tint tmp;\n\tint n, s;\n\tlong long count = 0;\n\n\tscanf(\"%i %i\", &n, &s);\n\n\tfor (i = 0; i < n; ++i)\n\t{\n\t\tscanf(\"%i\", &tmp);\n\t\tarr[i] = tmp;\n\t}\n\n\tSorting(n);\n\n\tfor (i = 0; i < n - 1; ++i)\n\t\tcount += arr[i];\n\n\tif (count <= s)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\n\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,s,s1=0,i;\n scanf(\"%d %d\",&n,&s);\n int a[n],f=0;\n for(i=0;i\n\nint main(void) {\nint n,m,i,j,arr[101],temp,sum=0;\nscanf(\"%d%d\",&n,&m);\nfor(i=0;iarr[j+1])\n\t\t{\n\t\t\ttemp=arr[j];\n\t\t\tarr[j]=arr[j+1];\n\t\t\tarr[j+1]=temp;\n\t\t}\n\t}\n\n}\nsum=0;\nfor(i=0;im){\n\tprintf(\"NO\");\n\n\treturn 0;\n\t}\n\n\n}\nprintf(\"YES\");\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,k,i,j,num[110],hold,sum=0;\n\tscanf(\"%d%d\",&n,&k);\n\tfor(i=1;i<=n;i++)\tscanf(\"%d\",&num[i]);\n\tfor(i=1;inum[i+1]){\n\t\t\thold=num[i];\n\t\t\tnum[i]=num[i+1];\n\t\t\tnum[i+1]=hold;\n\t\t}\n\t}\n\tfor(i=1;i\nint main()\n{\n int N, S, i, a, max=0, sum=0;\n\n scanf(\"%d%d\",&N,&S);\n for (i = 0; i < N; i++)\n {\n scanf(\"%d\",&a);\n if(max S)\n printf(\"NO\");\n else printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n\nint main()\n{\n\tint n,m,s=0;;\n\tscanf(\"%d %d\",&n,&m);\n\tint a[n];\n\tfor(int i=0;ia[j+1])\n\t\t {\n\t\t int p=a[j];\n\t\t a[j]=a[j+1];\n\t\t a[j+1]=p;\n\t\t }\t\n\t }\n\t}\n\tfor(int i=0;i\nint main()\n{\n int n,s,i,j,t;\n t=0;\n\n\n scanf(\"%d %d\",&n,&s);\n int arra[n];\n for(i=0;i\n\nint main(){\n int n, s, i, max = 0 ,sum = 0, t;\n scanf(\"%d %d\", &n, &s);\n for(i=0; i max)max = t;\n }\n if(sum-max <= s)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include\nint cmp(int *a,int *b)\n{\n return *a-*b;\n}\nint main()\n{\n int n,i,s,a[1000];\n int ans=0;\n scanf(\"%d%d\",&n,&s);\n for(i=0;i\nint main()\n{\n int n,m,k,sum;\n int i,a[1001];\n k=-1;\n while(scanf(\"%d%d\",&n,&m)!=EOF)\n {\n sum=0;\n for(i=0;i\nint main()\n{\n int n,s,sum=0,c=0,i,a[1010];\n scanf(\"%d %d\",&n,&s);\n for(i=0;i=sum-a[i]){c++;printf(\"YES\\n\"); break;}\n }if(c==0) printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint cmpfunc(const void * a, const void * b){\n return (*(int*)a - *(int*)b);\n}\n\nint main(int argc, char *argv[]){\n int i, n, vol, sum=0;\n scanf(\"%d %d\",&n,&vol);\n int arr[n];\n\n for(i=0;ivol){\n printf(\"NO\");\n }\n else{\n printf(\"YES\");\n }\n\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n\tint n, i, s, m = 0, sum;\n\n\tscanf (\"%d %d %d\", &n, &s, &m);\n\n\tsum = m;\n\n\tfor (i = 1; i < n; i++) {\n\t\tint a;\n\t\t\n\t\tscanf (\"%d\", &a);\n\t\t\n\t\tif (a > m) m = a;\n\t\tsum += a;\n\t}\n\n\tputs (sum - m <= s ? \"YES\" : \"NO\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,s,sum=0,c=0,i,a[1010];\n scanf(\"%d %d\",&n,&s);\n for(i=0;i=sum-a[i]){c++;printf(\"YES\\n\"); break;}\n }if(c==0) printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n\tint n, s, sum, max;\n\n\tscanf(\"%d%d\", &n, &s);\n\tsum = 0;\n\tmax = 0;\n\twhile (n-- > 0) {\n\t\tint a;\n\n\t\tscanf(\"%d\", &a);\n\t\tsum += a;\n\t\tif (max < a)\n\t\t\tmax = a;\n\t}\n\tprintf(\"%s\\n\", sum - max <= s ? \"YES\" : \"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#pragma warning(disable:4996)\n#include \n#include \n#include \n#include \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, sum = 0, s, i,now,max = 0;\n\tscanf(\"%i%i\", &n, &s);\n\tfor (i = 0; i < n; i++)\n\t{\n\t\tscanf(\"%i\", &now);\n\t\tsum += now;\n\t\tif (now > max)\n\t\t\tmax = now;\n\t}\n\tif (sum - max <= s)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,s;int i,t;int sum=0;\n scanf(\"%d%d\",&n,&s);\n int a[n];\nscanf(\"%d\",&a[0]);\nint g=a[0];\n for(i=1;i\nint main()\n{\n int n,s,a[1000],i,sum=0,j,temp=0;\n scanf(\"%d\",&n);\n scanf(\"%d\",&s);\n for(i=0;ia[i+1])\n {\n temp=a[i];\n a[i]=a[i+1];\n a[i+1]=temp;\n }\n }\n }\n for(i=0;i\n#include\n#include\nint compare (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\n\nint main()\n{\n int n,s,i;\n int sum=0;\n int x[101];\n scanf(\"%d %d\",&n,&s);\n for(i=0;is)\n {\n if(i<=(n-2))\n {\n printf(\"NO\");\n break;\n }\n else\n {\n printf(\"YES\");\n break;\n }\n }\n else if(i==n-2)\n {\n printf(\"YES\");\n break;\n }\n \n }\n \n //getch();\n \n \n return 0;\n}\n \n"}, {"source_code": "#include \n#include \nint cmp (const void *a,const void *b)\n{\n return *(int *)a-*(int *)b;\n}\nint main()\n{\n int n,s;\n scanf (\"%d%d\",&n,&s);\n int i,a[100005];\n for (i=0; i s)\n printf (\"NO\\n\");\n else printf (\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n,s;\n int i,j,k,temp,index,check=0;\n\n int vol[10000];\n\n scanf(\"%d %d\",&n,&s);\n\n temp = 0;\n for(i=0;itemp){\n temp = vol[i];\n index = i;\n\n }\n }\n\n for(i=0;is){\n printf(\"NO\\n\");\n\n }\n else{\n printf(\"YES\\n\");\n }\n return 0;\n\n}\n"}, {"source_code": "#include //AA06( 08/ 04/ 20) If u see my code, Have a Good Day!\n\nint main()\n{\n int n, s, max, i = 0, sum = 0, a[100];\n\n scanf(\"%d%d\", &n, &s);\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 if((sum - max) <= s) {\n printf(\"YES\\n\");\n }\n\n else {\n printf(\"NO\\n\");\n }\n\n\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tint n,s,i,t,j;\n\tscanf(\"%d %d\",&n,&s);\n\tint ara[1000];\n\tfor (i=0;i=0;i--){\n\t\tfor (j=0;jara[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\tt=0;\n\tfor (i=0;i\nint main()\n{\n\tint n, m, s = 0, a, mx = 0;\n\tscanf(\"%d%d\", &n, &m);\n\twhile (n--)\n\t{\n\t\tscanf(\"%d\", &a);\n\t\ts += a;\n\t\tif (a > mx)\n\t\t\tmx = a;\n\t}\n\tprintf((s - mx) > m ? \"NO\\n\" : \"YES\\n\");\n}"}, {"source_code": "#include\n#include\n#include\nint main() {\n int n,s;\n scanf(\"%d%d\",&n,&s);\n int *a=malloc(n*sizeof(int));\n if(a==NULL) {\n printf(\"n 没有分配到内存\\n\");\n }\n int i;\n //int min=1000+1;\n int sum=0;\n int max=0;\n for(i=0; imax) max=a[i];\n\tsum+=a[i];\n }\n //if(sum-min<=s) printf(\"YES\\n\");\n if(sum-max<=s) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n\n free(a);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\n int n , s,i,j ,f,sum;\n int arr[100001];\n\n scanf(\"%d%d\",&n,&s);\n f=0;\n\n for ( i = 0 ; i < n ; i++)\n scanf(\"%d\",&arr[i]);\n\n for ( i = 0 ; i < n ; i++)\n {\n sum = 0 ;\n for ( j = 0 ; j < n ; j++)\n if( j != i)\n sum += arr[j] ;\n\n if ( sum <= s)\n {\n f = 1;\n break ;\n }\n }\n\n if(f==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0 ;\n}\n"}, {"source_code": "#include\nint main()\n{\n\n int n , s,i,j ,f,sum;\n int arr[100001];\n\n scanf(\"%d%d\",&n,&s);\n f=0;\n\n for ( i = 0 ; i < n ; i++)\n scanf(\"%d\",&arr[i]);\n\n for ( i = 0 ; i < n ; i++)\n {\n sum = 0 ;\n for ( j = 0 ; j < n ; j++)\n if( j != i)\n sum += arr[j] ;\n\n if ( sum <= s)\n {\n f = 1;\n break ;\n }\n }\n\n if(f==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0 ;\n}\n"}, {"source_code": "#include \nint main()\n{\n\tint n, m, s = 0, a, mx = 0;\n\tscanf(\"%d%d\", &n, &m);\n\twhile (n--)\n\t{\n\t\tscanf(\"%d\", &a);\n\t\ts += a;\n\t\tif (a > mx)\n\t\t\tmx = a;\n\t}\n\tprintf((s - mx) > m ? \"NO\\n\" : \"YES\\n\");\n}"}, {"source_code": "#include\n\nint main()\n{\n int n, s,max=0,sum=0;\n scanf(\"%d%d\",&n,&s);\n for(int i=0;imax)\n max=num;\n }\n sum-=max;\n if(s>=sum)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include\n#include\nint sai(const void* a,const void* b)\n{\n\treturn *(int*)a-*(int*)b;\n}\nint main( )\n{\n\tint n,s,a[101],i=0,j=0,k=0,c=0;\n\tscanf(\"%d %d\",&n,&s);\n\tfor(i=0;i\n\nint n,s;\nint v[100];\n\nint main(){\n\tint i,total=0,f=0,aux;\n\tscanf(\"%d%d\",&n,&s);\n\tfor(i=0 ; i\nint main()\n{\n int n,s,i,j,t;\n t=0;\n\n\n scanf(\"%d %d\",&n,&s);\n int arra[n];\n for(i=0;i\nint main()\n{\n\tint n,threshold;\n\tscanf(\"%d%d\",&n,&threshold);\n\tint i,flag=0,data,max=-100,total=0;\n\tfor(i=0;imax)\n\t\t\tmax=data;\n\t\ttotal=total+data;\n\n\t}\n\tif(total-max<=threshold)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\treturn 0;\n\n}"}, {"source_code": "#include\nint main()\n{\n\tint n,s,i,a,c=0,max=0;\n\tscanf(\"%d %d\",&n,&s);\n\tfor(i=0;i\n#include \n\nint main()\n{\n int n;\n int s;\n int i ;\n scanf(\"%d %d\",&n,&s);\n int a[10000];\n for(i=0;imax)\n {\n max = a[i];\n }\n }\n int sum = 0;\n for(i=0;i\n\nint main()\n{\n int s,n,i,max=-1,sum=0;\n scanf(\"%d %d\",&n,&s);\n\n int ara[n];\n\n for(i=0;i\n\nint main(){\n int n, s, i, max = 0 ,sum = 0, t;\n scanf(\"%d %d\", &n, &s);\n for(i=0; i max)max = t;\n }\n if(sum-max <= s)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a[102],b,c,d,i,j,s=0,max=0;\n scanf(\"%d %d\",&b,&c);\n for(i=0;imax)\n max=a[i];\n \n }\n if(s-max<=c)\n printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include\nint comp(const void *p,const void *q);\nint main(){\n int n,s,i,k=0;\n int a[120];\n scanf(\"%d%d\",&n,&s);\n for(i=0;i\n#include\nint main()\n{\n int sum=0,m,n,a[10000],i,cnt=0;\n scanf(\"%d %d\",&m,&n);\n for(i=0;i=sum-a[i])\n {\n\n cnt++;\n break;\n }\n\n }\n if(cnt==0)\n printf(\"NO\");\n else\n printf(\"YES\");\n\n return 0;\n}\n\n"}, {"source_code": "#include\n\nint main(void)\n{\n int n,s,a[1001],bol=0,i,count=0,temp=0,j,sum=0;\n\n scanf(\"%d %d\",&n,&s);\n\n for(i=0;ia[j])\n {\n temp=a[i];\n a[i]=a[j];\n a[j]=temp;\n }\n }\n }\n\n for(i=0;is)\n bol=1;\n }\n\n if(bol==1)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n\n\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n\tint n , s ; scanf(\"%d %d\",&n,&s);\n\tint a , max = 0 , sum = 0;\n\tfor (int i = 0 ; i < n ; i++)\n\t{\n\t\tscanf(\"%d\" , &a);\n\t\tif ( a > max ) max = a ;\n\t\tsum += a;\n\t}\n\tif(sum-max<=s)printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int N, S, i, a, max=0, sum=0;\n \n scanf(\"%d%d\",&N,&S);\n for (i = 0; i < N; i++)\n {\n scanf(\"%d\",&a);\n if(max S)\n printf(\"NO\");\n else printf(\"YES\");\n return 0;\n}"}, {"source_code": "#include \nint main() {\n int mugs,cup,mug,max=0,acc=0;\n scanf(\"%d %d\",&mugs,&cup);\n for (int i=0; imax) max=mug;\n acc+=mug;\n }\n acc-=max;\n if (acc<=cup) {\n printf(\"YES\");\n } else {\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include\n#include\n#include\n#include\n\nint main()\n{\n\tint n,m,s=0;;\n\tscanf(\"%d %d\",&n,&m);\n\tint a[n];\n\tfor(int i=0;ia[j+1])\n\t\t {\n\t\t int p=a[j];\n\t\t a[j]=a[j+1];\n\t\t a[j+1]=p;\n\t\t }\t\n\t }\n\t}\n\tfor(int i=0;i\nmain()\n{\n int n,s,a[102],i,k,j,t,sum;\n while(scanf(\"%d%d\",&n,&s)!=EOF)\n {\n for(i=0; ia[j])\n k=j;\n if(k!=i)\n {\n t=a[i];\n a[i]=a[k];\n a[k]=t;\n }\n }\n for(i=0;i\n#include\n#include\nint mcp(const void*a,const void*b)\n{\n return (*(int*)b-*(int*)a);\n}\nmain()\n{\n int n,s,sum=0,sum2=0,a[200],i,j,cnt=0;\n scanf(\"%d %d\",&n,&s);\n for(i=0;is)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\"); \n\n return 0;\n} "}, {"source_code": "#include\nint main()\n{\n int i,j,n,s,a[105],sum=0,temp=0;\n scanf(\"%d %d\",&n,&s);\n for(i=0;i=a[j+1])\n {\n temp=a[j];\n a[j]=a[j+1];\n a[j+1]=temp;\n }\n }\n }\n for(i=0;i\nint main()\n{\n\tint n,threshold;\n\tscanf(\"%d%d\",&n,&threshold);\n\tint i,flag=0,data,max=-100,total=0;\n\tfor(i=0;imax)\n\t\t\tmax=data;\n\t\ttotal=total+data;\n\n\t}\n\tif(total-max<=threshold)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\treturn 0;\n\n}"}, {"source_code": "#include\nint main()\n{\n int N, S, i, a, max=0, sum=0;\n\n scanf(\"%d%d\",&N,&S);\n for (i = 0; i < N; i++)\n {\n scanf(\"%d\",&a);\n if(max S)\n printf(\"NO\");\n else printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n, a, max, i, s ;\n scanf (\"%d %d%d\", &n, &max, &a ) ;\n s = a ;\n if (n == 6 && max == 38 )\n printf (\"YES\" ) ;\n\n else\n {\n if (n == 6 && max == 14 )\n printf (\"YES\" ) ;\n else\n {\n if (n == 78 && max == 400 )\n printf (\"YES\" ) ;\n else\n {\n if (n ==49 && max == 272)\n printf (\"YES\" ) ;\n else\n {\n if (n == 91 && max == 486)\n printf (\"YES\" ) ;\n else\n {\n for (i = 1 ; i < n-1 ; i++ )\n {\n scanf (\"%d\", &a ) ;\n s = s + a ;\n }\n if (s > max )\n printf(\"NO\") ;\n else\n printf (\"YES\" ) ;\n }\n }\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n, s,max=0,sum=0;\n scanf(\"%d%d\",&n,&s);\n for(int i=0;imax)\n max=num;\n }\n sum-=max;\n if(s>=sum)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int a,b,i,k,sum=0;\n scanf(\"%d %d\",&a,&b);\n int x[a];\n for(i=0;ik)\n k=x[i];\n sum=sum+x[i];\n }\n if(sum-k<=b)\n printf(\"YES\");\n else\n printf(\"NO\"); \n return 0;\n}"}, {"source_code": "#include \n#include \nint cmp (const void *a,const void *b)\n{\n return *(int *)a-*(int *)b;\n}\nint main()\n{\n int n,s;\n scanf (\"%d%d\",&n,&s);\n int i,a[100005];\n for (i=0; i s)\n printf (\"NO\\n\");\n else printf (\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main()\n{\n long int n,s,i,j,temp;\n scanf(\"%ld %ld\",&n,&s);\n long int *a;\n a=(long int*)malloc(n*sizeof(long int));\n for(i=0;ia[j])\n \t\t{\n \t\t\ttemp=a[i];\n \t\t\ta[i]=a[j];\n \t\t\ta[j]=temp;\n \t\t}\n \t}\n \t }\n long int sum=0;\t \n \tfor(i=0;i\nint main()\n{\n int n,s,x=0;\n scanf(\"%d %d\",&n,&s);\n int a[n],i,j,temp,flag=0;\n for(i=0;i=a[j+1]){\n temp=a[j];\n a[j]=a[j+1];\n a[j+1]=temp;\n }\n }\n }\n for(i=0;i=x){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,s,i,c=0;\n scanf(\"%d %d\",&n,&s);\n int a[n];\n int sum=0,max=0;\n for(i=0;imax){\n max=a[i];\n }\n }\n //printf(\"%d\",max);\n if(sum-max<=s)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include\nint cmp(int *a,int *b)\n{\n return *a-*b;\n}\nint main()\n{\n int n,i,s,a[1000];\n int ans=0;\n scanf(\"%d%d\",&n,&s);\n for(i=0;i\nint main(){\n int n,m,z=0,s=0;\n scanf(\"%d%d\",&n,&m);\n int a[n];\n for(int i=0;im){\n printf(\"NO\\n\");\n }\n else{\n printf(\"YES\\n\");\n }\n return 0;\n}"}, {"source_code": "#include \n#include \n\nint compare(const void*p, const void*q)\n{\n\tint x=*(int*)p;\n\tint y=*(int*)q;\n\t\n\tif(x>y)\n\treturn 1;\n\t\n\tif(x==y)\n\treturn 0;\n\t\n\tif(xs)\n\t\t{\n\t\t\tprintf(\"NO\");\n\t\t\tbreak;\n\t\t}\n\t}\n\t\n\tif(i==n-1)\n\tprintf(\"YES\");\n\t\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,s;\n scanf(\"%d%d\",&n,&s);\n int a[n],i;\n for(i=0;ia[j])\n {\n t=a[i];\n a[i]=a[j];\n a[j]=t;\n }\n }\n }\n int sum=0;\n for(i=0;i\n#include \nint main()\n{\n int n, s;\n scanf(\"%d%d\", &n, &s);\n int *a = (int *)malloc(sizeof(int)*n);\n int i;\n for (i = 0; i < n; i++)\n {\n scanf(\"%d\", &a[i]);\n }\n int j, sum = 0;\n for (i = 0; i < n; i++)\n {\n for (j = 0; j < n; j++)\n {\n sum += a[j];\n }\n sum -= a[i];\n if (sum <= s){\n printf(\"YES\\n\");\n return 0;\n }\n sum = 0;\n }\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include\n#include\nint a[120],n,s;\nint Rising(const void *p1,const void *p2){return *(int*)p1-*(int*)p2;}\nint main()\n{\n\tscanf(\"%d%d\",&n,&s);\n\tint i=0,sum=0;for(;i\n\nint main ()\n {\n unsigned short n;\n unsigned short s;\n unsigned short ax;\n unsigned short ta;\n unsigned short i;\n unsigned short a;\n \n if (scanf(\"%hu %hu\",&n,&s) != 2)\n return -1;\n if (n < 2 || n > 100 || s < 1 || s > 1000)\n return -1;\n ax = ta = 0;\n for (i = 0; i < n; i++)\n {\n if (scanf(\"%hu\",&a) != 1)\n return -1;\n if (a < 1 || a > 10)\n return -1;\n if (a > ax)\n ax = a;\n ta += a;\n }\n printf (ta-ax <= s ? \"YES\\n\" : \"NO\\n\");\n return 0;\n }\n"}, {"source_code": "#include\nint main()\n{ int n,s,i,j,a[105],total,check;\n\n while(scanf(\"%d%d\",&n,&s)!=EOF)\n {for(i=0;i\nint main(){\n int n,s,i,sum=0,a[100],max=0;\n scanf(\"%d%d\",&n,&s);\n for(i=0;i=(sum-max)?printf(\"YES\"):printf(\"NO\");\n}"}, {"source_code": "#include\n#include\nint main()\n{\n int i,j,n,s,temp;\n scanf(\"%d%d\",&n,&s);\n int a[n];\n for(i=0;ia[j+1])\n {\n temp=a[j];\n a[j]=a[j+1];\n a[j+1]=temp;\n }\n }\n }\n int c=0,sum=0;\n for(i=0;i=n-1) printf(\"YES\");\n else printf(\"NO\");\n \n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int n,x,i,j,total=0,c=10;\n scanf(\"%d %d\",&n,&x);\n int s[n];\n\n\n for(i=0;i= total-s[i])\n {\n c=0;\n break;\n }\n }\n\n if(c==0)\n printf(\"YES\");\n else printf(\"NO\");\n}\n\n\n\n\n\n\n"}, {"source_code": "\n#include\nint main()\n{\n int n,a[105],s,i,j,temp,sum=0;\n scanf(\"%d %d\",&n,&s);\n for(i=0;i\n#include\n#include\nint mcp(const void*a,const void*b)\n{\n return (*(int*)b-*(int*)a);\n}\nmain()\n{\n int n,s,sum=0,sum2=0,a[200],i,j,cnt=0;\n scanf(\"%d %d\",&n,&s);\n for(i=0;is)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\"); \n\n return 0;\n} "}, {"source_code": "#include \n\nint main()\n{\n int s,n,i,max=-1,sum=0;\n scanf(\"%d %d\",&n,&s);\n\n int ara[n];\n\n for(i=0;i\n\nint main()\n{\n\tint n, i, s, m = 0, sum;\n\n\tscanf (\"%d %d %d\", &n, &s, &m);\n\n\tsum = m;\n\n\tfor (i = 1; i < n; i++) {\n\t\tint a;\n\t\t\n\t\tscanf (\"%d\", &a);\n\t\t\n\t\tif (a > m) m = a;\n\t\tsum += a;\n\t}\n\n\tputs (sum - m <= s ? \"YES\" : \"NO\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n#include \nint main()\n{\n\n int n,s,i,j,k,sum=0;\n scanf(\"%d%d\",&n,&s);\n int a[n];\n for(i=0;ia[j]){\n k=a[i];\n a[i]=a[j];\n a[j]=k;\n }\n }\n }\n for(i=0;i\nint main()\n{\n int i,n,s,a=0,b,max,c;\n int x[100];\n scanf(\"%d%d\",&n,&s);\n for(i=0;i\nint main()\n{\n int n,s,x=0;\n scanf(\"%d %d\",&n,&s);\n int a[n],i,j,temp,flag=0;\n for(i=0;i=a[j+1]){\n temp=a[j];\n a[j]=a[j+1];\n a[j+1]=temp;\n }\n }\n }\n for(i=0;i=x){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": " #include \n #include \n int main()\n {\n int n,s,i,a,max=-1,sum=0;\n scanf(\"%d%d\",&n,&s);\n for(i=0;imax)\n max=a;\n }\n if(sum-max <= s)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n }\n"}, {"source_code": "#include\n\nint n,s;\nint v[100];\n\nint main(){\n\tint i,total=0,f=0,aux;\n\tscanf(\"%d%d\",&n,&s);\n\tfor(i=0 ; i\nint main()\n{\n int n,s;\n scanf(\"%d%d\",&n,&s);\n int a[n];\n int i,j,x;\n for(i=0;ia[i+1])\n {\n x=a[i];\n a[i]=a[i+1];\n a[i+1]=x;\n }\n if(i==0 && j==n) break;\n }\n if(j==n) break;\n }\n /*for(i=0;is) printf(\"NO\");\n else printf(\"YES\");\n}\n"}, {"source_code": "#include\n\nint n,s;\nint v[100];\n\nint main(){\n\tint i,total=0,f=0,aux;\n\tscanf(\"%d%d\",&n,&s);\n\tfor(i=0 ; i\n#include\n#include\n#include\n#include\n\nint main()\n{\n\tint n,s,x,sum=0,max=INT_MIN;\n\tscanf(\"%d %d\",&n,&s);\n\twhile(n--)\n\t{\n\t\tscanf(\"%d\",&x);\n\t\tsum+=x;\n\t\tmax=(max>x)?max:x;\n\t}\n\tif(sum-max <= s)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n}\n"}, {"source_code": "#include\n#include\n#include\nint main()\n{\n int n,s,i,a,max_a=1;\n long long int sum = 0;\n scanf(\"%d %d\",&n,&s);\n for(i=1;i<=n;i++){\n scanf(\"%d\",&a);\n sum = sum + a;\n if(a>=max_a) max_a=a;\n }\n if((sum-max_a)<=s)printf(\"YES\");\n else printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "\n#include\nmain()\n{\n int n,s,i,j,p,sum=0,a[100];\n scanf(\"%d %d\",&n,&s);\n for(i=0;ia[j])\n {\n p=a[i];\n a[i]=a[j];\n a[j]=p;\n }\n }\n }\n for(i=0;i\n#include\n#include\nint main()\n{\n int n,s,k,c,j=0;\n scanf(\"%d %d\",&n,&s);\n int a[n],m=0;\n for(int i=0;ia[j])\n {\n k=a[i];\n a[i]=a[j];\n a[j]=k;\n }\n }\n }\n for(int i=0;is)\n {\n if(j==n)\n {c=0;\n break;}\n else if(j!=n)\n {\n c=1;\n break;\n }\n }\n else if(m==s)\n {\n if(j==n-1)\n {c=0;\n break;}\n else if(j!=n-1)\n {\n c=1;\n break;\n }\n }\n else if(m\nint main()\n{\n int n,s,x=0;\n scanf(\"%d %d\",&n,&s);\n int a[n],i,j,temp,flag=0;\n for(i=0;i=a[j+1]){\n temp=a[j];\n a[j]=a[j+1];\n a[j+1]=temp;\n }\n }\n }\n for(i=0;i=x){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int i,n,s,a=0,b,max,c;\n int x[100];\n scanf(\"%d%d\",&n,&s);\n for(i=0;i\n#include \n#include \n#include \n#include \n\n#define MAXN 1005\n#define N 105\n#define INF 1<<30\n#define eps 1.0e-10\n\n#define For(i,m,n) for(i=(m);i(y)?(x):(y)\n#define MIN(x,y) (x)<(y)?(x):(y)\n\nint main()\n{\n int i, j, n, t, sum=0, max=0, x;\n scanf(\"%d%d\",&n,&t);\n For(i,0,n) scanf(\"%d\",&x), sum+=x, max=MAX(max,x);\n if(sum-max>t) puts(\"NO\");\n else puts(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n\n int n,s;\n scanf(\"%d %d\",&n,&s);\n int arr[n];\n int i;\n for(i=0;iarr[i])\n {\n int temp=arr[i];\n arr[i]=arr[j];\n arr[j]=temp;\n }\n\n }\n}\n for(i=0;is)\n {\n printf(\"NO\");\n return 0;\n }\n }\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include \nint main ()\n{\n int n,s,a,x=0,max=0,i,j;\n scanf(\"%d %d\",&n,&s);\n for(i=1;i<=n;i++) {\n scanf(\"%d\",&a);\n x=x+a;\n if(a>max) {\n max=a;\n }\n }\n j=x-max;\n if(j>s) {\n printf(\"NO\\n\");\n }\n else {\n printf(\"YES\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include\n\nint n,s;\nint v[100];\n\nint main(){\n\tint i,total=0,f=0,aux;\n\tscanf(\"%d%d\",&n,&s);\n\tfor(i=0 ; i\n\nint main(void) \n{\nint n,s;\nscanf(\"%d %d\\n\",&n,&s);\nint ara[n],i=0,r=0,x=0;\nfor(i=0;ir){\nr=ara[i];\n}\n}\nif(s<(x-r)){\nprintf(\"NO\");\n}\nelse{printf(\"YES\");}\n\t\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\nint n,s,count=0,t;\nscanf(\"%d%d\",&n,&s);\nint a[n],i,j,sum=0;\nfor(i=0;ia[j])\n {\n t=a[i];\n a[i]=a[j];\n a[j]=t;\n }\n }\n}\nfor(i=0;is)\n {\n count=1;\n break;\n }\n}\nif(count==1)\n printf(\"NO\");\nelse\n printf(\"YES\");\nreturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int n, s, i, u = 0, ma = 0;\n scanf(\"%d %d\", &n, &s);\n int a[n];\n for (i = 0; i < n; i++)\n scanf(\"%d\", &a[i]);\n for (i = 0; i < n; i++)\n u += a[i];\n for (i = 0; i < n; i++)\n if (a[i] > ma)\n ma = a[i];\n if (u - ma <= s)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int a,b,i,k,sum=0;\n scanf(\"%d %d\",&a,&b);\n int x[a];\n for(i=0;ik)\n k=x[i];\n sum=sum+x[i];\n }\n if(sum-k<=b)\n printf(\"YES\");\n else\n printf(\"NO\"); \n return 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n int mugs,volume_of_cups,volume_of_mugs,max=0,sum=0;\n while(scanf(\"%d %d\", &mugs,&volume_of_cups) != EOF)\n {\n while(mugs--)\n {\n scanf(\"%d\", &volume_of_mugs);\n if(volume_of_mugs>max)\n max=volume_of_mugs;\n sum+=volume_of_mugs;\n }\n\n if((sum-max)<=volume_of_cups)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n max=0;\n sum=0;\n }\n return 0;\n}"}, {"source_code": "#include \nint main()\n{\n int m,c,v[100],i=0,max=0,sum=0;\n scanf(\"%d\",&m);\n scanf(\"%d\",&c);\n for(i=0;imax)\n {\n max=v[i];\n }\n }\n for(i=0;i\nvoid swap(int* a,int* b)\n{\n\tint tmp=*a;\n\t*a=*b;\n\t*b=tmp;\n\treturn;\n}\nint main()\n{\n\tint i,j,f=0,n,m=0,s,a[100];\n\tscanf(\"%d%d\",&n,&s);\n\tfor(i=0;ia[j])\n\t\t\t\tswap(&a[i],&a[j]);\n\tfor(i=0,j=0;i\nint main()\n{\n\n int n , s,i,j ,f,sum;\n int arr[100001];\n\n scanf(\"%d%d\",&n,&s);\n f=0;\n\n for ( i = 0 ; i < n ; i++)\n scanf(\"%d\",&arr[i]);\n\n for ( i = 0 ; i < n ; i++)\n {\n sum = 0 ;\n for ( j = 0 ; j < n ; j++)\n if( j != i)\n sum += arr[j] ;\n\n if ( sum <= s)\n {\n f = 1;\n break ;\n }\n }\n\n if(f==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0 ;\n}\n"}], "negative_code": [{"source_code": "#include\nint main()\n{\n int n,s,i,max=0,sum=0;\n int a[1000];\n scanf(\"%d%d\",&n,&s);\n for(i=0;imax)\n max=a[i];\n }\n //printf(\"%d%d\",sum,max);\n if(sum-max<=s){\n printf(\"Yes\\n\");\n }\n else{\n printf(\"No\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(void) {\n int n,s,i,a[500],sum;\n scanf(\"%d %d\",&n,&s);\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n sum=0;\n for(i=2;i<=n;i++)\n {\n sum+=a[i];\n }\n if(sum<=s)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n\n int n,s;\n scanf(\"%d %d\",&n,&s);\n int arr[n];\n int i;\n for(i=0;i\nint main()\n{\n int n,s;int i,t;int sum=0;\n scanf(\"%d%d\",&n,&s);\n\n for(i=0;i\n\nint main()\n{\n int n,m,i,k;\n\n scanf(\"%d %d\",&n,&m);\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&k);\n if(k>=m)\n {\n printf(\"NO\");\n return 0;\n\n }\n }\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,s,i,a[100],sum=0;\n scanf(\"%d%d\",&n,&s);\n for(i=0;i\nint main()\n{\n\tint i,f,n,s,a;\n\tscanf(\"%d%d\",&n,&s);\n\tfor(i=0;i\nint main()\n{\n int n,s,i,sum=0;\n scanf(\"%d %d\",&n,&s);\n int a[n];\n for(i=0;i\nint main()\n{\n\tint n,threshold;\n\tscanf(\"%d%d\",&n,&threshold);\n\tint i,flag=0,data;\n\tfor(i=0;i=threshold)\n\t\t\tflag=1;\n\n\t}\n\tif(!flag)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\treturn 0;\n\n}"}, {"source_code": "#include\n#include\n#define pf printf\n#define sf scanf\n\nint main()\n{\n\tint n, s, a = 0, count = 0;\n\tint i;\n\tsf(\"%d\", &n);\n\tsf(\"%d\", &s);\n\t\n\tfor(i = 0; i < n; i++)\n\t{\n\t\tsf(\"%d\", &a);\n\t\tcount += a; \n\t}\n\tif(count <= s)\n\t\tpf(\"YES\\n\");\n\telse\n\t\tpf(\"NO\\n\");\n\t\t\n\treturn 0;\n\t\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n#define sort radix_sort(a,n)\nint min(int p,int q)\n{\n if(p>q) return q;\n else return p;\n}\nint max(int p,int q)\n{\n if(p>q) return p;\n else return q;\n}\ntypedef long long int ll;\n //n=inp();\n\nvoid radix_sort(int a[], int n)\n{\n int i, x[n+1], m = 0, exp = 1;\n for (i = 1; i <= n; i++)\n if (a[i] > m)\n m = a[i];\n while (m / exp > 0)\n {\n int box[10] = {0,0,0,0,0,0,0,0,0,0};\n for (i = 0; i < n; i++)\n box[a[i] / exp % 10]++;\n for (i = 1; i < 10; i++)\n box[i] += box[i - 1];\n for (i = n-1; i >= 0; i--)\n {\n x[--box[a[i] / exp % 10]] = a[i];\n }\n for (i = 0; i < n; i++)\n {\n a[i] = x[i];\n }\n exp *= 10;\n }\n}\n //sort;\nint main()\n{\n int t,n,i,s,sm=0;\n scanf(\"%d%d\",&n,&s);\n int a[n];\n for(i=0;i<=n-1;i++)\n scanf(\"%d\",&a[i]);\n //radix_sort(a,n);\n for(i=0;i<=n-2;i++)\n {\n sm=sm+a[i];\n }\n if(sm<=s)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n int a,b,flag=1,i;\n\nscanf(\"%d %d\",&a,&b);\nint c[a];\nfor(i=0;i=b)flag=0;\n}\nif(flag==0)printf(\"NO\");\nelse printf(\"YES\");\n}\n"}, {"source_code": "#include\n#include\n#define pf printf\n#define sf scanf\n\nint main()\n{\n\tint n, s, a[101];\n\tlong long count = 0;\n\tint i;\n\tsf(\"%d\", &n);\n\tsf(\"%d\", &s);\n\t\n\tfor(i = 0; i < n; i++)\n\t{\n\t\tscanf(\"%d\", &a[i]);\t\t\n\t}\n\tfor(i = 0; i < n - 1; i++)\n\t{\n\t\tcount += a[i];\n\t}\n\tif(count <= s)\n\t\tpf(\"YES\");\n\telse\n\t\tpf(\"NO\");\n\t\t\n\treturn 0;\n\t\n}\n"}, {"source_code": "#include\nint main()\n{ int n,s,i,j,a[105],total,check;\n scanf(\"%d%d\",&n,&s);\n\n for(i=0;i\nint main()\n{\n\tint n,threshold;\n\tscanf(\"%d%d\",&n,&threshold);\n\tint i,flag=0,data;\n\tfor(i=0;i=threshold)\n\t\t\tflag++;\n\n\t}\n\tif(flag\nint main()\n{\n int n,s,a[1000],i,sum=0,j,temp=0;\n scanf(\"%d\",&n);\n scanf(\"%d\",&s);\n for(i=0;ia[i+1])\n {\n temp=a[i];\n a[i]=a[i+1];\n a[i+1]=temp;\n }\n }\n }\n for(i=0;i\n\nint main(void)\n{\n int n,s,a[1001],bol=0,i,count=0;\n\n scanf(\"%d %d\",&n,&s);\n\n for(i=0;i=n-1)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n\n return 0;\n}\n"}, {"source_code": "#include\nint a[1100];\nint main(){\n\tint n,s,flag,i;\n\twhile(scanf(\"%d %d\",&n,&s)!=EOF){\n\t\tfor(i=0,flag=1;i=s)\n\t\t\t\tflag=0;\n\t\t}\n\t\tif(flag==1)\n\t\t\tprintf(\"YES\\n\");\n\t\telse\n\t\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}\n\n\n"}, {"source_code": "#include \n#include \n#include \n#include \n#include \n\n#define MAXN 1005\n#define N 105\n#define INF 1<<30\n#define eps 1.0e-10\n\n#define For(i,m,n) for(i=(m);i(y)?(x):(y)\n#define MIN(x,y) (x)<(y)?(x):(y)\n\nint main()\n{\n int i, j, n, t, sum=0, max=0, x;\n scanf(\"%d%d\",&n,&t);\n For(i,0,n) scanf(\"%d\",&x), sum+=x, max=MAX(max,x);\n if(sum-x>t) puts(\"NO\");\n else puts(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,s,i,k;\n\n\n scanf(\"%d %d\",&n,&s);\n for(i=0;i=s){\n printf(\"NO\");\n break;}\n }\n\n if(i==n)printf(\"YES\");\n return 0;\n\n }\n"}, {"source_code": "#include\n#include\n#define pf printf\n#define sf scanf\n\nint main()\n{\n\tint n, s, a[101];\n\tlong long count = 0;\n\tint i;\n\tsf(\"%d\", &n);\n\tsf(\"%d\", &s);\n\t\n\tfor(i = 0; i < n; i++)\n\t{\n\t\tscanf(\"%d\", &a[i]);\t\t\n\t}\n\tfor(i = 0; i < n - 1; i++)\n\t{\n\t\tcount += a[i];\n\t}\n\tif(count <= s)\n\t\tpf(\"YES\");\n\telse\n\t\tpf(\"NO\");\n\t\t\n\treturn 0;\n\t\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,s;\n scanf(\"%d%d\",&n,&s);\n int a[n],i;\n for(i=0;i=s)\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n printf(\"YES\\n\");\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int n,s,j=0,c=0,d;\n int m=0;\n scanf(\"%d %d\",&n,&s);\n int a[n];\n for(int i=0;ia[k])\n {\n d=a[i];\n a[i]=a[k];\n a[k]=d;\n }\n }\n }\n for(int i=0;i=s||j==n-1)\n {\n if(j==n-1)\n {\n c=1;\n break;\n }\n else\n {\n c=0;\n break;\n }\n }\n }\n if(c==1)\n {\n printf(\"YES\");\n }\n else if(c==0)\n {\n printf(\"NO\");\n }\n return 0;\n}\n\n"}, {"source_code": "#include \nint main()\n{\n int tz,v1,x,y,t,aux,f;\n scanf(\"%d\",&tz);\n int i;\n int arr[tz];\n for(i=0;iarr[y])\n {\n aux=arr[x];\n arr[x]=arr[y];\n arr[y]=aux;\n }\n i=0;\n x=0;\n f=0;\n\n while(i\n\nint main(void)\n{\n int n, s, i, max_index = 0, sum;\n int a[100];\n scanf(\"%d%d\", &n, &s);\n for(i = 0; i < n; ++i)\n scanf(\"%d\", &a[i]);\n for(i = 1; i < n; ++i)\n if(a[i] > a[max_index])\n max_index = i;\n for(i = 0; i < n; ++i)\n if(i != max_index)\n sum += a[i];\n if(sum <= s)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n}\n"}, {"source_code": "#include\n#include \nint main()\n{\t\n int n, s, i, j, temp, vol, a[100];\n\twhile(scanf(\"%d %d\", &n, &s) != EOF)\n\t{\n\t\tvol = 0;\n\t\tfor(i = 0; i < n; i++)\n\t\t{\n\t\t\tscanf(\"%d\", &a[i]);\n\t\t}\n for(i = 0; i < n - 1; i++)\n\t\t\tfor(j = 0; j < n - 1 - i; j++)\n\t\t\tif(a[j] > a[j + 1])\n\t\t\t{\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\tfor(i = 0 ; i < n - 1; i++)\n\t\t{\n\t\t\tvol += a[i];\n\t\t}\n\t\tif(vol > s)\n\t\t\tprintf(\"No\\n\");\n\t\telse\n\t\t\tprintf(\"Yes\\n\");\n\t}\n\treturn 0;\n\n}\n"}, {"source_code": "#include\nint main()\n{\nint n,s,count=0;\nscanf(\"%d%d\",&n,&s);\nint a[n],i,j,sum=0;\nfor(i=0;is)\n {\n count=1;\n break;\n }\n}\nif(count==1)\n printf(\"NO\");\nelse\n printf(\"YES\");\nreturn 0;\n}\n"}, {"source_code": "#include \n\n#define N 1000\n\nint arr[N] = {0};\n\nvoid Swap(int *x, int *y)\n{\n\tint tmp;\n\ttmp = *x;\n\t*x = *y;\n\t*y = tmp;\n}\n\nvoid Sorting(int n)\n{\n\tint i, j;\n\n\tfor (i = 0; i < n; ++i)\n\t{\n\t\tfor (j = 0; j < n; ++j)\n\t\t{\n\t\t\tif (arr[i] < arr[j])\n\t\t\t\tSwap(arr + i, arr + j);\n\t\t}\n\t}\n}\n\nint main(void)\n{\n\tint i;\n\tint tmp;\n\tint n, s;\n\tlong long count = 0;\n\n\tscanf(\"%i %i\", &n, &s);\n\n\tfor (i = 0; i < n; ++i)\n\t{\n\t\tscanf(\"%i\", &tmp);\n\t\tarr[i] = tmp;\n\t}\n\n\tSorting(n);\n\n\tfor (i = 0; i < n - 1; ++i)\n\t\tcount += arr[i];\n\n\tif (count <= s)\n\t\tprintf(\"Yes\\n\");\n\telse\n\t\tprintf(\"No\\n\");\n\n\n\treturn 0;\n}"}, {"source_code": "#include\n#include\n#include\n#include\n\nint main()\n{\n\tint n,s,x,f=0;\n\tscanf(\"%d %d\",&n,&s);\n\twhile(n--)\n\t{\n\t\tscanf(\"%d\",&x);\n\t\tif(x>=s)\n\t\t\tf=1;\n\t}\n\tif(f==0)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int m,n,a[10000],i,cnt=0;\n scanf(\"%d %d\",&m,&n);\n for(i=0;im)\n {\n\n cnt++;\n break;\n }\n\n }\n if(cnt==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n return 0;\n}\n\n"}, {"source_code": "#include\nint main(void)\n{\n int i,x=0,a,n,s;\n scanf(\"%d %d\",&n,&s);\n for(i=0;i=s)\n x++;\n }\n if(x!=0)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include \nmain()\n{\n int m,c,v[100],i=0,flag=0,sum=0;\n scanf(\"%d\",&m);\n scanf(\"%d\",&c);\n for(i=0;i\nint main()\n{\n\tint f=1,n,s,a;\n\tscanf(\"%d %d\",&n,&s);\n\twhile(n--)\n\t{\n\t\tscanf(\"%d\",&a);\n\t\tif(a>=s) {f=0;break;}\n\t\telse f=1;\t\t\n\t}\n\t\n\tif(f)\n\t printf(\"YES\\n\");\n else \n printf(\"NO\\n\");\n\t\n return 0;\t\n}"}, {"source_code": "#include\n#include\nint main( )\n{\n\tint n,s,a[101],i=0,j=0,k=0,c=0;\n\tscanf(\"%d %d\",&n,&s);\n\tfor(i=0;i\nmain()\n{\n int n,s,a[102],i,k;\n while(scanf(\"%d%s\",&n,&s)!=EOF)\n {\n for(i=0; i=s)\n {\n k=1;\n break;\n }\n if(k==0)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n,s;\n int i,j,k,temp,check=0;\n\n int vol[10000];\n\n scanf(\"%d %d\",&n,&s);\n\n temp = 0;\n for(i=0;itemp){\n temp = i;\n }\n }\n\n for(i=0;i<(n-1);i++){\n if(i!=temp){\n check = check + vol[i];\n }\n }\n\n if(check>s){\n printf(\"NO\\n\");\n\n }\n else{\n printf(\"YES\\n\");\n }\n return 0;\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,s;\n scanf(\"%d%d\",&n,&s);\n int a[n],i;\n for(i=0;i=s)\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n printf(\"YES\\n\");\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n#include \n\n#define MAXN 1005\n#define N 105\n#define INF 1<<30\n#define eps 1.0e-10\n\n#define For(i,m,n) for(i=(m);i(y)?(x):(y)\n#define MIN(x,y) (x)<(y)?(x):(y)\n\nint main()\n{\n int i, j, n, t, sum=0, max=0, x;\n scanf(\"%d%d\",&n,&t);\n For(i,0,n) scanf(\"%d\",&x), sum+=x, max=MAX(max,x);\n if(sum-x>t) puts(\"NO\");\n else puts(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,s;\n scanf(\"%d%d\",&n,&s);\n int a[n],i;\n for(i=0;i=s)\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n printf(\"YES\\n\");\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n, a, max, i, s ;\n scanf (\"%d %d%d\", &n, &max, &a ) ;\n s = a ;\n for (i = 1 ; i < n-1 ; i++ )\n {\n scanf (\"%d\", &a ) ;\n s = s + a ;\n }\n if (s > max )\n printf(\"NO\") ;\n else\n printf (\"YES\" ) ;\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n,m,i,k;\n\n scanf(\"%d %d\",&n,&m);\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&k);\n if(k>=m)\n {\n printf(\"NO\");\n return 0;\n\n }\n }\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int n,s,j=0,c=0,d;\n int m=0;\n scanf(\"%d %d\",&n,&s);\n int a[n];\n for(int i=0;ia[k])\n {\n d=a[i];\n a[i]=a[k];\n a[k]=d;\n }\n }\n }\n for(int i=0;i=s||j==n-1)\n {\n if(j==n-1)\n {\n c=1;\n break;\n }\n else\n {\n c=0;\n break;\n }\n }\n }\n if(c==1)\n {\n printf(\"YES\");\n }\n else if(c==0)\n {\n printf(\"NO\");\n }\n return 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n int n,s,i,cnt=0;\n scanf(\"%d %d\",&n,&s);\n int a[n];\n for(i=0;i=s)\n {\n cnt++;\n }\n }\n if(cnt==0)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,s,i,j,temp,count=0,a[100];\n scanf(\"%d%d\",&n,&s);\n\n for(i=0;ia[j])\n {\n temp=a[i];\n a[i]=a[j];\n a[j]=temp;\n }\n }\n }\n for(i=0;i=0)\n {\n count++;\n s=s-a[i];\n }\n }\n if(count>=n-1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,s,i,j,sum=0;\n char a[1000];\n scanf(\"%d %d\",&n,&s);\n for(i=0; i\nmain()\n{\n int n,s,i,sum=0,a[100];\n scanf(\"%d %d\",&n,&s);\n for(i=0;i\n\nint main(void)\n{\n int n,s,a[1001],bol=0,i,count=0;\n\n scanf(\"%d %d\",&n,&s);\n\n for(i=0;i\n#include\n#define pf printf\n#define sf scanf\n\nint main()\n{\n\tint n, s, a = 0, count = 0;\n\tint i;\n\tsf(\"%d\", &n);\n\tsf(\"%d\", &s);\n\t\n\tfor(i = 0; i < n; i++)\n\t{\n\t\tsf(\"%d\", &a);\n\t\tcount += a; \n\t}\n\tif(a <= s)\n\t\tpf(\"YES\\n\");\n\telse\n\t\tpf(\"NO\\n\");\n\t\t\n\treturn 0;\n\t\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,c[100],i,j,k,d=0,max=0;\n scanf(\"%d %d\",&a,&b);\n for(i=0;imax){\n max=c[i];\n }\n for(i=0;ib){printf(\"NO\\n\");}\n\n\n else if(d-max<=b)\n printf(\"YES\\n\");\n\n}\n"}, {"source_code": "#include\n#include\n\nint main()\n{\n\tint n,s;\n\tint a[101];\n\tscanf(\"%d%d\",&n,&s);\n\tint j,i;\n\tint max=0;\n\tint maxj=-1;\n\tfor(i=0;i=s)\n\t\t{\n\t\t\t\tflag=1;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\tif(flag==0)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\treturn 0;\n}\n\n\n\n"}, {"source_code": "#include\n#include\nint main()\n{\n int m,n,a[10000],i,cnt=0;\n scanf(\"%d %d\",&m,&n);\n for(i=0;im)\n {\n\n cnt++;\n break;\n }\n\n }\n if(cnt==0)\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\"\nint cmp(const void *a,const void *b)\n{\n\treturn (*(int *)a-*(int *)b);\n}\nint main(int argc, char const *argv[])\n{\n\t\n\tint n,s;\n\tint a[102];\n\tint count;\n\tint i;\n\tint sum;\n\twhile(scanf(\"%d%d\",&n,&s)!=EOF)\n\t{\n\t\tsum=0;\n\t\tcount=0;\n\t\tfor(i=1;i<=n;i++)\n\t\t\tscanf(\"%d\",&a[i]);\n\t\tqsort(a,n,sizeof(a[0]),cmp);\n\t\tfor(i=1;i<=n;i++)\n\t\t{\n\t\t\t\tsum+=a[i];\n\t\t\t\tcount++;\n\t\t\t\tif(sum>s)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"NO\\n\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\tif(s>=sum&&s<=sum+a[i])\n\t\t\t{\n\t\t\t\tif(count==(n-1))\n\t\t\t\t\t{\n\t\t\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\tprintf(\"NO\\n\");\n\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t}\n\t\t\n\t\t\t\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n,s,i,a[1000],max=0;\n scanf(\"%d%d\",&n,&s);\n for(i=0;i=s)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n, a, max, i, s ;\n scanf (\"%d %d%d\", &n, &max, &a ) ;\n s = a ;\n if (n == 6 && max == 38 )\n printf (\"YES\" ) ;\n\n else\n {\n if (n == 6 && max == 14 )\n printf (\"YES\" ) ;\n else\n {\n if (n == 78 && max == 400 )\n printf (\"YES\" ) ;\n else\n {\n if (n ==49 && max == 272)\n printf (\"YES\" ) ;\n else\n {\n for (i = 1 ; i < n-1 ; i++ )\n {\n scanf (\"%d\", &a ) ;\n s = s + a ;\n }\n if (s > max )\n printf(\"NO\") ;\n else\n printf (\"YES\" ) ;\n }\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \nint main(){\n\tlong n,s,b;\n\tscanf(\"%ld%ld\",&n,&s);\n\twhile(--n){\n\t\tscanf(\"%ld\",&b);\n\t\ts-=b;\n\t}\n\tif(s>=0)printf(\"YES\");else printf(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main(){\n int n,s,i,sum=0,a[100];\n scanf(\"%d%d\",&n,&s);\n for(i=0;i=(sum-a[n-1])?printf(\"YES\"):printf(\"NO\");\n}"}, {"source_code": "#include\nint main()\n{\n int n,s;int i,t;int sum=0;\n scanf(\"%d%d\",&n,&s);\n\n for(i=0;i0)\n sum=sum+t;\n }\n if(sum<=s)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int i,j,c=0,n,m;\n scanf(\"%d%d\",&n,&m);\n for( i=0 ; i\nmain()\n{\n int n,s,a[102],i,k;\n while(scanf(\"%d%s\",&n,&s)!=EOF)\n {\n for(i=0; i=s)\n {\n k=1;\n break;\n }\n if(k==0)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n}\n"}, {"source_code": "#include\n#include\n#include\nint main()\n{\n int n,s,k,c,j=0;\n scanf(\"%d %d\",&n,&s);\n int a[n],m=0;\n for(int i=0;ia[j])\n {\n k=a[i];\n a[i]=a[j];\n a[j]=k;\n }\n }\n }\n for(int i=0;i=s||j==(n-1))\n {\n if(m>=s)\n {\n if(j==n)\n {c=0;\n break;}\n else if(j!=n)\n {\n c=1;\n break;\n }\n }\n else if(m\nmain()\n{\n int n,s,a[102],i,k;\n while(scanf(\"%d%s\",&n,&s)!=EOF)\n {\n for(i=0; i=s)\n {\n k=1;\n break;\n }\n if(k==0)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n,m,i,k;\n\n scanf(\"%d %d\",&n,&m);\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&k);\n if(k>=m)\n {\n printf(\"NO\");\n return 0;\n\n }\n }\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int m,n,a[10000],i,cnt=0;\n scanf(\"%d %d\",&m,&n);\n for(i=0;im)\n {\n\n cnt++;\n break;\n }\n\n }\n if(cnt==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n return 0;\n}\n\n"}, {"source_code": "#include\nint main(){\n int n,s,i,k=0;\n int a[120];\n scanf(\"%d%d\",&n,&s);\n for(i=1;i<=n-1;++i){\n scanf(\"%d\",&a[i]);\n k+=a[i];\n }\n if(k<=s)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\nreturn 0;\n}\n"}, {"source_code": "#include \n\nint main() {\nint n,s,i,sum=0;\nscanf(\"%d %d\\n\",&n,&s);\nint ara[99];\nfor(i=0;i>n;i++){\nscanf(\"%d\",ara[i]);\n}\nfor(i=0;is){printf(\"NO\\n\");}\nelse{printf(\"YES\\n\");}\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint i,f,n,s,a;\n\tscanf(\"%d%d\",&n,&s);\n\tfor(i=0;is)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"NO\\n\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\tif(s>=sum&&s<=sum+a[i])\n\t\t\t{\n\t\t\t\tif(count==(n-1))\n\t\t\t\t\t{\n\t\t\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\tprintf(\"NO\\n\");\n\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t}\n\t\t\n\t\t\t\n\t\t}\n\t}\n\treturn 0;\n}\nint cmp(const void *a,const void *b)\n{\n\treturn (*(int *)a-*(int *)b);\n}"}, {"source_code": "#include\n\nint main()\n{\n int n,m,i,k;\n\n scanf(\"%d %d\",&n,&m);\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&k);\n \n }\n for(i=1;i<=n;i++)\n {\n if(k>=m)\n {\n printf(\"NO\");\n return 0;\n }\n }\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n,s,ara[1000],i,count=0;\n scanf(\"%d %d\",&n,&s);\n for(i=0;i=(n-1)){\n printf(\"YES\\n\");\n }\n else{\n printf(\"NO\\n\");\n }\n return 0;\n}"}, {"source_code": "#include\n#include\n#define pf printf\n#define sf scanf\n\nint main()\n{\n\tint n, s, a = 0;\n\tint i;\n\tscanf(\"%d\", &n);\n\tscanf(\"%d\", &s);\n\t\n\tfor(i = 0; i < n; i++)\n\t{\n\t\tscanf(\"%d\", &a);\n\t\ta += a; \n\t}\n\tif(a < s)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\t\t\n\treturn 0;\n\t\n}\n"}, {"source_code": "#include \nint main()\n{\n int m,c,v[100],i=0,flag=0,sum=0;\n scanf(\"%d\",&m);\n scanf(\"%d\",&c);\n for(i=0;i\nint main()\n{\n int i,j,n,x,cou=0;\n scanf(\"%d %d\",&n,&x);\n for(i=1;i<=n;i++)\n {\n if(x%i==0 && (x/i)<=n) cou++;\n }\n printf(\"%d\",cou);\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n, a, max, i, s ;\n scanf (\"%d %d%d\", &n, &max, &a ) ;\n s = a ;\n if (n == 6 && max == 38 )\n printf (\"YES\" ) ;\n\n else\n {\n if (n == 6 && max == 14 )\n printf (\"YES\" ) ;\n else\n {\n if (n == 78 && max == 400 )\n printf (\"YES\" ) ;\n else\n {\n if (n ==49 && max == 272)\n printf (\"YES\" ) ;\n else\n {\n for (i = 1 ; i < n-1 ; i++ )\n {\n scanf (\"%d\", &a ) ;\n s = s + a ;\n }\n if (s > max )\n printf(\"NO\") ;\n else\n printf (\"YES\" ) ;\n }\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int m,n,a[10000],i,cnt=0;\n scanf(\"%d %d\",&m,&n);\n for(i=0;i=n)\n {\n\n cnt++;\n break;\n }\n\n }\n if(cnt==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n return 0;\n}\n\n"}, {"source_code": "#include \nint main()\n{\n int tz,v1,x,y,t,aux,f;\n scanf(\"%d\",&tz);\n int i;\n int arr[tz];\n for(i=0;iarr[y])\n {\n aux=arr[x];\n arr[x]=arr[y];\n arr[y]=aux;\n }\n i=0;\n x=0;\n f=0;\n\n while(i\nmain()\n{\n int n,s,i,sum=0,a[100];\n scanf(\"%d %d\",&n,&s);\n for(i=0;i\nint main()\n{\n int a[105],n,i,ans,s;\n scanf(\"%d %d\",&n,&s);\n ans=1000;\n for (i=1;i<=n;i++)\n {\n scanf(\"%d\",&a[i]);\n if (ans>a[i]) ans=a[i];\n }\n if (ans*n<=s) printf(\"YES\"); else printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,s,a,i,cnt=0;\n scanf(\"%d %d\",&n,&s);\n for(i=1;i<=n;i++){\n scanf(\"%d\",&a);\n }\n for(i=1;i<=n;i++){\n if(a>=s){\n cnt++;\n }\n }\n if(cnt==0){\n printf(\"YES\\n\");\n }\n else{\n printf(\"NO\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,s,i,c=0;\n scanf(\"%d %d\",&n,&s);\n int a[n];\n int sum=0;\n for(i=0;i\nint main(){\n int n,s,i,k=0;\n int a[120];\n scanf(\"%d%d\",&n,&s);\n for(i=1;i<=n-1;++i){\n scanf(\"%d\",&a[i]);\n k+=a[i];\n }\n if(k<=s)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\nreturn 0;\n}\n"}, {"source_code": "#include \nmain()\n{\n int m,c,v[100],i=0,flag=0,sum=0;\n scanf(\"%d\",&m);\n scanf(\"%d\",&c);\n for(i=0;i\n#include \n\nint main()\n{\n int n, a, max, i, s ;\n scanf (\"%d %d%d\", &n, &max, &a ) ;\n s = a ;\n if (n == 6 && max == 38 )\n printf (\"YES\" ) ;\n\n else\n {\n if (n == 6 && max == 38 )\n printf (\"YES\" ) ;\n else\n {\n for (i = 1 ; i < n-1 ; i++ )\n {\n scanf (\"%d\", &a ) ;\n s = s + a ;\n }\n if (s > max )\n printf(\"NO\") ;\n else\n printf (\"YES\" ) ;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\nint cmp(int *a,int *b)\n{\n return *a-*b;\n}\nint main()\n{\n int n,i,s,a[1000];\n int ans=0;\n scanf(\"%d%d\",&n,&s);\n for(i=0;i\nint main()\n{\n int a,b,i,c=0;\n scanf(\"%d %d\",&a,&b);\n int x[a];\n for(i=0;i\nmain()\n{\n int a,b,c[100],i,j,k,d=0,max=0,e;\n scanf(\"%d %d\",&a,&b);\n for(i=0;imax){\n max=c[i];\n }\n for(i=0;ib){printf(\"NO\\n\");}\n\n\n else if(e<=b)\n printf(\"YES\\n\");\n\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n, a, max, i, s ;\n scanf (\"%d %d%d\", &n, &max, &a ) ;\n s = a ;\n if (n == 6 && max == 38 )\n printf (\"YES\" ) ;\n\n else\n {\n if (n == 6 && max == 14 )\n printf (\"YES\" ) ;\n else\n {\n if (n == 78 && max == 400 )\n printf (\"YES\" ) ;\n else\n {\n if (n ==49 && max == 272)\n printf (\"YES\" ) ;\n else\n {\n for (i = 1 ; i < n-1 ; i++ )\n {\n scanf (\"%d\", &a ) ;\n s = s + a ;\n }\n if (s > max )\n printf(\"NO\") ;\n else\n printf (\"YES\" ) ;\n }\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main()\n{\n\tint n,s;\n\tint a[101];\n\tscanf(\"%d%d\",&n,&s);\n\tint i;\n\tfor(i=0;ia[i])\n\t\t\t{\n\t\t\t\tmin=a[i];\n\t\t\t\tminj=i;\n\t\t\t}\n\t\t}\n\t\tsum+=min;\n\t\ta[minj]=INT_MAX;\n\t}\n\tif(sum<=s)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\treturn 0;\n}\n\n\n\n"}, {"source_code": "#include \n\nint main(void) {\n int n,s,i,a[500],sum;\n scanf(\"%d %d\",&n,&s);\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n sum=0;\n for(i=2;i<=n;i++)\n {\n sum+=a[i];\n }\n if(sum<=s)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n\n int n,s;\n scanf(\"%d %d\",&n,&s);\n int arr[n];\n int i;\n for(i=0;is)\n {\n flag=1;\n }\n\n }\n if(flag==1)\n {\n\n printf(\"NO\");\n }\n else\n {\n\n printf(\"YES\");\n }\n return 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n int n,s,ara[1000],i,count=0;\n scanf(\"%d %d\",&n,&s);\n for(i=0;i=(n-1)){\n printf(\"YES\\n\");\n }\n else{\n printf(\"NO\\n\");\n }\n return 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n, a, max, i, s ;\n scanf (\"%d %d%d\", &n, &max, &a ) ;\n s = a ;\n if (n == 6 && max == 38 )\n printf (\"YES\" ) ;\n\n else\n {\n if (n == 6 && max == 14 )\n printf (\"YES\" ) ;\n else\n {\n if (n == 78 && max == 400 )\n printf (\"YES\" ) ;\n else\n {\n for (i = 1 ; i < n-1 ; i++ )\n {\n scanf (\"%d\", &a ) ;\n s = s + a ;\n }\n if (s > max )\n printf(\"NO\") ;\n else\n printf (\"YES\" ) ;\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n,s;\n scanf (\"%d%d\",&n,&s);\n int i,a[105];\n for (i=0; i s)\n printf (\"NO\\n\");\n else printf (\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int n,s,j=0,c=0,d;\n int m=0;\n scanf(\"%d %d\",&n,&s);\n int a[n];\n for(int i=0;ia[k])\n {\n d=a[i];\n a[i]=a[k];\n a[k]=d;\n }\n }\n }\n for(int i=0;i=s||j==(n-1))\n {\n if(j==n-1)\n {\n if(m==s)\n {\n c=1;\n }else{\n c=0;}\n break;\n }\n else if(j!=n-1)\n {\n c=0;\n break;\n }\n }\n }\n if(c==1)\n {\n printf(\"YES\");\n }\n else if(c==0)\n {\n printf(\"NO\");\n }\n return 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n int a,b,i,c=0;\n scanf(\"%d %d\",&a,&b);\n int x[a];\n for(i=0;i=a-1)\n printf(\"YES\");\n else\n printf(\"NO\"); \n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int a,b,c[100],i,j,k,d=0,max=0,e;\n scanf(\"%d %d\",&a,&b);\n for(i=0;imax){\n max=c[i];\n }\n for(i=0;ib){printf(\"NO\\n\");}\n\n\n else if(e<=b)\n printf(\"YES\\n\");\n\n}\n"}, {"source_code": "#include\n#include\n#define pf printf\n#define sf scanf\n\nint main()\n{\n\tint n, s, a = 0;\n\tlong long count = 0;\n\tint i;\n\tsf(\"%d\", &n);\n\tsf(\"%d\", &s);\n\t\n\tfor(i = 0; i < n; i++)\n\t{\n\t\t//pf(\"\\nBefore-->%lld\", count);\n\t\tsf(\"%d\", &a);\n\t\tcount += a; \n\t\t//pf(\"\\nAfter-->%lld\", count);\n\t}\n\t//pf(\"\\nCount-->%lld\", count);\n\tif(count <= s)\n\t\tpf(\"YES\\n\");\n\telse\n\t\tpf(\"NO\\n\");\n\t\t\n\treturn 0;\n\t\n}\n"}, {"source_code": "#include\nint main()\n{\n int a[102],b,c,d,i,j;\n scanf(\"%d %d\",&b,&c);\n for(i=0;i=c)\n break;\n }\n if(i==b)\n printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int mugs,volume_of_cups,volume_of_mugs,n;\n while(scanf(\"%d %d\", &mugs,&volume_of_cups) != EOF)\n {\n while(mugs--)\n {\n scanf(\"%d\", &volume_of_mugs);\n if(volume_of_mugs\nint main()\n{\n int N, S, i, a, max=0, sum=0;\n\n scanf(\"%d%d\",&N,&S);\n for (i = 0; i < N; i++)\n {\n scanf(\"%d\",&a);\n\n sum += a;\n }\n\n if((sum - max) > S)\n printf(\"NO\");\n else printf(\"YES\");\n return 0;\n}\n"}], "src_uid": "496baae594b32c5ffda35b896ebde629"} {"nl": {"description": "Petya loves football very much. One day, as he was watching a football match, he was writing the players' current positions on a piece of paper. To simplify the situation he depicted it as a string consisting of zeroes and ones. A zero corresponds to players of one team; a one corresponds to players of another team. If there are at least 7 players of some team standing one after another, then the situation is considered dangerous. For example, the situation 00100110111111101 is dangerous and 11110111011101 is not. You are given the current situation. Determine whether it is dangerous or not.", "input_spec": "The first input line contains a non-empty string consisting of characters \"0\" and \"1\", which represents players. The length of the string does not exceed 100 characters. There's at least one player from each team present on the field.", "output_spec": "Print \"YES\" if the situation is dangerous. Otherwise, print \"NO\".", "sample_inputs": ["001001", "1000000001"], "sample_outputs": ["NO", "YES"], "notes": null}, "positive_code": [{"source_code": "#include \n#include \n#include \n\nint main()\n{\n char arr[101]={0};\n int i,leng,count,flag=0;\n count=0;\n scanf(\"%s\",arr);\n leng=strlen(arr);\n for(i=0;i\n#include\nint main(){\n int l,c=0,c1=0,c2=0,c3=0;\n char a[101];\n scanf(\"%s\",a);\n l=strlen(a);\n for(int i=0;i=6){\n break;\n } \n } \n if(a[i]!=a[i+1]){\n c=0;\n }\n } \n if(c>=6){\n printf(\"YES\");\n } \n else\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include\n#include\nint main()\n\n{\n int i,j,k=1,m=0;\n char str[100];\n gets(str);\n for(i=1;i\n#include\n \nint main(){\nint i,o,p=0;\nchar n[700];\nscanf(\"%s\",&n);\no=strlen(n);\nfor(i=0;i\n#include\nint main()\n{\n int i,o,p=0;\n char n[700];\n scanf(\"%s\",&n);\n o=strlen(n);\n for (i=0;i\n#include\nint main()\n{\n char a[100];\n int i,n;\n gets(a);\n if(strstr(a,\"1111111\"))\n {\n printf(\"YES\");\n return 0;\n }\n else if(strstr(a,\"0000000\"))\n {\n printf(\"YES\");\n return 0;\n }\n else\n printf(\"NO\");\n return 0;\n}\n \n "}, {"source_code": "#include\nint main()\n{\n int i;\n char str[100];\n scanf(\"%s\",str);\n int count=0;\n int count1=0;\n int result=0;\n for(i=0;i<100;i++)\n {\n if(str[i]=='1')\n {\n count++;\n count1=0;\n }\n if(str[i]=='0')\n \n {\n count1++;\n count=0;\n }\n \n if(count>=7 || count1>=7 ){\n result++;\n break;\n }\n }\n if(result==1)\n printf(\"YES\");\n if(result==0)\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n long long int t=0,d=0,i,j;\n char str[105]={'\\0'};\n scanf(\"%s\",str);\n for(i=0;i=7 || d>=7)\n\t\t{\n\t\t\tbreak;\n\t\t}\n }\n if(t>=7 || d>=7)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n return 0;\n}\n\n"}, {"source_code": "#include \n#include \n\nint main()\n{\nchar m[8],s[100];\n int n,j,p=0,k=0,i;\n gets(s);\n\n for(i=0;i\n#include\nint main(){\n char ch[120];\n int i,count=1,length;\n scanf(\"%s\",ch);\n if(strstr(ch,\"0000000\")||strstr(ch,\"1111111\"))\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 \t \t\t \t \t\t\t"}, {"source_code": "#include\n#include\nint main()\n{\n\tchar s[101];\n\tint l,p=0,q=0,k=0;\n\tscanf(\"%s\",s);\n\n\tl=strlen(s);\n\n\tfor(int i=0;i=6)\n\t\t\t{printf(\"YES\\n\");k=3;}\t\n\t\t\tif(k==3)\n\t\t\t{break;}\n\t}\n\tif(k==0)\n\t{\n\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int j=0, k=0, m ;\n char w[100] ;\n gets(w) ;\n m = strlen(w) ;\n while(m--)\n {\n if( w[m]=='0' )\n j++, k=0 ;\n else if( w[m]=='1' )\n k++, j=0 ;\n if( j==7 || k==7 )\n {\n printf(\"YES\") ;\n return 0 ;\n }\n }\n printf(\"NO\") ;\n return 0 ;\n}\n"}, {"source_code": "#include \n#include \n#include \n\nint main()\n{\n char arr[101]={0};\n int i,leng,count,flag=0;\n count=0;\n scanf(\"%s\",arr);\n leng=strlen(arr);\n for(i=0;i\n#include\nint main()\n{\n int i,j,k,a=0,b=0,m,sum=0;\n char str[101];\n gets(str);\n m=strlen(str);\n for(i=0; i=7 || b>=7)\n printf(\"YES\");\n\n else\n {\n printf(\"NO\");\n }\n\n\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int i,j,p=0,q=0,count=0,count1=0;\n char s[101];\n scanf(\"%s\",s);\n for(i=0;s[i]!='\\0';i++)\n {\n count=0;\n count1=0;\n if(s[i]=='1')\n {\n for(j=i;s[j]!='\\0';j++)\n {\n if(s[j]=='1')\n {\n count++;\n }\n else\n break;\n if(count==7){\n p=1;\n break;\n }\n }\n }\n else\n {\n for(j=i;s[j]!='\\0';j++)\n {\n if(s[j]=='0')\n {\n count1++;\n }\n else\n break;\n if(count1==7){\n p=1;\n break;\n }\n }\n }\n }\n if(p==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main()\n{\n int j,k,r;\n char a[100];\n gets(a);\n r=strlen(a);\n if(r<=6)\n {\n printf(\"NO\\n\");\n }\n else\n {\n for(j=0;j\n#include\nint main()\n{\n char a[100];\n int i=0,count=1,j=1;\n gets(a);\n while(i<=strlen(a))\n {\n if(a[i]==a[j])\n {\n count++;\n if(count==7) break;\n }\n else count=1;\n i++;\n j++;\n }\n\n if(count==7) printf(\"YES\");\n else printf(\"NO\");\n}\n"}, {"source_code": "#include\n#include\nint main(){\n\n char ch;\n int a=0,b=0;\n while(scanf(\"%c\",&ch) && ch!='\\n'){\n\n if(ch=='1'){\n b=0;\n a++;\n }\n else {\n a=0;\n b++;\n }\n if(a>=7 || b>=7){\n printf(\"YES\");\n return 0;\n }\n }\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main()\n{\nint i,l,cnt1=0,cnt2=0,sum=0;\nchar a[100];\ngets(a);\nl=strlen(a);\nfor(i=0;i=7)\n sum=1;\n\n}\n\n\nfor(i=0;i=7)\n sum=1;\n\n\n} if(sum==1)\nprintf(\"YES\");\nelse\n printf(\"NO\");\n\n\n\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int n,i,x=0;\n char s[1000];\n scanf(\"%s\",s);\n n=strlen(s);\n for(i=0;i\n#include \n#include \nchar string[100];int length,i,is_dangerous,ones,zeros;\nones=0;zeros=0;is_dangerous=0;\nint main()\n{\n scanf(\"%s\",&string);\n length=strlen(string);\n for (i=0;i=7||zeros>=7){\n is_dangerous=1;\n }\n\n }\n if(is_dangerous==1){\n printf(\"YES\");\n }\n else printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\nmain()\n{\n char sit[101];\n scanf(\"%s\", sit);\n int i, l = strlen(sit);\n int one = 0, zero = 0, danger = 0;\n for(i = 0; i < l; i++)\n {\n if(sit[i] == '1')\n {one++;\n if(one >= 7)\n danger++;}\n else\n one = 0;\n if(sit[i] == '0'){\n zero++;\n if(zero >= 7)\n danger++;}\n else\n zero = 0;\n }\n if(danger >= 1)\n printf(\"YES\");\n else\n printf(\"NO\");\n}"}, {"source_code": "#include \n#include \nvoid main()\n{\n\tchar a[102]; \n int i,max,flag; \n max=1; \n flag=0; \n scanf(\"%s\",&a); \n for(i=1;a[i]!='\\0';i++) \n { \n if(a[i]==a[i-1]) \n { \n max++; \n if(max==7) \n { \n flag=1; \n printf(\"YES\\n\"); \n break; \n } \n } \n else\n max=1;\n } \n if(flag==0)\n printf(\"NO\\n\");\n}\n"}, {"source_code": "#include\n#include\nmain()\n{\n char str[101]; int i,c=0,d=0,e,sum,j;\n scanf(\"%s\",str);\n e=strlen(str);\n if(e<7)\n d=0;\n else\n {\n for(i=0;i0)\n printf(\"YES\");\n else\n printf(\"NO\");\n}"}, {"source_code": "#include\n#include\nmain()\n{\n char s[100];\n int i,j,k,l=0;\n gets(s);\n k=strlen(s);\n if(k>=7)\n {\n for(i=0;i\n#include\nint main()\n{\n int i,o,p=0;\n char n[700];\n scanf(\"%s\",&n);\n o=strlen(n);\n for (i=0;i\n#include\nint main()\n{\n char s[100];\n int i,j,k,l=0;\n gets(s);\n k=strlen(s);\n if(k>=7)\n {\n for(i=0;i\n#include\n\n\nint main()\n{\n char str[101];\n gets(str);\n if(strstr(str,\"0000000\")||strstr(str,\"1111111\"))\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n //This code is not same\n char str[100];\n int coun=0,i;\n scanf(\"%s\",&str);\n for(i=0;i=6)?printf(\"YES\"):printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int i,j,p=0,q=0,count=0,count1=0;\n char s[101];\n scanf(\"%s\",s);\n for(i=0;s[i]!='\\0';i++)\n {\n count=0;\n count1=0;\n if(s[i]=='1')\n {\n for(j=i;s[j]!='\\0';j++)\n {\n if(s[j]=='1')\n {\n count++;\n }\n else\n break;\n if(count==7){\n p=1;\n break;\n }\n }\n }\n else\n {\n for(j=i;s[j]!='\\0';j++)\n {\n if(s[j]=='0')\n {\n count1++;\n }\n else\n break;\n if(count1==7){\n p=1;\n break;\n }\n }\n }\n }\n if(p==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main ()\n{\n char t[100];\n int c=1;\n scanf(\"%s\",t);\n int n = strlen(t);\n for(int i = 1 ; i\n#include\n#include\n\nint main()\n{\n char str[100];\n scanf(\"%s\",str);\n int len,i,count=0,t,j;\n len = strlen(str);\n for(i=0;i=7)\n {\n printf(\"YES\\n\");\n return 0;\n }\n }\n }\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "\n#include \n#include \nint main()\n{ \n int m,count,flag;\n char arr[100]=\"scanf(%s,arr)\";\n scanf(\"%s\",arr);\n m = strlen(arr);\n count=1;flag=0;\n for(int i=0;i\n#include\nint main()\n{\n int i,o,p=0;\n char n[700];\n scanf(\"%s\",&n);\n o=strlen(n);\n for (i=0;i\nint strlen(char a[])\n{\n int i;\n for(i=1; a[i]!=0; i++) {}\n return i;\n}\nint main()\n{\n int i,j,len,t,c=0,d;\n char a[100];\n gets(a);\n len=strlen(a);\n for(i=0; ic)\n c=d;\n\n\n }\n else if(a[i]!=a[j])\n break;\n }\n\n }\n if(c>=6)\n printf(\"YES\");\n else if(c<7)\n printf(\"NO\");\n return 0;\n}\n\n\n\n"}, {"source_code": "#include\nint main (){\n char x[100];\n int i,k,l;\n scanf(\"%s\",&x);\n k=0;\n l=0;\n for (i=0;x[i]!='\\0';i++){\n switch (x[i]){\n case '1':\n k++;\n case '0' :\n l++;\n }\n \n \n if (k==7){\n printf(\"YES\");\n break ;\n }\n else \n if(l==7){\n printf(\"YES\");\n break;\n }\n if((x[i]=='1')&&(x[i+1]=='0')){\n k=0;\n l=0;\n }\n if((x[i]=='0')&&(x[i+1]=='1')){\n l=0;\n k=0;\n }\n \n \n \n \n \n }\n if ((l!=7)&&(k!=7)){\n printf(\"NO\");\n \n }\n }"}, {"source_code": "#include \n#include \n\nint main()\n{\n char ara[102];\n int i=0,k=0,j;\n scanf(\" %[^\\n]\",ara);\n int len=strlen(ara);\n //printf(\"%d\\n\",ara[2]);\n\n if(len>=2 && len<=7){\n printf(\"NO\\n\");\n k++;\n }\n else if(len>7)\n {\n for(i=0;i=6){\n k++;\n printf(\"YES\\n\");\n break;\n }\n }\n\n }\n\n if(k==0)\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \nint main(){\n\tint nb0,i,nb1,test;\n\tchar T[100];\n\tscanf(\"%s\",&T);\n\tnb0=0;\n\tnb1=0;\n\ttest=0;\n\tfor (i=0;i\nint main(){\n char s[101]={'\\0'};\n scanf(\"%s\",s);\n int c=0,f=0;\n for(int i=0;s[i]!='\\0';i++){\n if(s[i]==s[i+1]){\n c++; \n }\n else{\n c=0;\n }\n if(c+1==7){\n f=1;\n break;\n }\n\n }\n if(f==1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n}"}, {"source_code": "#include\n#include\nint main()\n{\n int i,l,x=0;\n char n[100];\n scanf(\"%s\",&n);\n l=strlen(n);\n for (i=0;i\n#include \n\nint main()\n{\n int i,n,j=0,k;\n char s1[1000];\n scanf(\"%s\",s1);\n n=strlen(s1);\n \n for(i=0;i5)\n {\n \n break;\n }\n }\n if(j>5)\n printf(\"YES\");\n else \n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "/* \n * File: Football.c\n * Author: Wissem\n *\n * Created on 19 novembre 2017, 01:41\n */\n\n#include \n#include \n#include \n/*\n * \n */\nint main() {\n int x=1;\n char s[101];\n scanf(\"%s\",&s);\n for (int i=1;i<(strlen(s));i++){\n if (s[i]==s[i-1])\n x++;\n else if (x<7)\n x=1;}\n if (x>6)\n printf(\"YES\");\n else printf(\"NO\");\n }\n \n \n \n \n \n \n\n\n"}, {"source_code": "#include\n#include\nint main()\n\n{\n char a[100];\n int i,j,n,d;\n d=1;\n scanf(\"%[0-1]\",a);\nn=strlen(a);\nfor(i=0;i=7){\n break;}\n}\n\n if(d<7){printf(\"NO\");}\n\n else{ printf(\"YES\");}\n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#define N 101\n\nint main()\n{\n char players[N];\n scanf(\"%s\",players);\n int size=strlen(players);\n\n int is_dangerous = 0;\n int i;\n int zeros = 0,ones = 0;\n \n for(i=0; i\nint main(){\n char football[100];\n gets(football);\n int i=0,a=1,k=1,j=0,q;\n while (football[i]!='\\0'){\n\n for(j=0;j<7;j++){\n if(football[k-1]==football[k])\n {a++;\n if(a>6)\n {break;}}\n else if(football[k-1]!=football[k])\n {a=1;}\n k++;\n }\n\n if(a>6)\n {break;}\n a=1;\n i++;\n k=i;\n }\n if(a>6)\n printf(\"YES\");\n else if(a<6)\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int i,sum=0;\n char a[100];\n scanf(\"%s\",a);\n for(i=0;a[i]!='\\0';i++)\n {\n if(a[i]==a[i+1])\n {\n sum++;\n if(sum==6)\n break;\n }\n else{sum=0;}\n }\n if(sum==6){printf(\"YES\");}\n else{printf(\"NO\");}\n}\n"}, {"source_code": "#include \n#include \nint main(void) {\n char ch[100];\n int i,s0,s1;\n s0=i=s1=0;\n scanf(\"%s\",&ch);\n while(ch[i]!='\\0' && s0<7 && s1<7 ){\n \n if (ch[i]=='0') {s1=0;\n s0=s0+1;\n i++;}\n else if (ch[i]=='1') {s1=s1+1;\n s0=0;\n i=i+1;}\n \n \n }\n if (s1>=7 || s0>=7) printf(\"YES\");\n else printf(\"NO\");\n \n \n \n return 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n int i,l,p=0;\n char s[100];\n scanf(\"%s\",&s);\n l=strlen(s);\n for(i=0;i\n#include\nint main()\n{\n int i,o,p=0;\n char n[700];\n scanf(\"%s\",&n);\n o=strlen(n);\n for (i=0;i\n#include \n#include\n/*\n * \n */\nint main() \n{\n char ch[100];\n int i,a=0, x=1, l;\n scanf(\"%s\",&ch),\n l=strlen(ch);\n for(i=0;i= 7){\n a=1;\n \n printf(\"YES\");\n \n break; }\n } \n else \n x=1;\n \n \n } \n \n if (a==0)\n printf(\"NO\");\n return (0);\n}"}, {"source_code": "#include\n#include\n\nint main(){\nint i,j;\nchar ch[100],k=0,l=0;\nscanf(\"%s\",ch);\nfor(i=0;i\n#include\nint main()\n{\n char a[110];\n int i,j,n,p=1;\n gets(a);\n n=strlen(a);\n for(i=0;i\n#include \n\nint main()\n{\n int sum = 0;\n char s [100] ;\n scanf(\"%s\",s);\n for (int i = 0 ; s[i] != '\\0' ; i++)\n {\n if (s[i] == s[i-1])\n {\n sum++;\n if (sum == 7)\n break;\n }\n else sum = 1;\n }\n if (sum == 7)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n char a[101];\n int i,count=0;\n gets(a);\n for(i=0;i=6)\n {\n printf(\"YES\");\n break;\n }\n }\n else\n count=0;\n }\n if(count<6)\n printf(\"NO\");\n return(0);\n}"}, {"source_code": "#include\nint main()\n{\n char s[100];\n int count1=0,count0=0,i,l;\n gets(s);\n for(i=0;s[i]!='\\0';i++)\n {\n if(s[i]=='0')\n count0++;\n else\n count1++;\n }\n if(count1==i || count0==i)\n {\n printf(\"NO\");\n return 0;\n }\n else\n { count0=0;\n count1=0;\n for(i=0;;i++)\n {\n if(count1>=7 || count0>=7)\n {\n printf(\"YES\");\n return 0;\n }\n if(s[i]=='\\0')\n break;\n if(s[i]=='1')\n {\n count1++;\n count0=0;\n continue;\n }\n else\n {\n count0++;\n count1=0;\n continue;\n }\n }\n }\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "\n#include\n#include\nint main()\n{\n char s[100];\n int i,l,p=0,q=0;\n gets(s);\n l=strlen(s);\n for( i=0;i=7) \n continue;\n else \n q=0;\n }\n if(s[i]=='0')\n {\n q++;\n if(p>=7)\n continue;\n else\n p=0;\n }\n\n }\n if(p>=7||q>=7)\n printf(\"YES\\n\");\n else\n\n printf(\"NO\\n\");\n\n return 0;\n\n\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int l,i,k=0,m;\n char s[100];\n scanf(\"%s\",s);\n l=strlen(s);\n for(i=1; i\n#include\nint main()\n{\n char a[100],i,n,o=0,z=0;\n scanf(\"%s\",a);\n n=strlen(a);\n for(i=0;i6)\n {\n printf(\"YES\");\n goto end;\n }\n else if(a[i+1]=='0') o=0;\n \n }\n else if(a[i]=='0')\n {\n z++;\n if(z>6)\n {\n printf(\"YES\");\n goto end;\n }\n else if(a[i+1]=='1') z=0;\n }\n }\n printf(\"NO\");\n end:\n return 0;\n \n \n}"}, {"source_code": "#include\n#include\nint main()\n{\n int l,i,k=0,m;\n char s[100];\n scanf(\"%s\",s);\n l=strlen(s);\n s[l]='\\0';\n for(i=1; i=6)\n break;\n }\n if(k>=6)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n char a[100];\n int i,n;\n gets(a);\n if(strstr(a,\"1111111\"))\n {\n printf(\"YES\");\n return 0;\n }\n else if(strstr(a,\"0000000\"))\n {\n printf(\"YES\");\n return 0;\n }\n else\n printf(\"NO\");\n return 0;\n}\n \n "}, {"source_code": "#include\nint main()\n{\n\tchar input[105];\n\tscanf(\"%s\",input);\n\tint flag = 0;\n\tint count = 0;\n\tfor(int i = 0;input[i] != '\\0';i++)\n\t{\n\t\tif(input[i] == input[i+1])\n\t\t{\n\t\t\tcount++;\n\t\t\tif(count == 6)\n\t\t\t{\n\t\t\t\tinput[i-1] == input[i];\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\tif(count == 7)\n\t\t\t{\n\t\t\t\tflag = 1;\n\t\t\t\t break;\n\t\t\t}\n\t\t\t}\n\t\telse{\n\t\t\tcount = 0;\n\t\t}\n\t}\n\tif(flag == 1) printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n}\n"}, {"source_code": "#pragma hdrstop\n#pragma argsused\n\n#include \n#include \n#include \n\nint _tmain(int argc, _TCHAR* argv[])\n{\n char s[101];\n gets(s);\n if ((strstr(s,\"0000000\")==0) && (strstr(s,\"1111111\")==0))\n printf(\"NO\");\n else\n printf(\"YES\");\n return (0);\n}\n"}, {"source_code": "#include\nint main()\n{\n int a=0,b=0,i,o=0,l;\n char s[101];\n scanf(\"%s\",s);\n for(i=0;s[i]!='\\0';i++)\n {\n if(s[i]=='0')\n {\n a++;\n b=0;\n }\n else\n {\n b++;\n a=0;\n }\n if(a==7 || b==7)\n {\n o=1;\n break;\n }\n }\n if(o==1) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int l,c=0,i=0,d=0;\n char p[100];\n gets(p);\n l=strlen(p);\n for(i=0;i=6)\n {\n printf(\"YES\");\n d=1;\n break;\n }\n else c++;\n }\n c=0;\n while(p[i]=='0'){\n i++;\n if(c>=6)\n {\n printf(\"YES\");\n d=1;\n break;\n }\n else c++;\n }\n if(d==1) break;\n }\n if(d==0)\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "/* \n * File: Football.c\n * Author: Wissem\n *\n * Created on 19 novembre 2017, 01:41\n */\n\n#include \n#include \n#include \n/*\n * \n */\nint main() {\n int x=1;\n char s[101];\n scanf(\"%s\",&s);\n for (int i=0;i<(strlen(s));i++){\n if (s[i]==s[i+1])\n x++;\n else if (x<7)\n x=1;}\n if (x>6)\n printf(\"YES\");\n else printf(\"NO\");\n }\n \n \n \n \n \n \n\n\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int i,n,j=0,k;\n char s1[1000];\n scanf(\"%s\",s1);\n n=strlen(s1);\n \n for(i=0;i5)\n {\n \n break;\n }\n }\n if(j>5)\n printf(\"YES\");\n else \n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int n,i,x=0;\n char s[100];\n scanf(\"%s\",&s);\n n=strlen(s);\n for(i=0;i\n#include \n#include \n/*\n * \n */\nint main() {\n int x=1;\n char s[101];\n scanf(\"%s\",&s);\n for (int i=0;i<(strlen(s));i++){\n if (s[i]==s[i+1])\n x++;\n else if (x<7)\n x=1;}\n if (x>6)\n printf(\"YES\");\n else printf(\"NO\");\n }\n \n \n \n \n \n \n\n\n"}, {"source_code": "#include\nint main()\n{\n int l,c=0,i=0,d=0;\n char p[100];\n gets(p);\n l=strlen(p);\n for(i=0;i=6)\n {\n printf(\"YES\");\n d=1;\n break;\n }\n else c++;\n }\n c=0;\n while(p[i]=='0'){\n i++;\n if(c>=6)\n {\n printf(\"YES\");\n d=1;\n break;\n }\n else c++;\n }\n if(d==1) break;\n }\n if(d==0)\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main(void)\n{\n int i;\n int count=0,max=0;\n char str[100];\n scanf(\"%s\",str);\n\n for(i=0;i=6){printf(\"YES\");\n return 0;}\n }\n else count=0;\n }printf(\"NO\");\n\n return 0;\n\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int l,i,k=0,m;\n char s[100];\n scanf(\"%s\",s);\n l=strlen(s);\n s[l]='\\0';\n for(i=1; i\n#include\nint main()\n{\n int i=0,q=1,j,k,p;\n char a[100];\n scanf(\"%s\",&a);\n p=strlen(a);\n for(i=0; i=6)\n {\n printf(\"YES\\n\");\n break;\n }\n }\n\n\n if(j<6)\n printf(\"NO\\n\");\n\n\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nmain()\n{\n char str[101]; int i,c=0,d=0,e,sum,j;\n scanf(\"%s\",str);\n e=strlen(str);\n if(e<7)\n d=0;\n else\n {\n for(i=0;i0)\n printf(\"YES\");\n else\n printf(\"NO\");\n}"}, {"source_code": "#include\n#include\nint main(){\n int t=0;\n char str[1000];\n scanf(\"%s\",str);\n int one = 0,zero = 0;\n for(int i = 0; i < strlen(str); i++){\n if(str[i] == '1'){\n one++;\n zero = 0;\n }\n else{\n zero++;\n one = 0;\n }\n if(one == 7 || zero == 7){\n t=1;\n break;\n }\n }\n if(t==1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \nint main(void){\n char team[101];\n while(scanf(\"%s\", team) != EOF){\n int count = 1, len = strlen(team), flag = team[0], i;\n for(i = 1; i < len; i++){\n if(flag == team[i]){\n count++;\n if(count >= 7){\n printf(\"YES\\n\");\n break;\n }\n }\n else {\n count = 1;\n flag = team[i];\n }\n }\n if(count < 7)\n printf(\"NO\\n\");\n }\n return 0;\n}\n\n \t \t \t \t\t\t \t \t\t \t \t\t \t"}, {"source_code": "#include \n#include \n#include \nint main()\n{\n \n int i,c ;\n char x[100];\n scanf(\"%s\",x);\n c=1;\n i=0;\n do\n { i=i+1;\n if (x[i]==x[i-1])\n {\n c=c+1;\n }\n else {\n c=1;\n }\n\n } while ((i<=strlen(x)) && (c<7));\n if (c>=7)\n {printf(\"YES\");\n }\n else {\n printf(\"NO\");\n \n }\n\n \n return (EXIT_SUCCESS);\n \n}"}, {"source_code": "#include \n#include \nint main(void){\n char p[101];\n scanf(\"%s\", p);\n if(strstr(p,\"0000000\") || strstr(p,\"1111111\")) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n }\n"}, {"source_code": "#include\n#include\n#include\n\nint main() {\n char a[200];\n int count = 1;\n scanf(\"%s\", a);\n for(int i=0; i 6)\n break;\n }\n else {\n a[i] = a[i+1];\n count = 1;\n }\n }\n if(count > 6) {\n printf(\"YES\\n\");\n }\n else{\n printf(\"NO\\n\");\n }\n return 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n char a[100];\n int i,j,k,count=0;\n gets(a);\n k=strlen(a);\n for(i=0;i=6)\n {\n break;\n }\n }\n else\n count=0;\n }\n if(count>=6)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n}\n"}, {"source_code": "#include\n#include\nmain()\n{\n\tint o=0,z=0,t=0,i,l;\n\tchar str[100];\n\tgets(str);\n\tl=strlen(str);\n\tfor(i=0;i\n#include\n\nint main()\n{\n\tchar str[100];\n\tint i, j, k, l=0;\n\t\n\tscanf(\"%s\", str);\n\t\n\tk = strlen(str);\n\n\t\n\tfor(i=0; i\n#include\nint main()\n{\n int i,o,p=0;\n char n[700];\n scanf(\"%s\",&n);\n o=strlen(n);\n for (i=0;i\n#include\nint main()\n{\n\tchar numbers[101];\n\tscanf(\"%s\",numbers);\n\tint count0 = 0;\n\tint count1 = 0;\n\tint occured =0;\n\tint i;\n\tfor (i=0; i= 7 || count1 >= 7)\n\t\t{\n\t\t\toccured =1;\n\t\t\tbreak;\n\n\t\t}\n\t}\n\t\tif(occured ==1)\n\t\tprintf(\"YES\");\n\t\telse \n\t\tprintf(\"NO\");\n\t\treturn 0;\n\t\n\t\n}//main "}, {"source_code": "#include \n#include \n#include \n\nint main()\n{ int i,x,l,s;\n char ch[100];\n\nscanf(\"%s\",ch);\n l=strlen(ch);\nx=1;\ns=0;\n for (i=0;i=7)\n {\n s=1;\n } else\n {\n x=1;\n }\n }\n }\n if ((x>=7) && (s==1))\n {\n printf(\"YES\");\n } else\n {\n printf(\"NO\");\n }\n\n\n\n\n return(0);\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n\nint main(int argc, char** argv) {\n\tchar ch[101];\n\tshort i=0,carac0=0,carac1=0;\n\t\n\tscanf(\"%s\",ch);\n for(i=0;i=7)||(carac1>=7))\n\t\t printf(\"YES\");\n\t\telse printf(\"NO\"); \n\t\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n char a[100];\n int i=0,count=1,j=1;\n gets(a);\n while(i<=strlen(a))\n {\n if(a[i]==a[j])\n {\n count++;\n if(count==7) break;\n }\n else count=1;\n i++;\n j++;\n }\n\n if(count==7) printf(\"YES\");\n else printf(\"NO\");\n}\n"}, {"source_code": "#include \n#include \n#include \n\n\n\nint main(){\n\nchar arr[100];\n\nscanf(\"%s\",arr);\nint i;\nint len=strlen(arr);\n\nif(len<7){printf(\"NO\");return 0;}\nelse{\n\n int cnt=0;\n int i=0;\n while(i<=len-7){\n if(arr[i]==arr[i+1]&&arr[i+1]==arr[i+2]&&arr[i+2]==arr[i+3]&&arr[i+3]==arr[i+4]&&arr[i+4]==arr[i+5]&&arr[i+5]==arr[i+6]){printf(\"YES\");return 0;}\n else{i++;}\n }\n printf(\"NO\");return 0;\n}\n\n\n\n\n}"}, {"source_code": "#include\n#include\nint main()\n{\n char a[110];\n int i,j,n,p=1;\n gets(a);\n n=strlen(a);\n for(i=0;i\n#include \n#include \n\n\nint main()\n{\n int occ1=0,occ0=0,i,verif=0;\n char joueurs[102];\n scanf(\"%s\",joueurs);\n \n for (i=0;i\n#include\nint main()\n{\n int i,o,p=0;\n char n[700];\n scanf(\"%s\",&n);\n o=strlen(n);\n for (i=0;i\n#include\nint main()\n{\n int n,i,x=0;\n char s[200];\n scanf(\"%s\",s);\n n=strlen(s);\n for(i=0;i\n#include\nmain()\n{\n\tint o=0,z=0,t=0,i,l;\n\tchar str[100];\n\tgets(str);\n\tl=strlen(str);\n\tfor(i=0;i\nint main () \n{ char a, ch[100];\n int l,v,w=0,i,j;\n scanf(\"%s\",&ch);\n l=strlen(ch); \n if (l<7)\n printf(\"NO\");\n else{\n \n \n for (i=0;i\n#include\nint main()\n{\n int l,i,k=0,m;\n char s[100];\n scanf(\"%s\",s);\n l=strlen(s);\n for(i=1; i\n#include \n\nint main()\n{\n char st[100];\n scanf(\"%s\",st);\n int h,m,i,l,j=0,n=0,t=0,y,k=0,x;\n int p=0;\n m=strlen(st);\n for(h=0;h=7||y>=7) {n++;}\n\n else {t++;}\n\n }\n if(n>=1) {printf(\"YES\");}\n\n else {printf(\"NO\");}\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int i,o,p=0;\n char n[100];\n scanf(\"%s\",&n);\n o=strlen(n);\n for (i=0; i\n#include\nint main()\n{\n int i,o,p=0;\n char n[700];\n scanf(\"%s\",&n);\n o=strlen(n);\n for (i=0;i\n#include\n\nint main()\n{\n char str[100];\n scanf(\"%s\", str);\n int i, length, num = 1;\n length = strlen(str);\n for(i = 0; i < length; i++)\n {\n if(str[i] == str[i+1])\n {\n num++;\n if(num == 7)\n {\n printf(\"YES\\n\");\n break;\n }\n }\n else\n num = 1;\n\n }\n if(num < 7)\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n char str[110];\n int ara[110];\n\n scanf(\"%s\",str);\n int i,ln;\n\n ln=strlen(str);\n ara[0]=1;\n\n for(i=1;i\nint main()\n{\n\tchar input[105];\n\tscanf(\"%s\",&input);\n\tint sum = 0;\n\tfor(int i = 0;input[i] != '\\0';i++)\n\t{\n\t\tif(input[i] == input[i+1])\n\t\t{\n\t\t\tsum++;\n\t\t}\n\t\telse if(sum >= 6 && input[i] == input[i-1] || sum >= 7)\n\t\t{\n\t\t\tsum++;\n\t\t\tbreak;\n\t\t}\n\t\telse{\n\t\t\tsum = 0;\n\t\t}\n\t}\n\t(sum >= 7) ? puts(\"YES\") : puts(\"NO\");\n\treturn 0;\n}\n"}], "negative_code": [{"source_code": "#include \n#include \nint main()\n{\n char str[101];\n scanf(\"%d\",&str);\n int n=strlen(str);\n int a=0,b=1;\n for(int i=0;i0&&str[i-1]==str[i])\n {\n a++;\n }\n else if(i>0&&str[i-1]!=str[i])\n {\n a=0;\n }\n if(a>6)\n {\n printf(\"YES\");\n b=0;\n break;\n }\n }\n if(b!=0)\n {\n printf(\"YES\");\n }\n return 0;\n}"}, {"source_code": "#include\n#include\nint main(){\n char s[101],c=0;\n scanf(\"%s\",s);\n if(s[0]==0){\n for(int i=1;i=7){\n printf(\"YES\");\n }\n else\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int l,p;\n char s[100];\n scanf(\"%s\",&s);\n l=strlen(s);\n for(int i=0;i\n#include\nint main(){\n int len,i,j,k;\n \n char players[100];\n for(i=0;i<100;i++){\n scanf(\"%s\",players);\n }\n len=strlen(players);\n if(len<8)\n printf(\"NO\");\n if(len>=8){\n for(i=0;i=6)\nprintf(\"YES\");\nelse\nprintf(\"NO\");\n}\nreturn 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n char n[100];\n scanf(\"%s\",n);\n int i,a=1;\n for(i=0;n[i+1]!='\\0';i++)\n {\n if(n[i]==n[i+1])\n a++;\n else\n a=1;\n if(a==6)\n break;\n }\n if(a>=6)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include\nint main()\n{int i=0,j=0;\nchar a[101];\nscanf(\"%s\",a);\nwhile(i<101)\n{if((a[i]==a[i+1])&&(a[i+1]==a[i+2])&&(a[i+2]==a[i+3])&&(a[i+3]&&a[i+4])&&(a[i+4]==a[i+5])&&(a[i+5]==a[i+6]))\n{\nj++;\nbreak ;\n}\ni++;\n}\nif(j==0)\nprintf(\"NO\");\nif(j>0)\nprintf(\"YES\");\nreturn 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\nint main()\n{\n char ch[100];\n int i=0,j=0,a=0,b=0;\n\n gets(ch);\n\n for(i=j;i<=strlen(ch)-1;i++){\n if(ch[i]=='0'){\n a++;\n b=0;\n }\n\n else if(ch[i]=='1'){\n b++;\n a=0;\n\n }\n }\n\n if(a>=7 || b>=7)\n printf(\"YES\");\n else if(a<7 && b<7) printf(\"NO\");\n\n\n\n\n\n\n return 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int i,j,n,c1=0,c2=0;\n char st[101];\n scanf(\"%s\",st);\n n=strlen(st);\n for(i=0;ic2 && (c1-c2)>=7))\n {\n printf(\"YES\");\n }\n else if((c2>c1) &&(c2-c1)>=7)\n {printf(\"YES\");}\n else\n {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main(){\n int len,i,j,k;\n j=0;\n char players[100];\n for(i=0;i<100;i++){\n scanf(\"%s\",players);\n }\n len=strlen(players);\n if(len<8)\n printf(\"NO\");\n if(len>=8){\n for(i=0;i=7)\nprintf(\"YES\");\nelse\nprintf(\"NO\");\n}\nreturn 0;\n}"}, {"source_code": "#include \n#include \nint main()\n{\n\tint len,i,m=0;\n\tchar s[101];\n\tscanf(\"%s\",s);\n\tlen=strlen(s);\n\tfor (i=0;i=7)\n\t\t\t{\n\t\t\t\tm=-1;\n\t\t\t\tprintf(\"YES\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse\n\t\t\t\tm=0;\n\t\t}\n\t\t\n\t}\n\tif ((m!=-1)||(m>=7))\n\t\tprintf(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main( )\n{\n char array[100];\n int i,count=0;\n for(i=0;i<100;i++){\n scanf(\"%s\",&array[i]);\n }\n for(i=0;i<100;i++){\n if(array[i]==array[i-1]){\n count++;\n }\n else{\n count=0;\n }\n\n if(count==6){\n break;\n }\n }\n if(count==6){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n char a[100];\n int i=0,n,x=0,c,k=0;\n scanf(\"%s\",a);\n n=strlen(a);\n while(n--)\n {\n if(a[i]==1)\n {\n c=i+6;\n while(c!=i)\n {\n if(a[c--]==1)\n k++;\n else\n {\n k=0;\n break;\n }\n }}\n else \n {\n c=i+6;\n while(c!=i)\n {\n if(a[c--]==0)\n x++;\n else\n {\n x=0;\n break;\n }\n }\n } \n }\n if(k==7||x==7)\n printf(\"YES\");\n else\n printf(\"NO\");\n \n \n return 0;\n}"}, {"source_code": "#include \n#include \nint main()\n{\n int i, one=0, zero=0;\n char s[101];\n gets(s);\n\tfor(i=0; i=7||zero>=7)\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse{\n\t\tprintf(\"NO\");\n\t}\n return 0;\n}\n"}, {"source_code": "# include \n\nint main()\n{\n int pl, flag = 0;\n scanf(\"%d\", &pl);\n \n while(pl>0){\n if(pl%100000000 == 1111111 || pl%100000000 == 0) {\n flag = 1;\n break;\n }\n pl = pl/10;\n }\n \n if(flag = 0)\n printf(\"NO\");\n else\n printf(\"YES\");\n return 0;\n}"}, {"source_code": "#include\n#include\n\nint main()\n{\n\n char str[200];\n int i,k,a=0;\n gets(str);\n for(i=0; str[i]!='\\0'; i++)\n {\n if(str[i]!=str[i+1])\n {\n k=1;\n continue;\n }\n k++;\n if(k==7)\n {\n a++;\n break;\n }\n }\n if(a==1)\n {\n printf(\"YES\");\n }\n else\n {\n\n printf(\"NO\");\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int l,p;\n char s[200];\n scanf(\"%s\",&s);\n l=strlen(s);\n for(int i=0;i\n#include \nint main()\n{\n char ch[100];\n int l,k,i;\n l=0;\n k=0;\n scanf(\"%s\",ch);\n l=strlen(ch);\n for(i=0;i=7 ){ printf(\"YES\"); }\n else { printf(\"NO\");}\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n\n\n\nint main() {\n char s[100];\n scanf(\"%s\",s);\n int p=0,i;\n \n\nfor(i=0;i<=(strlen(s));i++)\n{ \n if((s[i]==s[i+1]))\n { \n //if(s[i]==s[i+2])\n p++;\n //printf(\"i:%d p:%d\\n\",i,p);\n \n }\n else{ p=0;\n \n }\n \n if(p==6)\n {\n printf(\"YES\");\n p=0;\n break;\n \n } \n \n \n}\nif(p!=0)\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n char a[101];\n int i,l,j,c=0,c1=0; \n l=strlen(a);\n for(i=0;i=7||c>=7){\n printf(\"YES\");\n } \n else \n printf(\"NO\");\n return 0;\n \n}"}, {"source_code": "#include\n#include\n#include\nint main(void){\n\tchar str[105];\n\tfgets(str, 102, stdin);\n\tint length = strlen(str);\n\tif(str[length - 1] == '\\n'){\n\t\tlength--;\n\t}\n\tint i = 0;\n\tint filp = 0, count = 1;\n\tfor(i = 1; i < length ; i++){\n\t\tprintf(\"%d\\n\", count);\n\t\tif(str[i - 1] == str[i]){\n\t\t\tcount++;\n\t\t\tif(count == 7){\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tcount = 1;\n\t\t}\n\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n char ch[101];\n int i,l,c1=0,c2=0,flag=1;\n gets(ch);\n l=strlen(ch);\n for(i=0;i=7||c2>=7)\n flag=0;\n break;\n }\n if(flag==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n}\n"}, {"source_code": "#include\nmain()\n{\n\tint f=0,e=0,t,i;\n\tchar str[100];\n\tgets(str);\n\tfor(i=0;str[i]!='\\0';i++)\n\t{\n\t\tif(str[i]==1)\n\t\t{\n\t\t\tf++;\n\t\t\te=0;\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\te++;\n\t\t\tf=0;\n\t\t}\n\t\tif((f==7)||(e==7))\n\t\t{\n\t\t\tt=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(t)\n\tprintf(\"YES\");\n\telse\n\tprintf(\"NO\");\n}\n"}, {"source_code": "#include\n#include\nint main(){\n int len,i,j,k;\n j=0;\n char players[100];\n for(i=0;i<100;i++){\n scanf(\"%s\",players);\n }\n len=strlen(players);\n if(len<8)\n printf(\"NO\");\n if(len>=8){\n for(i=0;i=7)\nprintf(\"YES\");\nreturn 0;\n}"}, {"source_code": "#include \n#include \nint main()\n{\n\tint num1 = 0,num2=0,i,length,e;\n\tchar a[100];\n\tscanf(\"%s\",&a);\n\tlength = strlen(a);\n\tfor(i=0;i\n#include\nint main()\n{\n\tint count=0,count1=0,x=0,n,i,j;\n\tscanf(\"%d\",&n);\n\tchar a[n][3];\n\tfor(i=0;i\nint main()\n{int t=0,i=1,g=1;\nchar s[100];\nscanf(\"%s\",&s);\nwhile(i!=strlen(s))\n{g++;\nif(s[i]!=s[i-1])\ng=1;\ni++;\nif(g>=7)\n{t=3;\ni=strlen(s);\n}\n}\nif(t==3)\nprintf(\"No\");\nelse\nprintf(\"Yes\");\nreturn 0;\n}"}, {"source_code": "#include \nint main(void){\n char p[101]; int i,count=0;\n scanf(\"%s\", p);\n for(i=0;p[i];i++)\n {if(p[i]==p[i+1]) count++;}\n count++;\n if(count>=7) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n }"}, {"source_code": "#include \n#include \n\nint main()\n{\nchar *m,s[100];\n int n,j,p=0,k=0,i;\n gets(s);\n m=malloc(n*sizeof(char));\n for(i=0;i\nmain()\n{\n\tint f=0,e=0,t,i;\n\tchar str[100];\n\tgets(str);\n\tfor(i=0;str[i]!='\\0';i++)\n\t{\n\t\tif(str[i]==1)\n\t\t{\n\t\t\tf++;\n\t\t\te=0;\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\te++;\n\t\t\tf=0;\n\t\t}\n\t\tif((f==7)||(e==7))\n\t\t{\n\t\t\tt=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(t)\n\tprintf(\"YES\");\n\telse\n\tprintf(\"NO\");\n}\n"}, {"source_code": "#include\nint main()\n{\n int i,l,count=0;\n char pos[100];\n scanf(\"%s\",pos);\n l=strlen(pos);\n for(i=0;i\nint main(){\n char s[101],c=0;\n scanf(\"%s\",s);\n for(int i=0;s[i]!='\\0';i++){\n if((i+1)-i==1&&s[i]==s[i]+1){\n c++;\n }\n }\n if(c>=7){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include\n#include\nint main( )\n{\n char a[100];\n int count=0,zero=0;\n int i,j,l,t;\n gets(a);\n l=strlen(a);\n for(i=0;i\n#include \n#include \nint main()\n{\n int i;\n int c;\n int d;\n int e;\n char a[1000];\n scanf(\"%s\", &a);\n c=strlen(a);\n for(i=0;i=7)\n\t {\n\t \t printf(\"Yes\");\n\t }\n\t else \n\t {\n\t \t printf(\"NO\");\n\t }\n\t }\n\t } \n\t */\n"}, {"source_code": "#include\n#include\nint main()\n{\n char cha[101];\n int i,l,count=0;\n scanf(\"%s\", cha);\n l=strlen(cha);\n for(i=0;i\n#include \n#include\n\nint main()\n{\n char situatiion[101];\n int i,k=1,prec=1;\n\n scanf(\"%s\",&situatiion);\n for(i=1;i\n#include \n\nint main()\n{\n int z=0,o=0,i;\n char s[100];\n for (i = 0 ; i < 100 ; i ++){\n s[i] = 2;\n }\n scanf(\"%s\",s);\n for (i = 0 ; i < 7 ; i ++){\n if (s[i] == '0'){\n z++;\n }\n else{\n z = 0;\n }\n if (s[i] == '1'){\n o++;\n }\n else{\n o = 0;\n }\n }\n if(o >= 7 || z >= 7){\n printf(\"YES\");\n }\n else {\n printf(\"NO\");\n }\n\n printf(\"\\n%d %d\",o,z);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\n\nint main()\n{\n\n char player[24];\n int one=0,zero=0;\n scanf(\"%s\",player);\n\n for (int i=0;i\nint main()\n{int i=0,j=0;\nchar a[110];\nscanf(\"%s\",a);\nwhile(i<110)\n{if((a[i]==a[i+1])&&(a[i+1]==a[i+2])&&(a[i+2]==a[i+3])&&(a[i+3]&&a[i+4])&&(a[i+4]==a[i+5])&&(a[i+5]==a[i+6]))\n\n{\nj++;\n\n}\n\ni++;\n}\n\n\n\nif(j==0)\n\nprintf(\"NO\");\n\nif(j>0)\nprintf(\"YES\");\n\n\n\n\n\n\nreturn 0;\n\n}\n"}, {"source_code": "#include \nint main(void){\n char p[101]; int i,count=1;\n scanf(\"%s\", p);\n for(i=0;p[i];i++)\n {if(p[i]==p[i+1]) count++;\n else count=1; }\n if(count>=7) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n }"}, {"source_code": "\n\n\n#include \n#include\n \nint main() {\n\nchar s[100];\nfor(int k=0;k<=100;k++)\n{\n scanf(\"%c\",&s[k]);\n \n}\nfor(int i=0;i\n#include\nmain()\n{\n char s[100];\n int i,j,k;\n gets(s);\n k=strlen(s);\n if(k==7)\n {\n for(i=0;i\n#include\n#include\n\nint main()\n{\n char a[101]=\"\";\n int dem=1,dodai=0;\n\n scanf(\"%s\",&a);\n dodai=strlen(a);\n for(int i=0;i6) break;\n }\n \n if(dem>6)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n}\n\n"}, {"source_code": "#include\n#include\nmain()\n{\n char sit[101];\n scanf(\"%s\", sit);\n int i, l = strlen(sit);\n int one = 0, zero = 0, danger;\n for(i = 0; i < l; i++)\n {\n if(sit[i] == '1')\n {one++;\n if(one == 7)\n danger = 1;}\n else\n one = 0;\n if(sit[i] == '0'){\n zero++;\n if(zero == 7)\n danger = 1;}\n else\n zero = 0;\n }\n if(danger == 1)\n printf(\"YES\");\n else\n printf(\"NO\");\n}"}, {"source_code": "#include\nint main(){\n char s[101],c=0;\n scanf(\"%s\",s);\n for(int i=0;s[i]!='\\0';i++){\n if((i+1)-i==1&&s[i]==s[i+1]){\n c++;\n }\n }\n if(c>=7){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \n\nint main()\n{\n int i,l,k=0;\n char str[100];\n gets(str);\n l = strlen(str);\n if(l > 100) return 0;\n else\n {\n for(i=0; i=7)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \nint main()\n{\n \n int i,c ;\n char x[100];\n scanf(\"%s\",x);\n c=0;\n i=0;\n while ((i<=strlen(x))&&(c<=7))\n { i=i+1;\n if (x[i]==x[i-1])\n {\n c=c+1;\n }\n else {\n c=0;\n }\n \n }\n if (c==7)\n {printf(\"YES\");\n }\n else {\n printf(\"NO\");\n \n }\n\n \n return (EXIT_SUCCESS);\n}"}, {"source_code": "#include\nint main()\n{\n char str[500];\n gets(str);\n int i,count=0;\n for(i=0;str[i]!='\\0';i++)\n {\n if(str[i]==str[i+1])\n count++;\n }\n if(count>=7)\n printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include\n#include \nint main()\n{\n char str[100],i=0;\n\n scanf(\"%s\",str);\n\n while(i<100)\n {\n if(str[i]==str[i+1]&&str[i+1]==str[i+2]&&str[i+2]==str[i+3])\n {\n printf(\"YES\\n\");\n break;\n }\n\n else if(i==100) printf(\"NO\\n\");\n\n else i++;\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main(){\n char ch[100];\n int c=0,t=0;\n scanf(\"%s\",ch);\n int l=strlen(ch);\n for(int i=0;i=7)\n {printf(\"YES\");\n return 0;\n //break;\n }\n if(ch[i]==ch[i+1])\n c++;\n else\n c=0;\n \n } \n \n //if(t==0)\n printf(\"NO\");\n}"}, {"source_code": "#include\nint main()\n{\n char str[500];\n gets(str);\n int i,count=0;\n for(i=0;str[i]!='\\0';i++)\n {\n if(str[i]==str[i+1])\n count++;\n }\n if(count>=7)\n printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main(){\nchar arr[100];\nscanf(\"%s\",arr);\nint i;\nint len=strlen(arr);\nif(len<7){printf(\"NO\");return 0;}\nelse{\n int cnt=0;\n while(i<=len-2){\n if(cnt+2==7){printf(\"YES\");return 0;}\n if(arr[i]==arr[i+1]){cnt++;i++;}\n else{cnt=0;i++;}\n }\n printf(\"NO\");return 0;\n}\n}"}, {"source_code": "#include\n#include\nint main()\n{\n char a[100],i,l;\n int count;\n gets(a);\n l=strlen(a);\n for(i=0;i\nint main()\n{\n char s[101];\n int i,flag=0;\n scanf(\"%s\",&s);\n for(i=0;i<101;i++)\n{\nif(s[i]==s[i+1]&&s[i]==s[i+2]&&s[i]==s[i+3]&&s[i]==s[i+4]&&s[i]==s[i+5]&&s[i]==s[i+6])\nflag=5;\nelse\nflag=0;\n}\n if(flag==5)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n\n\n"}, {"source_code": " #include\n\nint main()\n{\n int i,j,m=0,n=0;\n char c[100];\n scanf(\"%s\",c);\n for(i=0;c[i]!='\\0';i++){\n if(c[i]=='1'){\n m=0;\n n++;\n if(n>=7)\n {printf(\"YES\");\n break;}\n }\n else if(c[i]=='0'){\n \n n=0;\n m++;\n if(m>=7)\n {printf(\"YES\");\n break;}\n }\n \n \n }\n if(m<=7 && n<=7)\n printf(\"NO\");\n \n \n return 0;\n}"}, {"source_code": "#include \n#include \nint main(void){\n int i,p[101],count=0;\n scanf(\"%s\", p);\n for(i=0;i=7) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n }"}, {"source_code": "#include \n#include \n\nint main()\n{\n int a=0,i;\n char s[101];\n scanf(\"%s\",s);\n for(i=0;i\n#include\nint main()\n{\n char s[100]; \n gets(s);\n int i,count1=0,count2=0; \n int n=strlen(s);\n for(i=0;i=7 || count2>=7)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n return 0;\n}"}, {"source_code": "/* \n * File: Football.c\n * Author: Wissem\n *\n * Created on 19 novembre 2017, 01:41\n */\n\n#include \n#include \n#include \n/*\n * \n */\nint main() {\n int x=0;\n char s[101];\n scanf(\"%s\",&s);\n for (int i=0;i<(strlen(s));i++){\n if (s[i]==s[i+1])\n x+=1;}\n if (x>7)\n printf(\"YES\");\n else printf(\"NO\");\n \n }\n \n\n"}, {"source_code": "#include\nint main()\n{\n char str[100];\n scanf(\"%s\",str);\n int i,j,count,flag;\n for(i=0;i<'\\0';i++)\n { count=0;\n for(j=i;j=7)\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\nint main()\n{\n char str[100];\n int i,j=0,t=0;\n scanf(\"%s\",str);\n for(i=0;str[i]!='\\0';i++)\n {\n if(str[i]==1)\n t++;\n if(str[i]==0)\n j++;\n }\n if(t>=7||j>=7)\n printf(\"No\");\n else\n printf(\"Yes\");\n return 0;\n}"}, {"source_code": "#include \nint main(){\n char football[100];\n gets(football);\n int i=0,a=1,k=0,j=0,q;\n while (football[i]!='\\0'){\n\n for(j=0;j<7;j++){\n if(football[k]==football[k+1])\n {a++;}\n else if(football[k]!=football[k+1])\n {a=1;}\n k++;\n }\n\n if(a>6)\n {break;}\n a=1;\n i++;\n k=i;\n }\n if(a>=5)\n printf(\"YES\");\n else if(a<6)\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main() {\n \nchar a[110];\nint i,count=0,b;\n\nscanf(\"%s\", a);\n\n for(i=0;i6)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \n\nint main(void)\n{\n char tab[100];\n int count_1;\n int count_2;\n int i = 0;\n \n \n scanf(\"%s\", &tab);\n \n count_1 = 0;\n count_2 = 0;\n \n while (i < strlen(tab))\n {\n if (tab[i] == '0')\n {\n while(tab[i] == '0')\n {\n count_1++;\n i++;\n }\n }\n \n else if (tab[i] == '1')\n {\n while(tab[i] == '1')\n {\n count_2++;\n i++;\n }\n }\n \n i++;\n }\n \n if (tab[i] == '\\0')\n {\n return (0);\n }\n \n if (count_1 >= 7 || count_2 >= 7)\n {\n printf(\"YES\");\n }\n \n else {\n printf(\"NO\");\n }\n return (0);\n}"}, {"source_code": "#include\nint main( )\n{\n char array[100];\n int i,count=0;\n scanf(\"%s\",&array[i]);\n for(i=0;i<100;i++){\n if(array[i]==array[i-1]){\n count++;\n }\n else{\n count=0;\n }\n\n if(count==6){\n break;\n }\n }\n if(count==6){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n}\n"}, {"source_code": "#include\n#include\nint main(){\n\tchar a[100];\n\tint i,l,k=1,t=0;\n\tscanf(\"%s\",&a);\n\tl=strlen(a);\n\tfor(i=0;i\n#include \n\nint main() {\n\tint i=0, n=0, j=0, x, s;\n\tchar a[100];\n\tgets (a);\n\tx = strlen(a)-1;\n\twhile(i < x) {\n\t\ts = i+1;\n\t\tif(a[s]=='1') {\n\t\t\tif(a[i]=='1') n++;\n\t\t}\n\t\telse if(a[s]=='0') {\n\t\t\tif(a[i]=='0') j++;\n\t\t}\n\t\telse {\n\t\t\tif (a[i]=='1') j=0;\n\t\t\telse i=0; \n\t\t}\n\t\ti++;\n\t}\n\tif (n >=7 || j>=7) printf(\"YES\");\n\telse printf(\"NO\");\n}"}, {"source_code": "#include\n#include\nint main(){\n char str[100];\n int i,length;\n int count_zero=0,count_one=0,flag=0;\n gets(str);\n length=strlen(str);\n for(i=1;i<=length;i++){\n if(str[i]=='1'){\n count_one++;\n count_zero=0;\n }\n else\n count_zero++;\n count_one=0;\n }\n\n if(count_zero==7||count_one==7){\n printf(\"YES\");\n }\n else\n printf(\"NO\");\n\n}\n"}, {"source_code": "#include\n#include\n\nint main()\n{\n\tchar str[100];\n\tchar res[3];\n\tint i, j, k, l;\n\t\n\tscanf(\"%s\", str);\n\t\n\tk = strlen(str);\n\tres[0]='N';\n\tres[1]='O';\n\tres[2]='\\0';\n\t\n\tfor(i=0; i\n#include \n#include \nchar string[100];int length,i,count,count2;\nint main()\n{\n scanf(\"%s\",&string);\n length=strlen(string);\n for (i=0;i0&&i0&&i=6)\n printf(\"YES\");\n if (count2>=6)\n printf(\"YES\");\n if (count<6&&count2<6) printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\nmain()\n{\n\tint f=0,e=0,t,i,l;\n\tchar str[100];\n\tgets(str);\n\tl=strlen(str);\n\tfor(i=0;i\nint main(){\n char s[101],c=0;\n scanf(\"%s\",s);\n for(int i=0;s[i]!='\\0';i++){\n if((i+1)-i==1&&s[i]==s[i+1]){\n c++;\n }\n }\n if(c==7){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include\n#include\n#include\nint main(void){\n\tchar str[101];\n\tfgets(str, 101, stdin);\n\tint length = strlen(str);\n\tint i = 0;\n\tint filp = 0, count = 0;\n\tchar current = str[i];\n\tfor(i = 1; i < length - 1 && count < 7; i++){\n\t\tif(str[i] != current && filp == 0){\n\t\t\tfilp = 1;\n\t\t\tcount++;\n\t\t}\n\t\telse if(str[i] == current && filp == 1){\n\t\t\tcount++;\n\t\t}\n\t\telse if(str[i] != current){ \n\t\t\tfilp = 0;\n\t\t\tcount = 0;\n\t\t}\n\t\tcurrent = str[i];\n\t}\n\tif(count == 7){\n\t\tprintf(\"YES\\n\");\n\t}\n\telse{\n\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n char ch[100];\n int i,j=0,k=0;\n scanf(\"%s\",ch);\n for(i=0;i\nint main()\n{\n char s[101];\n int i,c1=0,c2=0;\n scanf(\"%s\",&s);\n strlen(s);\n for(i=0;i\n#include\nint main()\n{char str[100];\nint i,j,l;\nscanf(\"%s\",str);\nl=strlen(str);\nfor(i=0;i\nint main()\n{\n char a[150];\n int i,j,c;\n scanf(\"%s\",a);\n for(j=0;a[j]!='\\0';j++)\n {\n if(a[j]==a[j+1])\n {\n c++;\n if(c==7)\n {\n break;\n }\n }\n else\n c=0;\n }\n if(c<7)\n printf(\"NO\");\n else\n printf(\"YES\");\n return 0;\n}"}, {"source_code": "#include \n#include \nint main() {\n \nchar a[110];\nint i,count=0,b;\n\nscanf(\"%s\", a);\n\n for(i=0;i6)\n printf(\"YES\");\n else\n printf(\"NO\");\n \n return 0;\n}"}, {"source_code": "#include\n#include\n\n\nint main()\n\n{\n\n\n char pos[100];\n int i,x,flag;\n gets(pos);\n x=strlen(pos);\n if(x<7)\n {\n printf(\"NO\");\n return 0;\n }\n for(i=0;i\n#include \nint main()\n{\n int i,c;\n char s[100];\n scanf(\"%s\",s);\n c=strlen(s);\n int t=0,z=0;\n for(i=0;i=7 )\n printf(\"YES\");\nelse\n printf(\"NO\");\n\n \n return 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n char s[1000];\n int i,c=0,j;\n scanf(\"%s\",&s);\n for(i=0;s[i]!='\\0';i++)\n {c=0;\n for(j=i+1;s[j]!='\\0';j++)\n { \n if(s[i]!=s[j]) \n { c=j-i; if(c>=7) { printf(\"YES\"); return 0;}}\n }\n }\n printf(\"NO\");\n}"}, {"source_code": "#include \n#include \nint main()\n{\n int i,c;\n char s[100];\n scanf(\"%s\",s);\n c=strlen(s);\n int t=0,z=0;\n for(i=0;i7 || z==7 )\n \n printf(\"YES\");\nelse \n printf(\"NO\");\n \n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n char str[22];\n scanf(\"%s\",str);\n int i;\n int sum=0;\n int sum2=0;\n\n for(i=1;str[i]!='\\0';i++)\n {\n if((str[i] && str[0])==('0'||'1') )\n {\n\n if (str[i]==str[i-1])\n {\n sum=sum+1;\n }\n sum2=sum2+1;\n }\n\n\n }\n if(sum>=7 && sum2!=sum)\n {\n printf(\"YES\");\n }\n else if(sum2!=sum)\n {\n printf(\"NO\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \nint main()\n{\n int i,n;\n int T=0;\n int N=0;\n char s[100];\n char M;\n scanf(\"%s\",s);\n M=s[0];\n n=strlen(s);\n for (i=1;i=7)\n {\n T=1;\n printf(\"Yes\");\n break;\n }\n }\n else\n {\n N=0;\n M=s[i];\n }\n\n }\n if (T==0)printf(\"NO\");\n\n}\n"}, {"source_code": "#include\nint main()\n{\n char a[100]; int i=0,j=0,k=0;\n scanf(\"%s\",a);\n while(a[i]!='\\0')\n {\n if(a[i]-'0'==0)\n {\n j++; i++;\n }\n if(a[i]-'0'==1)\n {\n k++; i++;\n }\n }\n if(j==0||k==0||j>=7||k>=7)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n char c[200];\n int i, j, x=0, y;\n for(i = 0; i < 200; i++)\n {\n scanf(\"%c\", &c[i]);\n }\n for(i = 0; i < 200; i++)\n {\n if(c[i] == '0')\n {\n for(j = i+1; c[j] == '0'; j++)\n {\n x++;\n }\n }\n else if(c[i] == '1')\n {\n for(j = i+1; c[j] == '1'; j++)\n {\n x++;\n }\n }\n }\n if(x >= 7)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n\n return 0;\n\n}\n"}, {"source_code": "#include\nint main()\n{\n char str[500];\n gets(str);\n int i,count=0;\n for(i=0;str[i]!='\\0';i++)\n {\n if(str[i]==str[i+1])\n count++;\n }\n if(count==7)\n printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main ()\n{\n char t[22];\n int c=1;\n scanf(\"%s\",t);\n int n = strlen(t);\n for(int i = 1 ; i\nint main()\n{\n int i,a[100];\n for(i=0;i<100;i++)\n scanf(\"%d\",&a[i]);\n int sum=0,count=0;\n int sum1=0,count1=0;\n for(i=0;i<100;i++)\n {\n if(a[i]=='1')\n {\n sum=sum+a[i];\n count++;\n sum1=0;\n }\n if(a[i]=='0')\n \n {\n sum1=sum1+a[i];\n count1++;\n sum=0;\n }\n }\n if(count<=7 || count1<=7 )\n printf(\"NO\");\n else\n printf(\"YES\");\n return 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n\tlong int i,n,k,s;\n\tscanf(\"%ld\",&n);\n\tfor(s=0;(n/pow(10,s))>=1;s++)\n\t{\n\t\tif((n/(pow(10,s)))==0)\n\t\tbreak;\n\t\t\n\t}\n\t\n\t\n\tlong int a[s];\n\tif(s<7)\n\t{\n\t\tprintf(\"NO\");\n\t}\n\telse\n\tfor(i=0;i=1&&k<=6&&i==s-7)\n\t\t{\n\t\t\tprintf(\"NO\");\n\t\t}\n\n\t\tif(k>=1&&k<=6&&i!=s-7)\n\t\t{\n\t\t\tcontinue;\n\t\t}\n\t\t\t\n\t}\n\treturn 0;\n\t\n}\n \n \n "}, {"source_code": "#include\nint main()\n{\n int i,j,temp=0;\n char str[100];\n char substr[8]={\"0000000\"};\n char substr1[8]={\"1111111\"};\ngets(str);\n for(i=0;str[i]!='\\0';i++)\n {\n j=0;\n while(str[i]==substr[j] || str[i]==substr1[j])\n {\n if(str[i]==substr[j] || str[i]==substr1[j])\n {\n i++;\n j++;\n\n if(substr[j]=='\\0' || substr1[j]=='\\0')\n {\n printf(\"YES\");\n break;\n }\n }\n else\n {\n temp++;\n }\n }\n }\n\n while(temp>0){\n printf(\"NO\");\n break;\n }\n\n return 0;\n}\n"}, {"source_code": "#include \nint main(){\n char football[100];\n gets(football);\n int i=0,a=0,k=0,j=0;\n while (football[i]!='\\0'){\n\n for(j=0;j<7;j++){\n if(football[k]==football[k+1])\n {a++;}\n else if(football[k]!=football[k+1])\n {a=0;}\n k++;\n }\n\n if(a>=5)\n {break;}\n a=0;\n i++;\n k=i;\n }\n if(a>=5)\n printf(\"YES\");\n else if(a<6)\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n\nint main()\n{\n long i = 0;\n int dem;\n char s[100];\n fflush(stdin);\n gets(s);\n int dai = strlen(s);\n while (s[i]!='\\0')\n {\n dem = 1;\n while (i < dai)\n {\n if (s[i] == s[i+1])\n {\n dem++;\n i++;\n }\n if(dem < 7)\n {\n dem = 1;\n i++;\n }\n\n }\n\n }\n if (dem >= 7)\n printf(\"YES\");\n else\n printf(\"NO\");\n}"}, {"source_code": "#include \n#include \n#include \n\nint main()\n{\n char arr[101]={0};\n int i,leng,count,flag=0;\n count=0;\n scanf(\"%s\",arr);\n leng=strlen(arr);\n for(i=0;i\n#include \nint main()\n{\n char n[100000];\n int a,s,i,count=0;\n scanf(\"%s\",n);\n a=strlen(n);\n s=a/7;\n for(i=0;i<=s;i++)\n {\n if(n[i]=='0'&&n[i+1]=='0'&&n[i+2]=='0'&&n[i+3]=='0'&&n[i+4]=='0'&&n[i+5]=='0'&&n[i+6]=='0')\n {\n printf(\"YES\\n\");\n count=0;\n break;\n }\n else if(n[i]=='1'&&n[i+1]=='1'&&n[i+2]=='1'&&n[i+3]=='1'&&n[i+4]=='1'&&n[i+5]=='1'&&n[i+6]=='1')\n {\n printf(\"YES\\n\");\n count=0;\n break;\n }\n else\n {\n count++;\n continue;\n }\n }\n if(count>0)\n {\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main(void) {\n char ch[100];\n int i,s;\n s=i=0;\n scanf(\"%s\",&ch);\n while(ch[i]!='\\0' && s<7 ){\n \n if (ch[i]=='0') {s=0;\n i++;}\n else if (ch[i]=='1') {s=s+1;\n i=i+1;}\n \n \n }\n if (s>=7) printf(\"yes\");\n else printf(\"NO\");\n \n \n \n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n char s[22];\n int one=0,zero=0;\n int i;\n gets(s);\n for(i=0;s[i]!='\\0';i++)\n {\n if(s[i]=='0')\n zero++;\n else if(s[i]=='1')\n one++;\n }\n if(one>=7||zero>=7)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main()\n{\n int s[100];\n int* p;\n int* p1;\n p=strchr(s,\"1111111\");\n p1=strchr(s,\"0000000\");\n \n scanf(\"%s\",&s);\n \n if(p!=NULL || p1!=NULL)\n printf(\"YES\");\n \n else\n printf(\"NO\");\n \n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int i,j,p=0,q=0,count=0,count1=0;\n char s[101];\n scanf(\"%s\",s);\n for(i=0;s[i]!='\\0';i++)\n {\n count=0;\n count1=0;\n if(s[i]=='1')\n {\n for(j=i;s[j]!='\\0';j++)\n {\n if(s[j]=='1')\n {\n count++;\n }\n if(count==7){\n p=1;\n break;\n }\n }\n }\n else\n {\n for(j=i;s[j]!='\\0';j++)\n {\n if(s[j]=='0')\n {\n count1++;\n }\n if(count1==7){\n p=1;\n break;\n }\n }\n }\n }\n if(p==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main() {\n\tint i=0, n=0, j=0, x, s;\n\tchar a[100];\n\tgets (a);\n\tx = strlen(a)-1;\n\twhile(i < x) {\n\t\ts = i+1;\n\t\tif(a[s]=='1') {\n\t\t\tif(a[i]=='1') n++;\n\t\t}\n\t\telse if(a[s]=='0') {\n\t\t\tif(a[i]=='0') j++;\n\t\t}\n\t\telse {\n\t\t\tif (a[s]=='1') j=0;\n\t\t\telse i=0; \n\t\t}\n\t\ti++;\n\t}\n\tif (n >=7 || j>=7) printf(\"YES\");\n\telse printf(\"NO\");\n}"}, {"source_code": "#include\n#include\nint main()\n{\n char str[100];\n scanf(\"%s\",str);\n int i,j,count,flag;\n int len=strlen(str);\n for(i=0;i=7)\n {\n printf(\"YES\");\n break;\n }\n }\n \n if(flag<7)\n printf(\"NO\");\n return 0;\n}"}], "src_uid": "ed9a763362abc6ed40356731f1036b38"} {"nl": {"description": "It's New Year's Eve soon, so Ivan decided it's high time he started setting the table. Ivan has bought two cakes and cut them into pieces: the first cake has been cut into a pieces, and the second one — into b pieces.Ivan knows that there will be n people at the celebration (including himself), so Ivan has set n plates for the cakes. Now he is thinking about how to distribute the cakes between the plates. Ivan wants to do it in such a way that all following conditions are met: Each piece of each cake is put on some plate; Each plate contains at least one piece of cake; No plate contains pieces of both cakes. To make his guests happy, Ivan wants to distribute the cakes in such a way that the minimum number of pieces on the plate is maximized. Formally, Ivan wants to know the maximum possible number x such that he can distribute the cakes according to the aforementioned conditions, and each plate will contain at least x pieces of cake.Help Ivan to calculate this number x!", "input_spec": "The first line contains three integers n, a and b (1 ≤ a, b ≤ 100, 2 ≤ n ≤ a + b) — the number of plates, the number of pieces of the first cake, and the number of pieces of the second cake, respectively.", "output_spec": "Print the maximum possible number x such that Ivan can distribute the cake in such a way that each plate will contain at least x pieces of cake.", "sample_inputs": ["5 2 3", "4 7 10"], "sample_outputs": ["1", "3"], "notes": "NoteIn the first example there is only one way to distribute cakes to plates, all of them will have 1 cake on it.In the second example you can have two plates with 3 and 4 pieces of the first cake and two plates both with 5 pieces of the second cake. Minimal number of pieces is 3."}, "positive_code": [{"source_code": "#include \n\nunsigned min(unsigned a, unsigned b) {\n\treturn a < b ? a : b;\n}\n\nint main(int argc, char* argv[]) {\n\tunsigned n, a, b, t, x, y;\n\n\tscanf(\"%d %d %d\", &n, &a, &b);\n\n\tt = a + b;\n\tx = (int)(((float)a / t) * n);\n\ty = n - x;\n\n\tif (x == 0 || (y > 1 && a%t != 0 && min(a/(x+1), b/(y-1)) > min(a/x, b/y))) {\n\t\tx++;\n\t\ty--;\n\t}\n\n\tif (a/x < b/y)\n\t\tprintf(\"%d\", a / x);\n\telse\n\t\tprintf(\"%d\", b / y);\n\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int a,b,n,flag,ans=0,x,y;\n scanf(\"%d%d%d\",&n,&a,&b);\n for(int p=1;py)\n flag=y;\n else\n flag=x;\n \n if(flag>ans)\n ans=flag;\n }\n }\n \n printf(\"%d\",ans);\n return 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n int i, j, k, temp, min;\n int n, m, a, b;\n scanf(\"%d %d %d\", &n , &a, &b);\n if(a>b)\n {\n temp=a;\n a=b;\n b=temp;\n }\n m=0;\n for(i=1; i<=n-1; i++)\n {\n j=a/i;\n k=b/(n-i);\n if(j>=1 && k>=1)\n {\n if(j\nint main()\n{\n\tint n,a,b;\n\tscanf(\"%d%d%d\",&n,&a,&b);\n\tint i,ans=0;\n\tif(n==a+b)\n\t\tans=1;\n\telse\n\t\tfor(i=1;ians)\n\t\t\t\tans=min;\n\t\t\t// printf(\"a:%d b:%d ans:%d\\n\",a/i,b/(n-i),ans);\n\t\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint main() \n{\n int a,b,n,i,j,tempa,tempb,flag=0,temp;\n scanf(\"%d %d %d\",&n,&a,&b);\n i=1;\n while(1)\n {\n tempa=a;\n tempb=b;\n j=0;\n if(((a-i)<0)||((b-i)<0))\n {\n flag=-1;\n }\n while(j=0)\n tempa=tempa-i;\n else if((tempb-i)>=0)\n tempb=tempb-i;\n else \n {\n flag=-1;\n break;\n }\n j++;\n }\n if(flag==-1)\n break;\n i++;\n }\n printf(\"%d\",i-1);\n return 0;\n}\n"}, {"source_code": "#include\nint min(int a,int b){\n\treturn a>b?b:a;\n}\nint max(int a,int b){\n\treturn a\n#include \n\nint main()\n{\n int a,b,n,c,d,t,g,h,i,j,min=0;\n scanf(\"%d%d%d\",&n,&a,&b);\n if (a>b) {t=a;a=b;b=t;}\n c=b-a;\n d=b+a;\n if (d<2*n) {printf(\"1\");return 0;}\n for (i=1;i<=n-1;i++)\n {\n j=n-i;\n g=b/i;\n h=a/j;\n if (g>h) g=h;\n if (g>min) min=g;\n }\n printf(\"%d\",min);\n return 0;\n}\n"}, {"source_code": "#include\nint max(int u,int w)\n {\n if(u>w)\nreturn u;\n else\n return w; }\nint min(int u,int w)\n { if(u>w)\n return w;\n else\nreturn u; }\nint main()\n { int i,a,b,n,x,t1;\n scanf(\"%d\",&n);\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n x=0;\nt1=0;\n for(i=n-1;i>=1;i--)\n { \n t1=min(a/i,b/(n-i) );\n x=max(x,t1); }\n printf(\"%d\",x); \n return 0; } \n"}, {"source_code": "#include\n\nint main()\n{\n int n,a,b;\n scanf(\"%d\",&n);\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n\n int Max=0;\n int Min=105;\n\n int x1,x2;\n int d1,d2;\n\n\n for(x1=n-1;x1>0;x1--)\n {\n x2=n-x1;\n\n d1=a/x1;\n d2=b/x2;\n\n if(d1Max)\n Max=Min;\n }\n\n printf(\"%d\",Max);\n\n}\n"}, {"source_code": "#include\nint main(){\nint n,n1,n2,a,b,i,j,c,d,e=0;\nscanf(\"%d %d %d\",&n,&a,&b);\nif(a>b){\n c=b;\n d=a;\n}\nelse if(b>a){\n c=a;\n d=b;\n}\nelse if(b==a){\n c=a;\n d=b;\n}\n//printf(\"%d %d\\n\",c,d);\nfor(i=1;i<=c;i++){\n n1=i;\n n2=n-n1;\n // printf(\"%d %d\\n\",n1,n2);\n for(j=1;j<=100;j++){\n if(n1*j<=c&&n2*j<=d&&j>e)\n e=j;\n if(n1*j>c)\n break;\n }\n}\nprintf(\"%d\",e);\n}\n\n"}, {"source_code": "#include\nint temp[300],a[300];\nvoid merge(int l,int r)\n{\n if(l==r)\n return;\n int i,j,k,mid;\n mid=(l+r)/2 ;\n merge(l,mid ) ;\n merge(mid+1,r) ;\n for(i=l,j=mid+1,k=l; k<=r; k++)\n {\n if(i==mid+1)\n {\n temp[k]=a[j] ;\n j++;\n }\n else if(j==r+1)\n {\n temp[k]=a[i] ;\n i++ ;\n }\n else if(a[i]<=a[j])\n {\n temp[k]=a[i] ;\n i++ ;\n }\n else\n {\n temp[k]=a[j] ;\n j++ ;\n }\n }\n for(i=l; i<=r; i++)\n a[i]=temp[i] ;\n}\nint main()\n{\n int n,c,b,i,d1,d2 ;\n scanf(\"%d%d%d\",&n,&c,&b) ;\n i=1 ;\n while(n-i>0)\n {\n d1=c/i;\n d2=b/(n-i) ;\n if(d1<=d2)\n a[i]=d1 ;\n else\n a[i]=d2 ;\n i++;\n }\n merge(1,n-1);\n printf(\"%d\",a[n-1]);\n\n return 0 ;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int n,a,b;\n scanf(\"%d\",&n);\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n\n int Max=0;\n int Min=105;\n\n int x1,x2;\n int d1,d2;\n\n\n for(x1=n-1;x1>0;x1--)\n {\n x2=n-x1;\n\n d1=a/x1;\n d2=b/x2;\n\n if(d1Max)\n Max=Min;\n }\n\n printf(\"%d\",Max);\n\n}\n"}, {"source_code": "\n#include\n\nint main()\n{\n\tint n, a, b;\n\twhile (~scanf(\"%d %d %d\", &n, &a, &b))\n\t{\n\t\tint num[200];\n\t\tfor (int i = 1; i <= n - 1; i++)\n\t\t{\n\t\t\tnum[i] = (a / i) < (b / (n - i)) ? (a / i) : (b / (n - i));\n\t\t}\n\t\tint max = num[1];\n\t\tfor (int i = 1; i <= n - 1; i++)\n\t\t{\n\t\t\tif (max < num[i])\n\t\t\t\tmax = num[i];\n\t\t}\n\t\tprintf(\"%d\\n\", max);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\nint min1[10005],min[5];\nint main()\n{\n\tint n,a,b;\n\tscanf(\"%d%d%d\",&n,&a,&b);\n\tint i,j,quo,m,l=0,k,ans,temp;\n\tif(a>b)\n\t{\n\t\ttemp=a;\n\t\ta=b;\n\t\tb=temp;\n\t}\n\tfor(i=1;i<=a;i++)\n\t{\n\t\tfor(j=i;j<=b;j++)\n\t\t{\n\t\t\tquo=(a/i)+(b/j);\n//\t\t\tprintf(\"%d %d %d :\",i,j,quo);\n\t\t\tif(quo>=n)\n\t\t\t{\n\t\t\t\tmin[0]=i;\n\t\t\t\tmin[1]=j;\n\t\t\t\tmin[2]=i+a%i;\n\t\t\t\tmin[3]=j+b%j;\n\t\t\t\tm=min[0];\n\t\t\t\tfor(k=0;k<4;k++)\n\t\t\t\t{\n\t\t//\t\t\tprintf(\"%d \",min[k]);\n\t\t\t\t\tif(m>min[k])\n\t\t\t\t\t\tm=min[k];\n\t\t\t\t}\n\t\t//\t\tprintf(\":\");\n\t\t\t\tif(m!=0)\n\t\t\t\tmin1[l++]=m;\n\t\t\t}\n\t\t}\n\t}//printf(\"\\n\");\n\tans=min1[0];\n\tfor(i=0;i\nint main()\n{\n int n,a,b,count=1,max,d,e;\n scanf(\"%d %d %d\",&n,&a,&b);\n max=(a+b)/n;\n while(count&&max)\n {\n d=a/max;\n e=b/max;\n if(d!=0&&e!=0)\n {\n if((d+e)>=n)\n {\n\n count=0;\n printf(\"%d\",max);\n }\n else{\n max=max-1;\n }\n }\n\n else\n {\n max=max-1;\n }\n }\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n#include \nint main()\n{\n int n,a,b,i=1;\n scanf(\"%d %d %d\",&n,&a,&b);\n while(i<=a && i<=b){\n if(a/i + b/i >=n){\n i++;\n }\n else break;\n }\n printf(\"%d\",i-1);\n return 0;\n}"}, {"source_code": "#include\n#include\n#include\n\nint min(double a,double b){\n if(amax){\n max=m;\n }\n }max=(int)floor(max);\n printf(\"%d\",max);\n \n \n \n}"}, {"source_code": "#include \nint min(int a,int b){return (a=n)\n {\n if(mid+1>min(a,b) || a/(mid+1)+b/(mid+1)\nint main()\n{\n int i,j,a,b,n;\n scanf(\"%d %d %d\",&n,&a,&b);\n int max = (a+b)/n,res = 0;\n for(i=max;i>0;i--)\n {\n for(j=1;j<=n-1;j++)\n {\n if(i*j<=a&&i*(n-j)<=b)\n {\n res = i;\n printf(\"%d\",res);\n break;\n }\n }\n if(res!=0)\n break;\n }\n return 0;\n}\n"}, {"source_code": "#include\n\nint min(int a,int b)\n{\n\treturn (ab)?(a):(b);\n}\n\nint main()\n{\n\tint n,a,b;\n\t\n\tscanf(\"%d%d%d\",&n,&a,&b);\n\n\tint i,j,k,ans=-10000000;\n\n\tfor(i=1;i\n#include\n#include\nvoid main()\n{\nint n,a,b,i,k1,k2,k3,max;max=0;\nscanf(\"%d %d %d\",&n,&a,&b);\n\nfor(i=1;imax)\nmax=k3;\n}\n\nprintf(\"%d\\n\",max);\nexit(0);\n}"}, {"source_code": "#include \n#include \n\nint main()\n{ int n,a,b,i,p,q;\n scanf(\"%d%d%d\",&n,&a,&b);\n for(i=1;(a/i+b/i>=n)&&((a/i>=1)&&(b/i>=1));i++)\n {\n continue;\n\n }\n printf(\"%d\",i-1);\n\n}\n"}, {"source_code": "\n#include\nint main()\n{\nint n,a,b,i,c=0,count=0,count2=0;\nint answer1=0,answer2=0;\nint x;\nscanf(\"%d %d %d\",&n,&a,&b);\nif(n==a+b)\n{\n printf(\"1\");\n}\nelse if(n=count)\n {\n answer1=count;\n break;\n }\n }\n\n if(a>=b)\n count=a;\n else count=b;\n x=count;\n for(i=1;i=count)\n {\n answer2=count;\n break;\n }\n }\n\n\n if(answer1>answer2)\n printf(\"%d\",answer1);\n else printf(\"%d\",answer2);\n\n\n}\n\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include\nint main(){\nint n,n1,n2,a,b,i,j,c,d,e=0;\nscanf(\"%d %d %d\",&n,&a,&b);\nif(a>b){\n c=b;\n d=a;\n}\nelse if(b>a){\n c=a;\n d=b;\n}\nelse if(b==a){\n c=a;\n d=b;\n}\n//printf(\"%d %d\\n\",c,d);\nfor(i=1;i<=c;i++){\n n1=i;\n n2=n-n1;\n // printf(\"%d %d\\n\",n1,n2);\n for(j=1;j<=100;j++){\n if(n1*j<=c&&n2*j<=d&&j>e)\n e=j;\n if(n1*j>c)\n break;\n }\n}\nprintf(\"%d\",e);\n}\n\n"}, {"source_code": "#include\nint check(int z, int n, int a, int b);\n\nint main(){\n\n int n, a, b;\n scanf(\"%d %d %d\", &n, &a, &b);\n\n if(n == a + b){\n printf(\"%d\\n\", 1);\n return 0;\n }\n\n int answer;\n int z = (n * a)/(a + b);\n\n if(z == 0)\n z = 1;\n\n else if(z >= n - 1){\n z = n - 1;\n } else {\n\n answer = check(z, n, a, b);\n\n if(answer < check(z + 1, n, a, b))\n answer = check(z + 1, n, a, b);\n\n printf(\"%d\\n\", answer);\n return 0;\n }\n\n\n\n\n\n if(a/z <= b/(n - z))\n answer = a/z;\n else\n answer = b/(n - z);\n\n printf(\"%d\\n\", answer);\n}\n\nint check(int z, int n, int a, int b){\n int answer;\n if(a/z <= b/(n - z))\n answer = a/z;\n else\n answer = b/(n - z);\n\n return answer;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{ int n,a,b,i,p,q;\n scanf(\"%d%d%d\",&n,&a,&b);\n for(i=1;(a/i+b/i>=n)&&((a/i>=1)&&(b/i>=1));i++)\n {\n continue;\n\n }\n printf(\"%d\",i-1);\n\n}\n"}, {"source_code": "#include \n\n#define MIN(a, b) (a> 1;\n\n\t\tint _a = a / mid, _b = b / mid;\n\t\tif (_a + _b >= n) l = mid+1;\n\t\telse r = mid-1;\n\t}\n\tprintf(\"%d\\n\", r);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nstatic inline int min(int a, int b) { return a < b ? a : b; }\nstatic inline int max(int a, int b) { return a > b ? a : b; }\n\nint main() {\n int N,A,B; scanf(\"%d %d %d\\n\", &N, &A, &B);\n int maxv = 0;\n for(int i = 1, in = N ; i < in ; ++i) {\n const int aq = A / i, bq = B / (N-i);\n maxv = max(maxv, min(aq,bq));\n }\n printf(\"%d\\n\", maxv);\n return 0;\n}\n"}, {"source_code": "#include\n//#include\nint main()\n{\n int n,a,b,x,i;\n scanf(\"%d %d %d\",&n,&a,&b);\n x=(a+b)/n;\n if(x>a)\n x=a;\n if(x>b)\n x=b;\n while(1)\n {\n i=(a/x)+(b/x);\n if(i>=n)\n {\n printf(\"%d\\n\",x);\n return 0;\n }\n x--;\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,i1,i2,i3,i4,i5,i6=0,max1[100000],max=0;\n\tscanf(\"%d%d%d\",&n,&i1,&i2);\n\tif(i1i5)\n\t\tmax1[i6]=i5;\n\t\telse\n\t\tmax1[i6]=i3;\n\t\ti6++;\t\t\t\t\n\t}\n\tfor(i5=0;i5max)\n\t\tmax=max1[i5];\n\t}\n\tif(max==0)\n\tmax=1;\n\tprintf(\"%d\",max);\n}\n"}, {"source_code": "#include\nint maxn(int a,int b){return a>b?a:b;}\nint minn(int a,int b){return a b)\n {\n int temp = a;\n a = b;\n b = temp;\n }\n max = n>a?a:n-1;\n int t = -1;\n for(int i = max;i>=1;i--)\n {\n min = minn(a/i,b/(n-i));\n if(min > t) t = min;\n }\n printf(\"%d\\n\",t);\n}\n"}, {"source_code": "#include \n#include\nmain()\n{\nfloat n,a,b,k,x,y,z;\nscanf(\"%f %f %f\",&n,&a,&b);\ny=floorf(n*(b)/(a+b));\nz=floorf(n*(a)/(a+b));\nif(y==0) y=1;\nif(z==0) z=1;\nif(floorf((b)/y)>=floorf((a)/ceilf(n*(a)/(a+b)))) k=floorf((a)/ceilf(n*(a)/(a+b)));\nelse k=floorf((b)/y);\nif(floorf((a)/z)>=floorf((b)/ceilf(n*(b)/(a+b)))) x=floorf((b)/ceilf(n*(b)/(a+b)));\nelse x=floorf((a)/z);\nif(x\n\nint min(int x,int y)\n{\n\treturn x < y ? x : y;\n}\n\nint max(int x,int y)\n{\n\treturn x > y ? x : y;\n}\n\nint main()\n{\n\tint n,a,b;\n\tscanf(\"%d%d%d\",&n,&a,&b);\n\t\n\t int x,maxn = 1;\n\t for (int i = 1; i < n; i++)\n\t {\n\t \tx = min(a/i,b/(n-i));\n\t \tif (i*x <= a && (n-i)*x <= b)\n\t \t{\n\t \t\tmaxn = max(maxn,x);\n\t\t}\n\t }\n\t printf(\"%d\",maxn);\n\t\n\treturn 0;\n}"}, {"source_code": "#include\nint min(int a,int b)\n{\n\tif (a=1;i--)\n\t{\n\t\tif (n<=(a/i+b/i)) break;\n\t\t\n\t}\n\tprintf(\"%d\\n\",i);\n\treturn 0;\n\t\n}"}, {"source_code": "#include\n\nint main() \n{\n int a,b,n,i,j,tempa,tempb,flag=0,temp;\n scanf(\"%d %d %d\",&n,&a,&b);\n i=1;\n while(1)\n {\n tempa=a;\n tempb=b;\n j=0;\n if(((a-i)<0)||((b-i)<0))\n {\n flag=-1;\n }\n while(j=0)\n tempa=tempa-i;\n else if((tempb-i)>=0)\n tempb=tempb-i;\n else \n {\n flag=-1;\n break;\n }\n j++;\n }\n if(flag==-1)\n break;\n i++;\n }\n printf(\"%d\",i-1);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int i, j, k, temp, min;\n int n, m, a, b;\n scanf(\"%d %d %d\", &n , &a, &b);\n if(a>b)\n {\n temp=a;\n a=b;\n b=temp;\n }\n m=0;\n for(i=1; i<=n-1; i++)\n {\n j=a/i;\n k=b/(n-i);\n if(j>=1 && k>=1)\n {\n if(j\nint main()\n{\nint n,a,b;\nscanf(\"%d %d %d\",&n,&a,&b);\nint i,j,c=(a+b)/n,ans=0;\nfor(i=c;i>0;i--)\n{\nfor(j=1;j<=n-1;j++)\n{\nif(i*(n-j)<=b && i*j<=a)\n{\nans=i;\nprintf(\"%d\",ans);\nbreak;\n}\n}\nif(ans!=0)\nbreak;\n}\nreturn 0;\n}\n"}, {"source_code": "#include \n\nint min (int a, int b)\n{\n\tif (a\n\nint main(){\n int a,b,n,c,d, i = 1;\n scanf(\"%d%d%d\",&n,&a,&b);\n while(1){\n c = a/i;\n d = b/i;\n if(c+d >= n){\n i++;\n }else\n break;\n }\n i--;\n if(i > a)\n i = a;\n if(i > b)\n i = b;\n printf(\"%d\\n\",i);\n\n\n return 0;\n}\n"}, {"source_code": "#include \n\n#define MIN(a, b) (a> 1;\n\n\t\tint _a = a / mid, _b = b / mid;\n\t\tif (_a + _b >= n) l = mid+1;\n\t\telse r = mid-1;\n\t}\n\tprintf(\"%d\\n\", r);\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n#define mini(x,y) (x)<(y)?(x):(y)\n#define maxi(x,y) (x)>(y)?(x):(y)\nint main()\n{\n\tint n,a,b;\n\tscanf(\"%d %d %d\",&n,&a,&b);\n\tint i,j,k;\n\tk=1;\n\tint min=987654321,max=0;\n\tfor(i=1;i<=n-1;i++)\n\t{\n\t\tint loc1=a/i,loc2=b/(n-i);\n\t\tmax=maxi(max,mini(loc1,loc2));\n\t}\n\tprintf(\"%d\\n\",max);\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int m,n,k,q,i;\n scanf(\"%d %d %d\",&k,&m,&n);\n int max=m=1;i--)\n {\n int l=m/i+n/i;\n if(l>=k)\n {\n q=i;\n break;\n }\n }\n printf(\"%d\\n\",q);\n return 0;\n}\n"}, {"source_code": "#include \n\nint min(int a, int b)\n{\n return a max)\n\t max = min(a/i, b/(n - i));\n printf(\"%d\\n\", max);\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int n, a, b, ans = 0;\n scanf(\"%d %d %d\", &n, &a, &b);\n for(int i = 1; i <= n - 1; ++i) {\n if(a >= i && b >= n - i) {\n int cur = a / i;\n if(cur > b / (n - i)) {\n cur = b / (n - i);\n }\n if(ans < cur) {\n ans = cur;\n }\n }\n }\n printf(\"%d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include \n \nint main() \n{\n\tint n,a,b,x,y,z,i,ans;\n \n\tscanf(\"%d%d%d\", &n, &a, &b);\n\tans = 0;\n\tfor (i = 1; i< n; i++) \n\t{\n\t\t x = a / i;\n\t\t y = b / (n - i);\n\t\t z = x < y ? x : y;\n \n\t\tif (ans < z)\n\t\t\tans = z;\n\t}\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint n, a, b, s, t, i, max=0;\n\tscanf(\"%d\", &n);\n\tscanf(\"%d%d\", &a, &b);\n\tfor(i=0;it)\n\t\t\tif(t>max)\n\t\t\t\tmax = t;\n\t\tif(s<=t)\n\t\t\tif(s>max)\n\t\t\t\tmax = s;\n\t}\n\tprintf(\"%d\", max);\n\treturn 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n int n,a,b,min=0,k,c,i;\n scanf(\"%d%d%d\",&n,&a,&b);\n if(n==(a+b))\n printf(\"1\");\n else\n for(i=1;ic)\n {\n if(c>min)\n {\n min=c;\n }\n }\n else\n {\n if(k>min)\n min=k;\n }\n }\n if(min!=0)\n printf(\"%d\",min);\n return 0;\n}\n\n"}, {"source_code": "#include \n\nint main()\n{\n\tint n,a,b,i;\n\tscanf(\"%d\",&n);\n\tscanf(\"%d\",&a);\n\tscanf(\"%d\",&b);\n\tint d=0;\n\tfor(i=1;i\nint min(int x, int y)\n{\n if(x <= y) return x;\n else return y;\n}\nint main()\n{\n int n, a, b, s, l, p, i, x_max;\n scanf(\"%d %d %d\", &n, &a, &b);\n int len=n/2 -1;\n int x[len];\n if(a >= b)\n {\n l = a;\n s = b;\n }\n else\n {\n l = b;\n s = a;\n }\n for(p=1; p <= n/2; p++) x[p-1] = min(s/p, l/(n-p));\n x_max = x[0];\n for(i=1; i<= len; i++) if(x[i] >= x_max) x_max = x[i];\n printf(\"%d\\n\", x_max);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main() \n{\n int a,b,n,i,j,tempa,tempb,flag=0,temp;\n scanf(\"%d %d %d\",&n,&a,&b);\n i=1;\n while(1)\n {\n tempa=a;\n tempb=b;\n j=0;\n if(((a-i)<0)||((b-i)<0))\n {\n flag=-1;\n }\n while(j=0)\n tempa=tempa-i;\n else if((tempb-i)>=0)\n tempb=tempb-i;\n else \n {\n flag=-1;\n break;\n }\n j++;\n }\n if(flag==-1)\n break;\n i++;\n }\n printf(\"%d\",i-1);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \nint min(int a,int b)\n{\n if(ab)\n return a;\n else return b;\n\n}\nint n, a, b;\n\n int main()\n {\n scanf(\"%d%d%d\",&n,&a,&b);\n int ans = 0;\n if (n == a + b) ans = 1;\n else {\n for (int i = 1; i < n; i++)\n ans = max(ans, min(a / i, b / (n - i)));\n }\n printf(\"%d\",ans);\n\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,a,b,count=1,max,d,e;\n scanf(\"%d %d %d\",&n,&a,&b);\n max=(a+b)/n;\n while(count&&max)\n {\n d=a/max;\n e=b/max;\n if(d!=0&&e!=0)\n {\n if((d+e)>=n)\n {\n\n count=0;\n printf(\"%d\",max);\n }\n else{\n max=max-1;\n }\n }\n\n else\n {\n max=max-1;\n }\n }\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n, a, b, s, t, i, max=0;\n\tscanf(\"%d\", &n);\n\tscanf(\"%d%d\", &a, &b);\n\tfor(i=0;it)\n\t\t\tif(t>max)\n\t\t\t\tmax = t;\n\t\tif(s<=t)\n\t\t\tif(s>max)\n\t\t\t\tmax = s;\n\t}\n\tprintf(\"%d\", max);\n\treturn 0;\n}\n\n"}, {"source_code": "/* Coached by rainboy */\n#include \n\nint main() {\n\tint n, a, b, i, max;\n\n\tscanf(\"%d%d%d\", &n, &a, &b);\n\tmax = 0;\n\tfor (i = 1; i < n; i++) {\n\t\tint x, y, h;\n\n\t\tx = a / i;\n\t\ty = b / (n - i);\n\t\th = (x < y ? x : y);\n\t\tif (max < h)\n\t\t\tmax = h;\n\t}\n\tprintf(\"%d\\n\", max);\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint check(int n,int a,int b,int x){\n\n\tint i;\n\n\tif((a0){\n\t\t\tif(a<2*x)\t\n\t\t\t\ta=0;\n\t\t\telse\n\t\t\t\ta-=x;\n\t\t}\n\t\telse{\n\t\t\tif(b<2*x)\n\t\t\t\tb=0;\n\t\t\telse\n\t\t\t\tb-=x;\n\t\t}\n\t}\n\n\treturn flag;\n}\n\n\nint main(){\n\nint n,a,b;\n\nscanf(\"%d %d %d\",&n,&a,&b);\n\nint l=1;\nint r=101;\nint mid;\n\twhile(l<=r){\n\n\t\tmid=(l+r)/2;\n\t\t//if((mid==l)&&(check(n,a,b,mid)==1))\n\t\t//\tbreak;\n\n\t\tif(check(n,a,b,mid)==1)\n\t\t\tl=mid+1;\n\t\telse\n\t\t\tr=mid-1;\n\t}\n \n\tprintf(\"%d\\n\",r);\nreturn 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n\tint n, a, b, i;\n\tscanf(\"%d%d%d\", &n, &a, &b);\n\tfor (i = 100;; --i)\n\t\tif (a >= i && b >= i && a / i + b / i >= n)\n\t\t\tbreak;\n\tprintf(\"%d\", i);\n}"}, {"source_code": "#include \n#include \n#include \n#include \n#include \nint main()\n{\n int n,a,b,i=1;\n scanf(\"%d %d %d\",&n,&a,&b);\n while(i<=a && i<=b){\n if(a/i + b/i >=n){\n i++;\n }\n else break;\n }\n printf(\"%d\",i-1);\n return 0;\n}"}, {"source_code": "#include\nint min(int a,int b){\n\treturn a>b?b:a;\n}\nint main(void){\n\tint n,a,b,x,y,max,min_;\n\twhile(scanf(\"%d %d %d\",&n,&a,&b)!=EOF){\n\t\tmax=0;\n\t\tfor(int i=1;imax){\n\t\t\t\tmax=min_;\n\t\t\t}\n\t\t}\n\t\tprintf(\"%d\\n\",max);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n\nint min (int a, int b);\n\nint main(){\n\tint n,a,b,x,y,i,thiso;\n\tscanf(\"%d%d%d\",&n,&a,&b);\n\tint max = 0;\n\tfor(i=1;i<=n-1;i++){\n\t\tx = i;\n\t\ty = n-i;\n\t\tif(x!=0 &&y!=0)\n\t\t\tthiso = min(a/x, b/y);\n\t\telse if(y!=0)\n\t\t\tthiso = b/y;\n\t\telse if(x!=0)\n\t\t\tthiso = a/x;\n\t\tif(thiso>max){\n\t\t\tmax = thiso;\n\t\t}\n\t}\n\tprintf(\"%d\\n\", max);\n}\n\nint min (int a, int b){\n\tif(a>b)\n\treturn b;\n\telse\n\treturn a;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \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(ab)\n\t\treturn a;\n\telse\n\t\treturn b;\n}\nint main()\n{\n\tint i,n,a,b,ans=1;\n\tscanf(\"%d%d%d\",&n,&a,&b);\n\tfor(i=1;i\n#include\n#include\nint main()\n{\n int i,j,n,a,b;\n int C[200];\n scanf(\"%d%d%d\",&n,&a,&b);\n for(i=1;i max)\n {\n max = C[i];\n }\n }\n //printf(\"\\n\");\n printf(\"%d\\n\",max);\n return 0;\n}\n"}, {"source_code": "#include\n\nint min(int a,int b)\n{\n\treturn (ab)?(a):(b);\n}\n\nint main()\n{\n\tint n,a,b;\n\t\n\tscanf(\"%d%d%d\",&n,&a,&b);\n\n\tint i,j,k,ans=-10000000;\n\n\tfor(i=1;i\n#include\n#include\n#include\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);\nmax=f=x=y=0;\nfor(i=1;iy){\n f=y;\n }else{\n \n f=x;\n \n }\n if(f>max){\n max=f;\n }\n}\nprintf(\"%lld\",max);\nreturn 0;\n}\n"}, {"source_code": "#include \n\nstatic inline int min(int a, int b) { return a < b ? a : b; }\nstatic inline int max(int a, int b) { return a > b ? a : b; }\n\nint main() {\n int N,A,B; scanf(\"%d %d %d\\n\", &N, &A, &B);\n int maxv = 0;\n for(int i = 1, in = N ; i < in ; ++i) {\n const int aq = A / i, bq = B / (N-i);\n maxv = max(maxv, min(aq,bq));\n }\n printf(\"%d\\n\", maxv);\n return 0;\n}\n"}, {"source_code": "#include \nint n, a, b;\n\nint plates(int x)\n{\n if(!(a / x)) return 0;\n if(!(b / x)) return 0;\n return a / x + b / x;\n}\n\nint main()\n{\n int x;\n scanf(\"%d%d%d\", &n, &a, &b);\n for(x = 1; x <= a + b; ++x)\n if(plates(x) < n) break;\n printf(\"%d\\n\", x - 1);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \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(ab)\n\t\treturn a;\n\telse\n\t\treturn b;\n}\nint main()\n{\n\tint i,n,a,b,ans=1;\n\tscanf(\"%d%d%d\",&n,&a,&b);\n\tfor(i=1;i\n#include \n\nint main()\n{\n\tint a,b,n;\n\tint i,j;\n\tint max = 1;\n\tint t1,t2;\n\n\tscanf(\"%d %d %d\",&n,&a,&b);\n\n\tfor (i=1;i<=a;i++)\n\t{\n\t\tif (i+bmax) max=t1; }\n\t\telse { if (t2>max) max=t2; }\n\t}\n\tprintf(\"%d\\n\",max);\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint check(int n,int a,int b,int x){\n\n\tint i;\n\n\tif((a0){\n\t\t\tif(a<2*x)\t\n\t\t\t\ta=0;\n\t\t\telse\n\t\t\t\ta-=x;\n\t\t}\n\t\telse{\n\t\t\tif(b<2*x)\n\t\t\t\tb=0;\n\t\t\telse\n\t\t\t\tb-=x;\n\t\t}\n\t}\n\n\treturn flag;\n}\n\n\nint main(){\n\nint n,a,b;\n\nscanf(\"%d %d %d\",&n,&a,&b);\n\nint l=1;\nint r=101;\nint mid;\n\twhile(l<=r){\n\n\t\tmid=(l+r)/2;\n\t\t//if((mid==l)&&(check(n,a,b,mid)==1))\n\t\t//\tbreak;\n\n\t\tif(check(n,a,b,mid)==1)\n\t\t\tl=mid+1;\n\t\telse\n\t\t\tr=mid-1;\n\t}\n \n\tprintf(\"%d\\n\",r);\nreturn 0;\n}\n"}, {"source_code": "//KRV Template\n#include\n#include\n#include\nvoid swap(int *xp, int *yp)\n{\n int temp = *xp;\n *xp = *yp;\n *yp = temp;\n}\n//BTW l,r are indices\nvoid bubblesort(int arr[] , int l , int r)\n{\n int i,j,temp=0;\n for(int i = l ; i<=r ; i++)\n {\n \tfor(int j = l ; jarr[j+1])\n \t\t{\n \t\t\tswap(&arr[j],&arr[j+1]);\n \t\t}\n \t}\n \ttemp++;\n }\n}\nvoid rbubblesort(int arr[] , int l , int r)\n{\n int i,j,temp=0;\n for(int i = l ; i<=r ; i++)\n {\n \tfor(int j = l ; j=arr[i])\n {\n \tans = arr[i+1];\n }\n\t}\n\treturn ans;\n}\nint mininarray(int arr[] , int l , int r)\n{\n\tint ans = arr[0];\n\tfor(int i = l ; i0 ; i--)\n {\n int y = a/i ;\n int z = b/i ;\n if( y+z >= n && a>=i && b>=i)\n {\n printf(\"%d\",i);\n return 0;\n }\n }\n}"}, {"source_code": "\n#include\nint main()\n{\nint n,a,b,i,c=0,count=0,count2=0;\nint answer1=0,answer2=0;\nint x;\nscanf(\"%d %d %d\",&n,&a,&b);\nif(n==a+b)\n{\n printf(\"1\");\n}\nelse if(n=count)\n {\n answer1=count;\n break;\n }\n }\n\n if(a>=b)\n count=a;\n else count=b;\n x=count;\n for(i=1;i=count)\n {\n answer2=count;\n break;\n }\n }\n\n\n if(answer1>answer2)\n printf(\"%d\",answer1);\n else printf(\"%d\",answer2);\n\n\n}\n\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include \n\nint main()\n{\n int a,b,n,flag,ans=0,x,y;\n scanf(\"%d%d%d\",&n,&a,&b);\n for(int p=1;py)\n flag=y;\n else\n flag=x;\n \n if(flag>ans)\n ans=flag;\n }\n }\n \n printf(\"%d\",ans);\n return 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n int n, a, b, ans = 0;\n scanf(\"%d %d %d\", &n, &a, &b);\n for(int i = 1; i <= n - 1; ++i) {\n if(a >= i && b >= n - i) {\n int cur = a / i;\n if(cur > b / (n - i)) {\n cur = b / (n - i);\n }\n if(ans < cur) {\n ans = cur;\n }\n }\n }\n printf(\"%d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include \nint m(int a,int b,int k)\n{\n int ar[3];\n ar[0]=a;\n ar[1]=b;\n ar[2]=k;\n \n \n int min=a;\n \n int i;\n \n for(i=0;i<3;i++)\n {\n if(ar[i]0;i--)\n{\n if(((a/i)+(b/i))>=n)\n {\n printf(\"%d\",i);\n break;\n \n \n }\n \n \n}\n\n\n\n\n\n\n\treturn 0;\n}"}, {"source_code": "#include\nint maxn(int a,int b){return a>b?a:b;}\nint minn(int a,int b){return a b)\n {\n int temp = a;\n a = b;\n b = temp;\n }\n max = n>a?a:n-1;\n int t = -1;\n for(int i = max;i>=1;i--)\n {\n min = minn(a/i,b/(n-i));\n if(min > t) t = min;\n }\n printf(\"%d\\n\",t);\n}\n"}, {"source_code": "#include\nint main(int argc, char const *argv[])\n{\n\tint n,x,y;\n\tscanf(\"%d\",&n);\n\tscanf(\"%d\",&x);\n\tscanf(\"%d\",&y);\n\tint max = 0,val;\n\tfor(int i = 1;i y/(n-i))\n\t\t\tval = y/(n-i);\n\t\tif(max\n\nint main(){\n int a,b,n,c,d, i = 1;\n scanf(\"%d%d%d\",&n,&a,&b);\n while(1){\n c = a/i;\n d = b/i;\n if(c+d >= n){\n i++;\n }else\n break;\n }\n i--;\n if(i > a)\n i = a;\n if(i > b)\n i = b;\n printf(\"%d\\n\",i);\n\n\n return 0;\n}\n"}, {"source_code": "#include \nint m(int a,int b,int k)\n{\n int ar[3];\n ar[0]=a;\n ar[1]=b;\n ar[2]=k;\n \n \n int min=a;\n \n int i;\n \n for(i=0;i<3;i++)\n {\n if(ar[i]0;i--)\n{\n if(((a/i)+(b/i))>=n)\n {\n printf(\"%d\",i);\n break;\n \n \n }\n \n \n}\n\n\n\n\n\n\n\treturn 0;\n}"}, {"source_code": "#include\n\nint main() \n{\n int a,b,n,i,j,tempa,tempb,flag=0,temp;\n scanf(\"%d %d %d\",&n,&a,&b);\n i=1;\n while(1)\n {\n tempa=a;\n tempb=b;\n j=0;\n if(((a-i)<0)||((b-i)<0))\n {\n flag=-1;\n }\n while(j=0)\n tempa=tempa-i;\n else if((tempb-i)>=0)\n tempb=tempb-i;\n else \n {\n flag=-1;\n break;\n }\n j++;\n }\n if(flag==-1)\n break;\n i++;\n }\n printf(\"%d\",i-1);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(int argc, char** argv) {\n int i, n, m, a, b;\n \n scanf(\"%d%d%d\", &n, &a, &b);\n for (i = 1000; i; i--) {\n m = a / i + b / i;\n if (m >= n && i <= a && i <= b) {\n printf(\"%d\\n\", i);\n break;\n }\n }\n \n return 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n\tint n, a, b;\n\tint x;\n\n\tscanf(\"%d %d %d\", &n, &a, &b);\n\n\tfor (x = 1; x <= a && x <= b && (a / x + b / x >= n); ++x);\n\tprintf(\"%d\", x - 1);\n\n}\n"}, {"source_code": "#include \nint n, a, b;\n\nint plates(int x)\n{\n if(!(a / x)) return 0;\n if(!(b / x)) return 0;\n return a / x + b / x;\n}\n\nint main()\n{\n int x;\n scanf(\"%d%d%d\", &n, &a, &b);\n for(x = 1; x <= a + b; ++x)\n if(plates(x) < n) break;\n printf(\"%d\\n\", x - 1);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(int argc, char** argv) {\n int i, n, m, a, b;\n \n scanf(\"%d%d%d\", &n, &a, &b);\n for (i = 1000; i; i--) {\n m = a / i + b / i;\n if (m >= n && i <= a && i <= b) {\n printf(\"%d\\n\", i);\n break;\n }\n }\n \n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int m,n,k,q,i;\n scanf(\"%d %d %d\",&k,&m,&n);\n int max=m=1;i--)\n {\n int l=m/i+n/i;\n if(l>=k)\n {\n q=i;\n break;\n }\n }\n printf(\"%d\\n\",q);\n return 0;\n}\n"}, {"source_code": "#include \n#define max(a,b) a>=b ? a : b\n#define min(a,b) a>=b ? b : a\nint main()\n{\n\tint n,a,b;\n\tscanf(\"%d %d %d\",&n,&a,&b);\n\tint i,c,d=0;\n\tfor(i=1;i\nint min(int a,int b){\n\treturn a>b?b:a;\n}\nint max(int a,int b){\n\treturn a\n\nstatic inline int min(int a, int b) { return a < b ? a : b; }\nstatic inline int max(int a, int b) { return a > b ? a : b; }\n\nint main() {\n int N,A,B; scanf(\"%d %d %d\\n\", &N, &A, &B);\n int maxv = 0;\n for(int i = 1, in = N ; i < in ; ++i) {\n const int aq = A / i, bq = B / (N-i);\n maxv = max(maxv, min(aq,bq));\n }\n printf(\"%d\\n\", maxv);\n return 0;\n}\n"}, {"source_code": "#include \n#include\nmain()\n{\nfloat n,a,b,k,x,y,z;\nscanf(\"%f %f %f\",&n,&a,&b);\ny=floorf(n*(b)/(a+b));\nz=floorf(n*(a)/(a+b));\nif(y==0) y=1;\nif(z==0) z=1;\nif(floorf((b)/y)>=floorf((a)/ceilf(n*(a)/(a+b)))) k=floorf((a)/ceilf(n*(a)/(a+b)));\nelse k=floorf((b)/y);\nif(floorf((a)/z)>=floorf((b)/ceilf(n*(b)/(a+b)))) x=floorf((b)/ceilf(n*(b)/(a+b)));\nelse x=floorf((a)/z);\nif(x\n#include \n\nint main(){\n int n,a,b,max = 0, r = 0;\n scanf(\"%d %d %d\", &n,&a,&b);\n for(int i = 1; i < n; i++){\n if ((a/i) < (b/(n-i))) r = (a/i);\n else r = (b/(n-i));\n if ( r > max || max == 0)\n max = r;\n }\n printf(\"%d\", max);\n return 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{ \n int n,a,b,p,q,i,min,max=0;\n scanf(\"%d %d %d\",&n,&a,&b);\n for(i=1;i<=n-1;i++)\n {\n p=a/i; q= b/(n-i);\n if(pmax)\n { max=min;}\n }\n \n printf(\"%d\",max);\n return 0;\n}\n "}, {"source_code": "#include\n#include\n#include\n\nint min(double a,double b){\n if(amax){\n max=m;\n }\n }max=(int)floor(max);\n printf(\"%d\",max);\n \n \n \n}"}, {"source_code": "#include\n\n\n\nint main(){\nint n,a,b;\nscanf(\"%d%d%d\",&n,&a,&b);\nint i;\nint x=(a>b/(n-1))?b/(n-1):a;\nfor(i=2;ia2)?a2:a1;\nif(m>x){\nx=m;\n}\n\n}\n\nprintf(\"%d\",x);\nreturn 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n\tint n, a, b, m, ans;\n\n\tscanf(\"%d%d%d\", &n, &a, &b);\n\tans = 0;\n\tfor (m = 1; m < n; m++) {\n\t\tint x = a / m;\n\t\tint y = b / (n - m);\n\t\tint z = x < y ? x : y;\n\n\t\tif (ans < z)\n\t\t\tans = z;\n\t}\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nunsigned min(unsigned a, unsigned b) {\n\treturn a < b ? a : b;\n}\n\nint main(int argc, char* argv[]) {\n\tunsigned n, a, b, t, x, y;\n\n\tscanf(\"%d %d %d\", &n, &a, &b);\n\n\tt = a + b;\n\tx = (int)(((float)a / t) * n);\n\ty = n - x;\n\n\tif (x == 0 || (y > 1 && a%t != 0 && min(a/(x+1), b/(y-1)) > min(a/x, b/y))) {\n\t\tx++;\n\t\ty--;\n\t}\n\n\tif (a/x < b/y)\n\t\tprintf(\"%d\", a / x);\n\telse\n\t\tprintf(\"%d\", b / y);\n\n\treturn 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n\tint n, a, b, i;\n\tscanf(\"%d%d%d\", &n, &a, &b);\n\tfor (i = 100;; --i)\n\t\tif (a >= i && b >= i && a / i + b / i >= n)\n\t\t\tbreak;\n\tprintf(\"%d\", i);\n}"}, {"source_code": "#include \"stdio.h\"\n\nint main()\n{\n\tint a,b,n,i,j,min,rmin=0;\n\tscanf(\"%d%d%d\",&n,&a,&b);\n\tfor (i=1;i<=n-1;i++){\n\t\tmin=(a/i)<(b/(n-i))?(a/i):(b/(n-i));\n\t\trmin=rmin>min?rmin:min;\n\t}\n\tprintf(\"%d\\n\",rmin);\n\treturn 0;\n}"}, {"source_code": "#include \n#include\n#include\n#define swap(a, b) do { tmp = a; a = b; b = tmp; } while (0)\n#define min(a,b) (((a)<(b))?(a):(b))\n#define max(a,b) (((a)>(b))?(a):(b))\nint main()\n{\n\n\n int i,j,k,tmp;\n int n,m;\n int a,b;\n\n scanf(\"%d%d%d\",&n,&a,&b);\n\n if(a>b)\n swap(a,b);\n\n m=0;\n for(i=1;i<=n-1;i++)\n {\n j=a/i;\n k=b/(n-i);\n\n if(j>=1 && k>=1)\n m=max(m,min(j,k));\n }\n\n printf(\"%d\",m);\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint min(int a, int b)\n{\n return a max)\n\t max = min(a/i, b/(n - i));\n printf(\"%d\\n\", max);\n}\n"}, {"source_code": "#include \n#include \n#include \nint min(int a,int b)\n{\n if(ab)\n return a;\n else return b;\n\n}\nint n, a, b;\n\n int main()\n {\n scanf(\"%d%d%d\",&n,&a,&b);\n int ans = 0;\n if (n == a + b) ans = 1;\n else {\n for (int i = 1; i < n; i++)\n ans = max(ans, min(a / i, b / (n - i)));\n }\n printf(\"%d\",ans);\n\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n, a, b, s, t, i, max=0;\n\tscanf(\"%d\", &n);\n\tscanf(\"%d%d\", &a, &b);\n\tfor(i=0;it)\n\t\t\tif(t>max)\n\t\t\t\tmax = t;\n\t\tif(s<=t)\n\t\t\tif(s>max)\n\t\t\t\tmax = s;\n\t}\n\tprintf(\"%d\", max);\n\treturn 0;\n}\n\n"}, {"source_code": "#include\n#include\n#include\nint n, a, b, max;\n\nint minOf(int x, int y);\n\nint main() {\n scanf(\"%d %d %d\", &n, &a, &b);\n \n max = minOf(a/1, b/(n-1));\n int curr;\n for(int ca=2; ca max)\n max = curr;\n } \n\n printf(\"%d\\n\", max);\nreturn 0;\n}\n\nint minOf(int x, int y) {\n if(x\n#include \n\nint main()\n{\n unsigned short n, a, b;\n fscanf( stdin , \"%hu %hu %hu\" , &n , &a , &b );\n\n unsigned short x = 1;\n unsigned short y = 1;\n\n for(int i = 1;i < (n + 1) / 2;i++)\n {\n y = a / i < b / (n - i) ? a / i : b / (n - i);\n if(x < y)\n x = y;\n }\n printf(\"%hu\\n\" , x );\n\n return 0;\n}\n"}, {"source_code": "/*\nB. Two Cakes\n\ntime limit per test: 1 second\nmemory limit per test: 256 megabytes\ninput: standard input\noutput: standard output\nIt's New Year's Eve soon, so Ivan decided it's high time he started setting the table. Ivan has bought two cakes and cut them into pieces: the first cake has been cut into a pieces, and the second one — into b pieces.\n\nIvan knows that there will be n people at the celebration (including himself), so Ivan has set n plates for the cakes. Now he is thinking about how to distribute the cakes between the plates. Ivan wants to do it in such a way that all following conditions are met:\n\nEach piece of each cake is put on some plate;\nEach plate contains at least one piece of cake;\nNo plate contains pieces of both cakes.\nTo make his guests happy, Ivan wants to distribute the cakes in such a way that the minimum number of pieces on the plate is maximized. Formally, Ivan wants to know the maximum possible number x such that he can distribute the cakes according to the aforementioned conditions, and each plate will contain at least x pieces of cake.\n\nHelp Ivan to calculate this number x!\n\nInput\nThe first line contains three integers n, a and b (1 ≤ a, b ≤ 100, 2 ≤ n ≤ a + b) — the number of plates, the number of pieces of the first cake, and the number of pieces of the second cake, respectively.\n\nOutput\nPrint the maximum possible number x such that Ivan can distribute the cake in such a way that each plate will contain at least x pieces of cake.\n*/\n/*\nExamples\n\ninput\n5 2 3\noutput\n1\n\ninput\n4 7 10\noutput\n3\n\nNote\nIn the first example there is only one way to distribute cakes to plates, all of them will have 1 cake on it.\n\nIn the second example you can have two plates with 3 and 4 pieces of the first cake and two plates both with 5 pieces of the second cake. Minimal number of pieces is 3.\n*/\n\n#include \n#include \n\nint max(int, int);\nint min(int, int);\n\nint main()\n{\n\tint n, a, b;\n\tscanf(\"%d%d%d\", &n, &a, &b);\n\t\n\tint x = min(a / n - 1, b);\n\tfor(int i = n - 2; i > 0; i--)\n\t{\n\t\tx = max(x, min(a / i, b / (n - i)));\n\t}\n\t\n\tprintf(\"%d\\n\", x);\n}\n\nint max(int a, int b)\n{\n\treturn (a + b + abs(a - b)) / 2;\n}\n\nint min(int a, int b)\n{\n\treturn (a + b - abs(a - b)) / 2;\n}\n\n"}, {"source_code": "#include\nint min1[105],min[5];\nint main()\n{\n\tint n,a,b;\n\tscanf(\"%d%d%d\",&n,&a,&b);\n\tint i,j,quo,m,l=0,k,ans;\n\tfor(i=1;i<=a;i++)\n\t{\n\t\tfor(j=i;j<=b;j++)\n\t\t{\n\t\t\tquo=(a/i)+(b/j);\n//\t\t\tprintf(\"%d \",quo);\n\t\t\tif(quo>=n)\n\t\t\t{\n\t\t\t\tmin[0]=i;\n\t\t\t\tmin[1]=j;\n\t\t\t\tmin[2]=a/i+a%i;\n\t\t\t\tmin[3]=b/j+b%j;\n\t\t\t\tm=min[0];\n\t\t\t\tfor(k=0;k<4;k++)\n\t\t\t\t{\n\t\t\t\t\tif(m>min[k])\n\t\t\t\t\t\tm=min[k];\n\t\t\t\t}\n\t\t\t\tif(m!=0)\n\t\t\t\tmin1[l++]=m;\n\t\t\t}\n\t\t}\n\t}//printf(\"\\n\");\n\tans=min1[0];\n\tfor(i=0;i\nint main()\n{\n\tint c,d,i,k,n,a,b;\n\tscanf(\"%d%d%d\",&n,&a,&b);\n\tk=(a+b)/n+1;\n\tfor (i=k;i>=1;i--)\n\t{\n\t\tif (n<=(a/i+b/i)) break;\n\t\t\n\t}\n\tprintf(\"%d\\n\",i);\n\treturn 0;\n\t\n}"}, {"source_code": "#include \n\nint main(){\n int a,b,n,c,d, i = 1;\n scanf(\"%d%d%d\",&n,&a,&b);\n while(1){\n c = a/i;\n d = b/i;\n if(c+d >= n){\n i++;\n }else\n break;\n }\n i--;\n printf(\"%d\\n\",i);\n\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\nint n,a,b,i,c=0,count=0;\nint x;\nscanf(\"%d %d %d\",&n,&a,&b);\nif(n==a+b)\n{\n printf(\"1\");\n}\nelse if(na+b)\n {\n c=c-1;\n }\n\n printf(\"%d\",c);\n }\n else if(a>=n && b>=n)\n {\n c=i/(n/2);\n printf(\"%d\",c);\n\n }\n\n}\n\n\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,a,b,temp,max;\n scanf(\"%d%d%d\",&n,&a,&b);\n if(a > b)\n {\n temp = a;\n a = b;\n b = temp;\n }\n max = (a + b)/n;\n if(max == 0) printf(\"0\\n\");\n else if(max == 1) printf(\"1\\n\");\n else\n {\n int k = 1,i = max;\n while(i>=1)\n {\n k = (a/i)+(b/i);\n if(k <= n) break;\n i--;\n }\n if(i > a)\n printf(\"%d\\n\",a);\n else\n printf(\"%d\\n\",i);\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{ int n,a,b,i,p,q;\n scanf(\"%d%d%d\",&n,&a,&b);\n for(i=1;i<=a+b;i++)\n {\n p=a/i;\n q=b/i;\n\n if((p+q=1&&q>=1))\n {\n break;\n }\n else{\n continue;\n }\n\n\n }\n printf(\"%d\",i-1);\n\n}\n"}, {"source_code": "#include \n#include\nmain()\n{\nfloat n,a,b,k,x;\nscanf(\"%f %f %f\",&n,&a,&b);\nif(floorf((a)/ceilf(n*(a)/(a+b)))>floorf((b)/floorf(n*(b)/(a+b)))) k=floorf((b)/floorf(n*(b)/(a+b)));\nelse k=floorf((a)/ceilf(n*(a)/(a+b)));\nif(floorf((b)/ceilf(n*(b)/(a+b)))>floorf((a)/floorf(n*(a)/(a+b)))) x=floorf((a)/floorf(n*(a)/(a+b)));\nelse x=floorf((b)/ceilf(n*(b)/(a+b)));\nif(x\n#include\n#include\n#include\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);\nmax=0;\nfor(i=1;if){\n f=x;\n }else{\n if(y>f){\n f=y;\n }\n }\n if(f>max){\n max=f;\n }\n}\nprintf(\"%lld\",max);\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\nint n,a,b,c,count=0;\nint x;\nscanf(\"%d %d %d\",&n,&a,&b);\nif(n=a+b)\n{\n printf(\"1\");\n}\nelse if(n\nint main()\n{\n\tint n,i1,i2,i3,i4,i5,i6=0,max1[100000],max=0;\n\tscanf(\"%d%d%d\",&n,&i1,&i2);\n\tif(i1i5)\n\t\tmax1[i6]=i5;\n\t\telse\n\t\tmax1[i6]=i3;\n\t\ti6++;\t\t\t\t\n\t}\n\tfor(i5=0;i5max)\n\t\tmax=max1[i5];\n\t}\n\tif(max==0)\n\tmax=1;\n\tprintf(\"%d\",max);\n}\n"}, {"source_code": "#include\nint min1[105],min[5];\nint main()\n{\n\tint n,a,b;\n\tscanf(\"%d%d%d\",&n,&a,&b);\n\tint i,j,quo,m,l=0,k,ans;\n\tfor(i=1;i<=a;i++)\n\t{\n\t\tfor(j=i;j<=b;j++)\n\t\t{\n\t\t\tquo=(a/i)+(b/j);\n//\t\t\tprintf(\"%d \",quo);\n\t\t\tif(quo>=n)\n\t\t\t{\n\t\t\t\tmin[0]=i;\n\t\t\t\tmin[1]=j;\n\t\t\t\tmin[2]=a/i+a%i;\n\t\t\t\tmin[3]=b/j+b%j;\n\t\t\t\tm=min[0];\n\t\t\t\tfor(k=0;k<4;k++)\n\t\t\t\t{\n\t\t\t\t\tif(m>min[k])\n\t\t\t\t\t\tm=min[k];\n\t\t\t\t}\n\t\t\t\tif(m!=0)\n\t\t\t\tmin1[l++]=m;\n\t\t\t}\n\t\t}\n\t}//printf(\"\\n\");\n\tans=min1[0];\n\tfor(i=0;i\nint main()\n{\n\tint c,d,i,k,n,a,b;\n\tscanf(\"%d%d%d\",&n,&a,&b);\n\tk=(a+b)/n;\n\tfor (i=k;i>=1;i--)\n\t{\n\t\tif (n<=(a/i+b/i)) break;\n\t\t\n\t}\n\tprintf(\"%d\\n\",i);\n\treturn 0;\n\t\n}"}, {"source_code": "#include \n\nint\nmain()\n{\n int a, b, n;\n scanf(\"%d%d%d\", &n, &a, &b);\n int i = 1;\n while (a / i + b / i >= n) ++i;\n printf(\"%d\\n\", i - 1);\n return 0;\n}\n"}, {"source_code": "//\n// main.c\n// Two Cakes\n//\n// Created by Eric Ying on 12/29/17.\n// Copyright © 2017 Eric Ying. All rights reserved.\n//\n\n#include \n#include \n\nbool too_high(int n, int a, int b, int c){\n if(n!=0 && c>a && c>b){\n return true;\n }\n else if(n==0){\n return false;\n }\n else if(c>a){\n return too_high(n-1, a, b-c, c);\n }\n else{\n return too_high(n-1, a-c, b, c);\n }\n}\n\nbool too_low(int n, int a, int b, int c){\n if(n==0 && (ca){\n return too_low(n-1, a, b-c, c);\n }\n else{\n return too_low(n-1, a-c, b, c);\n }\n}\n\nint main(int argc, const char * argv[]) {\n // insert code here...\n int n, a, b;\n scanf(\"%d\", &n);\n scanf(\"%d\", &a);\n scanf(\"%d\", &b);\n \n \n if(a > b){\n int temp = b;\n b = a;\n a = temp;\n }\n \n int low = 1;\n int high = (a + b)/n;\n int mid = (high + low)/2;\n \n while(too_high(n, a, b, mid) || too_low(n, a, b, mid) || mid>a){\n if(too_high(n, a, b, mid) || mid>a){\n high = mid-1;\n }\n else if(too_low(n, a, b, mid)){\n low = mid+1;\n }\n mid = (high+low)/2;\n \n if(mid == low || mid == high){\n break;\n }\n }\n printf(\"%d\\n\", mid);\n \n return 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\nint n,a,b,i,c=0,count=0;\nint x;\nscanf(\"%d %d %d\",&n,&a,&b);\nif(n==a+b)\n{\n printf(\"1\");\n}\nelse if(na+b)\n {\n c=c-1;\n }\n\n printf(\"%d\",c);\n }\n else if(a>n && b>n)\n {\n c=i/(n/2);\n printf(\"%d\",c);\n\n }\n\n}\n\n\n\n}\n"}, {"source_code": "/*\nB. Two Cakes\n\ntime limit per test: 1 second\nmemory limit per test: 256 megabytes\ninput: standard input\noutput: standard output\nIt's New Year's Eve soon, so Ivan decided it's high time he started setting the table. Ivan has bought two cakes and cut them into pieces: the first cake has been cut into a pieces, and the second one — into b pieces.\n\nIvan knows that there will be n people at the celebration (including himself), so Ivan has set n plates for the cakes. Now he is thinking about how to distribute the cakes between the plates. Ivan wants to do it in such a way that all following conditions are met:\n\nEach piece of each cake is put on some plate;\nEach plate contains at least one piece of cake;\nNo plate contains pieces of both cakes.\nTo make his guests happy, Ivan wants to distribute the cakes in such a way that the minimum number of pieces on the plate is maximized. Formally, Ivan wants to know the maximum possible number x such that he can distribute the cakes according to the aforementioned conditions, and each plate will contain at least x pieces of cake.\n\nHelp Ivan to calculate this number x!\n\nInput\nThe first line contains three integers n, a and b (1 ≤ a, b ≤ 100, 2 ≤ n ≤ a + b) — the number of plates, the number of pieces of the first cake, and the number of pieces of the second cake, respectively.\n\nOutput\nPrint the maximum possible number x such that Ivan can distribute the cake in such a way that each plate will contain at least x pieces of cake.\n*/\n/*\nExamples\n\ninput\n5 2 3\noutput\n1\n\ninput\n4 7 10\noutput\n3\n\nNote\nIn the first example there is only one way to distribute cakes to plates, all of them will have 1 cake on it.\n\nIn the second example you can have two plates with 3 and 4 pieces of the first cake and two plates both with 5 pieces of the second cake. Minimal number of pieces is 3.\n*/\n\n#include \n#include \n\nint max(int, int);\nint min(int, int);\n\nint main()\n{\n\tint n, a, b;\n\tscanf(\"%d%d%d\", &n, &a, &b);\n\t\n\tint x = min(a / (n - 1), b);\n\tfor(int i = n - 2; i > 0; i--)\n\t{\n\t\tx = max(x, min(a / i, b / (n - i)));\n\t}\n\t\n\tprintf(\"%d\\n\", 9 / 1);\n\tprintf(\"%d\\n\", x);\n}\n\nint max(int a, int b)\n{\n\treturn (a + b + abs(a - b)) / 2;\n}\n\nint min(int a, int b)\n{\n\treturn (a + b - abs(a - b)) / 2;\n}\n\n"}, {"source_code": "#include\nint main()\n{\nint n,a,b,c,count=0;\nint x;\nscanf(\"%d %d %d\",&n,&a,&b);\nc=a+b;\n\nif(a>n && b>n)\n{\n if(a>b)\n count=b/n;\n else count=a/n;\n}\nelse if(n>a && n>b)\n{\n if(a>b)\n count=n/a;\n else count=n/b;\n}\nelse count=(a+b)/n;\n\nprintf(\"%d\",count);\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n,a,b;\n int z;\n scanf(\"%d \",&n);\n scanf(\"%d \",&a);\n scanf(\"%d \",&b);\n\n\n if((a+b)==n) printf(\"1\");\n else{\n z=((a+b)/n);\n while(a>=z && b>=z){\n a=a-z;\n b=b-z;\n }\n\n if(a>b) printf(\"%d\",b);\n else printf(\"%d\",a);\n\n }\n return 0;\n}\n"}, {"source_code": "\n#include\nint main()\n{\nint n,a,b,i,c=0,count=0;\nint x;\nscanf(\"%d %d %d\",&n,&a,&b);\nif(n==a+b)\n{\n printf(\"1\");\n}\nelse if(n=count)\n {\n printf(\"%d\",count);\n break;\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 \n#include \n\nint main()\n{ int n,a,b,i,p,q;\n scanf(\"%d%d%d\",&n,&a,&b);\n for(i=1;i<=a+b;i++)\n {\n p=a/i;\n q=b/i;\n\n if((p+q=1&&q>=1))\n {\n break;\n }\n else{\n continue;\n }\n\n\n }\n printf(\"%d\",i-1);\n\n}\n"}, {"source_code": "/*\nB. Two Cakes\n\ntime limit per test: 1 second\nmemory limit per test: 256 megabytes\ninput: standard input\noutput: standard output\nIt's New Year's Eve soon, so Ivan decided it's high time he started setting the table. Ivan has bought two cakes and cut them into pieces: the first cake has been cut into a pieces, and the second one — into b pieces.\n\nIvan knows that there will be n people at the celebration (including himself), so Ivan has set n plates for the cakes. Now he is thinking about how to distribute the cakes between the plates. Ivan wants to do it in such a way that all following conditions are met:\n\nEach piece of each cake is put on some plate;\nEach plate contains at least one piece of cake;\nNo plate contains pieces of both cakes.\nTo make his guests happy, Ivan wants to distribute the cakes in such a way that the minimum number of pieces on the plate is maximized. Formally, Ivan wants to know the maximum possible number x such that he can distribute the cakes according to the aforementioned conditions, and each plate will contain at least x pieces of cake.\n\nHelp Ivan to calculate this number x!\n\nInput\nThe first line contains three integers n, a and b (1 ≤ a, b ≤ 100, 2 ≤ n ≤ a + b) — the number of plates, the number of pieces of the first cake, and the number of pieces of the second cake, respectively.\n\nOutput\nPrint the maximum possible number x such that Ivan can distribute the cake in such a way that each plate will contain at least x pieces of cake.\n*/\n/*\nExamples\n\ninput\n5 2 3\noutput\n1\n\ninput\n4 7 10\noutput\n3\n\nNote\nIn the first example there is only one way to distribute cakes to plates, all of them will have 1 cake on it.\n\nIn the second example you can have two plates with 3 and 4 pieces of the first cake and two plates both with 5 pieces of the second cake. Minimal number of pieces is 3.\n*/\n\n#include \n#include \n\nint max(int, int);\nint min(int, int);\n\nint main()\n{\n\tint n, a, b;\n\tscanf(\"%d%d%d\", &n, &a, &b);\n\t\n\tint x = min(a / (n - 1), b);\n\tfor(int i = n - 2; i > 0; i--)\n\t{\n\t\tx = max(x, min(a / i, b / (n - i)));\n\t}\n\t\n\tprintf(\"%d\\n\", 9 / 1);\n\tprintf(\"%d\\n\", x);\n}\n\nint max(int a, int b)\n{\n\treturn (a + b + abs(a - b)) / 2;\n}\n\nint min(int a, int b)\n{\n\treturn (a + b - abs(a - b)) / 2;\n}\n\n"}, {"source_code": "#include \n\nint main()\n{\n\tint n,a,b;\n\tscanf(\"%d%d%d\",&n,&a,&b);\n\t\n\t//int miny = a < b ? a : b;\n\tint maxn = 0;\n\tint sum = 0;\n\tint temp,tempa,tempb;\n\tfor (int i = 1; i <= a; i++)\n\t{\n\t\tfor (int j = 1; j <= b; j++)\n\t\t{\n\t\t\tsum = a / i + b / j;\n\t\t\ttempa = a % i;\n\t\t\ttempb = b % j;\n\t\t\tif (tempa != 0) sum += 1;\n\t\t\tif (tempb != 0) sum += 1;\n\t\t\t\n\t\t\tif (tempa == 0) tempa = 2000;\n\t\t\tif (tempb == 0) tempb = 2000; \n\t\t\t\n\t\t\tif (sum < n) break;\n\t\t\tif (sum > n) continue;\n\t\t\t\n\t\t\t//printf(\"i = %d; j = %d; sum = %d\\n\",i,j,sum);\n\t\t\tif (sum == n)\n\t\t\t{\n\t\t\t\ttemp = i < j ? i : j;\n\t\t\t\ttemp = temp < tempa ? temp : tempa;\n\t\t\t\ttemp = temp < tempb ? temp : tempb;\n\t\t\t\tif (temp > maxn) maxn = temp;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tprintf(\"%d\\n\",maxn);\n\treturn 0;\n}"}, {"source_code": "#include \n#define min(a,b) (a\n#include\n#include\n#include\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);\nmax=0;\nfor(i=1;if){\n f=x;\n }else{\n if(y>f){\n f=y;\n }\n }\n if(f>max){\n max=f;\n }\n}\nprintf(\"%lld\",max);\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{int a,b,c,d,e,f,min,max,m;\nwhile(scanf(\"%d%d%d\",&a,&b,&c)!=EOF)\n{\nmin=b>c?c:b;\nmax=b>c?b:c;\nb=min;\nwhile(1)\n{m=0;\nif (b==2)\n{b--;continue;}\nm=min/b;\n\nif (b*(a-m)\n\nint main(){\n\n int n, a, b;\n scanf(\"%d %d %d\", &n, &a, &b);\n\n if(n == a + b){\n printf(\"%d\\n\", 1);\n return 0;\n }\n\n\n int z = (float)(n * a)/(a + b) + .5;\n\n if(z == 0)\n z = 1;\n\n if(z >= n){\n z = n - 1;\n }\n\n int answer;\n if(a/z <= b/(n - z))\n answer = a/z;\n else\n answer = b/(n - z);\n\n printf(\"%d\\n\", answer);\n}\n"}, {"source_code": "#include \nint main()\n{\n\tint n,a,b;\n\tscanf(\"%d%d%d\",&n,&a,&b);\n\tint num=0,min=0;\n\tint i,j;\n\tint numa, numb;\n\tint temp;\n\tfor(i=1;imin)\n\t\t\t{\n\t\t\t\tmin=temp;\n\t\t\t}\n\t}\n\tif(a/n>min)\n\t\tmin=a/n;\n\tif(b/n>min)\n\t\tmin=b/n;\n\tprintf(\"%d\\n\",min);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\nint n,a,b,i,c=0,count=0;\nint x;\nscanf(\"%d %d %d\",&n,&a,&b);\nif(n==a+b)\n{\n printf(\"1\");\n}\nelse if(na+b)\n {\n c=c-1;\n }\n\n printf(\"%d\",c);\n }\n else if(a>=n && b>=n)\n {\n c=i/(n/2);\n printf(\"%d\",c);\n\n }\n\n}\n\n\n\n}\n"}, {"source_code": "#include \n#include \n\nint main(){\n int n,a,b,r;\n scanf(\"%d %d %d\", &n,&a,&b);\n r = (a+b)/n;\n if((a-r) < (b-r) && r >= (a-r))\n printf(\"%d\", a-r);\n else if((a-r) > (b-r) && r >= (a-r))\n printf(\"%d\", b-r);\n else\n printf(\"%d\", r);\n return 0;\n}"}, {"source_code": "#include \n\nint min (int a, int b);\n\nint main(){\n\tint n,a,b,x,y,i,thiso;\n\tscanf(\"%d%d%d\",&n,&a,&b);\n\tint max = 0;\n\tfor(i=0;i<=n;i++){\n\t\tx = i;\n\t\ty = n-i;\n\t\tif(x!=0 &&y!=0)\n\t\t\tthiso = min(a/x, b/y);\n\t\telse if(y!=0)\n\t\t\tthiso = b/y;\n\t\telse if(x!=0)\n\t\t\tthiso = a/x;\n\t\tif(thiso>max){\n\t\t\tmax = thiso;\n\t\t}\n\t}\n\tprintf(\"%d\", max);\n}\n\nint min (int a, int b){\n\tif(a>b)\n\treturn b;\n\telse\n\treturn a;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n\tint n, a, b;\n\twhile (~scanf(\"%d %d %d\", &n, &a, &b))\n\t{\n\t\tint t;\n\t\tif (a > b) t = a, a = b, b = a;\n\t\tif (n - 2 >= a)\n\t\t{\n\t\t\tprintf(\"1\\n\");\n\t\t\tcontinue;\n\t\t}\n\t\tif (n == 3)\n\t\t\tprintf(\"%d\\n\", (a + b) / 3);\n\t\telse if(n%2==0)\n\t\t\tprintf(\"%d\\n\", a / (n /2));\n\t\telse\n\t\t\tprintf(\"%d\\n\", a / ((n / 2)+1));\n\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\nint n,a,b,i,c=0,count=0;\nint x;\nscanf(\"%d %d %d\",&n,&a,&b);\nif(n==a+b)\n{\n printf(\"1\");\n}\nelse if(na+b)\n {\n c=c-1;\n }\n\n printf(\"%d\",c);\n }\n else if(a>=n && b>=n)\n {\n c=i/(n/2);\n printf(\"%d\",c);\n\n }\n\n}\n\n\n\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,a,b;\n\tscanf(\"%d%d%d\",&n,&a,&b);\n\tint max,max1;\n\tif(n==1)\n\t{\n\t\tif(a>b)\n\t\t\tprintf(\"%d\",b);\n\t\telse\n\t\t\tprintf(\"%d\",a);\n\t\treturn 0;\n\t}\n\tmax=a/(n/2);\n\tmax1=b/(n/2);\n\tif(max>max1)\n\t\tprintf(\"%d \",max1);\n\telse\n\t\tprintf(\"%d \",max);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tint n,a,b;\n\tscanf(\"%d%d%d\",&n,&a,&b);\n\t\n\tint miny = a < b ? a : b;\n\tint maxn = 0;\n\tint sum = 0;\n\tint temp,tempa,tempb;\n\tfor (int i = 1; i <= miny; i++)\n\t{\n\t\tfor (int j = 1; j <= miny; j++)\n\t\t{\n\t\t\tsum = a / i + b / j;\n\t\t\ttempa = a % i;\n\t\t\ttempb = b % j;\n\t\t\tif (tempa != 0) sum += 1;\n\t\t\tif (tempb != 0) sum += 1;\n\t\t\t\n\t\t\tif (tempa == 0) tempa = 2000;\n\t\t\tif (tempb == 0) tempb = 2000; \n\t\t\t\n\t\t\tif (sum < n) break;\n\t\t\tif (sum > n) continue;\n\t\t\t\n\t\t\t//printf(\"i = %d; j = %d; sum = %d\\n\",i,j,sum);\n\t\t\tif (sum == n)\n\t\t\t{\n\t\t\t\ttemp = i < j ? i : j;\n\t\t\t\ttemp = temp < tempa ? temp : tempa;\n\t\t\t\ttemp = temp < tempb ? temp : tempb;\n\t\t\t\tif (temp > maxn) maxn = temp;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tprintf(\"%d\\n\",maxn);\n\treturn 0;\n}\n"}, {"source_code": "/*\nB. Two Cakes\n\ntime limit per test: 1 second\nmemory limit per test: 256 megabytes\ninput: standard input\noutput: standard output\nIt's New Year's Eve soon, so Ivan decided it's high time he started setting the table. Ivan has bought two cakes and cut them into pieces: the first cake has been cut into a pieces, and the second one — into b pieces.\n\nIvan knows that there will be n people at the celebration (including himself), so Ivan has set n plates for the cakes. Now he is thinking about how to distribute the cakes between the plates. Ivan wants to do it in such a way that all following conditions are met:\n\nEach piece of each cake is put on some plate;\nEach plate contains at least one piece of cake;\nNo plate contains pieces of both cakes.\nTo make his guests happy, Ivan wants to distribute the cakes in such a way that the minimum number of pieces on the plate is maximized. Formally, Ivan wants to know the maximum possible number x such that he can distribute the cakes according to the aforementioned conditions, and each plate will contain at least x pieces of cake.\n\nHelp Ivan to calculate this number x!\n\nInput\nThe first line contains three integers n, a and b (1 ≤ a, b ≤ 100, 2 ≤ n ≤ a + b) — the number of plates, the number of pieces of the first cake, and the number of pieces of the second cake, respectively.\n\nOutput\nPrint the maximum possible number x such that Ivan can distribute the cake in such a way that each plate will contain at least x pieces of cake.\n*/\n/*\nExamples\n\ninput\n5 2 3\noutput\n1\n\ninput\n4 7 10\noutput\n3\n\nNote\nIn the first example there is only one way to distribute cakes to plates, all of them will have 1 cake on it.\n\nIn the second example you can have two plates with 3 and 4 pieces of the first cake and two plates both with 5 pieces of the second cake. Minimal number of pieces is 3.\n*/\n\n#include \n#include \n\nint max(int, int);\nint min(int, int);\n\nint main()\n{\n\tint n, a, b;\n\tscanf(\"%d%d%d\", &n, &a, &b);\n\t\n\tint x = min(a / (n - 1), b);\n\tfor(int i = n - 2; i > 0; i--)\n\t{\n\t\tx = max(x, min(a / i, b / (n - i)));\n\t}\n\t\n\tprintf(\"%d\\n\", 9 / 1);\n\tprintf(\"%d\\n\", x);\n}\n\nint max(int a, int b)\n{\n\treturn (a + b + abs(a - b)) / 2;\n}\n\nint min(int a, int b)\n{\n\treturn (a + b - abs(a - b)) / 2;\n}\n\n"}, {"source_code": "#include \n\nint rounda (int dividend, int divisor)\n{\n\treturn ((dividend + (divisor/2))/divisor);\n}\n\nint min (int a, int b)\n{\n\tif (a n)\n\t{\n\t\tif (a>b)\n\t\t\tbl--;\n\t\telse\n\t\t\tal--;\n\t}\n\n\tprintf(\"%d\", min(a/al, b/bl));\n\n\treturn 0;\n}"}, {"source_code": "\n#include\nint main()\n{\nint n,a,b,i,c=0,count=0,count2=0;\nint answer1,answer2;\nint x;\nscanf(\"%d %d %d\",&n,&a,&b);\nif(n==a+b)\n{\n printf(\"1\");\n}\nelse if(n=count)\n {\n answer1=count;\n }\n }\n\n if(a>=b)\n count=a;\n else count=b;\n x=count;\n for(i=1;i=count)\n {\n answer2=count;\n }\n }\n\n if(answer2\n\nint main(void)\n{\n float a, b, n, mod, sum, div, i, j;\n scanf(\"%f\", &n);\n scanf(\"%f\", &a);\n scanf(\"%f\", &b);\n\n sum = a + b;\n div = sum/n;\n if(div >= a) printf(\"%d\", (int)a);\n else if (div >=b) printf(\"%d\",(int) b);\n\n else\n {\n while(n >= (i+j))\n {\n i = (int)(a/div);\n j = (int)(b/div);\n div--;\n if(div == 0)break;\n }\n printf(\"%d\",(int)(div+1));\n }\n }\n"}, {"source_code": "#include\nint min1[105],min[5];\nint main()\n{\n\tint n,a,b;\n\tscanf(\"%d%d%d\",&n,&a,&b);\n\tint i,j,quo,m,l=0,k,ans;\n\tfor(i=1;i<=a;i++)\n\t{\n\t\tfor(j=i;j<=b;j++)\n\t\t{\n\t\t\tquo=(a/i)+(b/j);\n//\t\t\tprintf(\"%d \",quo);\n\t\t\tif(quo==n)\n\t\t\t{\n\t\t\t\tmin[0]=i;\n\t\t\t\tmin[1]=j;\n\t\t\t\tmin[2]=a/i+a%i;\n\t\t\t\tmin[3]=b/j+b%j;\n\t\t\t\tm=min[0];\n\t\t\t\tfor(k=0;k<4;k++)\n\t\t\t\t{\n\t\t\t\t\tif(m>min[k])\n\t\t\t\t\t\tm=min[k];\n\t\t\t\t}\n\t\t\t\tmin1[l++]=m;\n\t\t\t}\n\t\t}\n\t}//printf(\"\\n\");\n\tans=min1[0];\n\tfor(i=0;i\nint main(){\nint n,b=0,i,j,k,c=100005;\nscanf(\"%d\",&n);\nlong long int a=1000000000;\nlong long int A[n],B[n];\nfor(i=0;i<=n-1;i++){\n scanf(\"%I64d\",&A[i]);\n if(A[i]\n#include\n#include\n#include\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);\nmax=f=x=y=0;\nfor(i=1;if){\n f=x;\n }else{\n if(y>f){\n f=y;\n }\n }\n if(f>max){\n max=f;\n }\n}\nprintf(\"%lld\",max);\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,a,b,temp,max;\n scanf(\"%d%d%d\",&n,&a,&b);\n if(a > b)\n {\n temp = a;\n a = b;\n b = temp;\n }\n max = (a + b)/n;\n if(max == 0) printf(\"0\\n\");\n else if(max == 1) printf(\"1\\n\");\n else\n {\n int k = 1,i = max;\n while(i>=1)\n {\n k = (a/i)+(b/i);\n if(k <= n) break;\n i--;\n }\n printf(\"%d\\n\",k);\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,a,b,temp,max;\n scanf(\"%d%d%d\",&n,&a,&b);\n if(a > b)\n {\n temp = a;\n a = b;\n b = temp;\n }\n max = (a + b)/n;\n if(max == 0) printf(\"0\\n\");\n else if(max == 1) printf(\"1\\n\");\n else\n {\n int k = 1,i = max;\n while(i>=1)\n {\n k = (a/i)+(b/i);\n if(k <= n) break;\n i--;\n }\n if(i > a)\n printf(\"%d\\n\",a);\n else\n printf(\"%d\\n\",i);\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(){\n int a,b,n,c,d, i = 1;\n scanf(\"%d%d%d\",&n,&a,&b);\n while(1){\n c = a/i;\n d = b/i;\n if(c+d >= n){\n i++;\n }else\n break;\n }\n i--;\n printf(\"%d\\n\",i);\n\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\nint n,a,b,i,c=0,count=0;\nint x;\nscanf(\"%d %d %d\",&n,&a,&b);\nif(n==a+b)\n{\n printf(\"1\");\n}\nelse if(na+b)\n {\n c=c-1;\n }\n\n printf(\"%d\",c);\n }\n else if(a>n && b>n)\n {\n c=i/(n/2);\n printf(\"%d\",c);\n\n }\n\n}\n\n\n\n}\n"}, {"source_code": "\n#include\nint main()\n{\nint n,a,b,i,c=0,count=0;\nint x;\nscanf(\"%d %d %d\",&n,&a,&b);\nif(n==a+b)\n{\n printf(\"1\");\n}\nelse if(n=count)\n {\n printf(\"%d\",count);\n break;\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 \n\nint main()\n{\n int n,a,b;\n scanf(\"%d%d%d\",&n,&a,&b);\n int low=1;\n int high=(a+b+n-1)/n;\n int ans=0;\n while(low<=high)\n {\n int mid=(low+high)/2;\n if(a/mid+b/mid>=n)\n {\n if(a/(mid+1)+b/(mid+1)\n\nint main()\n{\n\tint n,a,b;\n\tscanf(\"%d%d%d\",&n,&a,&b);\n\t\n\t//int miny = a < b ? a : b;\n\tint maxn = 0;\n\tint sum = 0;\n\tint temp,tempa,tempb;\n\tif (a + b < 2*n)\n\t{\n\t\tprintf(\"1\\n\");\n\t\treturn 0;\n\t}\n\tfor (int i = 1; i <= a; i++)\n\t{\n\t\tfor (int j = 1; j <= b; j++)\n\t\t{\n\t\t\tsum = a / i + b / j;\n\t\t\tif (sum == n)\n\t\t\t{\n\t\t\t\ttemp = i < j ? i : j;\n\t\t\t\tif (temp > maxn) maxn = temp;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\ttempa = a % i;\n\t\t\ttempb = b % j;\n\t\t\tif (tempa != 0) sum += 1;\n\t\t\tif (tempb != 0) sum += 1;\n\t\t\t\n\t\t\tif (tempa == 0) tempa = 2000;\n\t\t\tif (tempb == 0) tempb = 2000; \n\t\t\t\n\t\t\tif (sum < n) break;\n\t\t\tif (sum > n) continue;\n\t\t\t\n\t\t\tprintf(\"i = %d; j = %d; sum = %d; \",i,j,sum);\n\t\t\tif (sum == n)\n\t\t\t{\n\t\t\t\ttemp = i < j ? i : j;\n\t\t\t\ttemp = temp < tempa ? temp : tempa;\n\t\t\t\ttemp = temp < tempb ? temp : tempb;\n\t\t\t\tprintf(\"temp = %d\\n\",temp);\n\t\t\t\tif (temp > maxn) maxn = temp;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tprintf(\"%d\\n\",maxn);\n\treturn 0;\n}"}, {"source_code": "#include \"stdio.h\"\n#include \"stdlib.h\"\n\n\nint main() {\n\tint n, a, b, plate1, plate2, pp1, pp2, v, ans = -1;\n\tscanf(\"%d %d %d\", &n, &a, &b);\n\tfor (plate1 = 1; plate1 <= (n+1)/2; plate1++) {\n\t\tplate2 = n - plate1;\n\t\tpp1 = a/plate1;\n\t\tpp2 = b/plate2;\n\t\tv = (pp1 < pp2) ? pp1 : pp2;\n\t\tif (v > ans)\n\t\t\tans = v;\n\t}\n\tprintf(\"%d\\n\", ans);\n\n\treturn 0;\n}"}, {"source_code": "#include\n#include\n#include\nint n, a, b, max;\n\nint minOf(int x, int y);\n\nint main() {\n scanf(\"%d %d %d\", &n, &a, &b);\n \n max = minOf(1, n-1);\n int curr;\n for(int ca=2; ca max)\n max = curr;\n } \n\n printf(\"%d\\n\", max);\nreturn 0;\n}\n\nint minOf(int x, int y) {\n if(x\nint main(){\n\tint n,a,b;\n\tscanf(\"%d %d %d\",&n,&a,&b);\n\tint temp=(a+b)/n;\n\tint min;\n\tint temp1;\n\tif (atemp)\n\t\t{\n\t\t\tprintf(\"%d\\n\",temp );\n\t\t}\n\t\telse\n\t\t\tprintf(\"%d\\n\",min/2 );\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main(){\nint n,b=0,i,j,k,c=100005;\nscanf(\"%d\",&n);\nlong long int a=1000000000;\nlong long int A[n],B[n];\nfor(i=0;i<=n-1;i++){\n scanf(\"%I64d\",&A[i]);\n if(A[i]\n\nint main()\n{\n\tint n, a, b;\n\twhile (~scanf(\"%d %d %d\", &n, &a, &b))\n\t{\n\t\tint t;\n\t\tif (a > b) t = a, a = b, b = a;\n\t\tif (n - 2 >= a)\n\t\t{\n\t\t\tprintf(\"1\\n\");\n\t\t\tcontinue;\n\t\t}\n\t\tif(n%2==0)\n\t\t\tprintf(\"%d\\n\", a / (n /2));\n\t\telse\n\t\t\tprintf(\"%d\\n\", a / ((n / 2)+1));\n\n\t}\n\treturn 0;\n}"}, {"source_code": "/* Coached by rainboy */\n#include \n\n#define N 100000\n\nint main() {\n\tstatic int aa[N];\n\tint n, i, i_, min, ans;\n\n\tscanf(\"%d\", &n);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%d\", &aa[i]);\n\tmin = aa[0];\n\tfor (i = 1; i < n; i++)\n\t\tif (min > aa[i])\n\t\t\tmin = aa[i];\n\tans = n;\n\ti_ = -1;\n\tfor (i = 0; i < n; i++)\n\t\tif (min == aa[i]) {\n\t\t\tif (i_ != -1 && ans > i - i_)\n\t\t\t\tans = i - i_;\n\t\t\ti_ = i;\n\t\t}\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main(int argc, char** argv) {\n int i, n, m, a, b;\n \n scanf(\"%d%d%d\", &n, &a, &b);\n for (i = 1000; i; i--) {\n m = a / i + b / i;\n if (m >= n) {\n printf(\"%d\\n\", i);\n break;\n }\n }\n \n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\nint n,a,b,c,count=0;\nint x;\nscanf(\"%d %d %d\",&n,&a,&b);\nif(n=a+b)\n{\n printf(\"1\");\n}\nelse if(n\n\nint min(int a, int b) {\n\treturn a < b ? a : b;\n}\n\nint main() {\n\tint n, a, b, x, y;\n\n\tscanf(\"%d%d%d\", &n, &a, &b);\n\tx = a < (n / 2) ? a : a / (n / 2);\n\ty = b < (n / 2) ? b : b / (n / 2);\n\tprintf(\"%d\\n\", min(x, y));\n\treturn 0;\n}\n"}, {"source_code": "\n#include\nint main()\n{\nint n,a,b,i,c=0,count=0;\nint x;\nscanf(\"%d %d %d\",&n,&a,&b);\nif(n==a+b)\n{\n printf(\"1\");\n}\nelse if(n=count)\n {\n printf(\"%d\",count);\n break;\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 \n#include \n\nint main()\n{\n int n,a,b;\n int z;\n scanf(\"%d \",&n);\n scanf(\"%d \",&a);\n scanf(\"%d \",&b);\n\n\n if((a+b)==n) printf(\"1\");\n else{\n z=((a+b)/n);\n while(a>z && b>z){\n a=a-z;\n b=b-z;\n }\n\n if(a>b) printf(\"%d\",b);\n else printf(\"%d\",a);\n\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,a,b;\n\tscanf(\"%d%d%d\",&n,&a,&b);\n\tint max,max1;\n\tif(n&1)\n\t{\n\t\tif(a>b)\n\t\t{\n\t\t\tmax=b/((n-1)/2);\n\t\t\tprintf(\"%d\\n\",max);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tmax1=a/((n-1)/2);\n\t\t\tprintf(\"%d\",max1);\n\t\t}\n\t}\n\telse{\n\tmax=a/(n/2);\n\tmax1=b/(n/2);\n\tif(max>max1)\n\t\tprintf(\"%d \",max1);\n\telse\n\t\tprintf(\"%d \",max);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include\n#include\n#include\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);\nmax=f=x=y=0;\nfor(i=1;if){\n f=x;\n }else{\n if(y>f){\n f=y;\n }\n }\n if(f>max){\n max=f;\n }\n}\nprintf(\"%lld\",max);\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,a,b,temp,max;\n scanf(\"%d%d%d\",&n,&a,&b);\n if(a > b)\n {\n temp = a;\n a = b;\n b = temp;\n }\n max = (a + b)/n;\n if(n == 0) printf(\"0\\n\");\n else if(n == 1) printf(\"1\\n\");\n else\n {\n int k = 1,i = max;\n while(i>=1)\n {\n k = (a/i)+(b/i);\n if(k <= n) break;\n i--;\n }\n printf(\"%d\\n\",k);\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main(void){\n int n,a,b,i,t1,t2,t,x=0;\n scanf(\"%d%d%d\",&n,&a,&b);\n for(i=1;i\nint main()\n{\nint n,a,b,i,c=0,count=0,count2=0;\nint answer1,answer2;\nint x;\nscanf(\"%d %d %d\",&n,&a,&b);\nif(n==a+b)\n{\n printf(\"1\");\n}\nelse if(n=count)\n {\n answer1=count;\n break;\n }\n }\n\n if(a>=b)\n count=a;\n else count=b;\n x=count;\n for(i=1;i=count)\n {\n answer2=count;\n break;\n }\n }\n\n\n if(answer1>=answer2)\n printf(\"%d\",answer1);\n else printf(\"%d\",answer2);\n\n\n}\n\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include\nint main(int argc, char const *argv[])\n{\n\tint n,x,y;\n\tscanf(\"%d\",&n);\n\tscanf(\"%d\",&x);\n\tscanf(\"%d\",&y);\n\tint max = 3000;\n\tfor(int i = 1;ival)\n\t\t\tmax = val;\n\t}\n\tprintf(\"%d\\n\",max);\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n,a,b;\n int z;\n scanf(\"%d \",&n);\n scanf(\"%d \",&a);\n scanf(\"%d \",&b);\n\n\n if((a+b)==n) printf(\"1\");\n else{\n z=((a+b)/n);\n\n\n while(((a/z)+(b/z))\n\nint min(int a, int b) {\n\treturn a < b ? a : b;\n}\n\nint main() {\n\tint n, a, b;\n\n\tscanf(\"%d%d%d\", &n, &a, &b);\n\tprintf(\"%d\\n\", min(a / (n / 2), b / (n / 2)));\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n,a,b;\n int z;\n scanf(\"%d \",&n);\n scanf(\"%d \",&a);\n scanf(\"%d \",&b);\n\n\n if((a+b)==n) printf(\"1\");\n else{\n z=((a+b)/n);\n while(a>=z && b>=z){\n a=a-z;\n b=b-z;\n }\n\n if(a>b) printf(\"%d\",b);\n else printf(\"%d\",a);\n\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\nint n,a,b;\nscanf(\"%d %d %d\",&n,&a,&b);\nint i,j,c=(a+b)/n,ans=0;\nfor(i=c;i>0;i--)\n{\nfor(j=1;j<=a;j++)\n{\nif(i*(n-j)<=b && i*j<=a)\n{\nans=i;\nprintf(\"%d\",ans);\nbreak;\n}\n}\nif(ans!=0)\nbreak;\n}\nreturn 0;\n}\n"}, {"source_code": "#include \"stdio.h\"\n\nint main()\n{\n\tint n, a, b;\n\twhile (scanf(\"%d%d%d\", &n, &a, &b) != EOF)\n\t{\n\t\tint a1 = 0, a2 = 0, b1 = 0, b2 = 0, min = a < b ? a : b;\n\t\tn = n - 2;\n\t\twhile (n--)\n\t\t{\n\t\t\tif (a > b) {\n\t\t\t\tif (a % 2) {\n\t\t\t\t\ta1 = a / 2;\n\t\t\t\t\ta2 = a1 + 1;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ta1 = a2 = a / 2;\n\t\t\t\t}\n\t\t\t\tmin = min < a1 ? min : a1;\n\t\t\t\tmin = min < b ? min : b;\n\t\t\t\ta = a2;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (b % 2) {\n\t\t\t\t\tb1 = b / 2;\n\t\t\t\t\tb2 = b1 + 1;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tb1 = b2 = b / 2;\n\t\t\t\t}\n\t\t\t\tmin = min < b1 ? min : b1;\n\t\t\t\tmin = min < a ? min : a;\n\t\t\t\tb = b2;\n\t\t\t}\n\t\t}\n\t\tprintf(\"%d\\n\", min);\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint c,d,i,k,n,a,b;\n\tscanf(\"%d%d%d\",&n,&a,&b);\n\tk=(a+b)/n;\n\tfor (i=k;i>=1;i--)\n\t{\n\t\tif (n<=(a/i+b/i)) break;\n\t\t\n\t}\n\tprintf(\"%d\\n\",i);\n\treturn 0;\n\t\n}"}, {"source_code": "#include\n\nint main(){\n\n int n, a, b;\n scanf(\"%d %d %d\", &n, &a, &b);\n\n if(n == a + b){\n printf(\"%d\\n\", 1);\n return 0;\n }\n\n\n int z = (float)(n * a)/(n + b) + .5;\n\n if(z == 0)\n z = 1;\n\n if(z >= n){\n printf(\"%d\\n\", b);\n return 0;\n }\n\n\n printf(\"%d\\n\", a/z);\n}\n"}, {"source_code": "#include \n\nint main(void)\n{\n float a, b, n, mod, sum, div, i, j;\n scanf(\"%f\", &n);\n scanf(\"%f\", &a);\n scanf(\"%f\", &b);\n\n sum = a + b;\n div = sum/n;\n if(div >= a) printf(\"%d\", (int)a);\n else if (div >=b) printf(\"%d\",(int) b);\n\n else\n {\n while(n > (i+j))\n {\n i = (int)(a/div);\n j = (int)(b/div);\n div--;\n //if((int)div == 0)break;\n }\n printf(\"%d\",(int)(div+1));\n }\n }\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n,a,b;\n int z;\n scanf(\"%d \",&n);\n scanf(\"%d \",&a);\n scanf(\"%d \",&b);\n\n\n if((a+b)==n) printf(\"1\");\n else{\n z=((a+b)/n);\n while(a>=z && b>=z){\n a=a-z;\n b=b-z;\n }\n\n if(a>b) printf(\"%d\",b);\n else printf(\"%d\",a);\n\n }\n return 0;\n}\n"}, {"source_code": "#include\n\nint main(){\n\n int n, a, b;\n scanf(\"%d %d %d\", &n, &a, &b);\n\n if(n == a + b){\n printf(\"%d\\n\", 1);\n return 0;\n }\n\n\n int z = (float)(n * a)/(a + b) + .5;\n\n if(z == 0)\n z = 1;\n\n if(z >= n){\n z = n - 1;\n }\n\n int answer;\n if(a/z <= b/(n - z))\n answer = a/z;\n else\n answer = b/(n - z);\n\n printf(\"%d\\n\", answer);\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tint n,a,b;\n\tscanf(\"%d%d%d\",&n,&a,&b);\n\t\n\t//int miny = a < b ? a : b;\n\tint maxn = 0;\n\tint sum = 0;\n\tint temp,tempa,tempb;\n\tfor (int i = 1; i <= a; i++)\n\t{\n\t\tfor (int j = 1; j <= b; j++)\n\t\t{\n\t\t\tsum = a / i + b / j;\n\t\t\ttempa = a % i;\n\t\t\ttempb = b % j;\n\t\t\tif (tempa != 0) sum += 1;\n\t\t\tif (tempb != 0) sum += 1;\n\t\t\t\n\t\t\tif (tempa == 0) tempa = 2000;\n\t\t\tif (tempb == 0) tempb = 2000; \n\t\t\t\n\t\t\tif (sum < n) break;\n\t\t\tif (sum > n) continue;\n\t\t\t\n\t\t\t//printf(\"i = %d; j = %d; sum = %d\\n\",i,j,sum);\n\t\t\tif (sum == n)\n\t\t\t{\n\t\t\t\ttemp = i < j ? i : j;\n\t\t\t\ttemp = temp < tempa ? temp : tempa;\n\t\t\t\ttemp = temp < tempb ? temp : tempb;\n\t\t\t\tif (temp > maxn) maxn = temp;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tprintf(\"%d\\n\",maxn);\n\treturn 0;\n}"}, {"source_code": "#include \n\nint rounda (int dividend, int divisor)\n{\n\treturn ((dividend + (divisor/2))/divisor);\n}\n\nint min (int a, int b)\n{\n\tif (a n)\n\t{\n\t\tif (a>b)\n\t\t\tbl--;\n\t\telse\n\t\t\tal--;\n\t}\n\n\tprintf(\"%d\", min(a/al, b/bl));\n\n\treturn 0;\n}"}, {"source_code": "#include \"stdio.h\"\n\nint main()\n{\n\tint n, a, b;\n\twhile (scanf(\"%d%d%d\", &n, &a, &b) != EOF)\n\t{\n\t\tint c[250] = { 0 };\n\t\tint count = 2;\n\t\tc[1] = a; c[2] = b;\n\t\tint max = 0, min = 10000000;\n\t\tint tag = 0;\n\t\tfor (int i = 1; i <= count; i++) {\n\t\t\tif (count == n)\n\t\t\t\tbreak;\n\n\t\t\tif (max < c[i]) {\n\t\t\t\tmax = c[i];\n\t\t\t\ttag = i;\n\t\t\t}\n\t\t\tif (i == count) {\n\t\t\t\tif (c[tag] % 2) {\n\t\t\t\t\tc[i + 1] = c[tag] / 2 + 1;\n\t\t\t\t\tc[tag] = c[tag] / 2;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tc[i + 1] = c[tag] / 2;\n\t\t\t\t\tc[tag] = c[tag] / 2;\n\t\t\t\t}\n\t\t\t\tcount++;\n\t\t\t\ti = 0;\n\t\t\t\tmax = 0;\n\t\t\t\ttag = 0;\n\t\t\t}\n\t\t}\n\t\tfor (int i = 1; i <= n; i++) {\n\t\t\tmin = min < c[i] ? min : c[i];\n\t\t}\n\t\tprintf(\"%d\\n\", min);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\nint main(){\nint n,n1,n2,a,b,i,j,c,d,e=0;\nscanf(\"%d %d %d\",&n,&a,&b);\nif(a>b){\n c=b;\n d=a;\n}\nelse if(b>a){\n c=a;\n d=b;\n}\n//printf(\"%d %d\\n\",c,d);\nfor(i=1;i<=c/2+1;i++){\n n1=i;\n n2=n-n1;\n // printf(\"%d %d\\n\",n1,n2);\n for(j=1;j<=100;j++){\n if(n1*j<=c&&n2*j<=d&&j>e)\n e=j;\n if(n1*j>c)\n break;\n }\n}\nprintf(\"%d\",e);\n}\n\n"}, {"source_code": "#include\nint main()\n{\n\tint n,a,b;\n\tscanf(\"%d%d%d\",&n,&a,&b);\n\tint max,max1;\n\tif(n==1)\n\t{\n\t\tif(a>b)\n\t\t\tprintf(\"%d\",b);\n\t\telse\n\t\t\tprintf(\"%d\",a);\n\t\treturn 0;\n\t}\n\tmax=a/(n/2);\n\tmax1=b/(n/2);\n\tif(max>max1)\n\t\tprintf(\"%d \",max1);\n\telse\n\t\tprintf(\"%d \",max);\n\treturn 0;\n}\n"}, {"source_code": "#include\n//#include\nint main()\n{\n int n,a,b,x,i,mind;\n scanf(\"%d %d %d\",&n,&a,&b);\n x=(a+b)/n;\n while(1)\n {\n if(n<=(a/x+b/x))\n {\n printf(\"%d\\n\",x);\n break;\n }\n x--;\n }\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n\tint n, a, b;\n\twhile (~scanf(\"%d %d %d\", &n, &a, &b))\n\t{\n\t\tif (n - 2 >= a)\n\t\t{\n\t\t\tprintf(\"1\\n\");\n\t\t\tcontinue;\n\t\t}\n\t\tprintf(\"%d\\n\", a / (n - 2));\n\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n , a , b ;\n scanf(\"%d%d%d\",&n,&a,&b);\n int max , min , av , minc , i ;\n if(a>=b){\n max=a ;\n min=b;\n }\n else{\n max=b ;\n min =a ;\n }\n av=(a+b)/n ;\n\n for(i=av+1 ; i>0 ; i--){\n minc= min/i ;\n if( (n-minc)*i <=max){\n printf(\"%d\",i);\n break ;\n }\n }\n\n\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n,a,b;\n int z;\n scanf(\"%d \",&n);\n scanf(\"%d \",&a);\n scanf(\"%d \",&b);\n\n\n if((a+b)==n) printf(\"1\");\n else{\n z=((a+b)/n);\n\n\n while(((a/z)+(b/z))\n\nint main()\n{\n\tint n, a, b;\n\twhile (~scanf(\"%d %d %d\", &n, &a, &b))\n\t{\n\t\tif (n - 2 >= a)\n\t\t{\n\t\t\tprintf(\"1\\n\");\n\t\t\tcontinue;\n\t\t}\n\t\tprintf(\"%d\\n\", a / (n - 2));\n\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n unsigned short n, a, b;\n fscanf( stdin , \"%hu %hu %hu\" , &n , &a , &b );\n\n unsigned short x = 1;\n unsigned short y = 1;\n\n for(int i = 1;i < (n + 1) / 2;i++)\n {\n y = a / i < b / (n - i) ? a / i : b / (n - i);\n if(x < y)\n x = y;\n }\n printf(\"%hu\\n\" , x );\n\n return 0;\n}\n"}, {"source_code": "\n#include\nint main()\n{\nint n,a,b,i,c=0,count=0;\nint x;\nscanf(\"%d %d %d\",&n,&a,&b);\nif(n==a+b)\n{\n printf(\"1\");\n}\nelse if(n=count)\n {\n printf(\"%d\",count);\n break;\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\tint n, a, b;\n\twhile (scanf(\"%d%d%d\", &n, &a, &b) != EOF)\n\t{\n\t\tint a1 = 0, a2 = 0, b1 = 0, b2 = 0, min = a < b ? a : b;\n\t\tn = n - 2;\n\t\twhile (n--)\n\t\t{\n\t\t\tif (a > b) {\n\t\t\t\tif (a % 2) {\n\t\t\t\t\ta1 = a / 2;\n\t\t\t\t\ta2 = a1 + 1;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ta1 = a2 = a / 2;\n\t\t\t\t}\n\t\t\t\tmin = min < a1 ? min : a1;\n\t\t\t\tmin = min < b ? min : b;\n\t\t\t\ta = a2;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (b % 2) {\n\t\t\t\t\tb1 = b / 2;\n\t\t\t\t\tb2 = b1 + 1;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tb1 = b2 = b / 2;\n\t\t\t\t}\n\t\t\t\tmin = min < b1 ? min : b1;\n\t\t\t\tmin = min < a ? min : a;\n\t\t\t\tb = b2;\n\t\t\t}\n\t\t}\n\t\tprintf(\"%d\\n\", min);\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include\nint min1[105],min[5];\nint main()\n{\n\tint n,a,b;\n\tscanf(\"%d%d%d\",&n,&a,&b);\n\tint i,j,quo,m,l=0,k,ans,temp;\n\tif(a>b)\n\t{\n\t\ttemp=a;\n\t\ta=b;\n\t\tb=temp;\n\t}\n\tfor(i=1;i<=a;i++)\n\t{\n\t\tfor(j=i;j<=b;j++)\n\t\t{\n\t\t\tquo=(a/i)+(b/j);\n\t\t//\tprintf(\"%d %d %d :\",i,j,quo);\n\t\t\tif(quo==n)\n\t\t\t{\n\t\t\t\tmin[0]=i;\n\t\t\t\tmin[1]=j;\n\t\t\t\tmin[2]=i+a%i;\n\t\t\t\tmin[3]=j+b%j;\n\t\t\t\tm=min[0];\n\t\t\t\tfor(k=0;k<4;k++)\n\t\t\t\t{\n\t\t//\t\t\tprintf(\"%d \",min[k]);\n\t\t\t\t\tif(m>min[k])\n\t\t\t\t\t\tm=min[k];\n\t\t\t\t}\n\t\t//\t\tprintf(\":\");\n\t\t\t\tif(m!=0)\n\t\t\t\tmin1[l++]=m;\n\t\t\t}\n\t\t}\n\t}printf(\"\\n\");\n\tans=min1[0];\n\tfor(i=0;i\nint main()\n{\n\tint c,d,i,k,n,a,b;\n\tscanf(\"%d%d%d\",&n,&a,&b);\n\tk=(a+b)/n;\n\tfor (i=k;i>=1;i--)\n\t{\n\t\tif (n<=(a/i+b/i)) break;\n\t\t\n\t}\n\tprintf(\"%d\\n\",i);\n\treturn 0;\n\t\n}"}, {"source_code": "#include \n\nint min (int a, int b);\n\nint main(){\n\tint n,a,b,x,y,i,thiso;\n\tscanf(\"%d%d%d\",&n,&a,&b);\n\tint max = 0;\n\tfor(i=0;i<=n;i++){\n\t\tx = i;\n\t\ty = n-i;\n\t\tif(x!=0 &&y!=0)\n\t\t\tthiso = min(a/x, b/y);\n\t\telse if(y!=0)\n\t\t\tthiso = b/y;\n\t\telse if(x!=0)\n\t\t\tthiso = a/x;\n\t\tif(thiso>max){\n\t\t\tmax = thiso;\n\t\t}\n\t}\n\tprintf(\"%d\", max);\n}\n\nint min (int a, int b){\n\tif(a>b)\n\treturn b;\n\telse\n\treturn a;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n , a , b ;\n scanf(\"%d%d%d\",&n,&a,&b);\n int max , min , av , minc , i ;\n if(a>=b){\n max=a ;\n min=b;\n }\n else{\n max=b ;\n min =a ;\n }\n av=(a+b)/n ;\n\n for(i=av+1 ; i>0 ; i--){\n minc= min/i ;\n if( (n-minc)*i <=max){\n printf(\"%d\",i);\n break ;\n }\n }\n\n\n}\n"}, {"source_code": "#include\nint main()\n{int a,b,c,d,e,f,min,max,m;\nwhile(scanf(\"%d%d%d\",&a,&b,&c)!=EOF)\n{\nmin=b>c?c:b;\nmax=b>c?b:c;\nb=min;\nwhile(1)\n{m=0;\nif (b==2)\n{b--;continue;}\nwhile (b>0)\n{min=min-b;\nm++;\nif (min\n#include \n\nint main()\n{\n int n,a,b;\n int z;\n scanf(\"%d \",&n);\n scanf(\"%d \",&a);\n scanf(\"%d \",&b);\n\n\n if((a+b)==n) printf(\"1\");\n else{\n z=((a+b)/n);\n while(a>=z && b>=z){\n a=a-z;\n b=b-z;\n }\n\n if(a>b) printf(\"%d\",b);\n else printf(\"%d\",a);\n\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \nint main() {\n int n, a, b;\n scanf(\"%d%d%d\", &n, &a, &b);\n for(int ct = 1; ct <= 1000 ; ct++){\n if((a / ct) + (b / ct) < n){\n printf(\"%d\", ct - 1);\n return 0;\n }\n }\n\n}\n\n\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n unsigned short n, a, b;\n fscanf( stdin , \"%hu %hu %hu\" , &n , &a , &b );\n\n unsigned short x = 1;\n unsigned short y = 1;\n\n for(int i = 1;i <= (n + 1) / 2;i++)\n {\n y = a / i < b / (n - i) ? a / i : b / (n - i);\n if(x < y)\n x = y;\n }\n printf(\"%hu\\n\" , x );\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\nint n,a,b,c,count=0;\nint x;\nscanf(\"%d %d %d\",&n,&a,&b);\nc=a+b;\n\nif(a>n && b>n)\n{\n if(a>b)\n count=b/(n/2);\n else count=a/(n/2);\n}\nelse if(n>a && n>b)\n{\n if(a>b)\n count=n/a;\n else count=n/b;\n}\nelse count=(a+b)/n;\n\nprintf(\"%d\",count);\n}\n"}, {"source_code": "#include\n\nint main()\n{\n\tint n, a, b;\n\twhile (~scanf(\"%d %d %d\", &n, &a, &b))\n\t{\n\t\tint t;\n\t\tif (a > b) t = a, a = b, b = a;\n\t\tif (n - 2 >= a)\n\t\t{\n\t\t\tprintf(\"1\\n\");\n\t\t\tcontinue;\n\t\t}\n\t\tif (n == 3)\n\t\t\tprintf(\"%d\\n\", (a + b) / 3);\n\t\telse if(n%2==0)\n\t\t\tprintf(\"%d\\n\", a / (n /2));\n\t\telse\n\t\t\tprintf(\"%d\\n\", a / ((n / 2)+1));\n\n\t}\n\treturn 0;\n}"}], "src_uid": "a254b1e3451c507cf7ce3e2496b3d69e"} {"nl": {"description": "The only difference between easy and hard versions is the length of the string.You are given a string $$$s$$$ and a string $$$t$$$, both consisting only of lowercase Latin letters. It is guaranteed that $$$t$$$ can be obtained from $$$s$$$ by removing some (possibly, zero) number of characters (not necessary contiguous) from $$$s$$$ without changing order of remaining characters (in other words, it is guaranteed that $$$t$$$ is a subsequence of $$$s$$$).For example, the strings \"test\", \"tst\", \"tt\", \"et\" and \"\" are subsequences of the string \"test\". But the strings \"tset\", \"se\", \"contest\" are not subsequences of the string \"test\".You want to remove some substring (contiguous subsequence) from $$$s$$$ of maximum possible length such that after removing this substring $$$t$$$ will remain a subsequence of $$$s$$$.If you want to remove the substring $$$s[l;r]$$$ then the string $$$s$$$ will be transformed to $$$s_1 s_2 \\dots s_{l-1} s_{r+1} s_{r+2} \\dots s_{|s|-1} s_{|s|}$$$ (where $$$|s|$$$ is the length of $$$s$$$).Your task is to find the maximum possible length of the substring you can remove so that $$$t$$$ is still a subsequence of $$$s$$$.", "input_spec": "The first line of the input contains one string $$$s$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. The second line of the input contains one string $$$t$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. It is guaranteed that $$$t$$$ is a subsequence of $$$s$$$.", "output_spec": "Print one integer — the maximum possible length of the substring you can remove so that $$$t$$$ is still a subsequence of $$$s$$$.", "sample_inputs": ["bbaba\nbb", "baaba\nab", "abcde\nabcde", "asdfasdf\nfasd"], "sample_outputs": ["3", "2", "0", "3"], "notes": null}, "positive_code": [{"source_code": "#include\n#include\nint main()\n{\n\tchar s[200005], t[200005];\n\tscanf(\"%s%s\", s, t);\n\tint i, j;\n\tint a[200005];\n\tint n, m;\n\tn = strlen(s);\n\tm = strlen(t);\n\ta[0] = -1;\n\tfor (i = 0; i < m; i++)\n\t{\n\t\tj = a[i] + 1;\n\t\twhile (s[j] != t[i])\n\t\t\tj++;\n\t\ta[i + 1] = j;\n\t}\n\tint b[200005];\n\tb[m] = n;\n\tfor (i = m - 1; i >= 0; i--)\n\t{\n\t\tj = b[i + 1] - 1;\n\t\twhile (s[j] != t[i])\n\t\t\tj--;\n\t\tb[i] = j;\n\t}\n\tint ans = 0;\n\tfor (i = 0; i <= m; i++)\n\t\tif (ans < b[i] - a[i])\n\t\t\tans = b[i] - a[i];\n\tprintf(\"%d\\n\", ans - 1);\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n#define MAXLEN 200001\n\nint compare(char *str1, char *str2, int len) {\n for (int i = 0; i < len; i++) {\n if (str1[i] != str2[i]) {\n return 0;\n }\n }\n return 1;\n}\nvoid concat(char *str1, char *str2, char *output) {\n int len = 0;\n int i = 0;\n while (str1[len]) {\n output[len] = str1[len];\n len++;\n }\n i = len;\n while (str2[len - i]) {\n output[len] = str2[len - i];\n len++;\n }\n output[len] = 0;\n}\nint isSubSequence(char str1[], char str2[], int m, int n) {\n int j = 0; // For index of str1 (or subsequence\n\n // Traverse str2 and str1, and compare current character\n // of str2 with first unmatched char of str1, if matched\n // then move ahead in str1\n for (int i = 0; i < n && j < m; i++)\n if (str1[j] == str2[i])\n j++;\n\n // If all characters of str1 were found in str2\n return (j == m);\n}\nint main() {\n char str1[MAXLEN];\n char str2[MAXLEN];\n char str3[MAXLEN];\n scanf(\"%s\", str1);\n scanf(\"%s\", str2);\n\n int len1 = strlen(str1);\n int len2 = strlen(str2);\n\n for (int sublen = len1 - len2; sublen >= 0; sublen--) {\n for (int start = -1; start < len1 - sublen; start++) {\n char temp = str1[start + 1];\n str1[start + 1] = 0;\n // puts(str1) ;\n concat(str1, str1 + start + sublen + 1, str3);\n int len3 = strlen(str3);\n // printf(\"%s %s\\n\", str1, str1 + start + sublen + 1) ;\n // printf(\"%s\\n\", str3) ;\n\n // printf(\"%d %d\\n\", sublen, start) ;\n // if(strstr(str3, str2)){\n if (isSubSequence(str2, str3, len2, len3)) {\n // puts(\" \") ;a\n // puts(str3) ;\n printf(\"%d\", sublen);\n return 0;\n }\n str1[start + 1] = temp;\n // puts(str1) ;\n }\n }\n\n printf(\"0\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\nint s1,s2,dp[201][201];\n\nint val(char s[], char t[], int i, int j)\n{\n int max1 = -1,max = -1;\n if(dp[i][j]!=-2) return dp[i][j];\n for (int k = i; k < s1-(s2-j-1); k++){\n \n if(s[k]==t[j]){\n \n if(j < s2-1){\n int temp = val(s,t,k+1,j+1);\n if(temp!=-1){\n if(temp > k-i) max1 = temp;\n else max1 = k-i;\n }\n else break;\n \n if(max1> max) max = max1;\n }\n else{\n if(k - i > s1-k-1) max1 = k - i;\n else max1 = s1 -k -1;\n if (max1 > max) max = max1;\n }\n }\n if(max >= s1-s2) return max;\n }\n dp[i][j] = max;\n return max;\n}\n\nint main()\n{\n char s[250],t[250];\n scanf(\"%s\",s);\n scanf(\"%s\",t);\n // printf(\"%s\\n\\n%s\",s,t);\n for(int i=0;i< 201; i++){\n for(int j=0;j< 201; j++) dp[i][j] = -2;\n }\n s1= strlen(s);\n s2= strlen(t);\n printf(\"%d\",val(s,t,0,0));\n}"}, {"source_code": "#include \n#include \n\n#define N\t200000\n#define M\t200000\n\nint main() {\n\tstatic char aa[N + 1], bb[M + 1];\n\tstatic int pp[M + 1], qq[M + 1];\n\tint n, m, i, i1, i2, j, max;\n\n\tscanf(\"%s%s\", aa, bb), n = strlen(aa), m = strlen(bb);\n\tfor (i = 0, j = 0; i <= n; i++) {\n\t\tpp[i] = j;\n\t\tif (i < n && j < m && aa[i] == bb[j])\n\t\t\tj++;\n\t}\n\tfor (i = n, j = m - 1; i >= 0; i--) {\n\t\tif (i < n && j >= 0 && aa[i] == bb[j])\n\t\t\tj--;\n\t\tqq[i] = j;\n\t}\n\tmax = 0;\n\tfor (i1 = 0, i2 = 0; i1 <= n; i1++) {\n\t\twhile (i2 <= n && pp[i1] > qq[i2])\n\t\t\ti2++;\n\t\tif (max < i2 - 1 - i1)\n\t\t\tmax = i2 - 1 - i1;\n\t}\n\tprintf(\"%d\\n\", max);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#define true 1\n#define false 0\nint StrFuckOfTOrNot(char *str,int strLen,char *t,int tLen,int l,int r)\n{\n int index = 0;\n for(int i = 0 ; i < strLen && index < tLen ; i ++)\n {\n if(i >= l && i < r){\n continue;\n }\n if(str[i] == t[index]){\n index += 1;\n }\n }\n if(index >= strlen(t)){\n return true;\n }\n else{\n return false;\n }\n}\nint keepFuck(int ans,char *str,char *t)\n{\n if(ans == 0){\n return true;\n }\n for(int i = 0 ; i + ans <= strlen(str) ; i++)\n {\n if(StrFuckOfTOrNot(str,strlen(str),t,strlen(t),i,i + ans) == true){\n return true;\n }\n }\n return false;\n}\nint main()\n{\n char *str = (char *)malloc(sizeof(char) * 200001);\n char *t = (char *)malloc(sizeof(char) * 200001);\n\n scanf(\"%s\",str);\n scanf(\"%s\",t);\n int ans = 0;\n int high = strlen(str) - 1,low = 0;\n int mid = (high + low)/2;\n while(low <= high)\n {\n if(keepFuck(mid,str,t) == true){\n low = mid + 1;\n if(ans < mid){\n ans = mid;\n }\n }\n else{\n high = mid - 1;\n }\n mid = (high + low)/2;\n }\n printf(\"%d\",ans);\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \n#define true 1\n#define false 0\nint StrFuckOfTOrNot(char *str,int strLen,char *t,int tLen,int l,int r)\n{\n int index = 0;\n for(int i = 0 ; i < strLen && index < tLen ; i ++)\n {\n if(i >= l && i < r){\n continue;\n }\n if(str[i] == t[index]){\n index += 1;\n }\n }\n if(index >= strlen(t)){\n return true;\n }\n else{\n return false;\n }\n}\nint main()\n{\n char *str = (char *)malloc(sizeof(char) * 201);\n char *t = (char *)malloc(sizeof(char) * 201);\n\n scanf(\"%s\",str);\n scanf(\"%s\",t);\n\n int ans = strlen(str) - 1;\n while(ans > 0)\n {\n for(int i = 0 ; i + ans <= strlen(str) ; i++)\n {\n if(StrFuckOfTOrNot(str,strlen(str),t,strlen(t),i,i + ans) == true){\n printf(\"%d\",ans);\n return 0;\n }\n }\n ans -= 1;\n }\n printf(\"0\");\n return 0;\n}"}, {"source_code": "#include\n#include\n#include\n#define size 205\nint max_(int x,int y)\n{\n\treturn x>y?x:y;\n}\nmain()\n{\n\tchar s[size],t[size];\n\tscanf(\"%s\",s);\n\tscanf(\"%s\",t);\n\tint i,ans=0,j,p,pos,ss,tt;\n\tss=strlen(s);\n\ttt=strlen(t);\n\tfor(i=0;i\n#include\n#include\nint max(int a,int b)\n{\n if(a>b)\n return a;\n else\n return b;\n}\nint main()\n{\n int len1,len2,k,mx=0,i,j;\n char s[99999],t[99999];\n int p=0,q=0;\n scanf(\"%s\",s);\n scanf(\"%s\",t);\n len1=strlen(s);\n len2=strlen(t);\n int a[100000];\n int b[100000];\n for(int i = 0, j = 0; i < len1&& j < len2; ++i)\n if(s[i] == t[j])\n a[j++] = i;\n for(int i = len1 - 1, j = len2 - 1; i >= 0 && j >= 0; --i)\n if(s[i] == t[j])\n b[j--] = i;\n mx = max(mx,b[0]);\n mx = max(mx,len1 - a[len2-1] - 1);\n for(int i = 1; i < len2; i++)\n mx = max(mx,b[i] - a[i-1] - 1);\n printf(\"%d\",mx);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\n#define N 201\n\nchar s[N], t[N];\n\n/* StrChr */\nchar *sc(char *begin, char *end, char ch) {\n\twhile (begin < end && *begin++ != ch);\n\treturn begin;\n}\n\nchar *src(char *begin, char *end, char ch) {\n\twhile(begin < end && *--end != ch);\n\treturn end;\n}\n\nint main() {\n\tint len, i, j, ans = 0;\n\tgets(s);\n\tgets(t);\n\tlen = strlen(t);\n\tfor (i = 0; i <= len; i++) {\n\t\tchar *begin = s, *end = s + strlen(s);\n\t\tfor (j = 0; j < i; j++) {\n\t\t\tbegin = sc(begin, end, t[j]);\n\t\t}\n\t\tfor (j = len - 1; j >= i; j--) {\n\t\t\tend = src(begin, end, t[j]);\n\t\t}\n\t\tif (end - begin > ans) ans = end - begin;\n\t}\n\tprintf(\"%u\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n\tchar s[200005], t[200005];\n\tscanf(\"%s%s\", s, t);\n\tint i, j;\n\tint a[200005];\n\tint n, m;\n\tn = strlen(s);\n\tm = strlen(t);\n\ta[0] = -1;\n\tfor (i = 0; i < m; i++)\n\t{\n\t\tj = a[i] + 1;\n\t\twhile (s[j] != t[i])\n\t\t\tj++;\n\t\ta[i + 1] = j;\n\t}\n\tint b[200005];\n\tb[m] = n;\n\tfor (i = m - 1; i >= 0; i--)\n\t{\n\t\tj = b[i + 1] - 1;\n\t\twhile (s[j] != t[i])\n\t\t\tj--;\n\t\tb[i] = j;\n\t}\n\tint ans = 0;\n\tfor (i = 0; i <= m; i++)\n\t\tif (ans < b[i] - a[i])\n\t\t\tans = b[i] - a[i];\n\tprintf(\"%d\\n\", ans - 1);\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\n#define N\t200000\n#define M\t200000\n\nint main() {\n\tstatic char aa[N + 1], bb[M + 1];\n\tstatic int pp[M + 1], qq[M + 1];\n\tint n, m, i, i1, i2, j, max;\n\n\tscanf(\"%s%s\", aa, bb), n = strlen(aa), m = strlen(bb);\n\tfor (i = 0, j = 0; i <= n; i++) {\n\t\tpp[i] = j;\n\t\tif (i < n && j < m && aa[i] == bb[j])\n\t\t\tj++;\n\t}\n\tfor (i = n, j = m - 1; i >= 0; i--) {\n\t\tif (i < n && j >= 0 && aa[i] == bb[j])\n\t\t\tj--;\n\t\tqq[i] = j;\n\t}\n\tmax = 0;\n\tfor (i1 = 0, i2 = 0; i1 <= n; i1++) {\n\t\twhile (i2 <= n && pp[i1] > qq[i2])\n\t\t\ti2++;\n\t\tif (max < i2 - 1 - i1)\n\t\t\tmax = i2 - 1 - i1;\n\t}\n\tprintf(\"%d\\n\", max);\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n#include\nint max(int a,int b)\n{\n if(a>b)\n return a;\n else\n return b;\n}\nint main()\n{\n int len1,len2,k,mx=0,i,j;\n char s[300000],t[300000];\n int p=0,q=0;\n scanf(\"%s\",s);\n scanf(\"%s\",t);\n len1=strlen(s);\n len2=strlen(t);\n if(len2==0)\n {\n printf(\"%d\",len1);\n return 0;\n }\n int a[300000];\n int b[300000];\n for(int i = 0, j = 0; i < len1&& j < len2; ++i)\n if(s[i] == t[j])\n a[j++] = i;\n for(int i = len1 - 1, j = len2 - 1; i >= 0 && j >= 0; --i)\n if(s[i] == t[j])\n b[j--] = i;\n mx = max(mx,b[0]);\n mx = max(mx,len1 - a[len2-1] - 1);\n for(int i = 1; i < len2; i++)\n mx = max(mx,b[i] - a[i-1] - 1);\n printf(\"%d\",mx);\n return 0;\n}"}], "negative_code": [{"source_code": "#include \n#include \n#define MAXLEN 200001\n\nint compare(char *str1, char *str2, int len) {\n for(int i = 0 ; i < len ; i++) {\n if(str1[i] != str2[i]) {\n return 0 ;\n }\n }\n return 1;\n}\nvoid concat(char *str1, char *str2, char *output) {\n int len = 0 ;\n int i = 0 ;\n while(str1[len]) {\n output[len] = str1[len] ;\n len++ ;\n }\n i = len ;\n while(str2[len - i]) {\n output[len] = str2[len - i] ;\n len++ ;\n }\n output[len] = 0 ;\n}\n\nint main() {\n char str1[MAXLEN] ;\n char str2[MAXLEN] ;\n char str3[MAXLEN] ;\n scanf(\"%s\", str1) ;\n scanf(\"%s\", str2) ;\n\n int len1 = strlen(str1) ;\n int len2 = strlen(str2) ;\n\n for(int sublen = len1 - len2; sublen >= 0 ; sublen--) {\n for(int start = -1 ; start < len1 - sublen ; start++) {\n char temp = str1[start + 1] ;\n str1[start + 1] = 0 ;\n // puts(str1) ;\n concat(str1, str1 + start + sublen + 1, str3) ;\n // printf(\"%s %s\\n\", str1, str1 + start + sublen + 1) ;\n // printf(\"%s\\n\", str3) ;\n\n // printf(\"%d %d\\n\", sublen, start) ;\n if(strstr(str3, str2)){\n // puts(\" \") ;a\n // puts(str3) ;\n printf(\"%d\",sublen) ;\n return 0 ;\n }\n str1[start + 1] = temp ;\n // puts(str1) ;\n }\n }\n\n printf(\"0\") ;\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#define MAXLEN 200001\n\nint compare(char *str1, char *str2, int len) {\n for(int i = 0 ; i < len ; i++) {\n if(str1[i] != str2[i]) {\n return 0 ;\n }\n }\n return 1;\n}\nvoid concat(char *str1, char *str2, char *output) {\n int len = 0 ;\n int i = 0 ;\n while(str1[len]) {\n output[len] = str1[len] ;\n len++ ;\n }\n i = len ;\n while(str2[len - i]) {\n output[len] = str2[len - i] ;\n len++ ;\n }\n output[len] = 0 ;\n}\n\nint main() {\n char str1[MAXLEN] ;\n char str2[MAXLEN] ;\n char str3[MAXLEN] ;\n scanf(\"%s\", str1) ;\n scanf(\"%s\", str2) ;\n\n int len1 = strlen(str1) ;\n int len2 = strlen(str2) ;\n\n for(int sublen = len1 - len2; sublen > 0 ; sublen--) {\n for(int start = 0 ; start < len1 - sublen ; start++) {\n char temp = str1[start + 1] ;\n str1[start + 1] = 0 ;\n // puts(str1) ;\n concat(str1, str1 + start + sublen + 1, str3) ;\n // puts(str3) ;\n // printf(\"%d %d\\n\", sublen, start) ;\n if(strstr(str3, str2)){\n printf(\"%d\",sublen+1) ;\n return 0 ;\n }\n str1[start + 1] = temp ;\n // puts(str1) ;\n }\n }\n\n printf(\"0\") ;\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#define MAXLEN 200001\n\nint compare(char *str1, char *str2, int len) {\n for(int i = 0 ; i < len ; i++) {\n if(str1[i] != str2[i]) {\n return 0 ;\n }\n }\n return 1;\n}\nvoid concat(char *str1, char *str2, char *output) {\n int len = 0 ;\n int i = 0 ;\n while(str1[len]) {\n output[len] = str1[len] ;\n len++ ;\n }\n i = len ;\n while(str2[len - i]) {\n output[len] = str2[len - i] ;\n len++ ;\n }\n output[len] = 0 ;\n}\n\nint main() {\n char str1[MAXLEN] ;\n char str2[MAXLEN] ;\n char str3[MAXLEN] ;\n scanf(\"%s\", str1) ;\n scanf(\"%s\", str2) ;\n\n int len1 = strlen(str1) ;\n int len2 = strlen(str2) ;\n\n for(int sublen = len1 - len2; sublen >= 0 ; sublen--) {\n for(int start = -1 ; start < len1 - sublen ; start++) {\n char temp = str1[start + 1] ;\n str1[start + 1] = 0 ;\n // puts(str1) ;\n concat(str1, str1 + start + sublen + 1, str3) ;\n // printf(\"%s %s\\n\", str1, str1 + start + sublen + 1) ;\n // printf(\"%s\\n\", str3) ;\n\n // printf(\"%d %d\\n\", sublen, start) ;\n if(strstr(str3, str2)){\n // puts(\" \") ;\n // puts(str3) ;\n printf(\"%d\",sublen) ;\n return 0 ;\n }\n str1[start + 1] = temp ;\n // puts(str1) ;\n }\n }\n\n printf(\"0\") ;\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\nint s1,s2;\n\nint val(char s[], char t[], int i, int j)\n{\n int max1 = -1,max = -1,i1;\n if(i==-1){ \n i = 0; \n i1= 0;\n }\n else i1 = i + 1;\n for (int k = i; k < s1; k++){\n if(s[k]==t[j]){\n if(j < s2-1){\n int temp = val(s,t,k+1,j+1);\n if(temp!=-1){\n if(temp > k-i1) max1 = temp;\n else max1 = k-i1;\n }\n else max1 = -1;\n if(max1> max) max = max1;\n }\n else{\n if(k - i1 > s1-k-1) max1 = k - i1;\n else max1 = s1 -k -1;\n if (max1 > max) max = max1;\n }\n }\n }\n return max;\n}\n\nint main()\n{\n char s[201],t[201];\n scanf(\"%s\",s);\n scanf(\"%s\",t);\n s1= strlen(s);\n s2= strlen(t);\n if(!strcmp(s,t)) printf(\"0\");\n else printf(\"%d\",val(s,t,-1,0));\n}"}, {"source_code": "#include \n#include \n#include \n\nint s1,s2;\n\nint val(char s[], char t[], int i, int j)\n{\n int max1 = -1,max = -1;\n for (int k = i; k < s1; k++){\n if(s[k]==t[j]){\n if(j < s2-1){\n int temp = val(s,t,k+1,j+1);\n if(temp!=-1){\n if(temp > k-i) max1 = temp;\n else max1 = k-i;\n }\n else break;\n if(max1> max) max = max1;\n }\n else{\n if(k - i > s1-k-1) max1 = k - i;\n else max1 = s1 -k -1;\n if (max1 > max) max = max1;\n }\n }\n if(max >= s2-s1) return max;\n }\n return max;\n}\n\nint main()\n{\n char s[201],t[201];\n scanf(\"%s\",s);\n scanf(\"%s\",t);\n s1= strlen(s);\n s2= strlen(t);\n if(!strcmp(s,t)) printf(\"0\");\n else printf(\"%d\",val(s,t,0,0));\n}"}, {"source_code": "#include \n#include \n#include \n \nint s1,s2,dp[200000][3];\n \nint val(char s[], char t[], int i, int j)\n{\n int max1 = -1,max2=-1,max[2] = {-1,-1, i};\n if(i max[0] && max1> max[1])|| (max2 > max[0]&& max2>max[1])) {\n max[0] = max1;\n max[1] = max2;\n max[2] = k;\n }\n \n }\n else{\n max1 = k - i;\n max2 = s1 -k -1;\n if((max1> max[0] && max1> max[1])|| (max2 > max[0]&& max2>max[1])) {\n max[0] = max1;\n max[1] = max2;\n max[2] = k;\n }\n }\n }\n if(max[0] >= s1-s2){\n dp[j][0] = max[0];\n dp[j][1] = max[1];\n dp[j][2] = max[2];\n return max[0];\n } \n if(max[1] >= s1-s2){\n dp[j][0] = max[0];\n dp[j][1] = max[1];\n dp[j][2] = max[2];\n return max[1];\n }\n }\n dp[j][0] = max[0];\n dp[j][1] = max[1];\n dp[j][2] = max[2];\n if(max[0] > max[1]) return max[0];\n else return max[1];\n}\n \nint main()\n{\n char s[200001],t[200001];\n scanf(\"%s\",s);\n scanf(\"%s\",t);\n for(int i=0;i< 3; i++){\n for(int j=0;j< 200000; j++) dp[j][i] = -2;\n }\n s1= strlen(s);\n s2= strlen(t);\n printf(\"%d\",val(s,t,0,0));\n}\n"}, {"source_code": "#include\n#include\n#include\nint main()\n{\n int len1,len2,k,max=0,i,j,pan=0;\n char s[99999],t[99999];\n int p=0;\n scanf(\"%s\",s);\n scanf(\"%s\",t);\n len1=strlen(s);\n len2=strlen(t);\n int start[10],last[10];\n if(len1==len2)\n {\n max=0;\n pan=1;\n }\n else\n {\n for(i=0; i\n#include\n#include\nint main()\n{\n int len1,len2,k,max=0,i,j;\n char s[99999],t[99999];\n int p=0;\n scanf(\"%s\",s);\n scanf(\"%s\",t);\n len1=strlen(s);\n len2=strlen(t);\n int start[10],last[10];\n if(len1==len2)\n max=0;\n else\n {\n for(i=0;i\n#include\n#include\nint main()\n{\n int len1,len2,k,max=0,i,j,pan=0;\n char s[99999],t[99999];\n int p=0;\n scanf(\"%s\",s);\n scanf(\"%s\",t);\n len1=strlen(s);\n len2=strlen(t);\n int start[10],last[10];\n if(len1==len2)\n {\n max=0;\n pan=1;\n }\n else\n {\n for(i=0; i\n#include\n#include\nint max(int a,int b)\n{\n if(a>b)\n return a;\n else\n return b;\n}\nint main()\n{\n int len1,len2,k,mx=0,i,j;\n char s[200000],t[200000];\n int p=0,q=0;\n scanf(\"%s\",s);\n scanf(\"%s\",t);\n len1=strlen(s);\n len2=strlen(t);\n int a[200000];\n int b[200000];\n for(int i = 0, j = 0; i < len1&& j < len2; ++i)\n if(s[i] == t[j])\n a[j++] = i;\n for(int i = len1 - 1, j = len2 - 1; i >= 0 && j >= 0; --i)\n if(s[i] == t[j])\n b[j--] = i;\n mx = max(mx,b[0]);\n mx = max(mx,len1 - a[len2-1] - 1);\n for(int i = 1; i < len2; i++)\n mx = max(mx,b[i] - a[i-1] - 1);\n printf(\"%d\",mx);\n return 0;\n}"}, {"source_code": "#include\n#include\n#include\nint max(int a,int b)\n{\n if(a>b)\n return a;\n else\n return b;\n}\nint main()\n{\n int len1,len2,k,mx=0,i,j;\n char s[200000],t[200000];\n int p=0,q=0;\n scanf(\"%s\",s);\n scanf(\"%s\",t);\n len1=strlen(s);\n len2=strlen(t);\n if(len2==0)\n {\n printf(\"%d\",len1);\n return 0;\n }\n int a[200000];\n int b[200000];\n for(int i = 0, j = 0; i < len1&& j < len2; ++i)\n if(s[i] == t[j])\n a[j++] = i;\n for(int i = len1 - 1, j = len2 - 1; i >= 0 && j >= 0; --i)\n if(s[i] == t[j])\n b[j--] = i;\n mx = max(mx,b[0]);\n mx = max(mx,len1 - a[len2-1] - 1);\n for(int i = 1; i < len2; i++)\n mx = max(mx,b[i] - a[i-1] - 1);\n if(mx==11)\n printf(\"200000\");\n else\n printf(\"%d\",mx);\n return 0;\n}"}, {"source_code": "#include\n#include\n#include\nint max(int a,int b)\n{\n if(a>b)\n return a;\n else\n return b;\n}\nint main()\n{\n int len1,len2,k,mx=0,i,j;\n char s[200000],t[200000];\n int p=0,q=0;\n scanf(\"%s\",s);\n scanf(\"%s\",t);\n len1=strlen(s);\n len2=strlen(t);\n if(len2==0)\n {\n printf(\"%d\",len1);\n return 0;\n }\n int a[200000];\n int b[200000];\n for(int i = 0, j = 0; i < len1&& j < len2; ++i)\n if(s[i] == t[j])\n a[j++] = i;\n for(int i = len1 - 1, j = len2 - 1; i >= 0 && j >= 0; --i)\n if(s[i] == t[j])\n b[j--] = i;\n mx = max(mx,b[0]);\n mx = max(mx,len1 - a[len2-1] - 1);\n for(int i = 1; i < len2; i++)\n mx = max(mx,b[i] - a[i-1] - 1);\n printf(\"%d\",mx);\n return 0;\n}"}], "src_uid": "0fd33e1bdfd6c91feb3bf00a2461603f"} {"nl": {"description": "Mary has just graduated from one well-known University and is now attending celebration party. Students like to dream of a beautiful life, so they used champagne glasses to construct a small pyramid. The height of the pyramid is n. The top level consists of only 1 glass, that stands on 2 glasses on the second level (counting from the top), then 3 glasses on the third level and so on.The bottom level consists of n glasses.Vlad has seen in the movies many times how the champagne beautifully flows from top levels to bottom ones, filling all the glasses simultaneously. So he took a bottle and started to pour it in the glass located at the top of the pyramid.Each second, Vlad pours to the top glass the amount of champagne equal to the size of exactly one glass. If the glass is already full, but there is some champagne flowing in it, then it pours over the edge of the glass and is equally distributed over two glasses standing under. If the overflowed glass is at the bottom level, then the champagne pours on the table. For the purpose of this problem we consider that champagne is distributed among pyramid glasses immediately. Vlad is interested in the number of completely full glasses if he stops pouring champagne in t seconds.Pictures below illustrate the pyramid consisting of three levels. ", "input_spec": "The only line of the input contains two integers n and t (1 ≤ n ≤ 10, 0 ≤ t ≤ 10 000) — the height of the pyramid and the number of seconds Vlad will be pouring champagne from the bottle.", "output_spec": "Print the single integer — the number of completely full glasses after t seconds.", "sample_inputs": ["3 5", "4 8"], "sample_outputs": ["4", "6"], "notes": "NoteIn the first sample, the glasses full after 5 seconds are: the top glass, both glasses on the second level and the middle glass at the bottom level. Left and right glasses of the bottom level will be half-empty."}, "positive_code": [{"source_code": "#include\n#include\n\n\n\nint main() {\n\n int i, j, count, rcount, n, t, index;\n float extra;\n\n scanf(\"%d %d\", &rcount, &t);\n n = rcount*(rcount+1)/2;\n\n float *arr = (float *)malloc(n*sizeof(float));\n\n for(i=0; i 1) {\n extra = arr[index]-1;\n arr[index] = 1;\n arr[index+i+1] += extra/2;\n arr[index+i+1+1] += extra/2;\n }\n }\n }\n //Last row\n for(j=0; j<=i; j++) {\n if(arr[++index] > 1) {\n extra = arr[index]-1;\n arr[index] = 1;\n //arr[index+i+1] += extra/2;\n //arr[index+i+1+1] += extra/2;\n }\n }\n\n count=0;\n for(i=0; i\n#include\n\n\n\nint main() {\n\n int i, j, count, rcount, n, t, index;\n float extra;\n\n scanf(\"%d %d\", &rcount, &t);\n n = rcount*(rcount+1)/2;\n\n float *arr = (float *)malloc(n*sizeof(float));\n\n for(i=0; i 1) {\n extra = arr[index]-1;\n arr[index] = 1;\n arr[index+i+1] += extra/2;\n arr[index+i+1+1] += extra/2;\n }\n }\n }\n //Last row\n for(j=0; j<=i; j++) {\n if(arr[++index] > 1) {\n extra = arr[index]-1;\n arr[index] = 1;\n //arr[index+i+1] += extra/2;\n //arr[index+i+1+1] += extra/2;\n }\n }\n\n count=0;\n for(i=0; i\n#include\n\nint findLChild(int n) {\n int i, levelNo, nCopy;\n nCopy = n;\n n++;\n levelNo = 0;\n do {\n levelNo++;\n n -= levelNo;\n }while(n>0);\n return nCopy+levelNo;\n}\n\nvoid pour(float *arr, int n, int glassNo, float quant) {\n\n if(glassNo <= n-1) {\n arr[glassNo] += quant;\n if(arr[glassNo] > 1) {\n float extra = arr[glassNo] - 1;\n arr[glassNo] = 1;\n int lChild = findLChild(glassNo);\n pour(arr, n, lChild, extra/2);\n pour(arr, n, lChild+1, extra/2);\n }\n }\n\n}\n\nint main() {\n\n int i, count, flag, n, t;\n float lower, upper, quant, quantc;\n\n scanf(\"%d%d\", &n, &t);\n n = n*(n+1)/2;\n\n float *arr = (float *)malloc(n*sizeof(float));\n\n for(i=0; i\n#include\n\nint main(void)\n{\n\tint n, t;\n\tscanf(\"%d%d\", &n, &t);\n\tdouble vol[n][n];\n\tint i, j, count = 0;\n\tfor(i = 0; i < n; i++)\n\t{\n\t\tfor(j = 0; j <= i; j++)\n\t\t{\n\t\t\tvol[i][j] = 0;\n\t\t}\n\t}\n\tvol[0][0] = t;\n\tfor(i = 0; i < n - 1; i++)\n\t{\n\t\tfor(j = 0; j <= i; j++)\n\t\t{\n\t\t\tif(vol[i][j] >= 1.0)\n\t\t\t{\n\t\t\t\tvol[i + 1][j] = vol[i + 1][j] + (vol[i][j] - 1.0)/2.0;\n\t\t\t\tvol[i + 1][j + 1] = vol[i + 1][j + 1] + (vol[i][j] - 1.0)/2.0;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t}\n\tfor(j = 0; j <= i; j++)\n\t{\n\t\tif(vol[i][j] >= 1.0)\n\t\t{\n\t\t\tcount++;\n\t\t}\n\t}\n\tprintf(\"%d\\n\", count);\n\treturn 0;\n}"}, {"source_code": "#include\n#include\n#define MAXN 11\n\ndouble a[MAXN][MAXN];\nconst double eps=1e-5;\nint n;\n\nvoid dfs(int r,int c,double v)\n{\n if(r==n+1)return ;\n if(fabs(v)=1.0)\n {\n dfs(r+1,c,v/2);\n dfs(r+1,c+1,v/2);\n }\n else\n {\n if(a[r][c]+v+eps<1.0)a[r][c]+=v;\n else\n {\n dfs(r+1,c,(v-(1-a[r][c]))/2);\n dfs(r+1,c+1,(v-(1-a[r][c]))/2);\n a[r][c]=1.0;\n }\n }\n}\n\nint main()\n{\n int i,j,cnt;\n double t;\n\n scanf(\"%d%lf\",&n,&t);\n for(i=0;i=1.0)cnt++;\n printf(\"%d\\n\",cnt);\n\n return 0;\n}\n"}, {"source_code": "#include\ndouble a[100][100]={0};\nint n,t;\nvoid add(int i,int j,double k)\n{\n\tif(i>=n || j>=n)\n\treturn;\n\tif(a[i][j]==1.0)\n\t{\n\t\tadd(i+1,j,k/2.0);\n\t\tadd(i+1,j+1,k/2.0);\n\t}\n\telse\n\ta[i][j]+=k;\n}\nint main()\n{\n\tscanf(\"%d%d\",&n,&t);\n\tint s=0,i,j;\n\twhile(t--)\n\t{\n\t\tadd(0,0,1.0);\n\t}\n\tfor(i=0;i<10;i++)\n\tfor(j=0;j<10;j++)\n\tif(a[i][j]==1.0)\n\ts++;\n\tprintf(\"%d\\n\",s);\n\treturn 0;\n}"}, {"source_code": "#include \n\nint A[10][10];\n\nint main()\n{\n int N, T;\n scanf(\"%d %d\", &N, &T);\n while(T--) {\n A[0][0] += 512;\n for(int i = 0; i < N - 1; ++i) {\n for(int j = 0; j <= i; ++j) {\n if(A[i][j] > 512) {\n int val = A[i][j] - 512;\n A[i + 1][j] += val / 2;\n A[i + 1][j + 1] += val / 2;\n A[i][j] = 512;\n }\n }\n }\n }\n int ans = 0;\n for(int i = 0; i < N; ++i) {\n for(int j = 0; j <= i; ++j) {\n if(A[i][j] >= 512) {\n ++ans;\n }\n }\n }\n printf(\"%d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "//题目是有趣的\n//就是说在t秒的时候有多少是满的!\n#include\n#define N 10\nint main() {\n int n,t;\n scanf(\"%d%d\",&n,&t);\n double pyramid[N][N];\n int i,j;\n for(i=0;i1){\n double more=pyramid[i][j]-1;\n pyramid[i][j]=1;\n pyramid[i+1][j]+=(more/2.0);\n pyramid[i+1][j+1]+=(more/2.0);\n }\n }\n }\n }\n int glass=0;\n for(i=0;i=1.0){\n glass++;\n }\n }\n //printf(\"\\n\");\n }\n\n printf(\"%d\\n\",glass);\n\treturn 0;\n}\n"}, {"source_code": "#include\ntypedef unsigned u;\nu G[22][22];\nint main()\n{\n\tu n,t,i,j,k;\n\tscanf(\"%u%u\",&n,&t);\n\twhile(t--)\n\t{\n\t\tG[0][0]+=1024;\n\t\tfor(i=-1;++i1024)\n\t\t\t{\n\t\t\t\tk=G[i][j]-1024;\n\t\t\t\tG[i][j]=1024;\n\t\t\t\tk>>=1;\n\t\t\t\tG[i+1][j]+=k;\n\t\t\t\tG[i+1][j+1]+=k;\n\t\t\t}\n\t\t}\n\t}\n\tfor(i=-1,k=0;++i=1?t++,M[i+1][j]+=(M[i][j]-1)/2,M[i+1][j+1]+=(M[i][j]-1)/2,M[i][j]=1:0;\n printf(\"%d\\n\",t);\n}\n/*2017-10-19 20:54:02.784*/"}, {"source_code": "#include\ndouble M[15][15],v;\nint n,t,i,j;\nmain()\n{\n scanf(\"%d%lf\",&n,M);\n for(;i=1?t++,M[i+1][j]+=v=(M[i][j]-1)/2,M[i+1][j+1]+=v:0;\n printf(\"%d\\n\",t);\n}\n/*2017-10-19 20:58:05.394*/"}, {"source_code": "n,t,i,j;\nfloat M[15][15],v;\nmain()\n{\n scanf(\"%d%f\",&n,M);\n for(;i=1?t++,M[i+1][j]+=v=(M[i][j])/2,M[i+1][j+1]+=v:0;\n printf(\"%d\",t);\n}\n/*2017-10-19 21:10:13.001*/"}, {"source_code": "double M[15][15], k;\nint n, t, i, j, A;\nmain()\n{\n\n scanf(\"%d%d\", &n, &t);\n M[1][1]=t;\n for(i=1; i<=n; i++)\n for(j=1; j<=i; j++)\n if(M[i][j]>=1)\n k=M[i][j]-1, A++, M[i+1][j]+=k/2, M[i+1][j+1]+=k/2, M[i][j]=1;\n printf(\"%d\\n\", A);\n}\n/*2017-10-19 20:42:13.316*/"}, {"source_code": "#include \n#include \n#define INF 2000000000\n#ifdef ONLINE_JUDGE\n#define ILL(x) scanf(\"%I64d\", &(x));\n#define OLL(x) printf(\"%I64d\", x);\n#else\n#define ILL(x) scanf(\"%lld\", &(x));\n#define OLL(x) printf(\"%lld\", x);\n#endif\n\nint gl[11][11];\n\nint main() {\n\tint n, t, r=0;\n\tscanf(\"%d%d\", &n, &t);\n\tgl[0][0] = t << 10;\n\tfor(int i=0 ; i= 1024) {\n\t\t\t\tgl[i+1][j] += (gl[i][j] - 1024) >> 1;\n\t\t\t\tgl[i+1][j+1] += (gl[i][j] - 1024) >> 1;\n\t\t\t\tr++;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\\n\", r);\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n#include \nint main() {\n int n,i,t,j,totglasses,k;\n scanf(\"%d %d\",&n,&t);\n totglasses = (n*(n+1))/2;\n double howfull[20][20];\n double howfall[20][20];\n int pascal[20][20];\n for(i=0;i<20;i++)\n {\n for(j=0;j<20;j++)\n {\n howfull[i][j] = 0;howfall[i][j] = 0;\n pascal[i][j] = 0;\n }\n }\n pascal[0][0] = 1;\n for(i=0;i<12;i++)\n {\n for(j=0;j<=i;j++)\n {\n pascal[i+1][j] += pascal[i][j];\n pascal[i+1][j+1] += pascal[i][j];\n }\n }\n if(t==0)\n {\n printf(\"0\\n\");\n return 0;\n }\n else if(t==1)\n {\n printf(\"1\\n\");\n return 0;\n }\n else\n {\n howfull[0][0] = 1;\n for(i=1;i=0.00000001)\n {\n howfull[j][k] += howfall[j][k];\n if(1-howfull[j][k]<=0.00000001)\n {\n howfall[j+1][k] += (howfull[j][k] - 1)/2;\n howfall[j+1][k+1] += (howfull[j][k] - 1)/2;\n howfull[j][k]=1;\n }\n \n howfall[j][k]=0;\n }\n }\n }\n }\n int ans=0;\n for(j=0;j\nlong double arr[100]={0};\nint n;\nvoid add(int ind,long double value,int level)\n{\n\tif(arr[ind]+value>1)\n\t{\n\t\tif(ind+level<=(n*(n+1))/2)\n\t\tadd(ind+level,(arr[ind]+value-1)/2,level+1);\n\t\telse\n\t\t\treturn;\n\t\tif(ind+level+1<=(n*(n+1)/2))\n\t\tadd(ind+level+1,(arr[ind]+value-1)/2,level+1);\n\t\telse\n\t\t\treturn ;\n\t}\n\telse\n\t{\n\t\tarr[ind]=arr[ind]+value;\n\t\treturn;\n\t}\n}\nint main()\n{\n\tint i,t,count=0;\n\tscanf(\"%d %d\",&n,&t);\n\tfor(i=0;i\nint main(void)\n{\n int level, time, i, j, glass=0;\n float pour[12][12]={0};\n scanf(\"%d%d\",&level,&time);\n pour[1][1] = time;\n for(i=1;i<=level;i++)\n {\n for(j=1;j<=i;j++)\n {\n if(pour[i][j]>=1){\n pour[i+1][j] += (pour[i][j]-1)/2;\n pour[i+1][j+1] += (pour[i][j]-1)/2;\n glass++;\n } \n } \n } \n printf(\"%d\",glass);\n return 0; \n} "}, {"source_code": "#include\n#include\ndouble a[10][10];\nint n;\nvoid dd(int x,int y,double t)\n{\n\ta[x][y]+=t;\n\tif(a[x][y]>1)\n\t{\n\t\tdouble num=(a[x][y]-1)/2;\n\t\ta[x][y]=1;\n\t\tint tx=x+1;\n\t\tint ty=y+1;\n\t\tif(tx\ndouble a[12][12];\nint main(){\n\tint n,t,i,j,count=0;\n\tscanf(\"%d%d\",&n,&t);\n\ta[1][1]=t;\n\tfor(i=1;i<=n;i++){\n\t\tfor(j=1;j<=i;j++){\n\t\t\tif(a[i][j]>=1){\n\t\t\t\ta[i+1][j] += (a[i][j]-1)/2;\n\t\t\t\ta[i+1][j+1] += (a[i][j]-1)/2;\n\t\t\t\tcount++;\n\t\t\t}\t\t\n\t\t}\n\t}\n\tprintf(\"%d\\n\",count);\n}\t\n"}, {"source_code": "//\n// main.c\n// 160525 CF-B\n//\n// Created by tjua on 5/25/16.\n// Copyright © 2016 tjua. All rights reserved.\n//\n\n#include \n\nint main(int argc, const char * argv[]) {\n // insert code here...\n \n int n, t, count = 0;\n double a[12][12] = {0}, k;\n int i, j;\n// struct node{\n// //no.\n// int s; // 10 bits\n// int\n// };\n// \n\n // true baolo\n scanf(\"%d%d\", &n, &t);\n \n a[1][1]=t;\n for (i=1;i<=n;i++) {\n for (j=1;j<=i;j++) {\n if (a[i][j]>1-0.00001){\n count++;\n k=(a[i][j]-1)/2;\n a[i+1][j]+=k;\n a[i+1][j+1]=k;\n }\n }\n }\n \n printf(\"%d\\n\",count);\n \n // printf(\"Hello, World!\\n\");\n return 0;\n}\n"}, {"source_code": "#include\n#include\nfloat a[11][11]={0.0};\nint count=0;\nvoid recur(int m,int n,int limit,int time){\n int i;\n if(m==limit){\n return;\n }\n else{\n if(a[m][n]==1){\n recur(m+1,n,limit,time);\n recur(m+1,n+1,limit,time);\n }\n else if(a[m][n]<1){\n a[m][n]+=pow(2.0,-1*m);\n } \n }\n}\nint main(){\n int i,j,k,n,t;\n scanf(\"%d%d\",&n,&t);\n for(i=1;i<=t;i++){\n recur(0,0,n,t);\n }\n for(i=0;i=1?t++,M[i+1][j++]+=v=M[i][j]/2,M[i+1][j]+=v:j++;\n printf(\"%d\",t);\n}\n/*2017-10-19 21:16:22.949*/"}, {"source_code": "n,t,i,j;\nfloat M[10][10],v;\nmain()\n{\n scanf(\"%d%f\",&n,M);\n for(;i=1?t++,M[i+1][j++]+=v=M[i][j]/2,M[i+1][j]+=v:j++;\n printf(\"%d\",t);\n}\n/*2017-10-19 21:35:24.639*/"}, {"source_code": "#include\ndouble M[15][15],v;\nint n,t,i,j;\nmain()\n{\n scanf(\"%d%lf\",&n,*M);\n for(;i=1?t++,M[i+1][j]+=v=(M[i][j]-1)/2,M[i+1][j+1]+=v:0;\n printf(\"%d\\n\",t);\n}\n/*2017-10-19 20:57:02.258*/"}, {"source_code": "n,t,i,j;\nfloat M[15][15],v;\nmain()\n{\n scanf(\"%d%f\",&n,M);\n for(;i=1?t++,M[i+1][j]+=v=(M[i][j]-1)/2,M[i+1][j+1]+=v:0;\n printf(\"%d\",t);\n}/*2017-10-19 21:08:01.557*/"}, {"source_code": "n,t,i,j;\ndouble M[15][15],v;\nmain()\n{\n scanf(\"%d%lf\",&n,M);\n for(;i=1?t++,M[i+1][j]+=v=(M[i][j]-1)/2,M[i+1][j+1]+=v:0;\n printf(\"%d\",t);\n}\n/*2017-10-19 21:01:18.62*/"}, {"source_code": "#include \n#include \n#include \n#include \n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint n, t;\ndouble ar[15][15];\n\nvoid pour(int i, int j){\n if (i > n) return;\n if (ar[i][j] > 1.0){\n double x = (ar[i][j] - 1.0) / 2.0;\n ar[i + 1][j] += x, ar[i + 1][j + 1] += x;\n pour(i + 1, j);\n pour(i + 1, j + 1);\n ar[i][j] = 1.0;\n }\n}\n\nint main(){\n int i, j, k, l, res;\n\n while (scanf(\"%d %d\", &n, &t) != EOF){\n clr(ar);\n while (t--){\n ar[1][1] += 1.0;\n pour(1, 1);\n }\n\n res = 0;\n for (i = 1; i <= n; i++){\n for (j = 1; j <= i; j++){\n if (fabs(ar[i][j] - 1.0) <= 1e-9) res++;\n }\n }\n\n printf(\"%d\\n\", res);\n }\n return 0;\n}\n"}, {"source_code": "#include\nint level[100];\nint solve(float a[],int num,int index,float amount)\n{\n float bcha;\n int lev;\n if(index>num)\n return 0;\n if(amount<=0)\n return 0;\n if(a[index]+amount<=1)\n {\n a[index]=a[index]+amount;\n return 0;\n }\n else\n {\n bcha=a[index]+amount-1;\n lev=level[index];\n solve(a,num,index+lev,bcha/2);\n solve(a,num,index+lev+1,bcha/2);\n }\n\nreturn 0;\n}\nint main()\n{\n int i,j,k,n,m,sum,sum1,l,num,t,ans,nl;\n sum=1;\n n=1;\n sum1=(n*(n+1))/2;\n l=1;\n while(i<=60)\n {\n level[sum]=l;\n sum++;\n if(sum>sum1)\n {\n n++;\n sum1=(n*(n+1))/2;\n l++;\n }\n i++;\n }\n scanf(\"%d%d\",&nl,&t);\n num=(nl*(nl+1))/2;\n float a[100]={0};\n for(i=1;i<=t;i++)\n solve(a,num,1,1);\n ans=0;\n for(i=1;i<=num;i++)\n {\n if(a[i]>=1.00)\n ans++;\n }\n printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int n,t,num,i,j,k;\n while( scanf(\"%d %d\",&n,&t)!=EOF ) {\n num=0;\n double a[n][n];\n for(i=0;i1 ) a[j][k]=1;\n }\n else {\n if(a[j][k]>1) {\n a[j+1][k] += (a[j][k]-1)/2.0;\n a[j+1][k+1] += (a[j][k]-1)/2.0;\n a[j][k] = 1;\n }\n }\n }\n }\n }\n for(i=0;i\n\nint a[11][11],n,t;\n\nvoid pour(int pr,int b,int c)\n{\n\tif(pr==0||b==n) return;\n\ta[b][c]+=pr;\n\tif(a[b][c]>1024)\n\t{\n\t\tpr=a[b][c]-1024;\n\t\ta[b][c]=1024;\n\t}\n\t\n\telse pr=0;\n\t\n\tpour(pr/2,b+1,c);\n\tpour(pr/2,b+1,c+1);\n\t\n\treturn;\n\t\n\t\n}\n\n\nint main(void) {\n\n\tint i=0,ans=0;\n\t\n\twhile(i<11)\n\t{\n\t\tint j=0;\n\t\twhile(j<11)\n\t\t{\n\t\t\ta[i][j]=0;\n\t\t\tj++;\n\t\t}\n\t\ti++;\n\t}\n\ti=0;\n\t\n\tscanf(\"%d %d\",&n,&t);\n\t\n\t\n\ti=0;\n\t\n\twhile(t--)\n\t{\n\t\tpour(1024,0,0);\n\t}\n\t\n\twhile(i<11)\n\t{\n\t\tint j=0;\n\t\twhile(j<11)\n\t\t{\n\t\t\t\n\t\t\tif(a[i][j]==1024) ans++;\n\t\t\tj++;\n\t\t}\n\t\ti++;\n\t\t\n\t}\n\t\n\tprintf(\"%d\",ans);\n\t\n\treturn 0;\n}\n"}, {"source_code": "double M[15][15],v;\nint n,t,i,j;\nmain()\n{\n scanf(\"%d%d\",&n,&t);\n for(**M=t,t=0;i=1?t++,M[i+1][j]+=v=(M[i][j]-1)/2,M[i+1][j+1]+=v:0;\n printf(\"%d\\n\",t);\n}/*2017-10-19 20:55:06.722*/"}, {"source_code": "n,t,i,j;\ndouble M[15][15],v;\nmain()\n{\n scanf(\"%d%lf\",&n,M);\n for(;i=1?t++,M[i+1][j]+=v=(M[i][j]-1)/2,M[i+1][j+++1]+=v:j++;\n printf(\"%d\",t);\n}\n/*2017-10-19 21:04:37.163*/"}, {"source_code": "n,t,i,j;\nfloat M[15][15],v;\nmain()\n{\n scanf(\"%d%f\",&n,M);\n for(;i=1?t++,M[i+1][j++]+=v=M[i][j]/2,M[i+1][j]+=v:j++;\n printf(\"%d\",t);\n}/*2017-10-19 21:22:01.794*/"}, {"source_code": "#include\n#define MAXLEVEL 20\n\nint main()\t{\n\tdouble cup[MAXLEVEL][MAXLEVEL], temp;\n\tint n, i, j, m;\n\tscanf(\"%d %lf\", &n, &cup[0][0]);\t\n\tfor(i=1; i1.00)\ttemp+=(cup[i-1][j-1]-1.00)/2.00;\n\t\t\tif(cup[i-1][j]>1.00)\ttemp+=(cup[i-1][j]-1.00)/2.00;\n\t\t\tcup[i][j] = temp;\n\t\t}\n\tfor(i=0, m=0; i=1.00)\tm++;\n\tprintf(\"%d\",m);\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n#define size_cup (sizeof(__cup))\n\nstruct st_cup\t{\n\tdouble filled_vol;\n\tstruct st_cup *rightBro;\n\tstruct st_cup *left;\n\tstruct st_cup *right;\n};\ntypedef struct st_cup __cup;\n\nint maxLevel;\nint maxCup;\nint m;\n\nint create_tree(__cup *node, int level)\t{\n\t__cup *temp;\n\tif(level == maxLevel)\n\t\treturn 0;\n\ttemp = (__cup *)malloc(size_cup);\n\ttemp->filled_vol = 0.00;\n\ttemp->left = NULL;\n\ttemp->right = NULL;\n\tnode->left = temp;\n\tif(node->rightBro == NULL)\t{\n\t\ttemp = (__cup *)malloc(size_cup);\n\t\ttemp->filled_vol = 0.00;\n\t\ttemp->rightBro = NULL;\n\t\ttemp->right = NULL;\n\t\ttemp->left = NULL;\n\t\tnode->right = temp;\n\t\tnode->left->rightBro = node->right;\n\t}\n\telse\t{\n\t\tnode->right = node->rightBro->left;\n\t\tnode->left->rightBro = node->right;\n\t}\n\tlevel++;\n\tcreate_tree(node->right, level);\n\tcreate_tree(node->left, level);\n\treturn 0;\n}\n\nint show_tree(__cup *head)\t{\n\t__cup *temp, *ttemp;\n\ttemp = head;\n\tint i, j;\n\twhile(temp)\t{\n\t\tttemp = temp;\tj = 1;\n\t\twhile(ttemp)\t{\n\t\t\tprintf(\"%d \",j++);\n\t\t\tttemp = ttemp->rightBro;\n\t\t}\n\t\tputs(\"\");\n\t\ttemp = temp->left;\n\t}\n\treturn 0;\n}\n\nint free_tree(__cup *head)\t{\n\t__cup *temp, *ttemp, *saveLeft, *saveRightBro;\n\tint i = 0;\n\ttemp = head;\n\twhile(temp)\t{\n\t\tsaveLeft = temp->left;\n\t\tttemp = temp;\n\t\twhile(ttemp)\t{\ti++;\n\t\t\tsaveRightBro = ttemp->rightBro;\n\t\t\tfree(ttemp);\n\t\t\tttemp = saveRightBro;\n\t\t}\n\t\ttemp = saveLeft;\n\t}\n\t\n\treturn i;\n}\n\nint manage(__cup *node, double fa)\t{\n\t__cup *temp;\n\n\tif(m == maxCup)\treturn 0;\n\tif(node->filled_vol < 1.00)\t{\n\t\tnode->filled_vol += fa;\n\t\tfa = 0.00;\n\t\tif(node->filled_vol >= 1.00)\t{\n\t\t\tm++;\n\t\t\tfa = node->filled_vol - 1.00;\n\t\t}\n\t}\n\tif(fa>0.00)\t{\n\t\tif(node->left!=NULL)\tmanage(node->left, (fa/2.00));\n\t\tif(node->right!=NULL)\tmanage(node->right, (fa/2.00));\n\t}\n\treturn 0;\n}\n\nint main()\t{\n\t__cup *head;\n\tint i, time;\n\n\tm = 0;\t\n\tscanf(\"%d %d\", &maxLevel, &time);\n\tmaxCup = maxLevel*(maxLevel+1)/2;\n//\tprintf(\"maxCup: %d\\n\",maxCup);\n\thead = (__cup *)malloc(size_cup);\n\thead->rightBro = NULL;\n\thead->left = head->right = NULL;\n\tcreate_tree(head, 1);\n\tfor(i = 0; i\n#include\n#define size_cup (sizeof(__cup))\n\nstruct st_cup\t{\n\tdouble filled_vol;\n\tstruct st_cup *rightBro;\n\tstruct st_cup *left;\n\tstruct st_cup *right;\n};\ntypedef struct st_cup __cup;\nint maxLevel, maxCup, m;\n\nint create_tree(__cup *node, int level)\t{\n\t__cup *temp;\n\tif(level == maxLevel)\treturn 0;\n\ttemp = (__cup *)malloc(size_cup);\n\ttemp->filled_vol = 0.00;\ttemp->left = NULL;\ttemp->right = NULL;\n\tnode->left = temp;\n\tif(node->rightBro == NULL)\t{\n\t\ttemp = (__cup *)malloc(size_cup);\n\t\ttemp->filled_vol = 0.00;\ttemp->rightBro = NULL;\n\t\ttemp->right = NULL;\ttemp->left = NULL;\n\t\tnode->right = temp;\n\t\tnode->left->rightBro = node->right;\n\t}\n\telse\t{\n\t\tnode->right = node->rightBro->left;\n\t\tnode->left->rightBro = node->right;\n\t}\n\tlevel++;\n\tcreate_tree(node->right, level);\n\tcreate_tree(node->left, level);\n\treturn 0;\n}\n\nint free_tree(__cup *head)\t{\n\t__cup *temp, *ttemp, *saveLeft, *saveRightBro;\n\ttemp = head;\n\twhile(temp)\t{\n\t\tsaveLeft = temp->left;\t\tttemp = temp;\n\t\twhile(ttemp)\t{\n\t\t\tsaveRightBro = ttemp->rightBro;\tfree(ttemp);\n\t\t\tttemp = saveRightBro;\n\t\t}\n\t\ttemp = saveLeft;\n\t}\n\treturn 0;\n}\n\nint manage(__cup *node, double fa)\t{\n\t__cup *temp;\n\tif(m == maxCup)\treturn 0;\n\tif(node->filled_vol < 1.00)\t{\n\t\tnode->filled_vol += fa;\tfa = 0.00;\n\t\tif(node->filled_vol >= 1.00)\t{\n\t\t\tm++;\tfa = node->filled_vol - 1.00;\n\t\t}\n\t}\n\tif(fa>0.00)\t{\n\t\tif(node->left)\tmanage(node->left, (fa/2.00));\n\t\tif(node->right)\tmanage(node->right, (fa/2.00));\n\t}\n\treturn 0;\n}\n\nint main()\t{\n\t__cup *head;\n\tint i, time;\n\tm = 0;\t\n\tscanf(\"%d %d\", &maxLevel, &time);\n\tmaxCup = maxLevel*(maxLevel+1)/2;\n\thead = (__cup *)malloc(size_cup);\n\thead->rightBro = NULL;\n\thead->left = NULL;\thead->right = NULL;\n\tcreate_tree(head, 1);\n\tmanage(head, (double)time);\n\tprintf(\"%d\\n\", m);\t\n\tfree_tree(head);\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n#define size_cup (sizeof(__cup))\n\nstruct st_cup\t{\n\tdouble filled_vol;\n\tstruct st_cup *rightBro;\n\tstruct st_cup *left;\n\tstruct st_cup *right;\n};\ntypedef struct st_cup __cup;\nint maxLevel, maxCup, m;\n\nint create_tree(__cup *node, int level)\t{\n\t__cup *temp;\n\tif(level == maxLevel)\treturn 0;\n\ttemp = (__cup *)malloc(size_cup);\n\ttemp->filled_vol = 0.00;\ttemp->left = NULL;\ttemp->right = NULL;\n\tnode->left = temp;\n\tif(node->rightBro == NULL)\t{\n\t\ttemp = (__cup *)malloc(size_cup);\n\t\ttemp->filled_vol = 0.00;\ttemp->rightBro = NULL;\n\t\ttemp->right = NULL;\ttemp->left = NULL;\n\t\tnode->right = temp;\n\t\tnode->left->rightBro = node->right;\n\t}\n\telse\t{\n\t\tnode->right = node->rightBro->left;\n\t\tnode->left->rightBro = node->right;\n\t}\n\tlevel++;\n\tcreate_tree(node->right, level);\n\tcreate_tree(node->left, level);\n\treturn 0;\n}\n\nint free_tree(__cup *head)\t{\n\t__cup *temp, *ttemp, *saveLeft, *saveRightBro;\n\ttemp = head;\n\twhile(temp)\t{\n\t\tsaveLeft = temp->left;\t\tttemp = temp;\n\t\twhile(ttemp)\t{\n\t\t\tsaveRightBro = ttemp->rightBro;\tfree(ttemp);\n\t\t\tttemp = saveRightBro;\n\t\t}\n\t\ttemp = saveLeft;\n\t}\n\treturn 0;\n}\n\nint manage(__cup *node, double fa)\t{\n\t__cup *temp;\n\tif(m == maxCup)\treturn 0;\n\tif(node->filled_vol < 1.00)\t{\n\t\tnode->filled_vol += fa;\tfa = 0.00;\n\t\tif(node->filled_vol >= 1.00)\t{\n\t\t\tm++;\tfa = node->filled_vol - 1.00;\n\t\t}\n\t}\n\tif(fa>0.00)\t{\n\t\tif(node->left)\tmanage(node->left, (fa/2.00));\n\t\tif(node->right)\tmanage(node->right, (fa/2.00));\n\t}\n\treturn 0;\n}\n\nint main()\t{\n\t__cup *head;\n\tint i, time;\n\tm = 0;\t\n\tscanf(\"%d %d\", &maxLevel, &time);\n\tmaxCup = maxLevel*(maxLevel+1)/2;\n\thead = (__cup *)malloc(size_cup);\n\thead->rightBro = NULL;\n\thead->left = NULL;\thead->right = NULL;\n\tcreate_tree(head, 1);\n\tfor(i = 0; i\n\nint main(int argc, char const *argv[])\n{\n\tint n, t;\n\tscanf(\"%d %d\", &n, &t);\n\n\tif(t < 1) {\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\n\n\tdouble a[n+1][n+1];\n\tint i, j, k;\n\n\tfor(i = 0; i <= n; ++i) {\n\t\tfor(j = 0; j <= n; ++j) {\n\t\t\ta[i][j] = (double)0;\n\t\t}\n\t}\n\n\tfor(i = 0; i < t; ++i) {\n\t\ta[0][0] += (double)1;\n\t\tfor(j = 0; j < n; ++j) {\n\t\t\tfor(k = 0; k <= j; ++k) {\n\t\t\t\tif(a[j][k] > (double)1) {\n\t\t\t\t\tdouble diff = a[j][k] - (double)1;\n\t\t\t\t\ta[j][k] = (double)1;\n\t\t\t\t\ta[j+1][k] += diff / 2;\n\t\t\t\t\ta[j+1][k+1] += diff / 2;\n\t\t\t\t}\n\t\t\t\t//elapsed_time++;\n\t\t\t}\n\t\t}\n\t}\n\n\tint ans = 0;\n\n\tfor(i = 0; i < n; ++i) {\n\t\tfor(j = 0; j < n; ++j) {\n\t\t\t//printf(\"%lf \", a[i][j]);\n\n\t\t\tif(a[i][j] == (double)1) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\t\t//printf(\"\\n\");\n\t}\n\n\tprintf(\"%d\\n\", ans);\n\n\treturn 0;\n}"}, {"source_code": "#include\n\nstruct node{\n double cup;\n int level;\n};\nstruct node Glass[56+12];\n\nint main()\n{\n int N, T, i, j, count=0, adv;\n double rest;\n for(i=1;i<=11;i++){\n for(j=1;j<=i;j++){\n Glass[count].level=i;\n Glass[count++].cup=0.00;\n }\n }\n scanf(\"%d %d\",&N, &T);\n count=0;\n Glass[0].cup=T;\n for(i=0;Glass[i].level<=N;i++){\n //printf(\">%lf\\n\",Glass[i].cup);\n if(Glass[i].cup>1.00){\n rest=Glass[i].cup-1.00;\n Glass[i].cup=1.00;\n adv=Glass[i].level;\n Glass[i+adv].cup+=rest/2.0;\n Glass[i+adv+1].cup+=rest/2.0;\n }\n if(Glass[i].cup>=1.00) count++;\n }\n printf(\"%d\\n\",count);\n return 0;\n}\n"}, {"source_code": "#include \nlong double arr[100]={0};\nint n;\nvoid add(int ind,long double value,int level)\n{\n\tif(arr[ind]+value>1)\n\t{\n\t\tif(ind+level<=(n*(n+1))/2)\n\t\tadd(ind+level,(arr[ind]+value-1)/2,level+1);\n\t\telse\n\t\t\treturn;\n\t\tif(ind+level+1<=(n*(n+1)/2))\n\t\tadd(ind+level+1,(arr[ind]+value-1)/2,level+1);\n\t\telse\n\t\t\treturn ;\n\t}\n\telse\n\t{\n\t\tarr[ind]=arr[ind]+value;\n\t\treturn;\n\t}\n}\nint main()\n{\n\tint i,t,count=0;\n\tscanf(\"%d %d\",&n,&t);\n\tfor(i=0;i\n\nint n, t;\ndouble arr[11][12];\nint res;\n\nvoid solve(int i, int j, double sum) \n{\n\tif (!j || j > i) return;\n\tif (i > n) return;\n\n\tif (arr[i][j] == 1 && sum > 0)\n\t{\n\t\tsolve(i + 1, j, sum/2);\n\t\tsolve(i + 1, j + 1, sum/2);\n\t}\n\telse arr[i][j] += sum;\n}\nint main() \n{\n\tscanf(\"%d %d\", &n, &t);\n\n\tfor (int i = 0; i < t; i++)\n\t\tsolve(1, 1, 1);\n\n\tfor (int i = 1; i <= n; i++)\n\t\tfor (int j = 1; j <= n; j++)\n\t\t\tif (arr[i][j] == 1) res++;\n\tprintf(\"%d\", res);\n}"}, {"source_code": "#include\nint main()\n{\n\tint n,t,level,ans,i,j,cnt=0;\n\tscanf(\"%d %d\",&n,&t);\n\tdouble arry[12][12];\n\tfor(i=0;i<12;i++)\n\t{\n\t\tfor(j=0;j<12;j++)\n\t\t{\n\t\t\tarry[i][j]=0;\n\t\t}\n\t}\n\tarry[1][1]=t;\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tfor(j=1;j<=i;j++)\n\t\t{\n\t\t\tif(arry[i][j]>=1)\n\t\t\t{\n\t\t\t\tarry[i+1][j]+=(arry[i][j]-1)/2.0;\n\t\t\t\tarry[i+1][j+1]+=(arry[i][j]-1)/2.0;\n\t\t\t\n\t\t\t}\n\t\t}\n\t}\n\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tfor(j=1;j<=i;j++)\n\t\t{\n\t\t\tif(arry[i][j]>=1)\n\t\t\t{\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t}\n\n\n\n\n\tprintf(\"%d\\n\",cnt);\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"}, {"source_code": "#include\ndouble M[15][15],v;\nint n,t,i,j;\nmain()\n{\n scanf(\"%d%d\",&n,&t);\n for(**M=t,t=0;i=1?t++,M[i+1][j]+=v=(M[i][j]-1)/2,M[i+1][j+1]+=v:0;\n printf(\"%d\\n\",t);\n}\n/*2017-10-19 20:54:48.956*/"}, {"source_code": "double M[15][15], k;\nint n, i, j, A;\nmain()\n{\n\n scanf(\"%d%lf\", &n, M);\n for(i=0; i=1)\n k=M[i][j]-1, A++, M[i+1][j]+=k/2, M[i+1][j+1]+=k/2, M[i][j]=1;\n printf(\"%d\\n\", A);\n}\n/*2017-10-19 20:45:18.443*/"}, {"source_code": "n,t,i,j;\nfloat M[15][15],v;\nmain()\n{\n scanf(\"%d%f\",&n,M);\n for(;i=1?t++,M[i+1][j]+=v=M[i][j]/2,M[i+1][j+1]+=v:0;\n printf(\"%d\",t);\n}\n/*2017-10-19 21:11:06.152*/"}, {"source_code": "double M[15][15], k;\nint n, i, j, A;\nmain()\n{\n scanf(\"%d%lf\", &n, M);\n for(; i=1?A++, M[i+1][j]+=k=(M[i][j]-1)/2, M[i+1][j+1]+=k, M[i][j]=1:0;\n printf(\"%d\\n\", A);\n}\n/*2017-10-19 20:58:36.936*/"}, {"source_code": "n,t,i,j;\nfloat M[15][15],v;\nmain()\n{\n scanf(\"%d%f\",&n,M);\n for(;i=1?t++,M[i+1][j++]+=v=M[i][j]/2,M[i+1][j]+=v:j++;\n printf(\"%d\",t);\n}\n/*2017-10-19 21:18:08.064*/"}, {"source_code": "double M[15][15], k;\nint n, i, j, A;\nmain()\n{\n scanf(\"%d%lf\", &n, M);\n for(; i=1?A++, M[i+1][j]+=k=(M[i][j]-1)/2, M[i+1][j+1]+=k:0;\n printf(\"%d\\n\", A);\n}/*2017-10-19 21:02:03.955*/"}, {"source_code": "#include \n#include \n\nint main(void) {\n\tint n, t, g[10][10],\n\t\ttt, i, j, isSpilled, full;\n\t\n\tmemset(g, 0, sizeof(g));\n\t\n\tscanf(\"%d%d\", &n, &t);\n\n\tfor (tt = 0; tt < t; ++tt) {\n\t\tisSpilled = 1;\n\t\ti = 0;\n\t\tg[0][0] += 512;\n\t\twhile (i < n - 1 && isSpilled) {\n\t\t\tisSpilled = 0;\n\t\t\tfor (j = 0; j <= i; ++j)\n\t\t\t\tif (g[i][j] > 512) {\n\t\t\t\t\tg[i + 1][j] += (g[i][j] - 512) / 2;\n\t\t\t\t\tg[i + 1][j + 1] += (g[i][j] - 512) / 2;\n\t\t\t\t\tg[i][j] = 512;\n\t\t\t\t\tisSpilled = 1;\n\t\t\t\t}\n\t\t\t++i;\t\t\t\t\t\n\t\t}\n\t}\n\t\n\tfull = 0;\n\tfor (i = 0; i < n; ++i)\n\t\tfor (j = 0; j <= i; ++j)\n\t\t\tif (g[i][j] >= 512)\n\t\t\t\t++full;\n\t\t\t\t\n\tprintf(\"%d\", full);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint main(){\n int t,n,i,j,k,ans=0;\n float arr[12][12]={0};\n scanf(\"%d %d\",&n,&t);\n for(i=0;i1.0){\n arr[j+1][k]+=(arr[j][k]-1)/2;\n arr[j+1][k+1]+=(arr[j][k]-1)/2;\n arr[j][k]=1;\n }\n }\n for(j=1;j<=n;j++){\n for(k=1;k<=j;k++){\n if(arr[j][k]==1)\n ans++;\n }\n }\n printf(\"%d\\n\",ans);\n return 0;\n}\n\n"}, {"source_code": "#include\n#include\n\ndouble cup[1000][1000];\nint main (){\n int h , t ;\n scanf(\"%d%d\",&h,&t);\n for(int i=0;i=1){\n double x = cup[i][j] - 1;\n cup[i][j] = 1;\n cup[i+1][j]+= x/2.0;\n cup[i+1][j+1]+= x/2.0;\n cnt++;\n }\n }\n }\n printf(\"%d\\n\",cnt);\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint m;\nint child(int *b, int *c, int i, int n){\n return i - b[i] + c[i] + n - 1; \n}\n\nvoid fill(double *a, int *b, int *c, int i, double v){\n if(a[i] + v > 1) {\n a[i] = 1;\n if(child(b, c, i, 1) < m)\n fill(a, b, c, child(b, c, i, 1), (v + a[i] - 1)/2);\n if(child(b, c, i, 2) < m)\n fill(a, b, c, child(b, c, i, 2), (v + a[i] - 1)/2);\n }\n else a[i] = a[i] + v;\n}\n\nint main(){\n int n, g, i, *b, k, *c,count = 0;\n double *a;\n \n scanf(\"%d%d\",&n, &g);\n\n m = (n*(n+1))/2;\n a = (double *)calloc((n*(n+1))/2,sizeof(double));\n b = (int *)calloc((n*(n+1))/2,sizeof(int));\n c = (int *)calloc((n*(n+1))/2,sizeof(int));\n \n k = 1; \n for(i = 0; i < (n*(n+1))/2; i++){\n a[i] = 0;\n if(i > (k*(k+1))/2 - 1) {\n k = k + 1;\n b[i] = ((k-1)*k)/2 - 1;\n c[i] = (k*(k+1))/2 - 1;\n } \n else {\n b[i] = ((k-1)*k)/2 - 1;\n c[i] = (k*(k+1))/2 - 1; \n }\n }\n \n for(i = 0; i < g; i++){\n fill(a, b, c, 0, 1.00);\n }\n\n for(i = 0; i < (n*(n+1))/2; i++) {\n if(a[i] == 1) count++;\n }\n\n printf(\"%d\\n\",count);\n}\n"}, {"source_code": "#include \n\nint main(void) {\n\tint i, j;\n\tint n, t;\n\tint amount[55] = {0}, ans;\n\n\tscanf(\"%d %d\", &n, &t);\n\n\twhile (t--) {\n\t\tamount[0] += 512;\n\t\tfor (i = 0; i < n - 1; i++) {\n\t\t\tconst int cur = i * (i + 1) / 2, next = (i + 1) * (i + 2) / 2;\n\t\t\tfor (j = cur; j < next; j++)\n\t\t\t\tif (amount[j] > 512) {\n\t\t\t\t\tamount[next + j - cur] += (amount[j] - 512) / 2;\n\t\t\t\t\tamount[next + j - cur + 1] += (amount[j] - 512) / 2;\n\t\t\t\t\tamount[j] = 512;\n\t\t\t\t}\n\t\t}\n\t}\n\n\tans = 0;\n\tfor (i = 0; i < n * (n + 1) / 2; i++)\n\t\tans += amount[i] >= 512;\n\n\tprintf(\"%d\\n\", ans);\n\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\ndouble amount[55];\n\nint main(void) {\n\tint i, j;\n\tint n, t;\n\tint ans;\n\n\tscanf(\"%d %d\", &n, &t);\n\n\twhile (t--) {\n\t\tamount[0] += 1.0;\n\t\tfor (i = 0; i < n; i++) {\n\t\t\tconst int cur = i * (i + 1) / 2, next = (i + 1) * (i + 2) / 2;\n\t\t\tfor (j = cur; j < next; j++)\n\t\t\t\tif (amount[j] > 1.0) {\n\t\t\t\t\tamount[next + j - cur] += (amount[j] - 1.0) / 2.0;\n\t\t\t\t\tamount[next + j - cur + 1] += (amount[j] - 1.0) / 2.0;\n\t\t\t\t\tamount[j] = 1.0;\n\t\t\t\t}\n\t\t}\n\t}\n\n\tans = 0;\n\tfor (i = 0; i < n * (n + 1) / 2; i++)\n\t\tans += fabs(amount[i] - 1) < 1e-9;\n\n\tprintf(\"%d\\n\", ans);\n\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n\tdouble t;\n\tint n;\n\tdouble arr[15][15];\n\tint i,j;\n\tscanf(\"%d %lf\",&n,&t);\n\tfor(i=0;i<=n;i++)\n\t\tfor(j=0;j<=n;j++)\n\t\t\tarr[i][j] = 0;\n\ti=1;\n\tint ans = 0;\n\tarr[1][1] = t;\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tfor(j=1;j<=i;j++)\n\t\t{\n\t\t\tif(arr[i][j] >= 1)\n\t\t\t{\n\t\t\t\tarr[i+1][j] += (arr[i][j] - 1)/2.0;\n\t\t\t\tarr[i+1][j+1] += (arr[i][j] - 1)/2.0;\n\t\t\t}\n\t\t}\n\t}\n\tfor(i=1;i<=n;i++)\n\t\tfor(j=1;j<=i;j++)\n\t\t{\n\t\t\tif(arr[i][j] >= 1)\n\t\t\t\tans = ans + 1;\n\t\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \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\ndouble a[15][15] = {0};\n\nint main()\n{\n int n, t;\n scanf(\"%d %d\", &n, &t);\n\n int i, j;\n a[0][0] = t;\n rep(i,1,n)\n {\n a[0][i] = (a[0][i-1] - 1) / 2;\n a[i][0] = a[0][i];\n }\n rep(i,1,n)\n {\n rep(j,1,n)\n {\n if (a[i-1][j]>=1)\n {\n a[i][j] = a[i][j] + (a[i-1][j] - 1) / 2;\n }\n if (a[i][j-1]>=1)\n {\n a[i][j] = a[i][j] + (a[i][j-1] - 1) / 2;\n }\n }\n }\n int results = 0;\n rep(i,0,n)\n {\n rep(j,0,n-i)\n {\n //printf(\"%.1f \", a[i][j]);\n if (a[i][j]>=1)\n {\n results++;\n }\n }\n //printf(\"\\n\");\n }\n\n printf(\"%d\", results);\n return 0;\n}\n"}, {"source_code": "#include \n#define MAXN 11\n\nint n;\ndouble a[MAXN][MAXN] = {{ 0 }};\n\nint main()\n{\n int i, j, ans = 0;\n scanf(\"%d%lf\", &n, &a[0][0]);\n for (i = 0; i < n; ++i) {\n for (j = 0; j <= i; ++j) if (a[i][j] >= 1) {\n a[i + 1][j] += (a[i][j] - 1) / 2;\n a[i + 1][j + 1] += (a[i][j] - 1) / 2;\n a[i][j] = 1;\n ++ans;\n }\n }\n printf(\"%d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "n,t,i,j;\nfloat M[15][15],v;\nmain()\n{\n scanf(\"%d%f\",&n,M);\n for(;i=1?t++,M[i+1][j++]+=v=M[i][j]/2,M[i+1][j]+=v:j++;\n printf(\"%d\",t);\n}\n/*2017-10-19 21:20:06.012*/"}, {"source_code": "double M[15][15], k;\nint n, i, j, A;\nmain()\n{\n scanf(\"%d%lf\", &n, M);\n for(; i=1?k=M[i][j]-1, A++, M[i+1][j]+=k/2, M[i+1][j+1]+=k/2, M[i][j]=1:0;\n printf(\"%d\\n\", A);\n}\n/*2017-10-19 20:53:32.641*/"}, {"source_code": "double M[15][15],v;\nint n,t,i,j;\nmain()\n{\n scanf(\"%d%lf\",&n,*M);\n for(;i=1?t++,M[i+1][j]+=v=(M[i][j]-1)/2,M[i+1][j+1]+=v:0;\n printf(\"%d\\n\",t);\n}\n/*2017-10-19 20:57:10.299*/"}, {"source_code": "n,t,i,j;\nfloat M[15][15],v;\nmain()\n{\n scanf(\"%d%f\",&n,M);\n for(;i=1?t++,M[i+1][j]+=v=M[i][j]/2,M[i+1][j+1]+=v:0;\n printf(\"%d\",t);\n}/*2017-10-19 21:11:39.87*/"}, {"source_code": "#include \n\n\nfloat a[56];\nint b[56];\nint count = 0;\nlong n, t;\n\nvoid pour(int i, int level, float dl){\n if (level > n) return;\n if (a[i] < 1.0) {\n a[i] += dl;\n if (a[i] >= 1) b[i] = 1;\n return;\n }\n pour(i+level,level+1,dl/2);\n pour(i+level+1,level+1,dl/2);\n}\n\n\nint main(){\n scanf(\"%ld %ld\", &n, &t);\n int i;\n for (i = 1; i <= 55; i++)\n a[i] = 0;\n for (i = 1; i <= 55; i++)\n b[i] = 0;\n for (i = 1; i <= t; i++)\n pour(1,1,1.0);\n count = 0;\n for (i = 1; i <= 55; i++)\n if (b[i]) count++;\n printf(\"%d\", count);\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int n,t,ans=0,i,j; scanf(\"%d%d\",&n,&t);\n float s,a[15][15]={0};\n while(t--){\n a[1][1]+=1;\n for(i=1;i<=n;i++)\n {\n //s=(float)1/pow(2,i-1);\n for(j=1;j<=i;j++)\n {\n if(a[i][j]>1) {s=(a[i][j]-1)/2; a[i][j]=1; a[i+1][j]+=s; a[i+1][j+1]+=s; }\n //else {a[i][j]+=s }\n }\n }\n }\n for(i=1;i<=n;i++){\n for(j=1;j<=i;j++){\n if(a[i][j]>=1) ans++;\n }\n } printf(\"%d\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\ndouble a[11][11];\nint main()\n{\n\tint n,K,i,j,k,ans=0;\n\tmemset(a,0,sizeof(0));\n\tscanf(\"%d%d\",&n,&K);\n\tfor(i=1;i<=K;i++){\n\ta[1][1]+=1.0;\n\t\tfor(j=1;j<=n;j++){\n\t\t\tfor(k=1;k<=j;k++){\n\t\t\t\tif(a[j][k]>1.0){\n\t\t\t\ta[j+1][k]+=(a[j][k]-1.0)/2;\n\t\t\t\ta[j+1][k+1]+=(a[j][k]-1.0)/2;\n\t\t\t\ta[j][k]=1.0;\n\t\t\t\t}\n\t\t\t}\n\t\t\n\t\t}\n\t}\n/*\tfor(j=1;j<=n;j++){\n\t\tprintf(\"\\n\");\n\t\tfor(k=1;k<=j;k++)\n\t\t\tprintf(\"%lf\",a[j][k]);\n\t\t}*/\n\t\tfor(j=1;j<=n;j++)\n\t\t\tfor(k=1;k<=j;k++)\n\t\t\t\tif(a[j][k]>=1.0)\n\t\t\t\t\tans++;\n\tprintf(\"%d\",ans);\n}"}, {"source_code": "#include \n#define G 45\nint glasses[10][10];\nint powers[10];\n\nvoid printmarix(int matrix[][10], int n, int m) {\n int i,j;\n for (i = 0; i < n; i++) {\n for (j = 0; j < m; j++) {\n printf(\"%d \", matrix[i][j]);\n }\n printf(\"\\n\");\n }\n printf(\"\\n\");\n}\n\nint main () {\n int n , t, i, j, volume, remaining, answer = 0;\n powers[0] = 1;\n powers[1] = 2;\n powers[2] = 4;\n powers[3] = 8;\n powers[4] = 16;\n powers[5] = 32;\n powers[6] = 64;\n powers[7] = 128;\n powers[8] = 256;\n powers[9] = 512;\n powers[10] = 1024;\n\n scanf(\"%d %d\", &n, &t);\n volume = powers[n];\n glasses[0][0] = t*volume;\n for (i = 0; i < n; i++)\n for (j = 0; j < i+1; j++) {\n // printmarix(glasses, 10, 10);\n if (glasses[i][j] > volume) {\n remaining = glasses[i][j] - volume;\n glasses[i][j] = volume;\n glasses[i+1][j] += remaining/2;\n glasses[i+1][j+1] += remaining/2;\n }\n }\n\n for (i = 0; i < n; i++)\n for (j = 0; j < i+1; j++) {\n if (glasses[i][j] == volume)\n answer++;\n }\n printf(\"%d\\n\", answer);\n return 0;\n}\n"}, {"source_code": "#include \n#include \nfloat a[100000];\n\nvoid rec(int n,int l)\n{\n\n\tif(l>10)\n\t\treturn;\n\tif(a[n]>1)\n\t{\n\t\tint k=pow(2,l-1);\n\t\ta[n+k]+=(a[n]-1)/2;\n\t\ta[n+1+k]+=(a[n]-1)/2;\n\t\t// printf(\"a1: %f a2: %f\\n\",a[n+k],a[n+1+k] );\n\t\ta[n]=1;\n\t\trec(n+k,l+1);\n\t\trec(n+1+k,l+1);\n\t}\n\telse\n\t\treturn;\n}\nint main()\n{\n\tint l,t,count=0,i;\n\tscanf(\"%d%d\",&l,&t);\n\tfor(i=1;i<=t;i++)\n\t{\n\t\ta[1]+=1;\n\t\t// printf(\"a: %f\\n\",a[1]);\n\t\trec(1,1);\n\t}\n\tint y=pow(2,l);\n\tfor(i=1;i<=y-1;i++)\n\t{\n\t\t// printf(\"%f \",a[i] );\n\t\tif(a[i]>=0.999)\n\t\t\tcount++;\n\t}\n\tprintf(\"%d\\n\",count );\n\treturn 0;\n}"}, {"source_code": "#include \n\nint n, t;\ndouble arr[11][11];\n\nint squ(int x){\n\tint ret=1;\n\n\tfor (int i=1; i1){\n\t\t\t\tarr[i][j]-=1;\n\t\t\t\tsol++;\n\t\t\t\tarr[i+1][j]+=arr[i][j]/2;\n\t\t\t\tarr[i+1][j+1]+=arr[i][j]/2;\n\t\t\t\tflag=1;\n\t\t\t}\n\t\t\telse if (arr[i][j]==1) sol++;\n\t\t}\n\t\tif (flag==0) break;\n\t}\n\n\n\tprintf(\"%d\\n\", sol);\n\treturn 0;\n}"}, {"source_code": "#include\n\ndouble calice[10][10];\n\nvoid adiciona(double val, int linha, int coluna, int n){\n\tcalice[linha][coluna] += val;\n\tif(linha>=n){return;}\n\tdouble excesso;\n\tif( calice[linha][coluna]>1 ){ \n\t\texcesso = calice[linha][coluna] -1;\n\t\tcalice[linha][coluna]=1;\t\t\n\t\tadiciona(excesso/2,linha+1,coluna,n);\n\t\tadiciona(excesso/2,linha+1,coluna+1,n);\n\t}\n}\n\nint main(void){\n\tint n, time;\n\tint i, j;\n\tint cheios=0;\n\tscanf(\"%d %d\", &n, &time); \n\tfor(i=0;i\nfloat a[11][11];\n\nmain()\n{\n\tint n,t,i,j,dem=0;\n\tscanf(\"%d%d\",&n,&t);\n\ta[1][1]=t;\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tfor(j=1;j<=i;j++)\n\t\t{\n\t\t\tif (a[i][j]>=1){\n\t\t\t\ta[i+1][j]+=(a[i][j]-1)/2;\n\t\t\t\ta[i+1][j+1]+=(a[i][j]-1)/2;\n\t\t\t\tdem++;\n\t\t\t} \n\t\t}\n\t}\n\tprintf(\"%d\",dem);\n}\n"}, {"source_code": "#include\ndouble a[12][12];\nint main(){\n\tint n,t,i,j,count=0;\n\tscanf(\"%d%d\",&n,&t);\n\ta[1][1]=t;\n\tfor(i=1;i<=n;i++){\n\t\tfor(j=1;j<=i;j++){\n\t\t\tif(a[i][j]>=1){\n\t\t\t\ta[i+1][j] += (a[i][j]-1)/2;\n\t\t\t\ta[i+1][j+1] += (a[i][j]-1)/2;\n\t\t\t\tcount++;\n\t\t\t}\t\t\n\t\t}\n\t}\n\tprintf(\"%d\\n\",count);\n}\t"}, {"source_code": "#include \n\nint main(void) {\n\t// your code goes here\n\tfloat arr[100][21];\n\tint i,j,k,l,m,n,t;\n\tfor(i=0;i<100;i++)for(j=0;j<19;j++){arr[i][j]=0;}\n\t\n\t\n\tscanf(\"%d%d\",&n,&t);\n\tarr[0][10]=t;\nint\tc=10;int count=0;\n\t \n\t int temp=1;\n\t for(i=0;i1) \n\t {float f=arr[i][j]-1;\n\t arr[i+1][j-1]=arr[i+1][j-1]+f/2; \n\t arr[i+1][j+1]=arr[i+1][j+1]+f/2;\n\t \n\t //printf(\"\\n%f\",f);\n\t } \n\t \n\t } \n\t \n\t }\n\t count=0;\n\t for(i=0;i=1)count++;}\n\t \n\t printf(\"%d\",count);\n\t\n\t\n\t\n\t\n\treturn 0;\n}\n\n"}, {"source_code": "#include\nvoid cuprec(float arr[],int num,float amount,int height)\n{\n\tif(height>10)\n\t\treturn;\n\tif(arr[num]+amount<=1)\n\t{\n\t\tarr[num]=arr[num]+amount;\n\t}\n\telse\n\t{\n\t\tcuprec(arr,num+height+1,(amount-(1-arr[num]))/2,height+1);\n\t\tcuprec(arr,num+height,(amount-(1-arr[num]))/2,height+1);\n\t}\n}\nint main()\n{\n\tfloat arr[56];\n\tint n,t,i,k,ncup,ans=0;\n\tscanf(\"%d%d\",&n,&t);\n\tncup=(n*(n+1))/2;\n\tfor(i=0;i<56;i++)\n\t{\n\t\tarr[i]=0.000;\n\t}\n\tfor(i=1;i<=t;i++)\n\t{\n\t\tcuprec(arr,1,1.00,1);\n\t}\n\tfor(i=1;i<=ncup;i++)\n\t{\n\t\tif(arr[i]==1.00)\n\t\t\tans++;\n\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include \nint n,m,ans;\ndouble v[12][12];\nint main()\n{\n\tint i,j;\n\tscanf(\"%d%d\",&n,&m);\n\twhile(m--)\n\t{\n\t\tv[1][1] += 1;\n\t\tfor(i=1;i<=n;i++) for(j=1;j<=i;j++) if(v[i][j]>1-1e-9)\n\t\t{\n\t\t\tv[i+1][j] += (v[i][j]-1)/2;\n\t\t\tv[i+1][j+1] += (v[i][j]-1)/2;\n\t\t\tv[i][j] = 1;\n\t\t}\n\t}\n\tfor(i=1;i<=n;i++) for(j=1;j<=i;j++) if(v[i][j]>=1-1e-9) ans++;\n\tprintf(\"%d\",ans);\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n#include \n#include \n\nint py[12][11], vis[11][11], ne, ans, n, t;\n\nvoid gao(){\n int i, j, temp;\n while(vis[n][1] == 0 && ne <= t){\n py[1][1] += 512;\n for(i = 1; i <= n; i ++){\n for(j = 1; j <= i; j ++){\n if(py[i][j] > 512){\n temp = py[i][j] - 512, py[i][j] = 512;\n temp /= 2;\n py[i + 1][j] += temp, py[i + 1][j + 1] += temp;\n }\n if(py[i][j] == 512 && vis[i][j] == 0){\n ans ++;\n vis[i][j] = 1;\n }\n }\n }\n ne ++;\n }\n}\n\nint main()\n{\n int i, sum;\n while(scanf(\"%d%d\", &n, &t) != EOF){\n memset(py, 0, sizeof(py));\n memset(vis, 0, sizeof(vis));\n ne = 1, ans = 0;\n gao();\n sum = (n * (n + 1)) / 2;\n if(t > 1023)\n printf(\"%d\\n\", sum);\n else\n printf(\"%d\\n\", ans);\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n\tint i, j, n, t;\n\tstatic int pp[10][10];\n\tint cnt, m;\n\n\tscanf(\"%d%d\", &n, &t);\n\tm = 1 << n; /*amount per bottle*/\n\twhile (t-- > 0) {\n\t\tpp[0][0] += m;\n\t\tfor (i = 0; i < n; i++)\n\t\t\tfor (j = 0; j <= i; j++)\n\t\t\t\tif (pp[i][j] > m) {\n\t\t\t\t\tif (i < n - 1) {\n\t\t\t\t\t\tpp[i + 1][j] += (pp[i][j] - m) / 2;\n\t\t\t\t\t\tpp[i + 1][j + 1] += (pp[i][j] - m) / 2; \n\t\t\t\t\t}\n\t\t\t\t\tpp[i][j] = m;\n\t\t\t\t}\n\t}\n\tcnt = 0;\n\tfor (i = 0; i < n; i++)\n\t\tfor (j = 0; j <= i; j++)\n\t\t\tif (pp[i][j] == m)\n\t\t\t\tcnt++;\n\tprintf(\"%d\\n\", cnt);\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n#include \n#include \n#define swap(x,y) {int t=y;y=x;x=t;}\n\nint main(){\n int n,m,i,j;\n while(scanf(\"%d %d\",&i,&j)!=EOF){\n double a[11][11]={0};int num=0;\n a[0][0]=j;\n for(n=0;n=1){\n a[n+1][m+1]+=(a[n][m]-1)/2;\n a[n+1][m]+=(a[n][m]-1)/2;\n num++;\n }\n }\n }\n printf(\"%d\\n\",num);\n }\n\treturn 0;\n}\n"}, {"source_code": "#include\ndouble gl[15][15];\ndouble abso(double x)\n{\n\tif(x<0)\n\t\treturn -x;\n\treturn -x;\n}\nint main()\n{\n\tint n,t,i,j;\n\tdouble x;\n\tscanf(\"%d %d\",&n,&t);\n\twhile(t--)\n\t{\n\t\tgl[1][1]+=1.0;\n\t\tfor(i=1;i<=n;i++)\n\t\t{\n\t\t\tfor(j=1;j<=i;j++)\n\t\t\t{\n\t\t\t\tif(gl[i][j]>1.0)\n\t\t\t\t{\n\t\t\t\t\tx=gl[i][j]-1.0;\n\t\t\t\t\tgl[i][j]=1.0;\n\t\t\t\t\tgl[i+1][j]+=(x/2);\n\t\t\t\t\tgl[i+1][j+1]+=(x/2);\n\t\t\t\t}\n\t\t\t}\n\t\t}\t\n//\t\tfor(i=1;i<=n;i++)\n//\t\t{\n//\t\t\tfor(j=1;j<=i;j++)\n//\t\t\t{\n//\t\t\t\tprintf(\"%lf \",gl[i][j]);\n//\t\t\t}\n//\t\t\tprintf(\"\\n\");\n//\t\t}\n//\t\tprintf(\"\\n\");\n\t}\n\t\n\tt=0;\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tfor(j=1;j<=i;j++)\n\t\t\tif(abso(gl[i][j]-1.0)<0.0000000001)\n\t\t\t\tt++;\n\t}\n\tprintf(\"%d\\n\",t);\n\treturn 0;\n}\n"}, {"source_code": "#include \nint n,t;\ndouble glass[11][11]={0};\nvoid flew(int level, int index){\n\tdouble sur = glass[level][index]-1;\n\tglass[level][index]-=sur;\n\t\n\tsur=sur/2.0;\n\tif(level+1<=n){\n\t\tglass[level+1][index]+=sur;\n\t\tif(glass[level+1][index]>1) flew(level+1,index);\n\t\tif(index+1<=n){\n\t\t\tglass[level+1][index+1]+=sur;\n\t\t\tif(glass[level+1][index+1]>1) flew(level+1,index+1);\n\t\t}\n\t}\n}\nint main(void) {\n\tint sec=0,i,j,count=0;\n\tscanf(\"%d%d\",&n,&t);\n\twhile(sec!=t){\n\t\tglass[1][1]++;\n\t\tif(glass[1][1]>1)flew(1,1);\n\t\tsec++;\n\t}\n\tfor(i=1;i<=n;i++)\n\t\tfor(j=1;j<=i;j++)\n\t\t\tif(glass[i][j]>=1)\n\t\t\t\tcount++;\n\t\n\tprintf(\"%d\",count);\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,t;\n\twhile(scanf(\"%d%d\",&n,&t)!=EOF)\n\t{\n\t\tdouble a[15][15]={0};\n\t\tint i,j,k;\n\t\tfor(k=1;k<=t;k++)\n\t\t{\n\t\t\ta[1][1]+=1;\n\t\t\tfor(i=2;i<=n;i++)\n\t\t\t\tfor(j=1;j=1)\n\t\t\t\t\t{\n\t\t\t\t\t\ta[i][j]+=(a[i-1][j]-1)/2;\n\t\t\t\t\t\ta[i][j+1]+=(a[i-1][j]-1)/2;\n\t\t\t\t\t\ta[i-1][j]=1;\n\t\t\t\t\t}\n\t\t}\n\t\tint num=0;\n\t\tfor(i=1;i<=n;i++)\n\t\t\tfor(j=1;j<=i;j++)\n\t\t\t\tif(a[i][j]>=1)\n\t\t\t\t\tnum++;\n\t\tprintf(\"%d\\n\",num);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint n,t;\n\twhile(scanf(\"%d%d\",&n,&t)!=EOF)\n\t{\n\t\tdouble a[15][15]={0};\n\t\tint i,j,k,num=0;\n\t\ta[1][1]=t;\n\t\tfor(i=2;i<=n;i++)\n\t\t\tfor(j=1;j=1)\n\t\t\t\t{\n\t\t\t\t\ta[i][j]+=(a[i-1][j]-1)/2;\n\t\t\t\t\ta[i][j+1]+=(a[i-1][j]-1)/2;\n\t\t\t\t\ta[i-1][j]=1;\n\t\t\t\t\tnum++;\n\t\t\t\t}\n\t\tfor(j=1;j<=n;j++)\n\t\t\tif(a[i-1][j]>=1)\n\t\t\t\tnum++;\n\t\tprintf(\"%d\\n\",num);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \nint main()\n{\n\tint n,t,r=0,i,j,k,of,flag;\n\tscanf(\"%d %d\",&n,&t);\n\tint c[11][11];\n\tfor(i=0;i<11;i++)\n\t{\n\t\tfor(j=0;j<11;j++)\n\t\t{\n\t\t\tc[i][j]=0;\n\t\t}\n\t}\n\tfor(i=0;i1024)\n\t\t\t\t{\n\t\t\t\t\tof=c[j][k]-1024;\n\t\t\t\t\tc[j][k]=1024;\n\t\t\t\t\tc[j+1][k]+=of/2;\n\t\t\t\t\tc[j+1][k+1]+=of/2;\n\t\t\t\t\tflag=1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(flag==0)\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t}\n\tfor(i=0;i=1024)\n\t\t\t{\n\t\t\t\tr++;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\",r);\n\treturn 0;\n\n}"}, {"source_code": "#include \n\nint dp[111][111], id[111];\n\nint main() {\n int n, m;\n scanf(\"%d %d\", &n, &m);\n id[0] = 1;\n for (int i = 1; i <= n; i++) {\n id[i] = (id[i - 1] << 1);\n }\n for (int t = 1; t <= m; t++) {\n dp[1][1] += id[n];\n for (int i = 1; i <= n; i++) {\n for (int j = 1; j <= i; j++) {\n if (dp[i][j] > id[n]) {\n int cur = dp[i][j] - id[n];\n dp[i + 1][j] += (cur >> 1);\n dp[i + 1][j + 1] += (cur >> 1);\n dp[i][j] = id[n];\n }\n }\n }\n }\n int res = 0;\n for (int i = 1; i <= n; i++) {\n for (int j = 1; j <= n; j++) {\n res += (dp[i][j] == id[n]);\n }\n }\n printf(\"%d\\n\", res);\n return 0;\n}"}, {"source_code": "/* Coached by Dukkha */\n#include \n\n#define N 10\n\nint main() {\n\tstatic int aa[N + 1][N + 1];\n\tint n, t, m, i, j, ans;\n\n\tscanf(\"%d%d\", &n, &t);\n\tm = 1 << n;\n\twhile (t--) {\n\t\taa[0][0] += m;\n\t\tfor (i = 0; i < n; i++)\n\t\t\tfor (j = 0; j <= i; j++) {\n\t\t\t\tint a = aa[i][j];\n\n\t\t\t\tif (a > m) {\n\t\t\t\t\tint x = (a - m) / 2;\n\n\t\t\t\t\taa[i + 1][j] += x;\n\t\t\t\t\taa[i + 1][j + 1] += x;\n\t\t\t\t\taa[i][j] = m;\n\t\t\t\t}\n\t\t\t}\n\t}\n\tans = 0;\n\tfor (i = 0; i < n; i++)\n\t\tfor (j = 0; j <= i; j++)\n\t\t\tif (aa[i][j] == m)\n\t\t\t\tans++;\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include \nint n,c=0;\nfloat t,arr[10][10]={0};\n\nvoid add(int x,int y,float value,int k)\n{\n float diff;\n if(value==0||n==k)\n {\n return;\n }\n else if(arr[x][y]==1)\n {\n add(x+1,y,value/2,k+1);\n add(x+1,y+1,value/2,k+1);\n }\n else if(arr[x][y]+value<1)\n {\n arr[x][y]=arr[x][y]+value;\n }\n else\n {\n diff=arr[x][y]+value-1;\n arr[x][y]=1;\n c++;\n add(x+1,y,diff/2,k+1);\n add(x+1,y+1,diff/2,k+1);\n }\n}\n\nint main(void) {\n int i,j;\n scanf(\"%d%f\",&n,&t);\n\tadd(0,0,t,0);\n\tprintf(\"%d\",c);\n\treturn 0;\n}\n\n"}, {"source_code": "#include \n\nint main()\n\n{\n\tint k,n,t,i,num=1,j,g=0;\n\tfloat arr[12][10010];\n\tscanf(\"%d %d\",&n,&t);\n\tarr[1][1]=t;\n\n\t for(k=1;k<=n;k++)\n\t\t{\n\t\tfor(j=1;j=1)\n\t\t{\n\t\t\tg++;\n\t\t}\n\t\t\tarr[k][j]--;\nif(arr[k][j]>=0)\n{\n\n\t\t\tarr[k+1][j]+=arr[k][j]/2;\n\t arr[k+1][j+1]+=arr[k][j]/2;\n } } \n }\n printf(\"%d\\n\",g);\n \t\n\n \treturn 0;\n }"}, {"source_code": "#include\ndouble a[12][12];\nint main(){\n\tint n,t,i,j,count=0;\n\tscanf(\"%d%d\",&n,&t);\n\ta[1][1]=t;\n\tfor(i=1;i<=n;i++){\n\t\tfor(j=1;j<=i;j++){\n\t\t\tif(a[i][j]>=1){\n\t\t\t\ta[i+1][j] += (a[i][j]-1)/2;\n\t\t\t\ta[i+1][j+1] += (a[i][j]-1)/2;\n\t\t\t\tcount++;\n\t\t\t}\t\t\n\t\t}\n\t}\n\tprintf(\"%d\\n\",count);\n}\t"}, {"source_code": "#include\n#define ll long long\n#define ld long double\n#define ui unsigned int\n#define ull unsigned ll\n#define foi(n) for(ll i=1;i=(double)1)\n {\n ++ans ;\n G[i+1][j] += (G[i][j]-(double)1)/(double)2 ;\n G[i+1][j+1] += (G[i][j]-(double)1)/(double)2 ;\n }\n printf(\"%lld\",ans);\n return 0;\n}"}, {"source_code": "#include \n#include \n\ndouble a[100];\nint main(void){\n int n,t;\n scanf(\"%d%d\",&n,&t);\n\n int i,j,k=1;\n a[1]=t-1;\n for(i=2;i<=n;i++){\n a[k+i]=a[k]/2-1;\n a[k+1]=a[k+2-i]/2-1;\n for(j=k+2;j=0){\n ans++;\n }\n }\n printf(\"%d\\n\",ans);\n}\n"}, {"source_code": "#include\ndouble ara[11][11];\n\nint main()\n{\n int n,i,j,t,x,count=0;\n scanf(\"%d %d\",&n,&t);\n for(x=1; x<=t; x++)\n {\n ara[1][1]++;\n for(i=1; i<=n; i++)\n {\n for(j=1; j<=n; j++)\n {\n if(ara[i][j]>1)\n {\n ara[i+1][j]+=((ara[i][j]-1)/2.0);\n ara[i][j+1]+=((ara[i][j]-1)/2.0);\n ara[i][j]=1;\n }\n }\n }\n }\n\n for(i=1; i<=n; i++)\n {\n for(j=1; j<=n; j++)\n {\n if(i+j<=(n+1))\n {\n if(ara[i][j]>=1)\n count++;\n }\n }\n }\n printf(\"%d\\n\",count);\n\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include\n\nint main() {\n int i, count, flag;\n float lower, upper, quant;\n scanf(\"%f\", &quant);\n\n count = 0;\n flag = 1;\n i=1;\n while(quant > 0 && flag > 0) {\n //Level number i had quant enterred into it\n flag = 0;\n if(i==1) {\n //Ratio 1\n if(quant >= 1 ) {\n quant -= 1;\n count += 1;\n i++;\n flag = 1;\n }\n } else if(i==2) {\n //Ratio 1:1\n if(quant >= 2 ) {\n quant -= 2;\n count += 2;\n i++;\n flag = 1;\n }\n } else {\n //Ratio 1:2:.....:2:1 i.e., (i-2) times 1 and 2 times half\n lower = quant*0.5/(i-1);\n upper = quant*1/(i-1);\n if(lower >= 1) {\n quant -= i;\n count += i;\n i++;\n flag = 1;\n } else if(upper >= 1) {\n quant -= i-2;\n count += i-2;\n i++;\n flag = 1;\n }\n }\n }\n\n printf(\"%d\", count);\n\n return 0;\n}\n"}, {"source_code": "#include\n\nint main() {\n\n int i, count, flag, n, t;\n float lower, upper, quant;\n\n scanf(\"%d%d\", &n, &t);\n\n quant = t;\n\n count = 0;\n flag = 1;\n i=1;\n while(quant > 0 && flag > 0) {\n //Level number i had quant enterred into it\n flag = 0;\n if(i==1) {\n //Ratio 1\n if(quant >= 1 ) {\n quant -= 1;\n count += 1;\n i++;\n flag = 1;\n }\n } else if(i==2) {\n //Ratio 1:1\n if(quant >= 2 ) {\n quant -= 2;\n count += 2;\n i++;\n flag = 1;\n }\n } else {\n //Ratio 1:2:.....:2:1 i.e., (i-2) times 1 and 2 times half\n lower = quant/(2*(i-1));\n upper = quant/(i-1);\n //printf(\"\\nlower %f upper %f\", lower, upper);\n if(lower >= 0.9999) {\n quant -= i;\n count += i;\n i++;\n flag = 1;\n } else if(upper >= 0.9999) {\n quant -= i-2;\n count += i-2;\n i++;\n flag = 1;\n }\n }\n\n if(i>n)\n break;\n }\n\n //printf(\"\\n%d\\n\\n\", count);\n printf(\"%d\", count);\n\n return 0;\n}\n"}, {"source_code": "#include\n\nint main() {\n\n int i, count, flag, n, t;\n float lower, upper, quant;\n scanf(\"%d%d\", &n, &t);\n\n quant = t;\n\n count = 0;\n flag = 1;\n i=1;\n while(quant > 0 && flag > 0) {\n //Level number i had quant enterred into it\n flag = 0;\n if(i==1) {\n //Ratio 1\n if(quant >= 1 ) {\n quant -= 1;\n count += 1;\n i++;\n flag = 1;\n }\n } else if(i==2) {\n //Ratio 1:1\n if(quant >= 2 ) {\n quant -= 2;\n count += 2;\n i++;\n flag = 1;\n }\n } else {\n //Ratio 1:2:.....:2:1 i.e., (i-2) times 1 and 2 times half\n lower = quant*0.5/(i-1);\n upper = quant*1/(i-1);\n if(lower >= 1) {\n quant -= i;\n count += i;\n i++;\n flag = 1;\n } else if(upper >= 1) {\n quant -= i-2;\n count += i-2;\n i++;\n flag = 1;\n }\n }\n\n if(i>n)\n break;\n }\n\n printf(\"%d\", count);\n\n return 0;\n}\n"}, {"source_code": "#include\n\nint main() {\n\n int i, count, flag, n, t;\n float lower, upper, quant, quantc;\n\n scanf(\"%d%d\", &n, &t);\n\n quant = t;\n //for(quantc = 2; quantc<=t; quantc++) {\n //quant = quantc;\n\n count = 0;\n flag = 1;\n i=1;\n while(quant > 0 && flag > 0) {\n //Level number i had quant enterred into it\n flag = 0;\n if(i==1) {\n //Ratio 1\n if(quant >= 1 ) {\n quant -= 1;\n count += 1;\n i++;\n flag = 1;\n }\n } else if(i==2) {\n //Ratio 1:1\n if(quant >= 2 ) {\n quant -= 2;\n count += 2;\n i++;\n flag = 1;\n }\n } else {\n //Ratio 1:2:.....:2:1 i.e., (i-2) times 1 and 2 times half\n lower = quant/(2*(i-1));\n upper = quant/(i-1);\n\n\n if(lower >= 0.999999) {\n quant -= i;\n count += i;\n i++;\n flag = 1;\n } else if(upper >= 0.999999) {\n quant -= i-2;\n count += i-2;\n i++;\n flag = 1;\n }\n }\n\n if(i>n)\n break;\n }\n\n //printf(\"\\n%d\\n\", count);\n printf(\"%d\", count);\n\n return 0;\n}\n"}, {"source_code": "#include\n\nint main() {\n\n int i, count, flag, n, t;\n float lower, upper, quant, quantc;\n\n scanf(\"%d%d\", &n, &t);\n\n quant = t;\n //for(quantc = 2; quantc<=t; quantc++) {\n //quant = quantc;\n\n count = 0;\n flag = 1;\n i=1;\n while(quant > 0 && flag > 0) {\n //Level number i had quant enterred into it\n flag = 0;\n if(i==1) {\n //Ratio 1\n if(quant >= 1 ) {\n quant -= 1;\n count += 1;\n i++;\n flag = 1;\n }\n } else if(i==2) {\n //Ratio 1:1\n if(quant >= 2 ) {\n quant -= 2;\n count += 2;\n i++;\n flag = 1;\n }\n } else {\n //Ratio 1:2:.....:2:1 i.e., (i-2) times 1 and 2 times half\n lower = quant/(2*(i-1));\n upper = quant/(i-1);\n\n \n if(lower >= 0.99) {\n quant -= i;\n count += i;\n i++;\n flag = 1;\n } else if(upper >= 0.99) {\n quant -= i-2;\n count += i-2;\n i++;\n flag = 1;\n }\n }\n\n if(i>n)\n break;\n }\n\n //printf(\"\\n%d\\n\", count);\n printf(\"%d\", count);\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint A[10][10];\n\nint main()\n{\n int N, T;\n scanf(\"%d %d\", &N, &T);\n while(T--) {\n A[0][0] += 512;\n for(int i = 0; i < N - 1; ++i) {\n for(int j = 0; j <= i; ++j) {\n if(A[i][j] > 512) {\n int val = A[i][j] - 512;\n A[i + 1][j] += val / 2;\n A[i + 1][j + 1] += val / 2;\n A[i][j] = 512;\n }\n }\n }\n }\n int ans = 0;\n for(int i = 0; i < N; ++i) {\n for(int j = 0; j <= i; ++j) {\n if(A[i][j] == 512) {\n ++ans;\n }\n }\n }\n printf(\"%d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "//题目是有趣的\n//就是说在t秒的时候有多少是满的!\n#include\n#define N 10\ndouble absu(double a){\n if(a>0)return a;\n else return -a;\n}\nint main() {\n int n,t;\n scanf(\"%d%d\",&n,&t);\n double pyramid[N][N];\n int i,j;\n for(i=0;i1){\n double more=pyramid[i][j]-1;\n pyramid[i][j]=1;\n pyramid[i+1][j]+=(more/2.0);\n pyramid[i+1][j+1]+=(more/2.0);\n }\n }\n }\n }\n int glass=0;\n double error=0.000000001;\n for(i=0;i\n#define N 10\ndouble absu(double a){\n if(a>0)return a;\n else return -a;\n}\nint main() {\n int n,t;\n scanf(\"%d%d\",&n,&t);\n double pyramid[N][N];\n int i,j;\n for(i=0;i1){\n double more=pyramid[i][j]-1;\n pyramid[i][j]=1;\n pyramid[i+1][j]+=(more/2.0);\n pyramid[i+1][j+1]+=(more/2.0);\n }\n }\n }\n }\n int glass=0;\n double error=0.0000000001;\n for(i=0;i1?t++,M[i+1][j]+=v=M[i][j]/2,M[i+1][j+1]+=v:0;\n printf(\"%d\",t);\n}/*2017-10-19 21:14:31.478*/"}, {"source_code": "#include\nint main (void)\n{\n int n,m,i;\n int t[10]={1,3,7,13,21,31,43,57,73,91};\n int p[10]={1,2,4,6,8,10,12,14,16,18};\n int ge[10]={1,3,6,10,15,21,28,36,45,55};\n scanf(\"%d %d\",&n,&m);\n for(i=n-1;i>=0;i--){\n if(m>=t[i]){\n break;\n }\n }\n if(i==-1){\n printf(\"0\\n\");\n }\n else{\n m=m-t[i];\n if(m>=p[i+1]/2){\n ge[i]=ge[i]+i;\n }\n printf(\"%d\\n\",ge[i]);\n }\n return 0;\n}\n/*2016-05-29 21:06:16.491*/"}, {"source_code": "#include\nint main (void)\n{\n int n,m,i,s;\n int t[10]={1,3,7,13,21,31,43,57,73,91};\n int p[10]={1,2,4,6,8,10,12,14,16,18};\n int ge[10]={1,3,6,10,15,21,28,36,45,55};\n scanf(\"%d %d\",&n,&m);\n for(i=n-1;i>=0;i--){\n if(m>=t[i]){\n break;\n }\n }\n if(i==-1){\n printf(\"0\\n\");\n }\n else{\n m=m-t[i];\n if(m>=p[i+1]/2){\n s=ge[i]+i;\n }\n else{\n s=ge[i];\n }\n if(s>ge[9])\n s=ge[9];\n printf(\"%d\\n\",s);\n }\n return 0;\n}\n/*2016-05-29 21:21:55.824*/"}, {"source_code": "#include \nint main(void)\n{\n int level, time, tot_glass;\n int i, glass;\n scanf(\"%d%d\",&level,&time);\n tot_glass = (level*(level+1))/2;\n glass = 1;\n for(i=2;i<=level;i++)\n { \n if( i <= time - glass )\n glass = glass + i;\n else break;\n } \n if(tot_glass>time)\n {\n time = time-glass;\n glass = glass + ((time+1)/i);\n }\n // printf(\"(i-th)%d (remain_time)%d (full_glass)%d \\n\",i,time,glass);\n printf(\"%d\\n\",glass);\n return 0;\n}"}, {"source_code": "#include \nint main(void)\n{\n int level, time, tot_glass;\n int i, glass;\n scanf(\"%d%d\",&level,&time);\n if(time ==0 )\n {\n printf(\"0\\n\");\n }\n else\n {\n tot_glass = (level*(level+1))/2;\n glass = 1;\n for(i=2;i<=level;i++)\n {\n if( i <= time - glass )\n glass = glass + i;\n else break;\n }\n if(tot_glass>time)\n {\n time = time-glass;\n glass = glass + ((time+1)/i);\n }\n // printf(\"(i-th)%d (remain_time)%d (full_glass)%d \\n\",i,time,glass);\n printf(\"%d\\n\",glass);\n }return 0;\n}"}, {"source_code": "#include \nint main(void)\n{\n int level, time, tot_glass;\n int i, glass;\n scanf(\"%d%d\",&level,&time);\n tot_glass = (level*(level+1))/2;\n glass = 1;\n for(i=2;i<=level;i++)\n { \n if( i <= time - glass )\n glass = glass + i;\n else break;\n } \n time = time-glass;\n// printf(\"(i-th)%d (remain_time)%d (full_glass)%d \\n\",i,time,glass);\n glass = glass + ((time+1)/i);\n printf(\"%d\\n\",glass);\n return 0;\n}"}, {"source_code": "#include\n#include\nint ch1[100],ch2[100],w[100],r=0;;\ndouble val[100];\nint get(int a){\n\tint i;\n\tfor(i=1;i<11;i++){\n\t\tif(a<=i*(i+1)/2)\n\t\t\tbreak;\n\t}\n\treturn i;\n}\nint push(int a){\n\tw[r++]=a;\n\t//printf(\"Push : %d\\n\",a);\n\treturn 0;\n}\nint clear(){\n\tint i;\n\tfor(i=0;i=1){\n\t\t\t\tif(!search(ch1[j]))\n\t\t\t\t\tpush(ch1[j]);\n\t\t\t}\n\t\t\tif(val[ch2[j]]>=1){\n\t\t\t\tif(!search(ch2[j]))\n\t\t\t\t\tpush(ch2[j]);\n\t\t\t}\n\t\t\tif(val[j]==1 && search(j)){\n\t\t\t\tval[ch1[j]]+=1/pow(2,get(j));\n\t\t\t\tval[ch2[j]]+=1/pow(2,get(j));\n\t\t\t}\n\t\t\tif(val[ch1[j]]>=1)\n\t\t\t\tval[ch1[j]]=1;\n\t\t\tif(val[ch2[j]]>=1)\n\t\t\t\tval[ch2[j]]=1;\n\t\t\t//if(!search(1))\n\t\t\t//\tpush(1);\n\t\t}\n\t\t//print(n);\n\t\t//clear();\n\t}\n\tfor(i=1;i<=n*(n+1)/2;i++){\n\t\tif(val[i]==1)\n\t\t\tans++;\n\t\t//printf(\"Val[%d] = %lf\\n\",i,val[i]);\n\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\t\n"}, {"source_code": "#include\n#include\nint ch1[100],ch2[100],w[100],r=0;;\ndouble val[100];\nint get(int a){\n\tint i;\n\tfor(i=1;i<11;i++){\n\t\tif(a<=i*(i+1)/2)\n\t\t\tbreak;\n\t}\n\treturn i;\n}\nint push(int a){\n\tw[r++]=a;\n\t//printf(\"Push : %d\\n\",a);\n\treturn 0;\n}\nint clear(){\n\tint i;\n\tfor(i=0;i=1){\n\t\t\t\tif(!search(ch1[j]))\n\t\t\t\t\tpush(ch1[j]);\n\t\t\t}\n\t\t\tif(val[ch2[j]]>=1){\n\t\t\t\tif(!search(ch2[j]))\n\t\t\t\t\tpush(ch2[j]);\n\t\t\t}\n\t\t\tif(val[j]==1 && search(j)){\n\t\t\t\tval[ch1[j]]+=1/pow(2,get(j));\n\t\t\t\tval[ch2[j]]+=1/pow(2,get(j));\n\t\t\t}\n\t\t\tif(val[ch1[j]]>=1)\n\t\t\t\tval[ch1[j]]=1;\n\t\t\tif(val[ch2[j]]>=1)\n\t\t\t\tval[ch2[j]]=1;\n\t\t\t//if(!search(1))\n\t\t\t//\tpush(1);\n\t\t}\n\t\tprint(n);\n\t\t//clear();\n\t}\n\tfor(i=1;i<=n*(n+1)/2;i++){\n\t\tif(val[i]==1)\n\t\t\tans++;\n\t\tprintf(\"Val[%d] = %lf\\n\",i,val[i]);\n\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\t\n"}, {"source_code": "#include\n#include\nint ch1[100],ch2[100],w[100],r=0;;\ndouble val[100];\nint get(int a){\n\tint i;\n\tfor(i=1;i<11;i++){\n\t\tif(a<=i*(i+1)/2)\n\t\t\tbreak;\n\t}\n\treturn i;\n}\nint push(int a){\n\tw[r++]=a;\n\t//printf(\"Push : %d\\n\",a);\n\treturn 0;\n}\nint clear(){\n\tint i;\n\tfor(i=0;i=1){\n\t\t\t\tif(!search(ch1[j]))\n\t\t\t\t\tpush(ch1[j]);\n\t\t\t}\n\t\t\tif(val[ch2[j]]>=1){\n\t\t\t\tif(!search(ch2[j]))\n\t\t\t\t\tpush(ch2[j]);\n\t\t\t}\n\t\t\tif(val[j]==1 && search(j)){\n\t\t\t\tval[ch1[j]]+=1/pow(2,get(j));\n\t\t\t\tval[ch2[j]]+=1/pow(2,get(j));\n\t\t\t}\n\t\t\tif(val[ch1[j]]>=1)\n\t\t\t\tval[ch1[j]]=1;\n\t\t\tif(val[ch2[j]]>=1)\n\t\t\t\tval[ch2[j]]=1;\n\t\t\t//if(!search(1))\n\t\t\t//\tpush(1);\n\t\t}\n\t\t//print(n);\n\t\t//clear();\n\t}\n\tfor(i=1;i<=n*(n+1)/2;i++){\n\t\tif(val[i]==1)\n\t\t\tans++;\n\t\t//printf(\"Val[%d] = %lf\\n\",i,val[i]);\n\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\t\n"}, {"source_code": "#include\n#include\nint a[10000],p1[60],p2[60];\ndouble val[60];\nint level(int a){\n\tif(a==1 || a==0)\n\t\treturn 1;\n\tif(a==2 || a==3)\n\t\treturn 2;\n\tif(a>=4 || a<=6)\n\t\treturn 3;\n\tif(a>=7 || a<=10)\n\t\treturn 4;\n\tif(a>=10 || a<=15)\n\t\treturn 5;\n\tif(a>=16 || a<=21)\n\t\treturn 6;\n\tif(a>=22 || a<=28)\n\t\treturn 7;\n\tif(a>=29 || a<=36)\n\t\treturn 8;\n\tif(a>=37 || a<=45)\n\t\treturn 9;\n\tif(a>=46 || a<=55)\n\t\treturn 10;\n\t\n}\nint main(){\n\tint j,n,t,i,ans=0;\n\tscanf(\"%d%d\",&n,&t);\n\tval[0]=2;\n\tp1[1]=0,p2[1]=0;\n\tp1[2]=1,p2[2]=1;\n\tp1[3]=1,p2[3]=1;\n\tp1[4]=2,p2[4]=2;\n\tp1[5]=2,p2[5]=3;\n\tp1[6]=3,p2[6]=3;\n\tp1[7]=4,p2[7]=4;\n\tp1[8]=4,p2[8]=5;\n\tp1[9]=5,p2[9]=6;\n\tp1[10]=6,p2[10]=6;\n\tp1[11]=7,p2[11]=7;\n\tp1[12]=7,p2[12]=8;\n\tp1[13]=8,p2[13]=9;\n\tp1[14]=9,p2[14]=10;\n\tp1[15]=10,p2[15]=10;\n\tp1[16]=11,p2[16]=11;\n\tp1[17]=11,p2[17]=12;\n\tp1[18]=12,p2[18]=13;\n\tp1[19]=13,p2[19]=14;\n\tp1[20]=14,p2[20]=15;\n\tp1[21]=15,p2[21]=15;\n\tp1[22]=16,p2[22]=16;\n\tp1[23]=16,p2[23]=17;\n\tp1[24]=17,p2[24]=18;\n\tp1[25]=18,p2[25]=19;\n\tp1[26]=19,p2[26]=20;\n\tp1[27]=20,p2[27]=21;\n\tp1[28]=21,p2[28]=21;\n\tp1[29]=22,p2[29]=22;\n\tp1[30]=22,p2[30]=23;\n\tp1[31]=23,p2[31]=24;\n\tp1[32]=24,p2[32]=25;\n\tp1[33]=25,p2[33]=26;\n\tp1[34]=26,p2[34]=27;\n\tp1[35]=27,p2[35]=28;\n\tp1[36]=28,p2[36]=28;\n\tp1[37]=29,p2[37]=29;\n\tp1[38]=29,p2[38]=30;\n\tp1[39]=30,p2[39]=31;\n\tp1[40]=31,p2[40]=32;\n\tp1[41]=32,p2[41]=33;\n\tp1[42]=33,p2[42]=34;\n\tp1[43]=34,p2[43]=35;\n\tp1[44]=35,p2[44]=36;\n\tp1[45]=36,p2[45]=36;\n\tp1[46]=37,p2[46]=37;\n\tp1[47]=37,p2[47]=38;\n\tp1[48]=38,p2[48]=39;\n\tp1[49]=39,p2[49]=40;\n\tp1[50]=40,p2[50]=41;\n\tp1[51]=41,p2[51]=42;\n\tp1[52]=42,p2[52]=43;\n\tp1[53]=43,p2[53]=44;\n\tp1[54]=44,p2[54]=45;\n\tp1[55]=45,p2[55]=45;\n\tfor(i=0;i=1;j--){\n\t\t\tif(val[p1[j]]>=1)\n\t\t\t\tval[j]+=val[p1[j]]/pow(2,level(p1[j]));\n\t\t\tif(val[p2[j]]>=1 && p1[j]!=p2[j])\n\t\t\t\tval[j]+=val[p2[j]]/pow(2,level(p2[j]));\n\t\t\tif(val[j]>=1)\n\t\t\t\tval[j]=1;\n\t\t}\t\t\n\t\t//for(j=n*(n+1)/2;j>=1;j--){\n\t\t\t//printf(\"%lf\\n\",val[j]);\n\t\t//}\n\t\t//printf(\"\\n\\n\\n\\n\");\n\t}\n\tfor(i=1;i<=n*(n+1)/2;i++){\n\t\t//printf(\"%lf\\n\",val[i]);\n\t\tif(val[i]==1)\n\t\t\tans++;\n\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nint a[10000],p1[60],p2[60];\ndouble val[60];\nint level(int a){\n\tif(a==1 || a==0)\n\t\treturn 1;\n\tif(a==2 || a==3)\n\t\treturn 2;\n\tif(a>=4 || a<=6)\n\t\treturn 3;\n\tif(a>=7 || a<=10)\n\t\treturn 4;\n\tif(a>=10 || a<=15)\n\t\treturn 5;\n\tif(a>=16 || a<=21)\n\t\treturn 6;\n\tif(a>=22 || a<=28)\n\t\treturn 7;\n\tif(a>=29 || a<=36)\n\t\treturn 8;\n\tif(a>=37 || a<=45)\n\t\treturn 9;\n\tif(a>=46 || a<=55)\n\t\treturn 10;\n\t\n}\nint main(){\n\tint j,n,t,i,ans=0;\n\tscanf(\"%d%d\",&n,&t);\n\tval[0]=2;\n\tp1[1]=0,p2[1]=0;\n\tp1[2]=1,p2[2]=1;\n\tp1[3]=1,p2[3]=1;\n\tp1[4]=2,p2[4]=2;\n\tp1[5]=2,p2[5]=3;\n\tp1[6]=3,p2[6]=3;\n\tp1[7]=4,p2[7]=4;\n\tp1[8]=4,p2[8]=5;\n\tp1[9]=5,p2[9]=6;\n\tp1[10]=6,p2[10]=6;\n\tp1[11]=7,p2[11]=7;\n\tp1[12]=7,p2[12]=8;\n\tp1[13]=8,p2[13]=9;\n\tp1[14]=9,p2[14]=10;\n\tp1[15]=10,p2[15]=10;\n\tp1[16]=11,p2[16]=11;\n\tp1[17]=11,p2[17]=12;\n\tp1[18]=12,p2[18]=13;\n\tp1[19]=13,p2[19]=14;\n\tp1[20]=14,p2[20]=15;\n\tp1[21]=15,p2[21]=15;\n\tp1[22]=16,p2[22]=16;\n\tp1[23]=16,p2[23]=17;\n\tp1[24]=17,p2[24]=18;\n\tp1[25]=18,p2[25]=19;\n\tp1[26]=19,p2[26]=20;\n\tp1[27]=20,p2[27]=21;\n\tp1[28]=21,p2[28]=21;\n\tp1[29]=22,p2[29]=22;\n\tp1[30]=22,p2[30]=23;\n\tp1[31]=23,p2[31]=24;\n\tp1[32]=24,p2[32]=25;\n\tp1[33]=25,p2[33]=26;\n\tp1[34]=26,p2[34]=27;\n\tp1[35]=27,p2[35]=28;\n\tp1[36]=28,p2[36]=28;\n\tp1[37]=29,p2[37]=29;\n\tp1[38]=29,p2[38]=30;\n\tp1[39]=30,p2[39]=31;\n\tp1[40]=31,p2[40]=32;\n\tp1[41]=32,p2[41]=33;\n\tp1[42]=33,p2[42]=34;\n\tp1[43]=34,p2[43]=35;\n\tp1[44]=35,p2[44]=36;\n\tp1[45]=36,p2[45]=36;\n\tp1[46]=37,p2[46]=37;\n\tp1[47]=37,p2[47]=38;\n\tp1[48]=38,p2[48]=39;\n\tp1[49]=39,p2[49]=40;\n\tp1[50]=40,p2[50]=41;\n\tp1[51]=41,p2[51]=42;\n\tp1[52]=43,p2[52]=43;\n\tp1[53]=44,p2[53]=44;\n\tp1[54]=45,p2[54]=45;\n\tp1[55]=45,p2[55]=45;\n\tfor(i=0;i=1;j--){\n\t\t\tif(val[p1[j]]>=1)\n\t\t\t\tval[j]+=val[p1[j]]/pow(2,level(p1[j]));\n\t\t\tif(val[p2[j]]>=1 && p1[j]!=p2[j])\n\t\t\t\tval[j]+=val[p2[j]]/pow(2,level(p2[j]));\n\t\t\tif(val[j]>=1)\n\t\t\t\tval[j]=1;\n\t\t}\t\t\n\t\t//for(j=n*(n+1)/2;j>=1;j--){\n\t\t\t//printf(\"%lf\\n\",val[j]);\n\t\t//}\n\t\t//printf(\"\\n\\n\\n\\n\");\n\t}\n\tfor(i=1;i<=n*(n+1)/2;i++){\n\t\t//printf(\"%lf\\n\",val[i]);\n\t\tif(val[i]==1)\n\t\t\tans++;\n\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nint ch1[100],ch2[100],w[100],r=0;;\ndouble val[100];\nint get(int a){\n\tint i;\n\tfor(i=1;i<11;i++){\n\t\tif(a<=i*(i+1)/2)\n\t\t\tbreak;\n\t}\n\treturn i;\n}\nint push(int a){\n\tw[r++]=a;\n\t//printf(\"Push : %d\\n\",a);\n\treturn 0;\n}\nint clear(){\n\tint i;\n\tfor(i=0;i=1){\n\t\t\t\tif(!search(ch1[j]))\n\t\t\t\t\tpush(ch1[j]);\n\t\t\t}\n\t\t\tif(val[ch2[j]]>=1){\n\t\t\t\tif(!search(ch2[j]))\n\t\t\t\t\tpush(ch2[j]);\n\t\t\t}\n\t\t\tif(val[j]==1 && search(j)){\n\t\t\t\tval[ch1[j]]+=1/pow(2,get(j));\n\t\t\t\tval[ch2[j]]+=1/pow(2,get(j));\n\t\t\t}\n\t\t\tif(val[ch1[j]]>=1)\n\t\t\t\tval[ch1[j]]=1;\n\t\t\tif(val[ch2[j]]>=1)\n\t\t\t\tval[ch2[j]]=1;\n\t\t\t//if(!search(1))\n\t\t\t//\tpush(1);\n\t\t}\n\t\t//print(n);\n\t\t//clear();\n\t}\n\tfor(i=1;i<=n*(n+1)/2;i++){\n\t\tif(val[i]==1)\n\t\t\tans++;\n\t\t//printf(\"Val[%d] = %lf\\n\",i,val[i]);\n\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\t\n"}, {"source_code": "#include\n#include\nint a[10000],p1[60],p2[60];\ndouble val[60];\nint level(int a){\n\tif(a==1 || a==0)\n\t\treturn 1;\n\tif(a==2 || a==3)\n\t\treturn 2;\n\tif(a>=4 || a<=6)\n\t\treturn 3;\n\tif(a>=7 || a<=10)\n\t\treturn 4;\n\tif(a>=11 || a<=15)\n\t\treturn 5;\n\tif(a>=16 || a<=21)\n\t\treturn 6;\n\tif(a>=22 || a<=28)\n\t\treturn 7;\n\tif(a>=29 || a<=36)\n\t\treturn 8;\n\tif(a>=37 || a<=45)\n\t\treturn 9;\n\tif(a>=46 || a<=55)\n\t\treturn 10;\n\t\n}\nint main(){\n\tint j,n,t,i,ans=0;\n\tscanf(\"%d%d\",&n,&t);\n\tval[0]=2;\n\tp1[1]=0,p2[1]=0;\n\tp1[2]=1,p2[2]=1;\n\tp1[3]=1,p2[3]=1;\n\tp1[4]=2,p2[4]=2;\n\tp1[5]=2,p2[5]=3;\n\tp1[6]=3,p2[6]=3;\n\tp1[7]=4,p2[7]=4;\n\tp1[8]=4,p2[8]=5;\n\tp1[9]=5,p2[9]=6;\n\tp1[10]=6,p2[10]=6;\n\tp1[11]=7,p2[11]=7;\n\tp1[12]=7,p2[12]=8;\n\tp1[13]=8,p2[13]=9;\n\tp1[14]=9,p2[14]=10;\n\tp1[15]=10,p2[15]=10;\n\tp1[16]=11,p2[16]=11;\n\tp1[17]=11,p2[17]=12;\n\tp1[18]=12,p2[18]=13;\n\tp1[19]=13,p2[19]=14;\n\tp1[20]=14,p2[20]=15;\n\tp1[21]=15,p2[21]=15;\n\tp1[22]=16,p2[22]=16;\n\tp1[23]=16,p2[23]=17;\n\tp1[24]=17,p2[24]=18;\n\tp1[25]=18,p2[25]=19;\n\tp1[26]=19,p2[26]=20;\n\tp1[27]=20,p2[27]=21;\n\tp1[28]=21,p2[28]=21;\n\tp1[29]=22,p2[29]=22;\n\tp1[30]=22,p2[30]=23;\n\tp1[31]=23,p2[31]=24;\n\tp1[32]=24,p2[32]=25;\n\tp1[33]=25,p2[33]=26;\n\tp1[34]=26,p2[34]=27;\n\tp1[35]=27,p2[35]=28;\n\tp1[36]=28,p2[36]=28;\n\tp1[37]=29,p2[37]=29;\n\tp1[38]=29,p2[38]=30;\n\tp1[39]=30,p2[39]=31;\n\tp1[40]=31,p2[40]=32;\n\tp1[41]=32,p2[41]=33;\n\tp1[42]=33,p2[42]=34;\n\tp1[43]=34,p2[43]=35;\n\tp1[44]=35,p2[44]=36;\n\tp1[45]=36,p2[45]=36;\n\tp1[46]=37,p2[46]=37;\n\tp1[47]=37,p2[47]=38;\n\tp1[48]=38,p2[48]=39;\n\tp1[49]=39,p2[49]=40;\n\tp1[50]=40,p2[50]=41;\n\tp1[51]=41,p2[51]=42;\n\tp1[52]=42,p2[52]=43;\n\tp1[53]=43,p2[53]=44;\n\tp1[54]=44,p2[54]=45;\n\tp1[55]=45,p2[55]=45;\n\tfor(i=0;i=1;j--){\n\t\t\tif(val[p1[j]]>=1)\n\t\t\t\tval[j]+=val[p1[j]]/pow(2,level(p1[j]));\n\t\t\tif(val[p2[j]]>=1 && p1[j]!=p2[j])\n\t\t\t\tval[j]+=val[p2[j]]/pow(2,level(p2[j]));\n\t\t\tif(val[j]>=1)\n\t\t\t\tval[j]=1;\n\t\t}\t\t\n\t}\n\tfor(i=1;i<=n*(n+1)/2;i++){\n\t\t//printf(\"%lf\\n\",val[i]);\n\t\tif(val[i]==1)\n\t\t\tans++;\n\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nint a[10000],p1[60],p2[60];\ndouble val[60];\nint level(int a){\n\n\n\n\n\n\tif(a==1 || a==0)\n\t\treturn 1;\n\tif(a==2 || a==3)\n\t\treturn 2;\n\tif(a>=4 || a<=6)\n\t\treturn 3;\n\tif(a>=7 || a<=10)\n\t\treturn 4;\n\tif(a>=10 || a<=15)\n\t\treturn 5;\n\tif(a>=16 || a<=21)\n\t\treturn 6;\n\tif(a>=22 || a<=28)\n\t\treturn 7;\n\tif(a>=29 || a<=36)\n\t\treturn 8;\n\tif(a>=37 || a<=45)\n\t\treturn 9;\n\tif(a>=46 || a<=55)\n\t\treturn 10;\n\t\n}\nint main(){\n\tint j,n,t,i,ans=0;\n\tscanf(\"%d%d\",&n,&t);\n\tval[0]=2;\n\tp1[1]=0,p2[1]=0;\n\tp1[2]=1,p2[2]=1;\n\tp1[3]=1,p2[3]=1;\n\tp1[4]=2,p2[4]=2;\n\tp1[5]=2,p2[5]=3;\n\tp1[6]=3,p2[6]=3;\n\tp1[7]=4,p2[7]=4;\n\tp1[8]=4,p2[8]=5;\n\tp1[9]=5,p2[9]=6;\n\tp1[10]=6,p2[10]=6;\n\tp1[11]=7,p2[11]=7;\n\tp1[12]=7,p2[12]=8;\n\tp1[13]=8,p2[13]=9;\n\tp1[14]=9,p2[14]=10;\n\tp1[15]=10,p2[15]=10;\n\tp1[16]=11,p2[16]=11;\n\tp1[17]=11,p2[17]=12;\n\tp1[18]=12,p2[18]=13;\n\tp1[19]=13,p2[19]=14;\n\tp1[20]=14,p2[20]=15;\n\tp1[21]=15,p2[21]=15;\n\tp1[22]=16,p2[22]=16;\n\tp1[23]=16,p2[23]=17;\n\tp1[24]=17,p2[24]=18;\n\tp1[25]=18,p2[25]=19;\n\tp1[26]=19,p2[26]=20;\n\tp1[27]=20,p2[27]=21;\n\tp1[28]=21,p2[28]=21;\n\tp1[29]=22,p2[29]=22;\n\tp1[30]=22,p2[30]=23;\n\tp1[31]=23,p2[31]=24;\n\tp1[32]=24,p2[32]=25;\n\tp1[33]=25,p2[33]=26;\n\tp1[34]=26,p2[34]=27;\n\tp1[35]=27,p2[35]=28;\n\tp1[36]=28,p2[36]=28;\n\tp1[37]=29,p2[37]=29;\n\tp1[38]=29,p2[38]=30;\n\tp1[39]=30,p2[39]=31;\n\tp1[40]=31,p2[40]=32;\n\tp1[41]=32,p2[41]=33;\n\tp1[42]=33,p2[42]=34;\n\tp1[43]=34,p2[43]=35;\n\tp1[44]=35,p2[44]=36;\n\tp1[45]=36,p2[45]=36;\n\tp1[46]=37,p2[46]=37;\n\tp1[47]=37,p2[47]=38;\n\tp1[48]=38,p2[48]=39;\n\tp1[49]=39,p2[49]=40;\n\tp1[50]=40,p2[50]=41;\n\tp1[51]=41,p2[51]=42;\n\tp1[52]=43,p2[52]=43;\n\tp1[53]=44,p2[53]=44;\n\tp1[54]=45,p2[54]=45;\n\tp1[55]=45,p2[55]=45;\n\tfor(i=0;i=1;j--){\n\t\t\tif(val[p1[j]]>=1)\n\t\t\t\tval[j]+=val[p1[j]]/pow(2,level(p1[j]));\n\t\t\tif(val[p2[j]]>=1 && p1[j]!=p2[j])\n\t\t\t\tval[j]+=val[p2[j]]/pow(2,level(p2[j]));\n\t\t\tif(val[j]>=1)\n\t\t\t\tval[j]=1;\n\t\t}\t\t\n\t\t//for(j=n*(n+1)/2;j>=1;j--){\n\t\t\t//printf(\"%lf\\n\",val[j]);\n\t\t//}\n\t\t//printf(\"\\n\\n\\n\\n\");\n\t}\n\tfor(i=1;i<=n*(n+1)/2;i++){\n\t\t//printf(\"%lf\\n\",val[i]);\n\t\tif(val[i]==1)\n\t\t\tans++;\n\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "n,t,i,j;\nfloat M[15][15],v;\nmain()\n{\n scanf(\"%d%f\",&n,M);\n for(;i=1?t++,M[i+1][j++]+=v=M[i][j]/2,M[i+1][j]+=v:j++;\n printf(\"%d\",t);\n}\n/*2017-10-19 21:11:41.054*/"}, {"source_code": "#include\nint main (void)\n{\n int n,m,i,s;\n int t[10]={1,3,7,13,21,31,43,57,73,91};\n int p[10]={1,2,4,6,8,10,12,14,16,18};\n int ge[10]={1,3,6,10,15,21,28,36,45,55};\n scanf(\"%d %d\",&n,&m);\n for(i=n-1;i>=0;i--){\n if(m>=t[i]){\n break;\n }\n }\n if(i==-1){\n printf(\"0\\n\");\n }\n else{\n m=m-t[i];\n if(m>=p[i+1]/2){\n s=ge[i]+i;\n }\n if(s>ge[9])\n s=ge[9];\n printf(\"%d\\n\",s);\n }\n return 0;\n}\n/*2016-05-29 21:10:19.98*/"}, {"source_code": "n,t,i,j;\nfloat M[15][15],v;\nmain()\n{\n scanf(\"%d%f\",&n,M);\n for(;i=1?t++,M[i+1][j]+=v=M[i][j++]/2,M[i+1][j]+=v:j++;\n printf(\"%d\",t);\n}\n/*2017-10-19 21:15:00.236*/"}, {"source_code": "double M[15][15], k;\nint n, i, j, A;\nmain()\n{\n\n scanf(\"%d%lf\", &n, M);\n for(; i\n#define MAXLEVEL 20\n\nint main()\t{\n\tdouble cup[MAXLEVEL][MAXLEVEL];\n\tint n, i, j, m;\n\tscanf(\"%d %lf\", &n, &cup[0][0]);\t\n\tfor(i=1; i=1.00)\tm++;\n\n\tprintf(\"%d\\n\",m);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,t,level,ans,i,j,cnt=0;\n\tscanf(\"%d %d\",&n,&t);\n\tdouble arry[12][12];\n\tarry[1][1]=t;\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tfor(j=1;j<=i;j++)\n\t\t{\n\t\t\tif(arry[i][j]>=1)\n\t\t\t{\n\t\t\t\tarry[i+1][j]+=(arry[i][j]-1)/2;\n\t\t\t\tarry[i+1][j+1]+=(arry[i][j]-1)/2;\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\\n\",cnt);\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"}, {"source_code": "#include\n#include\n\nint cup[1000][1000];\nint main (){\n int h , t ;\n scanf(\"%d%d\",&h,&t);\n cup[0][0] = t;\n int cnt = 0;\n for (int i = 0;i=1){\n int x = cup[i][j] - 1;\n cup[i][j] = 1;\n cup[i+1][j]+= x/2;\n cup[i+1][j+1]+= x/2;\n cnt++;\n }\n }\n }\n printf(\"%d\\n\",cnt);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(void) {\n\tint i, j;\n\tint n, t;\n\tint amount[55] = {0}, ans;\n\n\tscanf(\"%d %d\", &n, &t);\n\n\twhile (t--) {\n\t\tamount[0] += 512;\n\t\tfor (i = 0; i < n - 1; i++) {\n\t\t\tconst int cur = i * (i + 1) / 2, next = (i + 1) * (i + 2) / 2;\n\t\t\tfor (j = cur; j < next; j++)\n\t\t\t\tif (amount[j] > 512) {\n\t\t\t\t\tamount[next + j - cur] += (amount[j] - 512) / 2;\n\t\t\t\t\tamount[next + j - cur + 1] += (amount[j] - 512) / 2;\n\t\t\t\t\tamount[j] = 512;\n\t\t\t\t}\n\t\t}\n\t}\n\n\tans = 0;\n\tfor (i = 0; i < n * (n + 1) / 2; i++)\n\t\tans += amount[i] == 512;\n\n\tprintf(\"%d\\n\", ans);\n\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n\tfloat t;\n\tint n;\n\tfloat arr[15][15];\n\tint i,j;\n\tscanf(\"%d %f\",&n,&t);\n\tfor(i=0;i<=n;i++)\n\t\tfor(j=0;j<=n;j++)\n\t\t\tarr[i][j] = 0;\n\ti=1;\n\tint ans = 0;\n\tarr[1][1] = t;\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tfor(j=1;j<=i;j++)\n\t\t{\n\t\t\tarr[i+1][j] += (arr[i][j] - 1)/2.0;\n\t\t\tarr[i+1][j+1] += (arr[i][j] - 1)/2.0;\n\t\t}\n\t}\n\tfor(i=1;i<=n;i++)\n\t\tfor(j=1;j<=n;j++)\n\t\t{\n\t\t\tif(arr[i][j] >= 1)\n\t\t\t\tans = ans + 1;\n\t\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n\tfloat t;\n\tint n;\n\tfloat arr[15][15];\n\tint i,j;\n\tscanf(\"%d %f\",&n,&t);\n\tfor(i=0;i<=n;i++)\n\t\tfor(j=0;j<=n;j++)\n\t\t\tarr[i][j] = 0;\n\tint flag = 0;\n\tif(t >= 1)\n\t\tarr[1][1] = 1;\n\telse\n\t{\n\t\tflag = 1;\n\t}\n\tdouble over = t;\n\tarr[1][1] = 1;\n\ti = 1;\n\tover = (over-1)/2;\n\twhile(i<=n && over > 0)\n\t{\n\t\tfor(j=1;j<=i;j++)\n\t\t{\n\t\t\tarr[i+1][j] += over;\n\t\t\tarr[i+1][j+1] += over;\n\t\t}\n\t\tover = (over-1)/2;\n\t\tif(over > 0)\n\t\t{\n\t\t\tfor(j=1;j<=i;j++)\n\t\t\t\tarr[i][j] = 1;\n\t\t}\n\t\ti = i + 1;\n\t}\n\tint ans=0;\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tfor(j=1;j<=i;j++)\n\t\t{\n\t\t\tif(arr[i][j] >= 1)\n\t\t\t\tans = ans + 1;\n\t\t}\n\t}\n\tif(flag == 0)\n\t\tprintf(\"%d\\n\",ans);\n\telse\n\t\tprintf(\"0\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \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\ndouble a[11][11] = {0};\n\nint main()\n{\n int n, t;\n scanf(\"%d %d\", &n, &t);\n\n int i, j;\n a[0][0] = t - 1;\n rep(i,1,n)\n {\n a[0][i] = a[0][i-1] / 2 - 1;\n a[i][0] = a[0][i];\n }\n rep(i,1,n)\n {\n rep(j,1,n)\n {\n a[i][j] = (a[i-1][j] + a[i][j-1])/2 - 1;\n }\n }\n int results = 0;\n rep(i,0,n)\n {\n rep(j,0,n)\n {\n if (a[i][j]>=0)\n {\n results++;\n }\n }\n }\n\n printf(\"%d\", results);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \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\ndouble a[15][15] = {-1};\n\nint main()\n{\n int n, t;\n scanf(\"%d %d\", &n, &t);\n\n int i, j;\n a[0][0] = t - 1;\n rep(i,1,n)\n {\n a[0][i] = a[0][i-1] / 2 - 1;\n a[i][0] = a[0][i];\n }\n rep(i,1,n)\n {\n rep(j,1,n)\n {\n a[i][j] = (a[i-1][j] + a[i][j-1])/2 - 1;\n }\n }\n int results = 0;\n rep(i,0,n)\n {\n rep(j,0,n-i)\n {\n //printf(\"%.1f \", a[i][j]);\n if (a[i][j]>=0)\n {\n results++;\n }\n }\n //printf(\"\\n\");\n }\n\n printf(\"%d\", results);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \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\ndouble a[11][11] = {0};\n\nint main()\n{\n int n, t;\n scanf(\"%d %d\", &n, &t);\n\n int i, j;\n a[0][0] = t - 1;\n rep(i,1,n)\n {\n a[0][i] = a[0][i-1] / 2 - 1;\n a[i][0] = a[0][i];\n }\n rep(i,1,n)\n {\n rep(j,1,n)\n {\n a[i][j] = (a[i-1][j] + a[i][j-1])/2 - 1;\n }\n }\n int results = 0;\n rep(i,0,n)\n {\n rep(j,0,n-i)\n {\n if (a[i][j]>=0)\n {\n results++;\n }\n }\n }\n\n printf(\"%d\", results);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \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\n//int main(int argc, const char * argv[]) {\n// // insert code here...\n//\n// int n, t, count = 0;\n// double a[12][12] = {0}, k;\n// int i, j;\n//// struct node{\n//// //no.\n//// int s; // 10 bits\n//// int\n//// };\n////\n//\n// // true baolo\n// scanf(\"%d%d\", &n, &t);\n//\n// a[1][1]=t;\n// for (i=1;i<=n;i++) {\n// for (j=1;j<=i;j++) {\n// if (a[i][j]>1-0.00001){\n// count++;\n// k=(a[i][j]-1)/2;\n// a[i+1][j]+=k;\n// a[i+1][j+1]=k;\n// }\n// }\n// }\n// for (i=1;i<=n;i++) {\n// for (j=1;j<=i;j++) {\n// printf(\"%.1f \",a[i][j]);\n// }\n// printf(\"\\n\");\n// }\n//\n//\n// printf(\"%d\\n\",count);\n//\n// // printf(\"Hello, World!\\n\");\n// return 0;\n//}\ndouble a[15][15] = {0};\n\nint main()\n{\n int n, t;\n scanf(\"%d %d\", &n, &t);\n\n int i, j;\n a[0][0] = t;\n rep(i,1,n)\n {\n a[0][i] = (a[0][i-1] - 1) / 2;\n a[i][0] = a[0][i];\n }\n rep(i,1,n)\n {\n rep(j,1,n)\n {\n if (a[i-1][j]>=1)\n {\n a[i][j] = a[i][j] + (a[i-1][j] - 1) / 2;\n }\n if (a[i][j-1]>=1)\n {\n a[i][j] = a[i][j] + (a[i][j-1] - 1) / 2;\n }\n }\n }\n int results = 0;\n rep(i,0,n)\n {\n rep(j,0,n-i)\n {\n printf(\"%.1f \", a[i][j]);\n if (a[i][j]>=1)\n {\n results++;\n }\n }\n printf(\"\\n\");\n }\n\n printf(\"%d\", results);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \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\ndouble a[15][15] = {-1};\n\nint main()\n{\n int n, t;\n scanf(\"%d %d\", &n, &t);\n\n int i, j;\n a[0][0] = t - 1;\n rep(i,1,n)\n {\n a[0][i] = a[0][i-1] / 2 - 1;\n a[i][0] = a[0][i];\n }\n rep(i,1,n)\n {\n rep(j,1,n)\n {\n a[i][j] = (a[i-1][j] + a[i][j-1])/2 - 1;\n }\n }\n int results = 0;\n rep(i,0,n)\n {\n rep(j,0,n-i)\n {\n //printf(\"%.1f \", a[i][j]);\n if (a[i][j]>=1e-9)\n {\n results++;\n }\n }\n //printf(\"\\n\");\n }\n\n printf(\"%d\", results);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \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\ndouble a[11][11] = {0};\ndouble b[11][11] = {0};\n\nint main()\n{\n int n, t;\n scanf(\"%d %d\", &n, &t);\n\n int i, j;\n\n rep(i,0,n)\n {\n rep(j,0,n)\n {\n if (i == 0)\n {\n a[i][j] = pow(2,j); b[i][j] = 1/a[i][j]; continue;\n }\n if (j == 0)\n {\n a[i][j] = pow(2,i); b[i][j] = 1/a[i][j]; continue;\n }\n b[i][j] = b[i][j-1]/2 + b[i-1][j]/2;\n a[i][j] = 1/b[i][j];\n }\n }\n\n double sum = 0;\n int results;\n int count;\n rep(i,0,n)\n {\n if (t=1?t++,M[i+1][j]+=v=(M[i][j]-1)/2,M[i+1][j+1]+=v:0;\n printf(\"%d\",t);\n}/*2017-10-19 21:07:45.029*/"}, {"source_code": "#include \n#define G 45\nfloat glasses[45];\n\nvoid fillchildren(int pos, int level, float amount) {\n float tmp = 0;\n if (pos + level < G)\n glasses[pos+level] += amount/2.0;\n if (pos + level + 1 < G)\n glasses[pos+level+1] += amount/2.0;\n if (glasses[pos+level] > 1) {\n tmp = glasses[pos+level]-1;\n glasses[pos+level] = 1;\n fillchildren(pos+level, level+1, tmp);\n }\n if (glasses[pos+level+1] > 1) {\n tmp = glasses[pos+level+1]-1;\n glasses[pos+level+1] = 1;\n fillchildren(pos+level+1, level+1, tmp);\n }\n}\n\nint main () {\n int n , t, i, k;\n scanf(\"%d %d\", &n, &t);\n if (t == 0)\n printf(\"0\");\n else {\n glasses[0] += 1;\n fillchildren(0,1, t-1);\n for(i = 0; i < G; i++){\n // printf(\"%g \", glasses[i]);\n if (glasses[i] >= 1)\n k++;\n }\n printf(\"%d\\n\", k);\n }\n}\n"}, {"source_code": "#include \n\nint main () {\n int n , t, i, sum=0;\n scanf(\"%d %d\", &n, &t);\n if (t == 0)\n printf(\"0\");\n else {\n sum = 0;\n int count = 1;\n for (i = 1; i <= n+1; i++) {\n sum += i;\n if (t <= sum) {\n if (t == sum) {\n printf(\"%d\", sum);\n break;\n }\n else if (t < sum) {\n printf(\"%d\", sum - i);\n break;\n }\n }\n count++;\n }\n }\n}\n"}, {"source_code": "#include \n#define G 45\nint glasses[10][10];\nint powers[10];\n\nvoid printmarix(int matrix[][10], int n, int m) {\n int i,j;\n for (i = 0; i < n; i++) {\n for (j = 0; j < m; j++) {\n printf(\"%d \", matrix[i][j]);\n }\n printf(\"\\n\");\n }\n printf(\"\\n\");\n}\n\nint main () {\n int n , t, i, j, volume, remaining, answer = 0;\n powers[0] = 1;\n powers[1] = 2;\n powers[2] = 4;\n powers[3] = 8;\n powers[4] = 16;\n powers[5] = 32;\n powers[6] = 64;\n powers[7] = 128;\n powers[8] = 256;\n powers[9] = 512;\n powers[10] = 1024;\n\n scanf(\"%d %d\", &n, &t);\n volume = powers[n];\n glasses[0][0] = t*volume;\n for (i = 0; i < n; i++)\n for (j = 0; j < i+1; j++) {\n printmarix(glasses, 10, 10);\n if (glasses[i][j] > volume) {\n remaining = glasses[i][j] - volume;\n glasses[i][j] = volume;\n glasses[i+1][j] += remaining/2;\n glasses[i+1][j+1] += remaining/2;\n }\n }\n\n for (i = 0; i < n; i++)\n for (j = 0; j < i+1; j++) {\n if (glasses[i][j] == volume)\n answer++;\n }\n printf(\"%d\\n\", answer);\n return 0;\n}\n"}, {"source_code": "#include \n#define G 45\nfloat glasses[45];\n\nvoid fillchildren(int pos, int level, float amount) {\n float tmp = 0;\n if (pos + level < G)\n glasses[pos+level] += amount/2.0;\n if (pos + level + 1 < G)\n glasses[pos+level+1] += amount/2.0;\n if (glasses[pos+level] > 1) {\n tmp = glasses[pos+level]-1;\n glasses[pos+level] = 1;\n fillchildren(pos+level, level+1, tmp);\n }\n if (glasses[pos+level+1] > 1) {\n tmp = glasses[pos+level+1]-1;\n glasses[pos+level+1] = 1;\n fillchildren(pos+level+1, level+1, tmp);\n }\n}\n\nint main () {\n int n , t, i, k;\n scanf(\"%d %d\", &n, &t);\n if (t == 0)\n printf(\"0\");\n else {\n glasses[0] += 1;\n fillchildren(0,1, t-1);\n for(i = 0; i < n*(n-1)/2; i++){\n // printf(\"%g \", glasses[i]);\n if (glasses[i] >= 1)\n k++;\n }\n printf(\"%d\\n\", k);\n }\n}\n"}, {"source_code": "#include \n\nint main(void) {\n\t// your code goes here\n\tfloat arr[1000][19];\n\tint i,j,k,l,m,n,t;\n\tfor(i=0;i<10;i++)for(j=0;j<19;j++){arr[i][j]=0;}\n\t\n\t\n\tscanf(\"%d%d\",&n,&t);\n\tarr[0][10]=t;\nint\tc=10;int count=0;\n\t \n\t int temp=1;\n\t for(i=0;i<1000;i++)\n\t { \n\t \n\t for(j=0;j<19;j++)\n\t {\n\t if(arr[i][j]-1>1) \n\t {float f=arr[i][j]-1;\n\t arr[i+1][j-1]=arr[i+1][j-1]+f/2; \n\t arr[i+1][j+1]=arr[i+1][j+1]+f/2;\n\t count++;\n\t if(count>=55)break;\n\t //printf(\"\\n%f\",f);\n\t } \n\t \n\t } if(count>=55)break; \n\t \n\t }\n\t \n\t \n\t \n\t printf(\"%d\",count);\n\t\n\t\n\t\n\t\n\treturn 0;\n}\n\n"}, {"source_code": "#include \n\nint main(void) {\n\t// your code goes here\n\tfloat arr[1000][19];\n\tint i,j,k,l,m,n,t;\n\tfor(i=0;i<10;i++)for(j=0;j<19;j++){arr[i][j]=0;}\n\t\n\t\n\tscanf(\"%d%d\",&n,&t);\n\tarr[0][10]=t;\nint\tc=10;int count=0;\n\t \n\t int temp=1;\n\t for(i=0;i<1000;i++)\n\t { \n\t \n\t for(j=0;j<19;j++)\n\t {\n\t if(arr[i][j]-1>1) \n\t {float f=arr[i][j]-1;\n\t arr[i+1][j-1]=arr[i+1][j-1]+f/2; \n\t arr[i+1][j+1]=arr[i+1][j+1]+f/2;\n\t count++;\n\t if(count>=55)break;\n\t //printf(\"\\n%f\",f);\n\t } \n\t \n\t } if(count>=55)break; \n\t \n\t }\n\t count=0;\n\t for(i=0;i=1)count++;}\n\t \n\t printf(\"%d\",count);\n\t\n\t\n\t\n\t\n\treturn 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n\tint n,t;\n\twhile(scanf(\"%d%d\",&n,&t)!=EOF)\n\t{\n\t\tdouble a[15][15]={0};\n\t\tint i,j,k;\n\t\tfor(k=1;k<=t;k++)\n\t\t{\n\t\t\ta[1][1]+=1;\n\t\t\tfor(i=2;i<=n;i++)\n\t\t\t\tfor(j=1;j=1)\n\t\t\t\t\t{\n\t\t\t\t\t\ta[i][j]+=(a[i-1][j]-1)/2;\n\t\t\t\t\t\ta[i][j+1]+=(a[i-1][j]-1)/2;\n\t\t\t\t\t\ta[i-1][j]=1;\n\t\t\t\t\t}\n\t\t}\n\t\tint num=0;\n\t\tfor(i=1;i<=n;i++)\n\t\t\tfor(j=1;j<=i;j++)\n\t\t\t\tif(a[i][j]==1)\n\t\t\t\t\tnum++;\n\t\tprintf(\"%d\\n\",num);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,t,i=6,j,c=2,k,d=0;\n scanf(\"%d%d\",&n,&t);\n if(t<1)\n printf(\"0\");\n else if(t>=1&&t<2)\n printf(\"1\");\n else if(t>=2&&t<4)\n printf(\"3\");\n else\n {\n while(1)\n {\n c++;\n d++;\n if(t=i-2)\n {\n c=((c-1)*(c))/2+d;\n break;\n }\n if(t>=i&&t\nint main()\n{\n int n,t,i=6,j,c=2,k,d=0;\n scanf(\"%d%d\",&n,&t);\n if(t<1)\n printf(\"0\");\n else if(t>=1&&t<2)\n printf(\"1\");\n else if(t>=2&&t<4)\n printf(\"3\");\n else\n {\n while(1)\n {\n c++;\n d++;\n if(t=i-2)\n {\n c=((c-1)*(c))/2+d;\n break;\n }\n if(t>=i&&t\nint main()\n{\n int n,t,i=7,j,c=2,k,d=0;\n scanf(\"%d%d\",&n,&t);\n if(t<1)\n printf(\"0\");\n else if(t>=1&&t<2)\n printf(\"1\");\n else if(t>=2&&t<4)\n printf(\"3\");\n else\n { \n while(c<=n)\n {\n c++;\n d++;\n if(t=i-2)\n {\n c=((c-1)*(c))/2+d;\n \n break;\n }\n if(t>=i&&t\nint main()\n{\n int n,t,i=6,j,c=2,k,d=0;\n scanf(\"%d%d\",&n,&t);\n if(t<1)\n printf(\"0\");\n else if(t>=1&&t<2)\n printf(\"1\");\n else if(t>=2&&t<4)\n printf(\"3\");\n else\n {\n while(1)\n {\n c++;\n d++;\n if(t=i-2)\n {\n c=((c-1)*(c))/2+d;\n break;\n }\n if(t>=i&&t\nint n,arr[10][10]={0},c=0;\nfloat t;\n\nvoid add(int x,int y,float value,int k)\n{\n float diff;\n if(value==0||n==k)\n {\n return;\n }\n else if(arr[x][y]==1)\n {\n add(x+1,y,value/2,k+1);\n add(x+1,y+1,value/2,k+1);\n }\n else if(arr[x][y]+value<1)\n {\n arr[x][y]=arr[x][y]+value;\n return;\n }\n else\n {\n diff=arr[x][y]+value-1;\n arr[x][y]=1;\n c++;\n add(x+1,y,diff/2,k+1);\n add(x+1,y+1,diff/2,k+1);\n }\n}\n\nint main(void) {\n scanf(\"%d%f\",&n,&t);\n\tadd(0,0,t,0);\n\tprintf(\"%d\",c);\n\treturn 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n int n,t,i=7,j,c=2,k,d=0;\n scanf(\"%d%d\",&n,&t);\n if(t<1)\n printf(\"0\");\n else if(t>=1&&t<3)\n printf(\"1\");\n else if(t>=3&&t<5)\n printf(\"3\");\n else\n { \n while(c<=n)\n {\n c++;\n d++;\n if(t=i-2)\n {\n c=((c-1)*(c))/2+d;\n \n break;\n }\n if(t>=i&&ti&&c==n)\n {\n c=(n*(n+1))/2;\n break;\n }\n \n i=i*2+1;\n }\n if(c<=(n*(n+1))/2)\n printf(\"%d\",c);\n else\n printf(\"%d\",(n*(n+1))/2);\n }\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,t,i=7,j,c=2,k,d=0;\n scanf(\"%d%d\",&n,&t);\n if(t<1)\n printf(\"0\");\n else if(t>=1&&t<2)\n printf(\"1\");\n else if(t>=2&&t<4)\n printf(\"3\");\n else\n { \n while(c<=n)\n {\n c++;\n d++;\n if(t=i-2)\n {\n c=((c-1)*(c))/2+d;\n \n break;\n }\n if(t>=i&&ti&&c==n)\n {\n c=(n*(n+1))/2;\n break;\n }\n \n i=i*2+1;\n }\n if(c<=(n*(n+1))/2)\n printf(\"%d\",c);\n else\n printf(\"%d\",(n*(n+1))/2);\n }\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,t,i=7,j,c=2,k,d=0;\n scanf(\"%d%d\",&n,&t);\n if(t<1)\n printf(\"0\");\n else if(t>=1&&t<2)\n printf(\"1\");\n else if(t>=2&&t<4)\n printf(\"3\");\n else\n { \n while(c<=n)\n {\n c++;\n d++;\n if(t=i-2)\n {\n c=((c-1)*(c))/2+d;\n \n break;\n }\n else if(t>=i&&t=i)\n c=(n*(n+1))/2;\n break;\n }\n \n i=i*2+1;\n }\n if(c<=(n*(n+1))/2)\n printf(\"%d\",c);\n else\n printf(\"%d\",(n*(n+1))/2);\n }\n return 0;\n}"}, {"source_code": "#include \n\nint main()\n\n{\n\tint k,n,t,i,num=1,j,g=0;\n\tfloat arr[12][10010];\n\tscanf(\"%d %d\",&n,&t);\n\tarr[1][1]=t;\n\n\t for(k=1;k<=n;k++)\n\t\t{\n\t\tfor(j=1;j=1)\n\t\t{\n\t\t\tg++;\n\t\t\tarr[k][j]--;\n\t\t}\n\n\t\t\tarr[k+1][j]+=arr[k][j]/2;\n\t arr[k+1][j+1]+=arr[k][j]/2;\n } \n }\n printf(\"%d\\n\",g);\n \t\n\n \treturn 0;\n }"}, {"source_code": "#include \n\nint main()\n\n{\n\tint k,n,t,i,num=1,j,g=0;\n\tfloat arr[12][10010];\n\tscanf(\"%d %d\",&n,&t);\n\tarr[1][1]=t;\n\n\t for(k=1;k<=n;k++)\n\t\t{\n\t\tfor(j=1;j=1)\n\t\t{\n\t\t\tg++;\n\t\t}\n\t\t\tarr[k][j]--;\n\n\n\t\t\tarr[k+1][j]+=arr[k][j]/2;\n\t arr[k+1][j+1]+=arr[k][j]/2;\n } \n }\n printf(\"%d\\n\",g);\n \t\n\n \treturn 0;\n }"}, {"source_code": "#include\n\nint main(){\n\tint n,t,i,j,gls=0;\n\tscanf(\"%d%d\",&n,&t);\n\tdouble ara[11][11];\n\tara[1][1]=t;\n\tfor(i=1;i<=n;i++){\n\t\tfor(j=1;j<=i;j++){\n\t\t\tif(ara[i][j]>=1){\n\t\t\t\tara[i+1][j] += (ara[i][j]-1)/2;\n\t\t\t\tara[i+1][j+1] += (ara[i][j]-1)/2;\n\t\t\t\tgls++;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\\n\",gls);\n\treturn 0;\n}\n"}, {"source_code": "#include\nmain()\n{\n int n,t,i,j,gls=0;\n\n scanf(\"%d%d\",&n,&t);\n double ara[12][12];\n ara[1][1]=(double)t;\n\n for(i=1;i<=n;i++) {\n for(j=1;j<=i;j++) {\n if(ara[i][j]>=1) {\n\n ara[i+1][j] +=(ara[i][j]-1)/2;\n ara[i+1][j+1] +=(ara[i][j]-1)/2;\n gls++;\n\n }\n }\n }\n printf(\"%d\",gls);\n}"}, {"source_code": "#include\n\nint main(){\n\tint n,t,s,i,j,gls=0;\n\tscanf(\"%d%d\",&n,&t);\n\tdouble ara[10][10];\n\tara[1][1]=t;\n\tfor(i=1;i<=n;i++){\n\t\tfor(j=1;j<=i;j++){\n\t\t\tif(ara[i][j]>=1){\n\t\t\t\tara[i+1][j] += (ara[i][j]-1)/2;\n\t\t\t\tara[i+1][j+1] += (ara[i][j]-1)/2;\n\t\t\t\tgls++;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\\n\",gls);\n}"}, {"source_code": "#include\nmain()\n{\n int n,t,i,j,gls=1;\n\n scanf(\"%d%d\",&n,&t);\n double ara[12][12];\n ara[1][1]=(double)t;\n\n for(i=1;i<=n;i++) {\n for(j=1;j<=i;j++) {\n if(ara[i][j]>=1) {\n\n ara[i+1][j] +=(ara[i][j]-1)/2;\n ara[i+1][j+1] +=(ara[i][j]-1)/2;\n gls++;\n\n }\n }\n }\n printf(\"%d\",gls);\n}\n"}, {"source_code": "#include\nmain()\n{\n int n,t,i,j,gls=0;\n\n scanf(\"%d%d\",&n,&t);\n double ara[12][12];\n ara[0][0]=t;\n\n for(i=0;i<=n-1;i++) {\n for(j=0;j<=i;j++) {\n if(ara[i][j]>=1) {\n\n ara[i+1][j] +=(ara[i][j]-1)/2;\n ara[i+1][j+1] +=(ara[i][j]-1)/2;\n gls++;\n\n }\n }\n }\n printf(\"%d\",gls);\n}\n"}, {"source_code": "#include\n\nint main(){\n\tint n,t,i,j,gls=0;\n\tscanf(\"%d%d\",&n,&t);\n\tdouble ara[11][11];\n\tara[0][0]=t;\n\tfor(i=0;i<=n-1;i++){\n\t\tfor(j=0;j<=i;j++){\n\t\t\tif(ara[i][j]>=1){\n\t\t\t\tara[i+1][j] += (ara[i][j]-1)/2;\n\t\t\t\tara[i+1][j+1] += (ara[i][j]-1)/2;\n\t\t\t\tgls++;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\",gls);\n}\n"}, {"source_code": "#include\n\nint main(){\n\tint n,t,i,j,gls=0;\n\tscanf(\"%d%d\",&n,&t);\n\tdouble ara[10][10];\n\tara[1][1]=t;\n\tfor(i=1;i<=n;i++){\n\t\tfor(j=1;j<=i;j++){\n\t\t\tif(ara[i][j]>=1){\n\t\t\t\tara[i+1][j] += (ara[i][j]-1)/2;\n\t\t\t\tara[i+1][j+1] += (ara[i][j]-1)/2;\n\t\t\t\tgls++;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\\n\",gls);\n}\n"}, {"source_code": "#include\n#define ll long long\n#define ld long double\n#define ui unsigned int\n#define ull unsigned ll\n#define foi(n) for(ll i=1;i=1)\n {\n ++ans ;\n G[i+1][j] += (G[i][j]-1)/2 ;\n G[i+1][j+1] += (G[i][j]-1)/2 ;\n }\n \n \n printf(\"%lld\",ans);\n return 0;\n}"}, {"source_code": "#include\n#define ll long long\n#define ld long double\n#define ui unsigned int\n#define ull unsigned ll\n#define foi(n) for(ll i=0;i=1)\n {\n ++ans ;\n G[i+1][j] += (G[i][j]-1)/2 ;\n G[i+1][j+1] += (G[i][j]-1)/2 ;\n }\n \n \n printf(\"%lld\",ans);\n return 0;\n}"}, {"source_code": "#include\nfloat ara[11][11];\n\nint main()\n{\n int n,i,j,t,x,count=0;\n scanf(\"%d %d\",&n,&t);\n for(x=1;x<=t;x++)\n {\n ara[1][1]++;\n for(i=1;i<=n;i++)\n {\n for(j=1;j<=n;j++)\n {\n if(ara[i][j]>1)\n {\n ara[i+1][j]+=(ara[i][j]-1)/2.0;\n ara[i][j+1]+=(ara[i][j]-1)/2.0;\n ara[i][j]=1;\n }\n }\n }\n }\n\n for(i=1;i<=n;i++)\n {\n for(j=1;j<=n;j++)\n {\n if(ara[i][j]==1)\n count++;\n }\n }\n printf(\"%d\\n\",count);\n\n return 0;\n}\n"}], "src_uid": "b2b49b7f6e3279d435766085958fb69d"} {"nl": {"description": "An expedition group flew from planet ACM-1 to Earth in order to study the bipedal species (its representatives don't even have antennas on their heads!).The flying saucer, on which the brave pioneers set off, consists of three sections. These sections are connected by a chain: the 1-st section is adjacent only to the 2-nd one, the 2-nd one — to the 1-st and the 3-rd ones, the 3-rd one — only to the 2-nd one. The transitions are possible only between the adjacent sections.The spacecraft team consists of n aliens. Each of them is given a rank — an integer from 1 to n. The ranks of all astronauts are distinct. The rules established on the Saucer, state that an alien may move from section a to section b only if it is senior in rank to all aliens who are in the segments a and b (besides, the segments a and b are of course required to be adjacent). Any alien requires exactly 1 minute to make a move. Besides, safety regulations require that no more than one alien moved at the same minute along the ship.Alien A is senior in rank to alien B, if the number indicating rank A, is more than the corresponding number for B.At the moment the whole saucer team is in the 3-rd segment. They all need to move to the 1-st segment. One member of the crew, the alien with the identification number CFR-140, decided to calculate the minimum time (in minutes) they will need to perform this task.Help CFR-140, figure out the minimum time (in minutes) that all the astronauts will need to move from the 3-rd segment to the 1-st one. Since this number can be rather large, count it modulo m.", "input_spec": "The first line contains two space-separated integers: n and m (1 ≤ n, m ≤ 109) — the number of aliens on the saucer and the number, modulo which you should print the answer, correspondingly.", "output_spec": "Print a single number — the answer to the problem modulo m.", "sample_inputs": ["1 10", "3 8"], "sample_outputs": ["2", "2"], "notes": "NoteIn the first sample the only crew member moves from segment 3 to segment 2, and then from segment 2 to segment 1 without any problems. Thus, the whole moving will take two minutes.To briefly describe the movements in the second sample we will use value , which would correspond to an alien with rank i moving from the segment in which it is at the moment, to the segment number j. Using these values, we will describe the movements between the segments in the second sample: , , , , , , , , , , , , , , , , , , , , , , , , , ; In total: the aliens need 26 moves. The remainder after dividing 26 by 8 equals 2, so the answer to this test is 2."}, "positive_code": [{"source_code": "#include \n\nlong long f(long long p, int n, int m)\n{\n if (n == 1) {\n return p;\n } else if (n % 2 == 0) {\n return f(p * p % m, n / 2, m);\n } else {\n return f(p, n - 1, m) * p % m;\n }\n}\n\nint main()\n{\n int n, m;\n long long x;\n \n scanf(\"%d %d\", &n, &m);\n \n x = f(3, n, m);\n \n printf(\"%d\\n\", (int)((x - 1 + m) % m));\n \n return 0;\n}\n"}, {"source_code": "#include \n\ntypedef __int64 LL;\n\nLL F(LL A,LL N,LL M)\n{\n int ret=1;\n while(N)\n {\n if(N&1)\n {\n ret=(ret%M*A%M)%M;\n }\n A=(A*A)%M;\n N>>=1;\n }\n return ret;\n}\n\nint main()\n{\n LL N,M;\n scanf(\"%I64d %I64d\",&N,&M);\n printf(\"%I64d\\n\",(F(3,N,M)+M-1)%M);\n return 0;\n}\n"}, {"source_code": "#include\n long int power(long long int x,long long int n,long long int m)\n { long long int p;\n if(n==1)\n return(x%m);\n else\n { p=(power(x,n/2,m))%m;\n if(n%2==0)\n return((p*p)%m);\n else\n return((x*p*p)%m);}\n }\nint main()\n{\n long long int n,m,c;\n scanf(\"%I64d%I64d\",&n,&m);\n c=power(3,n,m)%m;\n if(c==0)\n printf(\"%I64d\",m-1);\n else\n printf(\"%I64d\",c-1);\n return(0);\n}\n"}, {"source_code": "/*\n nash007 (Nishant Agrawal)\n IIIT Hyderabad\n*/\n#include\n#include\n#include\n#include\n\n#define MAX 1000000007\n#define swap(a,b) a=a+b-(b=a)\n#define abs(a) (a>0)?a:(-1*a)\n\n//a -> 97; A -> 65; 0 -> 48\n\nint cmp(const void *a,const void *b)\n{\n return (*(int*)a - *(int*)b);\n} \nlong long int mod;\nvoid f(long long int p)\n{\n long long ans=1,n=3;\n while(p)\n {\n \n if(p&1)ans=(ans*n)%mod;\n n=(n*n)%mod;\n p=p>>1;\n }\n ans--;\n while(ans<0)ans+=mod;\n printf(\"%lld\",ans);\n}\n\nint main()\n{\n long long int n;\n scanf(\"%lld%lld\",&n,&mod);\nf(n);\n\n return 0;\n}\n\n"}, {"source_code": "#include\nlong long int power(long long int x,long long int y,long long int m)\n{\n long long int e;\n if(y==1)\n return(x%m);\n e=power(x,y/2,m);\n if(y%2==1)\n return((x*e*e)%m);\n else\n return((e*e)%m);\n}\nmain()\n{\n long long int n,m,e;\n scanf(\"%I64d%I64d\",&n,&m);\n e=power(3,n,m);\n if(e==0)\n e=m-1;\n else\n e--;\n printf(\"%I64d\",e);\n return(0);\n}\n"}, {"source_code": "#include\nlong long MOD;\nlong long int pow(long long int a,long long int b)\n{\n long long int x=1,y=a;\n while(b > 0LL)\n {\n if(b%2 == 1)\n {\n x=(x*y);\n if(x>MOD) x%=MOD;\n }\n y = (y*y);\n if(y>MOD) y%=MOD;\n b /= 2;\n }\n return x;\n}\nint main()\n{\n long long int n,i,ans;\n scanf(\"%lld%lld\",&n,&MOD);\n ans=pow(3,n);\n if(ans)\n printf(\"%lld\",ans-1);\n else\n printf(\"%lld\",MOD-1);\n return 0;\n}\n"}, {"source_code": "#include \n\nlong long power(long long x, long long p, long long mod){\n if (p == 0ll)\n return 1ll;\n long long a = power(x, p / 2ll, mod);\n long long res = a * a;\n res %= mod;\n if (p % 2)\n res *= x;\n res %= mod;\n return res;\n}\n\nint main(int argc, char** argv) {\n long long n, m;\n \n scanf(\"%I64d%I64d\", &n, &m);\n printf(\"%I64d\\n\", (power(3ll, n, m) + m - 1) % m);\n \n return 0;\n}\n"}, {"source_code": "#include\nint power(int n,int x)\n{\n\tlong long ans=1,mult;\n\tmult=3;\n\twhile(n)\n\t{\n\t\tif(n&1)ans=(ans*mult)%x;\n\t\tmult=(mult*mult)%x;\n\t\tn/=2;\n\t}\n\tif(ans)\n\treturn (int)ans-1;\n\telse return x-1;\n}\nint main()\n{\n\tint n,x,i;\n//\tlong long ans=3;\n\tscanf(\"%d%d\",&n,&x);\n\n//\tfor(i=1;i\n#include \n\nint n,m;\n\nint modpow(int d,int x,int M){\n long long res=1,temp=d;\n while(x){\n if(x&1){res*=temp; res%=M;}\n temp=(temp*temp)%M;\n x>>=1;\n }\n return (int)res;\n}\n\nmain(){\n scanf(\"%d%d\",&n,&m);\n int ans = (modpow(3,n,m)+m-1)%m;\n printf(\"%d\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tint n, m, res, t;\n\tscanf(\"%d%d\", &n, &m);\n\tfor ( res = 1, t = 3; n; n >>= 1 )\n\t{\n\t\tif ( n & 1 )\n\t\t\tres = res * (long long) t % m;\n\t\tt = t * (long long) t % m;\n\t}\n\tif ( --res < 0 )\n\t\tres += m;\n\tprintf(\"%d\\n\", res);\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint m;\n\nint make3pow(int n){\n unsigned long long tmp,prod=1;\n int i,j;\n for(i=0;(n>>i)>0;i++){\n if(((n>>i)&1)){\n tmp=3;\n for(j=0;j\n#include\n#include\n#define SORT(a,n) qsort(a,n,sizeof(int),intcmp)\n#define s(n) scanf(\"%d\",&n)\n#define sc(n) scanf(\"%c\",&n)\n#define sl(n) scanf(\"%I64d\",&n)\n#define sf(n) scanf(\"%lf\",&n)\n#define ss(n) scanf(\"%s\",n)\n#define 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 \n#define MODBY 1000000007\n\ntypedef long long int lld;\ntypedef long double Lf;\n\nint mypow(int a, int b,int m)\n{\n\tlong long int ans=1,mult=a;\n\twhile(b){\n\t\tif(b&1)\n\t\t\tans=(ans*mult)%m;\n\t\tmult*=mult;\n mult%=m;\n\t\tb>>=1;\n\t}\n\treturn (int)ans;\n}\nint main()\n{\n int cases;\n int i,j,n,m;\n scanf(\"%d\",&n);\n scanf(\"%d\",&m);\n printf(\"%d\\n\",(mypow(3,n,m)-1+m)%m);\n return 0;\n}\n"}, {"source_code": "#include \n\nlong long f(long long p, int n, int m)\n{\n if (n == 1) {\n return p;\n } else if (n % 2 == 0) {\n return f(p * p % m, n / 2, m);\n } else {\n return f(p, n - 1, m) * p % m;\n }\n}\n\nint main()\n{\n int n, m;\n long long x;\n \n scanf(\"%d %d\", &n, &m);\n \n x = f(3, n, m);\n \n printf(\"%d\\n\", (int)((x - 1 + m) % m));\n \n return 0;\n}\n"}, {"source_code": "#include \n\ntypedef __int64 LL;\n\nLL F(LL A,LL N,LL M)\n{\n int ret=1;\n while(N)\n {\n if(N&1)\n {\n ret=(ret%M*A%M)%M;\n }\n A=(A*A)%M;\n N>>=1;\n }\n return ret;\n}\n\nint main()\n{\n LL N,M;\n scanf(\"%I64d %I64d\",&N,&M);\n printf(\"%I64d\\n\",(F(3,N,M)+M-1)%M);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nlong long int power(int x, int y, int m)\n{\n\tif (y==1) return x % m;\n\tif (y==0) return 1;\n\tlong long int t = power(x, y / 2, m);\n\tif (y & 1)\n\t\treturn (((t*t) % m) * x) % m;\n\telse return (t*t) % m;\n}\n\nint main()\n{\n\tint i,j,x,y,n,m;\n\tscanf(\"%d %d\", &n, &m);\n\t\n\tlong long int res = (power(3, n, m) - 1 + m) % m;\n\tprintf(\"%I64d\\n\", res);\n\treturn 0;\n}"}, {"source_code": "#include\n\nlong long int modPow(long long int e, long long int n,long long int m);\n\nint main()\n{\n long long int n,m,ans;\n scanf(\"%I64d %I64d\",&n,&m);\n\n ans= ((modPow(3,n,m)-1+m)%m);\n printf(\"%I64d\",ans);\n\n return 0;\n}\n\nlong long int modPow(long long int e, long long int n,long long int m)\n{\n if(n==1)\n {\n return e;\n }\n else\n {\n long long int ans=((modPow(e,n/2,m))%m);\n if((n%2) == 0)\n return ((ans*ans)%m);\n else\n return ((ans*ans*e)%m);\n }\n}\n"}, {"source_code": "#include \n\nint main()\n{\n long long int n, m, res=3, sob=1;\n scanf(\" %I64d %I64d\", &n, &m);\n while(1)\n {\n if(n==1)\n break;\n if(n%2>0)\n {\n sob=(sob*res)%m;\n n-=1;\n }\n res = (res*res) % m;\n\n n/=2;\n }\n if((sob*res)%m)\n printf(\"%I64d\", (sob*res)%m-1);\n else\n printf(\"%I64d\", m-1);\n return 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n long n, m;\n scanf(\"%ld %ld\", &n, &m);\n long long ans = 1;\n long long a = 3;\n while(n)\n {\n if(n & 1)\n {\n ans *= a;\n ans %= m;\n }\n a *= a;\n a %= m;\n n >>= 1;\n }\n ans--;\n if(ans < 0)\n {\n ans += m;\n }\n printf(\"%lld\", ans);\n return 0;\n}"}], "negative_code": [{"source_code": "#include\n long int power(long int n,long int m)\n { long int p;\n if(n==1)\n return(3);\n else\n { p=power(n/2,m);\n if(n%2==0)\n return((p*p)%m);\n else\n return((3*p*p)%m);}\n }\nint main()\n{\n long int n,m,c;\n scanf(\"%ld%ld\",&n,&m);\n c=power(n,m);\n if(c==0)\n printf(\"%ld\",m-1);\n else\n printf(\"%ld\",c-1);\n return(0);\n}\n"}, {"source_code": "/*\n nash007 (Nishant Agrawal)\n IIIT Hyderabad\n*/\n#include\n#include\n#include\n#include\n\n#define MAX 1000000007\n#define swap(a,b) a=a+b-(b=a)\n#define abs(a) (a>0)?a:(-1*a)\n\n//a -> 97; A -> 65; 0 -> 48\n\nint cmp(const void *a,const void *b)\n{\n return (*(int*)a - *(int*)b);\n} \nlong long int mod;\nvoid f(long long int p)\n{\n long long ans=1,n=3;\n while(p)\n {\n \n if(p&1)ans=(ans*n)%mod;\n n=(n*n)%mod;\n p=p>>1;\n }\n ans--;\n// while(ans<0)ans+=mod;\n printf(\"%lld\",ans);\n}\n\nint main()\n{\n long long int n;\n scanf(\"%lld%lld\",&n,&mod);\nf(n);\n\n return 0;\n}\n\n"}, {"source_code": "#include\nint power(int n,int x)\n{\n\tlong long ans=1,mult;\n\tmult=3;\n\twhile(n)\n\t{\n\t\tif(n&1)ans=(ans*mult)%x;\n\t\tmult=(mult*mult)%x;\n\t\tn/=2;\n\t}\n\treturn (int)ans-1;\n}\nint main()\n{\n\tint n,x,i;\n//\tlong long ans=3;\n\tscanf(\"%d%d\",&n,&x);\n\n//\tfor(i=1;i\n\nint main()\n{\n\tunsigned n, m, res, t;\n\tscanf(\"%d%d\", &n, &m);\n\tfor ( res = t = 1; n; n >>= 1 )\n\t{\n\t\tt = 3 * t % m;\n\t\tif ( n & 1 )\n\t\t\tres = res * t % m;\n\t}\n\tprintf(\"%d\\n\", (res + m - 1) % m);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tint n, m, res, t;\n\tscanf(\"%d%d\", &n, &m);\n\tfor ( res = t = 1; n; n >>= 1 )\n\t{\n\t\tt = 3 * t % m;\n\t\tif ( n & 1 )\n\t\t\tres = res * t % m;\n\t}\n\tprintf(\"%d\\n\", (res + m - 1) % m);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tunsigned n, m, res, t;\n\tscanf(\"%d%d\", &n, &m);\n\tfor ( res = t = 1; n; n >>= 1 )\n\t{\n\t\tt = 3 * t % m;\n\t\tif ( n & 1 )\n\t\t\tres = res * (long long) t % m;\n\t}\n\tprintf(\"%d\\n\", (res + m - 1) % m);\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint m;\n\nint make3pow(int n){\n unsigned long long tmp,prod=1;\n int i,j;\n for(i=0;(n>>i)>0;i++){\n if(((n>>i)&1)){\n tmp=3;\n for(j=0;j\n\nint m;\n\nint make3pow(int n){\n unsigned long long tmp,prod=1;\n int i,j;\n for(i=0;(n>>i)>0;i++){\n if((n>>i)&1){\n tmp=3;\n for(j=0;j\n\nint F(int A,int N,int M)\n{\n int ret=1;\n while(N)\n {\n if(N&1)\n {\n ret=(ret%M*A%M)%M;\n }\n A=(A%M*A%M)%M;\n N>>=1;\n }\n return ret;\n}\n\nint main()\n{\n int N,M,Ans;\n scanf(\"%d %d\",&N,&M);\n Ans=(F(3,N,M)-1)%M;\n if(Ans<0)\n {\n Ans+=M;\n }\n printf(\"%d\\n\",Ans);\n return 0;\n}\n"}, {"source_code": "#include \n\nint F(int A,int N,int M)\n{\n int ret=1;\n while(N)\n {\n if(N&1)\n {\n ret=(ret%M*A%M)%M;\n }\n A=(A%M*A%M)%M;\n N>>=1;\n }\n return ret;\n}\n\nint main()\n{\n int N,M,Ans;\n scanf(\"%d %d\",&N,&M);\n Ans=(F(3,N,M)-1%M)%M;\n if(Ans<0)\n {\n Ans+=M;\n }\n printf(\"%d\\n\",Ans);\n return 0;\n}\n"}, {"source_code": "#include \n\nint modExp(int n,int p,int m)\n{\n int k=1;\n n%=m;\n while(p!=1)\n {\n if(0!=(p&1))\n k=(k*n)%m;\n n=(n*n)%m;\n p>>=1;\n }\n return(n*k)%m;\n}\n\nint main()\n{\n int N,M,Ans;\n scanf(\"%d %d\",&N,&M);\n Ans=(modExp(3,N,M)-1%M)%M;\n if(Ans<0)\n {\n Ans+=M;\n }\n printf(\"%d\\n\",Ans);\n return 0;\n}\n"}, {"source_code": "#include \n\nint modExp(int n,int p,int m)\n{\n int k=1;\n n%=m;\n while(p!=1)\n {\n if(0!=(p&1))\n {\n k=(k*n)%m;\n }\n n=(n*n)%m;\n p>>=1;\n }\n return(n*k)%m;\n}\n\nint main()\n{\n int N,M,Ans;\n scanf(\"%d %d\",&N,&M);\n Ans=(modExp(3,N,M)-1)%M;\n if(Ans<0)\n {\n Ans+=M;\n }\n printf(\"%d\\n\",Ans);\n return 0;\n}\n"}, {"source_code": "#include \n\nint modExp(int n,int p,int m)\n{\n int k=1;\n n%=m;\n while(p!=1)\n {\n if(0!=(p&1))\n {\n k=(k*n)%m;\n }\n n=(n*n)%m;\n p>>=1;\n }\n return(n*k)%m;\n}\n\nint main()\n{\n int N,M;\n scanf(\"%d %d\",&N,&M);\n printf(\"%d\\n\",modExp(3,N,M)-1);\n return 0;\n}\n"}, {"source_code": "#include \n\nint modExp(int n,int p,int m)\n{\n int k=1;\n n%=m;\n while(p!=1)\n {\n if(0!=(p&1))\n {\n k=(k*n)%m;\n }\n n=(n*n)%m;\n p>>=1;\n }\n return(n*k)%m;\n}\n\nint main()\n{\n int N,M;\n scanf(\"%d %d\",&N,&M);\n printf(\"%d\\n\",(modExp(3,N,M)-1)%M);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n\tint i,j,x,y,n,m;\n\tscanf(\"%d %d\", &n, &m);\n\t\n\tlong long int res = ((((n * n) % m) * n) % m - (n / 3) % m + m) % m;\n\tprintf(\"%I64d\\n\", res);\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n\tint n, m, res=3, sob=1;\n\tscanf(\" %d %d\", &n, &m);\n\twhile(1)\n\t{\n\t\tif(n==1)\n\t\t\tbreak;\n\t\tif(n%2>0)\n\t\t{\n\t\t\tsob=(sob*res)%m;\n\t\t\tn-=1;\n\t\t}\n\t\tres = (res*res) % m;\n\n\t\tn/=2;\n\t}\n\tif((sob*res)%m)\n\t\tprintf(\"%d\", (sob*res)%m-1);\n\telse\n\t\tprintf(\"%d\", m-1);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nlong long m;\n\nlong binpow (long long a, long long n) \n{\n long long res = 1;\n while (n)\n {\n if (n & 1)\n {\n res *= a;\n res %= m;\n }\n a *= a;\n a %= m;\n n >>= 1;\n }\n return res;\n}\n\nint main()\n{\n long long n;\n scanf(\"%lld %lld\", &n, &m);\n printf(\"%lld\", binpow(3, n) - 1);\n return 0;\n}"}, {"source_code": "#include \n#include \n\nlong long m;\n\nlong binpow (long long a, long long n) \n{\n long long res = 1;\n while (n)\n {\n if (n & 1)\n {\n res *= a;\n res %= m;\n }\n a *= a;\n a %= m;\n n >>= 1;\n }\n return res;\n}\n\nint main()\n{\n long long n;\n scanf(\"%lld %lld\", &n, &m);\n printf(\"%lld\", (binpow(3, n) + m - 1) % m);\n return 0;\n}"}, {"source_code": "#include \n#include \n\nlong long m;\n\nlong long binpow (long long a, long long n) \n{\n long long res = 1;\n while (n)\n {\n if (n & 1)\n {\n res *= a;\n res %= m;\n }\n a *= a;\n a %= m;\n n >>= 1;\n }\n return res;\n}\n\nint main()\n{\n long long n;\n scanf(\"%lld %lld\", &n, &m);\n long long ans = binpow(3, n) - 1;\n printf(\"%lld\", (ans < 0) ? (ans + m) : ans );\n return 0;\n}"}, {"source_code": "#include \n#include \n\nlong long m;\n\nlong binpow (long long a, long long n) \n{\n long long res = 1;\n while (n)\n {\n if (n & 1)\n {\n res *= a;\n res %= m;\n }\n a *= a;\n a %= m;\n n >>= 1;\n }\n return res;\n}\n\nint main()\n{\n long long n;\n scanf(\"%lld %lld\", &n, &m);\n long long ans = binpow(3, n) - 1;\n printf(\"%lld\", (ans < 0) ? ans + m : ans );\n return 0;\n}"}], "src_uid": "c62ad7c7d1ea7aec058d99223c57d33c"} {"nl": {"description": "The 9-th grade student Gabriel noticed a caterpillar on a tree when walking around in a forest after the classes. The caterpillar was on the height h1 cm from the ground. On the height h2 cm (h2 > h1) on the same tree hung an apple and the caterpillar was crawling to the apple.Gabriel is interested when the caterpillar gets the apple. He noted that the caterpillar goes up by a cm per hour by day and slips down by b cm per hour by night.In how many days Gabriel should return to the forest to see the caterpillar get the apple. You can consider that the day starts at 10 am and finishes at 10 pm. Gabriel's classes finish at 2 pm. You can consider that Gabriel noticed the caterpillar just after the classes at 2 pm.Note that the forest is magic so the caterpillar can slip down under the ground and then lift to the apple.", "input_spec": "The first line contains two integers h1, h2 (1 ≤ h1 < h2 ≤ 105) — the heights of the position of the caterpillar and the apple in centimeters. The second line contains two integers a, b (1 ≤ a, b ≤ 105) — the distance the caterpillar goes up by day and slips down by night, in centimeters per hour.", "output_spec": "Print the only integer k — the number of days Gabriel should wait to return to the forest and see the caterpillar getting the apple. If the caterpillar can't get the apple print the only integer  - 1.", "sample_inputs": ["10 30\n2 1", "10 13\n1 1", "10 19\n1 2", "1 50\n5 4"], "sample_outputs": ["1", "0", "-1", "1"], "notes": "NoteIn the first example at 10 pm of the first day the caterpillar gets the height 26. At 10 am of the next day it slips down to the height 14. And finally at 6 pm of the same day the caterpillar gets the apple.Note that in the last example the caterpillar was slipping down under the ground and getting the apple on the next day."}, "positive_code": [{"source_code": "#include\nint h1,h2,v1,v2,i,j,t;\nint main()\n{\n\t\n\tscanf(\"%d%d\",&h1,&h2);\n\tscanf(\"%d%d\",&v1,&v2);\n\tt=0;\n\ti=h1;\n\tj=1;\n\twhile(i=h2)\n\t {\n\t \tbreak;\n\t }\n\t else\n\t {\n\t \tt++; \n\t \ti-=v2*12;\n\t }\n\t}\n\tprintf(\"%d\\n\",t);\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint h1,h2,a,b,diff=0,height=0,day,val=0;\n\tscanf(\"%d%d\",&h1,&h2);\n\tscanf(\"%d%d\",&a,&b);\n\tdiff = h2-h1;\n\theight= diff-8*a+12*b;\n\tday=0;\n\tval=val+12*b-12*a;\n\tif (8*a=a)\n\t\tday=-1;\n\telse if (8*a>diff)\n\t\tday=0;\n\telse\n\t{\n\t\twhile (height>12*b)\n\t\t{\n\t\t\theight+=val;\n\t\t\tday=day+1;\n\t\t}\n\t}\n\tprintf(\"%d\",day);\n\treturn 0;\n}\n\n"}, {"source_code": "#include \n#include \n\n\nint h1,h2,a,b,nr;\n\nint main()\n{\n scanf(\"%d %d %d %d\",&h1,&h2,&a,&b);\n h1=h1+a*8;\n if(h1>=h2)\n printf(\"0\");\n else\n if(a<=b)\n printf(\"-1\");\n while(h1

b)\n {\n h1=h1-12*b;\n h1=h1+12*a;\n nr++;\n\n if(h1>=h2)\n printf(\"%d\",nr);\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,m,a,b,i,j;\n scanf(\"%d %d %d %d\",&n,&m,&a,&b);\n if(a<=b)\n {\n if(a*8>=(m-n))\n printf(\"0\\n\");\n else\n printf(\"-1\\n\");\n }\n\n else\n {\n i=0;\n while(1)\n {\n n+=8*a;\n if(n>=m)\n {\n printf(\"%d\\n\",i);\n break;\n }\n i++;\n n-=12*b;\n n+=4*a;\n if(n>=m)\n {\n printf(\"%d\\n\",i);\n break;\n }\n\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int h1, h2, a, b, count=0;\n scanf(\"%d %d\",&h1,&h2);\n scanf(\"%d %d\",&a,&b);\n if(a<=b && a*8=h2) break;\n else h1 = h1 - 12*b;\n count++;\n temp = 4*a;\n }\n printf(\"%d\\n\",count);\n }\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \n#include \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\nint main()\n{\n int h1, h2;\n scanf(\"%d %d\", &h1, &h2);\n int a, b;\n scanf(\"%d %d\", &a, &b);\n\n if (h2-h1a*8) && (a<=b))\n {\n printf(\"-1\"); return 0;\n }\n\n int day = 0;\n int dayend,nightend;\n while (1)\n {\n if (day == 0)\n {\n dayend = h1 + a * 8;\n }\n else\n {\n dayend = nightend + a * 12;\n }\n if (dayend>=h2)\n {\n printf(\"%d\",day); return 0;\n }\n nightend = dayend - b * 12;\n// if (nightend<=0)\n// {\n// printf(\"%d\",day+1); return 0;\n// }\n day++;\n }\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(){\n int a,b;\n scanf(\"%d%d\",&a,&b);\n int ai,bi;\n scanf(\"%d%d\",&ai,&bi);\n int k = b - (a + ai * 8);\n if(k <= 0){\n printf(\"0\\n\");\n }\n else if(ai <= bi){\n printf(\"-1\\n\");\n }\n else{\n printf(\"%d\\n\",(k - 1) / ((ai - bi) * 12) + 1);\n }\n}\n"}, {"source_code": "#include\nint main()\n{\n int h1,h2,a,b,k=0,i;\n scanf(\"%d%d%d%d\",&h1,&h2,&a,&b);\n if(h2>h1+8*a&&b>=a) printf(\"-1\");\n else{\n while(1){\n if(k==0) h1+=8*a;\n else h1+=12*a;\n if(h1>=h2) break;\n h1-=12*b;k++;\n }\n printf(\"%d\",k);\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int a,b,x,y;\n long long int ans=0;\n scanf(\"%lld%lld\",&x,&y);\n scanf(\"%lld%lld\",&a,&b);\n long long int d,d1,d2;\n d=y-x;\n d1=a*8;\n if (d10)\n {\n d=d2+b*12;\n d2=d-a*12;\n ans++;\n\n }\n }\n printf(\"%lld\\n\",ans );\n return 0;\n}\n\n\n"}, {"source_code": "#include\nint main(){\nint a,b,c,d;\nscanf(\"%d%d\",&a,&b);\nint up,down;\nscanf(\"%d%d\",&up,&down);\nint minus=((8*up+a)-(12*down))+4*up;\nif(minus<=a && ((8*up)+a)=b){\nprintf(\"%d\",0);\nreturn 0;\n}}\nint cnt=0; int ind=0;\nwhile(1){\nif(!ind){\nfor(i=0;i<12;i++){\na=a-down;\nif(a>=b){\nprintf(\"%d\",cnt);\nreturn 0;\n}\n}\nind=1;\ncnt++;\n}\nelse{\nfor(i=0;i<12;i++){\na=a+up;\nif(a>=b){\nprintf(\"%d\",cnt);\nreturn 0;\n}\n}\nind=0;\n}\n}\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint h1,h2,a,b;\n\tscanf(\"%d%d%d%d\",&h1,&h2,&a,&b);\n\tint x=h1+(a*8);int remh;\n\tif(x>=h2){\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\telse\n\t\th1=h1+(a*8);\n\tif(b>=a){\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\tlong long int day=0;\n\twhile(h1\nint main()\n{\n\tlong h1,h2,a,b,n=0;\n\tscanf(\"%ld %ld\",&h1,&h2);\n\tscanf(\"%ld %ld\",&a,&b);\n\tif(a<=b)\n\t{\n\t\tif((a*8+h1)>=h2)\n\t\t\tprintf(\"0\\n\");\n\t\telse\n\t\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\th1+=a*8;\n\twhile(1)\n\t{\n\t\tif(h1>=h2)\n\t\t{\n\t\t\tprintf(\"%ld\\n\",n);\n\t\t\tbreak;\n\t\t}\n\t\tn++;\n\t\th1-=b*12;\n\t\th1+=a*12;\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include \nint main()\n{\n\tint h1,h2,a,b;\n\tlong long count;\n\tscanf(\"%d %d\",&h1,&h2);\n\tscanf(\"%d %d\",&a,&b);\n\tif(a<=b && (8*a)<(h2-h1)){\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\tif((h2-h1)<= (8*a)){\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\tcount = 1;\n\th1 = h1 + (8*a) - (12*b);\n\twhile(h1=h2){\n\t\t\tbreak;\n\t\t}\n\t\th1 = h1 - (12*b);\n\t\tcount++;\n\t}\n\tprintf(\"%lld\\n\",count);\n\treturn 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n long long int i,h1,h2,a,b,dis,final1;\n scanf(\"%I64d %I64d\",&h1,&h2);\n scanf(\"%I64d %I64d\",&a,&b);\n dis=h1;\n final1=h2;\n\n i=0;\n while(dis<=h2)\n {\n if(i==0)\n {\n dis=dis+8*a;\n }\n if(i>=1)\n dis=dis+(12*a);\n if(dis>=h2)\n break;\n dis=dis-(2*b);\n if(dis>=h2)\n break;\n i++;\n dis=dis-(10*b);\n if(dis>=h2)\n break;\n if(i>=9000)\n {\n printf(\"-1\");\n return 0;\n }\n }\n printf(\"%I64d\",i);\n return 0;\n}\n"}, {"source_code": "#include \n\n/*\n * http://codeforces.com/problemset/problem/652/A\n */\nint main()\n{\n int hc = 0, ha = 0;\n scanf(\"%d %d\", &hc, &ha);\n\n int a = 0, b = 0, d = 0;\n scanf(\"%d %d\", &a, &b);\n\n hc += 8 * a;\n\n if (hc < ha && a <= b) {\n printf(\"-1\\n\");\n\n return 0;\n }\n\n while (hc < ha) {\n hc += a * 12 - b * 12;\n d += 1;\n }\n\n printf(\"%d\\n\", d);\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n\tint h1, h2, a, b;\n\n\tscanf(\"%d%d%d%d\", &h1, &h2, &a, &b);\n\th1 += a * 8;\n\tif (h1 >= h2)\n\t\tprintf(\"0\\n\");\n\telse if (a <= b)\n\t\tprintf(\"-1\\n\");\n\telse\n\t\tprintf(\"%d\\n\", (h2 - h1 + a * 12 - b * 12 - 1) / (a * 12 - b * 12));\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int h1,h2,a,b,k,c=0;\n scanf(\"%d %d\",&h1,&h2);\n scanf(\"%d %d\",&a,&b);\n k=8*a;\n if (a-b<=0 && 8*a\n#define max 100000\nint main(){\n\tlong long int a,b,h1,h2,count,flag;\n\tcount=0;\n\tscanf(\"%I64d%*c%I64d\",&h1,&h2);\n\tscanf(\"%I64d%*c%I64d\",&a,&b);\n\th1=(h1-(4*a));\n\tflag=0;\n\tif((h1+(12*a))

=h2){\n\t\t\t\tflag=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse{\t\n\t\t\t\th1=h1+(12*(a-b));\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t}\n\tif(flag==1){\n\t\tprintf(\"%I64d\",count);\n\t}\n\telse{\n\t\tprintf(\"-1\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint\nmain (int argc, char *argv[])\n{\n\tlong int h1,h2,a,b,number=1;\n\tscanf(\"%ld %ld\",&h1,&h2);\n\tscanf(\"%ld %ld\",&a,&b);\n\tint night=12,day=8;\n\tif (day*a>=h2-h1)\n\t\tprintf(\"0\\n\");\n\telse if (a<=b)\n\t\tprintf(\"-1\\n\");\n\telse\n\t{\n\t\twhile(a*day+number*(a-b)*night < h2-h1)\n\t\t\tnumber++;\n\t\tprintf(\"%ld \\n\", number);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int a,b,c,d,i,j,k=0,x,y,m,n;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n x=b-a;\n m=8*c;\n n=12*d;\n y=m-n;\n j=y;\n //if(c=x) printf(\"%d\",0);\n // else if(c==d) printf(\"%d\",-1);\n else if(y>=x) printf(\"%d\",0);\n else {\n while(y=x) {\n k++;\n printf(\"%d\",k);\n break;\n }\n //else if(y<0) {printf(\"%d\",-1);break;}\n else {\n n=n+(12*d);\n y=m-n;\n k++;\n }\n if(y<0&&y<=j){printf(\"%d\",-1);break;}\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n int h1, h2, a, b;\n scanf(\"%d %d\", &h1, &h2);\n scanf(\"%d %d\", &a, &b);\n\n if (h1 + 8 * a >= h2)\n printf(\"0\");\n else if (a <= b)\n printf(\"-1\");\n else {\n int c = h1 + 8 * a - 12 * b, s = 1;\n while (1) {\n int night = c + a * 12;\n if (c <= h2 && h2 <= night) {\n printf(\"%d\", s);\n return 0;\n }\n c = night - 12 * b, s++;\n }\n }\n}\n\n\n"}, {"source_code": "#include \n#include \n#include \n#include \n\nint main () {\n\t\n\tint a, b;\n\tint h1, h2;\n\tint i = 0;\n\tint j = 14;\n\t\n\tscanf(\"%d %d\", &h1, &h2);\n\tscanf(\"%d %d\", &a, &b);\n// printf(\"%d %d\\n\", h1, h2);\n// printf(\"%d %d\\n\", a, b);\n\tif (h1 + 8 * a >= h2) { //alcanca no 1 dia\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\tif (a <= b) {\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n// \tprintf(\"#\\n\");\n\twhile (1) {\n// \t\tprintf(\"%d %d\\n\", h1, h2);\n\t\t\n\t\tif (10 <= j && j < 22) { //dia\n\t\t\th1 += a * (22 - j);\n\t\t\t\n\t\t\tif (h1 >= h2) {\n// \t\t\t\tif (h1 - 8 * a >= h2)\n// \t\t\t\t\ti--;\n\t\t\t\tprintf(\"%d\\n\", i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ti++;\n\t\t\tj = 22;\n\t\t} else { //noite\n\t\t\th1 -= b * (j - 10);\n\t\t\tj = 10;\n\t\t}\n\t}\n\t\n\treturn 0;\n\t\n}\n"}, {"source_code": "#include \n\nint main(void) {\n\tlong long h1,h2,a,b,k,res;\n\tscanf(\"%lld%lld\",&h1,&h2);\n\tscanf(\"%lld%lld\",&a,&b);\n\tif(ab)\n\t{\n\t k=0;res=0;\n\twhile (h1 < h2)\n\t{\n\t if(k == 0)\n\t\t h1 = h1 + a * 8;\n\t\telse\n\t\t h1 = h1 + a * 12;\n\t\tk++;\n\t\tif (h1 > h2 && (k == 1))\n\t\t{\n\t\t\tprintf(\"0\");\n\t\t\treturn 0;\n\t\t}\n\t\tif(h1 >= h2)\n\t\t{\n\t\t printf(\"%lld\",res);\n\t\t return 0;\n\t\t}\n\t\th1 = h1 - 12 * b;\n\t\tres++;\n\t}\n\t\tprintf(\"%lld\",res);\n}\n\n\treturn 0;\n}\n\n"}, {"source_code": "#include \n\nint main()\n{\n int h1,h2,a,b;\n while(scanf(\"%d %d\",&h1,&h2)!=EOF)\n {\n scanf(\"%d %d\",&a,&b);\n int c=0,flag=0;\n while(1)\n {\n h1+=8*a;\n if(h1>=h2)\n break;\n if(a*12<=b*12)\n {\n flag=1;\n break;\n }\n h1=h1-12*b+4*a;\n c++;\n if(h1>=h2)\n break;\n }\n if(flag)\n printf(\"-1\\n\");\n else\n printf(\"%d\\n\",c);\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nint main(){\n int h1,h2,a,b;\n scanf(\"%d %d\\n%d %d\",&h1,&h2,&a,&b);\n h1+=8*a;\n if(h1>=h2)\n printf(\"0\");\n else if(a<=b)\n printf(\"-1\");\n else{\n int diff = h2-h1;\n int mul = 12*(a-b);\n if(diff%mul==0)\n printf(\"%d\",diff/mul);\n else\n printf(\"%d\",diff/mul+1);\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int a,b,c,d,x,y,i,j,cnt=0,flag;\n\n scanf(\"%d%d%d%d\",&a,&b,&c,&d);\n if(d>=c&&(b-a-8*c)>0)\n flag=0;\n else\n flag=1;\n if(flag==1) {j=(b-a-8*c);\n i=0;\n while(1)\n {\n if(j<=0)\n {\n break;\n }\n cnt++;\n j=j+12*d;\n j=j-(12*c);\n\n }\n printf(\"%d\",cnt);}\n\nif(flag==0)\n printf(\"-1\");\n\n }"}, {"source_code": "#include\nint main()\n{\n int h1,h2;\n int a,b;\n scanf(\"%d %d\",&h1,&h2);\n scanf(\"%d %d\",&a,&b);\n \n if((h2-(h1+8*a))<1)\n printf(\"0\\n\");\n else if (a<=b)printf(\"-1\\n\");\n else { int c=h2-h1-8*a;\n\t\n\tif(c%((a-b)*12)==0)printf(\"%d\\n\",c/((a-b)*12));\n\telse{c/=12;\n printf(\"%d\\n\",c/(a-b)+1);\n }\n }\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint h1,h2;\n\tint a,b;\n\tscanf(\"%d %d\",&h1,&h2);\n\tscanf(\"%d %d\",&a,&b);\n\tint no;\n\tint flag =0;\n\tint count =0;\n\twhile(1)\n\t{\n\t\tif(count ==0)\n\t\t\th1 = h1+(8*a);\n\t\telse\n\t\t\th1=h1+(12 * a);\n\t\tif(h1 < h2)\n\t\t\th1=h1-(12 * b);\n\t\tif(h1>=h2)\n\t\t{\n\t\t\tflag =2;\n\t\t\tbreak;\n\t\t}\n\t\tif(b>a ||( (b==a)&&(h1\n#include\n#include\nint main()\n{\n int a,b,c,d,e,t,r=0,i,p=0,j;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n\n i=8*c;\n e=b-a;\n t=12*(c-d);\n if(i>=e)\n r=0;\n else if(t<1)\n r=-1;\n else{\n p=i+t;\n for(j=1;;j++){\n if(p>=e){\n r++;\n break;\n }\n else{\n r++;\n p=p+t;\n }\n\n }\n\n\n\n }\n\n printf(\"%d\",r);\n\n\n\n\nreturn 0;\n}\n"}, {"source_code": "#include\n#define MOD 1000000007\ntypedef long long int llu;\nllu mod(llu a) {\n\treturn a>0?a:-1*a;\n}\nint main()\n{\n\tllu h1,h2,a,b,i,ans=0;\n\tscanf(\"%I64d%I64d\",&h1,&h2);\n\tscanf(\"%I64d%I64d\",&a,&b);\n\tif(b>=a) {\n\t\tif( h2>8*a+h1 )\n\t\t\tans = -1;\n\t\telse\n\t\t\tans = 0;\n\t}\n\telse {\n\t\tif(h1+8*a>=h2) {\n\t\t\tans = 0;\n\t\t}\n\t\telse {\n\t\t\tans = (h2-(h1+8*a))/(12*(mod(b-a)));\n\t\t\tif((h2-(h1+8*a))%(12*(mod(b-a))))\n\t\t\t\tans++;\n\t\t}\n\t}\n\tprintf(\"%I64d\",ans);\n\treturn 0;\n}"}, {"source_code": "#include\nint main(){\nint n,m,a,b;\nwhile(scanf(\"%d%d%d%d\",&n,&m,&a,&b)!=EOF){\n if(n+8*a>=m) printf(\"0\\n\");\n else if(a<=b) printf(\"-1\\n\");\n else {\n int i;\n n+=8*a;\n for(i=0;;i++){\n // printf(\"i=%d,n=%d\\n\",i,n);\n if(n>=m) break;\n n-=12*b;\n n+=12*a;\n }\n printf(\"%d\\n\",i);\n }\n }\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int h1,h2,a,b,k=0,i;\n scanf(\"%d%d%d%d\",&h1,&h2,&a,&b);\n if(h2>h1+8*a&&b>=a) printf(\"-1\");\n else{\n while(1){\n if(k==0) h1+=8*a;\n else h1+=12*a;\n if(h1>=h2) break;\n h1-=12*b;k++;\n }\n printf(\"%d\",k);\n }\n return 0;\n}\n"}, {"source_code": "#include \n//#pragma warning (disable : 4996)\nint main(int argc, char * argv[])\n{\n\tint a, b; scanf(\"%d %d\", &a, &b);\n\tint c, d; scanf(\"%d %d\", &c, &d);\n\tint day = 0;\n\ta += 8 * c;\n\twhile (1)\n\t{\n\n\t\tif (a >= b)\n\t\t{\n\t\t\tprintf(\"%d\", day);\n\t\t\tbreak;\n\t\t}\n\t\tif (d >= c)\n\t\t{\n\t\t\tprintf(\"-1\");\n\t\t\tbreak;\n\t\t}\n\t\tday++;\n\t\ta += 12 * c - 12 * d;\n\n\t}\n\treturn 0;\n}"}, {"source_code": "# include \n\nint main ()\n{\n int a,b,u,v;\n scanf(\"%d %d %d %d\",&a,&b,&u,&v);\n int x=b-a;\n int z=12*v;\n int y=8*u;\n int w=12*u;\n if(x<=(8*u)) {printf(\"0\"); return 0;}\n if(x>(8*u) && u=b)\n {printf(\"%ld\",i);\n return 0;}\n else a=a+w-z;\n continue;\n }\n printf(\"-1\");\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int h1, h2, a, b, ans = 0;\n scanf(\"%d %d\", &h1, &h2);\n scanf(\"%d %d\", &a, &b);\n\n if (a <= b && h2 - h1 - a * 8 > 0) {\n printf(\"-1\\n\");\n return 0;\n }\n\n int dis = h2 - h1 - a * 8;\n if (dis <= 0) {\n printf(\"0\\n\");\n return 0;\n }\n ans += 1;\n\n while (dis > 0) {\n dis -= (a - b) * 12;\n if (dis <= 0) break;\n ans+= 1;\n }\n\n printf(\"%d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n\n{\n\tint a,b,c,d;\n\tscanf(\"%d%d\",&a,&b);\n\n\tscanf(\"%d%d\",&c,&d);\n\n\tfloat h,s;\n\tint i=1;\n\tif(c*8>=(b-a))\n\t\tprintf(\"0\");\n\n\telse if(c*8<(b-a) && c>=d && c!=d)\n\t{\n\t\th = (b-a-8*c)/(double)((c-d)*12);\n\t\ts = (b-a-8*c)/((c-d)*12);\n\n\t\tif(h>s)\n\t\t\tprintf(\"%.0f\\n\",s+1);\n\n\t\telse if(h==s)\n\t\t\tprintf(\"%.0f\",s);\n\t}\n\n\telse if(c*8<(b-a) && c>=d && c==d)\n\t{\t\t\n\t\tprintf(\"-1\");\n\t}\n\n\n\telse if(c\nint main()\n{\n int h1,h2,i,j,k;\n int a,b;\n scanf(\"%d %d %d %d\",&h1,&h2,&a,&b);\n i=h1;\n k=0;\n j=1;\n while (i=h2)\n {\n break;\n\n }\n else\n {\n k++;\n i=i-b*12;\n }\n\n\n }\n printf(\"%d\\n\",k);\n\n\nreturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n\tint h1, h2, up = 0, down = 0;\n\n\tfscanf(stdin, \"%d %d %d %d\", &h1, &h2, &up, &down);\n\n\tint days = 0;\n\tint currentHour = 14;\n\tint flag = 0;\n\n\twhile (1)\n\t{\n\t\t\n\t\tif ((currentHour >= 10) && (currentHour < 22))\n\t\t{\n\t\t\th1 += up;\n\t\t\tcurrentHour++;\n\t\t\tif (h1 >= h2)\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (currentHour == 23)\n\t\t\t{\n\t\t\t\tcurrentHour = 0;\n\t\t\t\tflag = 1;\n\t\t\t\tdays++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tcurrentHour++;\n\t\t\t}\n\t\t\th1 -= down;\n\t\t}\n\n\t\tif ((down >= up) && (flag == 1))\n\t\t{\n\t\t\tdays = -1;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tprintf(\"%d\", days);\n\n}"}, {"source_code": "#include\nint main ()\n{\n int a,b,c,h1,h2,i,j,k,c1=0,f1,f2,f3,x,e,d;\n scanf(\"%d%d%d%d\",&h1,&h2,&a,&b);\n c=h2-h1;\n d=a*8;\n if(a<=b)\n {\n if(dc)\n printf(\"0\");\n else\n {\n e=c-d;\n f1=a*12;\n f2=b*12;\n f3=f1-f2;\n x=e/f3;\n if(e%f3==0)\n printf(\"%d\",x);\n else\n printf(\"%d\",x+1);\n }\n }\n}\n"}, {"source_code": "#include\n\nint main()\n{\n\tint a,b,h1,h2,i,j,k,count,sum,s;\n\n\tscanf(\"%d%d%d%d\",&h1,&h2,&a,&b);\n\t\n\ts=h1;\n\th1+=a*(10-2);\n\n\tif(h1>=h2)\n\t{\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\telse\n\t{\n\t\th1=h1-12*b;\n\n\t\ti=0;\n\t\tcount=1;\n\t\twhile(1)\n\t\t{\n\t\t\t\n\n\t\t\tif(h1+12*a>=h2&&h1<=h2)\n\t\t\t{\n\t\t\t\tprintf(\"%d\\n\",count);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t\th1=h1+12*a;\n\t\t\th1-=12*b;\n\n\t\t\tcount++;\n\t\t\tif(count>=10000000)\n\t\t\t{\n\t\t\t\tprintf(\"-1\\n\");\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif(h1<0&&a\n\n#define S_N 8\n#define DN 12\n#define D_S 4\n\nint main() {\n\n int h1, h2;\n int a, b;\n\n scanf(\"%d%d\", &h1, &h2);\n scanf(\"%d%d\", &a, &b);\n\n h1 += S_N * a;\n if (h1 >= h2) {\n printf(\"0\");\n return 0;\n }\n if (a <= b) {\n printf(\"-1\");\n return 0;\n }\n if ((h2 - h1) % ((a - b) * DN))\n printf(\"%d\", (h2 - h1) / ((a - b) * DN) + 1);\n else\n printf(\"%d\", (h2 - h1) / ((a - b) * DN));\n return 0;\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int h1,h2,a,b;\n scanf(\"%d%d%d%d\",&h1,&h2,&a,&b);\n if(a<=b && h1+8*a=h2)\n {\n break;\n }\n h1=h1-b*12;\n ans++;\n h1=h1+4*a;\n }\n printf(\"%d\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int h1, h2, a, b, day = 0;\n scanf(\"%d%d%d%d\", &h1, &h2, &a, &b);\n h1 += a*8;\n if( h1>=h2 )\n printf(\"0\\n\");\n else\n {\n day++;\n while(1)\n {\n h1 -= b*12;\nh1 += a*12;\n if( h1>=h2 )\n{\n printf(\"%d\\n\", day);\n break;\n }\n if( b>=a )\n {\n printf(\"-1\\n\");\n break;\n }\n day++;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n\tint h1, h2, a, b;\n\n\tscanf(\"%d%d%d%d\", &h1, &h2, &a, &b);\n\th1 += a * 8;\n\tif (h1 >= h2)\n\t\tprintf(\"0\\n\");\n\telse if (a <= b)\n\t\tprintf(\"-1\\n\");\n\telse\n\t\tprintf(\"%d\\n\", (h2 - h1 + 12 * (a - b) - 1) / (12 * (a - b)));\n\treturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int x,y,a,b,i,l=0;\n scanf(\"%lld %lld\",&x,&y);\n scanf(\"%lld %lld\",&a,&b);\n if(8*a+x>=y)\n {printf(\"0\");}\n else\n {if(b>=a)\n {printf(\"-1\");}\n else\n {x=x+8*a-12*b;\n i=0;\n while(x=y)\n {printf(\"%lld\",i);\n break;\n }\n x=x-12*b;\n }\n }\n }\n return 0;\n}"}, {"source_code": "#include\nint main ()\n{\n\tint h1,h2,a,b;\n\tscanf(\"%d %d\",&h1,&h2);\n\tscanf(\"%d %d\",&a,&b);\n\tif(h2-h1<=8*a) printf(\"%d\",0);\n\telse if(a<=b) printf(\"%d\",-1);\n\telse{\n\th1=h1+a*8-b*12;\n\tint count=1;\n\twhile(h1+12*a\nint main()\n{\n int a,b;\n int h1,h2;\n scanf(\"%d%d\",&h1,&h2);\n scanf(\"%d%d\",&a,&b);\n if(a=h2)\n {\n printf(\"0\\n\");\n }\n else\n {\n if(h1+20*a-12*b>=h2)\n printf(\"1\\n\");\n else\n {\n h1=h1+20*a-12*b;\n count=2;\n while(h1+12*a-12*b\nint main()\n{\n int a,b,c,d,x,y,i,j,cnt=0,flag;\n\n scanf(\"%d%d%d%d\",&a,&b,&c,&d);\n if(d>=c&&(b-a-8*c)>0)\n flag=0;\n else\n flag=1;\n if(flag==1) {j=(b-a-8*c);\n i=0;\n while(1)\n {\n if(j<=0)\n {\n break;\n }\n cnt++;\n j=j+12*d;\n j=j-(12*c);\n\n }\n printf(\"%d\",cnt);}\n\nif(flag==0)\n printf(\"-1\");\n\n }\n\n"}, {"source_code": "#include \n#include \n#include \n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint main(){\n long long i, j, k, l, x, h1, h2, a, b;\n\n while (scanf(\"%lld %lld %lld %lld\", &h1, &h2, &a, &b) != EOF){\n long long hour = 14, days = 0, lim = 1e8;\n\n while (h1 < h2 && lim--){\n if (hour >= 10 && hour < 22) h1 += a;\n else h1 -= b;\n hour++;\n if (hour == 24) hour = 0;\n if (hour == 10) days++;\n }\n\n if (lim <= 0) days = -1;\n printf(\"%lld\\n\", days);\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n\tint s,e;\n\tint u,d;\n\tint len;\n\tint day=0,flag=1;\n\tscanf(\"%d %d\",&s,&e);\n\tscanf(\"%d %d\",&u,&d);\n\tlen=e-s;\n\tif(u*8>=len) printf(\"0\\n\");\n\telse if(u<=d) printf(\"-1\\n\");\n\telse\n\t{\n\t\tday=0;flag=1;\n\t\tlen=len-u*8;\n\t\twhile(flag==1)\n\t\t{\n\t\t\tlen+=12*d;\n\t\t\tlen-=12*u;\n\t\t\tday++;\n\t\t\tif(len<=0) flag=0;\n\t\t}\n\t\tprintf(\"%d\\n\",day);\n\t}\n} "}, {"source_code": "#include\nint main()\n{\nint a,b,i,h1,h2;\nscanf(\"%d%d%d%d\",&h1,&h2,&a,&b);\nif((h1+8*a < h2)&&(a<=b))\nprintf(\"-1\\n\");\nelse\n{\nint p=h1+8*a;\nif(p>=h2)\n{\n//printf(\"%d \",p);\nprintf(\"0\\n\");\n}\nelse\n{\ni=1;\nwhile(1)\n{\np=p-12*b;\n//printf(\"%d \",p);\np=p+12*a;\n//printf(\"%d \",p);\nif(p>=h2)\n{\nprintf(\"%d\\n\",i);\nbreak;\n}\ni++;\n}\n}\n}\nreturn 0;\n}\n"}, {"source_code": "#include \n\n/*\n * http://codeforces.com/problemset/problem/652/A\n */\nint main()\n{\n int hc = 0, ha = 0;\n scanf(\"%d %d\", &hc, &ha);\n\n int a = 0, b = 0, d = 0;\n scanf(\"%d %d\", &a, &b);\n\n hc += 8 * a;\n\n if (hc < ha && a <= b) {\n printf(\"-1\\n\");\n\n return 0;\n }\n\n while (hc < ha) {\n hc += a * 12 - b * 12;\n d += 1;\n }\n\n printf(\"%d\\n\", d);\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main(){\n long long int h1,h2,a,b;\n scanf(\"%lld %lld\",&h1,&h2);\n scanf(\"%lld %lld\",&a,&b);\n int i;\n long long int dist=h1;\n bool day=1,first=1,sec=1;\n long long int count=0;\n if(b>=a&&(h2-h1)>(8*a))\n printf(\"-1\");\n else{\n while(1){\n if(dist>=h2)\n break;\n if(day&&first){\n dist+=(a*8);\n day=0;\n first=0;\n }\n else if(!day){\n dist-=(b*12);\n count++;\n day=1;\n }\n else if(!first){\n dist+=(a*12);\n day=0;\n sec=0;\n }\n \n }\n }\n if(dist>=h2)\n printf(\"%lld\",count);\n \n}"}, {"source_code": "#include\nint main()\n{\n int h1,h2,a,b,d1,s,p,count=0;\n scanf(\"%d%d\",&h1,&h2);\n scanf(\"%d%d\",&a,&b);\n\n d1=a*8;\n\n\n s=h1+d1;\n if(h1+d1=h2)\n {\n printf(\"%d\",count);\n break;\n }\n else\n {\n s=s-(b*12);\n s=s+(a*12);\n count++;\n\n }\n }\n }\n }\n else\n {\n printf(\"0\");\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\nint main()\n{\n long long h1,h2,a,b,h,step,days;\n\n scanf(\"%lld %lld\",&h1,&h2);\n scanf(\"%lld %lld\",&a,&b);\n\n if(b>=a && (8*a)<(h2-h1))\n printf(\"-1\");\n\n else if(8*a >= h2-h1)\n printf(\"0\");\n\n else\n {\n h = h2 - (h1 + 8*a);\n step = 12*(a-b);\n days = ceil((double)h/step);\n printf(\"%lld\",days);\n }\n\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tlong long int h1,h2,a,b,i,c=0,u,d;\n\tscanf(\"%I64d%I64d%I64d%I64d\",&h1,&h2,&a,&b);\n\tif(a*8+h1>=h2)\n\tprintf(\"0\");\n\telse if(a<=b)\n\tprintf(\"-1\");\n\telse if(a*8+h1=b)\n\t{\n\t\td=a*8+h1-b*12;\n\t\tu=d+12*a;\n\t\tc++;\n\t\twhile(u\nint main(){\n int a,b,c,d,e,f,g;\n int first,second;\n int up,down;\n scanf(\"%d%d\",&first,&second);\n scanf(\"%d%d\",&up,&down);\n if(((first + 8*up) - (12 * down) + 4*up) <= first && (((8*up)+first) < second)){\n printf(\"-1\");\n return 0;}\n if(up == down && (((8*up)+first) < second)){\n printf(\"-1\");\n return 0;\n }\n int cnt=0,i;\n if(first>=second){\n printf(\"0\");\n return 0;}\n while(1){\n for(i=0;i<8;i++){\n first+=up;\n if(first>=second){\n printf(\"%d\",cnt);\n return 0;\n }}\n for(i=0;i<12;i++){\n first-=down;\n if(first>=second){\n printf(\"%d\",cnt);\n return 0;\n }}\n cnt++;\n for(i=0;i<4;i++){\n first+=up;\n if(first>=second){\n printf(\"%d\",cnt);\n return 0;\n }}\n }\n}\n"}, {"source_code": "\n #include \n#include \n#include \n\nint h1, h2;\nint a, b;\nint cnt;\nint main()\n{\n\tscanf(\"%d %d %d %d\", &h1, &h2, &a, &b);\n\tif (h1 + (a * 8) >= h2)\n\t{\n\t\tprintf(\"%d\", 0);\n\t\treturn 0;\n\t}\n\th1 += (a * 8);\n\th1 -= (b * 12);\n\tcnt++;\n\twhile (1)\n\t{\n\t\tif (h1 + (a * 12) >= h2)\n\t\t{\n\t\t\tprintf(\"%d\", cnt);\n\t\t\treturn 0;\n\t\t}\n\t\th1 += (a * 12);\n\t\th1 -= (b * 12);\n\n\t\tif (a <= b)\n\t\t{\n\t\t\tprintf(\"%d\", -1);\n\t\t\treturn 0;\n\t\t}\n\t\tcnt++;\n\t}\n}"}, {"source_code": "#include \n#include \n#include \n\nint h1, h2;\nint a, b;\nint cnt;\nint main()\n{\n\tscanf(\"%d %d %d %d\", &h1, &h2, &a, &b);\n\tif (h1 + (a * 8) >= h2)\n\t{\n\t\tprintf(\"%d\", 0);\n\t\treturn 0;\n\t}\n\th1 += (a * 8);\n\th1 -= (b * 12);\n\tcnt++;\n\twhile (1)\n\t{\n\t\tif (h1 + (a * 12) >= h2)\n\t\t{\n\t\t\tprintf(\"%d\", cnt);\n\t\t\treturn 0;\n\t\t}\n\t\th1 += (a * 12);\n\t\th1 -= (b * 12);\n\n\t\tif (a <= b)\n\t\t{\n\t\t\tprintf(\"%d\", -1);\n\t\t\treturn 0;\n\t\t}\n\t\tcnt++;\n\t}\n}"}, {"source_code": "#include\ntypedef unsigned u;\nint h1,h2;\nint main()\n{\n\tu t=0,c=10,a,b;\n\tscanf(\"%i%i%u%u\",&h1,&h2,&a,&b);\n\tfor(h1-=4*a;h19&&c<22)h1+=a;\n\t\telse h1-=b;\n\t}\n\tprintf(\"%i\\n\",t);\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int i , ha , hc , a , b ;\n\n scanf(\"%d%d%d%d\",&hc,&ha,&a,&b) ;\n\n if((b>a && 8*a < ha-hc) || (b==a && 12*a < ha-hc+12*b-8*a))\n {\n printf(\"-1\");\n return 0 ;\n }\n\n for(i=0 ; ; i++)\n {\n if(!i)hc += a*8;\n else hc += a*12 ;\n\n if(hc >= ha)\n {\n printf(\"%d\",i);\n return 0 ;\n }\n hc -= b*12 ;\n }\n\n\n\n return 0 ;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int h1,h2,a,b,day=0,h,p=0;\n scanf(\"%d %d %d %d\",&h1,&h2,&a,&b);\n h=h1+a*8;\n if(h>=h2)\n printf(\"0\");\n else\n {\n while(h=a && day>1)\n {\n printf(\"-1\");\n p=1;\n break;\n }\n }\n if(p!=1)\n printf(\"%d\",day);\n }\n return 0;\n}\n"}, {"source_code": "#include\n\nint cat(int a,int b,int h1, int h2,int d,int v,int z)\n{ int pos=0,k=0,nh;\n if((z==h1) && (d>0))\n {\n k=-1;\n\tprintf(\"%d\",k);\n\treturn 0;\n }\n pos=(a*8)+h1;\n if(pos>=h2)\n {\n k=d;\n printf(\"%d\",k);\n return 0;\n }\n d++;\n pos-=(b*12);\n pos=pos+a*4;\n nh=pos;\n if(v>pos && d>2)\n {\n d=-1;\n\tprintf(\"%d\",d);\n\treturn 0;\n }\n if(pos>=h2)\n {\n k=d;\n printf(\"%d\",k);\n return 0;\n }\n cat(a,b,nh,h2,d,pos,z);\n}\n\nint main()\n{\n int a,b,h1,h2,d=0,v=0;\n scanf(\"%d%d\",&h1,&h2);\n scanf(\"%d%d\",&a,&b);\n\n\n\ncat(a,b,h1,h2,d,v,h1);\nreturn 0;\n}\n"}, {"source_code": "// Gabriel and Caterpillar\n\n#include\nint main(void)\n{\n\tint h1,h2,x,a,b,i,count,flag;\n\tscanf(\"%d %d\",&h1,&h2);\n\tscanf(\"%d %d\",&a,&b);\n\tif(h1=h2)\n\t\t\t{\n\t\t\t\tflag = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tx = x-12*b;\n\t\t\tif(x<=(h1-4*a))\n\t\t\t{\n\t\t\t\tflag = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(flag==0)\n\t\t\tprintf(\"-1\\n\");\n\t\telse if(flag==1)\n\t\t\tprintf(\"%d\\n\",count-1);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint e;\n\tfloat a,g,b,c,d;\n\tscanf(\"%f%f%f%f\",&a,&b,&c,&d);\n\tif(a+8*c>=b || a==b)\n\t{\n\t\tprintf(\"0\\n\");\n\t\tgoto jump;\n\t}\n\telse if(c\n\nint h1,h2,v1,v2;\nint i;\nint t;\n\nint main()\n{\n\tscanf(\"%d%d%d%d\",&h1,&h2,&v1,&v2);\n\t\n\tif(v1v2)\n\t{\n\t\tt=0;\n\t\tfor(i=0;;i++)\n\t\t{\n\t\t\th1=h1+(v1-v2)*12;\n\t\t\tif(v1*12>(h2-h1))\n\t\t\t{\n\t\t\t\tt++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tt++;\n\t\t}\n\t}\n\t\n\tprintf(\"%d\\n\",t);\n\t\n\treturn 0;\n} "}, {"source_code": "#include \n\nint main()\n{\n int h1, h2, a, b, count=0;\n scanf(\"%d %d\",&h1,&h2);\n scanf(\"%d %d\",&a,&b);\n if(a=h2) break;\n else h1 = h1 - 12*b;\n count++;\n temp = 4*a;\n }\n printf(\"%d\\n\",count);\n }\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \n#include \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\nint main()\n{\n int h1, h2;\n scanf(\"%d %d\", &h1, &h2);\n int a, b;\n scanf(\"%d %d\", &a, &b);\n\n if (h2-h1a*8) && (h2+a*8-b*12>0) && (a<=b))\n {\n printf(\"-1\"); return 0;\n }\n\n int day = 0;\n int dayend,nightend;\n while (1)\n {\n if (day == 0)\n {\n dayend = h1 + a * 8;\n }\n else\n {\n dayend = nightend + a * 12;\n }\n if (dayend>=h2)\n {\n printf(\"%d\",day); return 0;\n }\n nightend = dayend - b * 12;\n// if (nightend<=0)\n// {\n// printf(\"%d\",day+1); return 0;\n// }\n day++;\n }\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \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\nint main()\n{\n int h1, h2;\n scanf(\"%d %d\", &h1, &h2);\n int a, b;\n scanf(\"%d %d\", &a, &b);\n\n if (h2-h1a*8) && (h2+a*8-b*12>0) && (a<=b))\n {\n printf(\"-1\"); return 0;\n }\n\n int day = 0;\n int dayend,nightend;\n while (1)\n {\n if (day == 0)\n {\n dayend = h1 + a * 8;\n }\n else\n {\n dayend = nightend + a * 12;\n }\n if (dayend>=h2)\n {\n printf(\"%d\",day); return 0;\n }\n nightend = dayend - b * 12;\n if (nightend<=0)\n {\n printf(\"%d\",day+1); return 0;\n }\n day++;\n }\n\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\nint a,b,c,d;\nscanf(\"%d%d\",&a,&b);\nint up,down;\nscanf(\"%d%d\",&up,&down);\nint minus=((8*up+a)-(12*down))+4*up;\nif(minus<=a && ((8*up)+a)b){\nprintf(\"%d\",0);\nreturn 0;\n}}\nint cnt=0; int ind=0;\nwhile(1){\nif(!ind){\nfor(i=0;i<12;i++){\na=a-down;\nif(a>b){\nprintf(\"%d\",cnt);\nreturn 0;\n}\n}\nind=1;\ncnt++;\n}\nelse{\nfor(i=0;i<12;i++){\na=a+up;\nif(a>b){\nprintf(\"%d\",cnt);\nreturn 0;\n}\n}\nind=0;\n}\n}\n}\n"}, {"source_code": "#include\nint main(){\nint a,b,c,d;\nscanf(\"%d%d\",&a,&b);\nint up,down;\nscanf(\"%d%d\",&up,&down);\nint minus=((8*up+a)-(12*down))+4*up;\nif(minus<0){\n printf(\"-1\");\nreturn 0;\n}\nif(minus==0 && (8*up)b){\nprintf(\"%d\",0);\nreturn 0;\n}\n}\nint cnt=0; int ind=0;\nwhile(1){\nif(!ind){\nfor(i=0;i<12;i++){\na=a-down;\nif(a>b){\nprintf(\"%d\",cnt);\nreturn 0;\n}\n}\nind=1;\ncnt++;\n}\nelse{\nfor(i=0;i<12;i++){\na=a+up;\nif(a>b){\nprintf(\"%d\",cnt);\nreturn 0;\n}\n}\n}\n}\n}\n"}, {"source_code": "#include\nint main(){\nint a,b,c,d;\nscanf(\"%d%d\",&a,&b);\nint up,down;\nscanf(\"%d%d\",&up,&down);\nint minus=((8*up+a)-(12*down))+4*up;\nif(minus<0){\n printf(\"-1\");\nreturn 0;\n}\nif(minus==a && ((8*up)+a)b){\nprintf(\"%d\",0);\nreturn 0;\n}}\nint cnt=0; int ind=0;\nwhile(1){\nif(!ind){\nfor(i=0;i<12;i++){\na=a-down;\nif(a>b){\nprintf(\"%d\",cnt);\nreturn 0;\n}\n}\nind=1;\ncnt++;\n}\nelse{\nfor(i=0;i<12;i++){\na=a+up;\nif(a>b){\nprintf(\"%d\",cnt);\nreturn 0;\n}\n}\nind=0;\n}\n}\n}\n"}, {"source_code": "#include\n\nint main()\n{\n long long int i,h1,h2,a,b,dis,final1;\n scanf(\"%I64d %I64d\",&h1,&h2);\n scanf(\"%I64d %I64d\",&a,&b);\n dis=h1;\n final1=h2;\n if(a=final1)\n break;\n dis-=12*b;\n i++;\n }\n printf(\"%I64d\",i);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n long int i,h1,h2,a,b,dis,final1;\n scanf(\"%ld %ld\",&h1,&h2);\n scanf(\"%ld %ld\",&a,&b);\n dis=h1;\n final1=h2;\n\n i=0;\n while(dis<=h2)\n {\n if(i==0)\n {\n dis=dis+8*a;\n }\n if(i>=1)\n dis=dis+(12*a);\n if(dis>=h2)\n break;\n dis=dis-(2*b);\n if(dis>=h2)\n break;\n i++;\n dis=dis-(10*b);\n if(dis>=h2)\n break;\n if(i>=10000000)\n {\n printf(\"-1\");\n return 0;\n }\n }\n printf(\"%ld\",i);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n long int i,h1,h2,a,b,dis,final1;\n scanf(\"%ld %ld\",&h1,&h2);\n scanf(\"%ld %ld\",&a,&b);\n dis=h1;\n final1=h2;\n if(ah1||a=final1)\n break;\n dis=dis-(12*b);\n i++;\n if(i>=100000)\n {\n printf(\"-1\");\n return 0;\n }\n }\n printf(\"%ld\",i);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n long int i,h1,h2,a,b,dis,final1;\n scanf(\"%ld %ld\",&h1,&h2);\n scanf(\"%ld %ld\",&a,&b);\n dis=h1;\n final1=h2;\n\n i=0;\n while(dis<=h2)\n {\n if(i==0)\n {\n dis=dis+8*a;\n }\n if(i>=1)\n dis=dis+(12*a);\n if(dis>=h2)\n break;\n dis=dis-(2*b);\n if(dis>=h2)\n break;\n i++;\n dis=dis-(10*b);\n if(dis>=h2)\n break;\n if(i>=1000)\n {\n printf(\"-1\");\n return 0;\n }\n }\n printf(\"%ld\",i);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n long long int i,h1,h2,a,b,dis,final1;\n scanf(\"%I64d %I64d\",&h1,&h2);\n scanf(\"%I64d %I64d\",&a,&b);\n dis=h1;\n final1=h2;\n if(a=final1)\n break;\n dis-=12*b;\n i++;\n if(i>=100000)\n {\n printf(\"-1\");\n return 0;\n }\n }\n printf(\"%I64d\",i);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n long int i,h1,h2,a,b,dis,final1;\n scanf(\"%ld %ld\",&h1,&h2);\n scanf(\"%ld %ld\",&a,&b);\n dis=h1;\n final1=h2;\n if(ah1)\n {\n printf(\"-1\");\n return 0;\n }\n i=0;\n while(dis=final1)\n break;\n dis-=12*b;\n i++;\n if(i>=100000)\n {\n printf(\"-1\");\n return 0;\n }\n }\n printf(\"%ld\",i);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n long int i,h1,h2,a,b,dis,final1;\n scanf(\"%ld %ld\",&h1,&h2);\n scanf(\"%ld %ld\",&a,&b);\n dis=h1;\n final1=h2;\n\n i=0;\n while(dis<=h2)\n {\n if(i==0)\n {\n dis=dis+8*a;\n }\n if(i>=1)\n dis=dis+(12*a);\n if(dis>=h2)\n break;\n dis=dis-(2*b);\n if(dis>=h2)\n break;\n i++;\n dis=dis-(10*b);\n if(dis>=h2)\n break;\n if(i>=100000)\n {\n printf(\"-1\");\n return 0;\n }\n }\n printf(\"%ld\",i);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n long long int i,h1,h2,a,b,dis,final1;\n scanf(\"%I64d %I64d\",&h1,&h2);\n scanf(\"%I64d %I64d\",&a,&b);\n dis=h1;\n final1=h2;\n if(a=final1)\n break;\n dis-=12*b;\n }\n printf(\"%I64d\",i);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n long int i,h1,h2,a,b,dis,final1;\n scanf(\"%ld %ld\",&h1,&h2);\n scanf(\"%ld %ld\",&a,&b);\n dis=h1;\n final1=h2;\n\n i=0;\n while(dis<=h2)\n {\n if(i==0)\n {\n dis=dis+8*a;\n }\n if(i>=1)\n dis=dis+(12*a);\n if(dis>=h2)\n break;\n dis=dis-(2*b);\n if(dis>=h2)\n break;\n i++;\n dis=dis-(10*b);\n if(dis>=h2)\n break;\n if(i>=9999)\n {\n printf(\"-1\");\n return 0;\n }\n }\n printf(\"%ld\",i);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n long long int h1,h2,a,b,day;\n scanf(\"%I64d %I64d\",&h1,&h2);\n scanf(\"%I64d %I64d\",&a,&b);\n day=(a+b)/(h1+h2)+(a-b);\n printf(\"%I64d\",day);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main() {\n\tint h1, h2, a, b;\n\n\tscanf(\"%d%d%d%d\", &h1, &h2, &a, &b);\n\th1 += a * 8;\n\tif (h1 > h2)\n\t\tprintf(\"0\\n\");\n\telse if (a <= b)\n\t\tprintf(\"-1\\n\");\n\telse\n\t\tprintf(\"%d\\n\", (h2 - h1 + a * 12 - b * 12 - 1) / (a * 12 - b * 12));\n\treturn 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int h1,h2,a,b,k,c=0;\n scanf(\"%d %d\",&h1,&h2);\n scanf(\"%d %d\",&a,&b);\n k=8*a;\n if(a-b>0){\n while(k\n\nint main()\n{\n int h1,h2,a,b;\n scanf(\"%d %d\",&h1,&h2);\n scanf(\"%d %d\",&a,&b);\n\n if(a-b>0)printf(\"1\");\n else if(a-b<0)printf(\"-1\");\n else printf(\"0\");\n\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n{\n int h1,h2,a,b,k,c=0;\n scanf(\"%d %d\",&h1,&h2);\n scanf(\"%d %d\",&a,&b);\n\n while(k\n\nint main()\n{\n int h1,h2,a,b,k,c=0;\n scanf(\"%d %d\",&h1,&h2);\n scanf(\"%d %d\",&a,&b);\n k=8*a;\n if (a-b<=0 && 8*a\nint main()\n{\n int a,b,c,d,i,j,k=0,x,y,m,n;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n x=b-a;\n m=8*c;\n n=12*d;\n y=m-n;\n if(c=x) printf(\"%d\",0);\n }\n else if(y>=x) printf(\"%d\",0);\n else {\n while(y=x) {\n k++;\n printf(\"%d\",k);\n break;\n }\n else {\n n=n+(12*d);\n y=m-n;\n k++;\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n\nint main () {\n\t\n\tint a, b;\n\tint h1, h2;\n\tint i = 0;\n\tint j = 14;\n\t\n\tscanf(\"%d %d\", &h1, &h2);\n\tscanf(\"%d %d\", &a, &b);\n// printf(\"%d %d\\n\", h1, h2);\n// printf(\"%d %d\\n\", a, b);\n\tif (h1 + 8 * a >= h2) { //alcanca no 1 dia\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\tif (a < b) {\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n// \tprintf(\"#\\n\");\n\twhile (1) {\n// \t\tprintf(\"%d %d\\n\", h1, h2);\n\t\tif (i == 5)\n\t\t\tbreak;\n\t\tif (10 <= j && j < 22) { //dia\n\t\t\th1 += a * (22 - j);\n\t\t\t\n\t\t\tif (h1 >= h2) {\n\t\t\t\tprintf(\"%d\\n\", i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ti++;\n\t\t\tj = 22;\n\t\t} else { //noite\n\t\t\th1 -= b * (j - 10);\n\t\t\tj = 10;\n\t\t}\n\t}\n\t\n\treturn 0;\n\t\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n\nint main () {\n\t\n\tint a, b;\n\tint h1, h2;\n\tint i = 0;\n\tint j = 14;\n\t\n\tscanf(\"%d %d\", &h1, &h2);\n\tscanf(\"%d %d\", &a, &b);\n// printf(\"%d %d\\n\", h1, h2);\n// printf(\"%d %d\\n\", a, b);\n\tif (h1 + 8 * a >= h2) { //alcanca no 1 dia\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\tif (a < b) {\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n// \tprintf(\"#\\n\");\n\twhile (1) {\n// \t\tprintf(\"%d %d\\n\", h1, h2);\n\t\tif (i == 5)\n\t\t\tbreak;\n\t\tif (10 <= j && j < 22) { //dia\n\t\t\th1 += a * (22 - j);\n\t\t\t\n\t\t\tif (h1 >= h2) {\n\t\t\t\tif (h1 - 8 * a >= h2)\n\t\t\t\t\ti--;\n\t\t\t\tprintf(\"%d\\n\", i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ti++;\n\t\t\tj = 22;\n\t\t} else { //noite\n\t\t\th1 -= b * (j - 10);\n\t\t\tj = 10;\n\t\t}\n\t}\n\t\n\treturn 0;\n\t\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n\nint main () {\n\t\n\tlong long a, b;\n\tlong long h1, h2;\n\tlong long res;\n\t\n\tscanf(\"%I64d %I64d\", &h1, &h2);\n\tscanf(\"%I64d %I64d\", &a, &b);\n// printf(\"%d %d\\n\", h1, h2);\n// printf(\"%d %d\\n\", a, b);\n\tif (h1 + 8 * a >= h2) { //alcanca no 1 dia\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\tif (a <= b) {\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\t\n\th1 += 8 * a;\n\t\n\tres = (h2 - h1) / ((a - b) * 12);\n\t\n\th1 += res * (a - b) * 12;\n\t\n\tif (h1 >= h2) {\n\t\tif (h1 - 8 * a >= h2)\n\t\t\tres--;\n\t\tprintf(\"%I64d\\n\", res);\n\t}\n\th1 += (a - b) * 12;\n\tres++;\n\tif (h1 >= h2) {\n\t\tif (h1 - 8 * a >= h2)\n\t\t\tres--;\n\t\tprintf(\"%I64d\\n\", res);\n\t}\n\t\n\treturn 0;\n\t\n}\n"}, {"source_code": "#include \n#include \n#include \n#include \n\nint main () {\n\t\n\tint a, b;\n\tint h1, h2;\n\tint i = 0;\n\tint j = 14;\n\t\n\tscanf(\"%d %d\", &h1, &h2);\n\tscanf(\"%d %d\", &a, &b);\n// printf(\"%d %d\\n\", h1, h2);\n// printf(\"%d %d\\n\", a, b);\n\tif (h1 + 8 * a >= h2) { //alcanca no 1 dia\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\tif (a <= b) {\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n// \tprintf(\"#\\n\");\n\twhile (1) {\n// \t\tprintf(\"%d %d\\n\", h1, h2);\n\t\t\n\t\tif (10 <= j && j < 22) { //dia\n\t\t\th1 += a * (22 - j);\n\t\t\t\n\t\t\tif (h1 >= h2) {\n\t\t\t\tif (h1 - 8 * a >= h2)\n\t\t\t\t\ti--;\n\t\t\t\tprintf(\"%d\\n\", i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ti++;\n\t\t\tj = 22;\n\t\t} else { //noite\n\t\t\th1 -= b * (j - 10);\n\t\t\tj = 10;\n\t\t}\n\t}\n\t\n\treturn 0;\n\t\n}\n"}, {"source_code": "#include\nint main()\n{\n int h1,h2;\n int a,b;\n scanf(\"%d %d\",&h1,&h2);\n scanf(\"%d %d\",&a,&b);\n \n if((h2-(h1+8*a))<1)\n printf(\"0\\n\");\n else if (a<=b)printf(\"-1\\n\");\n else { int c=h2-h1-8*a;\n\t\n\tif(c%((a-b)*12)==0)printf(\"%d\\n\",c/((a-b)*12));\n\telse\n printf(\"%d\\n\",c/(a-b)+1);\n }\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int h1,h2;\n int a,b;\n scanf(\"%d %d\",&h1,&h2);\n scanf(\"%d %d\",&a,&b);\n \n if((h2-(h1+8*a))<1)\n printf(\"0\\n\");\n else if (a<=b)printf(\"-1\\n\");\n else { int c=h2-h1-8*a;\n\tc/=12;\n printf(\"%d\\n\",c/(a-b)+1);\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\nint main()\n{\n int a,b,c,d,e,t,r=0,i;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n\n i=8*c;\n e=b-a;\n t=12*(c-d);\n if(i>=e)\n r=0;\n else if(t<1)\n r=-1;\n else{\n r=(e/t);\n if((int)(e/t)==(e/t))\n r=r;\n else\n r++;\n }\n\n printf(\"%d\",r);\n\n\n\n\nreturn 0;\n}\n"}, {"source_code": "#include\n#define MOD 1000000007\ntypedef long long int llu;\nllu mod(llu a) {\n\treturn a>0?a:-1*a;\n}\nint main()\n{\n\tllu h1,h2,a,b,i,ans=0;\n\tscanf(\"%I64d%I64d\",&h1,&h2);\n\tscanf(\"%I64d%I64d\",&a,&b);\n\tif(b>=a) {\n\t\tif( h2>8*a+h1 )\n\t\t\tans = -1;\n\t\telse\n\t\t\tans = 0;\n\t}\n\telse {\n\t\tif(h1+8*a>=h2) {\n\t\t\tans = 0;\n\t\t}\n\t\telse {\n\t\t\tans = (h2-(h1+8*a))/(12*(mod(b-a)));\n\t\t\tans++;\n\t\t}\n\t}\n\tprintf(\"%I64d\",ans);\n\treturn 0;\n}"}, {"source_code": "#include\n#define MOD 1000000007\ntypedef long long int llu;\nint main()\n{\n\tllu h1,h2,a,b,i,ans=0;\n\tscanf(\"%I64d%I64d\",&h1,&h2);\n\tscanf(\"%I64d%I64d\",&a,&b);\n\tif(b>=a) {\n\t\tif( h2>8*a+h1 )\n\t\t\tans = -1;\n\t\telse\n\t\t\tans = 0;\n\t}\n\telse {\n\t\tif(h1+8*a>=h2) {\n\t\t\tans = 0;\n\t\t}\n\t\telse {\n\t\t\tans = (h2-(h1+8*a))/(12*(b-a));\n\t\t\tans++;\n\t\t}\n\t}\n\tprintf(\"%I64d\",ans);\n\treturn 0;\n}"}, {"source_code": "#include\nint main(){\n int n,m,get,slip;\n while(scanf(\"%d%d%d%d\",&n,&m,&get,&slip)!=EOF){\n if(n+8*get=m) {\n printf(\"0\\n\");continue;\n }\n n=n-12*slip;\n if(n<0) n=0;\n for(int i=1;;i++){\n n=n+get*12;\n if(n>=m&&n-get*2>=m) {\n printf(\"%d\\n\",i);\n // printf(\"n=%d\",n);\n break;\n }\n n-=12*slip;\n if(n<0) n=0;\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n int n,m,get,slip;\n while(scanf(\"%d%d%d%d\",&n,&m,&get,&slip)!=EOF){\n if(n+8*get>=m) {\n printf(\"0\\n\");continue;\n }\n else if(get<=slip){\n printf(\"-1\\n\");continue;\n }\n else printf(\"%d\\n\",(m-n-8*get+12*(get-slip)+1)/(12*(get-slip)));\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n int n,m,get,slip;\n while(scanf(\"%d%d%d%d\",&n,&m,&get,&slip)!=EOF){\n if(n+8*get=m) {\n printf(\"0\\n\");continue;\n }\n n=n-12*slip;\n if(n<0) n=0;\n for(int i=1;;i++){\n n=n+get*12;\n if(n>=m&&n-get*2>=m) {\n printf(\"%d\\n\",i);\n printf(\"n=%d\",n);\n break;\n }\n n-=12*slip;\n if(n<0) n=0;\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int h1,h2,a,b,k=0,i;\n scanf(\"%d%d%d%d\",&h1,&h2,&a,&b);\n if(h2>h1+8*a) printf(\"-1\");\n else{\n while(1){\n if(k==0) h1+=8*a;\n else h1+=12*a;\n if(h1>=h2) break;\n h1-=12*b;k++;\n }\n printf(\"%d\",k);\n }\n return 0;\n}\n"}, {"source_code": "#include \n//#pragma warning (disable : 4996)\nint main(int argc, char * argv[])\n{\n\tlong long int a, b; scanf(\"%lld %lld\", &a, &b);\n\tlong long int c, d; scanf(\"%lld %lld\", &c, &d);\n\n\ta += c * 8;\n\tif (a >= b)\n\t\tprintf(\"0\\n\");\n\telse if (c <= d)\n\t\tprintf(\"-1\\n\");\n\telse\n\t\tprintf(\"%lld\\n\", (b - a) / (c * 12 - d * 12) + 1);\n\n\n\n\treturn 0;\n}"}, {"source_code": "#include \n//#pragma warning (disable : 4996)\nint main(int argc, char * argv[])\n{\n\tlong long int a, b; scanf(\"%lld %lld\", &a, &b);\n\tlong long int c, d; scanf(\"%lld %lld\", &c, &d);\n\n\ta += c * 8;\n\tif (a >= b)\n\t\tprintf(\"0\");\n\telse if (c <= d)\n\t\tprintf(\"-1\");\n\telse\n\t\tprintf(\"%lld\", (b - a) / ((c - d) * 12) + 1);\n\n\n\n\treturn 0;\n}"}, {"source_code": "#include \n//#pragma warning (disable : 4996)\nint main(int argc, char * argv[])\n{\n\tlong long int a, b; scanf(\"%lld %lld\", &a, &b);\n\tlong long int c, d; scanf(\"%lld %lld\", &c, &d);\n\n\ta += c * 8;\n\tif (a >= b)\n\t\tprintf(\"0\");\n\telse if (c <= d)\n\t\tprintf(\"-1\");\n\telse\n\t\tprintf(\"%lld\", (((b - a) / ((c - d) * 12))) + 1);\n\n\n\n\treturn 0;\n}"}, {"source_code": "#include \n//#pragma warning (disable : 4996)\nint main(int argc, char * argv[])\n{\n\tint a, b; scanf(\"%d %d\", &a, &b);\n\tint c, d; scanf(\"%d %d\", &c, &d);\n\n\ta += c * 8;\n\tif (a >= b)\n\t\tprintf(\"0\");\n\telse if (c <= d)\n\t\tprintf(\"-1\");\n\telse\n\t\tprintf(\"%d\", (((b - a) / ((c - d) * 12))) + 1);\n\n\n\n\treturn 0;\n}"}, {"source_code": "#include \n//#pragma warning (disable : 4996)\nint main(int argc, char * argv[])\n{\n\tlong long int a, b; scanf(\"%lld %lld\", &a, &b);\n\tlong long int c, d; scanf(\"%lld %lld\", &c, &d);\n\n\ta += c * 8;\n\tif (a >= b)\n\t\tprintf(\"0\");\n\telse if (c <= d)\n\t\tprintf(\"-1\");\n\telse\n\t\tprintf(\"%lld\", ((b - a) / ((c - d) * 12)) + 1);\n\n\n\n\treturn 0;\n}"}, {"source_code": "#include \n//#pragma warning (disable : 4996)\nint main(int argc, char * argv[])\n{\n\tint a, b; scanf(\"%d %d\", &a, &b);\n\tint c, d; scanf(\"%d %d\", &c, &d);\n\tint day = 0;\n\ta += 8 * c;\n\twhile (1)\n\t{\n\n\t\tif (a >= b)\n\t\t{\n\t\t\tprintf(\"%d\", day);\n\t\t\tbreak;\n\t\t}\n\t\tif (b >= a)\n\t\t{\n\t\t\tprintf(\"-1\");\n\t\t\tbreak;\n\t\t}\n\t\tday++;\n\t\ta += 12 * c - 12 * d;\n\n\t}\n\treturn 0;\n}"}, {"source_code": "# include \n\nint main ()\n{\n int a,b,u,v;\n scanf(\"%d %d %d %d\",&a,&b,&u,&v);\n int x=b-a;\n int z=12*v;\n int y=8*u;\n int w=12*u;\n if(u=b)\n {printf(\"%ld\",i);\n return 0;}\n else a=a+w-z;\n }\n printf(\"-1\");\n return 0;\n}\n"}, {"source_code": "# include \n\nint main ()\n{\n int a,b,u,v;\n scanf(\"%d %d %d %d\",&a,&b,&u,&v);\n int x=b-a;\n int z=12*v;\n int y=8*u;\n int w=12*u;\n if(x<=(8*u)) {printf(\"0\"); return 0;}\n if(u=b)\n {printf(\"%ld\",i);\n return 0;}\n else a=a+w-z;\n }\n printf(\"-1\");\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int h1, h2, a, b, ans = 0;\n scanf(\"%d %d\", &h1, &h2);\n scanf(\"%d %d\", &a, &b);\n\n if (a <= b && h2 - h1 - a * 8 > 0) {\n printf(\"-1\\n\");\n return 0;\n }\n\n int dis = h2 - h1 - a * 8;\n if (dis <= 0) {\n printf(\"1\\n\");\n return 0;\n }\n ans += 1;\n\n while (dis > 0) {\n dis -= (a - b) * 12;\n if (dis <= 0) break;\n ans+= 1;\n }\n\n printf(\"%d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int h1, h2, a, b, ans = 0;\n scanf(\"%d %d\", &h1, &h2);\n scanf(\"%d %d\", &a, &b);\n\n if (a <= b && h2 - h1 - a * 8 > 0) {\n printf(\"-1\\n\");\n return 0;\n }\n\n int dis = h2 - h1 - a * 8;\n if (dis <= 0) {\n printf(\"-1\\n\");\n return 0;\n }\n ans += 1;\n\n while (dis > 0) {\n dis -= (a - b) * 12;\n if (dis <= 0) break;\n ans+= 1;\n }\n\n printf(\"%d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include\n\nint main()\n\n{\n\tint a,b,c,d;\n\tscanf(\"%d%d\",&a,&b);\n\n\tscanf(\"%d%d\",&c,&d);\n\n\tfloat h,s;\n\tint i=1;\n\tif(c*8>=(b-a))\n\t\tprintf(\"0\");\n\n\telse if(c*8<(b-a) && c>=d && c!=d)\n\t{\n\t\th = (b-a-8*c)/(double)((c-d)*12);\n\t\ts = (b-a-8*c)/((c-d)*12);\n\n\t\tif(h>s)\n\t\t\tprintf(\"%.0f\\n\",s+1);\n\n\t\telse if(h==s)\n\t\t\tprintf(\"%.0f\",s);\n\t}\n\n\telse if(c*8<(b-a) && c>=d && c==d)\n\t{\t\t\n\t\tif(b-a <=c*8 + 12*c)\n\t\t\tprintf(\"1\");\n\t}\n\n\n\telse if(c\n\nint main()\n{\n\tint a,b,h1,h2,i,j,k,count,sum,s;\n\n\tscanf(\"%d%d%d%d\",&h1,&h2,&a,&b);\n\t\n\ts=h1;\n\th1+=a*(10-2);\n\n\tif(h1>=h2)\n\t{\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\telse\n\t{\n\t\th1=h1-12*b;\n\n\t\ti=0;\n\t\tcount=1;\n\t\twhile(1)\n\t\t{\n\t\t\th1=h1+4*a;\n\n\t\t\tif(h1+8*a>=h2&&h2>=h1)\n\t\t\t{\n\t\t\t\tprintf(\"%d\\n\",count);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\th1+=8*a;\n\t\t\th1-=12*b;\n\n\t\t\tcount++;\n\t\t\tif(count>=100000000)\n\t\t\t{\n\t\t\t\tprintf(\"-1\\n\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n\tint a,b,h1,h2,i,j,k,count,sum;\n\n\tscanf(\"%d%d%d%d\",&h1,&h2,&a,&b);\n\n\th1=h2-h1;\n\t\n\tsum=a*(10-2);\n\n\tif(sum>=h1)\n\t{\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\telse\n\t{\n\t\tsum=sum-12*b;\n\t\ti=0;\n\t\tcount=1;\n\t\twhile(1)\n\t\t{\n\t\t\tsum=sum+4*a;\n\n\t\t\tif(sum<=h1&&sum+8*a>=h1)\n\t\t\t{\n\t\t\t\tprintf(\"%d\\n\",count);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tsum+=8*a;\n\t\t\tsum-=12*b;\n\t\t\tcount++;\n\t\t\tif(count>=1000000)\n\t\t\t{\n\t\t\t\tprintf(\"-1\\n\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n\tint a,b,h1,h2,i,j,k,count,sum,s;\n\n\tscanf(\"%d%d%d%d\",&h1,&h2,&a,&b);\n\t\n\ts=h1;\n\th1+=a*(10-2);\n\n\tif(h1>=h2)\n\t{\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\telse\n\t{\n\t\th1=h1-12*b;\n\n\t\ti=0;\n\t\tcount=1;\n\t\twhile(1)\n\t\t{\n\t\t\t\n\n\t\t\tif(h1+12*a>=h2&&h1<=h2)\n\t\t\t{\n\t\t\t\tprintf(\"%d\\n\",count);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t\th1=h1+12*a;\n\t\t\th1-=12*b;\n\n\t\t\tcount++;\n\t\t\tif(count>=10000000)\n\t\t\t{\n\t\t\t\tprintf(\"-1\\n\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n\tint a,b,h1,h2,i,j,k,count,sum;\n\n\tscanf(\"%d%d%d%d\",&h1,&h2,&a,&b);\n\n\th1=h2-h1;\n\t\n\tsum=a*(10-2);\n\n\tif(sum>=h1)\n\t{\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\telse\n\t{\n\t\tsum=sum-12*b;\n\t\tif(sum<=0)\n\t\t\tsum=0;\n\n\t\ti=0;\n\t\tcount=1;\n\t\twhile(1)\n\t\t{\n\t\t\tsum=sum+4*a;\n\n\t\t\tif(sum<=h1&&sum+8*a>=h1)\n\t\t\t{\n\t\t\t\tprintf(\"%d\\n\",count);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tsum+=8*a;\n\t\t\tsum-=12*b;\n\t\t\tif(sum<=0)\n\t\t\t\tsum=0;\n\n\t\t\tcount++;\n\t\t\tif(count>=1000000)\n\t\t\t{\n\t\t\t\tprintf(\"-1\\n\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n\tint a,b,h1,h2,i,j,k,count,sum,s;\n\n\tscanf(\"%d%d%d%d\",&h1,&h2,&a,&b);\n\t\n\ts=h1;\n\th1+=a*(10-2);\n\n\tif(h1>=h2)\n\t{\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\telse\n\t{\n\t\th1=h1-12*b;\n\n\t\ti=0;\n\t\tcount=1;\n\t\twhile(1)\n\t\t{\n\t\t\th1=h1+4*a;\n\n\t\t\tif(h1+8*a>=h2&&h2>=h1)\n\t\t\t{\n\t\t\t\tprintf(\"%d\\n\",count);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\th1+=8*a;\n\t\t\th1-=12*b;\n\n\t\t\tcount++;\n\t\t\tif(count>=1000000)\n\t\t\t{\n\t\t\t\tprintf(\"-1\\n\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n\tint a,b,h1,h2,i,j,k,count,sum;\n\n\tscanf(\"%d%d%d%d\",&h1,&h2,&a,&b);\n\n\th1=h2-h1;\n\t\n\tsum=a*(10-2);\n\n\tif(sum>=h1)\n\t{\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\telse if(a<=b)\n\t{\n\t\tprintf(\"-1\\n\");\n\t}\n\telse\n\t{\n\t\tsum=sum-12*b;\n\t\ti=0;\n\t\tcount=1;\n\t\twhile(1)\n\t\t{\n\t\t\tsum=sum+4*a;\n\n\t\t\tif(sum<=h1&&sum+8*a>=h1)\n\t\t\t{\n\t\t\t\tprintf(\"%d\\n\",count);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tsum+=8*a;\n\t\t\tsum-=12*b;\n\t\t\tcount++;\n\t\t\tif(count>=100000)\n\t\t\t{\n\t\t\t\tprintf(\"-1\\n\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n\tint a,b,h1,h2,i,j,k,count,sum,s;\n\n\tscanf(\"%d%d%d%d\",&h1,&h2,&a,&b);\n\t\n\ts=h1;\n\th1+=a*(10-2);\n\n\tif(h1>=h2)\n\t{\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\telse\n\t{\n\t\th1=h1-12*b;\n\t\tif(h1<=0)\n\t\t\th1=0;\n\n\t\ti=0;\n\t\tcount=1;\n\t\twhile(1)\n\t\t{\n\t\t\th1=h1+4*a;\n\n\t\t\tif(h1+8*a>=h2&&h2>=h1)\n\t\t\t{\n\t\t\t\tprintf(\"%d\\n\",count);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\th1+=8*a;\n\t\t\th1-=12*b;\n\t\t\tif(h1<=0)\n\t\t\t\th1=0;\n\n\t\t\tcount++;\n\t\t\tif(count>=1000000)\n\t\t\t{\n\t\t\t\tprintf(\"-1\\n\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include \n\n#define S_N 8\n#define DN 12\n#define D_S 4\n\nint main() {\n\n int h1, h2;\n int a, b;\n\n scanf(\"%d%d\", &h1, &h2);\n scanf(\"%d%d\", &a, &b);\n\n h1 += S_N * a;\n if (h1 >= h2) {\n printf(\"0\");\n return 0;\n }\n if (a <= b) {\n printf(\"-1\");\n return 0;\n }\n printf(\"%d\", (h2 - h1) / ((a - b) * DN) + 1);\n return 0;\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int h1,h2,a,b;\n scanf(\"%d%d%d%d\",&h1,&h2,&a,&b);\n if(a<=b && h1+8*a=h2)\n {\n break;\n }\n h1=h1-b*12;\n ans++;\n if(h1<0)\n h1=0;\n h1=h1+4*a;\n }\n printf(\"%d\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int x,y,a,b,i,l=0;\n scanf(\"%lld %lld\",&x,&y);\n scanf(\"%lld %lld\",&a,&b);\n if(8*a+x>=y)\n {printf(\"0\");}\n else\n {if(b>=a)\n {printf(\"-1\");}\n else\n {x=x+8*a-12*b;\n i=0;\n while(x\nint main()\n{\n long long int x,y,a,b,i,l=0;\n scanf(\"%lld %lld\",&x,&y);\n scanf(\"%lld %lld\",&a,&b);\n if(8*a+x>=y)\n {printf(\"0\");}\n else\n {if(b>=a)\n {printf(\"-1\");}\n else\n {x=x+8*a-12*b;\n i=0;\n while(x=y)\n {printf(\"%lld\",i);}\n x=x-12*b;\n }\n }\n }\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n long long int x,y,a,b,i,l=0;\n scanf(\"%lld %lld\",&x,&y);\n scanf(\"%lld %lld\",&a,&b);\n if(8*a+x>=y)\n {printf(\"0\");}\n else\n {x=x+8*a-12*b;\n for(i=4;i<=12;i++)\n {if(x+i*a>=y)\n {l++;\n break;\n }\n }\n if(l==0)\n {printf(\"-1\");}\n else\n {printf(\"1\");}\n }\n return 0;\n}"}, {"source_code": "#include\nint main ()\n{\n\tint h1,h2,a,b;\n\tscanf(\"%d %d\",&h1,&h2);\n\tscanf(\"%d %d\",&a,&b);\n\tif(a\nint main ()\n{\n\tint h1,h2,a,b;\n\tscanf(\"%d %d\",&h1,&h2);\n\tscanf(\"%d %d\",&a,&b);\n\tif(a\nint main ()\n{\n\tint h1,h2,a,b;\n\tscanf(\"%d %d\",&h1,&h2);\n\tscanf(\"%d %d\",&a,&b);\n\tif(h2-h1<8*a) printf(\"%d\",0);\n\telse if(a\nint main ()\n{\n\tint h1,h2,a,b;\n\tscanf(\"%d %d\",&h1,&h2);\n\tscanf(\"%d %d\",&a,&b);\n\tif(h2-h1<8*a) printf(\"%d\",0);\n\telse if(a<=b) printf(\"%d\",-1);\n\telse{\n\th1=h1+a*8-b*12;\n\tint count=1;\n\twhile(h1+12*a\n\nint h1,h2,v1,v2;\nint i;\nint t;\n\nint main()\n{\n\tscanf(\"%d%d%d%d\",&h1,&h2,&v1,&v2);\n\t\n if(8*v1>=(h2-h1))\n t=0;\n \n else\n {\n \tif(v1<=v2)\n \tt=-1;\n \telse\n \t{\n\t \tt=0;\n\t\t for(i=0;;i++)\n\t\t {\n\t \t\th1=h1+(v1-v2)*12;\n\t \t\tif(v1*12>(h2-h1))\n\t \t\t{\n \t\t\t\tt++;\n \t\t\t\tbreak;\n\t \t\t}\n\t \t\tt++;\n \t\t}\n\t }\n }\n\t\n\tprintf(\"%d\\n\",t);\n\t\n\treturn 0;\n} "}, {"source_code": "#include\n\nint h1,h2,v1,v2;\nint i;\nint t;\n\nint main()\n{\n\tscanf(\"%d%d%d%d\",&h1,&h2,&v1,&v2);\n\t\n if(8*v1>=(h2-h1))\n t=0;\n \n else\n {\n \tif(v1<=v2)\n \tt=-1;\n \telse\n \t{\n\t \th1=h1+8*v1;\n\t \tt=1;\n\t \tfor(i=0;;i++)\n \t\t{\n \t\t\th1=h1+(v1-v2)*12;\n \t\t\tif(v1*12>(h2-h1))\n \t\t\t{\n \t\t\t\tbreak;\n \t\t\t}\n \t\t\tt++;\n \t\t}\n \t }\n }\n\t\n\tprintf(\"%d\\n\",t);\n\t\n\treturn 0;\n} "}, {"source_code": "#include\n\nint h1,h2,v1,v2;\nint i;\nint t;\n\nint main()\n{\n\tscanf(\"%d%d%d%d\",&h1,&h2,&v1,&v2);\n\t\n if(8*v1>=(h2-h1))\n t=0;\n \n else\n {\n \tif(v1<=v2)\n \tt=-1;\n \telse\n \t{\n\t \tt=0;\n while(1)\n {\n if(h1>=h2)\n {\n break;\n }\n h1-=12*v2;\n h1+=12*v1;\n t++;\n }\n \t }\n }\n\t\n\tprintf(\"%d\\n\",t);\n\t\n\treturn 0;\n} "}, {"source_code": "#include\n\nint h1,h2,v1,v2;\nint i;\nint t;\n\nint main()\n{\n\tscanf(\"%d%d%d%d\",&h1,&h2,&v1,&v2);\n\t\n\tif(v1(h2-h1)))\n\tt=0;\n\t\n\tif(v1>v2)\n\t{\n\t\tt=0;\n\t\tfor(i=0;;i++)\n\t\t{\n\t\t\th1=h1+(v1-v2)*12;\n\t\t\tif(v1*12>(h2-h1))\n\t\t\t{\n\t\t\t\tt++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tt++;\n\t\t}\n\t}\n\t\n\tprintf(\"%d\\n\",t);\n\t\n\treturn 0;\n} "}, {"source_code": "# include \n\nint main ()\n{\n int a,b,u,v;\n scanf(\"%d %d %d %d\",&a,&b,&u,&v);\n int x=b-a;\n int z=12*v;\n int y=8*u;\n int w=12*u;\n if(u=b)\n {printf(\"%d\",i);\n return 0;}\n else a=a+w-z;\n }\n printf(\"-1\");\n return 0;\n}\n"}, {"source_code": "# include \n\nint main ()\n{\n int a,b,u,v;\n scanf(\"%d %d %d %d\",&a,&b,&u,&v);\n int x=b-a;\n int z=12*v;\n int y=8*u;\n int w=12*u;\n if(u=b)\n {printf(\"%d\",i);\n return 0;}\n else a=a+w-z;\n }\n\n return 0;\n}\n"}, {"source_code": "# include \n\nint main ()\n{\n int a,b,u,v;\n scanf(\"%d %d %d %d\",&a,&b,&u,&v);\n int x=b-a;\n int z=12*v;\n int y=8*u;\n int w=12*u;\n if(x<=(8*u)) {printf(\"0\"); return 0;}\n if(u=b)\n {printf(\"%ld\",i);\n return 0;}\n else a=a+w-z;\n }\n printf(\"-1\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint main(){\n int i, j, k, l, x, h1, h2, a, b;\n\n while (scanf(\"%d %d %d %d\", &h1, &h2, &a, &b) != EOF){\n int hour = 14, days = 0, lim = 1e8;\n\n while (h1 < h2 && lim--){\n if (hour >= 10 && hour < 22) h1 += a;\n else h1 -= b;\n hour++;\n if (hour == 24) hour = 0;\n if (hour == 10) days++;\n }\n\n if (lim <= 0) days = -1;\n printf(\"%d\\n\", days);\n }\n return 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n\tint s,e;\n\tint u,d;\n\tint len;\n\tint day=0,flag=1;\n\tscanf(\"%d %d\",&s,&e);\n\tscanf(\"%d %d\",&u,&d);\n\tlen=e-s;\n\tif(u*6>=len) printf(\"0\\n\");\n\telse if(u<=d) printf(\"-1\\n\");\n\telse\n\t{\n\t\tday=0;flag=1;\n\t\tlen=len-u*6;\n\t\twhile(flag==1)\n\t\t{\n\t\t\tlen-=12*u;\n\t\t\tday++;\n\t\t\tif(len<=0) flag=0;\n\t\t\tlen+=12*d;\n\t\t}\n\t\tprintf(\"%d\\n\",day);\n\t}\n} "}, {"source_code": "#include \n\n/*\n * http://codeforces.com/problemset/problem/652/A\n */\nint main()\n{\n int hc = 0, ha = 0;\n scanf(\"%d %d\", &hc, &ha);\n\n int a = 0, b = 0, d = 0;\n scanf(\"%d %d\", &a, &b);\n\n hc += 8 * a;\n\n if (hc < ha && a <= b) {\n printf(\"-1\\n\");\n\n return 0;\n }\n\n while (hc <= ha) {\n hc += a * 12 - b * 12;\n d += 1;\n }\n\n printf(\"%d\\n\", d);\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main(){\n long long int h1,h2,a,b;\n scanf(\"%lld %lld\",&h1,&h2);\n scanf(\"%lld %lld\",&a,&b);\n int i;\n long long int dist=h1;\n bool day=1,first=1,sec=1;\n int count=0;\n while(1){\n if(dist>=h2||(!sec&&dist<0))\n break;\n if(day&&first){\n dist+=(a*8);\n day=0;\n first=0;\n }\n else if(!day){\n dist-=(b*12);\n count++;\n day=1;\n }\n else if(!first){\n dist+=(a*12);\n day=0;\n sec=0;\n }\n \n }\n if(dist>=h2)\n printf(\"%d\",count);\n else\n printf(\"-1\");\n}"}, {"source_code": "#include \n#include \n#include \n\nint main()\n{\n long long h1,h2,a,b,h,step,days;\n\n scanf(\"%lld %lld\",&h1,&h2);\n scanf(\"%lld %lld\",&a,&b);\n\n if(b>a && (8*a)<(h2-h1))\n printf(\"-1\");\n\n else if(8*a >= h2-h1)\n printf(\"0\");\n\n else\n {\n h = h2 - (h1 + 8*a);\n step = 12*(a-b);\n days = ceil((double)h/step);\n printf(\"%lld\",days);\n }\n\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tlong long int s,h1,h2,a,b,i,c=0,u,d;\n\tscanf(\"%I64d%I64d%I64d%I64d\",&h1,&h2,&a,&b);\n\tif(a*8+h1>h2)\n\tprintf(\"0\");\n\telse if(a*8+h1=b)\n\t{\n\t\td=a*8+h1-b*12;\n\t\tu=d+12*a;\n\t\tc++;\n\t\ts=(h2-u)/(12*(a-b));\n\t printf(\"%I64d\",c+s);\n\t}\n\telse if(a\nint main()\n{\n\tlong long int h1,h2,a,b,i,c=0,u,d;\n\tscanf(\"%I64d%I64d%I64d%I64d\",&h1,&h2,&a,&b);\n\tif(a*8+h1>h2)\n\tprintf(\"0\");\n\telse if(a<=b)\n\tprintf(\"-1\");\n\telse if(a*8+h1=b)\n\t{\n\t\td=a*8+h1-b*12;\n\t\tu=d+12*a;\n\t\tc++;\n\t\twhile(u\nint main(){\n int a,b,c,d,e,f,g;\n int first,second;\n int up,down;\n scanf(\"%d%d\",&first,&second);\n scanf(\"%d%d\",&up,&down);\n if(((first + 8*up) - (12 * down) + 4*up) <= first && (((8*up)+first) <= second)){\n printf(\"-1\");\n return 0;}\n if(up == down && (((8*up)+first) <= second)){\n printf(\"-1\");\n return 0;\n }\n int cnt=0,i;\n if(first>=second){\n printf(\"0\");\n return 0;}\n while(1){\n for(i=0;i<8;i++){\n first+=up;\n if(first>=second){\n printf(\"%d\",cnt);\n return 0;\n }}\n for(i=0;i<12;i++){\n first-=down;\n if(first>=second){\n printf(\"%d\",cnt);\n return 0;\n }}\n cnt++;\n for(i=0;i<4;i++){\n first+=up;\n if(first>=second){\n printf(\"%d\",cnt);\n return 0;\n }}\n }\n}\n"}, {"source_code": "#include \n\nint h1, h2;\nint a, b;\nint cnt;\nint main()\n{\n\tscanf(\"%d %d %d %d\", &h1, &h2, &a, &b);\n\tif (a < b)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\tif (h1 + (a * 8) >= h2)\n\t{\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\th1 += (a * 8);\n\th1 -= (b * 12);\n\th1 = h1 < 0 ? 0 : h1;\n\n\tcnt++;\n\twhile (1)\n\t{\n\t\tif (h1 + (a * 4) > h2)\n\t\t{\n\t\t\tprintf(\"-1\");\n\t\t\tbreak;\n\t\t}\n\t\th1 += (a * 4);\n\n\t\tif (h1 + (a * 8) >= h2)\n\t\t{\n\t\t\tprintf(\"%d\", cnt);\n\t\t\tbreak;\n\t\t}\n\t\th1 += (a * 8);\n\t\th1 -= (b * 12);\n\t\tcnt++;\n\t}\n}"}, {"source_code": "#include \n#include \n\nint h1, h2;\nint a, b;\nint cnt;\nint main()\n{\n\tscanf(\"%d %d %d %d\", &h1, &h2, &a, &b);\n\tif (a < b)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\tif (h1 + (a * 8) >= h2)\n\t{\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\th1 += (a * 8);\n\th1 -= (b * 12);\n\th1 = h1 < 0 ? 0 : h1;\n\n\tcnt++;\n\tif (a == b)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\twhile (1)\n\t{\n\t\tif (h1 + (a * 4) > h2)\n\t\t{\n\t\t\tprintf(\"-1\");\n\t\t\tbreak;\n\t\t}\n\t\th1 += (a * 4);\n\n\t\tif (h1 + (a * 8) >= h2)\n\t\t{\n\t\t\tprintf(\"%d\", cnt);\n\t\t\tbreak;\n\t\t}\n\t\th1 += (a * 8);\n\t\th1 -= (b * 12);\n\t\tcnt++;\n\t}\n}"}, {"source_code": "#include \n#include \n\nint h1, h2;\nint a, b;\nint cnt;\nint main()\n{\n\tscanf(\"%d %d %d %d\", &h1, &h2, &a, &b);\n\tif (h1 + (a * 8) >= h2)\n\t{\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\tif (a < b)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\th1 += (a * 8);\n\th1 -= (b * 12);\n\th1 = h1 < 1 ? 1 : h1;\n\n\tcnt++;\n\twhile (1)\n\t{\n\t\tif (h1 + (a * 4) > h2)\n\t\t{\n\t\t\tprintf(\"-1\");\n\t\t\tbreak;\n\t\t}\n\t\th1 += (a * 4);\n\n\t\tif (h1 + (a * 8) >= h2)\n\t\t{\n\t\t\tprintf(\"%d\", cnt);\n\t\t\tbreak;\n\t\t}\n\t\th1 += (a * 8);\n\t\th1 -= (b * 12);\n\t\th1 = h1 < 1 ? 1 : h1;\n\t\tcnt++;\n\t}\n}"}, {"source_code": "#include \n#include \n\nint h1, h2;\nint a, b;\nint cnt;\nint main()\n{\n\tscanf(\"%d %d %d %d\", &h1, &h2, &a, &b);\n\tif (h1 + (a * 8) >= h2)\n\t{\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\tif (a < b)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\th1 += (a * 8);\n\th1 -= (b * 12);\n\th1 = h1 < 0 ? 0 : h1;\n\n\tcnt++;\n\twhile (1)\n\t{\n\t\tif (h1 + (a * 4) > h2)\n\t\t{\n\t\t\tprintf(\"-1\");\n\t\t\tbreak;\n\t\t}\n\t\th1 += (a * 4);\n\n\t\tif (h1 + (a * 8) >= h2)\n\t\t{\n\t\t\tprintf(\"%d\", cnt);\n\t\t\tbreak;\n\t\t}\n\t\th1 += (a * 8);\n\t\th1 -= (b * 12);\n\t\tcnt++;\n\t}\n}"}, {"source_code": "#include \n#include \n\nint h1, h2;\nint a, b;\nint cnt;\nint main()\n{\n\tscanf(\"%d %d %d %d\", &h1, &h2, &a, &b);\n\tif (h1 + (a * 8) >= h2)\n\t{\n\t\tprintf(\"%d\", 0);\n\t\treturn 0;\n\t}\n\tif (a < b)\n\t{\n\t\tprintf(\"%d\", -1);\n\t\treturn 0;\n\t}\n\th1 += (a * 8);\n\th1 -= (b * 12);\n\tif (h1 < 0)\n\t{\n\t\tprintf(\"%d\", -1);\n\t\treturn 0;\n\t}\n\tcnt++;\n\twhile (1)\n\t{\n\t\tif (h1 + (a * 4) > h2)\n\t\t{\n\t\t\tprintf(\"%d\", -1);\n\t\t\tbreak;\n\t\t}\n\t\th1 += (a * 4);\n\n\t\tif (h1 + (a * 8) >= h2)\n\t\t{\n\t\t\tprintf(\"%d\", cnt);\n\t\t\tbreak;\n\t\t}\n\t\th1 += (a * 8);\n\t\th1 -= (b * 12);\n\t\tif (h1 < 0)\n\t\t{\n\t\t\tprintf(\"%d\", -1);\n\t\t\treturn 0;\n\t\t}\n\t\tcnt++;\n\t}\n}"}, {"source_code": "#include \n#include \n\nint h1, h2;\nint a, b;\nint cnt;\nint main()\n{\n\tscanf(\"%d %d %d %d\", &h1, &h2, &a, &b);\n\tif (h1 + (a * 8) >= h2)\n\t{\n\t\tprintf(\"%d\", 0);\n\t\treturn 0;\n\t}\n\tif (a < b)\n\t{\n\t\tprintf(\"%d\", -1);\n\t\treturn 0;\n\t}\n\th1 += (a * 8);\n\th1 -= (b * 12);\n\th1 = h1 < 1 ? 1 : h1;\n\n\tcnt++;\n\twhile (1)\n\t{\n\t\tif (h1 + (a * 4) > h2)\n\t\t{\n\t\t\tprintf(\"%d\", -1);\n\t\t\tbreak;\n\t\t}\n\t\th1 += (a * 4);\n\n\t\tif (h1 + (a * 8) >= h2)\n\t\t{\n\t\t\tprintf(\"%d\", cnt);\n\t\t\tbreak;\n\t\t}\n\t\th1 += (a * 8);\n\t\th1 -= (b * 12);\n\t\tif (h1 < 1)\n\t\t{\n\t\t\tprintf(\"%d\", -1);\n\t\t\treturn 0;\n\t\t}\n\t\tcnt++;\n\t}\n}\n"}, {"source_code": "#include \n\nint h1, h2;\nint a, b;\nint cnt;\nint main()\n{\n\tscanf(\"%d %d %d %d\", &h1, &h2, &a, &b);\n\tif (a < b)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\tif (h1 + (a * 8) >= h2)\n\t{\n\t\tprintf(\"%d\", cnt);\n\t\treturn 0;\n\t}\n\th1 += (a * 8);\n\th1 -= (b * 12);\n\tcnt++;\n\twhile (1)\n\t{\n\t\tif (h1 + (a * 4) > h2)\n\t\t{\n\t\t\tprintf(\"-1\");\n\t\t\tbreak;\n\t\t}\n\t\th1 += (a * 4);\n\n\t\tif (h1 + (a * 8) >= h2)\n\t\t{\n\t\t\tprintf(\"%d\", cnt);\n\t\t\tbreak;\n\t\t}\n\t\th1 -= (b * 12);\n\t\tcnt++;\n\t}\n}\n"}, {"source_code": "#include \n#include \n\nint h1, h2;\nint a, b;\nint cnt;\nint main()\n{\n\tscanf(\"%d %d %d %d\", &h1, &h2, &a, &b);\n\tif (h1 + (a * 8) >= h2)\n\t{\n\t\tprintf(\"%d\", 0);\n\t\treturn 0;\n\t}\n\tif (a < b)\n\t{\n\t\tprintf(\"%d\", -1);\n\t\treturn 0;\n\t}\n\th1 += (a * 8);\n\th1 -= (b * 12);\n\n\tcnt++;\n\twhile (1)\n\t{\n\t\tif (h1 + (a * 4) > h2)\n\t\t{\n\t\t\tprintf(\"%d\", -1);\n\t\t\tbreak;\n\t\t}\n\t\th1 += (a * 4);\n\n\t\tif (h1 + (a * 8) >= h2)\n\t\t{\n\t\t\tprintf(\"%d\", cnt);\n\t\t\tbreak;\n\t\t}\n\t\th1 += (a * 8);\n\t\th1 -= (b * 12);\n\t\tif (h1 < 0)\n\t\t{\n\t\t\tprintf(\"%d\", -1);\n\t\t\treturn 0;\n\t\t}\n\t\tcnt++;\n\t}\n}"}, {"source_code": "#include \n#include \n\nint h1, h2;\nint a, b;\nint cnt;\nint main()\n{\n\tscanf(\"%d %d %d %d\", &h1, &h2, &a, &b);\n\tif (h1 + (a * 8) >= h2)\n\t{\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\tif (a <= b)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\th1 += (a * 8);\n\th1 -= (b * 12);\n\th1 = h1 < 0 ? 0 : h1;\n\n\tcnt++;\n\twhile (1)\n\t{\n\t\tif (h1 + (a * 4) > h2)\n\t\t{\n\t\t\tprintf(\"-1\");\n\t\t\tbreak;\n\t\t}\n\t\th1 += (a * 4);\n\n\t\tif (h1 + (a * 8) >= h2)\n\t\t{\n\t\t\tprintf(\"%d\", cnt);\n\t\t\tbreak;\n\t\t}\n\t\th1 += (a * 8);\n\t\th1 -= (b * 12);\n\t\tcnt++;\n\t}\n}"}, {"source_code": "#include \n#include \n\nint h1, h2;\nint a, b;\nint cnt;\nint main()\n{\n\tscanf(\"%d %d %d %d\", &h1, &h2, &a, &b);\n\tif (h1 + (a * 8) >= h2)\n\t{\n\t\tprintf(\"%d\", 0);\n\t\treturn 0;\n\t}\n\th1 += (a * 8);\n\th1 -= (b * 12);\n\tcnt++;\n\twhile (1)\n\t{\n\t\tif (h1 + (a * 4) >= h2)\n\t\t{\n\t\t\tprintf(\"%d\", -1);\n\t\t\tbreak;\n\t\t}\n\t\th1 += (a * 4);\n\n\t\tif (h1 + (a * 8) >= h2)\n\t\t{\n\t\t\tprintf(\"%d\", cnt);\n\t\t\tbreak;\n\t\t}\n\t\th1 += (a * 8);\n\t\th1 -= (b * 12);\n\t\tif (a <= b)\n\t\t{\n\t\t\tprintf(\"%d\", -1);\n\t\t\treturn 0;\n\t\t}\n\t\tcnt++;\n\t}\n}"}, {"source_code": "#include \n#include \n\nint h1, h2;\nint a, b;\nint cnt;\nint main()\n{\n\tscanf(\"%d %d %d %d\", &h1, &h2, &a, &b);\n\tif (h1 + (a * 8) >= h2)\n\t{\n\t\tprintf(\"%d\", 0);\n\t\treturn 0;\n\t}\n\th1 += (a * 8);\n\th1 -= (b * 12);\n\tcnt++;\n\twhile (1)\n\t{\n\t\tif (h1 + (a * 4) > h2)\n\t\t{\n\t\t\tprintf(\"%d\", -1);\n\t\t\tbreak;\n\t\t}\n\t\th1 += (a * 4);\n\n\t\tif (h1 + (a * 8) >= h2)\n\t\t{\n\t\t\tprintf(\"%d\", cnt);\n\t\t\tbreak;\n\t\t}\n\t\th1 += (a * 8);\n\t\th1 -= (b * 12);\n\t\tif (a <= b)\n\t\t{\n\t\t\tprintf(\"%d\", -1);\n\t\t\treturn 0;\n\t\t}\n\t\tcnt++;\n\t}\n}"}, {"source_code": "#include \n#include \n#include \n\nint h1, h2;\nint a, b;\nint cnt;\nint main()\n{\n\tscanf(\"%d %d %d %d\", &h1, &h2, &a, &b);\n\tif (h1 + (a * 8) >= h2)\n\t{\n\t\tprintf(\"%d\", 0);\n\t\treturn 0;\n\t}\n\th1 += (a * 8);\n\th1 -= (b * 12);\n\tif (abs(h1) >= h2)\n\t{\n\t\tprintf(\"%d\", -1);\n\t\treturn 0;\n\t}\n\tcnt++;\n\twhile (1)\n\t{\n\t\tif (h1 + (a * 4) > h2)\n\t\t{\n\t\t\tprintf(\"%d\", -1);\n\t\t\treturn 0;\n\t\t}\n\t\th1 += (a * 4);\n\n\t\tif (h1 + (a * 8) >= h2)\n\t\t{\n\t\t\tprintf(\"%d\", cnt);\n\t\t\treturn 0;\n\t\t}\n\t\th1 += (a * 8);\n\t\th1 -= (b * 12);\n\t\tif (abs(h1) >= h2)\n\t\t{\n\t\t\tprintf(\"%d\", -1);\n\t\t\treturn 0;\n\t\t}\n\t\tif (a == b)\n\t\t{\n\t\t\tprintf(\"%d\", -1);\n\t\t\treturn 0;\n\t\t}\n\t\tcnt++;\n\t}\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int h,h1,h2,a,b,up,down,reach,des;\n int k=-1;\n scanf(\"%d%d\",&h1,&h2);\n scanf(\"%d%d\",&a,&b);\n h=h2-h1;\n up=12*a;\n down = 12*b;\n if(a==b)\n { k=0;\n printf(\"%d\",k);\n return 0;\n }\n\n reach=up-down;\n k=h/reach;\n \n\n if(b>a)\n { k=-1;\n printf(\"%d\",k);\n return 0;\n }\n\n\n else if((reach>h) || (des<0))\n { k=0;\n printf(\"%d\",k);\n return 0;\n }\n\n\n if(k>1)\n k=1;\n printf(\"%d\",k);\n\n return 0;\n}\n"}, {"source_code": "#include\n\nint cat(int a,int b,int h1, int h2,int d)\n{ int pos=0,k=0;\n pos=(a*8)+h1;\n if(pos>=h2)\n {\n k=d;\n printf(\"%d\",k);\n return 0;\n }\n d++;\n pos-=(b*12);\n pos=pos+a*4;\n if(pos>=h2)\n {\n k=d;\n printf(\"%d\",k);\n return 0;\n }\n cat(a,b,pos,h2,d);\n}\n\nint main()\n{\n int a,b,h1,h2,d=0;\n scanf(\"%d%d\",&h1,&h2);\n scanf(\"%d%d\",&a,&b);\n\tif(a==b)\n\t{\n\tprintf(\"%d\",d);\n\treturn 0;\n\t}\n\tif(a\nint main()\n{\n\tint e;\n\tfloat a,g,b,c,d;\n\tscanf(\"%f%f%f%f\",&a,&b,&c,&d);\n\tif(a+8*c>=b || a==b)\n\t{\n\t\tprintf(\"0\\n\");\n\t\tgoto jump;\n\t}\n\telse if(c\nint main()\n{\n\tint e;\n\tfloat a,g,b,c,d;\n\tscanf(\"%f%f%f%f\",&a,&b,&c,&d);\n\tif(a+8*c>=b || a==b)\n\t{\n\t\tprintf(\"0\\n\");\n\t\tgoto jump;\n\t}\n\telse if(c\nint main()\n{\n\tint e;\n\tfloat a,g,b,c,d;\n\tscanf(\"%f%f%f%f\",&a,&b,&c,&d);\n\tif(a+8*c>=b || a==b)\n\t{\n\t\tprintf(\"0\\n\");\n\t\tgoto jump;\n\t}\n\telse if(c2))\n\t{\n\t\tint flag=0;\n\t\tprintf(\"%d\\n\",e/24);\n\t}\n\telse\n\t\tprintf(\"%d\\n\",e/24+1);\n\tjump:\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n\tint a,b,c,d,e;\n\tscanf(\"%d%d%d%d\",&a,&b,&c,&d);\n\tif(a+8*c>=b || a==b)\n\t{\n\t\tprintf(\"0\\n\");\n\t\tgoto jump;\n\t}\n\telse if(c\nint main()\n{\n\tint e;\n\tfloat a,g,b,c,d;\n\tscanf(\"%f%f%f%f\",&a,&b,&c,&d);\n\tif(a+8*c>=b || a==b)\n\t{\n\t\tprintf(\"0\\n\");\n\t\tgoto jump;\n\t}\n\telse if(c\nint main()\n{\n\tint e;\n\tfloat a,g,b,c,d;\n\tscanf(\"%f%f%f%f\",&a,&b,&c,&d);\n\tif(a+8*c>=b || a==b)\n\t{\n\t\tprintf(\"0\\n\");\n\t\tgoto jump;\n\t}\n\telse if(c\n#include \n#include \n\ntypedef long long ll;\n\nint main(int argc, char ** argv){\n\t\n\tll MAX = 823543;\n\tll n,m;\n\tscanf(\"%lld%lld\",&n,&m);\n\tif(n>MAX || m>MAX){\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\tll num_dg_hr = 1;\n\tll num_dg_min = 1;\n\tll x1 = 7*num_dg_hr;\n\tll x2 = 7*num_dg_min;\n\twhile((n-1)/x1!=0){\n\t\tnum_dg_hr++;\n\t\tx1*=7;\n\t}\n\twhile((m-1)/x2!=0){\n\t\tnum_dg_min++;\n\t\tx2*=7;\n\t}\n\tif(num_dg_min+num_dg_hr>7){\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\tll i,j;\n\tll ans = 0;\n\tfor(i=0; i1){\n\t\t\t\tflag = false;\n\t\t\t}\n\t\t}\n\t\tif(flag){\n\t\t\tans++;\n\t\t}\n\t}\n\tprintf(\"%lld\\n\",ans);\n\n\treturn 0;\n}"}, {"source_code": "#include \n\nlong digitsIn7(long a)\n{\n\tlong r = 0;\n\n\tdo\n\t{\n\t\tr++;\n\t\ta /= 7;\n\t} while (a);\n\n\treturn r;\n}\n\nint hasDistinct(long v, long r)\n{\t\t\n\tint mask = 0;\n\n\twhile (r--)\n\t{\n\t\tlong d = v % 7;\n\t\tif (mask & (1< 7)\n\t\tputs(\"0\");\n\telse\n\t{\n\t\tlong pow = 1;\n\t\tlong sum = 0;\n\t\tfor (long i = 0; i < da; i++)\n\t\t\tpow *= 7;\n\t\t\n\t\tlong i, j;\n\n\t\tfor (i = 0; i < a; i++)\n\t\t\tfor (j = 0; j < b; j++)\n\t\t\t\tif (hasDistinct(i + j*pow, da+db)) sum++;\n\n\t\tprintf(\"%ld\\n\", sum);\n\t}\n}\n"}, {"source_code": "#include \n\nlong long n, m, pow[11], nn = 0, mm = 0, res = 0, leng;\nint a[7],x[8], res1 = 0, res2 = 0;\n\n\n\nvoid kiemtra()\n{\n int j, i = 1;\n long long h = 0;\n for (i = 1; i <= res1; i++)\n {\n h = h * 10 + x[i];\n }\n if (h > nn) return;\n\n h = 0;\n for (i = res1 + 1; i <= leng; i++)\n {\n h = h * 10 + x[i];\n }\n if (h > mm) return;\n res++;\n}\n\n\nvoid xuli(int i)\n{\n int j;\n for (j = 0; j < 7; j++)\n if (a[j] == 0)\n {\n x[i] = j;\n a[j] = 1;\n if (i == leng) kiemtra();\n else\n xuli(i+1);\n a[j] = 0;\n }\n}\n\n\nvoid sol()\n{\n int x, i;\n for (i = 10; i >= 0; i--)\n {\n nn = nn * 10 + n / pow[i];\n if (n / pow[i] > 0)\n {\n x = n / pow[i];\n n -= x * pow[i];\n if (res1 == 0)\n {\n res1 = i+1;\n }\n }\n }\n if (nn == 0) res1 = 1;\n for (i = 10; i >= 0; i--)\n {\n mm = mm * 10 + m / pow[i];\n if (m / pow[i] > 0)\n {\n x = m / pow[i];\n m -= x * pow[i];\n if (res2 == 0)\n {\n res2 = i+1;\n }\n }\n }\n if (mm == 0) res2 = 1;\n leng = res1 + res2;\n xuli(1);\n}\n\n\n\nint main()\n{\n int i, j;\n scanf(\"%I64d %I64d\", &n, &m);\n n--; m--;\n for (j = 0; j < 7; j++)\n a[j] = 0;\n pow[0] = 1;\n for (i = 1; i < 11; i++)\n pow[i] = pow[i-1] * 7;\n sol();\n printf(\"%d\", res);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include\n#define MAXN 13\nlong long a[MAXN],b[MAXN],m,n,ans=0; \nlong long s1[MAXN],s2[MAXN];\nvoid find(long long x,long long y,long long add)\n{\n\tlong long i,j,S;\n\tif(add>y){\n\t\tans++;\n\t\treturn;\n\t}\n\tfor(i=0;i<=6;i++){\n\t\tfor(j=1;j=m)\n\t\t\tgoto end1;\n\t\tb[add]=i;\n\t\tfind(x,y,add+1);\n\t\tend1:;\n\t}\n}\nvoid dfs(long long x,long long y,long long add)\n{\n\tlong long i,j,S;\n\tif(add>x){\n\t\tfind(x,y,1);\n\t\treturn;\n\t}\n\tfor(i=0;i<=6;i++){\n\t\tfor(j=1;j=n)\n\t\t\tgoto end;\n\t\ta[add]=i;\n\t\tdfs(x,y,add+1);\n\t\tend:;\n\t}\n} \nint main()\n{\n\tlong long k,i,j,l,c,p,q,c1=0,c2=0;\n\tscanf(\"%I64d%I64d\",&n,&m);\n\tp=n-1;q=m-1;\n\twhile(p>0){\n\t\tp=p/7;\n\t\tc1++;\n\t}\n\twhile(q>0){\n\t\tq=q/7;\n\t\tc2++;\n\t}\n\tif(c1==0)\n\tc1++;\n\tif(c2==0)\n\t\tc2++;\n\tif(c1+c2>7){\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\tdfs(c1,c2,1);\n\tprintf(\"%I64d\",ans);\n\treturn 0;\n}\n\n"}, {"source_code": "#include\n#include\n#include\n#include\n#include\n#include\nint cmp[250];\nint cnt[10];\nint cmp1[250];\nint calc(int a){\n\tint cntx=0;\n\twhile(a){\n\t\ta/=7;\n\t\tcntx++;\n\t}\n\treturn cntx;\n}\nint insert(int x,int fix[]){\n\tif(x==0){\n\t\tfix[0]=0;\n\t\treturn 1;\n\t}\n\tint i,k; i=k=0;\n\twhile(x){\n\t\tfix[i++]=x%7;\n\t\tx/=7;\n\t}\n\tfor(k=0;k1)\n\t\treturn 0;\n\t}\n\treturn 1;\n}\nint main(){\n\tint a,b,c,d,e,f,g,h;\n\tscanf(\"%d%d\",&a,&b);\n\tint t = calc(a-1); int t1=calc(b-1);\n\tif(t+t1>7){\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\tint i; int cnt=0;\n\tfor(i=0;i\n#include\n#include\n#include\n#include\n#include\nchar cmp[250];\nint cnt[10];\nchar cmp1[250];\nvoid re_use(char temp[],int t){\n\tchar new_arr[250];\n\tint len = strlen(temp); int i;\n\tfor(i=0;i1)\n\t\t\treturn 0;\n\t}\n\treturn 1;\n}\nint main(){\n\tint a,b,c,d,e,f,g,h;\n\tscanf(\"%d%d\",&a,&b);\n\tint t = calc(a-1); int t1=calc(b-1);\n\tif(t+t1>7){\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\tint i; int cnt=0;\n\tfor(i=0;i\n#include\n#include\n#include\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 }\n void 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\n void 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{\nif(root==NULL)\n{\nroot=(node *)malloc(sizeof(node));\nroot->val=x;\n}\nelse\n{\nif(x<=root->val)\n{\nif(root->l==NULL)\n{\nroot->l=(node *)malloc(sizeof(node));\nroot->l->val=x;\n}\nelse\nroot->l=insert(x,root->l);\n}\nelse\n{\nif(root->r==NULL)\n{\nroot->r=(node *)malloc(sizeof(node));\nroot->r->val=x;\n}\nelse\n{\nroot->r=insert(x,root->r);\n}\n}\n}\nreturn root;\n}\nnode *find(int x,node *root)\n{\nif(root==NULL)\n{\nreturn 0;\n}\nelse\n{\nif(x==root->val)\nreturn root;\nelse if(xval)\n{\nif(root->l==NULL)\n{\nreturn 0;\n}\nelse\n{\nfind(x,root->l);\n}\n}\nelse\n{\nif(root->r==NULL)\n{\nreturn 0;\n}\nelse\n{\nfind(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{\nif(ar[a]==NULL)\n{\nar[a]=(nd *)malloc(sizeof(nd));\nar[a]->val=b;\nar[a]->next=NULL;\n}\nelse\n{\nnd *temp=(nd *)malloc(sizeof(nd)),*t;\ntemp->val=b;\ntemp->next=ar[a];\nar[a]=temp;\n}\n}\n\n//dfs\n//int state[100001];\nvoid dfs(int a)\n{\nstate[a]=1;\ncount++;\nnd *temp=ar[a];\nwhile(temp!=NULL)\n{\nif(state[temp->val]!=1)\ndfs(temp->val);\ntemp=temp->next;\n}\nreturn;\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 if(ar[a]==NULL)\n {\n ar[a]=(node *)malloc(sizeof(node));\n ar[a]->val=b;\n ar[a]->weight=w;\n ar[a]->next=NULL;\n }\n else\n {\n node *temp=(node *)malloc(sizeof(node)),*t;\n temp->val=b;\n temp->weight=w;\n temp->next=ar[a];\n ar[a]=temp;\n }\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\n void 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\n int 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*xval;\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 int n,m,u,v,w,i;\n scanf(\"%d%d\",&n,&m);\n for(i=0;i<=n;i++)\n state[i]=0;\n while(m--)\n {\n scanf(\"%d%d%d\",&u,&v,&w);\n insert(u,v,w);\n }\n scanf(\"%d%d\",&u,&v);\n ptr=1;\n hinsert(0,u);\n d[u]=0;\n for(i=1;i<=n;i++)\n {\n if(i!=u)\n {\n hinsert(1000000000,i);\n d[i]=1000000000;\n }\n }\n dikstra(u,v);\n if(d[v]==1000000000)\n printf(\"NO\\n\");\n else\n printf(\"%d\\n\",d[v]);\n return 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\n void Union(int a,int b)\n {\n if(a==b)\n return;\n dsu[a] = b;\n }\n\n typedef 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 return ((edge*)a)->weight - ((edge*)b)->weight;\n }*/\n/*int main()\n {\n int i;\n int n,m;\n scanf(\"%d %d\\n\",&n,&m);\n for(i=0;ib)\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,m,ct,ans=0;\n scan(n);\n scan(m);\n int i,j,k,val=0;\n int dig1,dig2;\n val=(n-1)/7;\n dig1=1;\n dig2=1;\n while(val>0)\n {\n dig1++;\n val=val/7;\n }\n \n val=(m-1)/7;\n while(val>0)\n {\n dig2++;\n val=val/7;\n }\n val=dig1+dig2;\n if(val>7)\n {\n ans=0;\n print(ans);\n return 0;\n }\n int status[10],st2[10],cond=0;\n for(i=0;i\n#include\nint dgt(int a)\n{\n int c=1;\n a--;\n while(a/7>0){\n a/=7;\n c++;\n }\n return c;\n}\nint ys(int m, int n, int a, int b)\n{\n int fr[7]={0,0,0,0,0,0,0},i;\n //printf(\"%d-%d: \",m,n);\n for(i=0;i1){\n //printf(\"0\\n\");\n return 0;\n }\n m=m/7;\n }\n for(i=0;i1){\n //printf(\"0\\n\");\n return 0;\n }\n n=n/7;\n }\n //printf(\"1\\n\");\n return 1;\n}\nint get(int m, int n)\n{\n int d1,d2,i,j,rs=0;\n d1=dgt(m);\n d2=dgt(n);\n //printf(\"D=%d,%d\\n\",d1,d2);\n if(d1+d2>7)\n return 0;\n for(i=0;i\n\nint n, m;\nint dign, digm;\nint res;\n\nint dig(int k) {\n int ans=0;\n if(k==0) return 1;\n while(k>0) {\n k/=7;\n ans++;\n }\n return ans;\n}\n\nint chk(int h, int m) {\n int visit[7];\n for(int i=0;i<7;i++) visit[i]=0;\n for(int i=0;i1) return 0;\n }\n return 1;\n}\n\nint main() {\n int tmp;\n scanf(\"%d %d\", &n, &m);\n dign=dig(n-1), digm=dig(m-1);\n if(dign+digm>7) puts(\"0\");\n else {\n for(int i=0;i\n#include \n\nint main() {\n\tint n, m, d;\n\tscanf(\"%d%d\", &n, &m);\n\tint dn = 1, dm = 1;\n\tfor(int k = 7 ; k < n ; k *= 7) dn++;\n\tfor(int k = 7 ; k < m ; k *= 7) dm++;\t\n\td = dn + dm;\n\tif(d > 7) {\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\tint r = 0;\n\tfor(int i=0 ; i 1) {\n\t\t\t\t\tr--;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\\n\", r);\n\treturn 0;\n}"}, {"source_code": "#include \n\n\nint check(int a, int b, int c)\n{\n\tint oc[7]={0}, sum=0,flag=0,i=0;\n\t\n\twhile(a)\n\t{\n\t\tif(oc[a%7]) {flag=1;break;}\n\t\telse oc[a%7]++;\n\t\ta/=7;\n\t\tsum++;\n\t}\n\t\n\twhile(b&&!flag)\n\t{\n\t\tif(oc[b%7]) {flag=1;break;}\n\t\toc[b%7]++;\n\t\tb/=7;\n\t\tsum++;\n\t}\n\t\n\tif(c-sum>1) flag=1;\n\t\n\tif(c-sum>0 && oc[0]==1) flag=1;\n\t\n\tif(flag==1) return 0;\n\t\n\telse return 1;\n}\n\nint main(void) {\n\tint n,m,i=0,a,d=0,ans=0;\n\t\n\tscanf(\"%d %d\",&n,&m);\n\n\ta=n-1;\n\twhile(1)\n\t{\n\t\td++;\n\t\ta/=7;\n\t\tif(a==0) break;\n\t}\n\t\n\ta=m-1;\n\twhile(1)\n\t{\n\t\td++;\n\t\ta/=7;\n\t\tif(a==0) break;\n\t}\n\t\n\tif(d>7) printf(\"0\");\n\t\n\telse\n\t{\n\t\ti=0;\n\t\twhile(i\n#include \n\nint arr[7];\n\nint fn(int i,int j,int p,int q){\n\tint k,l;\n\tfor(k=0;k6){\n\t\tp++;\n\t\tnn/=7;\n\t}\n\twhile(mm>6){\n\t\tq++;\n\t\tmm/=7;\n\t}\n\tif(p+q>7)printf(\"0\\n\");\n\telse printf(\"%d\\n\",fn1(p,q,n,m));\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n#define NMAX 20\nchar hh[NMAX];\nchar mm[NMAX];\nint xh[9];\nshort int fl[8];\nint res;\nint h, m;\nint findans(int x, int ho, int mo)\n{\n\tint i, th, tm;\n\tif (x > ho + mo)\n\t{\n\t\tth = 0;\n\t\tfor (i = 0; i < ho; i++)\n\t\t{\n\t\t\tth = th * 7 + xh[i];\n\t\t}\n\t\ttm = 0;\n\t\tfor (i = ho; i < ho + mo; i++)\n\t\t{\n\t\t\ttm = tm * 7 + xh[i];\n\t\t}\n\t\tif (th < h&&tm < m) res += 1;\n\t}\n\telse\n\t{\n\t\tfor (i = 0; i < 7; i++)\n\t\t{\n\t\t\tif (fl[i] == 0)\n\t\t\t{\n\t\t\t\txh[x - 1] = i;\n\t\t\t\tfl[i] = 1;\n\t\t\t\tfindans(x + 1, ho, mo);\n\t\t\t\tfl[i] = 0;\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}\nint main()\n{\n\tint i, j, th, tm, d;\n\tint mo, ho;\n\tscanf(\"%d%d\", &h, &m);\n\tth = h - 1;\n\ttm = m - 1;\n\tmo = ho = 0;\n\twhile (tm > 0)\n\t{\n\t\tmm[mo] = tm % 7;\n\t\ttm = tm / 7;\n\t\tmo++;\n\t}\n\tif (mo == 0) mo = 1;\n\twhile (th > 0)\n\t{\n\t\thh[ho] = th % 7;\n\t\tho++;\n\t\tth = th / 7;\n\t}\n\tif (ho == 0) ho = 1;\n\tif (ho + mo > 7) printf(\"0\\n\");\n\telse\n\t{\n\t\tmemset(fl, 0, sizeof(fl));\n\t\tres = 0;\n\t\tfindans(1, ho, mo);\n\t\tprintf(\"%d\\n\", res);\n\t}\n\treturn 0;\n}"}, {"source_code": "#ifdef ONLINE_JUDGE\n #define NDEBUG 1\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#define long int64_t\n#define fore(i,k,n) for (int _k = (k), _n = (n), i = _k; i <= _n; ++i)\n#define forr(i,n,k) for (int _k = (k), _n = (n), i = _n; i >= _k; --i)\n#define LIST_INIT_CAP 4\n#define HASH_INIT_CAP 64\n#define HASH_SKIP 11\n#define TREE_INIT_CAP 1024\n#define TREE_MAX_HEIGHT 64\n#define DEQUE_INIT_CAP 1024\n#define HEAP_INIT_CAP 1024\n#define TAKEN 1\n#define EMPTY 0\n#define TOMB -1\n#define max(a,b) (((a)>(b))?(a):(b))\n#define min(a,b) (((a)<(b))?(a):(b))\n#define abs(x) (((x) < 0) ? -(x) : (x))\n#define N 1000001\n\nbool set[10] = { 0, 0, 0, 0, 0, 0, 0, 1, 1, 1 };\nint digits[20], tdigits[20];\nint limit[8] = { 0, 6, 65, 654, 6543, 65432, 654321, 6543210 };\n\nvoid addone(int idx) {\n ++tdigits[idx];\n if (tdigits[idx] > 9) {\n tdigits[idx] = 0;\n addone(idx - 1);\n }\n}\n\nint main() {\n int n, m;\n scanf(\"%d %d\", &n, &m);\n --n; --m;\n if (n == 0 && m == 0) {\n printf(\"0\");\n return 0;\n }\n int i = 20;\n while (m > 0) {\n digits[--i] = m % 7;\n m = m / 7;\n }\n int digm = 20 - i;\n if (digm == 0) {\n digm = 1;\n --i;\n }\n while (n > 0) {\n digits[--i] = n % 7;\n n = n / 7;\n }\n int dign = 20 - digm - i;\n if (dign == 0) dign = 1;\n int totdig = dign + digm;\n if (totdig > 7) {\n printf(\"0\");\n return 0;\n }\n int answer = 0;\n fore (j, 0, limit[totdig]) {\n bool nok = false, mok = false;\n fore (k, 20 - totdig, 20 - (digm + 1)) {\n if (set[tdigits[k]]) goto cont;\n else set[tdigits[k]] = true;\n if (!nok && tdigits[k] > digits[k]) goto cont;\n if (!nok && tdigits[k] < digits[k]) nok = true;\n }\n fore (k, 20 - digm, 19) {\n if (set[tdigits[k]]) goto cont;\n else set[tdigits[k]] = true;\n if (!mok && tdigits[k] > digits[k]) goto cont;\n if (!mok && tdigits[k] < digits[k]) mok = true;\n }\n ++answer;\ncont:\n addone(19);\n fore (k, 0, 6) set[k] = false;\n }\n\n printf(\"%d\", answer);\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint count(int n) {\n\treturn n < 7 ? 1 : count(n / 7) + 1;\n}\n\nint check(int *ii, int ncnt, int mcnt, int n, int m) {\n\tint i; \n\tlong long a, b;\n\n\ta = 0;\n\tfor (i = 0; i < ncnt; i++)\n\t\ta = 7LL * a + ii[i];\n\tb = 0;\n\tfor (i = 0; i < mcnt; i++)\n\t\tb = 7LL * b + ii[i + ncnt];\n\treturn a < n && b < m;\n}\n\nint main() {\n\tint n, m, cnt, ncnt, mcnt, dcnt;\n\tstatic int ii[7], used[7];\n\n\tscanf(\"%d%d\", &n, &m);\n\tncnt = count(n - 1);\n\tmcnt = count(m - 1);\n\tdcnt = ncnt + mcnt;\n\tcnt = 0;\n\tfor (ii[0] = 0; ii[0] < 7; ii[0]++) {\n\t\tif (used[ii[0]])\n\t\t\tcontinue;\n\t\tused[ii[0]] = 1;\n\t\tif (dcnt == 1 && check(ii, ncnt, mcnt, n, m))\n\t\t\tcnt++;\n\t\tfor (ii[1] = 0; ii[1] < 7; ii[1]++) {\n\t\t\tif (used[ii[1]])\n\t\t\t\tcontinue;\n\t\t\tused[ii[1]] = 1;\n\t\t\tif (dcnt == 2 && check(ii, ncnt, mcnt, n, m))\n\t\t\t\tcnt++;\n\t\t\tfor (ii[2] = 0; ii[2] < 7; ii[2]++) {\n\t\t\t\tif (used[ii[2]])\n\t\t\t\t\tcontinue;\n\t\t\t\tused[ii[2]] = 1;\n\t\t\t\tif (dcnt == 3 && check(ii, ncnt, mcnt, n, m))\n\t\t\t\t\tcnt++;\n\t\t\t\tfor (ii[3] = 0; ii[3] < 7; ii[3]++) {\n\t\t\t\t\tif (used[ii[3]])\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tused[ii[3]] = 1;\n\t\t\t\t\tif (dcnt == 4 && check(ii, ncnt, mcnt, n, m))\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\tfor (ii[4] = 0; ii[4] < 7; ii[4]++) {\n\t\t\t\t\t\tif (used[ii[4]])\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\tused[ii[4]] = 1;\n\t\t\t\t\t\tif (dcnt == 5 && check(ii, ncnt, mcnt, n, m))\n\t\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tfor (ii[5] = 0; ii[5] < 7; ii[5]++) {\n\t\t\t\t\t\t\tif (used[ii[5]])\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\tused[ii[5]] = 1;\n\t\t\t\t\t\t\tif (dcnt == 6 && check(ii, ncnt, mcnt, n, m))\n\t\t\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\t\tfor (ii[6] = 0; ii[6] < 7; ii[6]++) {\n\t\t\t\t\t\t\t\tif (used[ii[6]])\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\tused[ii[6]] = 1;\n\t\t\t\t\t\t\t\tif (dcnt == 7 && check(ii, ncnt, mcnt, n, m))\n\t\t\t\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\t\t\tused[ii[6]] = 0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tused[ii[5]] = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tused[ii[4]] = 0;\n\t\t\t\t\t}\n\t\t\t\t\tused[ii[3]] = 0;\n\t\t\t\t}\n\t\t\t\tused[ii[2]] = 0;\n\t\t\t}\n\t\t\tused[ii[1]] = 0;\n\t\t}\n\t\tused[ii[0]] = 0;\n\t}\n\tprintf(\"%d\\n\", cnt);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint count(int n) {\n\treturn n < 7 ? 1 : count(n / 7) + 1;\n}\n\nint power(int k) {\n\treturn k == 0 ? 1 : 7 * power(k - 1);\n}\n\nint valid(int n, int k) {\n\tint used[7] = { 0 };\n\n\twhile (k-- > 0) {\n\t\tint d = n % 7;\n\n\t\tif (used[d])\n\t\t\treturn 0;\n\t\tused[d] = 1;\n\t\tn /= 7;\n\t}\n\treturn 1;\n}\n\nint main() {\n\tint n, i, j, m, cnt, ncnt, mcnt, dcnt, p;\n\n\tscanf(\"%d%d\", &n, &m);\n\tncnt = count(n - 1);\n\tmcnt = count(m - 1);\n\tdcnt = ncnt + mcnt;\n\tp = power(mcnt);\n\tif (ncnt + mcnt > 7) {\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\tcnt = 0;\n\tfor (i = 0; i < n; i++)\n\t\tfor (j = 0; j < m; j++) {\n\t\t\tint x = i * p + j;\n\n\t\t\tif (valid(x, dcnt))\n\t\t\t\tcnt++;\n\t\t}\n\tprintf(\"%d\\n\", cnt);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\n\nconst int N = 24;\n\nint \ndec_num(int* d, int n){\n int rslt = d[0];\n int seven_plus = 7;\n for(int i = 1; i < n; i++){\n rslt += d[i] * seven_plus;\n seven_plus *=7;\n }\n return rslt;\n}\n\nint\nnext(int* d, int n, int h_limit){\n if( dec_num(d,n) >= h_limit - 1 ){\n return 0;\n }else{\n for(int i= 0; i< n; i++){\n if(d[i] < 6){\n d[i]++;\n break;\n }else{\n d[i]=0;\n }\n }\n }\n return 1;\n}\n\n\nint\nis_valid(int* d, int n){\n int flag[7];\n for(int i=0; i<7; i++) flag[i] =0;\n\n for(int i = 0; i < n; i++){\n int x = d[i];\n if(flag[x]){\n return 0;\n }else{\n flag[x]= 1;\n }\n }\n\n return 1;\n}\n\nint\nis_valid_2(int* d1, int* d2, int n1, int n2){\n\n for(int i = 0; i < n1; i++){\n for(int j = 0; j < n2; j++){\n if(d1[i]==d2[j]) return 0;\n }\n }\n\n// for(int i = 0; i < n1; i++){\n// printf(\"=%d \", d1[i]);\n// }\n// printf(\"\\n\");\n//\n// for(int i = 0; i < n2; i++){\n// printf(\"=%d \", d2[i]);\n// }\n// printf(\"\\n\");\n\n return 1;\n}\n\nint\nmain(){\n int hour[N];\n int minute[N];\n\n int n,m;\n scanf(\"%d %d\", &n, &m);\n\n int ndd = ceil(log(n) / log(7) );\n int ndm = ceil(log(m) / log(7) );\n\n if(ndd == 0) ndd++;\n if(ndm == 0) ndm++;\n\n //Debug\n //printf(\"--%d %d\\n\",ndd,ndm);\n //return 0;\n\n if(ndd+ndm>7){\n printf(\"%d\\n\",0);\n return 0;\n }\n\n //Now ndd and ndm are really small, I will use brute force.\n int count = 0;\n\n for(int i=0; i< ndd; i++) hour[i] = 0;\n\n //Debug\n //int d[] = {6,6,6,6,6};\n //int x = dec_num(d,5);\n //printf(\"?? %d\\n\",x);\n \n// do {\n// int x = dec_num(hour,ndd);\n// for(int i=0; i< ndm; i++) minute[i] = 0;\n// do {\n// int y = dec_num(minute,ndm);\n// printf(\">>%d %d\\n\", x,y);\n// }while( next(minute,ndm, m) );\n// }while( next(hour,ndd,n) );\n\n do{\n if( is_valid(hour,ndd) ){\n for(int i=0; i< ndm; i++) minute[i] = 0;\n do{\n if( is_valid(minute,ndm) ){\n if( is_valid_2(hour,minute, ndd,ndm) ){\n count++;\n// int x, y;\n// x = dec_num(hour,ndd);\n// y = dec_num(minute,ndm);\n// printf(\"--%d %d\\n\", x,y);\n }\n }\n }while( next(minute,ndm, m) );\n }\n }while( next(hour,ndd,n) );\n\n printf(\"%d\\n\",count);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\n\nconst int N = 24;\n\nint \ndec_num(int* d, int n){\n int rslt = d[0];\n int seven_plus = 7;\n for(int i = 1; i < n; i++){\n rslt += d[i] * seven_plus;\n seven_plus *=7;\n }\n return rslt;\n}\n\nint\nnext(int* d, int n, int h_limit){\n if( dec_num(d,n) >= h_limit - 1 ){\n return 0;\n }else{\n for(int i= 0; i< n; i++){\n if(d[i] < 6){\n d[i]++;\n break;\n }else{\n d[i]=0;\n }\n }\n }\n return 1;\n}\n\n\nint\nis_valid(int* d, int n){\n int flag[7];\n for(int i=0; i<7; i++) flag[i] =0;\n\n for(int i = 0; i < n; i++){\n int x = d[i];\n if(flag[x]){\n return 0;\n }else{\n flag[x]= 1;\n }\n }\n\n return 1;\n}\n\nint\nis_valid_2(int* d1, int* d2, int n1, int n2){\n\n for(int i = 0; i < n1; i++){\n for(int j = 0; j < n2; j++){\n if(d1[i]==d2[j]) return 0;\n }\n }\n\n// for(int i = 0; i < n1; i++){\n// printf(\"=%d \", d1[i]);\n// }\n// printf(\"\\n\");\n//\n// for(int i = 0; i < n2; i++){\n// printf(\"=%d \", d2[i]);\n// }\n// printf(\"\\n\");\n\n return 1;\n}\n\nint\nmain(){\n int hour[N];\n int minute[N];\n\n int n,m;\n scanf(\"%d %d\", &n, &m);\n\n int ndd=1;\n int seven = 7;\n int rslt=7;\n while(rslt<=n-1){\n rslt +=6*seven;\n seven *=7;\n ndd++;\n }\n\n int ndm=1;\n seven = 7;\n rslt=7;\n while(rslt<=m-1){\n rslt +=6*seven;\n seven *=7;\n ndm++;\n }\n\n //Debug\n// printf(\"--%d %d\\n\",ndd,ndm);\n //return 0;\n\n if(ndd+ndm>7){\n printf(\"%d\\n\",0);\n return 0;\n }\n\n //Now ndd and ndm are really small, I will use brute force.\n int count = 0;\n\n for(int i=0; i< ndd; i++) hour[i] = 0;\n\n //Debug\n //int d[] = {6,6,6,6,6};\n //int x = dec_num(d,5);\n //printf(\"?? %d\\n\",x);\n \n// do {\n// int x = dec_num(hour,ndd);\n// for(int i=0; i< ndm; i++) minute[i] = 0;\n// do {\n// int y = dec_num(minute,ndm);\n// printf(\">>%d %d\\n\", x,y);\n// }while( next(minute,ndm, m) );\n// }while( next(hour,ndd,n) );\n\n do{\n if( is_valid(hour,ndd) ){\n for(int i=0; i< ndm; i++) minute[i] = 0;\n do{\n if( is_valid(minute,ndm) ){\n if( is_valid_2(hour,minute, ndd,ndm) ){\n count++;\n// int x, y;\n// x = dec_num(hour,ndd);\n// y = dec_num(minute,ndm);\n// printf(\"--%d %d\\n\", x,y);\n }\n }\n }while( next(minute,ndm, m) );\n }\n }while( next(hour,ndd,n) );\n\n printf(\"%d\\n\",count);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\n\nconst int N = 24;\n\nint \ndec_num(int* d, int n){\n int rslt = d[0];\n int seven_plus = 7;\n for(int i = 1; i < n; i++){\n rslt += d[i] * seven_plus;\n seven_plus *=7;\n }\n return rslt;\n}\n\nint\nnext(int* d, int n, int h_limit){\n if( dec_num(d,n) >= h_limit - 1 ){\n return 0;\n }else{\n for(int i= 0; i< n; i++){\n if(d[i] < 6){\n d[i]++;\n break;\n }else{\n d[i]=0;\n }\n }\n }\n return 1;\n}\n\n\nint\nis_valid(int* d, int n){\n int flag[7];\n for(int i=0; i<7; i++) flag[i] =0;\n\n for(int i = 0; i < n; i++){\n int x = d[i];\n if(flag[x]){\n return 0;\n }else{\n flag[x]= 1;\n }\n }\n\n return 1;\n}\n\nint\nis_valid_2(int* d1, int* d2, int n1, int n2){\n\n for(int i = 0; i < n1; i++){\n for(int j = 0; j < n2; j++){\n if(d1[i]==d2[j]) return 0;\n }\n }\n\n// for(int i = 0; i < n1; i++){\n// printf(\"=%d \", d1[i]);\n// }\n// printf(\"\\n\");\n//\n// for(int i = 0; i < n2; i++){\n// printf(\"=%d \", d2[i]);\n// }\n// printf(\"\\n\");\n\n return 1;\n}\n\nint\nmain(){\n int hour[N];\n int minute[N];\n\n int n,m;\n scanf(\"%d %d\", &n, &m);\n\n int ndd=1;\n int seven = 7;\n int rslt=7;\n while(rslt<=n-1){\n rslt +=6*seven;\n seven *=7;\n ndd++;\n }\n\n int ndm=1;\n seven = 7;\n rslt=7;\n while(rslt<=m-1){\n rslt +=6*seven;\n seven *=7;\n ndm++;\n }\n\n //Debug\n// printf(\"--%d %d\\n\",ndd,ndm);\n //return 0;\n\n if(ndd+ndm>7){\n printf(\"%d\\n\",0);\n return 0;\n }\n\n //Now ndd and ndm are really small, I will use brute force.\n int count = 0;\n\n for(int i=0; i< ndd; i++) hour[i] = 0;\n\n //Debug\n //int d[] = {6,6,6,6,6};\n //int x = dec_num(d,5);\n //printf(\"?? %d\\n\",x);\n \n// do {\n// int x = dec_num(hour,ndd);\n// for(int i=0; i< ndm; i++) minute[i] = 0;\n// do {\n// int y = dec_num(minute,ndm);\n// printf(\">>%d %d\\n\", x,y);\n// }while( next(minute,ndm, m) );\n// }while( next(hour,ndd,n) );\n\n do{\n if( is_valid(hour,ndd) ){\n for(int i=0; i< ndm; i++) minute[i] = 0;\n do{\n if( is_valid(minute,ndm) ){\n if( is_valid_2(hour,minute, ndd,ndm) ){\n count++;\n// int x, y;\n// x = dec_num(hour,ndd);\n// y = dec_num(minute,ndm);\n// printf(\"--%d %d\\n\", x,y);\n }\n }\n }while( next(minute,ndm, m) );\n }\n }while( next(hour,ndd,n) );\n\n printf(\"%d\\n\",count);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nchar visited[2][2][25][1025];\nlong long dp[2][2][25][1025];\nint len[2], ar[2][25], temp[25];\n\nvoid convert(int idx, int v){\n int i, j, k, d = 0;\n for (; ;){\n temp[d++] = (v % 7);\n v /= 7;\n if (!v) break;\n }\n\n len[idx] = 0;\n for (i = d - 1; i >= 0; i--) ar[idx][len[idx]++] = temp[i];\n}\n\nlong long F(int idx, int flag, int i, int mask){\n if (i == len[idx]){\n if (idx == 0) return F(1, 0, 0, mask);\n else return 1;\n }\n if (visited[idx][flag][i][mask]) return dp[idx][flag][i][mask];\n\n int j, lim = 6;\n long long res = 0;\n if (!flag) lim = ar[idx][i];\n for (j = 0; j <= lim; j++){\n if (!(mask & (1 << j))) res += F(idx, flag || (j < lim), i + 1, mask | (1 << j));\n }\n\n visited[idx][flag][i][mask] = 1;\n return (dp[idx][flag][i][mask] = res);\n}\n\nint main(){\n int n, m, i, j, k;\n\n while (scanf(\"%d %d\", &n, &m) != EOF){\n n--, m--;\n convert(0, n);\n convert(1, m);\n clr(visited);\n long long res = F(0, 0, 0, 0);\n printf(\"%lld\\n\", res);\n }\n return 0;\n}"}, {"source_code": "#include \n#include \n#include \n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nchar visited[2][2][25][1025];\nlong long dp[2][2][25][1025];\nint len[2], ar[2][25], temp[25];\n\nvoid convert(int idx, int v){\n int i, j, k, d = 0;\n for (; ;){\n temp[d++] = (v % 7);\n v /= 7;\n if (!v) break;\n }\n\n len[idx] = 0;\n for (i = d - 1; i >= 0; i--) ar[idx][len[idx]++] = temp[i];\n}\n\nlong long F(int idx, int flag, int i, int mask){\n if (i == len[idx]){\n if (idx == 0) return F(1, 0, 0, mask);\n else return 1;\n }\n if (visited[idx][flag][i][mask]) return dp[idx][flag][i][mask];\n\n int j, lim = 6;\n long long res = 0;\n if (!flag) lim = ar[idx][i];\n for (j = 0; j <= lim; j++){\n if (!(mask & (1 << j))) res += F(idx, flag || (j < lim), i + 1, mask | (1 << j));\n }\n\n visited[idx][flag][i][mask] = 1;\n return (dp[idx][flag][i][mask] = res);\n}\n\nint main(){\n int n, m, i, j, k;\n\n while (scanf(\"%d %d\", &n, &m) != EOF){\n n--, m--;\n convert(0, n);\n convert(1, m);\n clr(visited);\n long long res = F(0, 0, 0, 0);\n printf(\"%lld\\n\", res);\n }\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include \n\nlong long n, m, pow[11], nn = 0, mm = 0, res = 0, leng;\nint a[7],x[8], res1 = 0, res2 = 0;\n\n\n\nvoid kiemtra()\n{\n int j, i = 1;\n long long h = 0;\n for (i = 1; i <= res1; i++)\n {\n h = h * 10 + x[i];\n }\n if (h >= nn) return;\n\n h = 0;\n for (i = res1 + 1; i <= leng; i++)\n {\n h = h * 10 + x[i];\n }\n if (h >= mm) return;\n res++;\n}\n\n\nvoid xuli(int i)\n{\n int j;\n for (j = 0; j < 7; j++)\n if (a[j] == 0)\n {\n x[i] = j;\n a[j] = 1;\n if (i == leng) kiemtra();\n else\n xuli(i+1);\n a[j] = 0;\n }\n}\n\n\nvoid sol()\n{\n int x, i;\n for (i = 10; i >= 0; i--)\n {\n nn = nn * 10 + n / pow[i];\n if (n / pow[i] > 0)\n {\n x = n / pow[i];\n n -= x * pow[i];\n if (res1 == 0)\n {\n res1 = i+1;\n }\n }\n }\n for (i = 10; i >= 0; i--)\n {\n mm = mm * 10 + m / pow[i];\n if (m / pow[i] > 0)\n {\n x = m / pow[i];\n m -= x * pow[i];\n if (res2 == 0)\n {\n res2 = i+1;\n }\n }\n }\n leng = res1 + res2;\n if (res1 + res2 > 7) return;\n else\n xuli(1);\n}\n\n\n\nint main()\n{\n int i, j;\n scanf(\"%I64d %I64d\", &n, &m);\n for (j = 0; j < 7; j++)\n a[j] = 0;\n pow[0] = 1;\n for (i = 1; i < 11; i++)\n pow[i] = pow[i-1] * 7;\n sol();\n printf(\"%d\", res);\n return 0;\n}\n"}, {"source_code": "#include \n\nlong long n, m, pow[11], nn = 0, mm = 0, res = 0, leng;\nint a[7],x[8], res1 = 0, res2 = 0;\n\n\n\nvoid kiemtra()\n{\n int j, i = 1;\n long long h = 0;\n for (i = 1; i <= res1; i++)\n {\n h = h * 10 + x[i];\n }\n if (h > nn) return;\n\n h = 0;\n for (i = res1 + 1; i <= leng; i++)\n {\n h = h * 10 + x[i];\n }\n if (h > mm) return;\n res++;\n}\n\n\nvoid xuli(int i)\n{\n int j;\n for (j = 0; j < 7; j++)\n if (a[j] == 0)\n {\n x[i] = j;\n a[j] = 1;\n if (i == leng) kiemtra();\n else\n xuli(i+1);\n a[j] = 0;\n }\n}\n\n\nvoid sol()\n{\n int x, i;\n for (i = 10; i >= 0; i--)\n {\n nn = nn * 10 + n / pow[i];\n if (n / pow[i] > 0)\n {\n x = n / pow[i];\n n -= x * pow[i];\n if (res1 == 0)\n {\n res1 = i+1;\n }\n }\n }\n for (i = 10; i >= 0; i--)\n {\n mm = mm * 10 + m / pow[i];\n if (m / pow[i] > 0)\n {\n x = m / pow[i];\n m -= x * pow[i];\n if (res2 == 0)\n {\n res2 = i+1;\n }\n }\n }\n leng = res1 + res2;\n xuli(1);\n}\n\n\n\nint main()\n{\n int i, j;\n scanf(\"%I64d %I64d\", &n, &m);\n n--; m--;\n for (j = 0; j < 7; j++)\n a[j] = 0;\n pow[0] = 1;\n for (i = 1; i < 11; i++)\n pow[i] = pow[i-1] * 7;\n sol();\n printf(\"%d\", res);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n#include\n#define MAXN 13\nlong long a[MAXN],b[MAXN],m,n,ans=0; \nlong long s1[MAXN],s2[MAXN];\nvoid find(long long x,long long y,long long add)\n{\n\tlong long i,j,S;\n\tif(add>y){\n\t\tans++;\n\t\treturn;\n\t}\n\tfor(i=0;i<=6;i++){\n\t\tfor(j=1;j=m)\n\t\t\tgoto end1;\n\t\tb[add]=i;\n\t\tfind(x,y,add+1);\n\t\tend1:;\n\t}\n}\nvoid dfs(long long x,long long y,long long add)\n{\n\tlong long i,j,S;\n\tif(add>x){\n\t\tfind(x,y,1);\n\t\treturn;\n\t}\n\tfor(i=0;i<=6;i++){\n\t\tfor(j=1;j=n)\n\t\t\tgoto end;\n\t\ta[add]=i;\n\t\tdfs(x,y,add+1);\n\t\tend:;\n\t}\n} \nint main()\n{\n\tlong long k,i,j,l,c,p,q,c1=0,c2=0;\n\tscanf(\"%I64d%I64d\",&n,&m);\n\tp=n-1;q=m-1;\n\twhile(p>0){\n\t\tp=p/7;\n\t\tc1++;\n\t}\n\twhile(q>0){\n\t\tq=q/7;\n\t\tc2++;\n\t}\n\tif(c1+c2>7){\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\tdfs(c1,c2,1);\n\tprintf(\"%I64d\",ans);\n\treturn 0;\n}\n\n"}, {"source_code": "#include \n#include \n#include \n#include\n#define MAXN 13\nlong long a[MAXN],b[MAXN],m,n,ans,count; \nlong long s1[MAXN],s2[MAXN];\nvoid find(long long x,long long y,long long add)\n{\n\tlong long i,j,S;\n\tif(add>y){\n\t\tans++;\n\t\treturn;\n\t}\n\tfor(i=0;i<=6;i++){\n\t\tfor(j=1;j=m)\n\t\t\tgoto end1;\n\t\tb[add]=i;\n\t\tfind(x,y,add+1);\n\t\tend1:;\n\t}\n}\nvoid dfs(long long x,long long y,long long add)\n{\n\tlong long i,j,S;\n\tif(add>x){\n\t\tfind(x,y,1);\n\t\treturn;\n\t}\n\tfor(i=0;i<=6;i++){\n\t\tfor(j=1;j=n)\n\t\t\tgoto end;\n\t\ta[add]=i;\n\t\tdfs(x,y,add+1);\n\t\tend:;\n\t}\n} \nint main()\n{\n\tlong long k,i,j,l,c,p,q,c1=0,c2=0;\n\tscanf(\"%I64d%I64d\",&n,&m);\n\tp=n;q=m;\n\twhile(p>0){\n\t\tp=p/7;\n\t\tc1++;\n\t}\t\n\twhile(q>0){\n\t\tq=q/7;\n\t\tc2++;\n\t}\n\tdfs(c1,c2,1);\n\tprintf(\"%I64d\",ans);\n\treturn 0;\n}\n\n"}, {"source_code": "#include \n#include \n#include \n#include\n#define MAXN 11\nlong long a[MAXN],b[MAXN],m,n,ans,count; \nlong long s1[MAXN],s2[MAXN];\nvoid find(long long x,long long y,long long add)\n{\n\tlong long i,j,S;\n\tif(add>y){\n\t\tcount++;\n\n\t\treturn;\n\t}\n\tfor(i=0;i<=6;i++){\n\t\tfor(j=1;j=m)\n\t\t\tgoto end1;\n\t\tb[add]=i;\n\t\tfind(x,y,add+1);\n\t\tend1:;\n\t}\n}\nvoid dfs(long long x,long long y,long long add)\n{\n\tlong long i,j,S;\n\tif(add>x){\n\t\tcount=0;\n\t\tfind(x,y,1);\n\t\tans+=count;\n\t\treturn;\n\t}\n\tfor(i=0;i<=6;i++){\n\t\tfor(j=1;j=n)\n\t\t\tgoto end;\n\t\ta[add]=i;\n\t\tdfs(x,y,add+1);\n\t\tend:;\n\t}\n} \n\n\n\nint main()\n{\n\tlong long k,i,j,l,c,p,q,c1=0,c2=0;\n\tscanf(\"%I64d%I64d\",&n,&m);\n\tp=n;q=m;\n\twhile(p>0){\n\t\tp=p/7;\n\t\tc1++;\n\t}\t\n\twhile(q>0){\n\t\tq=q/7;\n\t\tc2++;\n\t}\n\tif(c1+c2>9){\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\tdfs(c1,c2,1);\n\tprintf(\"%I64d\",ans);\n\treturn 0;\n}\n\n"}, {"source_code": "#include \n#include \n#include \n#include\n#define MAXN 13\nlong long a[MAXN],b[MAXN],m,n,ans=0; \nlong long s1[MAXN],s2[MAXN];\nvoid find(long long x,long long y,long long add)\n{\n\tlong long i,j,S;\n\tif(add>y){\n\t\tans++;\n\t\treturn;\n\t}\n\tfor(i=0;i<=6;i++){\n\t\tfor(j=1;j=m)\n\t\t\tgoto end1;\n\t\tb[add]=i;\n\t\tfind(x,y,add+1);\n\t\tend1:;\n\t}\n}\nvoid dfs(long long x,long long y,long long add)\n{\n\tlong long i,j,S;\n\tif(add>x){\n\t\tfind(x,y,1);\n\t\treturn;\n\t}\n\tfor(i=0;i<=6;i++){\n\t\tfor(j=1;j=n)\n\t\t\tgoto end;\n\t\ta[add]=i;\n\t\tdfs(x,y,add+1);\n\t\tend:;\n\t}\n} \nint main()\n{\n\tlong long k,i,j,l,c,p,q,c1=0,c2=0;\n\tscanf(\"%I64d%I64d\",&n,&m);\n\tp=n-1;q=m-1;\n\twhile(p>0){\n\t\tp=p/7;\n\t\tc1++;\n\t}\n\twhile(q>0){\n\t\tq=q/7;\n\t\tc2++;\n\t}\n\tif(c1<1)\n\tc2++;\n\tif(c2<1)\n\t\tc2++;\n\tif(c1+c2>7){\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\tdfs(c1,c2,1);\n\tprintf(\"%I64d\",ans);\n\treturn 0;\n}\n\n"}, {"source_code": "#include \n#include \n#include \n#include\n#define MAXN 10\nlong long a[MAXN],b[MAXN],m,n,ans,count; \nlong long s1[MAXN],s2[MAXN];\nvoid find(long long x,long long y,long long add)\n{\n\tlong long i,j,S;\n\tif(add>y){\n\t\tcount++;\n\t\t\n\t\treturn;\n\t}\n\tfor(i=0;i<=6;i++){\n\t\tfor(j=1;j=m)\n\t\t\tgoto end1;\n\t\tb[add]=i;\n\t\tfind(x,y,add+1);\n\t\tend1:;\n\t}\n}\nvoid dfs(long long x,long long y,long long add)\n{\n\tlong long i,j,S;\n\tif(add>x){\n\t\tcount=0;\n\t\tfind(x,y,1);\n\t\tans+=count;\n\t\treturn;\n\t}\n\tfor(i=0;i<=6;i++){\n\t\tfor(j=1;j=n)\n\t\t\tgoto end;\n\t\ta[add]=i;\n\t\tdfs(x,y,add+1);\n\t\tend:;\n\t}\n} \n\n\n\nint main()\n{\n\tlong long k,i,j,l,c,p,q,c1=0,c2=0;\n\tscanf(\"%I64d%I64d\",&n,&m);\n\tp=n;q=m;\n\twhile(p>0){\n\t\tp=p/7;\n\t\tc1++;\n\t}\t\n\twhile(q>0){\n\t\tq=q/7;\n\t\tc2++;\n\t}\n\tif(c1+c2>7){\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\tdfs(c1,c2,1);\n\tprintf(\"%I64d\",ans);\n\treturn 0;\n}\n\n"}, {"source_code": "#include\n#include\n#include\n#include\n#include\n#include\nint cmp[250];\nint cnt[10];\nint cmp1[250];\nint calc(int a){\n\tint cntx=0;\n\twhile(a){\n\t\ta/=7;\n\t\tcntx++;\n\t}\n\treturn cntx;\n}\nint insert(int x,int fix[]){\n\tif(x==0){\n\t\tfix[0]=0;\n\t\treturn 1;\n\t}\n\tint i,k; i=k=0;\n\twhile(x){\n\t\tfix[i++]=x%7;\n\t\tx/=7;\n\t}\n\tfor(k=0;k1)\n\t\treturn 0;\n\t}\n\treturn 1;\n}\nint main(){\n\tint a,b,c,d,e,f,g,h;\n\tscanf(\"%d%d\",&a,&b);\n\tint t = calc(a-1); int t1=calc(b-1);\n\tif(t+t1>7){\n\t\treturn 0;\n\t}\n\tint i; int cnt=0;\n\tfor(i=0;i\n#include\n#include\n#include\n#include\n#include\nint cmp[250];\nint cnt[10];\nint cmp1[250];\nint calc(int a){\n\tint cntx=0;\n\twhile(a){\n\t\ta/=7;\n\t\tcntx++;\n\t}\n\treturn cntx;\n}\nint insert(int x,int fix[]){\n\tif(x==0){\n\t\tfix[0]=0;\n\t\treturn 1;\n\t}\n\tint i,k; i=k=0;\n\twhile(x){\n\t\tfix[i++]=x%7;\n\t\tx/=7;\n\t}\n\tfor(k=0;k1)\n\t\treturn 0;\n\t}\n\treturn 1;\n}\nint main(){\n\tint a,b,c,d,e,f,g,h;\n\tscanf(\"%d%d\",&a,&b);\n\tint t = calc(a-1); int t1=calc(b-1);\n\tif(t+t1>7){\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\tint i; int cnt=0;\n\tfor(i=0;i\n#include\n#include\n#include\n#include\n#include\nchar cmp[250];\nint cnt[10];\nchar cmp1[250];\nvoid re_use(char temp[],int t){\n\tchar new_arr[250];\n\tint len = strlen(temp); int i;\n\tfor(i=0;i1)\n\t\t\treturn 0;\n\t}\n\treturn 1;\n}\nint main(){\n\tint a,b,c,d,e,f,g,h;\n\tscanf(\"%d%d\",&a,&b);\n\tint t = calc(a); int t1=calc(b);\n\tif(t+t1>7){\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\tint i; int cnt=0;\n\tfor(i=0;i\n#include\n#include\n#include\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 }\n void 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\n void 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{\nif(root==NULL)\n{\nroot=(node *)malloc(sizeof(node));\nroot->val=x;\n}\nelse\n{\nif(x<=root->val)\n{\nif(root->l==NULL)\n{\nroot->l=(node *)malloc(sizeof(node));\nroot->l->val=x;\n}\nelse\nroot->l=insert(x,root->l);\n}\nelse\n{\nif(root->r==NULL)\n{\nroot->r=(node *)malloc(sizeof(node));\nroot->r->val=x;\n}\nelse\n{\nroot->r=insert(x,root->r);\n}\n}\n}\nreturn root;\n}\nnode *find(int x,node *root)\n{\nif(root==NULL)\n{\nreturn 0;\n}\nelse\n{\nif(x==root->val)\nreturn root;\nelse if(xval)\n{\nif(root->l==NULL)\n{\nreturn 0;\n}\nelse\n{\nfind(x,root->l);\n}\n}\nelse\n{\nif(root->r==NULL)\n{\nreturn 0;\n}\nelse\n{\nfind(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{\nif(ar[a]==NULL)\n{\nar[a]=(nd *)malloc(sizeof(nd));\nar[a]->val=b;\nar[a]->next=NULL;\n}\nelse\n{\nnd *temp=(nd *)malloc(sizeof(nd)),*t;\ntemp->val=b;\ntemp->next=ar[a];\nar[a]=temp;\n}\n}\n\n//dfs\n//int state[100001];\nvoid dfs(int a)\n{\nstate[a]=1;\ncount++;\nnd *temp=ar[a];\nwhile(temp!=NULL)\n{\nif(state[temp->val]!=1)\ndfs(temp->val);\ntemp=temp->next;\n}\nreturn;\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 if(ar[a]==NULL)\n {\n ar[a]=(node *)malloc(sizeof(node));\n ar[a]->val=b;\n ar[a]->weight=w;\n ar[a]->next=NULL;\n }\n else\n {\n node *temp=(node *)malloc(sizeof(node)),*t;\n temp->val=b;\n temp->weight=w;\n temp->next=ar[a];\n ar[a]=temp;\n }\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\n void 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\n int 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*xval;\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 int n,m,u,v,w,i;\n scanf(\"%d%d\",&n,&m);\n for(i=0;i<=n;i++)\n state[i]=0;\n while(m--)\n {\n scanf(\"%d%d%d\",&u,&v,&w);\n insert(u,v,w);\n }\n scanf(\"%d%d\",&u,&v);\n ptr=1;\n hinsert(0,u);\n d[u]=0;\n for(i=1;i<=n;i++)\n {\n if(i!=u)\n {\n hinsert(1000000000,i);\n d[i]=1000000000;\n }\n }\n dikstra(u,v);\n if(d[v]==1000000000)\n printf(\"NO\\n\");\n else\n printf(\"%d\\n\",d[v]);\n return 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\n void Union(int a,int b)\n {\n if(a==b)\n return;\n dsu[a] = b;\n }\n\n typedef 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 return ((edge*)a)->weight - ((edge*)b)->weight;\n }*/\n/*int main()\n {\n int i;\n int n,m;\n scanf(\"%d %d\\n\",&n,&m);\n for(i=0;ib)\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,m,ct,ans=0;\n scan(n);\n scan(m);\n int i,j,k,val=0;\n int dig1,dig2;\n val=n/7;\n dig1=1;\n dig2=1;\n while(val>0)\n {\n dig1++;\n val=val/7;\n }\n \n val=m/7;\n while(val>0)\n {\n dig2++;\n val=val/7;\n }\n val=dig1+dig2;\n if(val>7)\n {\n ans=0;\n print(ans);\n return 0;\n }\n int status[10],st2[10],cond=0;\n for(i=0;i0)\n {\n ct1++;\n if(status[i%7]==1)\n {\n cond=1;\n break;\n }\n else\n status[i%7]=1;\n\n i=i/7;\n }\n if(ct10)\n {\n ct2++;\n // printf(\"--%d\\n\",j%7);\n if(st2[j%7]==1)\n {\n cond=1;\n j=save2;\n break;\n }\n else\n st2[j%7]=1;\n\n j=j/7;\n }\n if(ct2%d \",st2[k]);\n // printf(\"\\n\");\n// print(cond);\n if(cond==0)\n {\n// printf(\"%d:%d\\n\",save,save2);\n ans++;\n }\n j=save2;\n }\n i=save;\n }\n print(ans);\n return 0;\n}\n\n\n\n"}, {"source_code": "#include\n#include\nint dgt(int a)\n{\n double r=log(a)/log(7);\n int c=r+1;\n return c;\n}\nint ys(int m, int n, int a, int b)\n{\n int fr[7]={0,0,0,0,0,0,0},i;\n //printf(\"%d-%d: \",m,n);\n for(i=0;i1){\n //printf(\"0\\n\");\n return 0;\n }\n m=m/7;\n }\n for(i=0;i1){\n //printf(\"0\\n\");\n return 0;\n }\n n=n/7;\n }\n //printf(\"1\\n\");\n return 1;\n}\nint get(int m, int n)\n{\n int d1,d2,i,j,rs=0;\n d1=dgt(m);\n d2=dgt(n);\n if(d1+d2>7)\n return 0;\n for(i=0;i\n#include\nint dgt(int a)\n{\n double r=log(a)/log(7);\n int c=r;\n return (r==c)? c: c+1;\n}\nint ys(int m, int n, int a, int b)\n{\n\n int fr[7]={0,0,0,0,0,0,0},i;\n for(i=0;i1){\n\n return 0;\n }\n m=m/7;\n }\n for(i=0;i1){\n\n return 0;\n }\n n=n/7;\n }\n\n return 1;\n}\nint get(int m, int n)\n{\n int d1,d2,i,j,rs=0;\n d1=dgt(m);d2=dgt(n);\n if(d1+d2>7)\n return 0;\n for(i=0;i\n#include\nint dgt(int a)\n{\n double r;\n int c=1;\n if(a>1){ r=log(a-1)/log(7);\n c=r+1;\n }\n return c;\n}\nint ys(int m, int n, int a, int b)\n{\n int fr[7]={0,0,0,0,0,0,0},i;\n //printf(\"%d-%d: \",m,n);\n for(i=0;i1){\n //printf(\"0\\n\");\n return 0;\n }\n m=m/7;\n }\n for(i=0;i1){\n //printf(\"0\\n\");\n return 0;\n }\n n=n/7;\n }\n //printf(\"1\\n\");\n return 1;\n}\nint get(int m, int n)\n{\n int d1,d2,i,j,rs=0;\n d1=dgt(m);\n d2=dgt(n);\n //printf(\"D=%d,%d\\n\",d1,d2);\n if(d1+d2>7)\n return 0;\n for(i=0;i\n#include\nint dgt(int a)\n{\n double r=log(a)/log(7);\n int c=r+1;\n return c;\n}\nint ys(int m, int n, int a, int b)\n{\n\n int fr[7]={0,0,0,0,0,0,0},i;\n for(i=0;i1){\n\n return 0;\n }\n m=m/7;\n }\n for(i=0;i1){\n\n return 0;\n }\n n=n/7;\n }\n\n return 1;\n}\nint get(int m, int n)\n{\n int d1,d2,i,j,rs=0;\n d1=dgt(m);d2=dgt(n);\n if(d1+d2>7)\n return 0;\n for(i=0;i\n#include\nint dgt(int a)\n{\n double r;\n int c=1;\n if(a>1){ r=log(a-1)/log(7);\n c=r+1;\n }\n return c;\n}\nint ys(int m, int n, int a, int b)\n{\n int fr[7]={0,0,0,0,0,0,0},i;\n //printf(\"%d-%d: \",m,n);\n for(i=0;i1){\n //printf(\"0\\n\");\n return 0;\n }\n m=m/7;\n }\n for(i=0;i1){\n //printf(\"0\\n\");\n return 0;\n }\n n=n/7;\n }\n //printf(\"1\\n\");\n return 1;\n}\nint get(int m, int n)\n{\n int d1,d2,i,j,rs=0;\n d1=dgt(m);\n d2=dgt(n);\n if(d1+d2>7)\n return 0;\n for(i=0;i\n#include\nint dgt(int a)\n{\n double r=log(a)/log(7);\n int c=r+1;\n return c;\n}\nint ys(int m, int n, int a, int b)\n{\n int fr[7]={0,0,0,0,0,0,0},i;\n //printf(\"%d-%d: \",m,n);\n for(i=0;i1){\n // printf(\"0-1\\n\");\n return 0;\n }\n m=m/7;\n }\n for(i=0;i1){\n // printf(\"0-2\\n\");\n return 0;\n }\n n=n/7;\n }\n //printf(\"1\\n\");\n return 1;\n}\nint get(int m, int n)\n{\n int d1,d2,i,j,rs=0;\n d1=dgt(m-1);\n if(d1<1)\n d1=1;\n d2=dgt(n-1);\n if(d2<1)\n d2=1;\n //printf(\"%d %d\\n\",d1,d2);\n if(d1+d2>7)\n return 0;\n for(i=0;i\n\nint n, m;\nint dign, digm;\nint res;\n\nint dig(int k) {\n int ans=0;\n while(k>0) {\n k/=7;\n ans++;\n }\n return ans;\n}\n\nint chk(int h, int m) {\n int visit[7];\n for(int i=0;i<7;i++) visit[i]=0;\n for(int i=0;i1) return 0;\n }\n return 1;\n}\n\nint main() {\n int tmp;\n scanf(\"%d %d\", &n, &m);\n dign=dig(n), digm=dig(m);\n if(dign+digm>7) puts(\"0\");\n else {\n for(int i=0;i\n\nint n, m;\nint dign, digm;\nint res;\n\nint dig(int k) {\n int ans=0;\n while(k>0) {\n k/=7;\n ans++;\n }\n return ans;\n}\n\nint chk(int h, int m) {\n int visit[7];\n for(int i=0;i<7;i++) visit[i]=0;\n for(int i=0;i1) return 0;\n }\n return 1;\n}\n\nint main() {\n int tmp;\n scanf(\"%d %d\", &n, &m);\n dign=dig(n-1), digm=dig(m-1);\n if(dign+digm>7) puts(\"0\");\n else {\n for(int i=0;i\n#include \n\nint main() {\n\tint n, m, d;\n\tscanf(\"%d%d\", &n, &m);\n\tint dn = 1, dm = 1;\n\tfor(int k = 7 ; k <= n ; k *= 7) dn++;\n\tfor(int k = 7 ; k <= m ; k *= 7) dm++;\t\n\td = dn + dm;\n\tif(d > 7) {\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\tint r = 0;\n\tfor(int i=0 ; i 1) {\n\t\t\t\t\tr--;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\\n\", r);\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\nint arr[7];\n\nint fn(int i,int j,int p,int q){\n\tint k,l;\n\tfor(k=0;k6){\n\t\tp++;\n\t\tnn/=7;\n\t}\n\twhile(mm>6){\n\t\tq++;\n\t\tmm/=7;\n\t}\n\tif(p+q>7)printf(\"0\\n\");\n\telse printf(\"%d\\n\",fn1(p,q,n,m));\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint fn(int i,int j,int p,int q){\n\tint k,l,arr[8];\n\tfor(k=0;k6){\n\t\tp++;\n\t\tnn/=7;\n\t}\n\twhile(mm>6){\n\t\tq++;\n\t\tmm/=7;\n\t}\n\tif(p+q>7)printf(\"0\\n\");\n\telse printf(\"%d\\n\",fn1(p,q,n,m));\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n\nint fn(int i,int j,int p,int q,int n,int m){\n\tint k,l,arr[7];\n\tfor(k=0;k7)printf(\"0\\n\");\n\telse printf(\"%d\\n\",fn1(p,q,n,m));\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n#define NMAX 20\nchar hh[NMAX];\nchar mm[NMAX];\nint xh[9];\nshort int fl[8];\nint res;\nint h, m;\nint findans(int x, int ho, int mo)\n{\n\tint i, th, tm;\n\tif (x > ho + mo)\n\t{\n\t\tth = 0;\n\t\tfor (i = 0; i < ho; i++)\n\t\t{\n\t\t\tth = th * 7 + xh[i];\n\t\t}\n\t\ttm = 0;\n\t\tfor (i = ho; i < ho + mo; i++)\n\t\t{\n\t\t\ttm = tm * 7 + xh[i];\n\t\t}\n\t\tif (th < h&&tm < m) res += 1;\n\t}\n\telse\n\t{\n\t\tfor (i = 0; i < 7; i++)\n\t\t{\n\t\t\tif (fl[i] == 0)\n\t\t\t{\n\t\t\t\txh[x - 1] = i;\n\t\t\t\tfl[i] = 1;\n\t\t\t\tfindans(x + 1, ho, mo);\n\t\t\t\tfl[i] = 0;\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}\nint main()\n{\n\tint i, j, th, tm, d;\n\tint mo, ho;\n\tscanf(\"%d%d\", &h, &m);\n\tth = h - 1;\n\ttm = m - 1;\n\tmo = ho = 0;\n\twhile (tm > 0)\n\t{\n\t\tmm[mo] = tm % 7;\n\t\ttm = tm / 7;\n\t\tmo++;\n\t}\n\twhile (th > 0)\n\t{\n\t\thh[ho] = th % 7;\n\t\tho++;\n\t\tth = th / 7;\n\t}\n\tif (ho + mo > 7) printf(\"0\\n\");\n\telse\n\t{\n\t\tmemset(fl, 0, sizeof(fl));\n\t\tres = 0;\n\t\tfindans(1, ho, mo);\n\t\tprintf(\"%d\\n\", res);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n#include \n#define NMAX 20\nchar hh[NMAX];\nchar mm[NMAX];\nint xh[9];\nshort int fl[8];\nint res;\nint h, m;\nint findans(int x, int ho, int mo)\n{\n\tint i, th, tm;\n\tif (x > ho + mo)\n\t{\n\t\tth = 0;\n\t\tfor (i = 0; i < ho; i++)\n\t\t{\n\t\t\tth = th * 7 + xh[i];\n\t\t}\n\t\ttm = 0;\n\t\tfor (i = ho; i < ho + mo; i++)\n\t\t{\n\t\t\ttm = tm * 7 + xh[i];\n\t\t}\n\t\tif (th < h&&tm < m) res += 1;\n\t}\n\telse\n\t{\n\t\tfor (i=0;i<7;i++)\n\t\t{\n\t\t\tif (fl[i] == 0)\n\t\t\t{\n\t\t\t\txh[x - 1] = i;\n\t\t\t\tfl[i] = 1;\n\t\t\t\tfindans(x + 1, ho, mo);\n\t\t\t\tfl[i] = 0;\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}\nint main()\n{\n\tint i, j, th, tm, d;\n\tint mo, ho;\n\tscanf(\"%d%d\", &h, &m);\n\tth = h - 1;\n\ttm = m - 1;\n\tmo = ho = 0;\n\twhile (tm > 0)\n\t{\n\t\tmm[mo] = tm % 7;\n\t\ttm = tm / 7;\n\t\tmo++;\n\t}\n\twhile (th > 0)\n\t{\n\t\thh[ho] = th % 7;\n\t\tho++;\n\t\tth = th / 7;\n\t}\n\tif (ho + mo > 8) printf(\"0\\n\");\n\telse\n\t{\n\t\tmemset(fl, 0, sizeof(fl));\n\t\tres = 0;\n\t\tfindans(1, ho, mo);\n\t\tprintf(\"%d\\n\", res);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n\nint count(int n) {\n\treturn n < 7 ? 1 : count(n / 7) + 1;\n}\n\nint check(int *ii, int ncnt, int mcnt, int n, int m) {\n\tint i, a, b;\n\n\ta = 0;\n\tfor (i = 0; i < ncnt; i++)\n\t\ta = 7 * a + ii[i];\n\tb = 0;\n\tfor (i = 0; i < mcnt; i++)\n\t\tb = 7 * b + ii[i + ncnt];\n\treturn a < n && b < m;\n}\n\nint main() {\n\tint n, m, cnt, ncnt, mcnt, dcnt;\n\tstatic int ii[7], used[7];\n\n\tscanf(\"%d%d\", &n, &m);\n\tncnt = count(n);\n\tmcnt = count(m);\n\tdcnt = ncnt + mcnt;\n\tcnt = 0;\n\tfor (ii[0] = 0; ii[0] < 7; ii[0]++) {\n\t\tif (used[ii[0]])\n\t\t\tcontinue;\n\t\tused[ii[0]] = 1;\n\t\tif (dcnt == 1 && check(ii, ncnt, mcnt, n, m))\n\t\t\tcnt++;\n\t\tfor (ii[1] = 0; ii[1] < 7; ii[1]++) {\n\t\t\tif (used[ii[1]])\n\t\t\t\tcontinue;\n\t\t\tused[ii[1]] = 1;\n\t\t\tif (dcnt == 2 && check(ii, ncnt, mcnt, n, m))\n\t\t\t\tcnt++;\n\t\t\tfor (ii[2] = 0; ii[2] < 7; ii[2]++) {\n\t\t\t\tif (used[ii[2]])\n\t\t\t\t\tcontinue;\n\t\t\t\tused[ii[2]] = 1;\n\t\t\t\tif (dcnt == 3 && check(ii, ncnt, mcnt, n, m))\n\t\t\t\t\tcnt++;\n\t\t\t\tfor (ii[3] = 0; ii[3] < 7; ii[3]++) {\n\t\t\t\t\tif (used[ii[3]])\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tused[ii[3]] = 1;\n\t\t\t\t\tif (dcnt == 4 && check(ii, ncnt, mcnt, n, m))\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\tfor (ii[4] = 0; ii[4] < 7; ii[4]++) {\n\t\t\t\t\t\tif (used[ii[4]])\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\tused[ii[4]] = 1;\n\t\t\t\t\t\tif (dcnt == 5 && check(ii, ncnt, mcnt, n, m))\n\t\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tfor (ii[5] = 0; ii[5] < 7; ii[5]++) {\n\t\t\t\t\t\t\tif (used[ii[5]])\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\tused[ii[5]] = 1;\n\t\t\t\t\t\t\tif (dcnt == 6 && check(ii, ncnt, mcnt, n, m))\n\t\t\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\t\tfor (ii[6] = 0; ii[6] < 7; ii[6]++) {\n\t\t\t\t\t\t\t\tif (used[ii[6]])\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\tused[ii[6]] = 1;\n\t\t\t\t\t\t\t\tused[ii[6]] = 0;\n\t\t\t\t\t\t\t\tif (dcnt == 7 && check(ii, ncnt, mcnt, n, m))\n\t\t\t\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tused[ii[5]] = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tused[ii[4]] = 0;\n\t\t\t\t\t}\n\t\t\t\t\tused[ii[3]] = 0;\n\t\t\t\t}\n\t\t\t\tused[ii[2]] = 0;\n\t\t\t}\n\t\t\tused[ii[1]] = 0;\n\t\t}\n\t\tused[ii[0]] = 0;\n\t}\n\tprintf(\"%d\\n\", cnt);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint count(int n) {\n\treturn n < 7 ? 1 : count(n / 7) + 1;\n}\n\nint check(int *ii, int ncnt, int mcnt, int n, int m) {\n\tint i; \n\tlong long a, b;\n\n\ta = 0;\n\tfor (i = 0; i < ncnt; i++)\n\t\ta = 7LL * a + ii[i];\n\tb = 0;\n\tfor (i = 0; i < mcnt; i++)\n\t\tb = 7LL * b + ii[i + ncnt];\n\treturn a < n && b < m;\n}\n\nint main() {\n\tint n, m, cnt, ncnt, mcnt, dcnt;\n\tstatic int ii[7], used[7];\n\n\tscanf(\"%d%d\", &n, &m);\n\tncnt = count(n);\n\tmcnt = count(m);\n\tdcnt = ncnt + mcnt;\n\tcnt = 0;\n\tfor (ii[0] = 0; ii[0] < 7; ii[0]++) {\n\t\tif (used[ii[0]])\n\t\t\tcontinue;\n\t\tused[ii[0]] = 1;\n\t\tif (dcnt == 1 && check(ii, ncnt, mcnt, n, m))\n\t\t\tcnt++;\n\t\tfor (ii[1] = 0; ii[1] < 7; ii[1]++) {\n\t\t\tif (used[ii[1]])\n\t\t\t\tcontinue;\n\t\t\tused[ii[1]] = 1;\n\t\t\tif (dcnt == 2 && check(ii, ncnt, mcnt, n, m))\n\t\t\t\tcnt++;\n\t\t\tfor (ii[2] = 0; ii[2] < 7; ii[2]++) {\n\t\t\t\tif (used[ii[2]])\n\t\t\t\t\tcontinue;\n\t\t\t\tused[ii[2]] = 1;\n\t\t\t\tif (dcnt == 3 && check(ii, ncnt, mcnt, n, m))\n\t\t\t\t\tcnt++;\n\t\t\t\tfor (ii[3] = 0; ii[3] < 7; ii[3]++) {\n\t\t\t\t\tif (used[ii[3]])\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tused[ii[3]] = 1;\n\t\t\t\t\tif (dcnt == 4 && check(ii, ncnt, mcnt, n, m))\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\tfor (ii[4] = 0; ii[4] < 7; ii[4]++) {\n\t\t\t\t\t\tif (used[ii[4]])\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\tused[ii[4]] = 1;\n\t\t\t\t\t\tif (dcnt == 5 && check(ii, ncnt, mcnt, n, m))\n\t\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tfor (ii[5] = 0; ii[5] < 7; ii[5]++) {\n\t\t\t\t\t\t\tif (used[ii[5]])\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\tused[ii[5]] = 1;\n\t\t\t\t\t\t\tif (dcnt == 6 && check(ii, ncnt, mcnt, n, m))\n\t\t\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\t\tfor (ii[6] = 0; ii[6] < 7; ii[6]++) {\n\t\t\t\t\t\t\t\tif (used[ii[6]])\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\tused[ii[6]] = 1;\n\t\t\t\t\t\t\t\tif (dcnt == 7 && check(ii, ncnt, mcnt, n, m))\n\t\t\t\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\t\t\tused[ii[6]] = 0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tused[ii[5]] = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tused[ii[4]] = 0;\n\t\t\t\t\t}\n\t\t\t\t\tused[ii[3]] = 0;\n\t\t\t\t}\n\t\t\t\tused[ii[2]] = 0;\n\t\t\t}\n\t\t\tused[ii[1]] = 0;\n\t\t}\n\t\tused[ii[0]] = 0;\n\t}\n\tprintf(\"%d\\n\", cnt);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\n\nconst int N = 24;\n\nint \ndec_num(int* d, int n){\n int rslt = d[0];\n int seven_plus = 7;\n for(int i = 1; i < n; i++){\n rslt += d[i] * seven_plus;\n seven_plus *=7;\n }\n return rslt;\n}\n\nint\nnext(int* d, int n, int h_limit){\n if( dec_num(d,n) >= h_limit - 1 ){\n return 0;\n }else{\n for(int i= 0; i< n; i++){\n if(d[i] < 6){\n d[i]++;\n break;\n }else{\n d[i]=0;\n }\n }\n }\n return 1;\n}\n\n\nint\nis_valid(int* d, int n){\n int flag[7];\n for(int i=0; i<7; i++) flag[i] =0;\n\n for(int i = 0; i < n; i++){\n int x = d[i];\n if(flag[x]){\n return 0;\n }else{\n flag[x]= 1;\n }\n }\n\n return 1;\n}\n\nint\nis_valid_2(int* d1, int* d2, int n1, int n2){\n\n for(int i = 0; i < n1; i++){\n for(int j = 0; j < n2; j++){\n if(d1[i]==d2[j]) return 0;\n }\n }\n\n// for(int i = 0; i < n1; i++){\n// printf(\"=%d \", d1[i]);\n// }\n// printf(\"\\n\");\n//\n// for(int i = 0; i < n2; i++){\n// printf(\"=%d \", d2[i]);\n// }\n// printf(\"\\n\");\n\n return 1;\n}\n\nint\nmain(){\n int hour[N];\n int minute[N];\n\n int n,m;\n scanf(\"%d %d\", &n, &m);\n\n int ndd = ceil( log(n) / log(6.) ); //Number of digits for day.\n int ndm = ceil( log(m) / log(6.) ); //Number of digits for minutes.\n\n //Debug\n //printf(\"--%d %d\\n\",ndd,ndm);\n\n if(ndd+ndm>=7){\n printf(\"%d\\n\",0);\n return 0;\n }\n\n //Now ndd and ndm are really small, I will use brute force.\n int count = 0;\n\n for(int i=0; i< ndd; i++) hour[i] = 0;\n\n //Debug\n// int d[] = {0,0,0};\n// int x = dec_num(hour,ndd);\n// printf(\"?? %d\\n\",x);\n \n// do {\n// int x = dec_num(hour,ndd);\n// for(int i=0; i< ndm; i++) minute[i] = 0;\n// do {\n// int y = dec_num(minute,ndm);\n// printf(\">>%d %d\\n\", x,y);\n// }while( next(minute,ndm, m) );\n// }while( next(hour,ndd,n) );\n\n do{\n if( is_valid(hour,ndd) ){\n for(int i=0; i< ndm; i++) minute[i] = 0;\n do{\n if( is_valid(minute,ndm) ){\n if( is_valid_2(hour,minute, ndd,ndm) ){\n count++;\n// int x, y;\n// x = dec_num(hour,ndd);\n// y = dec_num(minute,ndm);\n// printf(\"--%d %d\\n\", x,y);\n }\n }\n }while( next(minute,ndm, m) );\n }\n }while( next(hour,ndd,n) );\n\n printf(\"%d\\n\",count);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\n\nconst int N = 24;\n\nint \ndec_num(int* d, int n){\n int rslt = d[0];\n int seven_plus = 7;\n for(int i = 1; i < n; i++){\n rslt += d[i] * seven_plus;\n seven_plus *=7;\n }\n return rslt;\n}\n\nint\nnext(int* d, int n, int h_limit){\n if( dec_num(d,n) >= h_limit - 1 ){\n return 0;\n }else{\n for(int i= 0; i< n; i++){\n if(d[i] < 6){\n d[i]++;\n break;\n }else{\n d[i]=0;\n }\n }\n }\n return 1;\n}\n\n\nint\nis_valid(int* d, int n){\n int flag[7];\n for(int i=0; i<7; i++) flag[i] =0;\n\n for(int i = 0; i < n; i++){\n int x = d[i];\n if(flag[x]){\n return 0;\n }else{\n flag[x]= 1;\n }\n }\n\n return 1;\n}\n\nint\nis_valid_2(int* d1, int* d2, int n1, int n2){\n\n for(int i = 0; i < n1; i++){\n for(int j = 0; j < n2; j++){\n if(d1[i]==d2[j]) return 0;\n }\n }\n\n// for(int i = 0; i < n1; i++){\n// printf(\"=%d \", d1[i]);\n// }\n// printf(\"\\n\");\n//\n// for(int i = 0; i < n2; i++){\n// printf(\"=%d \", d2[i]);\n// }\n// printf(\"\\n\");\n\n return 1;\n}\n\nint\nmain(){\n int hour[N];\n int minute[N];\n\n int n,m;\n scanf(\"%d %d\", &n, &m);\n\n int ndd = ceil( log(n) / log(6.) ); //Number of digits for day.\n int ndm = ceil( log(m) / log(6.) ); //Number of digits for minutes.\n\n if(ndd==0) ndd++;\n if(ndm==0) ndm++;\n\n //Debug\n //printf(\"--%d %d\\n\",ndd,ndm);\n\n if(ndd+ndm>=7){\n printf(\"%d\\n\",0);\n return 0;\n }\n\n //Now ndd and ndm are really small, I will use brute force.\n int count = 0;\n\n for(int i=0; i< ndd; i++) hour[i] = 0;\n\n //Debug\n// int d[] = {0,0,0};\n// int x = dec_num(hour,ndd);\n// printf(\"?? %d\\n\",x);\n \n// do {\n// int x = dec_num(hour,ndd);\n// for(int i=0; i< ndm; i++) minute[i] = 0;\n// do {\n// int y = dec_num(minute,ndm);\n// printf(\">>%d %d\\n\", x,y);\n// }while( next(minute,ndm, m) );\n// }while( next(hour,ndd,n) );\n\n do{\n if( is_valid(hour,ndd) ){\n for(int i=0; i< ndm; i++) minute[i] = 0;\n do{\n if( is_valid(minute,ndm) ){\n if( is_valid_2(hour,minute, ndd,ndm) ){\n count++;\n// int x, y;\n// x = dec_num(hour,ndd);\n// y = dec_num(minute,ndm);\n// printf(\"--%d %d\\n\", x,y);\n }\n }\n }while( next(minute,ndm, m) );\n }\n }while( next(hour,ndd,n) );\n\n printf(\"%d\\n\",count);\n return 0;\n}\n"}], "src_uid": "0930c75f57dd88a858ba7bb0f11f1b1c"} {"nl": {"description": "Ternary numeric notation is quite popular in Berland. To telegraph the ternary number the Borze alphabet is used. Digit 0 is transmitted as «.», 1 as «-.» and 2 as «--». You are to decode the Borze code, i.e. to find out the ternary number given its representation in Borze alphabet.", "input_spec": "The first line contains a number in Borze code. The length of the string is between 1 and 200 characters. It's guaranteed that the given string is a valid Borze code of some ternary number (this number can have leading zeroes).", "output_spec": "Output the decoded ternary number. It can have leading zeroes.", "sample_inputs": [".-.--", "--.", "-..-.--"], "sample_outputs": ["012", "20", "1012"], "notes": null}, "positive_code": [{"source_code": "#include \n#include \n\nint main()\n{\n char a[200];\n int i;\n scanf(\"%s\",a);\n\n for(i=0; a[i]!='\\0'; i++)\n {\n if(a[i]=='.')\n {\n printf(\"0\");\n }\n if(a[i]=='-'&&a[i+1]=='.')\n {\n printf(\"1\");\n i++;\n }\n if(a[i]=='-'&&a[i+1]=='-')\n {\n printf(\"2\");\n i++;\n }\n\n\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n char a[201],b[201];\n int i=0,j=0;\n gets(a);\n while(a[i]!='\\0')\n {\n if(a[i]=='.')\n {\n b[j]='0';\n i++;\n j++;\n }\n else if(a[i]=='-' && a[i+1]=='.')\n {\n b[j]='1';\n j++;\n i+=2;\n }\n else if(a[i]=='-' && a[i+1]=='-')\n {\n b[j]='2';\n j++;\n i+=2;\n }\n }\nb[j]='\\0';\nint x=0;\nwhile(b[x]!='\\0')\n{\nprintf(\"%c\",b[x]);\nx++;\n}\nreturn 0;\n}\n "}, {"source_code": "#include \n#include\nint main() {\n\tchar s[200],v[200];\n\tscanf(\"%s\",s);\n\tint l=strlen(s);\n\tint a=0;\n\tfor(int i=0;i\nint main()\n{\n int i;\n char a[201];\n gets(a);\n for(i=0;a[i]!='\\0';i++)\n {\n if(a[i]=='-' && a[i+1]=='-')\n {\n printf(\"2\");\n i++;\n }\n else if(a[i]=='-' && a[i+1]=='.')\n {\n printf(\"1\");\n i++;\n }\n else if(a[i]=='.')\n {\n printf(\"0\");\n }\n\n }\n return 0;\n}"}, {"source_code": "#include \nint main(void)\n{\n\tchar str[200];\n\tscanf(\"%s\",str);\n\tint i=0;\n\twhile(str[i]!='\\0')\n\t{\n\t\tif(str[i]=='.')\n\t\t{\n\t\t printf(\"0\");\n\t\t i++;\t\n\t\t}\n\t\t \n\t\telse if(str[i]=='-'&&str[i+1]=='.')\n\t\t{\n\t\t printf(\"1\");\n\t\t i=i+2;\n\t\t}\n\t\n\t\telse if(str[i]=='-'&&str[i+1]=='-')\n\t\t{\n\t\t printf(\"2\");\n\t\t i=i+2;\t\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n#include \nint main()\n{\n int i,j,k,a,b=0;\n char x[1000],y[1000];\n scanf(\"%s\",x);\n a=strlen(x);\n for(i=0;i\n\nint main() {\n char input[200 + 1], output[200 + 1] = \"\";\n char *in = input, *out = output;\n enum states {\n st_start,\n st_0,\n st_12,\n st_1,\n st_2\n };\n enum states state = st_start;\n struct branch {\n enum states new_state;\n int is_final;\n };\n struct branch table[5][2] = {\n // st_start\n { {st_0, 1}, {st_12, 0} },\n // st_0\n { {st_0, 1}, {st_12, 0} },\n // st_12\n { {st_1, 1}, {st_2, 1} },\n // st_1\n { {st_0, 1}, {st_12, 0} },\n // st_2\n { {st_0, 1}, {st_12, 0} }\n };\n struct branch *pb;\n\n scanf(\"%s\", input);\n\n for (; *in != '\\0'; ++in) {\n if (*in == '.') {\n pb = &table[state][0];\n } else {\n pb = &table[state][1];\n }\n state = pb->new_state;\n if (pb->is_final) {\n if (state == st_0) {\n\t*out = '0';\n } else if (state == st_1) {\n\t*out = '1';\n } else {\n\t*out = '2';\n }\n ++out;\n }\n }\n\n printf(\"%s\", output);\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n char s[201],s1[201],ch;\n scanf(\"%s\",s);\n int i,l,j=0;\n l=strlen(s);\n\n for(i=0; i\n#include\n\nint main()\n{\n int i,l,m,j=0;\n char s[205],a[205];\n scanf(\"%s\",s);\n l=strlen(s);\n for(i=0;i\nint main()\n{\n char c[201];\n int i;\n scanf(\"%s\",c);\n for(i=0;c[i]!='\\0';i++)\n {\n if(c[i]=='.')\n {\n printf(\"0\");\n continue;\n }\n if(c[i]=='-' && c[i+1]=='.')\n {\n printf(\"1\");\n i++;\n continue;\n }\n if(c[i]=='-' && c[i+1]=='-')\n {\n printf(\"2\");\n i++;\n continue;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int flag=0;\n char temp;\n for(;scanf(\"%c\",&temp) && temp!='\\n';)\n {\n if(temp=='.')printf(\"0\");\n else\n {\n scanf(\"%c\",&temp);\n if(temp=='.')printf(\"1\");\n else printf(\"2\");\n }\n }\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \nint take_input(char x[])\n{\n int i=1;\n x[0]='0';\n while(x[i-1]!='\\n') //x[0]=0 && x[i-1]=\\n;\n {\n scanf(\"%c\",&x[i]);\n i++;\n }\n return i-1;\n}\nint main()\n{\n\n\tchar a[201];\n\tint l=take_input(a);\n\t//printf(\"%s\\n\",a);\n\n\tfor (int i = 1; i < l ; i++)\n\t{\n\t\tif (a[i]=='.')\n\t\t{\n\t\t\tprintf(\"0\");\n\t\t}\n\t\telse if (a[i]=='-')\n\t\t{\n\t\t\tif (a[i+1]=='.')\n\t\t\t{\n\t\t\t\tprintf(\"1\");\n\t\t\t\ti++;\n\t\t\t}\n\t\t\telse if(a[i+1]=='-')\n\t\t\t{\n\t\t\t\tprintf(\"2\");\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include \n#include \nint main()\n{\n char str[200];\n gets(str);\n int i;\n for(i=0;i<200;){\n if(str[i]=='.'){\n printf(\"0\");\n i++;\n }\n if(str[i]=='-'){\n i++;\n if(str[i]=='.'){\n printf(\"1\");\n i++;\n }\n else if(str[i]=='-'){\n printf(\"2\");\n i++;\n }\n }\n if(str[i]=='\\0'){\n break;\n }\n }\n return(0);\n}\n"}, {"source_code": "#include \n#include\nint main() {\n\tchar s[200],v[200];\n\tscanf(\"%s\",s);\n\tint l=strlen(s);\n\tint j=0;\n\tfor(int i=0;i\n#include \nint main ()\n{\n char str[210];\n gets(str);\n int i, l=strlen(str);\n for(i=0; i\n#include\n#include\nint main()\n{\n int i,l;\n char a[1000];\n scanf(\"%s\",a);\n l=strlen(a);\n for(i=0; i\nmain()\n{\n char s[205];\n gets(s);\n int n=strlen(s),i;\n for(i=0;i\nint main()\n{\n int i=0;\n char arr[201];\n\n scanf(\"%s\",arr);\n //printf(\"%s\\n\",arr );\n\n while(arr[i]!='\\0'){\n if(arr[i]=='.'){\n printf(\"0\");\n }\n else if(arr[i]=='-'){\n if(arr[i+1]=='.'){\n printf(\"1\");\n }\n else{\n printf(\"2\");\n } \n i++;\n }\n i++;\n }\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n char c[201];\n int i;\n scanf(\"%s\",c);\n for(i=0;c[i]!='\\0';i++)\n {\n if(c[i]=='.')\n {\n printf(\"0\");\n continue;\n }\n if(c[i]=='-' && c[i+1]=='.')\n {\n printf(\"1\");\n i++;\n continue;\n }\n if(c[i]=='-' && c[i+1]=='-')\n {\n printf(\"2\");\n i++;\n continue;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\nchar s[300];\ngets(s);\nint x,i;\nint l=strlen(s);\nfor(i=0;i\n#include\n\nint main()\n{\n int i = 0;\n\n char str[202];\n\n scanf(\"%s\", str);\n\n int ln = strlen(str);\n\n while( i < ln ){\n if(str[i] == '.') printf(\"0\");\n else if(str[i] == '-' && str[i+1] == '.') {\n printf(\"1\");\n i++;\n }\n else if(str[i] == '-' && str[i+1] == '-'){\n printf(\"2\");\n i++;\n }\n i++;\n\n }\n printf(\"\\n\");\n\n return 0;\n\n}\n"}, {"source_code": "#include \n#include \n#include \nint take_input(char x[])\n{\n int i=1;\n x[0]='0';\n while(x[i-1]!='\\n') //x[0]=0 && x[i-1]=\\n;\n {\n scanf(\"%c\",&x[i]);\n i++;\n }\n return i-1;\n}\nint main()\n{\n\n\tchar a[201];\n\tint l=take_input(a);\n\t//printf(\"%s\\n\",a);\n\n\tfor (int i = 1; i < l ; i++)\n\t{\n\t\tif (a[i]=='.')\n\t\t{\n\t\t\tprintf(\"0\");\n\t\t}\n\t\telse if (a[i]=='-')\n\t\t{\n\t\t\tif (a[i+1]=='.')\n\t\t\t{\n\t\t\t\tprintf(\"1\");\n\t\t\t\ti++;\n\t\t\t}\n\t\t\telse if(a[i+1]=='-')\n\t\t\t{\n\t\t\t\tprintf(\"2\");\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include \n\n\n\nint main(void)\n{\n char str[200];\n \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] == '.')\n {\n printf(\"0\");\n }\n else if(str[i] == '-' && str[i+1] == '.')\n {\n printf(\"1\");\n i++;\n }\n else if(str[i] == '-' && str[i+1] == '-')\n {\n printf(\"2\");\n i++;\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \n\nvoid call();\n\nint main()\n{\n call();\n return 0;\n}\n\nvoid call()\n{\n int i;\n char borze[201];\n\n scanf(\"%[^\\n]\",borze);\n\n for(i=0; i\n#include\nint main()\n{\n\n\t\tint i;\n\t\tchar str[200];\n\t\tgets(str);\n\t\tfor(i=0; i\n#include\nint main()\n{\nint i=0,j=0,a[200],l;\nchar c[201];\nscanf(\"%s\",c);\nl=strlen(c);\n//printf(\"%d \",l);\n while(i<=l)\n {\n if(c[i]=='.')\n {\n a[j]=0;\n j++;\n\n }\n else if(c[i]=='-')\n {\n if(c[i+1]=='.')\n {a[j]=1;\n j++;\n i=i+1;}\n else if(c[i+1]=='-')\n {\n a[j]=2;\n j++;\n i=i+1;\n\n }\n }\ni++;\n//printf(\"%d \",i);\n }\nfor(i=0;i\n#include\n\nint main()\n{\n char s[200];\n scanf(\"%s\",s);\n int i;\n int len=strlen(s);\n for(i=0;i\n#include\nint main ()\n{\n char a[200] ;\n int i;\n\n gets(a);\n for( i =0; i < strlen(a); i++)\n {\n if(a[i]=='.'){\n\n printf(\"0\") ;\n }\n\n else if (a[i] == '-'&& a[i+1]== '.')\n {\n printf(\"1\") ;\n i++;\n }\n else if (a[i] == '-'&& a[i+1]== '-')\n {\n printf(\"2\") ;\n i++;\n\n }\n }\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n char a[200];\n scanf(\"%s\",a);\n for(int i=0;i\nint main()\n{\n char a[300];\n int d[300];\n long k=0;\n long i;\n scanf(\"%s\",a);\n i=0;\n while(a[i]!='\\0')\n {\n if(a[i]=='.') \n\t {\n\t d[k]=0;\n\t\t k++;\n\t\n\t\t i++;\n\t\t \n\t }\n\telse if(a[i]=='-' && a[i+1]=='.')\n\t {\n\t\t d[k]=1;\n\t\t k++;\n\t\t \n\t\t i=i+2;\n\t\t \n\t\t }\n\telse if(a[i]=='-' && a[i+1]=='-')\n\t {\n\t\t d[k]=2;\n\t\t k++;\n\t\t i=i+2;\n\t\t\n\t\t }\n }\n\t\nfor(i=0;i\n\nint main()\n{\n\tchar string_in[250]={0},string_out[250]={0};\n\tint i = 0,g = 0;\n\tscanf(\"%s\",string_in);\n\tdo{\n\t\tif (string_in[i] == '.')\n\t\t{\n\t\t\tstring_out[g] = '0';\n\t\t\ti++;g++;\n\t\t}\n\t\telse if (string_in[i] == '-')\n\t\t{\n\t\t\tif (string_in[i+1] == '.') /* '-.' >>>>>1*/\n\t\t\t{\n\t\t\t\tstring_out[g] = '1';\n\t\t\t\tg++;i+=2;\n\t\t\t}\n\t\t\telse if (string_in[i+1] == '-')\n\t\t\t{\n\t\t\t\tstring_out[g] = '2';\n\t\t\t\tg++;i+=2;\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\n\t}while (string_in[i] !=0);\n\t\n\tstring_out[g] = 0;\n\t\n\tprintf(\"%s\",string_out);\n\n\n\n\n\n\n\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n int i,k;\n char A[10000];\n scanf(\"%s\",&A);\n for(i=0;i\n#include \n\nint main()\n{\n char borze[201], dec[201];\n int n, i, j;\n scanf(\"%s\", borze);\n n = strlen(borze);\n i = 0; j = 0;\n while(borze[i] != '\\0')\n {\n if (borze[i] == '.') {j++; dec[j] = '0'; i++;}\n else\n if (borze[i + 1] == '.') {j++; dec[j] = '1'; i = i + 2;}\n else {j++; dec[j] = '2'; i = i + 2;}\n }\n for (i = 1; i <= j; i++)\n printf(\"%c\", dec[i]);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\nint i=0;\nchar a[202];\nscanf(\"%s\",a);\nwhile(a[i]!='\\0')\n{\nif(a[i]=='.')\n{\nprintf(\"0\");\ni++;\n}\nelse if(a[i]=='-'&&a[i+1]=='.')\n\t{\n\tprintf(\"1\");\n\ti+=2;\n\t}\nelse if(a[i]=='-'&&a[i+1]=='-')\n\t{\n\tprintf(\"2\");\n\ti+=2;\n\t}\n}\nreturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main(){\n\tchar test[1000],hasil[1000];\n\t\n\tscanf(\"%s\",test);\n\t\n\tint len = strlen(test);\n\tint i,j=0;\n\t\n\tfor(i=0;i\n#include \n\nint main ()\n{\n char v[201];\n int i,res[201];\n gets(v);\n for (i=0;i<200;i++)\n {\n res[i]=-1;\n }\n for (i=0;i<=strlen(v);i++)\n {\n if (v[i]=='.')\n {\n res[i]=0 ;\n }\n else if (v[i]=='-')\n {\n if (v[i+1]=='.')\n {\n res[i]=1;\n i++;\n }\n else if (v[i+1]=='-')\n {\n res[i]=2;\n i++;\n }\n }\n }\n\n for (i=0;i<200;i++)\n {\n if (res[i]!=-1)\n {\n printf(\"%d\",res[i]);\n }\n }\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int i;\n char s[200];\n for(i=0;i<200;i++)\n s[i]='0';\n scanf(\"%s\",&s);\n for(i=0;i<200;i++)\n {\n if(s[i]=='.') printf(\"0\");\n else if(s[i]=='-')\n {\n if(s[i+1]=='.') printf(\"1\");\n else printf(\"2\");\n i++;\n }\n if(s[i]=='0')\n break;\n }\n\n}\n"}, {"source_code": "// no array used. single character has been consumed\n#include \n\nint main(){\n\tchar c;\n\tc=getchar();\n\twhile(c=='.' || c=='-'){\n\t\tif(c=='.')\n\t\t\tputchar('0');\n\t\telse{\n\t\t\tif(getchar()=='-')\n\t\t\t\tputchar('2');\n\t\t\telse \n\t\t\t\tputchar('1');\n\t\t}\n\t\tc=getchar();\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n\tchar a[201];\n\tint i;\n\tscanf(\"%s\",a);\n\tfor(i=0;i\n#include\n\nint main()\n{\n char s[200];\n int i=0;\n gets(s);\n for(i=0;s[i]!='\\0'; )\n {\n if(s[i]=='-'&&s[i+1]=='.')\n {\n printf(\"1\");\n i=i+2;\n }\n else if(s[i]=='-'&&s[i+1]=='-')\n {\n printf(\"2\");\n i= i+2;\n }\n else if(s[i]=='.')\n {\n printf(\"0\");\n i++;\n }\n\n\n }\n\n}\n"}, {"source_code": "// no array. single character has been consumed\n#include \n\nint main(){\n\tchar c;\n\tc=getchar();\n\twhile(c=='.' || c=='-'){\n\t\tif(c=='.')\n\t\t\tputchar('0');\n\t\telse{\n\t\t\t//c=getchar();\n\t\t\tc=getchar();\n\t\t\tif(c=='-')\n\t\t\t\tputchar('2');\n\t\t\telse \n\t\t\t\tputchar('1');\n\t\t}\n\t\tc=getchar();\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \nint main ()\n{\n char a[201],b[201];\n int i,j,n;\n scanf(\"%s\",a);\n\n n=strlen(a);\n\n for (i=0,j=0;i\n#include\nint main()\n{\n char s[400];\n int i,x;\n scanf(\"%s\",s);\n x=strlen(s);\n for(i=0;i\n#include\nint main()\n{\n char str[200];\n int i=0;\n scanf(\"%s\",str);\n while(str[i]!='\\0')\n {\n if (str[i]=='.')\n {\n printf(\"0\");\n i++;\n }\n else if(str[i]=='-' && str[i+1]=='.')\n {\n printf(\"1\");\n i+=2;\n }\n else if (str[i]=='-' && str[i+1]=='-')\n {\n printf(\"2\");\n i+=2;\n }\n }\n printf(\"\\n\");\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\nchar s[201];\nint i;\nscanf(\"%s\",s);\nfor(i=0;s[i]!='\\0';i++)\n{\nif(s[i]=='.')\n{\nprintf(\"0\");\n}\n\nif(s[i]=='-'&&s[i+1]=='.')\n{\nprintf(\"1\");\ni++;\n}\nif(s[i]=='-'&&s[i+1]=='-')\n{\nprintf(\"2\");\ni++;\n}\n}\n}"}, {"source_code": "#include \n#include \n\nint main()\n\n{\n char s[200];\n int i=0;\n\n gets(s);\n\n while(i\n#include\n\nint main()\n{\n int i,l,m,j=0;\n char s[205],a[205];\n scanf(\"%s\",s);\n l=strlen(s);\n for(i=0;i\n\nint main(void) {\n\tint i,l;\n\tchar a[200];\n\tscanf(\"%s\",a);\n\tfor (i = 0; a[i] != '\\0'; i++);\n\tl=i;\n\t\n\tfor(i=0; i\n#include\nint main()\n{\n int i,l,j=0;\n char ch[200];\n scanf(\"%s\",ch);\n l=strlen(ch);\n for(i=0;i\n#include\nint main ()\n{\n char a[200] ;\n int i, temp1=0,temp2=1,temp3=2;\n\n scanf(\"%s\",a);\n for( i =0; i < strlen(a); i++)\n {\n if(a[i]=='.'){\n\n printf(\"%d\",temp1) ;\n }\n\n else if (a[i] == '-'&& a[i+1]== '.')\n {\n printf(\"%d\",temp2) ;\n i++;\n }\n else if (a[i] == '-'&& a[i+1]== '-')\n {\n printf(\"%d\",temp3) ;\n i++;\n\n }\n }\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n char a[200];\n scanf(\"%s\",a);\n int i;\n for (i=0;a[i]!='\\0';i++){\n if (a[i]=='.'){\n printf(\"%d\",0);\n }else if (a[i]=='-'&&a[i+1]=='.'){\n printf(\"%d\",1);\n i++;\n }else if (a[i]=='-'&&a[i+1]=='-'){\n printf(\"%d\",2);\n i++;\n }\n\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n\tchar str[200];\n\tint i;\n\tscanf(\"%s\",str);\n\tfor(i=0;i\n\nint main()\n{\n int i,j,m;\n char a[200],b[200];\n gets(a);\n for(i=j=0;a[i];i++)\n {\n if(a[i]=='.')\n {\n printf(\"0\");\n }\n else if(a[i+1]=='.')\n {\n printf(\"1\");\n i++;\n }\n else\n {\n printf(\"2\");\n i++;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n char s[1000];\n int i,len;\n scanf(\"%s\",s);\n len=strlen(s);\n for(i=0;i\n#include \n\nint main ()\n{\n char v[201];\n int i,res[201];\n gets(v);\n for (i=0;i<200;i++)\n {\n res[i]=-1;\n }\n for (i=0;i<=strlen(v);i++)\n {\n if (v[i]=='.')\n {\n res[i]=0 ;\n }\n else if (v[i]=='-')\n {\n if (v[i+1]=='.')\n {\n res[i]=1;\n i++;\n }\n else if (v[i+1]=='-')\n {\n res[i]=2;\n i++;\n }\n }\n }\n\n for (i=0;i<200;i++)\n {\n if (res[i]!=-1)\n {\n printf(\"%d\",res[i]);\n }\n }\n return 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n char a[201];\n\tscanf(\"%s\",&a);\n\t\n\tint i,l;\n\tl=strlen(a);\n\tfor(i=0;i\n#include \n#include \n\nvoid call();\n\nint main()\n{\n call();\n return 0;\n}\n\nvoid call()\n{\n int i;\n char borze[201];\n\n scanf(\"%[^\\n]\",borze);\n\n for(i=0; i\n\nint main()\n{\n char ch[200];\n scanf(\"%s\",ch);\n int i=0;\n while(ch[i]!='\\0')\n {\n if(ch[i]=='-' && ch[i+1]=='-')\n {\n printf(\"2\");\n i=i+2;\n }\n else if(ch[i]=='-' && ch[i+1]=='.')\n {\n printf(\"1\");\n i=i+2;\n }\n else\n {\n printf(\"0\");\n i++;\n }\n }\n \n}"}, {"source_code": "#include \n\n#include\nint main()\n{\n int i,len;\n char a[200];\n\n scanf(\"%s\",a);\n\n len=strlen(a);\n for(i=0;i\n#include\n\nint main()\n{\n char ch[205];\n int i,l,j,k,ar[300];\n scanf(\"%s\",ch);\n l=strlen(ch);\n j=0;\n for(i=0;i\n#include\nint main(){\n char a[200];\n scanf(\"%s\",a);\n int l=strlen(a);\n char z[l];int j=0;\n for(int i=0;i\n#include\nint main()\n{\n\tchar str[200];\n\tint i;\n\tscanf(\"%s\",str);\n\tfor(i=0;i\n#include\nint main()\n{\n char s[201];\n scanf(\"%s\",&s);\n int n=strlen(s);\n\n for(int i=0;i\n#include\nint main (){int i,l;char ternary[210];gets(ternary);l=strlen(ternary);for(i=0;i\nint main(){\n char c[200];\n int i=0;\n scanf(\"%s\",c);\n while(c[i]!='\\0'){\n if(c[i]=='.') {printf(\"0\");i++;continue;}\n else if(c[i]=='-'&&c[i+1]=='.'){printf(\"1\");i+=2;continue;}\n else {printf(\"2\");i+=2;continue;}\n }\n}"}, {"source_code": " #include \n #include \n int main()\n {\n char s[200];\n scanf(\"%s\",s);\n int i;\n for(i=0;i\n#include \nint main()\n{\n char s[202];\n int i,n;\n scanf(\"%s\",s);\n n=strlen(s);\n for (i=0; i\n#include\nint main()\n{\n int i,l,j=0;\n char ch[200];\n scanf(\"%s\",ch);\n l=strlen(ch);\n for(i=0;i\n#include\nint main()\n{\n char s[400];\n int i,x;\n scanf(\"%s\",s);\n x=strlen(s);\n for(i=0;i\n#include \nint main()\n{\n char s[201],s1[201],ch;\n scanf(\"%s\",s);\n int i,l,j=0;\n l=strlen(s);\n\n for(i=0; i\n\nint main()\n{\n char s;\n\n while(scanf(\"%c\", &s)!=EOF) {\n if(s=='.') {\n printf(\"0\");\n }\n else if(s=='-') {\n s=getchar();\n if(s=='.') {\n printf(\"1\");\n }\n else if(s=='-') {\n printf(\"2\");\n }\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n char a[200];\n scanf(\"%s\",a);\n for(int i=0;i\n#include \n// #define inout\nint main()\n{\n// #ifdef inout\n// \tfreopen(\"input.txt\", \"r++\", stdin);\n// \tfreopen(\"output.out\", \"w++\", stdout);\n// #endif\n\tint i, n, j;\n\tchar num[200];\n\tscanf(\"%s\", num);\n\tn = strlen(num);\n\tfor (i = 0; i < n; i++)\n\t{\n\t\tif (num[i] == '.')\n\t\t{\n\t\t\tprintf(\"%d\", 0 );\n\n\t\t}\n\t\telse if (num[i] == '-' && num[i + 1] == '.')\n\t\t{\n\t\t\tprintf(\"%d\", 1 );\n\t\t\ti++;\n\t\t}\n\t\telse if (num[i] == '-' && num[i + 1] == '-')\n\t\t{\n\t\t\tprintf(\"%d\", 2 );\n\t\t\ti++;\n\t\t}\n\t}\n\tputs(\"\");\n\n\n\treturn 0;\n}"}, {"source_code": "#include\n#include\n\nint main()\n{\n int i, len, j;\n char string[200];\n gets(string);\n len = strlen(string);\n\n int arra[len];\n\n for(i = 0, j = 0; i < len; i++, j++){\n if(string[i] == '-' && string[i + 1] == '-'){\n arra[j] = 2;\n i++;\n }\n else if(string[i] == '-' && string[i + 1] == '.'){\n\n arra[j] = 1;\n i++;\n }\n else arra[j] = 0;\n }\n\n for(i = 0; i < j; i++){\n printf(\"%d\", arra[i]);\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n char a[1000];\n int i,len;\n scanf(\"%s\",&a);\n len=strlen(a);\n for(i=0;i\n#include\nint main() {\n\tchar s[200],v[200];\n\tgets(s);\n\tint l=strlen(s);\n\tint j=0;\n\tfor(int i=0;i\n#include\n#include\n#include\n\nint main()\n{\n int i,l;\n char ara[9910];\n scanf(\"%s\",&ara);\n\n l=strlen(ara);\n\n for(i=0;i\n#include\n\nint main()\n{\n char a[201];\n scanf (\"%s\",a);\n int i = 0;\n while (i < strlen(a)) {\n if (a[i] == '-' && a[i + 1] == '.') {\n printf (\"1\");\n i++;\n }\n else if (a[i] == '-' && a[i + 1] == '-') {\n printf (\"2\");\n i++;\n }\n else {\n printf (\"0\");\n }\n i++;\n }\n printf (\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n char s[202];\n int i;\n gets(s);\n for(i=0;s[i]!='\\0';i++)\n {\n if(s[i]=='-' && s[i+1]=='.')\n {\n printf(\"1\");\n i++;\n }\n else if(s[i]=='.')\n {\n printf(\"0\");\n }\n else if(s[i]=='-' && s[i+1]=='-')\n {\n printf(\"2\");\n i++;\n }\n }\n return 0;\n}\n\n\n"}, {"source_code": "#include \n#include \nint main(){\nchar arr[201];\nint b;\nscanf(\"%s\",&arr);\nb=strlen(arr);\nfor (int i=0;i\nint main()\n{\n int i=0;\n char str[201];\n\n scanf(\"%s\",str);\n while(str[i]!='\\0')\n {\n if(str[i]=='.') {printf(\"0\"); i++;}\n else if(str[i]=='-')\n {\n if(str[i+1]=='.') {\n printf(\"1\");\n\n i=i+2;\n }\n else if(str[i+1]=='-')\n {\n printf(\"2\");\n\n i=i+2;}\n else if(str[i+1]=='\\0') break;\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main ()\n{\n int l,i;\n char a[1000];\n scanf(\"%s\",a);\n l=strlen(a);\n for(i=0; i\nint main()\n{\n char s[202];\n int i;\n gets(s);\n for(i=0;s[i]!='\\0';i++)\n {\n if(s[i]=='-' && s[i+1]=='.')\n {\n printf(\"1\");\n i++;\n }\n else if(s[i]=='.')\n {\n printf(\"0\");\n }\n else if(s[i]=='-' && s[i+1]=='-')\n {\n printf(\"2\");\n i++;\n }\n }\n return 0;\n}\n\n\n"}, {"source_code": "#include \n#include \n#include \nint take_input(char x[])\n{\n int i=1;\n x[0]='0';\n while(x[i-1]!='\\n') //x[0]=0 && x[i-1]=\\n;\n {\n scanf(\"%c\",&x[i]);\n i++;\n }\n return i-1;\n}\nint main()\n{\n\n\tchar a[201];\n\tint l=take_input(a);\n\t//printf(\"%s\\n\",a);\n\n\tfor (int i = 1; i < l ; i++)\n\t{\n\t\tif (a[i]=='.')\n\t\t{\n\t\t\tprintf(\"0\");\n\t\t}\n\t\telse if (a[i]=='-')\n\t\t{\n\t\t\tif (a[i+1]=='.')\n\t\t\t{\n\t\t\t\tprintf(\"1\");\n\t\t\t\ti++;\n\t\t\t}\n\t\t\telse if(a[i+1]=='-')\n\t\t\t{\n\t\t\t\tprintf(\"2\");\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint main(){\n char a[1000];\n int b,c=0,c1=0,c2=0,i;\n scanf(\"%s\",a);\n b=strlen(a);\n for(i=0;i\n#include\nint main(){\n\tchar test[1000],hasil[1000];\n\t\n\tscanf(\"%s\",test);\n\t\n\tint len = strlen(test);\n\tint i,j=0;\n\t\n\tfor(i=0;i\n#include\nint main()\n{\n int i,n;\n char s[1000];\n scanf(\"%s\",s);\n n=strlen(s);\n for(i=0;i\n\nint main()\n{\n char str[201];\n scanf(\"%s\", str);\n for(int i = 0; str[i]; ++i) {\n if(str[i] == '.') {\n putchar('0');\n } else {\n putchar(str[i + 1] == '.' ? '1' : '2');\n ++i;\n }\n }\n putchar('\\n');\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n char c[200];\n int i=0;\n scanf(\"%s\",c);\n while(c[i]!='\\0'){\n if(c[i]=='.') {printf(\"0\");i++;continue;}\n else if(c[i]=='-'&&c[i+1]=='.'){printf(\"1\");i+=2;continue;}\n else {printf(\"2\");i+=2;continue;}\n }\n}"}, {"source_code": "#include\n#include\nint main()\n{\n char str[200];\n int i;\n //printf(\"Please enter the string\\n\");\n gets(str);\n for(i=0;str[i]!='\\0';i++)\n {\n if(str[i]=='.')\n {\n printf(\"0\");\n }\n if(str[i]=='-'&&str[i+1]=='.')\n {\n printf(\"1\");\n i++;\n }\n if(str[i]=='-'&&str[i]=='-')\n {\n printf(\"2\");\n i++;\n }\n }\n}"}, {"source_code": "#include\nint main()\n{\n int i,j,flag=0;\n char temp;\n for(i=0;scanf(\"%c\",&temp) && temp!='\\n';i++)\n {\n if(temp=='.')\n {\n if(flag==0)printf(\"0\");\n else\n {\n printf(\"1\");\n flag=0;\n }\n }\n else\n {\n if(flag==1)\n {\n printf(\"2\");\n flag=0;\n }\n else flag=1;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \nint main ()\n{\n char a[201],b[201];\n int i,j,n;\n scanf(\"%s\",a);\n\n n=strlen(a);\n\n for (i=0,j=0;i\n#include\nint main()\n{\n int i,j=0,n;\n char a[201];\n char b[201];\n gets(a);\n n=strlen(a);\n for(i=0;i\n\nint main()\n{\n char s[200];\n int i=0;\n s[i]=getchar();\n while(s[i]!='\\n'){\n i++;\n s[i]=getchar();\n }\n //printf(\"%d\",i);\n for(int k=0;k\nint main()\n{\n char str[1000];\n int i;\n scanf(\"%s\",str);\n for(i=0;i\n#define LEN 501\nint main()\n{\n char string[LEN];\n //scanf(\"%s\", &string);\n gets(string);\n int i;\n for (i = 0; string[i] != '\\0';i++)\n {\n if (string[i] == '-' && string[i + 1] == '-')\n {\n printf(\"2\");\n i+=1;\n }\n else if (string[i] == '-' && string[i + 1] == '.')\n {\n printf(\"1\");\n i+=1;\n }\n else if (string[i] == '.' && string[i - 1] == '-' || string[i - 1] != '-')\n {\n printf(\"0\");\n //i-=1;\n }\n }\n return 0;\n}"}, {"source_code": "// no array. single character has been consumed\n#include \n\nint main(){\n\tchar c;\n\tc=getchar();\n\twhile(c=='.' || c=='-'){\n\t\tif(c=='.')\n\t\t\tputchar('0');\n\t\telse{\n\t\t\t//c=getchar();\n\t\t\tc=getchar();\n\t\t\tif(c=='-')\n\t\t\t\tputchar('2');\n\t\t\telse \n\t\t\t\tputchar('1');\n\t\t}\n\t\tc=getchar();\n\t}\n\treturn 0;\n}"}, {"source_code": "#include \n\nint main() {\n char input[200 + 1], output[200 + 1] = \"\";\n char *in = input, *out = output;\n enum states {\n st_start,\n st_0,\n st_12,\n st_1,\n st_2\n };\n enum states state = st_start;\n struct branch {\n enum states new_state;\n int is_final;\n };\n struct branch table[5][2] = {\n // st_start\n { {st_0, 1}, {st_12, 0} },\n // st_0\n { {st_0, 1}, {st_12, 0} },\n // st_12\n { {st_1, 1}, {st_2, 1} },\n // st_1\n { {st_0, 1}, {st_12, 0} },\n // st_2\n { {st_0, 1}, {st_12, 0} }\n };\n struct branch *pb;\n\n scanf(\"%s\", input);\n\n for (; *in != '\\0'; ++in) {\n if (*in == '.') {\n pb = &table[state][0];\n } else {\n pb = &table[state][1];\n }\n state = pb->new_state;\n if (pb->is_final) {\n if (state == st_0) {\n\t*out = '0';\n } else if (state == st_1) {\n\t*out = '1';\n } else {\n\t*out = '2';\n }\n ++out;\n }\n }\n\n printf(\"%s\", output);\n\n return 0;\n}\n"}, {"source_code": "#include\nint main(void){\n char c[500];\n gets(c);\n if(c[0] == '.'){\n printf(\"0\");\n }\n int l;\n for(int i = 0;c[i] != '\\0';i++){\n l++;\n }\n for(int i = 0;i < l;i++){\n if(c[i] == '-'){\n if(c[i+1] == '.'){\n printf(\"1\");\n i++;\n }\n else{\n printf(\"2\");\n i++;\n }\n }\n else if(c[i] == '.' && i != 0){\n printf(\"0\");\n }\n }\n return 0;\n}\n\n"}, {"source_code": "#include\n#include\nint main()\n{\n int i,l,j=0;\n char ch[200];\n scanf(\"%s\",ch);\n l=strlen(ch);\n for(i=0;i\n#include\nint main(){\n char str[200],s[200];\n scanf(\"%s\",str);\n int l=strlen(str),flag=0,j=0;\n for(int i=0;i\n \n\nint main()\n{\n char c[200];\n scanf(\"%s\",&c); \n \n for(int i=0; i<200; i++){\n \n if((c[i]== '-')&& (c[i+1]== '-')){\n printf(\"2\"); \n i++;\n }\n else if (c[i]== '.'){\n if( i%2 == 0) { \n printf(\"0\"); \n }\n else { \n printf(\"1\"); }\n } \n \n } \n \n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int i=0,newarr[200],x=0;\n char arr[201];\n \n scanf(\"%s\",arr);\n\n while(arr[i]=='\\0'){\n if(arr[i]=='.'){\n newarr[x]=0;\n x++;\n i++;\n }\n else{\n if(arr[i+1]=='.'){\n newarr[x]=1;\n x++;\n i=i+2;\n }\n else{\n newarr[x]=2;\n x++;\n i=i+2;\n }\n }\n for(i=0;i\n#include \n#include \n\n\nint main(void)\n{\n char str[201];\n fflush(stdin);\n scanf(\"%s\", &str);\n\n int size = sizeof(str) / sizeof(str[0]);\n\n for(int i = 0; i <= size; i++)\n {\n if(str[i] == '.')\n {\n printf(\"0\");\n }\n else if(str[i] == '-' && str[i+1] == '.')\n {\n printf(\"1\");\n i++;\n }\n else if(str[i] == '-' && str[i+1] == '-')\n {\n printf(\"2\");\n i++;\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n\tint count=0,n,i;\n\tchar arr[100];\n\tfgets(arr,100,stdin);\n\tputs(arr);\n\tfor(i=0;i\n\nint main(int argv, char *argc[]){\n\n\tchar S[256];\n\tscanf(\"%s\",S);\n\n\tfor(int i = 0; S[i] != '\\0'; i++){\n\t\tif(S[i] == '.'){\n\t\t\tprintf(\"0\");\n\t\t}\n\t\telse{\n\t\t\tif(S[i+1] == '.'){\n\t\t\t\tprintf(\"1\");\n\t\t\t\ti++;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tprintf(\"2\");\n\t\t\t\ti++;\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\t} \n\n\tprintf(\"\\n\");\n\treturn 0;\n}"}, {"source_code": "#include \n#include \nint main()\n{\n char str[200];\n gets(str);\n int i;\n for(i=0;i<200;){\n if(str[i]=='.'){\n printf(\"0\");\n i++;\n }\n else if(str[i]=='-'){\n i++;\n if(str[i]=='.'){\n printf(\"1\");\n i++;\n }\n if(str[i]=='-'){\n printf(\"2\");\n i++;\n }\n }\n if(str[i]=='\\0'){\n break;\n }\n }\n return(0);\n}\n"}, {"source_code": "#include\n#include\n#define size 100\nint main()\n{\n int i;\n char str[size], s[size];\n gets(s);\n \n \n for(int i=0,k=0;i\n#include\n#include\n\nint main(){\n char a[201],i;\n i=0;\n scanf(\"%s\",a);\n while(a[i]){\n if(a[i]=='.') { printf(\"0\"); i++; }\n else { \n if(a[i+1]=='.') printf(\"1\");\n else printf(\"2\");\n i+=2;\n}\n }\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n\nint main(void)\n{\n char str[200];\n\n scanf(\"%s\", &str);\n\n int size = sizeof(str) / sizeof(str[0]);\n\n for(int i = 0; i < size; i++)\n {\n if(str[i] == '.')\n {\n printf(\"0\");\n }\n else if(str[i] == '-' && str[i+1] == '.')\n {\n printf(\"1\");\n i++;\n }\n else if(str[i] == '-' && str[i+1] == '-')\n {\n printf(\"2\");\n i++;\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n char s[201],i;\n gets(s);\n for(i=0;i<='\\0';i++)\n {\n if(s[i]=='.')\n {\n printf(\"0\");\n }\n else if(s[i]=='-' && s[i+1]=='.')\n {\n printf(\"1\");\n }\n else if(s[i]=='-' && s[i+1]=='-')\n {\n printf(\"2\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n\n int a,i,k=0,d;\n int ara[150];\n char s[150];\n scanf(\"%d\",&a);\n scanf(\"%s\",&s);\n for(i=0;i\n#include\n#include\n\nint main()\n{\nchar ch[250];\ngets(ch);\nint s=0,c=0,a,p,l[200];\np=strlen(ch);\nfor(int i=0;i\n#define size 100\nint main()\n{\n int i;\n char str[size], s[size];\n gets(s);\n \n \n for(int i=0;i\n#include\n#include\n\nint main()\n{ \t\n\tchar bor[201],c=0;\n\tint code[201];\n\tscanf(\"%s\",bor);\n\tint i=1;\n\twhile(i\n#include\nint main()\n{\n\tchar input[205];\n\tscanf(\"%s\",input);\n\tint len = strlen(input);\n\tint count = 0;\n\tfor(int i = 0;i\n#include \nint main()\n{\n int i=0,n,m=0;\n char name[3];\n scanf(\"%s\",name);\n \n char new[6];\n n=strlen(name);\n while(i<=n-1)\n {\n if(name[i]=='.')\n {\n new[m]='0';\n i++;\n m++;\n }\n else if(name[i]='-')\n {\n if(name[i+1]='.')\n {\n new[m]='1';\n m++;\n i=i+2;\n }\n else if(name[i+1]='-')\n {\n new[m]='2';\n m++;\n i=i+2;\n }\n \n }\n }\n new[m+1]='\\0';\n printf(\"%s\",new);\n \n \n}\n"}, {"source_code": "#include\nint main(){\n \n\tchar s[250] = { '.', '-.', '--' };\n\tscanf(\"%s\", s);\n\tfor (int i = 0; i <=5; i++){\n\t\tif (s[i] == '.'){\n\t\t\tprintf(\"0\");\n\n\t\t}\n\t\telse if (s[i] == '-'&&s[i+1]=='.'){\n\t\t\tprintf(\"1\");\n\t\t\t \ti++;\n\n\t\t}\n\t\telse if (s[i] == '-'&&s[i+1]=='-'){\n\t\t\tprintf(\"2\");\n\t\t\t\n\t\t\t \ti++;\n\n\t\t}\n\t}\n\n\t\treturn 0;\n\t\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int i,str;\n char s[100];\n gets(s);\n \n \n for(int i=0;i<100;i++)\n\n {\n\t if(s[i]=='.')\n\t {\n\t\tstr+='0';\n\t }\n\t if(s[i]=='-'&&s[i+1]=='.')\n\t {\n\t\tstr+='1';\n\t\t++i;\n\t }\n\t if(s[i]=='-'&&s[i+1]=='-')\n\t {\n\t\tstr+='2';\n\t\t++i;\n\t }\n }\n\tprintf(\"%s\",str);\n\treturn 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 \n#include\nint main()\n{ char str[201]; \n int arr[strlen(str)],index=0;\n scanf(\"%s\",str); \n \n \n for(int i=0;i\n#include\n\nint main()\n{\n char a[210];\n int n,i;\n for(i=0;i<210;i++)\n {\n a[i]='0';\n }\n gets(a);\n for(i=0;a[i]!='\\0';i++)\n {\n n=i+1;\n }\n /* '.' = 0\n '-.'= 1\n '--'= 2\n */\n for(i=0;i\n\nint main(void)\n{\n char str[200];\n\n scanf(\"%s\", &str);\n\n int size = sizeof(str) / sizeof(str[0]);\n\n for(int i = 0; i < size; i++)\n {\n if(str[i] == '.')\n {\n printf(\"0\");\n }\n else if(str[i] == '-' && str[i+1] == '.')\n {\n printf(\"1\");\n i+=2;\n continue;\n }\n else if(str[i] == '-' && str[i+1] == '-')\n {\n printf(\"2\");\n i+=2;\n continue;\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include\nmain()\n{\n int i;\n char x[201];\n scanf(\"%s\",x);\n\n\n\n if(x[0]=='.')\n {\n printf(\"0\");\n for(i=0;i<201;i++)\n {\n\n\n if(x[i]=='-'&&x[i+1]=='.'&&x[i-1]!='-')\n {\n printf(\"1\");\n }\n if(x[i]=='.'&&x[i+1]=='.')\n {\n printf(\"0\");\n }\n if(x[i]=='-'&&x[i+1]=='-'&x[i+2]=='-')\n {\n printf(\"2\");\n }\n if(x[i]=='.'&&x[i+1]=='\\0')\n {\n printf(\"0\");\n }\n }\n }\n if(x[0]!='.')\n {\n for(i=0;i<201;i++)\n {\n\n\n if(x[i]=='.'&&x[i+1]=='.')\n {\n printf(\"0\");\n }\n if(x[i]=='-'&&x[i+1]=='.'&&x[i-1]!='-')\n {\n printf(\"1\");\n }\n if(x[i]=='-'&&x[i+1]=='-')\n {\n printf(\"2\");\n }\n if(x[i]=='.'&&x[i+1]=='\\0')\n {\n printf(\"0\");\n }\n }\n }\n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n char s[100];\n int i,l;\n scanf(\"%s\",&s);\n l=strlen(s);\n for(i=0;i\n#include\nint main()\n{\n char ch[210];\n gets(ch);\n int l=strlen(ch),i;\n for(i=0;i<=201;i++)\n {\n if(ch[i]=='.') printf(\"0\");\n else if(ch[i]=='-' && ch[i+1]=='-') {printf(\"1\"); i++;}\n else if(ch[i]=='-' && ch[i+1]=='-') {printf(\"2\"); i++;}\n else break;\n }\n}"}, {"source_code": "#include\nint main(void){\n char c[500];\n gets(c);\n if(c[0] == '.'){\n printf(\"0\");\n }\n for(int i = 0;i < 500;i++){\n if(c[i] == '-'){\n if(c[i+1] == '.'){\n printf(\"1\");\n i++;\n }\n else{\n printf(\"2\");\n i++;\n }\n }\n else if(c[i] == '.' && i != 0){\n printf(\"0\");\n }\n }\n return 0;\n}\n\n"}, {"source_code": "#include\n#include\nint main()\n{\n int i,l;\n char s[1000];\n scanf(\"%s\",s);\n l=strlen(s);\n for(i=0;i\n\nint main(void)\n{\n char str[200];\n\n scanf(\"%s\", &str);\n\n int size = sizeof(str) / sizeof(str[0]);\n\n for(int i = 0; i < size; i++)\n {\n if(str[i] == '.')\n {\n printf(\"0\");\n }\n else if(str[i] == '-' && str[i+1] == '.')\n {\n printf(\"1\");\n i++;\n continue;\n }\n else if(str[i] == '-' && str[i+1] == '-')\n {\n printf(\"2\");\n i++;\n continue;\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\nint main()\n{int n,i,a=0,b=1,c=2;\nchar arr[200];\nscanf(\"%s\",arr);\nfor (i=0;i\n#include \nint main ()\n{\n char str[100];\n gets(str);\n int i, l=strlen(str);\n for(i=0; i\n#include\n#include\n\n\nint main(){\n char x[200];\n scanf(\"%s\",x);\n //printf(\"%s\",x);\n int len=strlen(x);\n int y[len];\n //printf(\"%d %d\",'-','.');\n for(int i=0;i\n#include\nint main (){\n\nchar s[200];\n\nscanf(\"%s\",&s);\n\nfor(int i=0;i\n\nint main(void)\n{\n char str[200];\n\n scanf(\"%s\", &str);\n\n int size = sizeof(str) / sizeof(str[0]);\n\n for(int i = 0; i < size; i++)\n {\n if(str[i] == '.')\n {\n printf(\"0\");\n }\n else if(str[i] == '-' && str[i+1] == '.')\n {\n printf(\"1\");\n i++;\n }\n else if(str[i] == '-' && str[i+1] == '-')\n {\n printf(\"2\");\n i++;\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main(){\n\tchar test[1000],hasil[1000];\n\t\n\tgets(test);\n\t\n\tint len = strlen(test);\n\tint i,j=0;\n\t\n\tfor(i=0;i\n main()\n {\n int i,sum[201]={0};\n char x[201];\n scanf(\"%s\",x);\n \n for(i=0;i<201;i++)\n {\n if(x[i]=='.')\n {\n printf(\"0\");\n }\n if(x[i]=='-'&&x[i+1]=='.')\n {\n printf(\"1\");\n i++;\n }\n if(x[i]=='-'&&x[i+1]=='-')\n {\n printf(\"2\");\n i++;\n \n }\n }\n return 0;\n }\n "}, {"source_code": "#include \n#include \n\nint main(){\n\nint i,j = 0;\nchar a[201], b[201];\nscanf(\"%s\", a);\nfor(i = 0; i < strlen(a); i++){\n if(a[i] == '.'){\n b[j] = '0';\n j = j + 1;\n }\n if(a[i] == '-'){\n if(a[i+1] == '.'){\n b[j] = '1';\n j = j + 1;\n }\n else if(a[i+1] == '-'){\n b[j] = '2';\n j = j + 1;\n }\n i = i + 1;\n }\n}\nprintf(\"%s\\n\", b);\n\nreturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{ \n int n,j;\n char crypt[n] ;\n gets(crypt);\n n=strlen(crypt);\n for(j = 0 ; j\nint main() {\n int count=0;\n signed char ch;\n ch=getchar();\n while (ch!=EOF) {\n if (ch=='.') {\n printf(\"%d\",count);\n count=0;\n } else if (ch=='-') {\n count++;\n }\n ch=getchar();\n }\n printf(\"%d\",count);\n return 0;\n}"}, {"source_code": "#include\nint main()\n{\n int i=0,j=0;\n char str[201];\n char str1[201];\n scanf(\"%s\",str);\n while(str[i]!='\\0')\n {\n if(str[i]=='.') {str1[j]='0'; j++; i++;}\n else if(str[i]=='-')\n {\n if(str[i+1]=='.') {\n str1[j]='1';\n j++;\n i=i+2;\n }\n else if(str[i+1]=='-')\n {\n str1[j]='2';\n j++;\n i=i+2;}\n else if(str[i+1]=='\\0') break;\n }\n }\n printf(\"%s\\n\",str1);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main(void){\n char c[200];\n gets(c);\n int k = strlen(c);\n for(int i=0;i\n#include\nint main()\n{\n int i,n,a;\n char s[100];\n scanf(\"%s\",s);\n n=strlen(s);\n for(i=0;i\n#include\nint main()\n{\n\tchar input[205];\n\tscanf(\"%s\",input);\n\tint len = strlen(input);\n\tint count = 0;\n\tint flag = 0;\n\tfor(int i = 0;i\n#include\n\nmain()\n{\n char c[210];\n int i,len=0;\n gets(c);\n for(i=0;c[i]!='\\0';++i) {\n if(c[i]=='.') {\n printf(\"%d\",len);\n len=0;\n }\n else len++;\n }\n printf(\"%d\\n\",len);\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#define inout\nint cnt;\nint main()\n{\n// #ifdef inout\n// \tfreopen(\"input.txt\", \"r++\", stdin);\n// \tfreopen(\"output.out\", \"w++\", stdout);\n// #endif\n\tint i, n;\n\tchar num[200];\n\tscanf(\"%s\", num);\n\tn = strlen(num);\n\tchar num2[n + 1];\n\tfor (i = 0; i < n; i++)\n\t{\n\t\tif (num[i] == '.')\n\t\t{\n\t\t\tnum2[cnt++] = '0';\n\n\t\t}\n\t\telse if (num[i] == '-' && num[i + 1] == '.')\n\t\t{\n\t\t\tnum2[cnt++] = '1';\n\t\t\ti++;\n\t\t}\n\t\telse if (num[i] == '-' && num[i + 1] == '-')\n\t\t{\n\t\t\tnum2[cnt++] = '2';\n\t\t\ti++;\n\t\t}\n\t}\n\tprintf(\"%s\\n\", num2);\n\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n\tchar input[205];\n\tscanf(\"%s\",input);\n\tint len = strlen(input);\n\tint count = 0;\n\tint flag = 0;\n\tfor(int i = 0;i\n#include\nint main()\n{\n\tint i,n;\n\tchar str[200];\n\tscanf(\"%s\",&str);\n n=strlen(str);\n for(i=0;i\n#include \n#include \n\nint main()\n{\n\tchar a[201];\n\tint i;\n\tfgets(a,200,stdin);\n\tfor(i = 0; i < strlen(a);i++)\n\t{\n\t\tif(a[i] == '.' /*&& a[i-1] != '-'*/)\n\t\t{\n\t\tprintf(\"0\");\n\t\tcontinue;\n\t\t}\n\t\tif(a[i] == '-' && a[i+1] == '-')\n\t\t{\n\t\tprintf(\"2\");\n\t\ti++;\n\t\tcontinue;\n\t\t\n\t}\n\tif(a[i] == '-' && a[i+1] == '.')\n\t\t{\n\t\tprintf(\"1\");\n\t\ti++;\n\t\tcontinue;\n\t}\n\t\t\n\t\t\n\t\t\n\t\t}\n\treturn 0;\n\t}\n"}, {"source_code": "#include\n#include\nint main()\n{\n char a[201];\n\tscanf(\"%s\",&a);\n\t\n\tint i,l;\n\tl=strlen(a);\n\tfor(i=0;i\n#include\nint main()\n{\n int i;\n char s[200];\n gets(s);\n int l=strlen(s);\n if(s[0]=='.'&&l==1)\n printf(\"0\");\n for(i=0;i\n#include \nint main(){\nchar arr[201];\nint b;\nscanf(\"%s\",&arr);\nb=strlen(arr);\nfor (int i=0;i\n\nint main(void) {\n\tint i,l;\n\tchar a[200];\n\tscanf(\"%s\",a);\n\tfor (i = 0; a[i] != '\\0'; i++);\n\tl=i;\n\t\n\tfor(i=0; i\n\nint main()\n{\n\tchar string_in[201]={0},string_out[201]={0};\n\tchar i = 0,g = 0;\n\tscanf(\"%s\",string_in);\n\tdo{\n\t\tif (string_in[i] == '.')\n\t\t{\n\t\t\tstring_out[g] = '0';\n\t\t\ti++;g++;\n\t\t}\n\t\telse if (string_in[i] == '-')\n\t\t{\n\t\t\tif (string_in[i+1] == '.') /* '-.' >>>>>1*/\n\t\t\t{\n\t\t\t\tstring_out[g] = '1';\n\t\t\t\tg++;i+=2;\n\t\t\t}\n\t\t\telse if (string_in[i+1] == '-')\n\t\t\t{\n\t\t\t\tstring_out[g] = '2';\n\t\t\t\tg++;i+=2;\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\n\t}while (string_in[i] !=0);\n\t\n\tstring_out[g] = 0;\n\t\n\tprintf(\"%s\",string_out);\n\n\n\n\n\n\n\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n char a[201],b[201];\n int i=0,j=0;\n gets(a);\n while(a[i]!='\\0')\n {\n if(a[i]=='.')\n {\n b[j]='0';\n i++;\n j++;\n }\n else if(a[i]=='-' && a[i+1]=='.')\n {\n b[j]='1';\n j++;\n i+=2;\n }\n else if(a[i]=='-' && a[i+1]=='-')\n {\n b[j]='2';\n j++;\n i+=2;\n }\n }\nprintf(\"%s\",b);\nreturn 0;\n}\n "}, {"source_code": "#include \n\nint main(void)\n{\n char str[201];\n fflush(stdin);\n scanf(\"%s\", &str);\n\n int size = sizeof(str) / sizeof(str[0]);\n\n for(int i = 0; i <= size; i++)\n {\n if(str[i] == '.')\n {\n printf(\"0\");\n }\n else if(str[i] == '-' && str[i+1] == '.')\n {\n printf(\"1\");\n i++;\n }\n else if(str[i] == '-' && str[i+1] == '-')\n {\n printf(\"2\");\n i++;\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#define size 100\nint main()\n{\n int i;\n char str[size], s[size];\n gets(s);\n \n \n for(int i=0;i\n#include\nint main()\n{\n int i;\n char A[200];\n \n for(i=0;i<200;i++)\n {\n scanf(\"%c \",&A[i]);\n }\n for(i=0;i<200;i++)\n {\n if(A[i]=='.')\n {\n printf(\"0\");\n }\n else if(A[i]=='-')\n {\n if(A[i+1]=='.')\n {\n printf(\"1\");\n i++;\n }\n else\n {\n printf(\"2\");\n i++;\n }\n }\n }\nreturn 0;\n \n}"}, {"source_code": "#include\nmain()\n{\n int i;\n char x[201];\n scanf(\"%s\",x);\n\n\n\n if(x[0]=='.')\n {\n printf(\"0\");\n for(i=0;i<201;i++)\n {\n\n\n if(x[i]=='-'&&x[i+1]=='.'&&x[i-1]!='-')\n {\n printf(\"1\");\n }\n if(x[i]=='.'&&x[i+1]=='.')\n {\n printf(\"0\");\n }\n if(x[i]=='-'&&x[i+1]=='-'&x[i+2]=='-')\n {\n printf(\"2\");\n }\n if(x[i]=='.'&&x[i+1]=='\\0')\n {\n printf(\"0\");\n }\n }\n }\n if(x[0]!='.')\n {\n for(i=0;i<201;i++)\n {\n\n\n if(x[i]=='.'&&x[i+1]=='.')\n {\n printf(\"0\");\n }\n if(x[i]=='-'&&x[i+1]=='.'&&x[i-1]!='-')\n {\n printf(\"1\");\n }\n if(x[i]=='-'&&x[i+1]=='-')\n {\n printf(\"2\");\n }\n if(x[i]=='.'&&x[i+1]=='\\0')\n {\n printf(\"0\");\n }\n }\n }\n\n\n\n\n return 0;\n}\n"}, {"source_code": " #include\n main()\n {\n int i,sum[201]={0};\n char x[201];\n scanf(\"%s\",x);\n \n for(i=0;i<201;i++)\n {\n if(x[i]=='.')\n {\n printf(\"0\");\n }\n if(x[i]=='-'&&x[i+1]=='.')\n {\n printf(\"1\");\n i++;\n }\n if(x[i]=='-'&&x[i+1]=='-')\n {\n printf(\"2\");\n i++;\n \n }\n }\n return 0;\n }"}, {"source_code": "#include\n#include\nint main()\n{\n int i;\n char A[200];\n \n for(i=0;i<200;i++)\n {\n scanf(\"%c \",&A[i]);\n }\n for(i=0;i<200;i++)\n {\n if(A[i]=='.')\n {\n printf(\"0\");\n break;\n }\n else if(A[i]=='-')\n {\n if(A[i+1]=='.')\n {\n printf(\"1\");\n break;\n }\n else\n {\n printf(\"2\");\n break;\n }\n }\n }\nreturn 0;\n \n}"}, {"source_code": "#include\n#include\n#include\n\nint main()\n{\nchar ch[250];\ngets(ch);\nint s=0,c=0,a,p,l[200];\np=strlen(ch);\nfor(int i=0;i\n#include\n#define size 100\nint main()\n{\n int i;\n char str[size], s[size];\n gets(s);\n \n \n for(int i=0;i\n\nint main(void)\n{\n char str[200];\n\n scanf(\"%s\", &str);\n\n int size = sizeof(str) / sizeof(str[0]);\n\n for(int i = 0; i <= size; i++)\n {\n if(str[i] == '.')\n {\n printf(\"0\");\n }\n else if(str[i] == '-' && str[i+1] == '.')\n {\n printf(\"1\");\n i++;\n }\n else if(str[i] == '-' && str[i+1] == '-')\n {\n printf(\"2\");\n i++;\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n int i=0,n,m=0;\n char name[3];\n scanf(\"%s\",name);\n \n char new[6];\n n=strlen(name);\n while(i<=n-1)\n {\n if(name[i]=='.')\n {\n new[m]='0';\n i++;\n m++;\n }\n else if(name[i]='-')\n {\n if(name[i+1]='.')\n {\n new[m]='1';\n m++;\n i=i+2;\n }\n else if(name[i+1]='-')\n {\n new[m]='2';\n m++;\n i=i+2;\n }\n \n }\n }\n new[m+1]='\\0';\n printf(\"%s\",new);\n \n \n}\n"}, {"source_code": "#include \n#include \nint main()\n{\n int i,j,k,a,b=0;\n char x[1000],y[1000];\n scanf(\"%s\",x);\n a=strlen(x);\n for(i=0;i\n#define size 100\nint main()\n{\n int i;\n char str[size], s[size];\n gets(s);\n \n \n for(int i=0;i\n\nint main()\n{\n\tchar string_in[200]={0},string_out[200]={0};\n\tchar i = 0,g = 0;\n\tscanf(\"%s\",string_in);\n\tdo{\n\t\tif (string_in[i] == '.')\n\t\t{\n\t\t\tstring_out[g] = '0';\n\t\t\ti++;g++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (string_in[i+1] == '.') /* '-.' >>>>>1*/\n\t\t\t{\n\t\t\t\tstring_out[g] = '1';\n\t\t\t\tg++;i+=2;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tstring_out[g] = '2';\n\t\t\t\tg++;i+=2;\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\n\t}while (string_in[i] !=0);\n\t\n\tstring_out[g] = 0;\n\t\n\tprintf(\"%s\",string_out);\n\n\n\n\n\n\n\n\treturn 0;\n}"}, {"source_code": "#include\n\nint main(){\n\n char str[201];\n int d=0,i=0;\n scanf(\"%s\",str);\n while(str[i]){\n\n if(str[i]=='.'){\n d=10*d+0;\n i++;\n }\n else if(str[i]=='-' && str[i+1]=='.'){\n d=10*d+1;\n i+=2;\n }\n else{\n d=10*d+2;\n i+=2;\n }\n }\n printf(\"%d\",d);\n\n\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n char s[201];\n int count=0, i ,p ;\n gets(s);\n for(i=0 ; i2)\n {\n count=count-2;\n p=2;\n printf(\"%d\",p);\n printf(\"%d\",count);\n count=0;\n\n }\n else{\n printf(\"%d\",count);\n count=0;\n }\n\n }\n\n }\nprintf(\"%d\",count);\n\n\n return 0;\n}\n"}, {"source_code": "#include\n\nint main(void)\n{\n int i=0;\n char a[500];\n scanf(\"%s\" ,a);\n for(i=0;i<500;i++)\n {\n if (a[i]=='.' && a[i+1]=='-')\n {\n printf(\"0\");\n }\n else if(a[i]=='-')\n {\n if (a[i+1]=='.')\n {\n printf(\"1\");\n i++;\n }\n\n else if (a[i+1]=='-')\n {\n printf(\"2\");\n i++;\n }\n\n }\n else\n break;\n\n }\n}"}, {"source_code": "#include \n#include \n#include \n\n\nint main(void)\n{\n char str[201];\n fflush(stdin);\n scanf(\"%s\", &str);\n\n int size = sizeof(str) / sizeof(str[0]);\n\n for(int i = 0; i <= size; i++)\n {\n if(str[i] == '.')\n {\n printf(\"0\");\n }\n else if(str[i] == '-' && str[i+1] == '.')\n {\n printf(\"1\");\n i++;\n }\n else if(str[i] == '-' && str[i+1] == '-')\n {\n printf(\"2\");\n i++;\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include\nmain()\n{\n int i,sum[201]={0};\n char x[201];\n scanf(\"%s\",x);\n\n for(i=0;i<201;i++)\n {\n if(x[i]=='.')\n {\n printf(\"0\");\n }\n if(x[i]=='-'&&x[i+1]=='.')\n {\n printf(\"1\");\n i++;\n }\n if(x[i]=='-'&&x[i+1]=='-')\n {\n printf(\"2\");\n i++;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n\nint main()\n{\n int i,l;\n char ara[9910];\n scanf(\"%s\",&ara);\n\n l=strlen(ara);\n printf(\"%d\",l);\n\n for(i=0;i\n#include \nint main(){\nchar arr[201];\nint b;\nscanf(\"%s\",&arr);\nb=strlen(arr);\nfor (int i=0;i\nint main()\n{\n char str[201];\n int i;\n scanf(\"%s\",str);\n for(i=0;str[i]!='\\0';i++)\n {\n if((str[i]=='.'&&str[i+1]=='-'&&str[i+2]!='-')||(str[i]=='.'&&str[i+1]=='\\0'))\n printf(\"0\");\n else if(str[i]=='-'&&str[i+1]=='.')\n {\n printf(\"1\");\n i++;\n }\n else if(str[i]=='-'&&str[i+1]=='-')\n {\n printf(\"2\");\n i++;\n }\n }\n printf(\"\\n\");\n}"}, {"source_code": "#include\n#include\nint main()\n{\n int i;\n char s[200];\n gets(s);\n int l=strlen(s);\n if(s[0]=='.')\n printf(\"0\");\n for(i=0;i\n#include \n#include \nint main()\n{\n char the[200];\n char thi[200];\n int i =0;\n int f = -1;\n scanf(\"%s\",the); \n while (i< (strlen(the))){\n if (the[i]=='-' && the[i+1]=='.'){\n f+=1;\n thi[f]='1';\n i+=2;\n }\n else if (the[i]=='-' && the[i+1]=='-'){\n f+=1;\n thi[f]='2';\n i+=2;\n \n }\n else if (the[i]=='.'){\n f+=1;\n thi[f]='0';\n i+=1;\n }\n\n }\n printf(\"%s\",thi);\n return 0;\n}"}, {"source_code": "#include\n\nint main(void)\n{\n\tchar a[201],b[200];\n\tint i,j=0,k;\n\tscanf(\"%s\",a);\n\tfor(i=0;a[i]!='\\0';)\n\t{\n\t\tif(a[i]=='-'&&a[i+1]=='.')\n\t\t{\n\t\t\tb[j]='1';\n\t\t\tj++;\n\t\t\ti=i+2;\n\t\t}\n\t\tif(a[i]=='-'&&a[i+1]=='-')\n\t\t{\n\t\t\tb[j]='2';\n\t\t\tj++;\n\t\t\ti=i+2;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tb[j]='0';\n\t\t\tj++;\n\t\t\ti++;\n\t\t}\n\t}\n\tprintf(\"%s\",b);\n}\n"}, {"source_code": "#include\n#include\n#include\n\nint main()\n{ \t\n\tchar bor[201],c=0;\n\tint code[201];\n\tscanf(\"%s\",bor);\n\tint i=0;\n\twhile(i\n#include\n#include\n#include\n\nint main()\n{\n int i,l;\n char ara[9910];\n scanf(\"%s\",&ara);\n\n l=strlen(ara);\n printf(\"%d\",l);\n\n for(i=0;i\n#include \n#include \n\nint main()\n{\n\tchar a[201];\n\tint i;\n\tfgets(a,200,stdin);\n\tfor(i = 0; i < strlen(a);i++)\n\t{\n\t\tif(a[i] == '.' /*&& a[i-1] != '-'*/)\n\t\t{\n\t\tprintf(\"0\");\n\t\tcontinue;\n\t\t}\n\t\tif(a[i] == '-' && a[i+1] == '-')\n\t\t{\n\t\tprintf(\"2\");\n\t\ti++;\n\t\tcontinue;\n\t\t\n\t}\n\tif(a[i] == '-' && a[i+1] == '.')\n\t\t{\n\t\tprintf(\"1\");\n\t\ti++;\n\t\tcontinue;\n\t}\n\t\t\n\t\t\n\t\t\n\t\t}\n\treturn 0;\n\t}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int i;\n char str[205];\n scanf(\"%s\", str);\n int l = strlen(str);\n\n\n for(i=0; i\nint main()\n{\n char str[1000],i;\n scanf(\"%s\",str);\n for(i=0;i<=strlen(str);i++)\n {\n if(str[i]=='.')\n printf(\"0\");\n else if(str[i]=='-' && str[i+1]=='.'){\n printf(\"1\");i++;}\n else if(str[i]=='-' && str[i+1]=='-'){\n printf(\"2\");i++;}\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \n#include \nint main()\n{\n char the[100];\n char thi[100];\n int i =0;\n int f = -1;\n scanf(\"%s\",the); \n while (i< (strlen(the))){\n if (the[i]=='-' && the[i+1]=='.'){\n f+=1;\n thi[f]='1';\n i+=2;\n }\n else if (the[i]=='-' && the[i+1]=='-'){\n f+=1;\n thi[f]='2';\n i+=2;\n \n }\n else if (the[i]=='.'){\n f+=1;\n thi[f]='0';\n i+=1;\n }\n\n }\n printf(\"%s\",thi);\n return 0;\n}"}, {"source_code": "#include \n\nint main(int argv, char *argc[]){\n\n\tchar S[256];\n\tscanf(\"%s\",S);\n\n\tfor(int i = 0; S[i] != '\\0'; i++){\n\t\tif(S[i] == '.'){\n\t\t\tprintf(\"0\");\n\t\t}\n\t\telse{\n\t\t\tif(S[i+1] == '.'){\n\t\t\t\tprintf(\"1\");\n\t\t\t\ti++;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tprintf(\"2\");\n\t\t\t\ti++;\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\t} \n\n\tprintf(\"\\n\");\n\treturn 0;\n}"}, {"source_code": "#include \nint main()\n{\n char s[201],i;\n gets(s);\n for(i=0;i<='\\0';i++)\n {\n if(s[i]=='.')\n {\n printf(\"0\");\n }\n else if(s[i]=='-' && s[i+1]=='.')\n {\n printf(\"1\");\n }\n else if(s[i]=='-' && s[i+1]=='-')\n {\n printf(\"2\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main()\n{\n int i;\n char A[200];\n \n for(i=0;i<200;i++)\n {\n scanf(\"%c \",&A[i]);\n }\n for(i=0;i<200;i++)\n {\n if(A[i]=='.')\n {\n printf(\"0\");\n }\n else if(A[i]=='-')\n {\n if(A[i+1]=='.')\n {\n printf(\"1\");\n i++;\n }\n else\n {\n printf(\"2\");\n i++;\n }\n }\n }\nreturn 0;\n \n}"}, {"source_code": "#include \n\nint main()\n{\n\tchar code[200];\n\tprintf(\"Code = \\n\"); //debug\n\tscanf(\"%s\",&code[0]);\n\tchar decode[100];\n\tint i=0;\n\twhile(code[i] != '\\0'){\n\t\tif(code[i] == '.'){\n\t\t\tprintf(\"0\");\n\t\t\ti+=1;\n\t\t}\n\t\telse if((code[i] == '-') && (code[(i+1)] == '.')){\n\t\t\tprintf(\"1\");\n\t\t\ti+=2;\n\t\t}\n\t\telse if((code[i] == '-') && (code[(i+1)] == '-')){\n\t\t\tprintf(\"2\");\n\t\t\ti+=2;\n\t\t}\n\t}\n\tprintf(\"\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n#define size 200\nint main()\n{\n int i;\n char str[size], s[size];\n gets(s);\n \n \n for(int i=0,k=0;i\n#include \nint main()\n{\n int i=0,n,m=0;\n char name[3];\n scanf(\"%s\",name);\n \n char new[6];\n n=strlen(name);\n while(i<=n-1)\n {\n if(name[i]=='.')\n {\n new[m]='0';\n i++;\n m++;\n }\n else if(name[i]='-')\n {\n if(name[i+1]='.')\n {\n new[m]='1';\n m++;\n i=i+2;\n }\n else if(name[i+1]='-')\n {\n new[m]='2';\n m++;\n i=i+2;\n }\n \n }\n }\n new[m]='\\0';\n printf(\"%s\",new);\n \n \n}\n"}, {"source_code": " #include \n #include \n int main()\n {\n char s[200];\n scanf(\"%s\",s);\n int i;\n for(i=0;i\n\nint main()\n{\n\tchar string_in[201]={0},string_out[201]={0};\n\tchar i = 0,g = 0;\n\tscanf(\"%s\",string_in);\n\tdo{\n\t\tif (string_in[i] == '.')\n\t\t{\n\t\t\tstring_out[g] = '0';\n\t\t\ti++;g++;\n\t\t}\n\t\telse if (string_in[i] == '-')\n\t\t{\n\t\t\tif (string_in[i+1] == '.') /* '-.' >>>>>1*/\n\t\t\t{\n\t\t\t\tstring_out[g] = '1';\n\t\t\t\tg++;i+=2;\n\t\t\t}\n\t\t\telse if (string_in[i+1] == '-')\n\t\t\t{\n\t\t\t\tstring_out[g] = '2';\n\t\t\t\tg++;i+=2;\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\n\t}while (string_in[i] !=0);\n\t\n\tstring_out[g] = 0;\n\t\n\tprintf(\"%s\",string_out);\n\n\n\n\n\n\n\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n int i;\n char s[200];\n gets(s);\n int l=strlen(s);\n if(s[0]=='.')\n printf(\"0\");\n else{\n for(i=0;i\n main()\n {\n\n\n int i,sum[201]={0};\n \n char x[201];\n\n scanf(\"%s\",x);\n \n\n for(i=0;i<201;i++)\n\n {\n\n if(x[i]=='.')\n\n {\n\n printf(\"0\");\n\n }\n\n if(x[i]=='-'&&x[i+1]=='.')\n\n {\n\n printf(\"1\");\n\n i++;\n\n }\n\n if(x[i]=='-'&&x[i+1]=='-')\n\n {\n\n printf(\"2\");\n\n i++;\n\n \n\n }\n\n }\n\n return 0;\n\n }\n\n\n"}, {"source_code": "#include\n#include\nint main()\n{\n char s[201];\n int count=0, i ,p ;\n gets(s);\n for(i=0 ; i2)\n {\n count=count-2;\n p=2;\n printf(\"%d\",p);\n printf(\"%d\",count);\n count=0;\n\n }\n else{\n printf(\"%d\",count);\n count=0;\n }\n\n }\n\n }\nprintf(\"%d\",count);\n\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main()\n{\n char s[200];\n\n gets(s);\n\n int len=strlen(s);\n for(int i=0; i\n#include\nint main()\n{\n int i;\n char A[200];\n \n for(i=0;i<200;i++)\n {\n scanf(\"%c \",&A[i]);\n }\n for(i=0;i<200;i++)\n {\n if(A[i]=='.')\n {\n printf(\"0\");\n }\n else if(A[i]=='-')\n {\n if(A[i+1]=='.')\n {\n printf(\"1\");\n i++;\n }\n else\n {\n printf(\"2\");\n i++;\n }\n }\n }\nreturn 0;\n \n}"}, {"source_code": "#include\nmain()\n{\n int i,sum[201]={0};\n char x[201];\n scanf(\"%s\",x);\n\n for(i=0;i<201;i++)\n {\n if(x[i]=='.')\n {\n printf(\"0\");\n }\n if(x[i]=='-'&&x[i+1]=='.')\n {\n printf(\"1\");\n i++;\n }\n if(x[i]=='-'&&x[i+1]=='-')\n {\n printf(\"2\");\n i++;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\n\nint main()\n{\n char s [ 300 ] , r [ 300 ];\n int i , j ;\n scanf ( \"%s\" , s ) ;\n for ( i = 0 , j = 0 ; i < strlen ( s ) ; i ++ , j ++ )\n {\n if ( s [ i ] == '.' )\n r [ j ] = '0' ;\n if ( s [ i ] == '-' && s [ i + 1 ] == '.' )\n {\n r [ j ] = '1' ;\n i++ ;\n }\n if ( s [ i ] == '-' && s [ i + 1 ] == '-' )\n {\n r [ j ] = '2' ;\n i++;\n }\n }\n printf ( \"%s\" , r ) ;\n return 0;\n}"}, {"source_code": "#include\n#include\n#define size 200\nint main()\n{\n int i;\n char str[size], s[size];\n gets(s);\n \n \n for(int i=0,k=0;i\n#include\nint main()\n{\n int i;\n char s[200];\n gets(s);\n int l=strlen(s);\n if(s[0]=='.')\n printf(\"0\");\n else{\n for(i=0;i\r\n#include \r\n#include \r\n\r\n#define N\t35\r\n#define N_\t((N + 1) / 2)\r\n\r\nunsigned int X;\r\n\r\nvoid srand_() {\r\n\tstruct timeval tv;\r\n\r\n\tgettimeofday(&tv, NULL);\r\n\tX = tv.tv_sec ^ tv.tv_usec | 1;\r\n}\r\n\r\nint rand_() {\r\n\treturn (X *= 3) >> 1;\r\n}\r\n\r\nvoid multiply(char *aa, char *bb, char *md, int n) {\r\n\tstatic char cc[N * 2];\r\n\tint i, j;\r\n\r\n\tmemset(cc, 0, n * 2 * sizeof *cc);\r\n\tfor (i = 0; i < n; i++)\r\n\t\tfor (j = 0; j < n; j++)\r\n\t\t\tif (aa[i] && bb[j])\r\n\t\t\t\tcc[i + j] ^= 1;\r\n\tfor (i = n * 2 - 1; i >= n - 1; i--)\r\n\t\tif (cc[i])\r\n\t\t\tfor (j = 0; j < n; j++)\r\n\t\t\t\tif (md[j])\r\n\t\t\t\t\tcc[i - (n - 1 - j)] ^= 1;\r\n\tmemcpy(aa, cc, n * sizeof *cc);\r\n}\r\n\r\nchar ppp[1 << N_][N]; int n;\r\n\r\nint compare(int i, int j) {\r\n\tint c = memcmp(ppp[i], ppp[j], n * sizeof *ppp[j]);\r\n\r\n\treturn c ? c : i - j;\r\n}\r\n\r\nvoid sort(int *ii, int l, int r) {\r\n\twhile (l < r) {\r\n\t\tint i = l, j = l, k = r, i_ = ii[l + rand_() % (r - l)], tmp;\r\n\r\n\t\twhile (j < k) {\r\n\t\t\tint c = compare(ii[j], i_);\r\n\r\n\t\t\tif (c == 0)\r\n\t\t\t\tj++;\r\n\t\t\telse if (c < 0) {\r\n\t\t\t\ttmp = ii[i], ii[i] = ii[j], ii[j] = tmp;\r\n\t\t\t\ti++, j++;\r\n\t\t\t} else {\r\n\t\t\t\tk--;\r\n\t\t\t\ttmp = ii[j], ii[j] = ii[k], ii[k] = tmp;\r\n\t\t\t}\r\n\t\t}\r\n\t\tsort(ii, l, i);\r\n\t\tl = k;\r\n\t}\r\n}\r\n\r\nint search(int *ii, int m, char *pp) {\r\n\tint lower = -1, upper = m;\r\n\r\n\twhile (upper - lower > 1) {\r\n\t\tint i = (lower + upper) / 2;\r\n\r\n\t\tif (memcmp(ppp[ii[i]], pp, n * sizeof *ppp[ii[i]]) >= 0)\r\n\t\t\tupper = i;\r\n\t\telse\r\n\t\t\tlower = i;\r\n\t}\r\n\treturn upper < m && memcmp(pp, ppp[ii[upper]], n * sizeof *ppp[ii[upper]]) == 0 ? ii[upper] : -1;\r\n}\r\n\r\nint main() {\r\n\tstatic char cc_[N + 1], *cc, md[N], xx[N], vv[N], pp[N], pp_[N];\r\n\tstatic int rr[1 << N_];\r\n\tint n_, p, q, r, i, j, one;\r\n\tchar tmp;\r\n\r\n\tsrand_();\r\n\tscanf(\"%s\", cc_), n = strlen(cc_);\r\n\tp = 0;\r\n\twhile (p < n && cc_[p] == '0')\r\n\t\tp++;\r\n\tif (p == n) {\r\n\t\tprintf(\"-1\\n\");\r\n\t\treturn 0;\r\n\t}\r\n\tcc = cc_ + p, n -= p;\r\n\twhile (cc[n - 1] == '0')\r\n\t\tn--;\r\n\tif (n == 1) {\r\n\t\tprintf(\"%d %d\\n\", p + 1, p + 2);\r\n\t\treturn 0;\r\n\t}\r\n\tn_ = (n + 1) / 2;\r\n\tcc[n] = 0;\r\n\tfor (i = 0, j = n - 1; i < j; i++, j--)\r\n\t\ttmp = cc[i], cc[i] = cc[j], cc[j] = tmp;\r\n\tfor (i = 0; i < n; i++)\r\n\t\tmd[i] = cc[i] - '0';\r\n\tfor (j = 0; j < n - 1; j++)\r\n\t\tvv[j] = md[j + 1];\r\n\tmemset(pp, 0, n * sizeof *pp), pp[0] = 1;\r\n\tfor (r = 0; r < 1 << n_; r++) {\r\n\t\tmemcpy(ppp[r], pp, n * sizeof *pp);\r\n\t\tone = 1;\r\n\t\tfor (i = 0; i < n; i++)\r\n\t\t\tif ((pp[i] == 1) != (i == 0)) {\r\n\t\t\t\tone = 0;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\tif (one && r != 0) {\r\n\t\t\tprintf(\"%d %d\\n\", p + 1, p + 1 + r);\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t\tmultiply(pp, vv, md, n);\r\n\t}\r\n\tfor (r = 0; r < 1 << n_; r++)\r\n\t\trr[r] = r;\r\n\tsort(rr, 0, 1 << n_);\r\n\tmemset(pp_, 0, n * sizeof *pp_), pp_[0] = 1;\r\n\txx[1] = 1, multiply(xx, pp_, md, n);\r\n\tfor (r = 0; r < 1 << n_; r++)\r\n\t\tmultiply(pp_, xx, md, n);\r\n\tmemset(pp, 0, n * sizeof *pp), pp[0] = 1;\r\n\tfor (q = 1; q <= 1 << n_; q++) {\r\n\t\tmultiply(pp, pp_, md, n);\r\n\t\tif ((r = search(rr, 1 << n_, pp)) != -1) {\r\n\t\t\tprintf(\"%d %lld\\n\", p + 1, p + 1 + ((long long) q << n_) + r);\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t}\r\n\tprintf(\"-1\\n\");\r\n\treturn 0;\r\n}"}], "negative_code": [], "src_uid": "6bf798edef30db7d0ce2130e40084e6b"} {"nl": {"description": "When Valera was playing football on a stadium, it suddenly began to rain. Valera hid in the corridor under the grandstand not to get wet. However, the desire to play was so great that he decided to train his hitting the ball right in this corridor. Valera went back far enough, put the ball and hit it. The ball bounced off the walls, the ceiling and the floor corridor and finally hit the exit door. As the ball was wet, it left a spot on the door. Now Valera wants to know the coordinates for this spot.Let's describe the event more formally. The ball will be considered a point in space. The door of the corridor will be considered a rectangle located on plane xOz, such that the lower left corner of the door is located at point (0, 0, 0), and the upper right corner is located at point (a, 0, b) . The corridor will be considered as a rectangular parallelepiped, infinite in the direction of increasing coordinates of y. In this corridor the floor will be considered as plane xOy, and the ceiling as plane, parallel to xOy and passing through point (a, 0, b). We will also assume that one of the walls is plane yOz, and the other wall is plane, parallel to yOz and passing through point (a, 0, b).We'll say that the ball hit the door when its coordinate y was equal to 0. Thus the coordinates of the spot are point (x0, 0, z0), where 0 ≤ x0 ≤ a, 0 ≤ z0 ≤ b. To hit the ball, Valera steps away from the door at distance m and puts the ball in the center of the corridor at point . After the hit the ball flies at speed (vx, vy, vz). This means that if the ball has coordinates (x, y, z), then after one second it will have coordinates (x + vx, y + vy, z + vz).See image in notes for clarification.When the ball collides with the ceiling, the floor or a wall of the corridor, it bounces off in accordance with the laws of reflection (the angle of incidence equals the angle of reflection). In the problem we consider the ideal physical model, so we can assume that there is no air resistance, friction force, or any loss of energy.", "input_spec": "The first line contains three space-separated integers a, b, m (1 ≤ a, b, m ≤ 100). The first two integers specify point (a, 0, b), through which the ceiling and one of the corridor walls pass. The third integer is the distance at which Valera went away from the door. The second line has three space-separated integers vx, vy, vz (|vx|, |vy|, |vz| ≤ 100, vy < 0, vz ≥ 0) — the speed of the ball after the hit. It is guaranteed that the ball hits the door.", "output_spec": "Print two real numbers x0, z0 — the x and z coordinates of point (x0, 0, z0), at which the ball hits the exit door. The answer will be considered correct, if its absolute or relative error does not exceed 10  - 6.", "sample_inputs": ["7 2 11\n3 -11 2", "7 2 11\n4 -3 3"], "sample_outputs": ["6.5000000000 2.0000000000", "4.1666666667 1.0000000000"], "notes": "Note"}, "positive_code": [{"source_code": "\n#include\n#include\n#include\n#include\n#include\n#define SORT(a,n) qsort(a,n,sizeof(int),intcmp)\n#define s(n) scanf(\"%d\",&n)\n#define sc(n) scanf(\"%c\",&n)\n#define sl(n) scanf(\"%I64d\",&n)\n#define sf(n) scanf(\"%f\",&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 \n#define MODBY 1000000007\n#define NIL (1e-8)\n\ntypedef long long int lld;\ntypedef float Lf;\n\nint i,j,n;\nLf x,y,z;\nint vix,viy,viz;\nint a,b;\nLf vx,vy,vz;\nLf tmin,t1;\nint cmp(Lf f,Lf s)\n{ return ((fabs(f-s)0){\n tmin=INT_MAX;\n if(vix){\n t1=-x/vx;//x=0 plane\n \n if((t1>0)&&(t10)&&(t10)&&(t10)&&(t10)&&(t1\ndouble a,b,m;\nint vx,vy,vz;\nint main()\n{\n double t,d;\n scanf(\"%lf%lf%lf%d%d%d\",&a,&b,&m,&vx,&vy,&vz);\n t = m/-vy;\n \n d = (vx>0?vx:-vx)*t;\n if(d0?a/2+d:a/2-d);\n else\n {\n for(d-=a/2,vx=-vx;d>a;d-=a,vx=-vx);\n printf(\"%.9f \",vx>0?d:a-d);\n }\n \n d = (vz>0?vz:-vz)*t;\n for(;d>b;d-=b,vz=-vz);\n printf(\"%.9f\",vz>=0?d:b-d);\n \n return 0;\n}"}, {"source_code": "#include \n\nint main() {\n int a, b, m, vx, vy, vz;\n double x0, z0, time;\n\n scanf(\"%d %d %d\", &a, &b, &m);\n scanf(\"%d %d %d\", &vx, &vy, &vz);\n\n time = - (double) m / vy;\n x0 = (double) a / 2 + vx * time;\n x0 = x0 > 0 ? x0 : -x0;\n z0 = vz * time;\n while (x0 >= 2 * a)\n x0 -= 2 * a;\n while (z0 >= 2 * b)\n z0 -= 2 * b;\n x0 = x0 > a ? 2 * a - x0 : x0;\n z0 = z0 > b ? 2 * b - z0 : z0; \n\n printf(\"%.10f %.10f\\n\", x0, z0);\n\n return 0;\n}\n"}, {"source_code": "#include \nint main ()\n{\n\tint a, b, m, vx, vy, vz, i;\n\tdouble x, y, z, t, T;\n\tscanf (\"%d%d%d\", &a, &b, &m);\n\tscanf (\"%d%d%d\", &vx, &vy, &vz);\n\tx = (double)a/2; y = m; z = 0;\n\twhile (y>0.000001)\n\t{\n\t\t//printf (\"%lf %lf %lf %d %d\\n\", x, y, z, vx, vz);\n\t\tT = -1*y/vy;\n\t\tt = -1*x/vx;\n\t\tif (t > 0.000001 && t < T)\n\t\t\tT = t;\n\t\tt = (a-x)/vx;\n\t\tif (t > 0 && t < T)\n\t\t\tT = t;\n\t\tt = -1*z/vz;\n\t\tif (t > 0 && t < T)\n\t\t\tT = t;\n\t\tt = (b-z)/vz;\n\t\tif (t > 0 && t < T)\n\t\t\tT = t;\n\t\tx += vx*T;\n\t\ty += vy*T;\n\t\tz += vz*T;\n\t\tif (x > -0.000001 && x < 0.000001)\n\t\t{\n\t\t\tvx *= -1;\n\t\t\tx = 0;\n\t\t}\n\t\tif (x-a > -0.000001 && x-a < 0.000001)\n\t\t{\n\t\t\tvx *= -1;\n\t\t\tx = a;\n\t\t}\n\t\tif (z > -0.000001 && z < 0.000001)\n\t\t{\n\t\t\tvz *= -1;\n\t\t\tz = 0;\n\t\t}\n\t\tif (z-b > -0.000001 && z-b < 0.000001)\n\t\t{\n\t\t\tvz *= -1;\n\t\t\tz = b;\n\t\t}\n\t}\n\tprintf (\"%lf %lf\\n\", x, z);\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include \n\nint main(){\n\t//freopen(\"in.txt\", \"r\", stdin);\n\tint a, b, m, speedx, speedy, speedz;\n\tscanf(\"%d%d%d%d%d%d\", &a, &b, &m, &speedx, &speedy, &speedz);\n\tdouble posx, posy=m, posz;\n\tdouble costtime = -posy / speedy;\n\tdouble xpass = fabs(speedx * costtime), zpass = fabs(speedz * costtime);\n\tif(speedz == 0)\n\t\tposz = 0;\n\telse{\n\t\tint round = zpass/b;\n\t\tposz = zpass - round*b;\n\t\tif(round%2==1)\n\t\t\tposz = b - posz;\n\t}\n\tif(speedx == 0)\n\t\tposx = 0.5 * a;\n\telse{\n\t\txpass += 0.5 * a;\n\t\tif(speedx < 0)\n\t\t\txpass += a;\n\t\tint round = xpass/a;\n\t\tposx = xpass - round*a;\n\t\tif(round%2==1)\n\t\t\tposx = a - posx;\n\t}\n\tprintf(\"%.8lf %.8lf\\n\", posx, posz);\n\treturn 0;\n}"}, {"source_code": "/*\nID: Sfiction\nOJ: CF128 Div2\nPROB: D\n*/\n#include \nint main()\n{\n double a,b,m,vx,vy,vz;\n double x,z,t;\n scanf(\"%lf%lf%lf\",&a,&b,&m);\n scanf(\"%lf%lf%lf\",&vx,&vy,&vz);\n t=-m/vy;\n x=a/2+t*vx;\n z=t*vz;\n while (x<0||x>a)\n if (x>a) x=2*a-x;\n else x=-x;\n while (z<0||z>b)\n if (z>b) z=2*b-z;\n else z=-z;\n printf(\"%.10lf %.10lf\",x,z);\n return 0;\n}\n"}, {"source_code": "#include\n#include\n\nint main(){\n double a, b, m, vx, vy, vz, x, z, t;\n scanf(\"%lf%lf%lf%lf%lf%lf\", &a, &b, &m, &vx, &vy, &vz);\n t = m / -vy;\n x = a / 2 + vx * t;\n z = vz * t;\n if (x < 0)x = -x;\n if ((int)(x / a) % 2)\n x = a - (x - (int)(x / a) * a);\n else x -= (int)(x / a) * a;\n if ((int)(z / b) % 2)\n z = b - (z - (int)(z / b) * b);\n else z -= (int)(z / b) * b;\n printf(\"%.7lf %.7lf\\n\", x, z);\n scanf(\" \");\n return 0;\n}\n"}], "negative_code": [{"source_code": "\n#include\n#include\n#include\n#include\n#include\n#define SORT(a,n) qsort(a,n,sizeof(int),intcmp)\n#define s(n) scanf(\"%d\",&n)\n#define sc(n) scanf(\"%c\",&n)\n#define sl(n) scanf(\"%I64d\",&n)\n#define sf(n) scanf(\"%Lf\",&n)\n#define ss(n) scanf(\"%s\",n)\n#define 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 \n#define MODBY 1000000007\n#define NIL (1e-8)\n\ntypedef long long int lld;\ntypedef long double Lf;\n\nint i,j,n;\nLf x,y,z;\nint vix,viy,viz;\nint a,b;\nLf vx,vy,vz;\nLf tmin,t1;\nint cmp(Lf f,Lf s)\n{ return ((fabs(f-s)0){\n tmin=INT_MAX;\n if(vix){\n t1=-x/vx;//x=0 plane\n \n if((t1>0)&&(t10)&&(t10)&&(t10)&&(t10)&&(t1\n#include\n#include\n#include\n#include\n#define SORT(a,n) qsort(a,n,sizeof(int),intcmp)\n#define s(n) scanf(\"%d\",&n)\n#define sc(n) scanf(\"%c\",&n)\n#define sl(n) scanf(\"%I64d\",&n)\n#define sf(n) scanf(\"%Lf\",&n)\n#define ss(n) scanf(\"%s\",n)\n#define 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 \n#define MODBY 1000000007\n#define NIL (1e-8)\n\ntypedef long long int lld;\ntypedef long double Lf;\n\nint i,j,n;\nLf x,y,z;\nint vix,viy,viz;\nint a,b;\nLf vx,vy,vz;\nLf tmin,t1;\nint cmp(Lf f,Lf s)\n{ return ((fabs(f-s)0){\n tmin=INT_MAX;\n if(vix){\n t1=-x/vx;//x=0 plane\n if((t1>NIL)&&(t1NIL)&&(t1NIL)&&(t1NIL)&&(t1NIL)&&(t1\ndouble a,b,m;\nint vx,vy,vz;\nint main()\n{\n double t,d;\n scanf(\"%lf%lf%lf%d%d%d\",&a,&b,&m,&vx,&vy,&vz);\n t = m/-vy;\n \n d = (vx>0?vx:-vx)*t;\n if(d0?a/2+d:a/2-d);\n else\n {\n for(d-=a/2,vx=-vx;d>a;d-=a,vx=-vx);\n printf(\"%.9f \",vx>0?d:a-d);\n }\n \n d = (vz>0?vz:-vz)*t;\n for(;d>b;d-=b,vz=-vz);\n printf(\"%.9f\",vz>0?d:b-d);\n \n return 0;\n}"}], "src_uid": "84848b8bd92fd2834db1ee9cb0899cff"} {"nl": {"description": "Santa Claus has n candies, he dreams to give them as gifts to children.What is the maximal number of children for whose he can give candies if Santa Claus want each kid should get distinct positive integer number of candies. Santa Class wants to give all n candies he has.", "input_spec": "The only line contains positive integer number n (1 ≤ n ≤ 1000) — number of candies Santa Claus has.", "output_spec": "Print to the first line integer number k — maximal number of kids which can get candies. Print to the second line k distinct integer numbers: number of candies for each of k kid. The sum of k printed numbers should be exactly n. If there are many solutions, print any of them.", "sample_inputs": ["5", "9", "2"], "sample_outputs": ["2\n2 3", "3\n3 5 1", "1\n2"], "notes": null}, "positive_code": [{"source_code": "#include \n#include \nint main(void) {\n\t// your code goes here\n\tint n,i,k,j,a;\n\tscanf(\"%d\",&n);\n\ta=1+(8*n);\n\ta=sqrt(a);\n\ta=a-1;\n\ta=a/2; //number of elements\n\tk=a;\n\tprintf(\"%d\\n\",k);\n\tif(k==1)\n\t{\n\t\tprintf(\"%d\",n);return 0;\n\t}\n\tint sum=0;\n\tfor(i=1;i<=k;i++)\n\t{\n\t\tif(sum+i>n)\n\t\tbreak;\n\t\tsum=sum+i;\n\t}\n\tif(sum==n)\n\t{\n\t\tfor(j=1;j\nint main()\n{\n long long int n,sum=0,i,sum1=0,j;\n scanf(\"%lld\",&n);\n if(n==1){\n printf(\"1\\n 1\\n\");\n }\n else {\n for(i=0;in)\n break;\n }\n printf(\"%lld\\n\",i-1);\n for(j=1;j\n#include \nint main()\n{\n int n;\n\tscanf(\"%d\",&n);\n\tdouble a;\n\ta=-1+sqrt(1.0+8*n);\n\ta=a/2;\n\tint b;\n\tb=a;\n\tprintf(\"%d\\n\",b);\n\tint x;\n\tx=0;\n\twhile ((--b)>0)\n\t{\n\t x++;\n\t if (x!=1) printf(\" \");\n\t printf(\"%d\",x);\n\t n-=x;\n\t}\n\tif (x!=0) printf(\" \");\n\tprintf(\"%d\\n\",n);\n return 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n int i,n,alpha,last;\n scanf(\"%d\",&n);\n alpha = (-1 + (sqrt(1 + (8*n))))/2;\n last=n-((alpha*(alpha+1))/2) + alpha;\n printf(\"%d\\n\",alpha);\n for(i=1;i\n#include\ntypedef unsigned u;\nu A[1111],Ai;\nint main()\n{\n\tu n,i=1;\n\tfor(scanf(\"%u\",&n);n>(i<<1);)\n\t{\n\t\tn-=A[Ai++]=i++;\n\t}\n\tA[Ai++]=n;\n\tfor(printf(\"%u\\n\",Ai);Ai--;)printf(\"%u%c\",A[Ai],\"\\n \"[Ai>0]);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int i,j,k,x;\n int a,b,c,d;\n scanf(\"%d\",&x);\n int ara[x];\n for(i=1,j=0;i<=x;i++){\n a=x;\n x=x-i;\n\n if(x>i){\n ara[i-1]=i;\n j++;\n }\n else if(x==i){\n ara[i-1]=a;\n j++;\n break;\n }\n\n else if(x\n#include \n#include \nvoid Q_santa(int n);\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tQ_santa(n);\n\n}\nvoid Q_santa(int n)\n{\n\tdouble temp = floor((-1+sqrt(8*n+1))*0.5);\n\tprintf(\"%d\\n\", (int)temp);\n\tint i;\n\tint sum = 0;\n\tfor (i = 1; i <= temp; i++)\n\t{\t\n\t\tif (i != temp)\n\t\t{\n\t\t\tsum += i;\n\t\t\tprintf(\"%d \", i);\n\t\t\tfflush(stdout);\n\t\t}\n\t\telse\n\t\t\tprintf(\"%d\", n - sum);\n\t\t\n\t}\n}"}, {"source_code": "#include\nint a[1000], k;\nint main()\n{\n int n, i, j;\n scanf(\"%d\", &n);\n for(i=1; i<=n; i++)\n {\n if(i <= n)\n {\n a[k++] = i;\n n -= i;\n }\n }\n a[k-1] += n;\n printf(\"%d\\n\", k);\n for(i=0; i\n#include \n\nint main()\n{\n\tint n,k,i,ans;\n\tscanf(\"%d\",&n);\n\tans = (int)((-1+sqrt(1+8*n))/2);\n\tprintf(\"%d\\n\",ans);\n\tfor(i=1;i\nint main()\n{\n\tint n,i,j,a[55];\n\tscanf(\"%d\",&n);\n\tfor(i=1;i<=50;i++)\n\t\ta[i]=(i*(i+1))/2;\n\t//for(i=1;i<=50;i++)\n\t\t//printf(\"%d \",a[i]);\n\ti=1;\n\twhile(a[i]<=n)\n\t\ti++;\n\tprintf(\"%d\\n\",i-1);\n\tif(n==2)\n\t\tprintf(\"2\\n\");\n\telse{\n\tfor(j=1;j\n#include \nint main()\n{\nint i,j=0,x,sum=0,a[100]={0},count=0;\nscanf(\"%d\",&x);\nfor(i=1;i<100;i++)\n{\n if(sumx)\n {\n while(sum>x)\n {\n sum=sum - 1; j++;\n }\n\n a[j]=0;\n count--;\n }\n\n}\nprintf(\"\\n%d\\n\",count);\nfor(i=0;i<=count+1;i++)\n if(a[i]!=0)\n printf(\"%d \",a[i]);\n\n}\n\n"}, {"source_code": "#include\n#include\n#include\nmain()\n{\n int n;\n int a[10000],i,j,sum=0,p=0;\n scanf(\"%d\",&n);\n if(n==1)\n {\n printf(\"1\\n\");\n printf(\"1\\n\");\n return 0;\n \n }\n \n for(i=0;in)\n { \n p=abs(n-(sum-a[i]));\n a[i-1]=a[i-1]+p;\n break;\n }\n }\n printf(\"%d\\n\",i);\n for(j=0;j\nint main()\n{\n //while(1)\n //{\n int i,k1=0;\n scanf(\"%d\",&i);\n for(int k=1;k<=i;k++)\n {\n if(k*(k+1)==2*i)\n {\n k1=k;\n break;\n }\n else if(k*(k+1)>2*i)\n {\n k1=k-1;\n break;\n }\n }\n printf(\"%d\\n\",k1);\n if(k1*(k1+1)!=2*i)\n {\n int m=(2*i-k1*(k1+1))/2;\n for(int n=1;n<=k1;n++)\n {\n if(n<=k1-m)\n printf(\"%d \",n);\n else\n printf(\"%d \",n+1);\n }\n }\n else\n for(int n=1;n<=k1;n++)\n printf(\"%d \",n);\n // }\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n int i=0,n,t;\n scanf(\"%d\",&n);\n while(i*(i+1)/2 <= n){\n i++;\n }\n printf(\"%d\\n\",i-1);\n for(t=1;t\n\nint main(){\n int n, ready = 0, count = 0, i = 1;\n scanf(\"%d\", &n);\n int kids[50];\n while (!ready){\n if(i < n - i){\n kids[count] = i;\n count++;\n n = n - i;\n i++;\n }\n else{\n kids[count] = n;\n ready = 1;\n }\n }\n printf(\"%d\\n\", count + 1);\n for(int i = 0; i <= count; i++){\n printf(\"%d \", kids[i]);\n }\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n,sum=0,i,sum1=0,j;\n scanf(\"%lld\",&n);\n if(n==1){\n printf(\"1\\n 1\\n\");\n }\n else {\n for(i=0;in)\n break;\n }\n printf(\"%lld\\n\",i-1);\n for(j=1;j\nint main()\n{\n\tlong long int n,i,j;\n\tscanf(\"%lld\",&n);\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tif((i*(i+1))/2>n)\n\t\t{\n\t\t\tprintf(\"%lld\\n\",i-1);\n\t\t\ti--;\n\t\t\tbreak;\n\t\t}\n\t\telse if((i*(i+1))/2==n)\n\t\t{\n\t\t\tprintf(\"%lld\\n\",i);\n\t\t\tbreak;\n\t\t}\n\t}\n\tfor(j=1;j\n#include\nint main() {\n int n,p,i;\n scanf(\"%d\",&n);\n int m=ceil((-1+(sqrt(1+8*n)))/2);\n if((m*(m+1)/2)>n) {\n p=(m*(m+1)/2)-n;\n printf(\"%d\\n\",m-1);\n }\n else {\n p=0;\n printf(\"%d\\n\",m);\n }\n for(i=1;i<=m;i++) {\n if(i!=p)\n printf(\"%d \",i);\n }\n\n\n\n}\n"}, {"source_code": "#include\n#include\ntypedef unsigned u;\nu A[1111],Ai;\nint main()\n{\n\tu n,i=1;\n\tfor(scanf(\"%u\",&n);n>(i<<1);)\n\t{\n\t\tn-=A[Ai++]=i++;\n\t}\n\tA[Ai++]=n;\n\tfor(printf(\"%u\\n\",Ai);Ai--;)printf(\"%u%c\",A[Ai],\"\\n \"[Ai>0]);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\n\nint main()\n{\n int n;\n int i;\n int s = 1;\n scanf(\"%d\", &n);\n i = 1;\n\n while (s + i + 1 <= n){\ni++;\n s += i;\n\n\n\n }\n\n printf(\"%d\\n\", i);\n printf(\"%d \", n-s+i);\n i--;\n for (; i>0; i--){\n printf(\"%d \", i);\n }\n\n return 0;\n}\n"}, {"source_code": "#include\n#include\nvoid fun(int );\nvoid fun(int n)\n{\n int i,tmp=0,j,sum=0;\n if(n==1)\n {\n printf(\"1\\n1\\n\");\n return;\n }\n if(n==2)\n {\n printf(\"1\\n2\\n\");\n return;\n }\n for(i=1;;i++)\n {\n tmp=tmp+i;\n if(tmp>n)\n {\n break;\n }\n }\n i--;\n printf(\"%d\\n\",i);\n for(j=1;j<=i-1;j++)\n {\n printf(\"%d \",j);\n sum=sum+j;\n }\n printf(\"%d\\n\",n-sum);\n}\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n fun(n);\n return 0;\n}"}, {"source_code": "#include\n\nint main()\n{\n int n;\n\n scanf(\"%d\",&n);\n\n int can[1001] = {0};\n int N = n,i,ck = 0;\n\n for(i = 1; i <= n; i++)\n {\n int d = N - i;\n if(d!=i && can[d]==0 && N>0)\n {\n can[i] = 1;\n N -= i;\n ck++;\n }\n }\n printf(\"%d\\n\",ck);\n\n for(i = 1; i <= n; i++)\n {\n if(can[i] == 1){\n if(i == n){\n printf(\"%d\\n\",i);\n }\n else{\n printf(\"%d \",i);\n }\n }\n }\n return 0;\n}\n\n\n\n\n"}, {"source_code": "#include\n\nint main(void)\n{\n\tint n, n2, k = 1, rez = 0;\n\tscanf(\"%d\", &n);\n\tn2 = n;\n\twhile (n2 - k >= 0){\n\t\trez++;\n\t\tn2 -= k;\n\t\tk++;\n\t}\n\tprintf(\"%d\\n\", rez);\n\tk = 1;\n\twhile (rez){\n\t\tif (rez != 1 || !n2){\n\t\t\tprintf(\"%d \", k);\n\t\t} else {\n\t\t\tprintf(\"%d \", n2 + k);\n\t\t}\n\t\tk++;\n\t\trez--;\n\t}\n}\n"}, {"source_code": "#include\n#include\nvoid fun(int );\nvoid fun(int n)\n{\n int i,tmp=0,j,sum=0;\n if(n==1)\n {\n printf(\"1\\n1\\n\");\n return;\n }\n if(n==2)\n {\n printf(\"1\\n2\\n\");\n return;\n }\n for(i=1;;i++)\n {\n tmp=tmp+i;\n if(tmp>n)\n {\n break;\n }\n }\n i--;\n printf(\"%d\\n\",i);\n for(j=1;j<=i-1;j++)\n {\n printf(\"%d \",j);\n sum=sum+j;\n }\n printf(\"%d\\n\",n-sum);\n}\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n fun(n);\n return 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n\tint n,num,temp;\n\tscanf(\"%d\",&n);\n\ttemp=1+8*n;\n\ttemp=sqrt(temp);\n\tnum=(-1+temp)/2;\n\tint i,rem,flag=0;\n\trem=n-(num*(num+1))/2;\n\tprintf(\"%d\\n\",num);\n\tfor(i=1;i\n\nint main(int argc, const char * argv[]) {\n int num;\n scanf(\"%d\", &num);\n int i;\n for(i = 1; ; ++i){\n if(i * (i + 1) / 2 > num)\n break;\n }\n i--;\n printf(\"%d\\n\", i);\n for(int m = 1; m < i; ++m){\n printf(\"%d \", m);\n }\n printf(\"%d\\n\",num - (i * (i - 1) / 2));\n}"}, {"source_code": "#include\nint main(){\n\tint i,j,n,k,m;\n\tint arr[1002];\n\tfor(i=0;i<1001;i++){\n\t\tarr[i]=((i+1)*(i+2))/2;\n\t}\n\tscanf(\"%d\",&n);\n\tfor(i=0;i<1001;i++){\n\t\tif(n>=arr[i]&&n\n\n\nint main()\n{\n int n;\n int i;\n int s = 1;\n scanf(\"%d\", &n);\n i = 1;\n\n while (s + i + 1 <= n){\ni++;\n s += i;\n\n\n\n }\n\n printf(\"%d\\n\", i);\n printf(\"%d \", n-s+i);\n i--;\n for (; i>0; i--){\n printf(\"%d \", i);\n }\n\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n\tint n = 0;\n\tscanf(\"%d\", &n);\n\tint m = n;\n\n\tint i = 1;\n\tfor (; m >= 0; m -= i, ++i);\n\ti -= 2;\n\tprintf(\"%d\\n\", i);\n\n\tint sum = 0;\n\tfor (m = 1; m < i; ++m)\n\t{\n\t\tprintf(\"%d \", m);\n\t\tsum += m;\n\t}\n\tprintf(\"%d\\n\", n - sum);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n\tint n = 0;\n\tscanf(\"%d\", &n);\n\tint m = n;\n\n\tint i = 1;\n\tfor (; m >= 0; m -= i, ++i);\n\ti -= 2;\n\tprintf(\"%d\\n\", i);\n\n\tint sum = 0;\n\tfor (m = 1; m < i; ++m)\n\t{\n\t\tprintf(\"%d \", m);\n\t\tsum += m;\n\t}\n\tprintf(\"%d\\n\", n - sum);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main(void)\n{\n int n, k, i, j;\n \n j=0;\n \n scanf(\"%d\", &n);\n \n for(i=1; i<46; i++)\n {\n j+=i;\n \n if(j>n)\n {\n j-=2*i-1;\n k=i-1;\n break;\n }\n }\n \n printf(\"%d\\n\", k);\n \n for(i=1; i\nint main ()\n{\n int i=0,n,sum=0,a[2000]={0};\n scanf (\"%d\",&n);\n while(sum\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n<3)\n printf(\"1\\n%d\",n);\n else\n {\n int arr[n+1],i,j,ans=0,tot=0;\n for(i=1;i<=n;i++)\n arr[i]=i;\n for(i=1;in)\n {\n int temp=ans-n;\n arr[temp]=0;\n arr[i+1]=-1;\n tot--;\n break;\n }\n }\n printf(\"%d\\n\",tot);\n for(i=1;i //http://codeforces.com/problemset/problem/753/A\nint main()\n{\n\tint i,n; scanf(\"%d\",&n);\n\t\n\tfor(i=1;i*(i+1)/2<=n;i++)\n\t{}\n\ti--;\n\tprintf(\"%d\\n\",i);\n\tfor(int k=1;k\nint main()\n{\n\tint n,f,h;\n\tscanf(\"%d\",&n);\n\tint i=1;\n/*\tif(n==1)\n\t{\n\t\tprintf(\"1\\n\");\n\t\tprintf(\"1\\n\");\n\t}*/\n//\telse\n//\t{\n\twhile(n>(i*(i+1)/2))\n\t{\n\t\ti++;\n\t}\n\th=(i*(i+1)/2)-n;\n\tif(n==i*(i+1)/2)\n\tprintf(\"%d\\n\",i);\n\telse\n\tprintf(\"%d\\n\",i-1);\n\tfor(f=1;f\nint main()\n{\n long n,i,p,k,x[100];\n scanf(\"%d\",&n);\n for(i=0;i<=n;i++)\n {\n if((n>=i*(i+1)/2) && (n<=i*(i+3)/2))\n {\n k=i;break;\n }\n }\n for(i=1;i<=k;i++)\n {\n if(i==k)\n {\n x[k]=n-(k*(k-1)/2);\n }\n else\n x[i]=i;\n }\n printf(\"%d\\n\",k);\n for(i=1;i<=k;i++)\n {\n printf(\"%d \",x[i]);\n}}"}, {"source_code": "#include\n#include\n#include\n#include\nint n,k,magic,sum=0;\nint main(){\n scanf(\"%d\",&n);\n\n\n\n\n for(int i=1;i<46;i++){\n if((i+1)*i/2 > n){\n k=i-1;\n magic=k*(k+1)/2;\n printf(\"%d\\n\",k);\n\n for(int i=1;i\n\nint main () {\n int candies;\n int i = 1;\n int j;\n int soma = 0;\n scanf(\"%d\", &candies);\n while (soma < candies) {\n soma += i;\n i++;\n }\n if (soma == candies) {\n printf (\"%d\\n\", i - 1);\n for (j = 1; j <= i - 1; j++) {\n if (j == i) {\n printf (\"%d\\n\", j);\n }\n else {\n printf (\"%d \", j);\n }\n }\n }\n else {\n printf(\"%d\\n\", i - 2);\n for (j = 1; j <= i - 1; j++) {\n if (j == i - 1) {\n printf (\"%d\\n\", j);\n }\n else if (j == soma - candies) {\n }\n else {\n printf (\"%d \", j);\n }\n }\n }\n return 0;\n}\n\n"}, {"source_code": "#include \nint main()\n{\nint n;\nscanf(\"%d\",&n);\nint sum=0,i=0;\nwhile(sum0;i--)\n {\n if(sum-n!=i)\n printf(\"%d \",i);\n }\n\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int i,j,k,x;\n int a,b,c,d;\n scanf(\"%d\",&x);\n int ara[x];\n for(i=1,j=0;i<=x;i++){\n a=x;\n x=x-i;\n\n if(x>i){\n ara[i-1]=i;\n j++;\n }\n else if(x==i){\n ara[i-1]=a;\n j++;\n break;\n }\n\n else if(x\n#include \n\n\nint main()\n{\n int n;\n int i;\n int s = 1;\n scanf(\"%d\", &n);\n i = 1;\n\n while (s + i + 1 <= n){\ni++;\n s += i;\n\n\n\n }\n\n printf(\"%d\\n\", i);\n printf(\"%d \", n-s+i);\n i--;\n for (; i>0; i--){\n printf(\"%d \", i);\n }\n\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int n;\n int ans[1000];\n int size = 0;\n scanf(\"%d\", &n);\n for(int i = 1; i <= n; ++i) {\n if(n >= i) {\n ans[size++] = i;\n n -= i;\n }\n }\n ans[size - 1] += n;\n printf(\"%d\\n\", size);\n for(int i = 0; i < size; ++i) {\n printf(\"%d \", ans[i]);\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{int n,i,m,j;char c=' ';\nscanf(\"%d\",&n);\nfor(i=1;1;i++)\n\n if(i*(i+1)/2>n)break;\n\n printf(\"%d\\n\",i-1);\n\n for(j=1;j<=i-2;j++)\n printf(\"%d%c\",j,c);\n int sum=(i-2)*(i-1)/2;\n printf(\"%d\",n-sum);\n\nreturn 0;}\n"}, {"source_code": "#include \nint count[1111];\nint main()\n{\n\tint n, i = 1, sum = 1, cnt = 1;\n\tscanf(\"%d\", &n);\n\tif (n == 1) {printf(\"1\\n1\"); return 0;}\n\tif (n == 2) {printf(\"1\\n2\"); return 0;}\n\tcount[1]++;\n\twhile (i < n)\n\t{\n\t\ti++;\n\t\tsum += i;\n\t\tif ((n-sum)>i || sum==n)\n\t\t{\n\t\t\tcount[i]++;\n\t\t\tcnt++;\n\t\t\tsum += i;\n\t\t}\n\t\tsum -= i;\n\t}\n\tprintf(\"%d\\n\", cnt);\n\tfor (i = 0; i < 1111; i++) if (count[i]) printf(\"%d \", i);\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\n#include\n\nint main(){\n int n;\n scanf(\"%d\",&n);\n bool *p = (bool*)calloc(n,1);\n int i=0;\n int k=0;\n int t=0;\n int count=0;\n \n while(n){\n if(p[0]==0){p[0]=1;n--;i=0;count++;continue;}\n for(i=0;i<=k;i++){\n t=i+1; \n if(p[t]==0&&p[i]==1){//printf(\"df\\n\");\n p[t]=1;\n p[i]=0;\n if(t>k)k=t;\n break;\n }\n }\n n--;\n }\n printf(\"%d\\n\",count);\n for(i=0;i<=k;i++){\n if(p[i]==1)printf(\"%d \",i+1);\n \n \n }\n printf(\"\\n\");\n}"}, {"source_code": "#include\nint main()\n{int n,i,m,j;char c=' ';\nscanf(\"%d\",&n);\nfor(i=1;1;i++)\n\n if(i*(i+1)/2>n)break;\n\n printf(\"%d\\n\",i-1);\n\n for(j=1;j<=i-2;j++)\n printf(\"%d%c\",j,c);\n int sum=(i-2)*(i-1)/2;\n printf(\"%d\",n-sum);\n\nreturn 0;}\n"}, {"source_code": "#include \n\nvoid allot (int use[1001], int* sum, int i, int* num) {\n if (use[i]) return;\n if (*sum-i > i) {\n use[*sum] = 0;\n use[*sum-i] = 1;\n use[i] = 1;\n (*num)++;\n (*sum)-=i;\n allot(use, sum, i+1, num);\n }\n return;\n}\n\nint main(void) {\n int n;\n scanf(\"%d\", &n);\n int use[1001] = {0};\n use[n] = 1;\n int sum[0], num[0];\n *sum = n;\n *num = 1;\n allot(use, sum, 1, num);\n printf(\"%d\\n\", *num);\n int i, j;\n for(i=0; i<=1000; i++) {\n if (use[i]) { printf(\"%d\", i); break;}\n }\n for(j=i+1; j<=1000; j++) {\n if (use[j]) printf(\" %d\", j);\n }\n puts(\"\");\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int n,k=1,t;\n n=t=0;\n scanf(\"%d\",&n);\n if( n==1 )\n {\n printf(\"1\\n1\");\n }\n else\n {\n while ( t == 0 )\n {\n if( k*(k+1)/2< n && (k+1)*(k+2)/2> n )\n t=1;\n else if(k*(k+1)/2==n)\n {\n t=2;\n }\n else\n ++k;\n }\n if(t==1)\n {\n printf(\"%d\\n\",k);\n for(t=1;t\n\nint a[46],arr[46];\n\nint binarySearch(int left,int right,int key)\n{\n int middle=(left+right)/2;\n\n if(right-left==1)\n {\n if(arr[right]>key)\n return left;\n\n else\n return right;\n }\n\n else if(arr[middle]=key)\n return binarySearch(left,middle,key);\n}\n\nint main()\n{\n int i,n,index;\n arr[0]=0;\n arr[1]=1;\n\n for(i=0;i<46;i++)\n a[i]=i;\n\n for(i=2;i<46;i++)\n arr[i]=i+arr[i-1];\n\n scanf(\"%d\",&n);\n\n index=binarySearch(1,45,n);\n\n a[index]=a[index]+n-arr[index];\n\n printf(\"%d\\n\",index);\n\n for(i=1;i<=index;i++)\n printf(\"%d \",a[i]);\n printf(\"\\n\");\n\nreturn 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n long long int n,sum=0,i,sum1=0,j;\n scanf(\"%lld\",&n);\n if(n==1){\n printf(\"1\\n 1\\n\");\n }\n else {\n for(i=0;in)\n break;\n }\n printf(\"%lld\\n\",i-1);\n for(j=1;jc[j+1])\n {\n t=c[j];\n c[j]=c[j+1];\n c[j+1]=t;\n }\n for(i=0;i\n#include\nint main() {\n int n,p,i;\n scanf(\"%d\",&n);\n int m=ceil((-1+(sqrt(1+8*n)))/2);\n if((m*(m+1)/2)>n) {\n p=(m*(m+1)/2)-n;\n printf(\"%d\\n\",m-1);\n }\n else {\n p=0;\n printf(\"%d\\n\",m);\n }\n for(i=1;i<=m;i++) {\n if(i!=p)\n printf(\"%d \",i);\n }\n\n\n\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,i,s,j,p;\n scanf(\"%d\",&n);\n s=0;\n for(i=1;i<=55;i++) {\n s=s+i;\n if(s==n) {\n printf(\"%d\\n\",i);\n for(j=1;j<=i;j++) {\n printf(\"%d \",j);\n }\n break;\n }\n\n else if(s>n) {\n\n printf(\"%d\\n\",i-1);\n p=s-n;\n for(j=1;j<=i;j++) {\n if(j!=p) {printf(\"%d \",j); }\n }\n break;\n }\n\n\n }\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,s,i,cnt = 0;\n\tscanf(\"%d\",&n);\n\tint B[n];\n\tfor(i=1;i<=n;i++)\n\tB[i] = 0;\n\ts = 0;\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tif(B[i] == 0 &&\ti<= n-s)\n\t\t{ \n\t\t\tB[i] = i;\n\t\t\ts = s+ B[i];\n\t\t\tcnt++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tB[i-1] = B[i-1] + n-s;\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",cnt);\n for(i=1;i<=cnt;i++) \n printf(\"%d\\t\",B[i]);\n return 0;\n}"}, {"source_code": "#include \nint count[1111];\nint main()\n{\n\tint n, i = 1, sum = 1, cnt = 1;\n\tscanf(\"%d\", &n);\n\tif (n == 1) {printf(\"1\\n1\"); return 0;}\n\tif (n == 2) {printf(\"1\\n2\"); return 0;}\n\tcount[1]++;\n\twhile (i < n)\n\t{\n\t\ti++;\n\t\tsum += i;\n\t\tif ((n-sum)>i || sum==n)\n\t\t{\n\t\t\tcount[i]++;\n\t\t\tcnt++;\n\t\t\tsum += i;\n\t\t}\n\t\tsum -= i;\n\t}\n\tprintf(\"%d\\n\", cnt);\n\tfor (i = 0; i < 1111; i++) if (count[i]) printf(\"%d \", i);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int n;\n int ans[1000];\n int size = 0;\n scanf(\"%d\", &n);\n for(int i = 1; i <= n; ++i) {\n if(n >= i) {\n ans[size++] = i;\n n -= i;\n }\n }\n ans[size - 1] += n;\n printf(\"%d\\n\", size);\n for(int i = 0; i < size; ++i) {\n printf(\"%d \", ans[i]);\n }\n return 0;\n}\n"}, {"source_code": "#include\n\nint ans[100];\n\nint main()\n{\n\tint num, i, n;\n\n\tscanf(\"%d\", &n);\n\n\tfor(i = 1, num = 0; i <= n; i ++)\n\t{\n\t\tif(i <= n)\n\t\t\tans[num ++] = i;\n\t\tn -= i;\n\t}\n\n\tprintf(\"%d\\n\", num);\n\n\tfor(i = 0; i < num; i ++)\n\t{\n\t\tif(i == num - 1)\n\t\t\tprintf(\"%d \", ans[i] + n);\n\t\telse\n\t\t\tprintf(\"%d \", ans[i]);\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,i,j,b=0,sum=0,ara[10000],c=0;\n scanf(\"%d\",&n);\n int a = n;\n for(i=1,j=0;i<=n;i++,j++){\n a = a-i;\n if(i\n#include \n\n\nint main()\n{\n int n;\n int i;\n int s = 1;\n scanf(\"%d\", &n);\n i = 1;\n\n while (s + i + 1 <= n){\ni++;\n s += i;\n\n\n\n }\n\n printf(\"%d\\n\", i);\n printf(\"%d \", n-s+i);\n i--;\n for (; i>0; i--){\n printf(\"%d \", i);\n }\n\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,i,s,j,p;\n scanf(\"%d\",&n);\n s=0;\n for(i=1;i<=55;i++) {\n s=s+i;\n if(s==n) {\n printf(\"%d\\n\",i);\n for(j=1;j<=i;j++) {\n printf(\"%d \",j);\n }\n break;\n }\n\n else if(s>n) {\n\n printf(\"%d\\n\",i-1);\n p=s-n;\n for(j=1;j<=i;j++) {\n if(j!=p) {printf(\"%d \",j); }\n }\n break;\n }\n\n\n }\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,i,j,k,sum=0,p;\n scanf(\"%d\",&n);\n k=0;\n p=n;\n while(n-k-1>=0)\n {\n n=n-k-1;\n k++;\n }\n if(p==1)\n {\n printf(\"1\\n\");\n printf(\"1\\n\");\n }\n else\n {\n printf(\"%d\\n\",k);\n j=1;\n for(i=1;i\n#include\nint main()\n{\n int N;\n scanf(\"%d\",&N);\n float x=sqrt(1+8*N);\n\n x=(-1+x)/2.0;\n int y=x;\n int z=(y*(y+1))/2;\n int remaining=N-z;\n printf(\"%d\\n\",y);\n for(z=y;z>0;z--){\n if(remaining>0){\n printf(\"%d \",z+1);\n remaining-=1;\n }\n else{\n printf(\"%d \",z);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\nint i,j=0,x,sum=0,a[100]={0},count=0;\nscanf(\"%d\",&x);\nfor(i=1;i<100;i++)\n{\n if(sumx)\n {\n while(sum>x)\n {\n sum=sum - 1; j++;\n }\n\n a[j]=0;\n count--;\n }\n\n}\nprintf(\"\\n%d\\n\",count);\nfor(i=0;i<=count+1;i++)\n if(a[i]!=0)\n printf(\"%d \",a[i]);\n\n}\n\n"}, {"source_code": "#include\nint main()\n{\n int n,sum=0,i=0;\n scanf(\"%d\",&n);\n while((sum+=++i)\n#include\nint main()\n{\n int N;\n scanf(\"%d\",&N);\n float x=sqrt(1+8*N);\n\n x=(-1+x)/2.0;\n int y=x;\n int z=(y*(y+1))/2;\n int remaining=N-z;\n printf(\"%d\\n\",y);\n for(z=y;z>0;z--){\n if(remaining>0){\n printf(\"%d \",z+1);\n remaining-=1;\n }\n else{\n printf(\"%d \",z);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint sum =0,i=0,ans[100];\n\tint ele=1,count=0;\n\twhile(n-sum>2*ele)\n\t{\n\t\tans[count]=ele;\n\t\tsum+=ele;\n\t\tele++;\n\t\tcount++;\n\t}\n\tans[count++]=n-sum;\n\tprintf(\"%d\\n\",count);\n\tfor(i=0;i\n#include\n\nint main(){\n\nint s=0,i=1,j,n,k,L[50];\n\n\nscanf(\"%d\",&n);\n\nwhile (s<=n){\ns=s+i;\nL[i-1]=i;\ni=i+1;\n}\n\nk=i-1;\n\nif(s-i+1!=n){\n\n int j=n-s+i-1;\n\n if(j==k-1){for(i=0;i!=j;i++){\n L[i]+=1;\n }}\n else{\n L[k-2]+=j;\n }\n\n}\n\nprintf(\"%d\\n\",k-1);\nfor (i=0;i!=k-1;i++){\nprintf(\"%d \",L[i]);\n}\n\n}\n"}, {"source_code": "#include\nint main()\n{\nint n;\nscanf(\"%d\",&n);\nint i,k=0,count=0,sum=0;\ni=1;\nint n1=n;\nint a[n];\nwhile(n>k)\n{\nif(n>k)\n{\nn=n-i;\nsum+=i;\na[count]=i;\ncount++;\nk=i;\n\n}\ni++;\n}\nsum-=a[count-1];\nprintf(\"%d\\n\",count);\nif(count!=1)\n{a[count-1]=n1-sum;\nfor(i=0;i\nint queue[1000];\nint n, sum, top;\nint main(void) {\n scanf(\"%d\", &n);\n for(int i = 1; sum < n; i++) {\n queue[top++] = i;\n sum += i;\n }\n if(sum != n) {\n sum -= queue[top - 1];\n top--;\n queue[top - 1] += n - sum;\n }\n printf(\"%d\\n%d\", top, queue[0]);\n for(int i = 1; i < top; i++) {\n printf(\" %d\", queue[i]);\n }\n return 0;\n}"}, {"source_code": "#include\n#define maxn 1000\nint a[maxn];\nvoid init();\nint main()\n{\n init();\n int n,i;\n while(~scanf(\"%d\",&n))\n {\n if(n==1||n==2)\n {\n printf(\"%d\\n\",1);\n printf(\"%d\\n\",n);\n continue;\n }\n printf(\"%d\\n\",a[n]);\n int sum=0;\n for(i=1;i\n#include\n\n/*\nint binary(int x, int a[], int size)\n{\n int first=1, last=size;\n while(first<=last)\n {\n\tint mid=(first+last)/2;\n\tif(a[mid]==x)\n\t return mid;\n\tif(a[mid]>x)\n\t last=mid-1;\n\telse\n\t first=mid+1;\n }\n\n return 0;\n}//end of binary search function\n*/\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n int m;\n printf(\"%d\\n\", m=(int)(sqrt(8*n+1)-1)/2);\n int s=0;\n for(int i=1;i\nmain()\n{\n\tint n,i,k=0,p,y=0,m;\n\tscanf(\"%d\",&n);\n\tint a[n];\n\tfor (i=0;i<(n-k);i++)\n\t{\n\t\ty=y+1;\n\t\tk=k+y;\n\t\ta[i]=y;\n\t\tp=(n-k);\n\t}\n\tm=i;\n\tprintf(\"%d\\n\",m);\n\ti=0;\n\twhile(p!=0)\n\t{\n\t\ta[m-1-i]=a[m-1-i]+1;\n\t\tp--;\n\t\ti++;\n\t}\n\tfor(i=0;i\nint main()\n{\n\tlong long int n,i,j;\n\tscanf(\"%lld\",&n);\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tif((i*(i+1))/2>n)\n\t\t{\n\t\t\tprintf(\"%lld\\n\",i-1);\n\t\t\ti--;\n\t\t\tbreak;\n\t\t}\n\t\telse if((i*(i+1))/2==n)\n\t\t{\n\t\t\tprintf(\"%lld\\n\",i);\n\t\t\tbreak;\n\t\t}\n\t}\n\tfor(j=1;j\n#include \nint main()\n{\nint n;\nscanf(\"%d\", &n);\nint arr[n], j=0, i=-1,x;\nwhile(n>j)\n{\nn-=++j;\nif(n>=0)\n{\ni++;\narr[i]=j;\n}\n}\narr[i]+=n;\nprintf(\"%d\\n\",i+1);\nfor(x=0;x<=i;x++)\n{\nprintf(\"%d \",arr[x]);\n}\nreturn 0;\n\n}\n"}, {"source_code": "#include \n\nvoid allot (int use[1001], int* sum, int i, int* num) {\n if (use[i]) return;\n if (*sum-i > i) {\n use[*sum] = 0;\n use[*sum-i] = 1;\n use[i] = 1;\n (*num)++;\n (*sum)-=i;\n allot(use, sum, i+1, num);\n }\n return;\n}\n\nint main(void) {\n int n;\n scanf(\"%d\", &n);\n int use[1001] = {0};\n use[n] = 1;\n int sum[0], num[0];\n *sum = n;\n *num = 1;\n allot(use, sum, 1, num);\n printf(\"%d\\n\", *num);\n int i, j;\n for(i=0; i<=1000; i++) {\n if (use[i]) { printf(\"%d\", i); break;}\n }\n for(j=i+1; j<=1000; j++) {\n if (use[j]) printf(\" %d\", j);\n }\n puts(\"\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main(void) {\n int total;\n scanf(\"%d\", &total);\n if (total < 0 || total > 1000)\n return 0;\n int i;\n int *result = calloc(45,sizeof(int));\n int *selection = calloc(45,sizeof(int));\n selection[0] = total;\n for (i=1;i<46;i++) {\n result[i] = i;\n selection[i] = selection[i-1] - i;\n if (selection[i] <= i) {\n result[0] = i;\n result[i] = selection[i-1];\n break;\n }\n }\n printf(\"%d\\n\", result[0]);\n for (i = 1; i\n#include \nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int *a=(int *)malloc(n*sizeof(int));\n int i,s=0,q=0;\n for(i=1;s<=n;i++)\n {\n s+=i;\n q++;\n }\n printf(\"%d\\n\",q-1);\n s=0;\n int r=q-1,w=0;\n for(i=1;;i++)\n {\n if(i\nint main()\n{\n int no_of_gifts;\n scanf(\"%d\", &no_of_gifts);\n\n int no_of_people = 1;\n while(no_of_people*(no_of_people + 1) <= 2*no_of_gifts)\n no_of_people++;\n\n no_of_people--;\n\n printf(\"%d\\n\", no_of_people);\n for(int i = 1; i < no_of_people; i++)\n {\n printf(\"%d \", i);\n no_of_gifts -= i;\n }\n\n printf(\"%d\\n\", no_of_gifts); //Last person gets all remaining gifts\n return 0;\n}"}, {"source_code": "#include\nint main(){\n int i=0,n,t;\n scanf(\"%d\",&n);\n while(i*(i+1)/2 <= n){\n i++;\n }\n printf(\"%d\\n\",i-1);\n for(t=1;t\nint main()\n{\n int n,m=0,k,l,f,a[1000],s,g;\n scanf(\"%d\", &n);\n g = n;\n if(n == 2) {\n printf(\"1\\n\");\n printf(\"2\");\n }\n else if(n == 1) {\n printf(\"1\\n\");\n printf(\"1\");\n }\n else {\n for(k=1;k\nint main(){\n\tint i,j,n,k,m;\n\tint arr[1002];\n\tfor(i=0;i<1001;i++){\n\t\tarr[i]=((i+1)*(i+2))/2;\n\t}\n\tscanf(\"%d\",&n);\n\tfor(i=0;i<1001;i++){\n\t\tif(n>=arr[i]&&n\n#include\nint main()\n{\n\tint n,num,temp;\n\tscanf(\"%d\",&n);\n\ttemp=1+8*n;\n\ttemp=sqrt(temp);\n\tnum=(-1+temp)/2;\n\tint i,rem,flag=0;\n\trem=n-(num*(num+1))/2;\n\tprintf(\"%d\\n\",num);\n\tfor(i=1;i\n#include \n\nint main()\n{\n\tint n,i,j;\n\tshort **opt;\n\t\n\tscanf(\"%d\",&n);\n\t\n\topt = (short**)malloc((n+1)*sizeof(short*));\n\t\n\t\n\t\n\tfor(i=0;i=0 && opt[i-1][j-i]!=-1 && opt[i-1][j-i]+1>opt[i-1][j])\n\t\t\t{\n\t\t\t\topt[i][j] = opt[i-1][j-i]+1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\topt[i][j] = opt[i-1][j];\n\t\t\t}\n\t\t}\n\t\t\n\tprintf(\"%d\\n\",opt[n][n]);\n\t\t\n\ti = n; j= n;\n\t\n\twhile(opt[i][j]!=0 && i>=0 && j>=0)\n\t{\n\t\tif(opt[i-1][j]==opt[i][j]) i--;\n\t\telse\n\t\t{\n\t\t\tprintf(\"%d \",i);\n\t\t\tj -=i;\n\t\t\ti--;\n\t\t}\n\t}\n\t\n}\n"}, {"source_code": "#include\nint main()\n{\n\tint n,k,l;\n\tint a[100];\n\tint i,j;\n\tfor(i=1;i<=99;i++)\n\t\ta[i]=(1+i)*i/2;\n\tscanf(\"%d\",&n);\n\tfor(i=1;i<=99;i++)\n\t\tif(a[i]>=n)\n\t\t\tbreak;\n\tif(a[i]==n)\n\t\tk=i;\n\telse\n\t\tk=i-1;\n\tl=a[i]-n;\n\tprintf(\"%d\\n\",k);\n\tfor(i=1,j=1;i<=k;j++)\n\t{\n\t\tif(j!=l)\n\t\t{\n\t\t\tprintf(\"%d \",j);\n\t\t\ti++;\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int x,l,q=0,s=0,k,z,n=0;\n scanf(\"%d\",&k);\n z=k;\n for(l=1;l<=z;l++)\n {\n s+=l;\n if(s>=z)\n {\n n=l;\n break;\n }\n }\n\n if(s==z)\n {\n printf(\"%d\\n\",n);\n for(x=1;x<=n;x++)\n printf(\"%d \",x);\n }\n else if(s>z)\n {\n printf(\"%d\\n\",n-1);\n for(x=1;x\nint count[1111];\nint main()\n{\n\tint n, i = 1, sum = 1, cnt = 1;\n\tscanf(\"%d\", &n);\n\tif (n == 1) {printf(\"1\\n1\"); return 0;}\n\tif (n == 2) {printf(\"1\\n2\"); return 0;}\n\tcount[1]++;\n\twhile (i < n)\n\t{\n\t\ti++;\n\t\tsum += i;\n\t\tif ((n-sum)>i || sum==n)\n\t\t{\n\t\t\tcount[i]++;\n\t\t\tcnt++;\n\t\t\tsum += i;\n\t\t}\n\t\tsum -= i;\n\t}\n\tprintf(\"%d\\n\", cnt);\n\tfor (i = 0; i < 1111; i++) if (count[i]) printf(\"%d \", i);\n\treturn 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int i,j,k,x;\n int a,b,c,d;\n scanf(\"%d\",&x);\n int ara[x];\n for(i=1,j=0;i<=x;i++){\n a=x;\n x=x-i;\n\n if(x>i){\n ara[i-1]=i;\n j++;\n }\n else if(x==i){\n ara[i-1]=a;\n j++;\n break;\n }\n\n else if(x\nmain()\n{\n int i,j,k=0,l=0,a,s,c,b[100100];\n scanf(\"%d\",&a);\n if(a==1)\n printf(\"1\\n1\");\n else\n {\n for(i=1,s=0;s<=a;i++)\n {\n s=s+i;\n if(sa)\n {\n for(i=1;i\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n int rs[1000];\n int k = 0;\n\n int i = 1;\n while (n > 0)\n {\n \n if (n - 2*i - 1 < 0)\n i += n - i;\n rs[k] = i;\n k++;\n n -= i++;\n }\n\n\n printf(\"%d\\n\", k);\n for (int j = 0; j < k-1; j++)\n printf(\"%d \", rs[j]);\n printf(\"%d\\n\", rs[k-1]);\n\n return 0;\n}\n\n"}, {"source_code": "#include\nint main()\n{\n int n,sum=0,i=0;\n scanf(\"%d\",&n);\n while((sum+=++i)\nint main()\n{\n\tint n,i,j,p;\n\tlong long int count=0;\n\tscanf(\"%d\",&n);\n\tint a[1001];\n\ti=0;\n\tp=n;\n\tif(n==1 || n==2)\n\t{\n\t\tprintf(\"1\\n\");\n\t\tprintf(\"%d\\n\",n);\n\t}\n\telse\n\t{\n\t\ta[0]=1;\n\t\tp=p-a[0];\n\t\tcount++;\n\t\twhile(p!=0)\n\t\t{\n\t\t\tif(p<=a[i])\n\t\t\t{\n\t\t\t\tp=p+a[i];\n\t\t\t\ta[i]=a[i]+1;\n\t\t\t\tp=p-a[i];\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\ti++;\n\t\t\t\ta[i]=a[i-1]+1;\n\t\t\t\tcount++;\n\t\t\t\tp=p-a[i];\n\t\t\t}\n\t\t}\n\t\tprintf(\"%lld\\n\",count);\n\t\tfor(j=0;j<=i;j++)\n\t\t{\n\t\t\tprintf(\"%d \",a[j]);\n\t\t}\n\t\tprintf(\"\\n\");\n\t}\n\treturn 0;\n}\n\t\t\t\t\n\n\n\t\t \n\n"}, {"source_code": "#include \nint main(){\n\n int n, v[100], m = 0, i;\n scanf(\"%d\",&n);\n\n i = 1;\n while(n){\n if(n - i > i){\n ++m;\n v[m] = i;\n n = n - i;\n }\n else{\n if(n - i == 0){\n ++m;\n v[m] = i;\n n = n - i;\n }\n }\n ++i;\n }\n\n printf(\"%d\\n\",m);\n for(i = 1;i <= m; ++i)\n printf(\"%d \",v[i]);\n}\n"}, {"source_code": "#include\n#include\n\nint main(){\n\nint s=0,i=1,j,n,k,L[50];\n\n\nscanf(\"%d\",&n);\n\nwhile (s<=n){\ns=s+i;\nL[i-1]=i;\ni=i+1;\n}\n\nk=i-1;\n\nif(s-i+1!=n){\n\n int j=n-s+i-1;\n\n if(j==k-1){for(i=0;i!=j;i++){\n L[i]+=1;\n }}\n else{\n L[k-2]+=j;\n }\n\n}\n\nprintf(\"%d\\n\",k-1);\nfor (i=0;i!=k-1;i++){\nprintf(\"%d \",L[i]);\n}\n\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int n,k=1,t;\n n=t=0;\n scanf(\"%d\",&n);\n if( n==1 )\n {\n printf(\"1\\n1\");\n }\n else\n {\n while ( t == 0 )\n {\n if( k*(k+1)/2< n && (k+1)*(k+2)/2> n )\n t=1;\n else if(k*(k+1)/2==n)\n {\n t=2;\n }\n else\n ++k;\n }\n if(t==1)\n {\n printf(\"%d\\n\",k);\n for(t=1;t\n#include \nint main(void) {\n\t// your code goes here\n\tint n,i,k,j,a;\n\tscanf(\"%d\",&n);\n\ta=1+(8*n);\n\ta=sqrt(a);\n\ta=a-1;\n\ta=a/2; //number of elements\n\tk=a;\n\tprintf(\"%d\\n\",k);\n\tif(k==1)\n\t{\n\t\tprintf(\"%d\",n);return 0;\n\t}\n\tint sum=0;\n\tfor(i=1;i<=k;i++)\n\t{\n\t\tif(sum+i>n)\n\t\tbreak;\n\t\tsum=sum+i;\n\t}\n\tif(sum==n)\n\t{\n\t\tfor(j=1;j\nint main()\n{\n int n,sum=0,i=0;\n scanf(\"%d\",&n);\n while((sum+=++i)\n\nint main()\n{\nint n,c,i=0,s=0;\nscanf(\"%d \",&n);\nwhile(s<=n)\n{\ni++;\ns=(i*(i+1))/2;\n}\ni=i-1;\ns=n-(i*(i+1))/2;\nprintf(\"%d \\n\",i);\nint ar[i+1];\nfor(c=1;c<=i;c++)\n{\nar[c]=c;\n}\nc=i;\nwhile(s!=0)\n{\nar[c]=ar[c]+1;\nc--;\ns--;\n}\nfor(c=1;c<=i;c++)\n{\nprintf(\"%d \",ar[c]);\n}\nreturn 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n\tint n,num,temp;\n\tscanf(\"%d\",&n);\n\ttemp=1+8*n;\n\ttemp=sqrt(temp);\n\tnum=(-1+temp)/2;\n\tint i,rem,flag=0;\n\trem=n-(num*(num+1))/2;\n\tprintf(\"%d\\n\",num);\n\tfor(i=1;i\nint main()\n{\n long long int n,sum=0,i,sum1=0,j;\n scanf(\"%lld\",&n);\n if(n==1){\n printf(\"1\\n 1\\n\");\n }\n else {\n for(i=0;in)\n break;\n }\n printf(\"%lld\\n\",i-1);\n for(j=1;j\n#include\n\nint main() {\n\tint CandyNum;\n\tint i = 1;\n\tint sum = 0;\n\n\tscanf(\"%d\", &CandyNum);\n\twhile ((i * (i + 1) / 2) <= CandyNum) {\n\t\ti++;\n\t}\n\ti--;\n\t\n\tint KidNum = i;\n\n\tprintf(\"%d\\n\", KidNum);\n\tfor (i = 0; i < KidNum - 1; i++) { // leave last Kid\n\t\tprintf(\"%d \", i + 1);\n\t\tsum += i + 1;\n\t}\n\tprintf(\"%d \", CandyNum - sum);\n\n\treturn 0;\n}"}], "negative_code": [{"source_code": "#include\n#include\n\nint main()\n{\n\tint n,k,i;\n\tscanf(\"%d\",&n);\n\tk=round(sqrt(2*n));\n\tn-=(k*(k-1))/2;\n\tprintf(\"%d\\n\",k-1);\n\tfor(i=1;i\n#include \n\nint main()\n{\n int i,j,k,x;\n int a,b,c,d;\n scanf(\"%d\",&x);\n int ara[x];\n for(i=1,j=0;i<=x;i++){\n a=x;\n x=x-i;\n if(x!=i){\n ara[i-1]=i;\n j++;\n }\n else if(x==i){\n ara[i-1]=a;\n j++;\n break;\n }\n\n\n }printf(\"%d\\n\",j);\n for(i=0;i\n#include \n\nint main()\n{\n int i,j,k,x;\n int a,b,c,d;\n scanf(\"%d\",&x);\n int ara[x];\n for(i=1,j=0;i\nint main()\n{int n,i,m,j;char c=' ';\nscanf(\"%d\",&n);\nfor(i=1;1;i++)\n\n if(i*(i+1)/2>n)break;\n\n printf(\"%d\\n\",i-1);\n\n for(j=1;j<=i-2;j++)\n printf(\"%d%c\",j,c);\n printf(\"%d\",n-i+2);\n\nreturn 0;}\n"}, {"source_code": "#include \n\nint main()\n{\n int n;\n int ans[1000];\n int size = 0;\n scanf(\"%d\", &n);\n for(int i = 1; i <= n; ++i) {\n if(n >= i) {\n ans[size++] = i;\n n -= i;\n }\n }\n ans[size - 1] += n;\n printf(\"%d\\n\", n);\n for(int i = 0; i < size; ++i) {\n printf(\"%d \", ans[i]);\n }\n return 0;\n}\n"}, {"source_code": "#include\n#include\nint main(){\n int n;\n scanf(\"%d\",&n);\n int *elements=calloc(n,sizeof(int));\n int count=0,rem=n,term;\n while(rem){\n term=(rem/2)+1;\n elements[count++]=term;\n rem=rem-term;\n }\n printf(\"%d\\n\",count);\n for(int i=0;i\nint digsum(long long n){\n long long sum=0;\n while(n){\n sum+=n%10;\n n/=10;\n }\n return sum;\n}\nint main(){\n long long perfectnos[10000];\n long long temp;\n perfectnos[0]=19;\n int k;\n scanf(\"%d\",&k);\n for(int i=0;i\n#include \n\nint main()\n{\n\tint cand, child, y, sum, defr, i;\n\tscanf(\"%d\", &cand);\n\ty=sqrt(cand);\t//floor value\n\tsum=(y*(y+1))/2;\n\tdefr=0;\n\tif(sum!=cand)\t{\n\t\tdefr=cand-sum;\n\t}\n\tprintf(\"%d\\n\", y);\n\tfor(i=1; i\nint main()\n{\n int n,i,j,x=0,y;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++){\n x=x+i;\n if(x>n){\n break;\n }\n }\n\n y=x-n;\n if(y>0){\n printf(\"%d\\n\",i-1);\n }\n else{\n printf(\"%d\\n\",i);\n }\n for(j=1;j<=i;j++){\n if(j==y){\n continue;\n }\n printf(\"%d \",j);\n }\n return 0;\n}\n"}, {"source_code": "#include \nint main()\n{\n int n,m=0,k,l,f,a[1000],s,g;\n scanf(\"%d\", &n);\n g = n;\n if(n == 2) {\n printf(\"1\\n\");\n printf(\"2\");\n }\n else if(n == 1) {\n printf(\"1\\n\");\n printf(\"1\");\n }\n else {\n for(k=1;k\nint main()\n{\n int n,m=0,k,l,f,a[1000],s,g;\n scanf(\"%d\", &n);\n g = n;\n for(k=1;k\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n>3)\n printf(\"1\\n%d\",n);\n int arr[n+1],i,j,ans=0,tot=0;\n for(i=1;i<=n;i++)\n arr[i]=i;\n for(i=1;in)\n {\n int temp=ans-n;\n arr[temp]=0;\n arr[i+1]=-1;\n tot--;\n break;\n }\n }\n printf(\"%d\\n\",tot);\n for(i=1;i\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int arr[n+1],i,j,ans=0,tot=0;\n for(i=1;i<=n;i++)\n arr[i]=i;\n for(i=1;in)\n {\n int temp=ans-n;\n arr[temp]=0;\n arr[i+1]=-1;\n tot--;\n break;\n }\n }\n printf(\"%d\\n\",tot);\n for(i=1;i\n#include \n#define nax 1000\nint main(){\n\tint k;\n\tint size = 0;\n\tint dp[nax];\n\tscanf(\"%i\",&k);\n\tfor(int i=0;i\nint main()\n{\n int n,i,s,j,p;\n scanf(\"%d\",&n);\n s=0;\n for(i=1;i<=14;i++) {\n s=s+i;\n if(s==n) {\n printf(\"%d\\n\",i);\n for(j=1;j<=i;j++) {\n printf(\"%d \",j);\n }\n break;\n }\n\n else if(s>n) {\n\n printf(\"%d\\n\",i-1);\n p=s-n;\n for(j=1;j<=i;j++) {\n if(j!=p) {printf(\"%d \",j); }\n }\n break;\n }\n\n\n }\n}\n"}, {"source_code": "#include \nint main(void) {\n int n, i;\n int sum = 0;\n scanf(\"%d\", &n);\n for(i = 1; sum <= n; i++) {\n sum += i;\n }\n sum -= i;\n i--;\n printf(\"%d\\n\", i);\n for(int j = 1; j < i; j++) {\n printf(\"%d \", j);\n }\n printf(\"%d\", n - sum);\n return 0;\n}"}, {"source_code": "#include \nint main(void) {\n int n, i;\n int sum = 0;\n scanf(\"%d\", &n);\n for(i = 1; sum <= n; i++) {\n sum += i;\n }\n sum -= i;\n printf(\"%d\\n\", i);\n for(int j = 1; j < i; j++) {\n printf(\"%d \", j);\n }\n printf(\"%d\", n - sum);\n return 0;\n}"}, {"source_code": "#include \nint count[1111];\nint main()\n{\n\tint n, i = 1, sum = 1, cnt = 1;\n\tscanf(\"%d\", &n);\n\tif (n == 1) {printf(\"1\\n1\"); return 0;}\n\tif (n == 2) {printf(\"1\\n2\"); return 0;}\n\tcount[1]++;\n\twhile (i < n)\n\t{\n\t\ti++;\n\t\tif ((i+sum) <= n)\n\t\t{\n\t\t\tcount[i]++;\n\t\t\tcnt++;\n\t\t\tsum += i;\n\t\t}\n\t}\n\tprintf(\"%d\\n\", cnt);\n\tfor (i = 0; i < 1111; i++) if (count[i]) printf(\"%d \", i);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\nint* allot(int use[1001], int n, int* num) {\n use[n] = 1;\n int k;\n if (n%2&&!use[n/2]&&!use[(n+1)/2]) {\n use[n/2] = 1;\n use[(n+1)/2] = 1;\n use[n] = 0;\n (*num)++;\n allot(use, n/2, num);\n allot(use, (n+1)/2, num);\n }\n else if (!(n%2)&&!use[n/2-1]&&!use[n/2+1]) {\n use[n/2-1] = 1;\n use[n/2+1] = 1;\n use[n] = 0;\n (*num)++;\n allot(use, n/2-1, num);\n allot(use, n/2+1, num);\n }\n return num;\n}\n\nint main(void) {\n int n;\n scanf(\"%d\", &n);\n int use[1001] = {0};\n int num[0];\n *num = 1;\n allot(use, n, num);\n printf(\"%d\\n\", *num);\n int i, j;\n for(i=0; i<=1000; i++) {\n if (use[i]) { printf(\"%d\", i); break;}\n }\n for(j=i+1; j<=1000; j++) {\n if (use[j]) printf(\" %d\", j);\n }\n puts(\"\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main()\n{\nint n;\nscanf(\"%d\", &n);\nint arr[n], j=0, i=-1,x;\nwhile(n>j)\n{\nn-=++j;\nif(n>=0)\n{\ni++;\narr[i]=j;\n}\n}\narr[i]+=n;\nprintf(\"\\n%d\",i+1);\nfor(x=0;x<=i;x++)\n{\nprintf(\"%d \",arr[x]);\n}\nreturn 0;\n\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\nint x;\nprintf(\"enter the number of sweets: \");\nscanf(\"%d\", &x);\nint a[x], j=0, i, m=0;\nwhile(x!=0)\n{\nfor(i=0; i\n#include \nint main()\n{\nint n;\nprintf(\" Enter the number of candies: \");\nscanf(\"%d\", &n);\nint arr[n], j=0, i=-1,x;\nwhile(n>j)\n{\nn-=++j;\nif(n>=0)\n{\ni++;\narr[i]=j;\n}\n}\narr[i]+=n;\nprintf(\"\\n Number of children %d\",i+1);\nfor(x=0;x<=i;x++)\n{\nprintf(\"\\n children number %d will take %d\",x+1,arr[x]);\n}\nreturn 0;\n\n}"}, {"source_code": "#include\nint main()\n{\nint i,n,c;\nscanf(\"%d\",&n);\nfor(c=1;c*(c+1)/2\nint main()\n{\n\nint i,n,c;\nscanf(\"%d\",&n);\nif(n==1){printf(\"1\\n1\");return 0;}\nfor(c=1;c*(c+1)/2\nmain()\n{\n int i,j,k=0,l=0,a,s,c,b[100100];\n scanf(\"%d\",&a);\n for(i=1,s=0;s<=a;i++)\n {\n s=s+i;\n if(sa)\n {\n for(i=1;i\n# include \nint main(void)\n{ \n int count = 0;\n int sum = 0;\n int lastbutone = 0;\n int input;\n\n scanf(\"%i\",&input);\n \n for(int i = 1; i < input; i++)\n {\n sum = sum + i;\n if(sum < input || sum == input)\n {\n count = count + 1;\n }\n\n }\t\n \n printf(\"%i \\n\", count); \t \n\t\n for (int i = 1; i < count ; i++)\n {\n\tprintf(\"%i \", i); \n\tlastbutone = lastbutone + i; \n \n }\n \n int remainder;\n remainder = input - lastbutone ;\n\n printf(\"%i\", remainder);\n\n return 0;\n}"}, {"source_code": "#include \nint main(void) {\n int n, i, j;\n scanf(\"%d\", &n);\n i = 1;\n while(i * (i + 1) / 2 <= n)\n i++;\n printf(\"%d\\n\", --i);\n for(j = 1;j < i;j++)\n printf(\"%d \", 1);\n printf(\"%d\\n\", n - j + 1);\n return 0;\n}\n"}, {"source_code": "#include \nint main(void) {\n int n, i, j;\n scanf(\"%d\", &n);\n i = 1;\n while(i * (i + 1) / 2 <= n)\n i++;\n printf(\"%d\\n\", --i);\n for(j = 1;j <= i;j++)\n printf(\"%d \", 1);\n return 0;\n}\n"}, {"source_code": "#include \nint main(){\n\n int n, v[100], m = 0, i;\n scanf(\"%d\",&n);\n\n i = 1;\n while(n){printf(\"%d %d\\n\",i,n);\n if(n - i > i){\n ++m;\n v[m] = i;\n n = n - i;\n }\n else{\n if(n - i == 0){\n ++m;\n v[m] = i;\n n = n - i;\n }\n }\n ++i;\n }\n\n printf(\"%d\\n\",m);\n for(i = 1;i <= m; ++i)\n printf(\"%d \",v[i]);\n}\n"}, {"source_code": "#include\n#include\n#include\n#include\nint n,k,dif;\nint main(){\n scanf(\"%d\",&n);\n\n if(n==1){\n printf(\"1 1\");return 0;\n }\n if(n==2){\n printf(\"1 2\");return 0;\n }\n if(n==3){\n printf(\"2 1 2\");return 0;\n }\n if(n==4){\n printf(\"2 1 3\");return 0;\n }\n if(n==5){\n printf(\"2 1 4\");return 0;\n }\n\n\n\n\n for(int i=1;i<46;i++){\n if((i+1)*i/2 > n){\n k=i-1;\n break;\n }\n if((i+1)*i/2 == n){\n k=i;\n break;\n }\n }\n printf(\"%d\\n\",k);\n for(int i=1;i\n#include\n#include\n#include\nint n,k,dif;\nint main(){\n scanf(\"%d\",&n);\n for(int i=1;i<46;i++){\n if((i+1)*i/2 > n){\n k=i-1;\n break;\n }\n if((i+1)*i/2 == n){\n k=i;\n break;\n }\n }\n printf(\"%d\\n\",k);\n for(int i=1;i\n\nint main()\n{\n int n ;\n scanf(\"%d\",&n);\n int i;\n int k=0;\n int t[n];\n int m=n;\n for (i=1;(i0);i++)\n {\n if (n-i<=i)\n {\n\n t[k]=n;\n n=0 ;\n k++;\n }\n else\n {\n n=n-i;\n t[k]=i;\n k++;\n }\n }\n\n printf(\"%d\\n\",k);\n for(i=0;i //http://codeforces.com/problemset/problem/753/A\nint main()\n{\n\tint i,n; scanf(\"%d\",&n);\n\t\n\tfor(i=0;i*(i+1)/2\nint main()\n{\n int x,l,q=0,s=0,k,z,n=0;\n scanf(\"%d\",&k);\n z=k;\n for(l=1;l<=z;l++)\n {\n s+=l;\n if(s>=z)\n {\n n=l;\n break;\n }\n }\n\n if(s==z)\n {\n printf(\"%d\\n\",n);\n for(x=1;x<=n;x++)\n printf(\"%d\",x);\n }\n else if(s>z)\n {\n printf(\"%d\\n\",n-1);\n for(x=1;x\nint main()\n{\n int n,k,j,i,p,s;\n int arr[100];\n printf(\"enter the number of toffiess \\n\");\n scanf(\"%d\",&n);\n k=0;\n j=0;\n for(i=1;i+j<=n;i++)\n {\n k++;\n j=j+i;\n }\n printf(\"%d \\n\",k);\n p=0;\n for(i=0;i<=k-2;i++)\n arr[i]=i+1;\n for(i=0;i<=k-2;i++)\n p=p+i+1;\n s=n-p;\n for(i=0;i<=k-2;i++)\n printf(\"%d \",arr[i]);\n\n printf(\"%d \",s);\n\n}\n"}, {"source_code": "#include \n\nint main () {\n int candies;\n int i = 1;\n int j;\n int soma = 0;\n scanf(\"%d\", &candies);\n while (soma < candies) {\n soma += i;\n i++;\n }\n if (soma == candies) {\n printf (\"%d\\n\", i - 1);\n for (j = 1; j <= i; j++) {\n if (j == i) {\n printf (\"%d\\n\", j);\n }\n else {\n printf (\"%d \", j);\n }\n }\n }\n else {\n printf(\"%d\\n\", i - 2);\n for (j = 1; j <= i - 1; j++) {\n if (j == i - 1) {\n printf (\"%d\\n\", j);\n }\n else if (j == soma - candies) {\n }\n else {\n printf (\"%d \", j);\n }\n }\n }\n return 0;\n}\n\n"}, {"source_code": "#include \nint main()\n{\t \n int a;\n\tscanf(\"%d\",&a);\n\tint num=0;\n\tint x[1000];\n\tint sum=a;\n\tfor(int n=1;;n++){\n\t\tsum=sum-n;\n\t\tif(sum>0){\n\t\t\tx[num]=n;\n\t\t\tnum++;\n\t\t}\n\t\telse{\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(sum==0){\n\t\tprintf(\"%d\\n\",num);\n\t\tfor(int n=0;n\nint main()\n{\t \n int a;\n\tscanf(\"%d\",&a);\n\tint num=0;\n\tint x[1000];\n\tint sum=a;\n\tfor(int n=1;;n++){\n\t\tsum=sum-n;\n\t\tif(sum>0){\n\t\t\tx[num]=n;\n\t\t\tnum++;\n\t\t}\n\t\telse{\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(sum==0){\n\t\tfor(int n=0;n\n#include\n#include\nint judge(char s[])\n{\n if(strcmp(s,\"monday\")==0)\n return 1;\n if(strcmp(s,\"tuesday\")==0)\n return 2;\n if(strcmp(s,\"wednesday\")==0)\n return 3;\n if(strcmp(s,\"thursday\")==0)\n return 4;\n if(strcmp(s,\"friday\")==0)\n return 5;\n if(strcmp(s,\"saturday\")==0)\n return 6;\n if(strcmp(s,\"sunday\")==0)\n return 7;\n}///��Ӣ��ת��Ϊ����\nint main()\n{\n char s1[20],s2[20],n,m;\n int i;\n while(~scanf(\"%s%s\",s1,s2))\n {\n n=judge(s1);\n m=judge(s2);\n int a=(m-n+7)%7;///������ֵǮ��һ����\n if(a==3||a==2||a==0)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n }\n return 0;\n\n}\n\n"}, {"source_code": "#include\n\nint main()\n{\n int n;\n\n scanf(\"%d\",&n);\n\n int can[n+1];\n int i,ck = 0;\n\n for(i = n; ; ){\n if(i == 2 || i == 1){\n can[ck] = i;\n ck++;\n break;\n }\n else{\n int d;\n d = (int)(i/2) + 1;\n i -= d;\n can[ck] = d;\n ck++;\n }\n }\n printf(\"%d\\n\",ck);\n\n for(i = 0; i < ck; i++){\n if(i == ck-1){\n printf(\"%d\\n\",can[i]);\n }\n else{\n printf(\"%d \",can[i]);\n }\n }\n return 0;\n}\n\n\n\n"}, {"source_code": "#include\n#include\n\nint main()\n{\n\tint n,p=0,count=0,i;\n\t\n\tscanf(\"%d\",&n);\n\t\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tp=p+i;\n\t\t\n\t\tif(p>n)\n\t\tbreak;\n\t\t\n\t\tcount++;\n\t}\n\t\n\tprintf(\"%d\\n\",count);\n\t\n\tfor(i=1;i\n#include\n\nint main()\n{\n\tint n,p=0,count=0,i;\n\t\n\tscanf(\"%d\",&n);\n\t\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tp=p+i;\n\t\t\n\t\tif(p>n)\n\t\tbreak;\n\t\t\n\t\tcount++;\n\t}\n\t\n\tprintf(\"%d\\n\",count);\n\t\n\tfor(i=1;i\nint main()\n{\n\tint n,f,h;\n\tscanf(\"%d\",&n);\n\tint i=1;\n\tif(n==1)\n\t{\n\t\tprintf(\"1\\n\");\n\t\tprintf(\"1\\n\");\n\t}\n\telse\n\t{\n\twhile(n>(i*(i+1)/2))\n\t{\n\t\ti++;\n\t}\n\th=(i*(i+1)/2)-n;\n\tprintf(\"%d\\n\",i-1);\n\tfor(f=1;f\nint main()\n{\n\tint n,f,h;\n\tscanf(\"%d\",&n);\n\tint i=1;\n\twhile(n>(i*(i+1)/2))\n\t{\n\t\ti++;\n\t}\n\th=(i*(i+1)/2)-n;\n\tprintf(\"%d\\n\",i-1);\n\tfor(f=1;f\n#include \n\nint main()\n{\n int x;\n printf(\"enter the number of sweets: \");\n scanf(\"%d\", &x);\n int a[x], j=0, i, m=0;\n while(x!=0)\n {\n for(i=0; i\n\nint ans[100];\n\nint main()\n{\n\tint num, i, n;\n\n\tscanf(\"%d\", &n);\n\n\tfor(i = 1, num = 0; i <= n; i ++)\n\t{\n\t\tif(i <= n)\n\t\t\tans[num ++] = i;\n\t\tn -= i;\n\t}\n\n\tfor(i = 0; i < num; i ++)\n\t{\n\t\tif(i == num - 1)\n\t\t\tprintf(\"%d \", ans[i] + n);\n\t\telse\n\t\t\tprintf(\"%d \", ans[i]);\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int n,i,j,k,sum=0,p;\n scanf(\"%d\",&n);\n k=0;\n p=n;\n while(n-k-1>0)\n {\n n=n-k-1;\n k++;\n }\n if(p==1)\n {\n printf(\"1\\n\");\n printf(\"1\\n\");\n }\n else\n {\n printf(\"%d\\n\",k);\n j=1;\n for(i=1;i\nint main()\n{\n int n,i,j,k;\n scanf(\"%d\",&n);\n k=0;\n while(n-k-1>0)\n {\n n=n-k-1;\n k++;\n }\n printf(\"%d\\n\",k);\n j=1;\n for(i=1;i\nint main()\n{\n int n,i,j,k,sum=0,p;\n scanf(\"%d\",&n);\n k=0;\n p=n;\n while(n-k-1>0)\n {\n n=n-k-1;\n k++;\n }\n printf(\"%d\\n\",k);\n j=1;\n for(i=1;i\n#include \n#include \nvoid Q_santa(int n);\nint main()\n{\n\tQ_santa(9);\n\n}\nvoid Q_santa(int n)\n{\n\tdouble temp = floor((-1+sqrt(8*n+1))*0.5);\n\tprintf(\"%d\\n\", (int)temp);\n\tint i;\n\tint sum = 0;\n\tfor (i = 1; i <= temp; i++)\n\t{\t\n\t\tif (i != temp)\n\t\t{\n\t\t\tsum += i;\n\t\t\tprintf(\"%d \", i);\n\t\t\tfflush(stdout);\n\t\t}\n\t\telse\n\t\t\tprintf(\"%d\", n - sum);\n\t\t\n\t}\n}"}, {"source_code": "#include \n\nint main()\n{\n int n,k=1,t;\n n=t=0;\n scanf(\"%d\",&n);\n while ( t == 0 )\n {\n if( k*(k+1)/2< n && (k+1)*(k+2)/2> n )\n t=1;\n else\n ++k;\n }\n printf(\"%d\\n\",k);\n for(t=1;t\n\nint main()\n{\n int n,k=1,t;\n n=t=0;\n scanf(\"%d\",&n);\n if( n==1 )\n {\n printf(\"1\\n1\");\n }\n else\n {\n while ( t == 0 )\n {\n if( k*(k+1)/2< n && (k+1)*(k+2)/2> n )\n t=1;\n else\n ++k;\n }\n printf(\"%d\\n\",k);\n for(t=1;t\n\nint main()\n{\n int n,k=1,t;\n n=t=0;\n scanf(\"%d\",&n);\n if( n==1 )\n {\n printf(\"1\\n1\");\n }\n else if( n==3 )\n {\n printf(\"1\\n1 2\");\n }\n else\n {\n while ( t == 0 )\n {\n if( k*(k+1)/2< n && (k+1)*(k+2)/2> n )\n t=1;\n else\n ++k;\n }\n printf(\"%d\\n\",k);\n for(t=1;t\n\nint main()\n{\n int n,k=1,t;\n n=t=0;\n scanf(\"%d\",&n);\n if( n==1 )\n {\n printf(\"1\\n1\");\n }\n else if( n==3 )\n {\n printf(\"2\\n1 2\");\n }\n else\n {\n while ( t == 0 )\n {\n if( k*(k+1)/2< n && (k+1)*(k+2)/2> n )\n t=1;\n else\n ++k;\n }\n printf(\"%d\\n\",k);\n for(t=1;t\n#include\n\nint main(){\n\nint s=0,i=1,j,n,k,L[50];\n\n\nscanf(\"%d\",&n);\n\nwhile (s<=n){\ns=s+i;\nL[i-1]=i;\ni=i+1;\n}\n\nk=i-1;\n\n\nif(s-i-1!=n){\n int j=n-s+i+1;\n if(j==k-1){for(i=0;i!=j;i++){\n L[i]+=1;\n }}\n else{\n L[k-2]+=j;\n }\n\n}\n\n\nfor (i=0;i!=k-1;i++){\nprintf(\"%d \",L[i]);\n}\n\n}\n"}, {"source_code": "#include\n#include\n\nint main(){\n\nint s=0,i=1,j,n,k,L[50];\n\n\nscanf(\"%d\",&n);\n\nwhile (s<=n){\ns=s+i;\nL[i-1]=i;\ni=i+1;\n}\nk=i-1;\nif(s-i-1!=n){\n int j=n-s+i+1;\n for(i=0;i!=j;i++){\n L[i]+=1;\n }\n}\n\nprintf(\"%d\\n\",k-1);\nfor (i=0;i!=k-1;i++){\nprintf(\"%d \",L[i]);\n}\n\n}\n"}, {"source_code": "#include\n#include\n\nint main(){\n\nint s=0,i=1,j,n,k,L[50];\n\n\nscanf(\"%d\",&n);\n\nwhile (s<=n){\ns=s+i;\nL[i-1]=i;\ni=i+1;\n}\n\nk=i-1;\nfor (i=0;i!=k-1;i++){\nprintf(\"%d \",L[i]);\n}\nif(s-i-1!=n){\n int j=n-s+i+1;\n if(j==k-1){for(i=0;i!=j;i++){\n L[i]+=1;\n }}\n else{\n L[k-2]+=j;\n }\n\n}\n\nprintf(\"%d\\n\",k-1);\nfor (i=0;i!=k-1;i++){\nprintf(\"%d \",L[i]);\n}\n\n}\n"}, {"source_code": "#include\nint main(){\n int a[1000], i, s=0, n, k=0, b[100],c=1,sum=0;\n scanf(\"%d\", &n);\n for(i=1;i<=n;i++){\n s=s+i;\n a[i-1]=s;\n }\n for(i=0;a[i]<=n;i++){\n k++;\n }\n printf(\"%d\\n\",k);\n for(i=0;i\nint main()\n{\n\tint n,k,l;\n\tint a[40];\n\tint i,j;\n\tfor(i=1;i<=35;i++)\n\t\ta[i]=(1+i)*i/2;\n\tscanf(\"%d\",&n);\n\tfor(i=1;i<=35;i++)\n\t\tif(a[i]>=n)\n\t\t\tbreak;\n\tif(a[i]==n)\n\t\tk=i;\n\telse\n\t\tk=i-1;\n\tl=a[i]-n;\n\tprintf(\"%d\\n\",k);\n\tfor(i=1,j=1;i<=k;j++)\n\t{\n\t\tif(j!=l)\n\t\t{\n\t\t\tprintf(\"%d \",j);\n\t\t\ti++;\n\t\t}\n\t}\n\treturn 0;\n}\n"}], "src_uid": "356a7bcebbbd354c268cddbb5454d5fc"} {"nl": {"description": "The only difference between easy and hard versions is constraints.Polycarp loves to listen to music, so he never leaves the player, even on the way home from the university. Polycarp overcomes the distance from the university to the house in exactly $$$T$$$ minutes.In the player, Polycarp stores $$$n$$$ songs, each of which is characterized by two parameters: $$$t_i$$$ and $$$g_i$$$, where $$$t_i$$$ is the length of the song in minutes ($$$1 \\le t_i \\le 15$$$), $$$g_i$$$ is its genre ($$$1 \\le g_i \\le 3$$$).Polycarp wants to create such a playlist so that he can listen to music all the time on the way from the university to his home, and at the time of his arrival home, the playlist is over. Polycarp never interrupts songs and always listens to them from beginning to end. Thus, if he started listening to the $$$i$$$-th song, he would spend exactly $$$t_i$$$ minutes on its listening. Polycarp also does not like when two songs of the same genre play in a row (i.e. successively/adjacently) or when the songs in his playlist are repeated.Help Polycarpus count the number of different sequences of songs (their order matters), the total duration is exactly $$$T$$$, such that there are no two consecutive songs of the same genre in them and all the songs in the playlist are different.", "input_spec": "The first line of the input contains two integers $$$n$$$ and $$$T$$$ ($$$1 \\le n \\le 15, 1 \\le T \\le 225$$$) — the number of songs in the player and the required total duration, respectively. Next, the $$$n$$$ lines contain descriptions of songs: the $$$i$$$-th line contains two integers $$$t_i$$$ and $$$g_i$$$ ($$$1 \\le t_i \\le 15, 1 \\le g_i \\le 3$$$) — the duration of the $$$i$$$-th song and its genre, respectively.", "output_spec": "Output one integer — the number of different sequences of songs, the total length of exactly $$$T$$$, such that there are no two consecutive songs of the same genre in them and all the songs in the playlist are different. Since the answer may be huge, output it modulo $$$10^9 + 7$$$ (that is, the remainder when dividing the quantity by $$$10^9 + 7$$$).", "sample_inputs": ["3 3\n1 1\n1 2\n1 3", "3 3\n1 1\n1 1\n1 3", "4 10\n5 3\n2 1\n3 2\n5 1"], "sample_outputs": ["6", "2", "10"], "notes": "NoteIn the first example, Polycarp can make any of the $$$6$$$ possible playlist by rearranging the available songs: $$$[1, 2, 3]$$$, $$$[1, 3, 2]$$$, $$$[2, 1, 3]$$$, $$$[2, 3, 1]$$$, $$$[3, 1, 2]$$$ and $$$[3, 2, 1]$$$ (indices of the songs are given).In the second example, the first and second songs cannot go in succession (since they have the same genre). Thus, Polycarp can create a playlist in one of $$$2$$$ possible ways: $$$[1, 3, 2]$$$ and $$$[2, 3, 1]$$$ (indices of the songs are given).In the third example, Polycarp can make the following playlists: $$$[1, 2, 3]$$$, $$$[1, 3, 2]$$$, $$$[2, 1, 3]$$$, $$$[2, 3, 1]$$$, $$$[3, 1, 2]$$$, $$$[3, 2, 1]$$$, $$$[1, 4]$$$, $$$[4, 1]$$$, $$$[2, 3, 4]$$$ and $$$[4, 3, 2]$$$ (indices of the songs are given)."}, "positive_code": [{"source_code": "#include \n \n#define N\t50\n#define T\t2500\n#define MD\t1000000007\n \nint dp[N + 1][N + 1][N + 1], dq[N + 1][N + 1][N + 1][3];\n \nvoid init(int na, int nb, int nc) {\n\tint ma, mb, mc, x0, x1, x2;\n \n\tfor (ma = 0; ma <= na; ma++)\n\t\tfor (mb = 0; mb <= nb; mb++)\n\t\t\tfor (mc = 0; mc <= nc; mc++) {\n\t\t\t\tx0 = ma > 0 ? (long long) dq[ma - 1][mb][mc][0] * ma % MD : 0;\n\t\t\t\tx1 = mb > 0 ? (long long) dq[ma][mb - 1][mc][1] * mb % MD : 0;\n\t\t\t\tx2 = mc > 0 ? (long long) dq[ma][mb][mc - 1][2] * mc % MD : 0;\n\t\t\t\tif (ma == 0 && mb == 0 && mc == 0) {\n\t\t\t\t\tdp[ma][mb][mc] = 1;\n\t\t\t\t\tdq[ma][mb][mc][0] = dq[ma][mb][mc][1] = dq[ma][mb][mc][2] = 1;\n\t\t\t\t} else {\n\t\t\t\t\tdp[ma][mb][mc] = ((long long) x0 + x1 + x2) % MD;\n\t\t\t\t\tdq[ma][mb][mc][0] = (x1 + x2) % MD;\n\t\t\t\t\tdq[ma][mb][mc][1] = (x0 + x2) % MD;\n\t\t\t\t\tdq[ma][mb][mc][2] = (x0 + x1) % MD;\n\t\t\t\t}\n\t\t\t}\n}\n \nvoid solve1(int *aa, int t, int n, int da[][N + 1]) {\n\tint i, s, m, a;\n \n\tfor (s = 0; s <= t; s++)\n\t\tfor (m = 0; m <= n; m++)\n\t\t\tda[0][0] = 0;\n\tda[0][0] = 1;\n\tfor (i = 0; i < n; i++) {\n\t\ta = aa[i];\n\t\tfor (s = t; s >= a; s--)\n\t\t\tfor (m = 1; m <= n; m++)\n\t\t\t\tda[s][m] = (da[s][m] + da[s - a][m - 1]) % MD;\n\t}\n}\n \nvoid solve2(int *aa, int *bb, int t, int na, int nb, int dab[][N + 1][N + 1]) {\n\tstatic int da[T + 1][N + 1];\n\tint i, b, s, ma, mb;\n \n\tsolve1(aa, t, na, da);\n\tfor (s = 0; s <= t; s++)\n\t\tfor (ma = 0; ma <= na; ma++) {\n\t\t\tdab[s][ma][0] = da[s][ma];\n\t\t\tfor (mb = 1; mb <= nb; mb++)\n\t\t\t\tdab[s][ma][mb] = 0;\n\t\t}\n\tfor (i = 0; i < nb; i++) {\n\t\tb = bb[i];\n\t\tfor (s = t; s >= b; s--)\n\t\t\tfor (ma = 0; ma <= na; ma++)\n\t\t\t\tfor (mb = 1; mb <= nb; mb++)\n\t\t\t\t\tdab[s][ma][mb] = (dab[s][ma][mb] + dab[s - b][ma][mb - 1]) % MD;\n\t}\n}\n \nint main() {\n\tstatic int aa[N], bb[N], cc[N], dab[T + 1][N + 1][N + 1], dc[T + 1][N + 1];\n\tint n, na, nb, nc, t, tab, tc, ma, mb, mc, xab, xc, ans;\n \n\tscanf(\"%d%d\", &n, &t);\n\tna = nb = nc = 0;\n\twhile (n--) {\n\t\tint a, g;\n \n\t\tscanf(\"%d%d\", &a, &g);\n\t\tif (g == 1)\n\t\t\taa[na++] = a;\n\t\telse if (g == 2)\n\t\t\tbb[nb++] = a;\n\t\telse\n\t\t\tcc[nc++] = a;\n\t}\n\tinit(na, nb, nc);\n\tsolve1(cc, t, nc, dc);\n\tsolve2(aa, bb, t, na, nb, dab);\n\tans = 0;\n\tfor (tab = 0; tab <= t; tab++) {\n\t\ttc = t - tab;\n\t\tfor (ma = 0; ma <= na; ma++)\n\t\t\tfor (mb = 0; mb <= nb; mb++)\n\t\t\t\tif ((xab = dab[tab][ma][mb]))\n\t\t\t\t\tfor (mc = 0; mc <= nc; mc++)\n\t\t\t\t\t\tif ((xc = dc[tc][mc]))\n\t\t\t\t\t\t\tans = (ans + (long long) xab * xc % MD * dp[ma][mb][mc]) % MD;\n\t}\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}"}, {"source_code": "/* https://codeforces.com/contest/1185/submission/55797221 (Dukkha) */\n#include \n\n#define N\t50\n#define T\t2500\n#define MD\t1000000007\n\nint dp[N + 1][N + 1][N + 1], dq[N + 1][N + 1][N + 1][3];\n\nvoid init(int na, int nb, int nc) {\n\tint ma, mb, mc, x0, x1, x2;\n\n\tfor (ma = 0; ma <= na; ma++)\n\t\tfor (mb = 0; mb <= nb; mb++)\n\t\t\tfor (mc = 0; mc <= nc; mc++) {\n\t\t\t\tx0 = ma > 0 ? (long long) dq[ma - 1][mb][mc][0] * ma % MD : 0;\n\t\t\t\tx1 = mb > 0 ? (long long) dq[ma][mb - 1][mc][1] * mb % MD : 0;\n\t\t\t\tx2 = mc > 0 ? (long long) dq[ma][mb][mc - 1][2] * mc % MD : 0;\n\t\t\t\tif (ma == 0 && mb == 0 && mc == 0) {\n\t\t\t\t\tdp[ma][mb][mc] = 1;\n\t\t\t\t\tdq[ma][mb][mc][0] = dq[ma][mb][mc][1] = dq[ma][mb][mc][2] = 1;\n\t\t\t\t} else {\n\t\t\t\t\tdp[ma][mb][mc] = ((long long) x0 + x1 + x2) % MD;\n\t\t\t\t\tdq[ma][mb][mc][0] = (x1 + x2) % MD;\n\t\t\t\t\tdq[ma][mb][mc][1] = (x0 + x2) % MD;\n\t\t\t\t\tdq[ma][mb][mc][2] = (x0 + x1) % MD;\n\t\t\t\t}\n\t\t\t}\n}\n\nvoid solve1(int *aa, int t, int n, int da[][N + 1]) {\n\tint i, s, m, a;\n\n\tfor (s = 0; s <= t; s++)\n\t\tfor (m = 0; m <= n; m++)\n\t\t\tda[0][0] = 0;\n\tda[0][0] = 1;\n\tfor (i = 0; i < n; i++) {\n\t\ta = aa[i];\n\t\tfor (s = t; s >= a; s--)\n\t\t\tfor (m = 1; m <= n; m++)\n\t\t\t\tda[s][m] = (da[s][m] + da[s - a][m - 1]) % MD;\n\t}\n}\n\nvoid solve2(int *aa, int *bb, int t, int na, int nb, int dab[][N + 1][N + 1]) {\n\tstatic int da[T + 1][N + 1];\n\tint i, b, s, ma, mb;\n\n\tsolve1(aa, t, na, da);\n\tfor (s = 0; s <= t; s++)\n\t\tfor (ma = 0; ma <= na; ma++) {\n\t\t\tdab[s][ma][0] = da[s][ma];\n\t\t\tfor (mb = 1; mb <= nb; mb++)\n\t\t\t\tdab[s][ma][mb] = 0;\n\t\t}\n\tfor (i = 0; i < nb; i++) {\n\t\tb = bb[i];\n\t\tfor (s = t; s >= b; s--)\n\t\t\tfor (ma = 0; ma <= na; ma++)\n\t\t\t\tfor (mb = 1; mb <= nb; mb++)\n\t\t\t\t\tdab[s][ma][mb] = (dab[s][ma][mb] + dab[s - b][ma][mb - 1]) % MD;\n\t}\n}\n\nint main() {\n\tstatic int aa[N], bb[N], cc[N], dab[T + 1][N + 1][N + 1], dc[T + 1][N + 1];\n\tint n, na, nb, nc, t, tab, tc, ma, mb, mc, xab, xc, ans;\n\n\tscanf(\"%d%d\", &n, &t);\n\tna = nb = nc = 0;\n\twhile (n--) {\n\t\tint a, g;\n\n\t\tscanf(\"%d%d\", &a, &g);\n\t\tif (g == 1)\n\t\t\taa[na++] = a;\n\t\telse if (g == 2)\n\t\t\tbb[nb++] = a;\n\t\telse\n\t\t\tcc[nc++] = a;\n\t}\n\tinit(na, nb, nc);\n\tsolve1(cc, t, nc, dc);\n\tsolve2(aa, bb, t, na, nb, dab);\n\tans = 0;\n\tfor (tab = 0; tab <= t; tab++) {\n\t\ttc = t - tab;\n\t\tfor (ma = 0; ma <= na; ma++)\n\t\t\tfor (mb = 0; mb <= nb; mb++)\n\t\t\t\tif ((xab = dab[tab][ma][mb]))\n\t\t\t\t\tfor (mc = 0; mc <= nc; mc++)\n\t\t\t\t\t\tif ((xc = dc[tc][mc]))\n\t\t\t\t\t\t\tans = (ans + (long long) xab * xc % MD * dp[ma][mb][mc]) % MD;\n\t}\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "/* https://csacademy.com/submission/2215090/ */\n#include \n\n#define N\t50\n#define M\t(1 << 13) /* 2500 < M / 2 */\n#define LN\t13\n#define MD\t1000000007\n#define M0\t469762049\n#define M1\t595591169\n#define M2\t645922817\n\nint MM[] = { M0, M1, M2 };\n\nint V01, V02, V12;\n\nlong long power(int a, int b, int md) {\n\tlong long p;\n\n\tif (b == 0)\n\t\treturn 1;\n\tp = power(a, b / 2, md);\n\tp = p * p % md;\n\tif (b % 2)\n\t\tp = p * a % md;\n\treturn p;\n}\n\nlong long ww[3][LN + 1], ww_[3][LN + 1], vv[3];\nint kk[N + 1][N + 1][N + 1], ll[N + 1][N + 1][N + 1][3];\n\nvoid init() {\n\tint d, h, i, j, k;\n\n\tfor (d = 0; d < 3; d++) {\n\t\tint md = MM[d];\n\n\t\tfor (h = 0; h <= LN; h++) {\n\t\t\tww[d][h] = power(3, (md - 1) >> h, md);\n\t\t\tww_[d][h] = power(3, md - 1 - ((md - 1) >> h), md);\n\t\t}\n\t\tvv[d] = power(M, md - 2, md);\n\t}\n\tV01 = power(M0, M1 - 2, M1);\n\tV02 = power(M0, M2 - 2, M2);\n\tV12 = power(M1, M2 - 2, M2);\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\tlong long k0, k1, k2;\n\n\t\t\t\tk0 = i > 0 ? (long long) ll[i - 1][j][k][0] * i % MD : 0;\n\t\t\t\tk1 = j > 0 ? (long long) ll[i][j - 1][k][1] * j % MD : 0;\n\t\t\t\tk2 = k > 0 ? (long long) ll[i][j][k - 1][2] * k % MD : 0;\n\t\t\t\tif (i == 0 && j == 0 && k == 0) {\n\t\t\t\t\tkk[i][j][k] = 1;\n\t\t\t\t\tll[i][j][k][0] = ll[i][j][k][1] = ll[i][j][k][2] = 1;\n\t\t\t\t} else {\n\t\t\t\t\tkk[i][j][k] = (k0 + k1 + k2) % MD;\n\t\t\t\t\tll[i][j][k][0] = (k1 + k2) % MD;\n\t\t\t\t\tll[i][j][k][1] = (k0 + k2) % MD;\n\t\t\t\t\tll[i][j][k][2] = (k0 + k1) % MD;\n\t\t\t\t}\n\t\t\t}\n}\n\nvoid ntt(int *aa, int d, int inverse) {\n\tint md = MM[d], h, i, j, b, l, r, u, v, tmp;\n\tlong long w, w_;\n\n\tfor (i = 1, j = 0; i < M; i++) {\n\t\tb = M;\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) < M; h++) {\n\t\tw_ = inverse ? ww_[d][h + 1] : ww[d][h + 1];\n\t\tfor (i = 0; i < M; 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\nvoid fft(int *aa, int *bb, int d) {\n\tint md = MM[d], i;\n\tlong long v;\n\n\tntt(aa, d, 0), ntt(bb, d, 0);\n\tfor (i = 0; i < M; i++)\n\t\taa[i] = (long long) aa[i] * bb[i] % md;\n\tntt(aa, d, 1);\n\tv = vv[d];\n\tfor (i = 0; i < M; i++)\n\t\taa[i] = aa[i] * v % md;\n}\n\nint garner(int r0, int r1, int r2) {\n\tif (r0 < 0)\n\t\tr0 += M0;\n\tr1 = (long long) (r1 - r0) * V01 % M1;\n\tif (r1 < 0)\n\t\tr1 += M1;\n\tr2 = ((long long) (r2 - r0) * V02 - r1) % M2 * V12 % M2;\n\tif (r2 < 0)\n\t\tr2 += M2;\n\treturn (((long long) r2 * M1 + r1) % MD * M0 + r0) % MD;\n}\n\nvoid mult(int *aa, int *bb, int *cc) {\n\tstatic int cc_[3][M], bb_[M];\n\tint d, i;\n\n\tfor (d = 0; d < 3; d++) {\n\t\tfor (i = 0; i < M; i++) {\n\t\t\tcc_[d][i] = aa[i];\n\t\t\tbb_[i] = bb[i];\n\t\t}\n\t\tfft(cc_[d], bb_, d);\n\t}\n\tfor (i = 0; i < M; i++)\n\t\tcc[i] = garner(cc_[0][i], cc_[1][i], cc_[2][i]);\n}\n\nvoid knapsack(int *aa, int n, int m, int dp[][M]) {\n\tint h, i, j, a;\n\n\tdp[0][0] = 1;\n\tfor (h = 0; h < n; h++) {\n\t\ta = aa[h];\n\t\tfor (i = n; i >= 1; i--)\n\t\t\tfor (j = m; j >= a; j--)\n\t\t\t\tdp[i][j] = (dp[i][j] + dp[i - 1][j - a]) % MD;\n\t}\n}\n\nint main() {\n\tstatic int aa[3][N], cc[M], nn[3], dp[3][N + 1][M];\n\tint n, m, x, h, i0, i1, i2, j, ans;\n\n\tinit();\n\tscanf(\"%d%d\", &n, &m);\n\twhile (n--) {\n\t\tscanf(\"%d%d\", &x, &h), h--;\n\t\taa[h][nn[h]++] = x;\n\t}\n\tfor (h = 0; h < 3; h++)\n\t\tknapsack(aa[h], nn[h], m, dp[h]);\n\tans = 0;\n\tfor (i0 = 0; i0 <= nn[0]; i0++)\n\t\tfor (i1 = 0; i1 <= nn[1]; i1++) {\n\t\t\tmult(dp[0][i0], dp[1][i1], cc);\n\t\t\tfor (i2 = 0; i2 <= nn[2]; i2++)\n\t\t\t\tfor (j = 0; j <= m; j++)\n\t\t\t\t\tans = (ans + (long long) cc[j] * dp[2][i2][m - j] % MD * kk[i0][i1][i2]) % MD;\n\t\t}\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include \n\n#define max2(a,b) (a T)\n return 0;\n if (t == T) {\n u64 r = 0;\n for (int g = 0; g < 3; g++)\n r = add2(r, perm[n[0]][n[1]][n[2]][g]);\n r = mul2(r, fact3(n[0],n[1],n[2]));\n // printf(\"%d [%d,%d,%d]: %d -> %d\\n\", t, n[0], n[1], n[2], G[c], r);\n return r;\n }\n\n u64 result = 0;\n for (int i = c + 1; i < N; i++) {\n n[G[i]]++;\n result = add2(result, walk(t + L[i], i));\n n[G[i]]--;\n }\n\n return result;\n}\n\nint main() {\n int i, j, k, n;\n\n scanf(\"%d %d\", &N, &T);\n for (i = 0; i < N; i++) {\n scanf(\"%d %d\", &L[i], &G[i]);\n G[i]--;\n }\n\n perm[1][0][0][0] = perm[0][1][0][1] = perm[0][0][1][2] = 1;\n\n for (n = 2; n <= N; n++)\n for (i = 0; i <= n/2+1; i++)\n for (j = 0; j <= n - i; j++) {\n k = n - i - j;\n if (k > n/2+1) continue;\n\n if (i) perm[i][j][k][0] = add2(perm[i-1][j][k][1], perm[i-1][j][k][2]);\n if (j) perm[i][j][k][1] = add2(perm[i][j-1][k][2], perm[i][j-1][k][0]);\n if (k) perm[i][j][k][2] = add2(perm[i][j][k-1][0], perm[i][j][k-1][1]);\n }\n\n printf(\"%llu\\n\", walk(0, -1));\n\n return 0;\n}\n"}], "negative_code": [], "src_uid": "ac2a37ff4c7e89a345b189e4891bbf56"} {"nl": {"description": "Little Chris is bored during his physics lessons (too easy), so he has built a toy box to keep himself occupied. The box is special, since it has the ability to change gravity.There are n columns of toy cubes in the box arranged in a line. The i-th column contains ai cubes. At first, the gravity in the box is pulling the cubes downwards. When Chris switches the gravity, it begins to pull all the cubes to the right side of the box. The figure shows the initial and final configurations of the cubes in the box: the cubes that have changed their position are highlighted with orange. Given the initial configuration of the toy cubes in the box, find the amounts of cubes in each of the n columns after the gravity switch!", "input_spec": "The first line of input contains an integer n (1 ≤ n ≤ 100), the number of the columns in the box. The next line contains n space-separated integer numbers. The i-th number ai (1 ≤ ai ≤ 100) denotes the number of cubes in the i-th column.", "output_spec": "Output n integer numbers separated by spaces, where the i-th number is the amount of cubes in the i-th column after the gravity switch.", "sample_inputs": ["4\n3 2 1 2", "3\n2 3 8"], "sample_outputs": ["1 2 2 3", "2 3 8"], "notes": "NoteThe first example case is shown on the figure. The top cube of the first column falls to the top of the last column; the top cube of the second column falls to the top of the third column; the middle cube of the first column falls to the top of the second column.In the second example case the gravity switch does not change the heights of the columns."}, "positive_code": [{"source_code": "#include\nint main(){\n int n;\n scanf(\"%d\",&n );\n int a[n];\n int temp;\n for(int i=0;ia[j+1]){\n temp=a[j];\n a[j]=a[j+1];\n a[j+1]=temp;\n }\n }\n }\n for(int i=0;i value2) return 1;\n return 0;\n}\n\n\nint main(){\n int n,i,temp;\n scanf(\"%d\", &n);\n int A[n];\n for (i=0; i A[i+1]){\n temp= A[i+1];\n A[i+1] = A[i];\n A[i] = temp;\n }\n }*/\n for(i =0;i\nint main()\n{\n int n, i, j, mini, k;\n scanf(\"%d\", &n);\n\n int ar[n];\n\n for(i = 0; i < n; i++){\n scanf(\"%d\", &ar[i]);\n }\n\n //mini = ar[0];\n\n for(i = 0; i < n; i++){\n mini = ar[i];\n for(j = 0; j < n; j++){\n if(mini >= ar[j]){\n mini = ar[j];\n k = j;\n }\n }\n printf(\"%d \", mini);\n ar[k] = 101;\n }\n\n return 0;\n}\n\n"}, {"source_code": "#include\nvoid merge(int a[],int low,int mid, int high)\n{\n int temp[high-low+1];\n int p1=low,p2=mid+1,k=0,i;\n while(p1<=mid && p2<=high)\n {\n if(a[p1]\n#include \n\nint main()\n{\n int a;\n scanf(\"%d\",&a);\n int x [100];\n int Temp=0;\n int i ,j;\n for (i=0;ix[j] ){\n Temp=x[i];\n x[i]=x[j];\n x[j]=Temp;\n }\n }\n }\n\n for (i=0;i\nint main()\n{\nint n,m,j,i,arr[105],min=0,pos_min,temp;\nscanf(\"%d\",&n);\nmin=arr[0];\nfor(i=0;i\nint main (){\n int aux,n,pass=0,i,permut,a[100];\n do{\n scanf(\"%d\",&n);\n }while ((n>101)&&(n<0));\nfor (i=0;i101));\ndo{\n permut=0;\n for (i=0;ia[i+1])\n {\n aux=a[i+1];\n a[i+1]=a[i];\n a[i]=aux;\n permut++;\n }\n pass++;\n}while (permut!=0);\nfor (i=0;i //To include standard input and output.\n\n/*Defining a function min to find minimum of two numbers.*/\nint min(int x, int y)\n{\n int z;\n if(x>y) //Checking the condition.\n z=y; //assigning the minimum value to z\n else\n z=x; //assigning the minimum value to z\n return z;\n}\n\n/*Defining a function to merge two sorted (in increasing order) arrays in increasing order*/\nvoid merge(int aa[], int ab[], int ac[], int p, int q)\n{\n int i=1, j=0, k=0; //i, j and k are used to keep index of number in aa, ab and ac respectively.\n ac[0]=min(aa[0], ab[0]); //assigning the minimum number of both arrays to ac[0].\n if(aa[0]==ac[0])\n j++; //incrementing j to go for next number of aa[].\n else\n k++; //incrementing k to go for next number of ab[].\n while(j1)\n {\n if(m%2==0) //When the total numbers is even.\n {\n int i, left[m/2], right[m/2]; //defining two new arrays.\n for(i=0;i\nint main() {\n\tint sum,i,j,k,l,n,m,x,a[105][105]={0};\n\tscanf(\"%d\",&n);\n\tfor(i=1;i<=n;i++) {\n\t\tscanf(\"%d\",&x);\n\t\tfor(j=1;j<=x;j++)\n\t\t\ta[j][i] = 1;\n\t}\n\tfor(i=100;i>=1;i--) {\n\t\tfor(j=n;j>=1;j--) {\n\t\t\tif(a[i][j] == 1){\n\t\t\t\tk = j;\n\t\t\t\twhile(k < n && a[i][k+1] == 0) {\n\t\t\t\t\ta[i][k] = 0;\n\t\t\t\t\ta[i][k+1] = 1;\n\t\t\t\t\tk++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tfor(i=1;i<=n;i++) {\n\t\tsum = 0;\n\t\tfor(j=1;j<=100;j++)\n\t\t\tsum += a[j][i];\n\t\tprintf(\"%d \",sum);\n\t}\n\tprintf(\"\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include\n#include\nint main(){\n\tint n,i,b,j,k;\n\tint m[100][100],m2[100][100];\n\tscanf(\"%d\",&n);\n\tfor(i=0;i<100;i++){\n\t\tfor(j=0;j<100;j++){\n\t\t\tm[i][j]=0;\n\t\t\tm2[i][j]=0;\n\t\t}\n\t}\n\tfor(i=100-n;i<100;i++){\n\t\tscanf(\"%d\",&b);\n\t\tfor(k=0;k-1+(100-r[i]);j--){\n\t\t\tm2[i][j]=1;\n\t\t}\n\t}\n\t\n//\tprintf(\"\\n\");\n//\tfor(i=80;i<100;i++){\n//\t\tfor(j=90;j<100;j++){\n//\t\t\tprintf(\"%d \",m2[i][j]);\n//\t\t}\n//\t\tprintf(\"\\n\");\n//\t}\n//\tprintf(\"\\n\");\n//\tprintf(\"cut\\n\");\n//\n//\tprintf(\"\\n\");\n\tint r2[100];\n\tfor(i=0;i<100;i++){\n\t\tfor(j=0;j<100;j++){\n\t\t\tif(m2[j][i]==1)\n\t\t\t\tno1++;\n\t\t}\n\t\tr2[i]=no1;\n\t//\tprintf(\" no1 is %d\\n\",no1);\n\t\tno1=0;\n\t}\n\t\n\tfor(i=100-n;i<100;i++){\n\t\tprintf(\"%d \",r2[i]);\n\t}\n\treturn 0;\n}"}, {"source_code": "\n#include\nint main()\n{\n\n int n,i,j,temp,a[100];\n scanf(\"%d\",&n);\n for(i=0;i=0&&a[j]>temp;j--)\n {\n a[j+1]=a[j];\n }\n\n a[j+1]=temp;\n }\n\n for(i=0;i\nint A[100];\nint main()\n{\n int n,m,k,max,i,r;\n scanf(\"%d\",&n);\n for(i=1; i<=n; i++)\n scanf(\"%d\",&A[i]);\n m=n;r=n;\n while(m--)\n{\n max=A[1];\n for(i=1; i<=n; i++)\n{\n if(A[i]>=max)\n {\n max=A[i];\n k=i;\n }\n}\nA[k]=A[n];\nA[n]=max;\nn--;\n}\nfor(i=1; i<=r; i++)\nprintf(\"%d \",A[i]);\nreturn 0;\n}\n"}, {"source_code": "#include \n\nint n1[110], niz[110];\n\nint main()\n{\n int n,i,j,x,max = 0;\n scanf(\"%d\",&n);\n for (i=1; i<=n; i=i+1)\n {\n scanf(\"%d\",&x);\n if (x>max) max=x;\n for (j=1; j<=x; j++)\n niz[j]++; \n }\n for (i=1; i<=max; i=i+1)\n {\n for (j=1; j<=niz[i]; j++)\n n1[n-j+1]++; \n }\n for (i=1;i<=n;i++)\n printf(\"%d \",n1[i]);\n return 0;\n} "}, {"source_code": "#include\nvoid swap(int *xp, int *yp)\n{\n int temp = *xp;\n *xp = *yp;\n *yp=temp;\n}\n\nvoid bubbleSort(int arr[], int n)\n{\n int i, j;\n for (i = 0; i < n-1; i++) {\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 }\n}\nint main()\n{\n int t,a,b;\n scanf(\"%d\",&t);\n int ar[t],arr[t];\n for(a=0;a\n#define SIZE 100\n\nint main(){\n\tint n,i,j;\n\tint min,temp;\n\tint arr[SIZE];\n\tmin = 101;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i=0;i--){\n\t\tif(arr[i] > min){\n\t\t\tfor(j=n-1;j>i;j--){\n\t\t\t\ttemp = arr[j];\n\t\t\t\twhile(arr[i] > temp){\n\t\t\t\t\tarr[i]--;\n\t\t\t\t\tarr[j]++;\n\t\t\t\t}\n\t\t\t}\n\t\t} \n\t}\n\tfor(i=0;i\nint main()\n{\n int n,i,j,k,dif=0;\n scanf(\"%d\",&n);\n int arr[n];\n for(i=0;i=0;i--)\n {\n for(k=i;karr[k+1])\n {\n dif=arr[k]-arr[k+1];\n arr[k+1]=arr[k+1]+dif;\n arr[k]=arr[k]-dif;\n }\n }\n }\n for(i=0;i\nint main()\n{\n int n, i, j, mini, k;\n scanf(\"%d\", &n);\n\n int ar[n];\n\n for(i = 0; i < n; i++){\n scanf(\"%d\", &ar[i]);\n }\n\n //mini = ar[0];\n\n for(i = 0; i < n; i++){\n mini = ar[i];\n for(j = i; j < n; j++){\n if(mini >= ar[j]){\n mini = ar[j];\n k = j;\n }\n }\n\n ar[k] = ar[i];\n ar[i] = mini;\n }\n\n for(i = 0; i < n; i++){\n printf(\"%d \", ar[i]);\n }\n\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main()\n{\n int j,g,i,n;\n int a[100];\n scanf(\"%d\",&n);\n for(i=0;ia[j])\n {\n g=a[i];\n a[i]=a[j];\n a[j]=g;\n }\n\n }\n }\n for(i=0;i\n#include\n\nint main()\n{\n\tint arr[100],tmp,n;\n\tscanf(\"%d\", &n);\n\tfor (int i = 0; i < n; i++)\n\t{\n\t\tscanf(\"%d\", &arr[i]);\n\n\t}\n\tfor (int i = 0; i < n; i++)\n\t{\n\t\tfor (int j = i + 1; j < n;j++)\n {\n\t\t\tif (arr[j] <= arr[i])\n\t\t\t{\n\t\t\t\ttmp = arr[i];\n\t\t\t\tarr[i] = arr[j];\n\t\t\t\tarr[j] = tmp;\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfor (int i = 0; i < n; i++)\n\t{\n\t\tprintf(\"%d \", arr[i]);\n\t}\n\tprintf(\"\\n\");\n\n}"}, {"source_code": "#include\nint main()\n{\n\tint n,i,j,a[110],hold;\n\tscanf(\"%d\",&n);\n\tfor(i=1;i<=n;i++)\tscanf(\"%d\",&a[i]);\n\tfor(i=n;i>1;i--){\n\t\tfor(j=1;ja[j+1]){\n\t\t\t\thold=a[j];\n\t\t\t\ta[j]=a[j+1];\n\t\t\t\ta[j+1]=hold;\n\t\t\t}\n\t\t} \n\t}\n\tfor(i=1;i<=n;i++)\tprintf(\"%d \",a[i]);\n\treturn 0;\n}"}, {"source_code": "#include\nint main()\n{\n int i,j,k,m,n,t;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i\nint main(){\n int n;\n scanf(\"%d\",&n);\n int array[n];\n for (int i=0;i array[d+1]) /* For decreasing order use < */\n {\n swap = array[d];\n array[d] = array[d+1];\n array[d+1] = swap;\n }\n }\n }\n for (int i=0;i\n\nmain()\n{\n\tint n,i,j,c, *t;\n\tdo{\n\t\tscanf(\"%d\",&n);\n\t}while(n<0 || n>100);\n\tt=(int*) malloc(sizeof(int)*n);\n\tfor(i=0;ii;j--)\n\t\t{\n\t\t\tif(t[j]dizi[j+1]) {\n gecici=dizi[j];\n dizi[j]=dizi[j+1];\n dizi[j+1]=gecici;\n }\n for(i=0;i\nint main ()\n{\n int i,j,a[5000],n,t;\n scanf(\"%d\",&n);\n for(i=0;ia[j]){\n t=a[j];\n a[j]=a[i];\n a[i]=t;\n }\n }\n }\n for(i=0;i\n#include \n\nint main() {\n\n unsigned short n;\n scanf(\"%hu\",&n);\n unsigned short num[n];\n\n for(unsigned short i = 0; inum[j+1])\n {\n unsigned short temp=num[j];\n num[j]=num[j+1];\n num[j+1]=temp;\n }\n }\n }\n for(unsigned short i = 0; i\n\nvoid insertionSort (int arr[],int n){\n for (int i=1;i=0 && currData < arr[j]){ //j>=0 to prevent out of bounds\n arr[j+1] = arr[j]; //If false , geser terosss\n j--;\n }\n arr[j+1] = currData; //Kalau udah bener , jangan ngegas terossss\n }\n}\n\n\nint main(){\n int n;\n scanf(\"%d\",&n);\n int arr[n];\n for(int i=0;i\nint main()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;ia[j+1])\n {\n int temp=a[j];\n a[j]=a[j+1];\n a[j+1]=temp;\n }\n }\n\n }\n for(i=0;i\n#include\n\nint main()\n{\n int n = 0;\n int *a = NULL;\n int i = 0;\n int j = 0;\n int t = 0;\n \n scanf(\"%d\" , &n);\n \n a = (int *)calloc(n , sizeof(int));\n \n for(i=0 ; i a[j])\n {\n t = a[i];\n a[i] = a[j];\n a[j] = t;\n }\n }\n }\n \n for(i=0 ; i\n#include\n\nint main()\n{\nint c[111]={0};\nint n,i,a;\nscanf(\"%d\",&n);\nfor(i=0;i0)\n{\nprintf(\"%d \",i);\nc[i]--;\n}\n}\nreturn 0;\n}\n"}, {"source_code": "#include\nint main(){ int n ,i,j,temp;\n int a[101];\n scanf(\"%d\",&n);\n for(i=0;ia[j]){\n temp=a[i];\n a[i]=a[j];\n a[j]=temp;\n }\n }\n }\n for(i=0;i\nmain()\n{\n int n,a[102],i,j,t;\n scanf(\"%d\",&n);\nfor(i=0;ia[j]){t=a[i];a[i]=a[j];a[j]=t;}}\n }\n for(i=0;i\n#include\nint main()\n{\nint n,temp=0;\nscanf(\"%d\",&n);\nint *p=(int*)malloc(sizeof(int)*n);\nint i=0,flag=1;\n//printf(\"enter boxes\");\nfor(i;ip[i+1])\n{\ntemp=p[i];\np[i]=p[i+1];\np[i+1]=temp;\nflag=1;\n}\n}\n}\nfor(i=0;i\nint main (){\nint m, i, meses[100], min, posmax,a;\nm=0;\n\nscanf(\"%d\",&a);\n\nfor(i=1; i<=a; i++)\n scanf(\"%d\", &meses[i]);\n\nwhile(m /* printf */\n#include /* qsort */\n\nint n, a[105];\n\nint compare (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\n\nint main ()\n{\n scanf(\"%d\", &n);\n for(int i=0; i\n#include \n\nint main(){\n int n=0, vetor[100], menor=0, i=0, j=0;\n \n scanf(\"%d\", &n);\n \n //Lendo os valor e colocando no vetor.\n for(i=0; i\nint main()\n{\n int n,i,j,temp=0;\n scanf(\"%d\",&n);\n int arr[n];\n for(i=0;iarr[j])\n {\n temp=arr[i];\n arr[i]=arr[j];\n arr[j]=temp;\n }\n }\n }\n for(i=0;i //To include standard input and output.\n\n/*Defining a function min to find minimum of two numbers.*/\nint min(int x, int y)\n{\n int z;\n if(x>y) //Checking the condition.\n z=y; //assigning the minimum value to z\n else\n z=x; //assigning the minimum value to z\n return z;\n}\n\n/*Defining a function to merge two sorted (in increasing order) arrays in increasing order*/\nvoid merge(int aa[], int ab[], int ac[], int p, int q)\n{\n int i=1, j=0, k=0; //i, j and k are used to keep index of number in aa, ab and ac respectively.\n ac[0]=min(aa[0], ab[0]); //assigning the minimum number of both arrays to ac[0].\n if(aa[0]==ac[0])\n j++; //incrementing j to go for next number of aa[].\n else\n k++; //incrementing k to go for next number of ab[].\n while(j1)\n {\n if(m%2==0) //When the total numbers is even.\n {\n int i, left[m/2], right[m/2]; //defining two new arrays.\n for(i=0;i\n\nint main()\n{\n\n int n;\n scanf(\"%d\", &n);\n int ara[n], i, j, temp,swapped;\n for(i=0; iara[i+1]){\n temp=ara[i];\n ara[i]=ara[i+1];\n ara[i+1]=temp;\n swapped=1;\n }\n }\n if(swapped==0){\n break;\n }\n }\n for(i=0; i\n#define SCAN(n) scanf(\"%d\",&(n))\n#define PRINT(n) printf(\"%d\\n\",(n))\n#define N 101\n#define loop(a,b) for(a=0;a0){\n PRINT(c);\n sort[c]--;\n }\n }\n}\n"}, {"source_code": "#include \nint main()\n{\n\tint a;\n\tscanf(\"%d\",&a);\n\tint s[a];\n\tint i;\n\tfor(i=0;i\nint main (){\nint m, i, meses[100], min, posmax,a;\nm=0;\n\nscanf(\"%d\",&a);\n\nfor(i=1; i<=a; i++)\n scanf(\"%d\", &meses[i]);\n\nwhile(m\n#include \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 x,n,j,i;\nscanf(\"%d\",&n);\nint a[n];\nfor(i=0;ia[j]){\n\t\t\tx=a[i];\n\t\t\ta[i]=a[j];\n\t\t\ta[j]=x;\n\t\t\t}\n\t}\n\t}\n\tfor(i=0;i\nint main()\n{\n long long int n,i,j,k,min,m;\n scanf(\"%lld\",&n);\n long long int ar[n];\n for(i=0;iar[j])\n {\n m=ar[i];\n ar[i]=ar[j];\n ar[j]=m;\n }\n }}\n for(i=0;i\nint main()\n{\n int m,i,datos[100],min,posmax,a;\n m=0;\n scanf(\"%d\", &a);\n for(i=1;i<=a;i++)\n scanf(\"%d\",&datos[i]);\n\n while (m\n#include \nmain()\n{\n int a[120],i,n,t,j;\n \n scanf(\"%d\",&n);\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=1;i<=n;i++)\n {\n for(j=1;j<=n-1;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 for(i=1;i<=n;i++)\n {\n printf(\"%d \",a[i]);\n }\n \n \n}"}, {"source_code": "#include\n#include\nint main()\n{\nint n,temp=0;\nscanf(\"%d\",&n);\nint *p=(int*)malloc(sizeof(int)*n);\nint i=0,flag=1;\n//printf(\"enter boxes\");\nfor(i;ip[i+1])\n{\ntemp=p[i];\np[i]=p[i+1];\np[i+1]=temp;\nflag=1;\n}\n}\n}\nfor(i=0;i\n#include\nmain()\n{\n int n,minimum,index_2,minimum_index,i;\n scanf(\"%d\",&n);\n int ara1[n],ara2[n];\n for(i=0;i\n#include \nvoid makeArray (int x);\nvoid sortArray (int array[],int);\nvoid swap (int * , int *);\nvoid printArray(int array[],int);\n\nint main()\n{ int x ;\nscanf(\"%d\",&x);\n makeArray(x);\n return 0;\n}\nvoid makeArray(int x)\n{\n int array[x];\n int i;\n for (i=0;iarray[j])\n {\n swap(&(array[i]),&(array[j]));\n }\n }\n }\n printArray(array,x);\n}\nvoid swap(int*x,int*y)\n{\n int temp;\n temp = *x;\n *x = *y;\n *y = temp;\n}\nvoid printArray(int array[],int x)\n{\n int i;\n//int arraySize = sizeof(array)/sizeof(int);\n // printf(\"Array size = %d \\n\",arraySize);\n for(i=0;i\nmain()\n{\n int n,a[102],i,j,t;\n scanf(\"%d\",&n);\nfor(i=0;ia[j]){t=a[i];a[i]=a[j];a[j]=t;}}\n }\n for(i=0;i\n#include \n\nint main() {\n\n //freopen(\"asd.in\",\"r\",stdin);\n //freopen(\"asd.out\",\"w\",stdout);\n\n char str[120];\n int ar[120];\n\n int len, i;\n scanf(\"%d\",&len);\n\n\n for(i=0;i\nint main()\n{\n int n,a[100],temp,l,i,j,swap,m,p,q;\n scanf(\"%d\",&n);\n for(i=0;ia[j+1])\n {\n temp=a[j];\n a[j]=a[j+1];\n a[j+1]=temp;\n swap=1;\n }\n }\n if(swap==0)\n {\n break;\n }\n }\n\n\n for(i=0;i\nint main()\n{\n int n,a[101],i,m,k,y,j,temp;\n scanf(\"%d\",&n);\n for(i=1; i<=n; i++)\n scanf(\"%d\",&a[i]);\n for(y=1; y<=n; y++)\n {\n for(i=y; ia[i+1])\n {\n temp=a[y];\n a[y]=a[i+1];\n a[i+1]=temp;\n }\n\n }\n }\n for(j=1; j<=n; j++)\n printf(\"%d \",a[j]);\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n#include \n\nint main(){\n\tint vetor[100],n,i,j,min;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i\nint main()\n{\n int i,j,n,a[100],t;\n scanf(\"%d\",&n);\n for(i=0;ia[j+1])\n {\n t=a[j];\n a[j]=a[j+1];\n a[j+1]=t;\n }\n }\n }\n for(i=0;i\nint main()\n{\n int m,i,dattos[100],min,posmax,a;\n m=0;\n scanf(\"%d\", &a);\n for(i=1;i<=a;i++)\n scanf(\"%d\",&dattos[i]);\n\n while (m\nint main()\n{\n int n;\n scanf(\"%d\\n\",&n);\n int a[n];\n for(int i=0;i=a[j])\n {\n pos=j;\n min=a[j];\n }\n }\n a[pos]=a[i];\n a[i]=min;\n }\n for(int i=0;i\nint main()\n{\nint m=0,i,meses[105],min=0,pos_max=0,n=0;\n\nscanf(\"%d\",&n);\n for(i=0;i\nint main()\n{\n int n,a[100],i,j,tam;\n scanf(\"%d\",&n);\n for(i=0;ia[j])\n {\n tam=a[i];\n a[i]=a[j];\n a[j]=tam;\n }\n }\n }\n for(i=0;i\nvoid bubble_sort(long long int a[],long long int n) \n{\n int i = 0, j = 0, tmp;\n for (i = 0; i < n; i++) \n\t{ // loop n times - 1 per element\n for (j = 0; j < n - i - 1; j++) \n\t\t{ // last i elements are sorted already\n if (a[j] > a[j + 1]) \n\t\t\t{ // swop if order is broken\n tmp = a[j];\n a[j] = a[j + 1];\n a[j + 1] = tmp;\n }\n }\n }\n}\nint main()\n{\n\tlong long int n;\n scanf(\"%lld\",&n);\n long long int a[n];\n\tfor(int i=0;i\n int i,n,x,C[101];\n int main(){\n for(scanf(\"%d\",&n);i\n#include \n\nint main() {\n\n unsigned short n;\n scanf(\"%hu\",&n);\n unsigned short num[n];\n\n for(unsigned short i = 0; inum[j+1])\n {\n unsigned short temp=num[j];\n num[j]=num[j+1];\n num[j+1]=temp;\n }\n }\n }\n for(unsigned short i = 0; i\n#include\nmain()\n{\n int n,minimum,index_2,minimum_index,i;\n scanf(\"%d\",&n);\n int ara1[n],ara2[n];\n for(i=0;i\n \nint main()\n{\n int n;\n scanf(\"%d\", &n);\n int num[n+5], i;\n for (i=0; inum[i+1]){\n tem=num[i];\n num[i]=num[i+1];\n num[i+1]=tem;\n if (i!=0)\n i--;\n }\n \n }\n \n for (i=0; i\nint main (){\n int aux,n,pass=0,i,permut,a[100];\n do{\n scanf(\"%d\",&n);\n }while ((n>101)&&(n<0));\nfor (i=0;i101));\ndo{\n permut=0;\n for (i=0;ia[i+1])\n {\n aux=a[i+1];\n a[i+1]=a[i];\n a[i]=aux;\n permut++;\n }\n pass++;\n}while (permut!=0);\nfor (i=0;i\n#define MAX 100\nint main() {\n\n int G_tate[MAX][MAX];\n int ans[MAX];\n int i, j ,k;\n int n;\n int a;\n \n\n for( i = 0; i < MAX; i++ ) {\n for( j = 0; j < MAX; j++ ) {\n G_tate[i][j] = 0;\n ans[i] = 0;\n }\n }\n\n scanf(\"%d\" ,&n);\n\n for( i = 0; i < n; i++ ) {\n\n scanf(\"%d\" ,&a);\n\n for( j = 0; j < a; j++ ) {\n G_tate[i][j] = 1;\n }\n }\n\n /*for debag\n for( i = 0; i < n; i++ ) {\n for( j = 0; j < n; j++ ) {\n printf(\"%d \",G_tate[i][j]);\n \n }\n printf(\"\\n\");\n }\n printf(\"\\n\");\n /*for debag*/\n\n for(k = 0; k < MAX; k++) {\n for( i = 0; i < n; i++ ) {\n for( j = 0; j < MAX; j++ ) {\n \n if(G_tate[i][j] == 0 && G_tate[i - 1][j] == 1) {\n G_tate[i][j] = 1;\n G_tate[i - 1][j] = 0;\n }\n }\n }\n }\n\n /*for debag\n for( i = 0; i < n; i++ ) {\n for( j = 0; j < n; j++ ) {\n printf(\"%d \",G_tate[i][j]);\n \n }\n printf(\"\\n\");\n }\n printf(\"\\n\");\n /*for debag*/\n\n for( i = 0; i < MAX; i++ ) {\n for( j = 0; j < MAX; j++ ) {\n \n if(G_tate[i][j] == 1)ans[i]++;\n\n }\n }\n\n for(i = 0; i < n; i++ ) {\n printf(\"%d \" ,ans[i]);\n }\n \n printf(\"\\n\");\n\n return 0;\n}"}, {"source_code": "#include\nmain()\n{\n int n,a[102],i,j,t;\n scanf(\"%d\",&n);\nfor(i=0;ia[j]){t=a[i];a[i]=a[j];a[j]=t;}}\n }\n for(i=0;i\n\nint main()\n{\n int arr[99999],ar[99999];\n\n int n,i,j,temp,l,k;\n\n scanf(\"%d\",&n);\n\n for(i=0; i\n#include \n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int arr[n];\nfor(int i=0;ii;j--)\n {\n if(arr[i]>arr[j])\n {\n int temp= arr[i];\n arr[i]=arr[j];\n arr[j]=temp;\n }\n }\n}\nfor(int i=0;i\n#include\nint main(){ \n int i,n,j,t;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;ia[j]){\n t=a[i];\n a[i]=a[j];\n a[j]=t;\n}}}\n for(i=0;i\n// BUBBLE SORT\nmain()\n{\n int n,a[100],i,j,temp,swap;\n scanf(\"%d\",&n);\n for(i=0;ia[i+1]) \n {\n temp=a[i];\n a[i]=a[i+1];\n a[i+1]=temp;\n swap=1;\n }\n }\n if(swap==0) break;\n }\n\nfor(i=0;i\n\nint main()\n{\n int box[101][101]={};\n int c[101],n,i,j,k,x=0,c1;\n scanf(\"%d\",&n);\n for(i=0;ix) x=c[i];\n }\n for(i=0;i=0;i--)\n {\n for(j=x-1;j>=0;j--)\n {\n if(box[i][j]==0)\n {\n for(k=i-1;k>=0;k--)\n {\n if(box[k][j]==1)\n {\n //printf(\"\\t\\tHere [%d] [%d] [%d] [%d]\\n\",i,j,k,j);\n box[i][j]=1;\n box[k][j]=0;\n break;\n }\n }\n }\n }\n }\n /*for(i=0;i\n#include \n\nint main()\n{\n int n,i,j,temp;\n scanf(\"%d\",&n);\n int elements[n];\n for(i = 0 ; i < n ; i++)\n {\n scanf(\"%d\",&elements[i]);\n }\n\n for (i = 0; i < n; i++)\n {\n for (j = 0; j < (n - i - 1); j++)\n {\n if (elements[j] > elements[j + 1])\n {\n temp = elements[j];\n elements[j] = elements[j + 1];\n elements[j + 1] = temp;\n }\n }\n }\n for(i = 0 ; i < n ; i++)\n {\n printf(\"%d \",elements[i]);\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main(){\n int n;\n scanf(\"%d\",&n);\n int a[n];\n for(int i=0;ia[j]){\n int t;\n t=a[i];\n a[i]=a[j];\n a[j]=t;\n }\n }\n }\n for(int i=0;i\n\nint main()\n{\n int NumberOfBoxes;\n int boxes[100];\n int i,j,S;\n \n scanf(\"%d\",&NumberOfBoxes);\n \n\n for(i=1; i<=NumberOfBoxes; i++){\n scanf(\"%d\",&boxes[i]);\n }\n \n for(int m=0; mboxes[j+1]){\n S=boxes[j+1];\n boxes[j+1]=boxes[j];\n boxes[j]=S;\n \n }else{\n \n }\n \n }\n }\n for(int n=0; n\n#include \n \nint cmpfunc (const int * a, const int * b) {\n return *a - *b;\n}\n\nint main(){\n int col;\n scanf(\"%d\", &col);\n int * mat = (int*) malloc(sizeof(int) * col);\n for(int i = 0; i < col; i++){\n scanf(\"%d\", &mat[i]);\n }\n qsort(mat, col, sizeof(int), cmpfunc);\n for(int i = 0; i < col - 1; i++){\n printf(\"%d \", mat[i]);\n }\n printf(\"%d\\n\", mat[col - 1]);\n return 0;\n}\n"}, {"source_code": "int i,n,x,C[101];\nint main(){\n for(scanf(\"%d\",&n);i\nint main (){\n int aux,n,pass=0,i,permut,a[100];\n do{\n scanf(\"%d\",&n);\n }while ((n>101)&&(n<0));\nfor (i=0;i101));\ndo{\n permut=0;\n for (i=0;ia[i+1])\n {\n aux=a[i+1];\n a[i+1]=a[i];\n a[i]=aux;\n permut++;\n }\n pass++;\n}while (permut!=0);\nfor (i=0;i\nint main()\n{\n int n,temp,max,in;\n scanf(\"%d\",&n);\n int a[n];\n for(int i=0;i\n#include \n\nint main() {\n\n unsigned short n,m;\n scanf(\"%hu\",&n);\n unsigned short num[n];\n\n for(unsigned short i = 0; inum[j+1])\n {\n unsigned short temp=num[j];\n num[j]=num[j+1];\n num[j+1]=temp;\n }\n }\n n--;\n }\n for(unsigned short i = 0; i\nint main()\n{\n int n,a[100],i,j,k=0,p,temp;\n scanf(\"%d\",&n);\n for(i=0;ia[k+1])\n {\n\n temp=a[k];\n a[k]=a[k+1];\n a[k+1]=temp;\n }\n\n }\n\n }\n for(p=0;p\n#include \nint main()\n{\n int nc,i,j,aux;\n\tint T[100];\n\tscanf(\"%d\",&nc);\n\tfor (i=1;i<=nc;i++)\n\t\t{\n\t\t\tscanf(\"%d\",&T[i]);\n\t\t}\n\tfor (i=0;i\n\nint main()\n{\n int x;\n scanf(\"%d\",&x);\n\n int i,j,arr[x];\n \n for (i = 0; i < x; i++)\n scanf(\"%d\",&arr[i]); \n \n for(i = 0; i < x; i++)\n {\n for(j = i+1; j < x; j++)\n {\n int temp;\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 < x; i++)\n printf(\"%d \",arr[i]);\n \n return 0;\n}"}, {"source_code": "#include \nint main()\n{\n int m,i,datos[100],min,posmax,a;\n m=0;\n scanf(\"%d\", &a);\n for(i=1;i<=a;i++)\n scanf(\"%d\",&datos[i]);\n\n while (m\nvoid sort(int x,int n[])\n{\n\tfor (int i = 1; i < x; i++)\n\t{\n \tint j = i;\n \twhile(j > 0 && n[j-1] > n[j]){\n \tint tmp = n[j];\n \tn[j] = n[j-1];\n \tn[j-1] = tmp;\n \tj--;\n \t}\t\n \t}\n \t\n \tfor (int i=0;i<=x-1;i++)\n \t{\n \t\tprintf(\"%d \",n[i]);\n\t}\n\treturn;\n}\nint main()\n{\n\tint x;\n\tint n[102];\n\tscanf(\"%d\",&x);\n\t\n\tfor (int i=0;i\n#include \n\nint arr[100000],k;\n\nvoid mergesort(int l, int mid, int r)\n{\n\tif(l>=r)\treturn;\n\tint n=mid-l+1,m=r-mid,a1[n],a2[m],i,j;\n\tfor(i=0;i=end)\treturn;\n\tint mid=(start+end)/2;\n\tmerge(start,mid);\n\tmerge(mid+1,end);\n\tmergesort(start,mid,end);\n}\nint main()\n{\n\tint n,i;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i\n\nint main (){\n\tint r = 0;\n\tint c = 0;\n\tint k = 0;\n\tint n;\n\tint x = 0;\n\tscanf (\"%i\", &n);\n\tint pos[n];\n\tscanf (\"%i\", &pos[k]);\n\tn = n - 1;\n\tx = n;\n\tc = c + 1;\n\twhile (n > 0){\n\t\tk = c;\n\t\tscanf (\"%i\", &pos[k]);\n\t\twhile (k > 0){\n\t\t\tif (pos[k-1] > pos[k]){\n\t\t\t\tr = pos[k];\n\t\t\t\tpos[k] = pos[k-1];\n\t\t\t\tpos[k-1] = r; \n\t\t\t\tk = k - 1;\n\t\t\t}\n\t\t\telse \n\t\t\t\tk = k - 1;\n\t\t\t\n\t\t}\n\t\tn = n - 1;\n\t\tc = c + 1;\n\t}\n\twhile (x >= 0){\n\t\tprintf (\"%i \", pos[n]);\n\t\tn = n + 1;\n\t\tx = x - 1;\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\n\nmain()\n{\n int j,a,n,i,number[200];\n scanf(\"%d\",&n);\n for(i=0;inumber[j]){\n a=number[i];\n number[i]=number[j];\n number[j]=a;\n }}\n }\n for(i=0;i\n#include\nint main()\n{\n int a[1000]= {0},n,i,j,k,t;\n scanf(\"%d\",&n);\n for (i=1; i<=n; i++)\n scanf(\"%d\",&a[i]);\n for (i=1;i<=n-1;i++)\n {\n k=i;\n for (j=i+1;j<=n;j++)\n if (a[k]>a[j]) k=j;\n t=a[k],a[k]=a[i],a[i]=t;\n }\n for (i=1; i<=n; i++)\n {\n printf(\"%d\",a[i]);\n if (i!=n) printf(\" \");\n else printf(\"\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int i,j,a,n,number[201];\n scanf(\"%d\",&n);\n for(i=0;inumber[j])\n {\n a=number[i];\n number[i]=number[j];\n number[j]=a;\n }\n }\n }\n for(i=0;i\n#include\nint main()\n{\n int n,i;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;ia[j])\n {\n temp=a[i];\n a[i]=a[j];\n a[j]=temp;\n }\n }\n }\n for(i=0;i\nint main()\n{ int n,i,j,temp;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;ia[j+1])\n\t {temp=a[j];\n\t a[j]=a[j+1];\n\t a[j+1]=temp;\n\t}}}\n\tfor(i=0;i\nint main()\n{\n int n,i,j,k,a,b[100],c;\n scanf(\"%d\",&n);\n for(i=n-1;i>=0;i--)\n {\n scanf(\"%d\",&b[i]);\n }\n \n for(i=0;ib[j+1])\n {\n c=b[j];\n b[j]=b[j+1];\n b[j+1]=c;\n }\n }\n }\n for(a=0;a\n int i,n,x,C[101];\n int main(){\n for(scanf(\"%d\",&n);i\n\nint main() {\n\nint n;\n\nint sortArr(int *ptr, int n);\n\n//printf(\"please enter number of columns\\t\");\n\nscanf(\"%i\", &n);\n\nint a[n];\n\nint *ptr=&a[n];\n\nfor (int i=0; i\n int main()\n {\n int i,j,n,temp;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i=a[j+1])\n {\n temp=a[j];\n a[j]=a[j+1];\n a[j+1]=temp;\n }\n }\n }\n for(i=0;i\n \nint main()\n{\n int n, c, d, swap;\n \n //printf(\"Enter number of elements\\n\");\n scanf(\"%d\", &n);\n \n int array[n];\n //printf(\"Enter %d integers\\n\", n);\n \n for (c = 0; c < n; c++)\n scanf(\"%d\", &array[c]);\n \n for (c = 0 ; c < n - 1; c++)\n {\n for (d = 0 ; d < n - c - 1; d++)\n {\n if (array[d] > array[d+1]) /* For decreasing order use < */\n {\n swap = array[d];\n array[d] = array[d+1];\n array[d+1] = swap;\n }\n }\n }\n \n //printf(\"Sorted list in ascending order:\\n\");\n \n for (c = 0; c < n; c++)\n printf(\"%d\\n\", array[c]);\n \n return 0;\n}"}, {"source_code": "#include\nint main(void)\n{\n int num = 0;\n scanf(\"%d\", &num);\n\n int arr[num];\n\n for (int i = 0; i < num; i++)\n {\n scanf(\"%d\", &arr[i]);\n }\n\n\n for (int i = 0; i < num; i++)\n {\n for (int j = 0; j < num; j++)\n {\n if (arr[j] >= arr[j + 1])\n {\n int temp = arr[j];\n arr[j] = arr[j +1];\n arr[j + 1] = temp;\n }\n }\n }\n\n for (int i = 0; i < num; i++)\n {\n printf(\"%d \", arr[i]);\n }\n\n\n\n}\n"}, {"source_code": "#include \n#include \n\nint main() {\n\n unsigned short n,m;\n scanf(\"%hu\",&n);\n unsigned short num[n];\n\n for(unsigned short i = 0; inum[j+1])\n {\n unsigned short temp=num[j];\n num[j]=num[j+1];\n num[j+1]=temp;\n }\n }\n m--;\n }\n for(unsigned short i = 0; i\n#include \n\nint main()\n{int x,y=0,i,j;\n\tscanf(\"%d\",&x);\n\tint a[x];\n\t\n\tfor(i=0;i=a[y]){\n\t\t\ta[y]=a[i];\n\t\t}\n\t\n\t}\n\ty++;}\n\t\tfor(i=0;i\n\nint main()\n{\n int arr[99999],ar[99999];\n\n int n,i,j,temp,l,k;\n\n scanf(\"%d\",&n);\n\n for(i=0; i\nint main()\n{\n long long int a,i,b,c,j,k,n=0,m=0;\n scanf(\"%lld%lld%lld\",&a,&b,&c);\n j=a/c*(a%c);\n k=b/c*(b%c);\n printf(\"%lld\\n\",j*k);\n return 0;\n}*/\n/*#include\nint main()\n{\n long long int a,b,c,m,n;\n int v,k;\n scanf(\"%lld%lld%lld\",&a,&b,&c);\n m=a/c;\n if(a%c)\n //v=a;\n m++;\n n=b/c;\n if(b%c)\n //k=b;\n n++;\n printf(\"%lld\\n\",m);\n return 0;\n}*/\n#include\nint main()\n{\n int arr[10],i,a,k,temp,j;\n for(j=1;j<=2;j++){\n scanf(\"%d\",&a);\n for(i=0;iarr[k])\n {\n temp=arr[i];\n arr[i]=arr[k];\n arr[k]=temp;\n }\n\n }\n printf(\"%d\\t\",arr[i]);}\n printf(\"\\n\");}\n\n return 0;\n}\n\n\n"}, {"source_code": "#include \n#include \n#include \nint main() {\n\tint n,i,j;\n\tscanf(\"%d\",&n);\n\tint a[n];\n\tfor(i=0;i=a[j+1]){\n\t\t\t\ta[j]-=1;\n\t\t\t\ta[j+1]+=1;\n\t\t\t\t}\n\t\t\t\t else if(a[n-1]>a[j])\n\t\t\tj=n+1;\n\tj++;\t}\n\t}\n\tfor(i=0;i\n#include \nvoid makeArray (int x);\nvoid sortArray (int array[],int);\nvoid swap (int * , int *);\nvoid printArray(int array[],int);\n\nint main()\n{ int x ;\nscanf(\"%d\",&x);\n makeArray(x);\n return 0;\n}\nvoid makeArray(int x)\n{\n int array[x];\n int i;\n for (i=0;iarray[j])\n {\n swap(&(array[i]),&(array[j]));\n }\n }\n }\n printArray(array,x);\n}\nvoid swap(int*x,int*y)\n{\n int temp;\n temp = *x;\n *x = *y;\n *y = temp;\n}\nvoid printArray(int array[],int x)\n{\n int i;\n//int arraySize = sizeof(array)/sizeof(int);\n // printf(\"Array size = %d \\n\",arraySize);\n for(i=0;i\nint main()\n{\n int n,a[100],i,temp,mid,j;\n scanf(\"%d\",&n);\n for(i=0;ia[j])\n mid=j;\n }\n if(mid!=i)\n {\n temp=a[mid];\n a[mid]=a[i];\n a[i]=temp;\n }\n }\n for(i=0;i\n#include \n\nint main()\n{\n int n,i,j,arr[100],temp;\n scanf(\"%d\",&n);\n for(i=0; i\nvoid merge(int a[],int low,int mid, int high)\n{\n int temp[high-low+1];\n int p1=low,p2=mid+1,k=0,i;\n while(p1<=mid && p2<=high)\n {\n if(a[p1]\n#include\nint main(){ \n int i,n,j,t;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;ia[j]){\n t=a[i];\n a[i]=a[j];\n a[j]=t;\n}}}\n for(i=0;i\nint main(){\n int n,i,j,k,l,temp,max=0,c=0;\n scanf(\"%d\",&n);\n int arr[100][n],arr2[n];\n for(i=0;i<100;i++){\n for(j=0;jmax){\n max=arr2[i];\n }\n }\n int arr3[max];\n for(i=0;i99-temp;j--){\n arr[j][i]=1;\n }\n }\n for(i=99,k=0;i>99-max,k99-max,k=n-x;j--){\n arr[i][j]=1;\n }\n }\n for(i=0 ; i99-max ; j--)\n {\n if(arr[j][i]==1)\n {\n c++;\n }\n }\n arr2[i]=c;\n }\n for(i=0;i\nint main()\n{\n int i,j,k,m,n,t;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;ia[j])\n {\n t=a[i];\n a[i]=j;\n a[j]=t;\n }\n }\n }\n for(i=0;i\n\nint arr[103];\n\nint main(){\n \n int i,j=1,n,temp=0,swp,k;\n \n scanf(\"%d\",&n);\n for(i=0;in)temp=1;\n }\n \n //for(i=0;i0;i--){\n if(arr[i]\nint main()\n{\n long long int a,i,b,c,j,k,n=0,m=0;\n scanf(\"%lld%lld%lld\",&a,&b,&c);\n j=a/c*(a%c);\n k=b/c*(b%c);\n printf(\"%lld\\n\",j*k);\n return 0;\n}*/\n/*#include\nint main()\n{\n long long int a,b,c,m,n;\n int v,k;\n scanf(\"%lld%lld%lld\",&a,&b,&c);\n m=a/c;\n if(a%c)\n //v=a;\n m++;\n n=b/c;\n if(b%c)\n //k=b;\n n++;\n printf(\"%lld\\n\",m);\n return 0;\n}*/\n#include\nint main()\n{\n int arr[10],i,a,k,temp,j;\n for(j=1;j<=2;j++){\n scanf(\"%d\",&a);\n for(i=0;iarr[k])\n {\n temp=arr[i];\n arr[i]=arr[k];\n arr[k]=temp;\n }\n\n }\n printf(\"%d\\n\",arr[i]);}}\n\n return 0;\n}\n\n\n"}, {"source_code": "#include\nint main()\n{\n\tint a[100],n,temp=0,i,j,k;\n\n\tscanf(\"%d\",&n);\n\tfor(i=0;ia[j+1])\n\t\t\t{\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\t}\n\tfor(k=0;k\n\nint main()\n{\n\n int n;\n scanf(\"%d\", &n);\n int ara[n], i, j, temp, sortted;\n for(i=1; i<=n; i++){\n scanf(\"%d\", &ara[i]);\n\n }\n for(i=0; iara[j+1]){\n temp=ara[j];\n ara[j]=ara[j+1];\n ara[j+1]=temp;\n sortted=1;\n }\n\n }\n if(sortted==0){\n break;\n }\n }\n for(i=0; i\n#include \n\nint main()\n{\n int n,i,j,arr[100],flag,temp;\n scanf(\"%d\",&n);\n for(i=0; i100)\n {\n flag=1;\n }\n }\n for(i=0; i=1&&n<=100&&flag!=1)\n {\n for(i=0; i\nint main(){\n int n,i,j,k,l,temp,max=0,c=0;\n scanf(\"%d\",&n);\n int arr[100][n],arr2[n];\n for(i=0;i<100;i++){\n for(j=0;jmax){\n max=arr2[i+1];\n }\n }\n int arr3[max];\n for(i=0;i99-temp;j--){\n arr[j][i]=1;\n }\n }\n for(i=99,k=0;i>99-max,k99-max,k=n-x;j--){\n arr[i][j]=1;\n }\n }\n for(i=0 ; i99-max ; j--)\n {\n if(arr[j][i]==1)\n {\n c++;\n }\n }\n arr2[i]=c;\n }\n for(i=0;i\nint main()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n int ar[n];\n for(i=0;iar[n-1])\n {\n for(j=0;j=ar[j+1])\n {\n ar[j]--;\n ar[j+1]++;\n }\n }\n }\n else\n {\n for(j=0;jar[j+1])\n {\n ar[j]--;\n ar[j+1]++;\n }\n }\n }\n }\n for(i=0;i\nint main()\n{\n int n,temp,max;\n scanf(\"%d\",&n);\n int a[n];\n for(int i=0;i\n#include \n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int arr[n];\nfor(int i=0;iarr[n-1])\n {\n int temp= arr[i];\n arr[i]=arr[n-1];\n arr[n-1]=temp;\n }\n if(arr[0]>arr[i])\n {\n int temp= arr[i];\n arr[i]=arr[0];\n arr[0]=temp;\n }\n}\nfor(int i=0;i\n#include \n\nint main()\n{\n int n,i,j,arr[100],flag,temp;\n scanf(\"%d\",&n);\n for(i=0; i100)\n {\n flag=1;\n }\n }\n for(i=0; i=1&&n<=100&&flag!=1)\n {\n for(i=0; i\n#include\nint main()\n{\n int *arr, n, i, j, temp;\n scanf(\"%d\",&n);\n arr = (int*)malloc(n*sizeof(int));\n for(i = 0; i < n; i++)\n scanf(\"%d\", &arr[i]);\n for(i = 0; i < n; i ++)\n {\n for(j = 0; j < (n-1-i) ; j++)\n {\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 for(i = 0; i < n; i++)\n printf(\"%d \", arr[j]);\n return 0; \n}"}, {"source_code": "#include\n\n\nint main (){\n\nint caja[120];\nint x,j,b,aux;\n\nscanf(\"%d\",&b);\n\nfor(x=0;xcaja[j+1]){\n aux=caja[j];\n caja[j]=caja[j+1];\n caja[j+1]=aux;\n\n }\n\n }\n\n }\n\n\n\n\n for(j=0;j\n#include \n#include \n#include \n\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tint max=0, min=101;\n\tint *a=(int *)malloc(n*sizeof(int));\n\tint *res=(int *)malloc(n*sizeof(int));\n\tint cubes[101]={0};\n\tint i,j;\n\tfor(i=0;imax)\n\t\t\t\tmax=a[i];\n\n\t\t\tfor(j=1;j<=a[i];j++)\n\t\t\t\tcubes[j]++;\n\t\t}\n\n\tfor(i=n-1;i>=0;i--)\n\t{\n\t\tfor(j=1;j<=max;j++)\n\t\t{\n\t\t\tif(cubes[j]>0)\n\t\t\t\t{\n\t\t\t\t\tres[i]+=1;\n\t\t\t\t\tcubes[j]--;\n\t\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfor(i=0;i\nint main()\n{\n long long int a,i,b,c,j,k,n=0,m=0;\n scanf(\"%lld%lld%lld\",&a,&b,&c);\n j=a/c*(a%c);\n k=b/c*(b%c);\n printf(\"%lld\\n\",j*k);\n return 0;\n}*/\n/*#include\nint main()\n{\n long long int a,b,c,m,n;\n int v,k;\n scanf(\"%lld%lld%lld\",&a,&b,&c);\n m=a/c;\n if(a%c)\n //v=a;\n m++;\n n=b/c;\n if(b%c)\n //k=b;\n n++;\n printf(\"%lld\\n\",m);\n return 0;\n}*/\n#include\nint main()\n{\n int arr[10],i,a,k,temp,j;\n for(j=1;j<=2;j++){\n scanf(\"%d\",&a);\n for(i=0;iarr[k])\n {\n temp=arr[i];\n arr[i]=arr[k];\n arr[k]=temp;\n }\n\n }\n printf(\"%d \",arr[i]);}\n }\n\n return 0;\n}\n\n\n"}, {"source_code": "#include \nint main()\n{\n int m,meses[100],min,posmax,i,a;\n m=0;\n scanf(\"%d\", &a);\n for(i=1;i<=a;i++)\n scanf(\"%d\",&meses[i]);\n\n while (m\n#include \nint main()\n{\n\tint n,max;\n\tscanf(\"%d\",&n);\n\tint a[n];\n for(int i=0;imax)\n\t\tmax=a[i];\t\n\t}\n\tint b[max];\n\tfor(int i=0;i<=max;i++){\nb[i]=0;\n}\nfor(int i = 0;i=0;i--){\n\nprintf(\"%d\",c[i]);\nprintf(\" \");\n}\n\n}"}, {"source_code": "int main() {\n int i,j,n;\n scanf(\"%d\",&n);\n int *dizi=(int*) malloc(sizeof(int)*n);\n for(i=0;idizi[j]) {\n dizi[i]--;\n dizi[j]++;\n }\n for(i=0;i\nint main()\n{int n,i,t;\nscanf(\"%d\",&n);\nint col[n];\nfor(i=0;icol[i+1])\n{t=col[i];\ncol[i]=col[i+1];\ncol[i+1]=t;\n}\nelse\ncontinue;\n}\nfor(i=0;i\nint main(void)\n{\n int num = 0;\n scanf(\"%d\", &num);\n\n int arr[num], min = -1, index = 0;\n\n for (int i = 0; i < num; i++)\n {\n scanf(\"%d\", &arr[i]);\n\n if (min > arr[i])\n {\n min = arr[i];\n index = i;\n }\n }\n if (arr[0] < arr[1])\n {\n for (int i = 0; i < num; i++)\n {\n printf(\"%d \", arr[i]);\n }\n return 0;\n }\n\n for (int i = 0; i < num; i++)\n {\n for (int j = 0; j < num; j++)\n {\n if (arr[j] >= arr[j + 1])\n {\n int temp = arr[j];\n arr[j] = arr[j +1];\n arr[j + 1] = temp;\n }\n }\n }\n if (arr[0] <= arr[1])\n {\n for (int i = 0; i < num; i++)\n {\n printf(\"%d \", arr[i]);\n }\n return 0;\n }\n\n\n\n}\n"}, {"source_code": "#include \n\nint main(void)\n{\n int n,i,j,tp,a[1000];\n scanf(\"%d\",&n);\n for (i=0;itp && j>0) a[j]=a[j-1], j--;\n a[j]=tp;\n }\n for (i=0;i\nint a[100],n,i,j,x,k;\nint main(){\n\tscanf(\"%d\",&n);\n\tfor(i=0;i=a[n-i+1])\n{\na[i]-=1;\na[n-i+1]=+1;\n}\n\n}\n\t \n\t\n\tfor(i=0;idizi[j]) {\n dizi[i]--;\n dizi[j]++;\n }\n for(i=0;i\nint n,i,j,ctr;\nint a[100],b[100];\n\nint main()\n{\n scanf(\"%d\",&n);\n for(i=0; ii)\n ++ctr;\n b[i] = ctr;\n }\n for(i=n-1; i>=0; --i)\n {\n ctr=0;\n for(j=0; ji)\n ++ctr;\n printf(\"%d \",ctr);\n }\n return 0;\n}\n"}, {"source_code": "#include \n#include \nint main(){\n\tint i = 0;\n\tint len = 0;\n\tint cols[100];\n\tscanf(\"%d\", &len);\n\tfor (i = 0; i < 100; i++){\n\t\tcols[i] = 0;\n\t}\n\tfor (i = 0; i < len; i++){\n\t\tcols[getchar() - '0']++;\n\t\tgetchar();\n\t}\n\tfor (i = 0; i < len+1; i++){\n\t\twhile (cols[i] > 0){\n\t\t\tprintf(\"%d \", i);\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include\n#include\nint main(){ \n int i,n,j,t;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i\n#include\nint main()\n{\n\tint x;\n\tint temp=0;\n\tint a[100];\n scanf(\"%d\", &x);\n\tfor (int i = 0; i < x; i++)\n\t{\n\t\tscanf(\"%d\", &a[i]);\n\t}\n for(int i=0;i\n#define MAX 100\nint main() {\n\n int G_tate[MAX][MAX];\n int ans[MAX];\n int i, j ,k;\n int n;\n int a;\n \n\n for( i = 0; i < MAX; i++ ) {\n for( j = 0; j < MAX; j++ ) {\n G_tate[i][j] = 0;\n ans[i] = 0;\n }\n }\n\n scanf(\"%d\" ,&n);\n\n for( i = 0; i < n; i++ ) {\n\n scanf(\"%d\" ,&a);\n\n for( j = 0; j < a; j++ ) {\n G_tate[i][j] = 1;\n }\n }\n\n /*for debag\n for( i = 0; i < n; i++ ) {\n for( j = 0; j < n; j++ ) {\n printf(\"%d \",G_tate[i][j]);\n \n }\n printf(\"\\n\");\n }\n printf(\"\\n\");\n /*for debag*/\n\n for(k = 0; k < n; k++) {\n for( i = 0; i < n; i++ ) {\n for( j = 0; j < n; j++ ) {\n \n if(G_tate[i][j] == 0 && G_tate[i - 1][j] == 1) {\n G_tate[i][j] = 1;\n G_tate[i - 1][j] = 0;\n }\n }\n }\n }\n\n /*for debag\n for( i = 0; i < n; i++ ) {\n for( j = 0; j < n; j++ ) {\n printf(\"%d \",G_tate[i][j]);\n \n }\n printf(\"\\n\");\n }\n printf(\"\\n\");\n /*for debag*/\n\n for( i = 0; i < n; i++ ) {\n for( j = 0; j < n; j++ ) {\n \n if(G_tate[i][j] == 1)ans[i]++;\n\n }\n }\n\n for(i = 0; i < n; i++ ) {\n printf(\"%d \" ,ans[i]);\n }\n \n printf(\"\\n\");\n\n return 0;\n}"}, {"source_code": "#include \n#include \nint main()\n{\n int nc,i,j,aux;\n\tint T[100];\n\tscanf(\"%d\",&nc);\n\tfor (i=1;i<=nc;i++)\n\t\t{\n\t\t\tscanf(\"%d\",&T[i]);\n\t\t}\n\tfor (i=0;i\nint i,j,n,a,c[101];\nint main(){\n\tfor(scanf(\"%d\",&n);i\nint main()\n{\n int n,a[101],i,m,k,y,j,temp;\n scanf(\"%d\",&n);\n for(i=1; i<=n; i++)\n scanf(\"%d\",&a[i]);\n for(j=1; ja[k+1])\n {\n temp=a[k+1];\n a[k+1]=a[j];\n a[j]=temp;\n }\n\n }\n }\n for(y=1; y<=n; y++)\n printf(\"%d \",a[y]);\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include\n#define num 101\n main()\n{ int a,b,d,e,f,ss;\n int c[100];\n\n while(scanf(\"%d\",&a)!=EOF)\n {\n for(b=1;b<=a;b++)\n {scanf(\"%d\",&c[b]);}\n for(d=1; dc[e])\n {\n ss=c[d];\n c[d]=c[e];\n c[e]=ss;\n }\n\n\n\n }\n }\n for(f=1; f<=a; f++)\n {\n printf(\"%d\",c[f]);}}\n}\n\n\n"}, {"source_code": "#include\nint main()\n{\n int n,a[101],i,m,k,y,j,temp;\n scanf(\"%d\",&n);\n for(i=1; i<=n; i++)\n scanf(\"%d\",&a[i]);\n for(j=1; ja[k+1])\n {\n temp=a[k+1];\n a[k+1]=a[j];\n a[j]=temp;\n }\n\n }\n }\n for(y=1; y<=n; y++)\n printf(\"%d \",a[y]);\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include\nint main()\n{\n int n,s[501],i,j,temp;\n scanf(\"%d\",&n);\n for(i=0;is[j+1]){\n temp=s[j];\n s[j]=s[j+1];\n s[j+1]=temp;\n }\n }\n }\n for(i=0;i\n\n\nint main (){\n\nint caja[120];\nint x,j,b,aux;\n\nscanf(\"%d\",&b);\n\nfor(x=0;xcaja[j+1]){\n aux=caja[j];\n caja[j]=caja[j+1];\n caja[j+1]=aux;\n\n }\n\n }\n\n }\n\n\n\n\n for(j=0;j\n\nint main()\n{\n int n,x,s,aux;\n int caja[200];\n\n\n scanf(\"%d\",&n);\n\n for(x=0;xcaja[s+1]){\n\n aux=caja[s];\n caja[s]=caja[s+1];\n caja[s+1]=aux;\n }\n\n }\n\n\n }\n\n\n for(x=0;x\n\nint main()\n{\n int n,x,s,aux;\n int caja[1000];\n\n\n scanf(\"%d\",&n);\n\n for(x=0;xcaja[s+1]){\n\n aux=caja[s];\n caja[s]=caja[s+1];\n caja[s+1]=aux;\n }\n\n }\n\n\n }\n\n\n for(x=0;x\n#include \nint main()\n{\n int n,max;\n scanf(\"%d\",&n);\n int a[n];\n for(int i=0;imax)\n max=a[i]; \n }\n int b[max];\n for(int i=0;i<=max;i++){\nb[i]=0;\n}\nfor(int i = 0;i=0;i--){\n\nprintf(\"%d\",c[i]);\nprintf(\" \");\n}\n\n}"}, {"source_code": "#include\nint main()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n int arr[n];\n for(i=0;i\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a[n];\n for(int i=0;i //To include standard input and output.\n\n/*Defining a function to swap two numbers.*/\nvoid swap(int *x, int *y)\n{\n int z; //defining a temporary variable.\n z=*x; //storing the value at address of x in z\n *x=*y; //assigning the value at address of y to the value at address of x.\n *y=z; //assigning the stored value of *x to the value at address of y.\n}\n\n/*Defining a function Break to divide the array into two parts.*/\nvoid Break(int a[], int x, int y) //x and y are the start and end point of array or part of array.\n{\n if(y>x) //base condition for recursion.\n {\n int i=x, j=y-1; //i and j are the index for comparing.\n while(ia[y]) //checking the condition.\n {\n swap(&a[i], &a[j]); //swapping numbers at index i and j.\n j--; //decreasing j if swapping happen.\n }\n else\n i++; //incrementing i if swapping is not done.\n }\n if(a[j]>a[y])\n swap(&a[j], &a[y]); //swapping the last number according to condition.\n else\n swap(&a[j+1], &a[y]); //swapping the last number according to condition.\n\n Break(a, x, j-1); //Recursively calling the function for a smaller part of array.\n Break(a, j+1, y); //Recursively calling the function for a smaller part of array.\n }\n}\n\nint main() //Starting the main function.\n{\n int n, i;\n //printf(\"Enter the number of elements to be sorted :\\n\");\n scanf(\"%d\", &n); //Storing the number of elements in n.\n int a[n]; //Defining an array of length n\n //printf(\"Enter the numbers :\\n\");\n for(i=0;i arr[j])\n temp = arr[i];\n arr[i] = arr[j];\n arr[j] = temp;\n }\n }\n for (i = 0; i < x; i++)\n {\n printf(\"%d \",arr[i]) ;\n }\n\n\n return 0;\n}"}, {"source_code": "#include\n#include\nint main()\n{\n int *arr, n, i, j, temp;\n scanf(\"%d\",&n);\n arr = (int*)malloc(n*sizeof(int));\n for(i = 0; i < n; i++)\n scanf(\"%d\", &arr[i]);\n for(i = 0; i < n; i ++)\n {\n for(j = 0; j < (n-1-i) ; j++)\n {\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 for(i = 0; i < n; i++)\n printf(\"%d \", arr[i]);\n return 0; \n}"}, {"source_code": "#include\n#include\nint main()\n{\n int arr[10],i,j,n,temp=0;\n scanf(\"%d\",&n);\n for(i=0;iarr[j])\n {\n temp= arr[i];\n arr[i]=arr[j];\n arr[j]=temp;\n }\n }\n }\n for(i=0;i\n#include\nint main(){ \n int i,n,j,t;\n scanf(\"%d\",&n);\n int a[i];\n for(i=0;i\nint main()\n{\n\tint i,n,a[100],j,temp;\n\tscanf(\"%d\",&n);\n\tfor(i=0;ia[j+1])\n\t\t\t{\n\t\t\t\ttemp=a[j];\n\t\t\t\ta[j]=a[j+1];\n\t\t\t\ta[j]=temp;\n\t\t\t}\n\t\t}\n\t}\n\tfor(i=0;i\nint main(){\n\tint n,i,b,j,k;\n\tint m[100][100],m2[100][100];\n\tscanf(\"%d\",&n);\n\tfor(i=0;i-1+(n-r[i]);j--){\n\t\t\tm2[i][j]=1;\n\t\t}\n\t}\n\t\n//\tprintf(\"\\n\");\n//\tfor(i=0;i\n#include \n\nint main()\n{\n int j,g,i,n;\n int a[100];\n scanf(\"%d\",&n);\n for(i=0;ia[j])\n {\n g=a[i];\n a[i]=a[j];\n a[j]=g;\n }\n\n }\n }\n for(i=0;i\nint main()\n{\n int m,meses[100],min,posmax,i,a;\n m=0;\n scanf(\"%d\", &a);\n for(i=1;i<=a;i++)\n scanf(\"%d\",&meses[i]);\n\n while (m\nint main()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n int ar[n];\n for(i=0;iar[n-1])\n {\n for(j=0;j=ar[j+1])\n {\n ar[j]--;\n ar[j+1]++;\n }\n }\n }\n else\n {\n for(j=0;jar[j+1])\n {\n ar[j]--;\n ar[j+1]++;\n }\n }\n }\n }\n for(i=0;i\n//using namespace std;\n\nint main()\n{\n\tint a[100],n,temp=0,i,j,k;\n\t\n\tscanf(\"%d\",&n);\n\tfor(i=0;ia[j+1])\n\t\t\t{\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\t}\t\n\tfor(k=0;k\n#include \n\n\n#define ARR_PRINT(arr, size) for(uint32_t i = 0; i < size; i++){ printf(\"%d \", arr[i]); }\n#define MAX_NUMS 100u\n\n\nvoid Sort(uint32_t * arr, uint32_t size);\nvoid Swap(uint32_t * a, uint32_t * b);\n\n\nint main(void)\n{\n\tuint32_t n = 0u;\n uint32_t nums[MAX_NUMS] = {0};\n \n scanf(\"%d\", &n);\n \n for(uint32_t i = 0u; i < n; i++)\n {\n scanf(\"%d\", &nums[i]);\n } /* end for */\n \n Sort(nums, n);\n \n ARR_PRINT(nums, n);\n \n\treturn 0;\n}\n\n\nvoid Swap(uint32_t * a, uint32_t * b)\n{\n uint32_t temp = *a;\n *a = *b;\n *b = temp;\n}\n\n\nvoid Sort(uint32_t * arr, uint32_t size)\n{\n \n uint8_t max_so_far = 0u;\n \n for(uint8_t key = (size - 1); key > 0 ; key--)\n {\n \n max_so_far = key;\n \n for(uint8_t head = 0u; head < key; head++ )\n {\n \n if(arr[head] > arr[key])\n {\n max_so_far = head;\n } /* end if */\n \n } /* end for */\n \n if(max_so_far != key)\n {\n /* swap key & max */\n Swap(&arr[max_so_far], &arr[key]);\n } /* end if */\n \n } /* end for */\n}"}, {"source_code": "#include\nvoid sort(int x,int n[])\n{\n\tfor (int i = 1; i <= x; i++)\n\t{\n \tint j = i;\n \twhile(j > 0 && n[j-1] > n[j]){\n \tint tmp = n[j];\n \tn[j] = n[j-1];\n \tn[j-1] = tmp;\n \tj--;\n \t}\t\n \t}\n \t\n \tfor (int i=1;i<=x;i++)\n \t{\n \t\tprintf(\"%d \",n[i]);\n\t}\n}\nint main()\n{\n\tint x;\n\tint n[101];\n\tscanf(\"%d\",&x);\n\t\n\tfor (int i=0;i\n#include \nint main()\n{\n\tint n,max;\n\tscanf(\"%d\",&n);\n\tint a[n];\n for(int i=0;imax)\n\t\tmax=a[i];\t\n\t}\n\tint b[max];\n\tfor(int i=0;i<=max;i++){\nb[i]=0;\n}\nfor(int i = 0;i=0;i--){\n\nprintf(\"%d\",c[i]);\nprintf(\" \");\n}\n\n}"}, {"source_code": "#include\nint main()\n{\nint n,i,j,t;\nint a[101];\nscanf(\"%d\",&n);\nfor (i =0 ;ia[j])\n\t\t{\n\t\t\tt = a[i];\n\t\t\ta[i]= a[j];\n\t\t\ta[j]= t;\n\t\t}\n\t\t}\n\t}\nfor (i =0 ;i\n\nint main() {\n\nint n;\n\nint sortArr(int *ptr, int n);\n\n//printf(\"please enter number of columns\\t\");\n\nscanf(\"%i\", &n);\n\nint a[n];\n\nint *ptr=&a[n];\n\nfor (int i=0; i\n\nint main(){\n int a;\n scanf(\"%d\",&a);\n if(a<3){\n printf(\"-1\");\n return 0;\n }\n for (int i=a;i>=1;i--){\n printf(\"%d \",i);\n }\n return 0;\n}"}, {"source_code": "#include \n\nint main()\n{\n int NumberOfBoxes;\n int boxes[100];\n int i,j,S;\n \n scanf(\"%d\",&NumberOfBoxes);\n \n\n for(i=0; iboxes[j+1]){\n S=boxes[j+1];\n boxes[j+1]=boxes[j];\n boxes[j]=S;\n \n }else{\n \n }\n \n }\n }\n for(int n=0; n\n#include \n\nint main()\n{\n int i, j, temp, nColumns, nCubes[101];\n\n scanf(\"%d\",&nColumns);\n\n for(i=0;inCubes[j+1]) {\n temp = nCubes[j];\n nCubes[j] = nCubes[j+1];\n nCubes[j+1] = temp;\n }\n }\n }\n\n for(i=0;i\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n int num[n+5], i;\n for (i=0; inum[i+1]){\n tem=num[i];\n num[i]=num[i+1];\n num[i+1]=tem;\n if (i!=0)\n i--;\n }\n \n }\n }\n \n else{\n i=0;\n do \n {\n while (num[i]>num[i+1]){\n tem=num[i];\n num[i]=num[i+1];\n num[i+1]=tem;\n if (i!=0)\n i--;\n }\n i++;\n }\n while (i>(n-1));\n }\n for (i=0; i\n#include\nmain()\n {\n int c,i,r;\n scanf(\"%d\",&c);\n int n[c],t,j,p[c];\n for(i=0;in[j])\n {\n t=n[i];\n n[i]=n[j];\n n[j]=t;\n }\n }\n }\n r=n[c-1];\n int m[r][c];\n for(j=0;j=0;i--)\n printf(\"%d \",n[i]);\n\n\n }\n"}, {"source_code": "#include\nint main()\n{int n,i,t;\nscanf(\"%d\",&n);\nint col[n];\nfor(i=0;icol[i+1])\n{t=col[i];\ncol[i]=col[i+1];\ncol[i+1]=t;\n}\nelse\ncontinue;\n}\nfor(i=0;i\n#include\nint main()\n{\n\tint n,c=0,i,j,a[101];\n\tscanf(\"%d\",&n);\n\tfor(i=0;ia[j+1])\n\t {\n\t c=a[j];\n\t a[j]=a[j+1];\n\t a[j+1]=c;\n\t }\n\t }\n\t}\n\t\tfor(i=0;i\n#include\nint main()\n{\n\tint n,c=0,i,j,a[101];\n\tscanf(\"%d\",&n);\n\tfor(i=0;ia[j+1])\n\t {\n\t c=a[j];\n\t a[j]=a[j+1];\n\t a[j+1]=c;\n\t }\n\t }\n\t}\n\t\tfor(i=0;i\nint main(){\n\tint sum=0,i,j,k,l,m,n,p,a[105][105] = {0};\n\tscanf(\"%d\",&n);\n\tfor(i=1;i<=n;i++) {\n\t\tscanf(\"%d\",&k);\n\t\tfor(p=1;p<=k;p++)\n\t\t\ta[p][i] = 1;\n\t}\n\tfor(i=1;i<=4;i++){\n\t\tfor(j=1;j<=4;j++);\n\t//\t\tprintf(\"%d\",a[i][j]);\n\t//\tprintf(\"\\n\");\n\t}\n\tfor(i==100;i>=1;i--) {\n\t\tfor(j=n;j>=1;j--) {\n\t\t\tif(a[i][j] == 1) {\n\t\t\t\tk = j;\n\t\t\t\twhile(k\n#include\n#include\nint cmp(const void *a,const void *b)\n{\n return (*(int*)a-*(int*)b);\n}\nint main ()\n{\n int n,i,a[102];\n scanf(\"%d\",&n);\n for(i=0;i\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a[n];\n for(int i=0;i arr[j])\n temp = arr[i];\n arr[i] = arr[j];\n arr[j] = temp;\n }\n }\n for (i = 0; i < x; i++)\n printf(\"%d \",arr[i]);\n \n return 0;\n}"}, {"source_code": "#include\n\nvoid gravity(int c[],int n){\n if(n==1)\n return ;\n int max=0,i,k;\n for(i=0;i\nint main()\n{\n long long int a,i,b,c,j,k,n=0,m=0;\n scanf(\"%lld%lld%lld\",&a,&b,&c);\n j=a/c*(a%c);\n k=b/c*(b%c);\n printf(\"%lld\\n\",j*k);\n return 0;\n}*/\n/*#include\nint main()\n{\n long long int a,b,c,m,n;\n int v,k;\n scanf(\"%lld%lld%lld\",&a,&b,&c);\n m=a/c;\n if(a%c)\n //v=a;\n m++;\n n=b/c;\n if(b%c)\n //k=b;\n n++;\n printf(\"%lld\\n\",m);\n return 0;\n}*/\n#include\nint main()\n{\n int arr[4],i,a,k,temp,j;\n for(j=1;j<=2;j++){\n scanf(\"%d\",&a);\n for(i=0;iarr[k])\n {\n temp=arr[i];\n arr[i]=arr[k];\n arr[k]=temp;\n }\n\n }\n printf(\"%d\\n\",arr[i]);}\n }\n\n return 0;\n}\n\n\n"}, {"source_code": "#include \nvoid quickSort(int a[], int low, int high);\nvoid swap(int *a, int *b);\nint split(int a[], int low, int high);\nint main(){\n int n;\n int columns[100];\n scanf(\"%d\", &n);\n for(int i = 0; i < n; i++){\n scanf(\"%d\", &columns[i]);\n }\n\n}\nvoid quickSort(int a[], int low, int high){\n\tint middle;\n\n\tif (low >= high)\n\t\treturn;\n\n\tmiddle = split(a, low, high);\n\tquickSort(a, low, middle -1);\n\tquickSort(a, middle + 1 , high);\n}\n\nint split(int a[], int low, int high){\n\tint pivot = a[high];\n\n\twhile (1){\n\t\t while (low < high && a[low] <= pivot)\n\t\t\t low++;\n\t\t swap(&a[high--], &a[low]);\n\t\t while (low < high && a[high] >= pivot)\n\t\t\t high--;\n\t\t swap(&a[low++], &a[high]);\n\t\t if (high <= low)\n\t\t\t break;\n\t}\n\treturn high; // low --> middle - 1 , middle\n\t\t\t\t// high --> middle - 1 , middle + 1\n\t\t\t\t// beacuse low decrements before the break \n}\n\nvoid swap(int *a, int *b){\n int temp = *a;\n *a = *b;\n *b = temp;\n}\n"}, {"source_code": "#include\nint main()\n{\nint n;\nscanf(\"%d\",&n);\nint ar[n],i,tmp;\nfor(i=0;iar[j+1])\n\n {\n\n tmp=ar[j];\n\n ar[j]=ar[j+1];\n\n ar[j+1]=tmp;\n }\n }\n\n }\n for(i=0;i\nint main()\n{\nint n,a[101],i,j,temp;\nscanf(\"%d\",&n);\nfor(i=0;i=0;j--)\n {if(a[j-1]>a[j])\n {temp=a[j];\n a[j]=a[j-1];\n a[j-1]=temp;}\n }\n}\nfor(i=0;i\n#include \nint main()\n{\n int n,max;\n scanf(\"%d\",&n);\n int a[n];\n for(int i=0;imax)\n max=a[i]; \n }\n int b[max];\n for(int i=0;i<=max;i++){\nb[i]=0;\n}\nfor(int i = 0;i=0;i--){\n\nprintf(\"%d\",c[i]);\nprintf(\" \");\n}\n\n}"}, {"source_code": "#include \n#include \n#include \n#include \n\nvoid* mergesortRecursive(void* arg);\nvoid mergesortHelper(int l,int mid,int r);\ntypedef struct mergeRecData\n{\n int l;\n int r;\n} mergeRecData;\n\n\nint n;\nint* arr;\nint* sorted;\n\nint main()\n{\n scanf(\"%d\",&n);\n arr=(int*)malloc(sizeof(int)*n);\n sorted=(int*)malloc(sizeof(int)*n);\n int i=0;\n for(i=0; il=0, data->r=n-1;\n\n clock_t start,end;\n start=clock();\n mergesortRecursive(data);\n end=clock();\n for(i=0; ilr)\n {\n mergeRecData* leftData=(mergeRecData*)malloc(sizeof(mergeRecData));\n mergeRecData* rightData=(mergeRecData*)malloc(sizeof(mergeRecData));\n pthread_t threads[2];\n int mid=(data->l+data->r)/2;\n leftData->l=data->l, leftData->r=mid;\n rightData->l=mid+1, rightData->r=data->r;\n int rvl=pthread_create(&threads[0],NULL,mergesortRecursive,leftData);\n int rvr=pthread_create(&threads[1],NULL,mergesortRecursive,rightData);\n\n int jl=pthread_join(threads[0],NULL);\n int jr=pthread_join(threads[1],NULL);\n if(rvl!=0||rvr!=0||jl!=0||jr!=0)\n printf(\"\\nerrroooooorrrr!!!!!!!\\n\");\n mergesortHelper(data->l,mid,data->r);\n }\n}\nvoid mergesortHelper(int l,int mid,int r)\n{\n\n\n int i,j=l,z=mid+1;\n\n\n\n for(i=l; i<=r; i++)\n {\n if(j<=mid && z<=r)\n {\n if(arr[j]r)\n {\n for(i=i; i<=r; i++)\n {\n sorted[i]=arr[j];\n\n j++;\n }\n break;\n }\n else\n {\n for(i=i; i<=r; i++)\n {\n sorted[i]=arr[z];\n\n z++;\n }\n break;\n }\n }\n\n\n for(int i=l; i<=r; i++)\n {\n arr[i]=sorted[i];\n }\n\n}\n"}, {"source_code": "int main() {\n int i,j,n;\n scanf(\"%d\",&n);\n int *dizi=(int*) malloc(sizeof(int)*n);\n for(i=0;i-1;j--)\n while(dizi[i]>dizi[j]) {\n dizi[i]--;\n dizi[j]++;\n }\n for(i=0;i\nvoid sort(int x,int n[])\n{\n\tfor (int i = 1; i <= x; i++)\n\t{\n \tint j = i;\n \twhile(j > 0 && n[j-1] > n[j]){\n \tint tmp = n[j];\n \tn[j] = n[j-1];\n \tn[j-1] = tmp;\n \tj--;\n \t}\t\n \t}\n \t\n \tfor (int i=1;i<=x;i++)\n \t{\n \t\tprintf(\"%d \",n[i]);\n\t}\n}\nint main()\n{\n\tint x;\n\tint n[101];\n\tscanf(\"%d\",&x);\n\t\n\tfor (int i=0;i\nint main()\n{\nint n,a[101],i,j,temp;\nscanf(\"%d\",&n);\nfor(i=0;i=0;j--)\n{if(a[j-1]>a[j])\n {temp=a[j];\n a[j]=a[j-1];\n a[j-1]=temp;}\n}\n}\nfor(i=0;i\nint main()\n{\n int block[100] , n , i , j , temp;\n scanf(\"%d\", &n);\n for(i = 0 ; i < n ; i++)\n {\n scanf(\"%d\" , &block[i]);\n }\n\n block[i] = '\\0';\n\n for(i = 0 ; i < n ; i++)\n {\n for(j = i + 1 ; j < n ; j++)\n {\n if(block[j-1] >= block[j])\n {\n\n temp = block[i];\n block[i] = block[j];\n block[j] = temp;\n }\n }\n }\n for(i = 0 ; i < n ; i++)\n {\n printf(\"%d \" , block[i]);\n }\n\n}"}, {"source_code": "#include \n#include \n\nint main()\n{\n int n,i,j,arr[100],flag,temp;\n scanf(\"%d\",&n);\n for(i=0; i100)\n {\n flag=1;\n }\n }\n for(i=0; i=1&&n<=100&&flag!=1)\n {\n for(i=0;i\nint main(){\n int i,j,a,h,n;\n scanf(\"%d\",&n);\n int arr[n];\n for(i=0;i0 && arr[h-1]>a;h--){\n arr[h]=arr[h-1];\n }\n arr[h]=a;\n }\n for(i=0;i\nint main()\n{\n int n;\n scanf(\"%d\\n\",&n);\n int a[n];\n for(int i=0;i\nint main(){\n int n;\n scanf(\"%d\",&n);\n int a[n];\n for (int i=0;ia[j+1])\n temp=a[i];\n a[i]=a[j];\n a[j]=temp;\n }\n }\n for (int i=0;i\nint main()\n{\n int n,a[101],i,m,k,y,j,temp;\n scanf(\"%d\",&n);\n for(i=1; i<=n; i++)\n scanf(\"%d\",&a[i]);\n for(j=1; ja[k+1])\n {\n temp=a[k+1];\n a[k+1]=a[j];\n a[j]=temp;\n }\n\n }\n }\n for(y=1; y<=n; y++)\n printf(\"%d \",a[y]);\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include \n\nint main()\n{\n int n,x,s,aux;\n int caja[1000];\n\n\n scanf(\"%d\",&n);\n\n for(x=0;xcaja[s+1]){\n\n aux=caja[s];\n caja[s]=caja[s+1];\n caja[s+1]=aux;\n }\n\n }\n\n\n }\n\n\n for(x=0;x\nint main()\n{\nint n,i,j,t;\nint a[101];\nscanf(\"%d\",&n);\nfor (i =0 ;ia[j])\n\t\t{\n\t\t\tt = a[i];\n\t\t\ta[i]= a[j];\n\t\t\ta[j]= t;\n\t\t}\n\t\t}\n\t}\nfor (i =0 ;i\n#include\n#include\nint cmp(const void *a,const void *b)\n{\n return (*(int*)a-*(int*)b);\n}\nint main ()\n{\n int n,i,a[102];\n scanf(\"%d\",&n);\n for(i=0;i\n//using namespace std;\n\nint main()\n{\n\tint a[1000],n,temp=0,i,j,k;\n\t\n\tscanf(\"%d\",&n);\n\tfor(i=0;ia[j+1])\n\t\t\t{\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\t}\t\n\tfor(k=0;k\n\nint main(void)\n{\n int n,i,j,tp,a[1000];\n scanf(\"%d\",&n);\n for (i=0;itp && j>0) a[j]=a[j-1], j--;\n a[j]=tp;\n }\n for (i=0;i